Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Widgets - General questions or Mixed problems » MinSize and ParentCtrl
Re: MinSize and ParentCtrl [message #14140 is a reply to message #14106] Thu, 14 February 2008 20:53 Go to previous messageGo to previous message
mirek is currently offline  mirek
Messages: 14261
Registered: November 2005
Ultimate Member
[quote title=mrjt wrote on Mon, 11 February 2008 06:11]I know I've mentioned this before, but this is still really bugging me. I honestly believe that it would be a substantial improvement if ParentCtrl had SetMinSize functionality as in TopWindow:
struct ParentCtrl : public Ctrl {
	virtual Rect   GetVoidRect();
	virtual Size   GetStdSize() const;

	virtual void SetMinSize(Size sz)	{ minsize = sz; }
	virtual Size GetMinSize() const		{ return IsNull(minsize) ? Ctrl::GetMinSize() : minsize; }

	ParentCtrl();
private:
	Size minsize;
};

(StaticCtrl.h)
Rect ParentCtrl::GetVoidRect()
{
	return GetSize();
}

Size ParentCtrl::GetStdSize() const
{
	return GetMinSize();
}

ParentCtrl::ParentCtrl()
{
	NoWantFocus();
	Transparent();
	minsize = Null;
}
(Static.cpp)
If not a modified ParentCtrl, can we at least have a different Ctrl with this functionality in CtrlLib please (MinSizeCtrl or LayoutCtrl)?

OK. Please check whether I have done some bug adopting it to my tasted a little:


class ParentCtrl : public Ctrl {
	Size minsize;

public:
	virtual Rect   GetVoidRect();
	virtual Size   GetStdSize() const;
	virtual Size   GetMinSize() const;

	void    SetMinSize(Size sz)         { minsize = sz; }

	ParentCtrl();
};

Rect ParentCtrl::GetVoidRect()
{
	return GetSize();
}

Size ParentCtrl::GetStdSize() const
{
	return GetMinSize();
}

Size ParentCtrl::GetMinSize() const
{
	return IsNull(minsize) ? Ctrl::GetMinSize() : minsize;
}

ParentCtrl::ParentCtrl()
{
	NoWantFocus();
	Transparent();
	minsize = Null;
}



Quote:

I'm getting tired of adding it myself Smile


BTW:

template<class T>
class WithMinSize {
	Size minsize;

public:
	void SetMinSize(Size sz)	{ minsize = sz; }

	virtual Size GetMinSize() const		{ return IsNull(minsize) ? Ctrl::GetMinSize() : minsize; }

	WithMinSize() { minsize = Null; }
};


Mirek
 
Read Message
Read Message
Read Message
Previous Topic: Scrolling in tabs
Next Topic: Printing using RichEditWithToolBar and PrinterJob on the same sheep of paper?
Goto Forum:
  


Current Time: Sat Jun 07 19:21:33 CEST 2025

Total time taken to generate the page: 0.04445 seconds