Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - AlexxanderX

#1
Feature requests / Re: Table
15 January 2016, 11:44:54
So I made time to finish the table. Why would you want to combine the size function with the position function? I want to say that updateWidgetPosition() is pretty frequently called and would be useless, only if somehow check if the size changed. What I need to resolve? I will also add comments in order to explain what I do.
#2
Feature requests / Re: Table
26 December 2015, 11:34:17
Sorry for late response. I will try it, but Monday, after all the feast past.
#3
Feature requests / Re: Table
23 December 2015, 20:13:15
Yes, there should be some calculations when the font or characters size is changed.

I don't really remember why I have chosen BoxLayout instead of VerticalLayout, but I think because I entirely rewrite the updateWidgetPositions(), so it's no more a legit VerticalLayout, but something else.

Well, need to think on this...

Yes, I never thought of the function returning nullptr.

I created the class TableItem for alignment of the widget. If you think would be easier to manage the alignment of every item of row in TableRow then go ahead. I already implemented some basic code for the events but don't work very well so I don't added in the repository.
#4
Feature requests / Re: Table
23 December 2015, 16:56:54
Done ;)
#5
Feature requests / Re: Table
14 December 2015, 14:55:35
In the time I will still work on it, but yea, pretty busy week here too :D
#6
Feature requests / Re: Table
14 December 2015, 14:51:48
I don't have much time to finish the table so I upload the work: https://bitbucket.org/AlexxanderX/tguitable. Some notes:

  • setTextColor() from Table and setNormalTextColor() from TableRow are not finished, need to think how to set it because it may not contain only labels;
  • With the getCustomHeight() from TableRow I check if the row contains widgets bigger then the label( a button). If is not bigger then in the Table's insert() I check it;
  • I separated the sizing of rows from Table's updateWidgetPositions() in order to make work the custom row sizes;
  • TableItem's mouseOnWidget() doesn't work, I don't really investigated to much how should be in order widgets like button to work
  • TableItem's Align::None is just for internal coding: in order to know if need to use the set align in adds function from TableRow
#7
Feature requests / Re: Table
13 December 2015, 21:07:32
Don't worked too much today, but on what I worked I encountered a problem: I need to get the ratio for a widget but I can't find a function like getRatio() in BoxLayout.
#8
Feature requests / Re: Table
12 December 2015, 16:13:23
"std::static_pointer_cast" is working. My bad: I called the function before rows were added. Here is a nicer table:
#9
Feature requests / Re: Table
12 December 2015, 15:40:23
I wants to do something like "setRowsColor()" but how to change Widget::Ptr to TableRow::Ptr? Tried "std::static_pointer_cast" but doesn't work( it compile, but have no effect). I think a solution is to make a template from class Container with default template argument a Widget::Ptr. With a template Container I can set the Table to accept only TableRows from functions add, insert.
#10
Feature requests / Re: Table
12 December 2015, 10:16:16


Now working on adding any widget to TableRow and next I will do some "hover effect" when mouse is over a row. After I will clean the code I will upload it. The only thing that is not really good( or maybe I'm wrong) is that the user need to call: table->setFontSize(18, mGui.getFont()); in order to everything to work properly.

The header is a separated TableRow( is not added in the container) because in the future, when you will wants to add a scroll option you will want to have the header visible and only the content rows to move.

Still need to think how to do with the size of columns: if user add a button with size bigger then the table. I think of adding a function in table in which to say if to set the table row height to 'fixed' or 'auto' and if is fixed to set all the widgets size to that size, and if auto, the table to check what is the biggest height and apply to all rows.
#11
Feature requests / Re: Table
12 December 2015, 08:25:48
This was my first try:
virtual void draw(sf::RenderTarget& target, sf::RenderStates states) const override {
            if (mWidget != nullptr) {
                target.draw(*mWidget, states);
            }
        }

But doesn't draw anything.

EDIT: Studying the Container's code I saw the function setFont() and implemented it and now the draw works.
#12
Feature requests / Re: Table
11 December 2015, 23:08:26
It is just a quick hack to make it work because I entered in some errors when inherited from a Widget and because of time I inherited from a BoxLayout.
QuoteE:/Work/Programare/Libs/SFML/include/SFML/Graphics/Drawable.hpp: In member function 'virtual void tgui::TableItem::draw(sf::RenderTarget&, sf::RenderStates) const':
E:/Work/Programare/Libs/SFML/include/SFML/Graphics/Drawable.hpp:69:18: error: 'virtual void sf::Drawable::draw(sf::RenderTarget&, sf::RenderStates) const' is protected
     virtual void draw(RenderTarget& target, RenderStates states) const = 0;
                  ^
E:\Work\Programare\Apps\CPP\Katan\Client\src\xalTGUI\TableItem.cpp:19:37: error: within this context
         mWidget->draw(target, states);
#13
Feature requests / Re: Table
11 December 2015, 22:46:10
I made some progress: I created a TableItem which is a BoxLayout which contains only 1 widget, with the possibility to set the align of widget(left, center, right)( not done, only center)( it would be nice if you would add padding properties to BoxLayout). Then in the TableRow(HorizontalLayout) you can add directly TableItem through a function which take a std::string or to add another widget( like a button). The class Table(BoxLayout) take the TableRow and put it one another other. Now I need to rewrite the Table's draw() to can add table bars between columns and rows.
#14
Feature requests / Re: Table
11 December 2015, 16:04:55
I think I need to do the modifications in updateWidgetPositions() or somewhere after the user add it to the gui, so we have the font.
#15
Feature requests / Re: Table
11 December 2015, 15:44:11
Yes, it should be a VerticalBox, but if is a VerticalBox then I think I need to resize table everytime a new row is added or to make every row fixed, because if I using VerticalBox and set the table size then every row is aligned in that space and not one below one. And I thinked if I only need to put one below one, then a for is enough so when updated not need to do all the calculations that are done in VerticalBox.

Now I need to see how to set the size of the Label because now It give me {100,100} and it need to be minimum for height.