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 » Splitter » Splitter::Reset and Splitter::Clear clarification
Splitter::Reset and Splitter::Clear clarification [message #24135] Mon, 28 December 2009 09:54 Go to next message
Tom1
Messages: 1212
Registered: March 2007
Senior Contributor
Hi,

The splitter would be easier to use if Splitter::Clear() would remove splitter wall positions and minimum sizes (pixel and relative) in addition to the child references. The minpx is currently not cleared at all, even if Splitter::Reset() is called.

Please change as follows:

void Splitter::Clear() {
	while(GetFirstChild())
		RemoveChild(GetFirstChild());

	pos.Clear();
	mins.Clear();
	minpx.Clear();
}

void Splitter::Reset() {
	Clear();
	style = -1;
	width = 4;
	vert = false;
}


Additionally, it would be very helpful, if removing a child by its Ctrl* would remove the respective pos, mins and minpx records in a way that frees the display area for the adjacent panels.

UPDATE:

I had something like this in mind for removing a panel:

void   Splitter::Layout() {
	Size sz = GetSize();
	int count = GetChildCount();
	if(count == 0)
		return;
	
	if(mins.GetCount()<count) mins.SetCount(count,0); // Added
	if(minpx.GetCount()<count) minpx.SetCount(count,0); // Added
	
	count--;
	if(pos.GetCount() < count) {
		pos.SetCount(count, 0);
		for(int i = 0; i < count; i++)


and

void Splitter::Remove(Ctrl *ctrl) {
	int n=0;
	Ctrl *c=GetFirstChild();
	while(c){
		if(c==ctrl){
			if(c->GetNext()) pos.Remove(n);
			else if(n>=1) pos.Remove(n-1);
			mins.Remove(n);
			minpx.Remove(n);
			RemoveChild(ctrl);
			break;
		}
		c=c->GetNext();
		n++;
	}
}


// Tom

[Updated on: Mon, 28 December 2009 11:09]

Report message to a moderator

Re: Splitter::Reset and Splitter::Clear clarification [message #24160 is a reply to message #24135] Wed, 30 December 2009 11:30 Go to previous message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Tom1 wrote on Mon, 28 December 2009 03:54

Hi,

The splitter would be easier to use if Splitter::Clear() would remove splitter wall positions and minimum sizes (pixel and relative) in addition to the child references. The minpx is currently not cleared at all, even if Splitter::Reset() is called.

Please change as follows:

void Splitter::Clear() {
	while(GetFirstChild())
		RemoveChild(GetFirstChild());

	pos.Clear();
	mins.Clear();
	minpx.Clear();
}

void Splitter::Reset() {
	Clear();
	style = -1;
	width = 4;
	vert = false;
}


Additionally, it would be very helpful, if removing a child by its Ctrl* would remove the respective pos, mins and minpx records in a way that frees the display area for the adjacent panels.

UPDATE:

I had something like this in mind for removing a panel:

void   Splitter::Layout() {
	Size sz = GetSize();
	int count = GetChildCount();
	if(count == 0)
		return;
	
	if(mins.GetCount()<count) mins.SetCount(count,0); // Added
	if(minpx.GetCount()<count) minpx.SetCount(count,0); // Added
	
	count--;
	if(pos.GetCount() < count) {
		pos.SetCount(count, 0);
		for(int i = 0; i < count; i++)


and

void Splitter::Remove(Ctrl *ctrl) {
	int n=0;
	Ctrl *c=GetFirstChild();
	while(c){
		if(c==ctrl){
			if(c->GetNext()) pos.Remove(n);
			else if(n>=1) pos.Remove(n-1);
			mins.Remove(n);
			minpx.Remove(n);
			RemoveChild(ctrl);
			break;
		}
		c=c->GetNext();
		n++;
	}
}


// Tom


Well, why not. I have made some changes (the most important is to use reference instead of pointer in Remove to make it consistent with other methods).

Mirek
Previous Topic: Splitter::SetMinPixels() bug+fix
Next Topic: Splitter transparent background
Goto Forum:
  


Current Time: Fri Mar 29 00:37:03 CET 2024

Total time taken to generate the page: 0.01339 seconds