U++ framework
Do not panic. Ask here before giving up.

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 Go to previous message
mirek is currently offline  mirek
Messages: 14291
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
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: How to set the Constructor of a derived widget class?
Next Topic: OpenGL, SDL
Goto Forum:
  


Current Time: Sat May 09 19:09:39 GMT+2 2026

Total time taken to generate the page: 0.00542 seconds