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: New Callback WhenEndResize
Splitter: New Callback WhenEndResize [message #26823] Mon, 31 May 2010 17:27 Go to next message
tojocky is currently offline  tojocky
Messages: 607
Registered: April 2008
Location: UK
Contributor

Hello,

I propose to add new callback in Splitter class: WhenEndResize.

This callback is very important when i have a ImageCtrl or other control that takes time on refreshing data by resizing (raster size by ctrl size to a big image).

The patch is:
Index: uppsrc/CtrlLib/Splitter.cpp
===================================================================
--- uppsrc/CtrlLib/Splitter.cpp	(revision 2445)
+++ uppsrc/CtrlLib/Splitter.cpp	(working copy)
@@ -85,6 +85,10 @@
 	if(HasCapture() && mouseindex >= 0 && mouseindex < pos.GetCount()) {
 		SetPos(ClientToPos(p), mouseindex);
 		WhenAction();
+		
+		if(!is_captured){
+			is_captured = true;
+		}
 	}
 }
 
@@ -108,6 +112,11 @@
 }
 
 void   Splitter::LeftUp(Point p, dword keyflags) {
+	if(is_captured){
+		is_captured = false;
+		if(WhenEndResize)
+			WhenEndResize();
+	}
 	Refresh();
 }
 
@@ -249,6 +258,7 @@
 }
 
 Splitter::Splitter() {
+	is_captured = false;
 	style = -1;
 	pos.Add(5000);
 	width = 4;
Index: uppsrc/CtrlLib/Splitter.h
===================================================================
--- uppsrc/CtrlLib/Splitter.h	(revision 2445)
+++ uppsrc/CtrlLib/Splitter.h	(working copy)
@@ -7,7 +7,7 @@
 	virtual void   LeftUp(Point p, dword keyflags);
 	virtual Image  CursorImage(Point p, dword keyflags);
 	virtual void   Serialize(Stream& s);
-
+	Callback WhenEndResize;
 public:
 	struct Style : ChStyle<Style> {
 		Value vert[2], horz[2];
@@ -66,6 +66,8 @@
 
 	Splitter();
 	virtual ~Splitter();
+private:
+	bool is_captured;
 };
 
 class SplitterFrame : public CtrlFrame, private Ctrl {

Re: Splitter: New Callback WhenEndResize [message #26853 is a reply to message #26823] Wed, 02 June 2010 19:10 Go to previous messageGo to next message
tojocky is currently offline  tojocky
Messages: 607
Registered: April 2008
Location: UK
Contributor

tojocky wrote on Mon, 31 May 2010 18:27

Hello,

I propose to add new callback in Splitter class: WhenEndResize.

This callback is very important when i have a ImageCtrl or other control that takes time on refreshing data by resizing (raster size by ctrl size to a big image).

The patch is:
Index: uppsrc/CtrlLib/Splitter.cpp
===================================================================
--- uppsrc/CtrlLib/Splitter.cpp	(revision 2445)
+++ uppsrc/CtrlLib/Splitter.cpp	(working copy)
@@ -85,6 +85,10 @@
 	if(HasCapture() && mouseindex >= 0 && mouseindex < pos.GetCount()) {
 		SetPos(ClientToPos(p), mouseindex);
 		WhenAction();
+		
+		if(!is_captured){
+			is_captured = true;
+		}
 	}
 }
 
@@ -108,6 +112,11 @@
 }
 
 void   Splitter::LeftUp(Point p, dword keyflags) {
+	if(is_captured){
+		is_captured = false;
+		if(WhenEndResize)
+			WhenEndResize();
+	}
 	Refresh();
 }
 
@@ -249,6 +258,7 @@
 }
 
 Splitter::Splitter() {
+	is_captured = false;
 	style = -1;
 	pos.Add(5000);
 	width = 4;
Index: uppsrc/CtrlLib/Splitter.h
===================================================================
--- uppsrc/CtrlLib/Splitter.h	(revision 2445)
+++ uppsrc/CtrlLib/Splitter.h	(working copy)
@@ -7,7 +7,7 @@
 	virtual void   LeftUp(Point p, dword keyflags);
 	virtual Image  CursorImage(Point p, dword keyflags);
 	virtual void   Serialize(Stream& s);
-
+	Callback WhenEndResize;
 public:
 	struct Style : ChStyle<Style> {
 		Value vert[2], horz[2];
@@ -66,6 +66,8 @@
 
 	Splitter();
 	virtual ~Splitter();
+private:
+	bool is_captured;
 };
 
 class SplitterFrame : public CtrlFrame, private Ctrl {




Mirek, I attached the plain files
  • Attachment: Splitter.7z
    (Size: 2.76KB, Downloaded 365 times)
Re: Splitter: New Callback WhenEndResize [message #26854 is a reply to message #26853] Wed, 02 June 2010 19:59 Go to previous message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Well, I have simplified and renamed to WhenSplitFinish (to get the name inline with SliderCtrl) - other than that, it is done.
Previous Topic: Colored drag margin for Splitter
Next Topic: FIX: Drawing artefact Bar when zommed
Goto Forum:
  


Current Time: Tue Apr 16 06:19:23 CEST 2024

Total time taken to generate the page: 0.02455 seconds