|
|
Home » U++ Library support » U++ Widgets - General questions or Mixed problems » Missing Functions for Layouter
Missing Functions for Layouter [message #10722] |
Wed, 25 July 2007 10:34  |
Zardos
Messages: 62 Registered: April 2007
|
Member |
|
|
Hello,
because I'm more productive if I use layout manager and automatic gui layouting functions instead of moving widgets on the screen I started to programm some simple layouting stuff.
But soon I ran into problems. What I would need is a "GetOptSize()" functions for controls. This function should return the "optimum size" of a control. For example for a button it should take into account:
the used font
the label
the image
default margin
... Because there is nothing like a GetOptSize() for Ctrls I started to make my own outside of the class like this:
Size GetOptSize(Ctrl &c) {
Button *b = dynamic_cast<Button *>(&c);
if(b) {
Size s;
s = GetTLTextSize(WString(b->GetDesc()), StdFont());
s.cx += GUI_MARGIN * 2;
return s;
} else
return c.GetStdSize();
}
... well not nice, but it should work.
What I'm really missing are a function to get the used font for ctrls and for buttons a GetImage:
If I would start adding the following functions to button (and other controls):
GetFont();
GetImage();
...and create a patch would you accept it?
Or even better would you like to have a "virtual GetOptSize()" for Ctrls?
Or do you have any other suggestions?
- Ralf
|
|
|
|
Re: Missing Functions for Layouter [message #10724 is a reply to message #10723] |
Wed, 25 July 2007 10:47   |
Zardos
Messages: 62 Registered: April 2007
|
Member |
|
|
Yes, thanks.
I have found this functions. But as you wrote some of them are not correct.
Especially for buttons: It allways returns the same size regardless of the label and use image, font, etc...
So,
if I would start "fixing" the GetStdSize functions. Starting with the buttons, you would accept it?
I thought GetStdSize is made this way by itension (always return a "default" size - independent of the content). ...But of course if GetSdtSize means something like "optimum size" then we could start fixing the functions.
Edit:
Anyway, I could get around an "incorrect" GetStdSize with my own function. It would just be very helpful to have access to the used Iamge and the used font for a button. If I miss more for other controls I will mention it again in the forum.
- Ralf
[Updated on: Wed, 25 July 2007 11:01] Report message to a moderator
|
|
|
|
|
|
|
Re: Missing Functions for Layouter [message #10752 is a reply to message #10747] |
Fri, 27 July 2007 15:26   |
Zardos
Messages: 62 Registered: April 2007
|
Member |
|
|
luzr wrote on Fri, 27 July 2007 13:19 | Should not these constants rather be chameleon variables?
Why Pusher::GetStdSize?
|
Ok, I will move necessary constants to chameleon. I will also reduce the new constants to a minimum and remove all constants related to Layout engines.
Pusher: GetStdSize:
I thought if someone derives from it, there would be a - hopefully - usable GetStdSize.
But no problem I will remove it.
Additional changes I discovered useful while programming my layouter:
I will more concentrate on GetMinSize(), because here it is relative clear what is meant: The minimum size which will not truncate an information (labels, text, ...).
For some controls - like buttons - I will supply GetStdSize().
For example I will add a small margin to the left and right of the button and make sure the button has a minimum default size.
Since my layouter is nearly complete I will soon start with checking and implementing GetMinSize(), GetStdSize() for some other controls and post the new patch for review.
I leave out GetMaxSize completely, because currently I have no clue what could be useful values for it.
Thanks,
Ralf
|
|
|
|
Goto Forum:
Current Time: Mon Apr 28 19:21:12 CEST 2025
Total time taken to generate the page: 0.03844 seconds
|
|
|