Home » U++ Library support » U++ Widgets - General questions or Mixed problems » FrameAddSize(Size& sz) really needed?
Re: FrameAddSize(Size& sz) really needed? [message #3706 is a reply to message #3704] |
Wed, 14 June 2006 17:45  |
 |
mirek
Messages: 14266 Registered: November 2005
|
Ultimate Member |
|
|
Werner wrote on Wed, 14 June 2006 09:52 |
luzr wrote on Mon, 12 June 2006 18:48 | Well, as I said before, it is not needed until some situation expects the right value....
One of such situations is e.g. when creating TopWindow with layout
MyWin::MyWin()
{
SetFrame(MyFrame);
CtrlLayout(*this, "");
}
Now try to make MyFrame quite thick (e.g. 50 pixels) and do not implement AddFrameSize.
Mirek
|
Yes!
CtrlLayout calls AddFrameSize ...
template <class T> // In TopWindow.h
void CtrlLayout(T& ctrl)
{
InitLayout(ctrl, ctrl, ctrl, ctrl);
Size sz = ctrl.AddFrameSize(T::GetLayoutSize());
ctrl.SetMinSize(sz);
ctrl.SetRect(sz);
}
... and AddFrameSize in turn calls FrameAddSize ...
Size Ctrl::AddFrameSize(int cx, int cy) const // In CtrlPos.cpp
{
Size sz = Size(cx, cy);
for(int i = frame.GetCount() - 1; i >= 0; i--)
frame[i].frame->FrameAddSize(sz);
return sz;
}
Sorry for the inconvenience!
Werner
|
Do not worry, keep digging.
Actually, AddFrameSize is really rarely used and in fact was added years after Frame interface first emerged to provide clean solution to similar corner-cases...
Mirek
|
|
|
Goto Forum:
Current Time: Fri Jul 18 10:48:32 CEST 2025
Total time taken to generate the page: 0.03315 seconds
|