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
MinSize and ParentCtrl [message #14106] Mon, 11 February 2008 12:11 Go to next message
mrjt is currently offline  mrjt
Messages: 705
Registered: March 2007
Location: London
Contributor
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)? I'm getting tired of adding it myself Smile
Re: MinSize and ParentCtrl [message #14140 is a reply to message #14106] Thu, 14 February 2008 20:53 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
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
Re: MinSize and ParentCtrl [message #14180 is a reply to message #14140] Mon, 18 February 2008 10:50 Go to previous message
mrjt is currently offline  mrjt
Messages: 705
Registered: March 2007
Location: London
Contributor
No bugs. Thanks.

Quote:

BTW:

The issue isn't realy having to do it in lots of places (I already have a template), but that there is nothing in CtrlLib that does it. This makes distributing sample code that used it more difficult, and I thought it should be available anyway. Specifically this is necessary for custom layout code that include Layout templates, but can useful in many other situations.

Thanks again.
James

[Updated on: Mon, 18 February 2008 10:50]

Report message to a moderator

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


Current Time: Sun Apr 28 23:15:27 CEST 2024

Total time taken to generate the page: 0.04245 seconds