I'm currently working on something I really need and I call it "semi-automatic resize handling". The idea is very simple:
classs GuiManager
{
std::map<tgui::Widget::Ptr, ResizeBehaviour> widgets; //I store pointers to widget in this class
};
struct ResizeBehaviour
{
bool changeX = false;
bool changeY = false;
bool changeWidth = false;
bool changeHeight = false;
};
Then we have function:
GuiManger::handleResize(int deltaX, int deltaY) //called when resize SFML event happens
{
//when a widget has for example changeX set to true
//then widget->x += deltaX etc.
}
This allows for very basic layouting (altough I use similar method and it works very well for handling resizing in gui!).
My problem is that tgui::Widget doesn't have virtual set/get Size function. Thus I can't make it as simple as in the above code.
What is the reason why there can't be even empty virtual setSize function in widget? Basically every widget has its size (unless it's container widget and then we can happily don't implement the virtual function body).
It's very simple way of handling basically the biggest TGUI problem (at least for me) and after some tuning (this code isn't really integrated into TGUI) I could write a patch.
However I really need that size in tgui::Widget class. Is it possible to place empty virtual function in the class? I think it won't hurt.
If it's not possible, do you have any other idea how I can workaround it?