tGtkPaned widgets now functional in Windows client - vaccinewars - be a doctor … | |
git clone git://src.adamsgaard.dk/vaccinewars | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit b0542e47a9251335615fedb5f2e8f7f5752d1a2b | |
parent 026ccc65062042d38013c968c0cfe2d08ebff24c | |
Author: Ben Webb <[email protected]> | |
Date: Thu, 18 Jan 2001 20:17:21 +0000 | |
GtkPaned widgets now functional in Windows client | |
Diffstat: | |
M src/gtk.c | 22 ++++++++++++++++++++++ | |
M src/gtk.h | 2 ++ | |
2 files changed, 24 insertions(+), 0 deletions(-) | |
--- | |
diff --git a/src/gtk.c b/src/gtk.c | |
t@@ -591,6 +591,7 @@ LRESULT CALLBACK GtkPanedProc(HWND hwnd,UINT msg,UINT wPar… | |
HPEN oldpen,dkpen,ltpen; | |
RECT rect; | |
HDC hDC; | |
+ gint newpos; | |
GtkPaned *paned; | |
paned=GTK_PANED(GetWindowLong(hwnd,GWL_USERDATA)); | |
switch(msg) { | |
t@@ -637,6 +638,15 @@ LRESULT CALLBACK GtkPanedProc(HWND hwnd,UINT msg,UINT wPa… | |
if (!paned||!paned->Tracking) break; | |
ReleaseCapture(); | |
paned->Tracking=FALSE; | |
+ GetClientRect(hwnd,&rect); | |
+ if (rect.right > rect.bottom) { | |
+ newpos=((gint16)HIWORD(lParam)+GTK_WIDGET(paned)->allocation.y- | |
+ paned->true_alloc.y)*100/paned->true_alloc.height; | |
+ } else { | |
+ newpos=((gint16)LOWORD(lParam)+GTK_WIDGET(paned)->allocation.x- | |
+ paned->true_alloc.x)*100/paned->true_alloc.width; | |
+ } | |
+ gtk_paned_set_position(paned,newpos); | |
return TRUE; | |
default: | |
return DefWindowProc(hwnd,msg,wParam,lParam); | |
t@@ -3703,6 +3713,8 @@ void gtk_vpaned_set_size(GtkWidget *widget,GtkAllocation… | |
gint16 alloc; | |
GtkAllocation child_alloc; | |
+ memcpy(&paned->true_alloc,allocation,sizeof(GtkAllocation)); | |
+ | |
alloc=allocation->height-paned->handle_size; | |
child=paned->children[0].widget; | |
t@@ -3733,6 +3745,7 @@ void gtk_hpaned_set_size(GtkWidget *widget,GtkAllocation… | |
gint16 alloc; | |
GtkAllocation child_alloc; | |
+ memcpy(&paned->true_alloc,allocation,sizeof(GtkAllocation)); | |
alloc=allocation->width-paned->handle_size; | |
child=paned->children[0].widget; | |
t@@ -4049,3 +4062,12 @@ void gtk_window_handle_auto_size(GtkWindow *window, | |
allocation->height=widget->allocation.height; | |
} | |
} | |
+ | |
+void gtk_paned_set_position(GtkPaned *paned,gint position) { | |
+ GtkAllocation allocation; | |
+ if (position<0) position=0; | |
+ if (position>100) position=100; | |
+ paned->handle_pos=position; | |
+ memcpy(&allocation,&paned->true_alloc,sizeof(GtkAllocation)); | |
+ gtk_widget_set_size(GTK_WIDGET(paned),&allocation); | |
+} | |
diff --git a/src/gtk.h b/src/gtk.h | |
t@@ -216,6 +216,7 @@ struct _GtkPanedChild { | |
struct _GtkPaned { | |
GtkContainer container; | |
GtkPanedChild children[2]; | |
+ GtkAllocation true_alloc; | |
gint handle_size,gutter_size; | |
gint handle_pos; | |
gint Tracking : 1; | |
t@@ -605,6 +606,7 @@ void gtk_paned_pack1(GtkPaned *paned,GtkWidget *child,gboo… | |
gboolean shrink); | |
void gtk_paned_pack2(GtkPaned *paned,GtkWidget *child,gboolean resize, | |
gboolean shrink); | |
+void gtk_paned_set_position(GtkPaned *paned,gint position); | |
#define gtk_container_border_width gtk_container_set_border_width | |
#define gtk_hbutton_box_new() gtk_hbox_new(TRUE,5) |