Mercurial > dwindows
annotate gtk/dw.c @ 517:63e5812d64ba
Need to show the images for the MDI window buttons, since we don't use
gtk_widget_show_all().
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Tue, 16 Mar 2004 06:18:40 +0000 |
parents | caa7ed17c132 |
children | 7efc5f99c4cc |
rev | line source |
---|---|
3 | 1 /* |
2 * Dynamic Windows: | |
3 * A GTK like implementation of the PM GUI | |
4 * GTK forwarder module for portabilty. | |
5 * | |
516
caa7ed17c132
Updated copyrights and license file.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
515
diff
changeset
|
6 * (C) 2000-2004 Brian Smith <dbsoft@technologist.com> |
caa7ed17c132
Updated copyrights and license file.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
515
diff
changeset
|
7 * (C) 2003-2004 Mark Hessling <m.hessling@qut.edu.au> |
515
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
8 * (C) 2002 Shmyrev <shmyrev@yandex.ru> |
3 | 9 */ |
10 #include "dw.h" | |
11 #include <string.h> | |
12 #include <stdlib.h> | |
13 #include <sys/utsname.h> | |
14 #include <stdarg.h> | |
15 #include <stdio.h> | |
16 #include <unistd.h> | |
17 #include <errno.h> | |
18 #include <sys/time.h> | |
482
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
19 #include <dirent.h> |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
20 #include <sys/stat.h> |
3 | 21 #include "config.h" |
40
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
22 #include <gdk/gdkkeysyms.h> |
3 | 23 #ifdef USE_IMLIB |
24 #include <gdk_imlib.h> | |
120
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
25 #endif |
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
26 #if GTK_MAJOR_VERSION > 1 |
47
997e9ed670ef
Fixes for box alignment problem on OS/2, crash in dw_bitmap_new() on unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
46
diff
changeset
|
27 #include <gdk-pixbuf/gdk-pixbuf.h> |
3 | 28 #endif |
29 | |
401
306ce9765a61
Fixes for new message box code. Also incorporated a fix from dw_window_set
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
399
diff
changeset
|
30 #include "gtk/messagebox_error.xpm" |
306ce9765a61
Fixes for new message box code. Also incorporated a fix from dw_window_set
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
399
diff
changeset
|
31 #include "gtk/messagebox_warning.xpm" |
306ce9765a61
Fixes for new message box code. Also incorporated a fix from dw_window_set
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
399
diff
changeset
|
32 #include "gtk/messagebox_information.xpm" |
306ce9765a61
Fixes for new message box code. Also incorporated a fix from dw_window_set
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
399
diff
changeset
|
33 #include "gtk/messagebox_question.xpm" |
399
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
34 |
3 | 35 /* These are used for resource management */ |
36 #if defined(DW_RESOURCES) && !defined(BUILD_DLL) | |
37 extern DWResources _resources; | |
38 #endif | |
39 | |
40 GdkColor _colors[] = | |
41 { | |
42 { 0, 0x0000, 0x0000, 0x0000 }, /* 0 black */ | |
43 { 0, 0xbbbb, 0x0000, 0x0000 }, /* 1 red */ | |
44 { 0, 0x0000, 0xbbbb, 0x0000 }, /* 2 green */ | |
45 { 0, 0xaaaa, 0xaaaa, 0x0000 }, /* 3 yellow */ | |
46 { 0, 0x0000, 0x0000, 0xcccc }, /* 4 blue */ | |
47 { 0, 0xbbbb, 0x0000, 0xbbbb }, /* 5 magenta */ | |
48 { 0, 0x0000, 0xbbbb, 0xbbbb }, /* 6 cyan */ | |
142
9560efb7bea2
Make DW_CLR_PALEGRAY a bit lighter.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
141
diff
changeset
|
49 { 0, 0xbbbb, 0xbbbb, 0xbbbb }, /* 7 white */ |
3 | 50 { 0, 0x7777, 0x7777, 0x7777 }, /* 8 grey */ |
51 { 0, 0xffff, 0x0000, 0x0000 }, /* 9 bright red */ | |
52 { 0, 0x0000, 0xffff, 0x0000 }, /* 10 bright green */ | |
53 { 0, 0xeeee, 0xeeee, 0x0000 }, /* 11 bright yellow */ | |
54 { 0, 0x0000, 0x0000, 0xffff }, /* 12 bright blue */ | |
55 { 0, 0xffff, 0x0000, 0xffff }, /* 13 bright magenta */ | |
56 { 0, 0x0000, 0xeeee, 0xeeee }, /* 14 bright cyan */ | |
57 { 0, 0xffff, 0xffff, 0xffff }, /* 15 bright white */ | |
58 }; | |
59 | |
48
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
60 #define DW_THREAD_LIMIT 50 |
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
61 |
463
2d7b27204cd4
Add support for DW_BROWSER to specify browser executable fir dw_browse()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
460
diff
changeset
|
62 #ifndef max |
2d7b27204cd4
Add support for DW_BROWSER to specify browser executable fir dw_browse()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
460
diff
changeset
|
63 # define max(a,b) (((a) > (b)) ? (a) : (b)) |
2d7b27204cd4
Add support for DW_BROWSER to specify browser executable fir dw_browse()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
460
diff
changeset
|
64 #endif |
2d7b27204cd4
Add support for DW_BROWSER to specify browser executable fir dw_browse()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
460
diff
changeset
|
65 |
2d7b27204cd4
Add support for DW_BROWSER to specify browser executable fir dw_browse()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
460
diff
changeset
|
66 #ifndef min |
2d7b27204cd4
Add support for DW_BROWSER to specify browser executable fir dw_browse()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
460
diff
changeset
|
67 # define min(a,b) (((a) < (b)) ? (a) : (b)) |
2d7b27204cd4
Add support for DW_BROWSER to specify browser executable fir dw_browse()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
460
diff
changeset
|
68 #endif |
2d7b27204cd4
Add support for DW_BROWSER to specify browser executable fir dw_browse()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
460
diff
changeset
|
69 |
48
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
70 DWTID _dw_thread_list[DW_THREAD_LIMIT]; |
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
71 GdkColor _foreground[DW_THREAD_LIMIT]; |
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
72 GdkColor _background[DW_THREAD_LIMIT]; |
373
d04b0699fc28
Fixes for background color drawing on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
372
diff
changeset
|
73 int _transparent[DW_THREAD_LIMIT]; |
3 | 74 |
93
98cce029a611
Changed handling of menu item click events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
92
diff
changeset
|
75 GtkWidget *last_window = NULL, *popup = NULL; |
47
997e9ed670ef
Fixes for box alignment problem on OS/2, crash in dw_bitmap_new() on unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
46
diff
changeset
|
76 |
483
1cb1b87bbd30
Fixes for the Unix file browser... seems to have revealed a problem in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
482
diff
changeset
|
77 static int _dw_file_active = 0, _dw_ignore_click = 0, _dw_ignore_expand = 0; |
258
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
78 static pthread_t _dw_thread = (pthread_t)-1; |
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
79 static int _dw_mutex_locked[DW_THREAD_LIMIT]; |
37
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
36
diff
changeset
|
80 /* Use default border size for the default enlightenment theme */ |
258
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
81 static int _dw_border_width = 12, _dw_border_height = 28; |
3 | 82 |
75
c629838d9805
Updated to latest DW, and updated the Makefile to install the header files
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
83 #define DW_MUTEX_LOCK { int index = _find_thread_index(dw_thread_id()); if(pthread_self() != _dw_thread && _dw_mutex_locked[index] == FALSE) { gdk_threads_enter(); _dw_mutex_locked[index] = TRUE; _locked_by_me = TRUE; } } |
c629838d9805
Updated to latest DW, and updated the Makefile to install the header files
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
84 #define DW_MUTEX_UNLOCK { if(pthread_self() != _dw_thread && _locked_by_me == TRUE) { gdk_threads_leave(); _dw_mutex_locked[_find_thread_index(dw_thread_id())] = FALSE; _locked_by_me = FALSE; } } |
3 | 85 |
14
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
86 #define DEFAULT_SIZE_WIDTH 12 |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
87 #define DEFAULT_SIZE_HEIGHT 6 |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
88 #define DEFAULT_TITLEBAR_HEIGHT 22 |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
89 |
258
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
90 static GdkColormap *_dw_cmap = NULL; |
3 | 91 |
92 /* Signal forwarder prototypes */ | |
258
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
93 static gint _button_press_event(GtkWidget *widget, GdkEventButton *event, gpointer data); |
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
94 static gint _button_release_event(GtkWidget *widget, GdkEventButton *event, gpointer data); |
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
95 static gint _motion_notify_event(GtkWidget *widget, GdkEventMotion *event, gpointer data); |
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
96 static gint _delete_event(GtkWidget *widget, GdkEvent *event, gpointer data); |
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
97 static gint _key_press_event(GtkWidget *widget, GdkEventKey *event, gpointer data); |
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
98 static gint _generic_event(GtkWidget *widget, gpointer data); |
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
99 static gint _configure_event(GtkWidget *widget, GdkEventConfigure *event, gpointer data); |
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
100 static gint _activate_event(GtkWidget *widget, gpointer data); |
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
101 static gint _container_select_event(GtkWidget *widget, GdkEventButton *event, gpointer data); |
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
102 static gint _container_context_event(GtkWidget *widget, GdkEventButton *event, gpointer data); |
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
103 static gint _item_select_event(GtkWidget *widget, GtkWidget *child, gpointer data); |
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
104 static gint _expose_event(GtkWidget *widget, GdkEventExpose *event, gpointer data); |
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
105 static gint _set_focus_event(GtkWindow *window, GtkWidget *widget, gpointer data); |
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
106 static gint _tree_context_event(GtkWidget *widget, GdkEventButton *event, gpointer data); |
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
107 static gint _value_changed_event(GtkAdjustment *adjustment, gpointer user_data); |
140
e0e73b4372a6
GTK 2.0 tree control is now fully functional. I just need to check for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
139
diff
changeset
|
108 #if GTK_MAJOR_VERSION > 1 |
258
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
109 static gint _tree_select_event(GtkTreeSelection *sel, gpointer data); |
478
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
472
diff
changeset
|
110 static gint _tree_expand_event(GtkTreeView *treeview, GtkTreeIter *arg1, GtkTreePath *arg2, gpointer data); |
140
e0e73b4372a6
GTK 2.0 tree control is now fully functional. I just need to check for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
139
diff
changeset
|
111 #else |
258
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
112 static gint _tree_select_event(GtkTree *tree, GtkWidget *child, gpointer data); |
478
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
472
diff
changeset
|
113 static gint _tree_expand_event(GtkTreeItem *treeitem, gpointer data); |
140
e0e73b4372a6
GTK 2.0 tree control is now fully functional. I just need to check for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
139
diff
changeset
|
114 #endif |
478
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
472
diff
changeset
|
115 static gint _switch_page_event(GtkNotebook *notebook, GtkNotebookPage *page, guint page_num, gpointer data); |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
472
diff
changeset
|
116 static gint _column_click_event(GtkWidget *widget, gint column_num, gpointer data); |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
117 |
258
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
118 typedef struct |
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
119 { |
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
120 GdkPixmap *pixmap; |
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
121 GdkBitmap *mask; |
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
122 int used; |
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
123 unsigned long width, height; |
316
a07e08f708d6
Fixed icons in the tree control in GTK 2.x when loaded from a file.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
312
diff
changeset
|
124 #if GTK_MAJOR_VERSION > 1 |
a07e08f708d6
Fixed icons in the tree control in GTK 2.x when loaded from a file.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
312
diff
changeset
|
125 GdkPixbuf *pixbuf; |
a07e08f708d6
Fixed icons in the tree control in GTK 2.x when loaded from a file.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
312
diff
changeset
|
126 #endif |
258
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
127 } DWPrivatePixmap; |
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
128 |
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
129 static DWPrivatePixmap *_PixmapArray = NULL; |
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
130 static int _PixmapCount = 0; |
3 | 131 |
132 typedef struct | |
133 { | |
134 void *func; | |
135 char name[30]; | |
136 | |
137 } SignalList; | |
138 | |
139 typedef struct | |
140 { | |
141 HWND window; | |
142 void *func; | |
143 gpointer data; | |
409
1d7be77cbfb5
Implemented signal removal system so it works like OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
407
diff
changeset
|
144 gint cid; |
1d7be77cbfb5
Implemented signal removal system so it works like OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
407
diff
changeset
|
145 void *intfunc; |
3 | 146 |
147 } SignalHandler; | |
148 | |
478
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
472
diff
changeset
|
149 #define SIGNALMAX 19 |
3 | 150 |
151 /* A list of signal forwarders, to account for paramater differences. */ | |
258
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
152 static SignalList SignalTranslate[SIGNALMAX] = { |
307
324587c06cea
Use the signal #defines internally so all that is required to change
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
296
diff
changeset
|
153 { _configure_event, DW_SIGNAL_CONFIGURE }, |
324587c06cea
Use the signal #defines internally so all that is required to change
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
296
diff
changeset
|
154 { _key_press_event, DW_SIGNAL_KEY_PRESS }, |
324587c06cea
Use the signal #defines internally so all that is required to change
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
296
diff
changeset
|
155 { _button_press_event, DW_SIGNAL_BUTTON_PRESS }, |
324587c06cea
Use the signal #defines internally so all that is required to change
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
296
diff
changeset
|
156 { _button_release_event, DW_SIGNAL_BUTTON_RELEASE }, |
324587c06cea
Use the signal #defines internally so all that is required to change
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
296
diff
changeset
|
157 { _motion_notify_event, DW_SIGNAL_MOTION_NOTIFY }, |
324587c06cea
Use the signal #defines internally so all that is required to change
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
296
diff
changeset
|
158 { _delete_event, DW_SIGNAL_DELETE }, |
324587c06cea
Use the signal #defines internally so all that is required to change
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
296
diff
changeset
|
159 { _expose_event, DW_SIGNAL_EXPOSE }, |
324587c06cea
Use the signal #defines internally so all that is required to change
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
296
diff
changeset
|
160 { _activate_event, "activate" }, |
324587c06cea
Use the signal #defines internally so all that is required to change
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
296
diff
changeset
|
161 { _generic_event, DW_SIGNAL_CLICKED }, |
324587c06cea
Use the signal #defines internally so all that is required to change
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
296
diff
changeset
|
162 { _container_select_event, DW_SIGNAL_ITEM_ENTER }, |
324587c06cea
Use the signal #defines internally so all that is required to change
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
296
diff
changeset
|
163 { _container_context_event, DW_SIGNAL_ITEM_CONTEXT }, |
324587c06cea
Use the signal #defines internally so all that is required to change
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
296
diff
changeset
|
164 { _tree_context_event, "tree-context" }, |
324587c06cea
Use the signal #defines internally so all that is required to change
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
296
diff
changeset
|
165 { _item_select_event, DW_SIGNAL_LIST_SELECT }, |
324587c06cea
Use the signal #defines internally so all that is required to change
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
296
diff
changeset
|
166 { _tree_select_event, DW_SIGNAL_ITEM_SELECT }, |
324587c06cea
Use the signal #defines internally so all that is required to change
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
296
diff
changeset
|
167 { _set_focus_event, DW_SIGNAL_SET_FOCUS }, |
331
20def3eaae8d
Implement handling of switch-page signal for notebooks.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
329
diff
changeset
|
168 { _value_changed_event, DW_SIGNAL_VALUE_CHANGED }, |
472
d11be1f40f8c
Add support for column-click signal.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
464
diff
changeset
|
169 { _switch_page_event, DW_SIGNAL_SWITCH_PAGE }, |
478
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
472
diff
changeset
|
170 { _column_click_event, DW_SIGNAL_COLUMN_CLICK }, |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
472
diff
changeset
|
171 { _tree_expand_event, DW_SIGNAL_TREE_EXPAND } |
3 | 172 }; |
173 | |
36
cddb02f847e1
Added unix versions of functions in compat, and added getfsname, plus
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
174 /* Alignment flags */ |
cddb02f847e1
Added unix versions of functions in compat, and added getfsname, plus
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
175 #define DW_CENTER 0.5f |
cddb02f847e1
Added unix versions of functions in compat, and added getfsname, plus
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
176 #define DW_LEFT 0.0f |
cddb02f847e1
Added unix versions of functions in compat, and added getfsname, plus
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
177 #define DW_RIGHT 1.0f |
cddb02f847e1
Added unix versions of functions in compat, and added getfsname, plus
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
178 |
515
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
179 /* MDI Support Code */ |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
180 #if GTK_MAJOR_VERSION > 1 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
181 #define GTK_MDI(obj) GTK_CHECK_CAST (obj, gtk_mdi_get_type (), GtkMdi) |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
182 #define GTK_MDI_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_mdi_get_type (), GtkMdiClass) |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
183 #define GTK_IS_MDI(obj) GTK_CHECK_TYPE (obj, gtk_mdi_get_type ()) |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
184 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
185 typedef struct _GtkMdi GtkMdi; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
186 typedef struct _GtkMdiClass GtkMdiClass; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
187 typedef struct _GtkMdiDragInfo GtkMdiDragInfo; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
188 typedef enum _GtkMdiChildState GtkMdiChildState; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
189 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
190 enum _GtkMdiChildState |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
191 { |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
192 CHILD_NORMAL, |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
193 CHILD_MAXIMIZED, |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
194 CHILD_ICONIFIED |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
195 }; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
196 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
197 struct _GtkMdi |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
198 { |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
199 GtkContainer container; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
200 GList *children; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
201 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
202 GdkPoint drag_start; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
203 gint drag_button; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
204 }; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
205 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
206 struct _GtkMdiClass |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
207 { |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
208 GtkContainerClass parent_class; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
209 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
210 void (*mdi) (GtkMdi * mdi); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
211 }; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
212 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
213 #include "gtk/maximize.xpm" |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
214 #include "gtk/minimize.xpm" |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
215 #include "gtk/kill.xpm" |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
216 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
217 #define GTK_MDI_BACKGROUND "Grey70" |
517
63e5812d64ba
Need to show the images for the MDI window buttons, since we don't use
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
516
diff
changeset
|
218 #define GTK_MDI_LABEL_BACKGROUND "RoyalBlue4" |
515
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
219 #define GTK_MDI_LABEL_FOREGROUND "white" |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
220 #define GTK_MDI_DEFAULT_WIDTH 0 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
221 #define GTK_MDI_DEFAULT_HEIGHT 0 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
222 #define GTK_MDI_MIN_HEIGHT 22 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
223 #define GTK_MDI_MIN_WIDTH 55 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
224 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
225 typedef struct _GtkMdiChild GtkMdiChild; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
226 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
227 struct _GtkMdiChild |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
228 { |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
229 GtkWidget *widget; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
230 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
231 GtkWidget *child; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
232 GtkMdi *mdi; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
233 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
234 gint x; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
235 gint y; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
236 gint width; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
237 gint height; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
238 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
239 GtkMdiChildState state; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
240 }; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
241 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
242 static void gtk_mdi_class_init(GtkMdiClass *klass); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
243 static void gtk_mdi_init(GtkMdi *mdi); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
244 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
245 static void gtk_mdi_realize(GtkWidget *widget); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
246 static void gtk_mdi_size_request(GtkWidget *widget, GtkRequisition *requisition); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
247 static void gtk_mdi_size_allocate(GtkWidget *widget, GtkAllocation *allocation); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
248 static gint gtk_mdi_expose(GtkWidget *widget, GdkEventExpose *event); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
249 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
250 /* Callbacks */ |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
251 static gboolean move_child_callback(GtkWidget *widget, GdkEvent *event, gpointer data); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
252 static gboolean resize_child_callback(GtkWidget *widget, GdkEvent *event, gpointer data); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
253 static gboolean iconify_child_callback(GtkWidget *widget, GdkEvent *event, gpointer data); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
254 static gboolean maximize_child_callback(GtkWidget *widget, GdkEvent *event, gpointer data); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
255 static gboolean kill_child_callback(GtkWidget *widget, GdkEvent *event, gpointer data); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
256 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
257 static void gtk_mdi_add(GtkContainer *container, GtkWidget *widget); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
258 static void gtk_mdi_remove_true(GtkContainer *container, GtkWidget *widget); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
259 static void gtk_mdi_forall(GtkContainer *container, gboolean include_internals, GtkCallback callback, gpointer callback_data); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
260 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
261 static GtkMdiChild *get_child(GtkMdi *mdi, GtkWidget * widget); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
262 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
263 static GtkType gtk_mdi_get_type(void) |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
264 { |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
265 static GType mdi_type = 0; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
266 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
267 if (!mdi_type) |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
268 { |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
269 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
270 static const GTypeInfo mdi_info = |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
271 { |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
272 sizeof (GtkMdiClass), |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
273 NULL, |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
274 NULL, |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
275 (GClassInitFunc) gtk_mdi_class_init, |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
276 NULL, |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
277 NULL, |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
278 sizeof (GtkMdi), |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
279 0, |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
280 (GInstanceInitFunc) gtk_mdi_init, |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
281 }; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
282 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
283 mdi_type = g_type_register_static (GTK_TYPE_CONTAINER, "GtkMdi", &mdi_info, 0); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
284 } |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
285 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
286 return mdi_type; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
287 } |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
288 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
289 /* Local data */ |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
290 static GtkWidgetClass *parent_class = NULL; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
291 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
292 static void gtk_mdi_class_init(GtkMdiClass *class) |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
293 { |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
294 GObjectClass *object_class; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
295 GtkWidgetClass *widget_class; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
296 GtkContainerClass *container_class; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
297 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
298 object_class = (GObjectClass *) class; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
299 widget_class = (GtkWidgetClass *) class; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
300 container_class = (GtkContainerClass *) class; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
301 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
302 parent_class = gtk_type_class (GTK_TYPE_CONTAINER); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
303 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
304 widget_class->realize = gtk_mdi_realize; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
305 widget_class->expose_event = gtk_mdi_expose; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
306 widget_class->size_request = gtk_mdi_size_request; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
307 widget_class->size_allocate = gtk_mdi_size_allocate; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
308 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
309 container_class->add = gtk_mdi_add; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
310 container_class->remove = gtk_mdi_remove_true; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
311 container_class->forall = gtk_mdi_forall; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
312 class->mdi = NULL; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
313 } |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
314 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
315 static void gtk_mdi_init(GtkMdi *mdi) |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
316 { |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
317 mdi->drag_button = -1; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
318 mdi->children = NULL; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
319 } |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
320 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
321 static GtkWidget *gtk_mdi_new(void) |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
322 { |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
323 GtkWidget *mdi; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
324 GdkColor background; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
325 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
326 mdi = GTK_WIDGET (g_object_new (gtk_mdi_get_type (), NULL)); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
327 gdk_color_parse (GTK_MDI_BACKGROUND, &background); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
328 gtk_widget_modify_bg (mdi, GTK_STATE_NORMAL, &background); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
329 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
330 return mdi; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
331 } |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
332 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
333 static void gtk_mdi_put(GtkMdi *mdi, GtkWidget *child_widget, gint x, gint y, GtkWidget *label) |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
334 { |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
335 GtkMdiChild *child; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
336 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
337 GtkWidget *table; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
338 GtkWidget *button[3]; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
339 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
340 GtkWidget *child_box; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
341 GtkWidget *top_event_box; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
342 GtkWidget *bottom_event_box; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
343 GtkWidget *child_widget_box; |
517
63e5812d64ba
Need to show the images for the MDI window buttons, since we don't use
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
516
diff
changeset
|
344 GtkWidget *image; |
515
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
345 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
346 GdkColor color; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
347 gint i, j; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
348 GdkCursor *cursor; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
349 GdkColormap *colormap; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
350 GdkPixmap *pixmap; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
351 GdkBitmap *mask; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
352 GtkStyle *style; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
353 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
354 child_box = gtk_event_box_new (); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
355 child_widget_box = gtk_event_box_new (); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
356 top_event_box = gtk_event_box_new (); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
357 bottom_event_box = gtk_event_box_new (); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
358 table = gtk_table_new (4, 7, FALSE); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
359 gtk_table_set_row_spacings (GTK_TABLE (table), 1); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
360 gtk_table_set_col_spacings (GTK_TABLE (table), 1); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
361 gtk_table_set_row_spacing (GTK_TABLE (table), 3, 0); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
362 gtk_table_set_col_spacing (GTK_TABLE (table), 6, 0); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
363 gtk_table_set_row_spacing (GTK_TABLE (table), 2, 0); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
364 gtk_table_set_col_spacing (GTK_TABLE (table), 5, 0); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
365 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
366 for (i = 0; i < 3; i++) |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
367 { |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
368 button[i] = gtk_event_box_new (); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
369 gtk_widget_set_events (button[0], GDK_BUTTON_PRESS_MASK); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
370 } |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
371 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
372 gdk_color_parse (GTK_MDI_LABEL_BACKGROUND, &color); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
373 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
374 gtk_widget_modify_bg (top_event_box, GTK_STATE_NORMAL, &color); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
375 gtk_widget_modify_bg (bottom_event_box, GTK_STATE_NORMAL, &color); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
376 gtk_widget_modify_bg (child_box, GTK_STATE_NORMAL, &color); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
377 for (i = GTK_STATE_NORMAL; i < GTK_STATE_ACTIVE; i++) |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
378 { |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
379 for (j = 0; j < 3; j++) |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
380 { |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
381 gtk_widget_modify_bg (button[j], i, &color); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
382 } |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
383 } |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
384 gdk_color_parse (GTK_MDI_LABEL_FOREGROUND, &color); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
385 gtk_widget_modify_fg (label, GTK_STATE_NORMAL, &color); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
386 gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
387 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
388 gtk_container_add (GTK_CONTAINER (top_event_box), label); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
389 gtk_container_add (GTK_CONTAINER (child_widget_box), child_widget); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
390 gtk_widget_set_size_request (bottom_event_box, 2, 2); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
391 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
392 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
393 style = gtk_widget_get_default_style (); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
394 colormap = gdk_colormap_get_system (); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
395 pixmap = gdk_pixmap_colormap_create_from_xpm_d (NULL, colormap, &mask, |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
396 &style->bg[GTK_STATE_NORMAL], |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
397 (gchar **) minimize_xpm); |
517
63e5812d64ba
Need to show the images for the MDI window buttons, since we don't use
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
516
diff
changeset
|
398 image = gtk_image_new_from_pixmap (pixmap, mask); |
63e5812d64ba
Need to show the images for the MDI window buttons, since we don't use
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
516
diff
changeset
|
399 gtk_widget_show(image); |
63e5812d64ba
Need to show the images for the MDI window buttons, since we don't use
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
516
diff
changeset
|
400 gtk_container_add (GTK_CONTAINER (button[0]), image); |
515
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
401 pixmap = gdk_pixmap_colormap_create_from_xpm_d (GTK_WIDGET (mdi)->window, colormap, &mask, |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
402 &style->bg[GTK_STATE_NORMAL], |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
403 (gchar **) maximize_xpm); |
517
63e5812d64ba
Need to show the images for the MDI window buttons, since we don't use
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
516
diff
changeset
|
404 image = gtk_image_new_from_pixmap (pixmap, mask); |
63e5812d64ba
Need to show the images for the MDI window buttons, since we don't use
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
516
diff
changeset
|
405 gtk_widget_show(image); |
63e5812d64ba
Need to show the images for the MDI window buttons, since we don't use
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
516
diff
changeset
|
406 gtk_container_add (GTK_CONTAINER (button[1]), image); |
515
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
407 pixmap = gdk_pixmap_colormap_create_from_xpm_d (GTK_WIDGET (mdi)->window, colormap, &mask, |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
408 &style->bg[GTK_STATE_NORMAL], |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
409 (gchar **) kill_xpm); |
517
63e5812d64ba
Need to show the images for the MDI window buttons, since we don't use
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
516
diff
changeset
|
410 image = gtk_image_new_from_pixmap (pixmap, mask); |
63e5812d64ba
Need to show the images for the MDI window buttons, since we don't use
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
516
diff
changeset
|
411 gtk_widget_show(image); |
63e5812d64ba
Need to show the images for the MDI window buttons, since we don't use
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
516
diff
changeset
|
412 gtk_container_add (GTK_CONTAINER (button[2]), image); |
515
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
413 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
414 gtk_table_attach (GTK_TABLE (table), child_widget_box, 1, 6, 2, 3, |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
415 GTK_EXPAND | GTK_SHRINK | GTK_FILL, |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
416 GTK_EXPAND | GTK_SHRINK | GTK_FILL, |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
417 0, 0); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
418 gtk_table_attach (GTK_TABLE (table), top_event_box, 1, 2, 1, 2, |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
419 GTK_FILL | GTK_EXPAND | GTK_SHRINK, |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
420 0, |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
421 0, 0); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
422 gtk_table_attach (GTK_TABLE (table), bottom_event_box, 6, 7, 3, 4, |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
423 0, |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
424 0, |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
425 0, 0); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
426 gtk_table_attach (GTK_TABLE (table), button[0], 2, 3, 1, 2, |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
427 0, |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
428 0, |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
429 0, 0); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
430 gtk_table_attach (GTK_TABLE (table), button[1], 3, 4, 1, 2, |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
431 0, |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
432 0, |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
433 0, 0); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
434 gtk_table_attach (GTK_TABLE (table), button[2], 4, 5, 1, 2, |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
435 0, |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
436 0, |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
437 0, 0); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
438 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
439 gtk_container_add (GTK_CONTAINER (child_box), table); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
440 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
441 child = g_new (GtkMdiChild, 1); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
442 child->widget = child_box; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
443 child->x = x; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
444 child->y = y; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
445 child->width = -1; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
446 child->height = -1; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
447 child->child = child_widget; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
448 child->mdi = mdi; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
449 child->state = CHILD_NORMAL; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
450 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
451 gtk_widget_set_parent (child_box, GTK_WIDGET (mdi)); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
452 mdi->children = g_list_append (mdi->children, child); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
453 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
454 gtk_widget_show (child_box); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
455 gtk_widget_show (table); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
456 gtk_widget_show (top_event_box); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
457 gtk_widget_show (bottom_event_box); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
458 gtk_widget_show (child_widget_box); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
459 for (i = 0; i < 3; i++) |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
460 { |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
461 gtk_widget_show (button[i]); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
462 } |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
463 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
464 cursor = gdk_cursor_new (GDK_HAND1); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
465 gtk_widget_realize (top_event_box); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
466 gdk_window_set_cursor (top_event_box->window, cursor); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
467 cursor = gdk_cursor_new (GDK_BOTTOM_RIGHT_CORNER); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
468 gtk_widget_realize (bottom_event_box); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
469 gdk_window_set_cursor (bottom_event_box->window, cursor); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
470 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
471 g_signal_connect (G_OBJECT (top_event_box), "event", |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
472 G_CALLBACK (move_child_callback), |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
473 child); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
474 g_signal_connect (G_OBJECT (bottom_event_box), "event", |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
475 G_CALLBACK (resize_child_callback), |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
476 child); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
477 g_signal_connect (G_OBJECT (button[0]), "button_press_event", |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
478 G_CALLBACK (iconify_child_callback), |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
479 child); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
480 g_signal_connect (G_OBJECT (button[1]), "button_press_event", |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
481 G_CALLBACK (maximize_child_callback), |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
482 child); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
483 g_signal_connect (G_OBJECT (button[2]), "button_press_event", |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
484 G_CALLBACK (kill_child_callback), |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
485 child); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
486 } |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
487 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
488 static void gtk_mdi_move(GtkMdi *mdi, GtkWidget *widget, gint x, gint y) |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
489 { |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
490 GtkMdiChild *child; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
491 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
492 g_return_if_fail (GTK_IS_MDI (mdi)); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
493 g_return_if_fail (GTK_IS_WIDGET (widget)); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
494 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
495 child = get_child (mdi, widget); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
496 g_return_if_fail (child); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
497 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
498 child->x = x; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
499 child->y = y; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
500 if (GTK_WIDGET_VISIBLE (widget) && GTK_WIDGET_VISIBLE (mdi)) |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
501 gtk_widget_queue_resize (GTK_WIDGET (widget)); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
502 } |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
503 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
504 static void gtk_mdi_tile(GtkMdi *mdi) |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
505 { |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
506 int i, n; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
507 int width, height; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
508 GList *children; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
509 GtkMdiChild *child; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
510 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
511 g_return_if_fail (GTK_IS_MDI (mdi)); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
512 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
513 children = mdi->children; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
514 n = g_list_length (children); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
515 width = GTK_WIDGET (mdi)->allocation.width; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
516 height = GTK_WIDGET (mdi)->allocation.height / n; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
517 for (i = 0; i < n; i++) |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
518 { |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
519 child = (GtkMdiChild *) children->data; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
520 children = children->next; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
521 child->x = 0; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
522 child->y = i * height; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
523 gtk_widget_set_size_request (child->widget, width, height); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
524 child->state = CHILD_NORMAL; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
525 child->width = -1; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
526 child->height = -1; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
527 } |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
528 if (GTK_WIDGET_VISIBLE (GTK_WIDGET (mdi))) |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
529 gtk_widget_queue_resize (GTK_WIDGET (mdi)); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
530 return; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
531 } |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
532 static void gtk_mdi_cascade(GtkMdi *mdi) |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
533 { |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
534 int i, n; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
535 int width, height; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
536 GList *children; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
537 GtkMdiChild *child; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
538 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
539 g_return_if_fail (GTK_IS_MDI (mdi)); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
540 if (!GTK_WIDGET_VISIBLE (GTK_WIDGET (mdi))) |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
541 return; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
542 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
543 children = mdi->children; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
544 n = g_list_length (children); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
545 width = GTK_WIDGET (mdi)->allocation.width / (2 * n - 1); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
546 height = GTK_WIDGET (mdi)->allocation.height / (2 * n - 1); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
547 for (i = 0; i < n; i++) |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
548 { |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
549 child = (GtkMdiChild *) children->data; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
550 children = children->next; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
551 child->x = i * width; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
552 child->y = i * height; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
553 gtk_widget_set_size_request (child->widget, width * n, height * n); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
554 child->state = CHILD_NORMAL; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
555 child->width = -1; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
556 child->height = -1; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
557 } |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
558 if (GTK_WIDGET_VISIBLE (GTK_WIDGET (mdi))) |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
559 gtk_widget_queue_resize (GTK_WIDGET (mdi)); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
560 return; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
561 } |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
562 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
563 static GtkMdiChildState gtk_mdi_get_state(GtkMdi *mdi, GtkWidget *widget) |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
564 { |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
565 GtkMdiChild *child; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
566 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
567 g_return_val_if_fail (GTK_IS_MDI (mdi), CHILD_NORMAL); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
568 g_return_val_if_fail (GTK_IS_WIDGET (widget), CHILD_NORMAL); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
569 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
570 child = get_child (mdi, widget); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
571 g_return_val_if_fail (child, CHILD_NORMAL); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
572 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
573 return child->state; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
574 } |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
575 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
576 static void gtk_mdi_set_state(GtkMdi *mdi, GtkWidget *widget, GtkMdiChildState state) |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
577 { |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
578 GtkMdiChild *child; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
579 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
580 g_return_if_fail (GTK_IS_MDI (mdi)); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
581 g_return_if_fail (GTK_IS_WIDGET (widget)); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
582 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
583 child = get_child (mdi, widget); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
584 g_return_if_fail (child); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
585 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
586 child->state = state; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
587 if (GTK_WIDGET_VISIBLE (child->widget) && GTK_WIDGET_VISIBLE (mdi)) |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
588 gtk_widget_queue_resize (GTK_WIDGET (child->widget)); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
589 } |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
590 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
591 static void gtk_mdi_remove(GtkMdi *mdi, GtkWidget *widget) |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
592 { |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
593 GtkMdiChild *child; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
594 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
595 g_return_if_fail (GTK_IS_MDI (mdi)); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
596 child = get_child (mdi, widget); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
597 g_return_if_fail (child); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
598 g_return_if_fail (GTK_IS_WIDGET (child)); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
599 gtk_mdi_remove_true (GTK_CONTAINER (mdi), child->widget); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
600 } |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
601 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
602 static void gtk_mdi_realize(GtkWidget *widget) |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
603 { |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
604 GtkMdi *mdi; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
605 GdkWindowAttr attributes; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
606 gint attributes_mask; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
607 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
608 mdi = GTK_MDI (widget); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
609 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
610 g_return_if_fail (widget != NULL); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
611 g_return_if_fail (GTK_IS_MDI (mdi)); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
612 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
613 GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
614 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
615 attributes.x = widget->allocation.x; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
616 attributes.y = widget->allocation.y; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
617 attributes.width = widget->allocation.width; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
618 attributes.height = widget->allocation.height; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
619 attributes.wclass = GDK_INPUT_OUTPUT; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
620 attributes.window_type = GDK_WINDOW_CHILD; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
621 attributes.event_mask = gtk_widget_get_events (widget) | |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
622 GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
623 GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK | |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
624 GDK_POINTER_MOTION_HINT_MASK; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
625 attributes.visual = gtk_widget_get_visual (widget); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
626 attributes.colormap = gtk_widget_get_colormap (widget); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
627 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
628 attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
629 widget->window = gdk_window_new (widget->parent->window, &attributes, attributes_mask); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
630 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
631 widget->style = gtk_style_attach (widget->style, widget->window); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
632 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
633 gdk_window_set_user_data (widget->window, widget); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
634 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
635 gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
636 } |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
637 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
638 static void gtk_mdi_size_request (GtkWidget *widget, GtkRequisition *requisition) |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
639 { |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
640 GtkMdi *mdi; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
641 GtkMdiChild *child; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
642 GList *children; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
643 GtkRequisition child_requisition; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
644 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
645 mdi = GTK_MDI (widget); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
646 requisition->width = GTK_MDI_DEFAULT_WIDTH; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
647 requisition->height = GTK_MDI_DEFAULT_HEIGHT; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
648 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
649 children = mdi->children; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
650 while (children) |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
651 { |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
652 child = children->data; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
653 children = children->next; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
654 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
655 if (GTK_WIDGET_VISIBLE (child->widget)) |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
656 { |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
657 gtk_widget_size_request (child->widget, &child_requisition); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
658 } |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
659 } |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
660 } |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
661 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
662 static void gtk_mdi_size_allocate(GtkWidget *widget, GtkAllocation *allocation) |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
663 { |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
664 GtkMdi *mdi; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
665 GtkMdiChild *child; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
666 GtkAllocation child_allocation; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
667 GtkRequisition child_requisition; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
668 GList *children; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
669 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
670 mdi = GTK_MDI (widget); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
671 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
672 widget->allocation = *allocation; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
673 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
674 if (GTK_WIDGET_REALIZED (widget)) |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
675 gdk_window_move_resize (widget->window, |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
676 allocation->x, |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
677 allocation->y, |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
678 allocation->width, |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
679 allocation->height); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
680 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
681 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
682 children = mdi->children; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
683 while (children) |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
684 { |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
685 child = children->data; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
686 children = children->next; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
687 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
688 if (GTK_WIDGET_VISIBLE (child->widget)) |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
689 { |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
690 gtk_widget_get_child_requisition (child->widget, &child_requisition); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
691 child_allocation.x = 0; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
692 child_allocation.y = 0; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
693 switch (child->state) |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
694 { |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
695 case CHILD_NORMAL: |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
696 { |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
697 if ((child->width < 0) && (child->height < 0)) |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
698 { |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
699 child_allocation.width = child_requisition.width; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
700 child_allocation.height = child_requisition.height; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
701 } |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
702 else |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
703 { |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
704 child_allocation.width = child->width; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
705 child_allocation.height = child->height; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
706 child->width = -1; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
707 child->height = -1; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
708 } |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
709 child_allocation.x += child->x; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
710 child_allocation.y += child->y; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
711 break; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
712 } |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
713 case CHILD_MAXIMIZED: |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
714 { |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
715 if ((child->width < 0) && (child->height < 0)) |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
716 { |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
717 child->width = child_requisition.width; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
718 child->height = child_requisition.height; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
719 } |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
720 child_allocation.width = allocation->width; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
721 child_allocation.height = allocation->height; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
722 } |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
723 break; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
724 case CHILD_ICONIFIED: |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
725 { |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
726 if ((child->width < 0) && (child->height < 0)) |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
727 { |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
728 child->width = child_requisition.width; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
729 child->height = child_requisition.height; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
730 } |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
731 child_allocation.x += child->x; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
732 child_allocation.y += child->y; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
733 child_allocation.width = child_requisition.width; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
734 child_allocation.height = GTK_MDI_MIN_HEIGHT; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
735 break; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
736 } |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
737 } |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
738 gtk_widget_size_allocate (child->widget, &child_allocation); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
739 } |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
740 } |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
741 } |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
742 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
743 static gint gtk_mdi_expose(GtkWidget *widget, GdkEventExpose *event) |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
744 { |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
745 GtkMdiChild *child; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
746 GList *children; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
747 GtkMdi *mdi; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
748 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
749 g_return_val_if_fail (widget != NULL, FALSE); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
750 g_return_val_if_fail (GTK_IS_MDI (widget), FALSE); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
751 g_return_val_if_fail (event != NULL, FALSE); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
752 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
753 mdi = GTK_MDI (widget); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
754 for (children = mdi->children; children; children = children->next) |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
755 { |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
756 child = (GtkMdiChild *) children->data; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
757 gtk_container_propagate_expose (GTK_CONTAINER (mdi), |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
758 child->widget, |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
759 event); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
760 } |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
761 return FALSE; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
762 } |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
763 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
764 static void gtk_mdi_add(GtkContainer *container, GtkWidget *widget) |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
765 { |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
766 GtkWidget *label; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
767 label = gtk_label_new (""); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
768 gtk_mdi_put (GTK_MDI (container), widget, 0, 0, label); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
769 } |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
770 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
771 static void gtk_mdi_remove_true(GtkContainer *container, GtkWidget *widget) |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
772 { |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
773 GtkMdi *mdi; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
774 GtkMdiChild *child = NULL; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
775 GList *children; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
776 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
777 mdi = GTK_MDI (container); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
778 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
779 children = mdi->children; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
780 while (children) |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
781 { |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
782 child = children->data; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
783 if (child->widget == widget) |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
784 break; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
785 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
786 children = children->next; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
787 } |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
788 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
789 if(child) |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
790 { |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
791 gtk_widget_unparent (child->widget); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
792 g_free (child); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
793 } |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
794 mdi->children = g_list_remove_link (mdi->children, children); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
795 g_list_free (children); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
796 } |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
797 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
798 static void gtk_mdi_forall(GtkContainer *container, gboolean include_internals, GtkCallback callback, gpointer callback_data) |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
799 { |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
800 GtkMdi *mdi; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
801 GtkMdiChild *child; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
802 GList *children; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
803 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
804 g_return_if_fail (callback != NULL); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
805 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
806 mdi = GTK_MDI (container); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
807 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
808 children = mdi->children; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
809 while (children) |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
810 { |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
811 child = children->data; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
812 children = children->next; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
813 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
814 (*callback) (child->widget, callback_data); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
815 } |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
816 } |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
817 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
818 static gboolean move_child_callback(GtkWidget *widget, GdkEvent *event, gpointer data) |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
819 { |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
820 GtkMdi *mdi; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
821 GtkMdiChild *child; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
822 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
823 child = (GtkMdiChild *) data; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
824 mdi = child->mdi; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
825 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
826 g_return_val_if_fail (GTK_IS_MDI (mdi), FALSE); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
827 g_return_val_if_fail (GTK_IS_EVENT_BOX (widget), FALSE); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
828 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
829 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
830 switch (event->type) |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
831 { |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
832 case GDK_2BUTTON_PRESS: |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
833 { |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
834 gdk_window_raise (child->widget->window); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
835 } |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
836 case GDK_BUTTON_PRESS: |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
837 if (child->state == CHILD_MAXIMIZED) |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
838 return FALSE; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
839 if (mdi->drag_button < 0) |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
840 { |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
841 if (gdk_pointer_grab (event->button.window, |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
842 FALSE, |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
843 GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
844 GDK_BUTTON_RELEASE_MASK, |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
845 NULL, |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
846 NULL, |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
847 event->button.time) != GDK_GRAB_SUCCESS) |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
848 return FALSE; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
849 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
850 mdi->drag_button = event->button.button; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
851 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
852 mdi->drag_start.x = event->button.x; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
853 mdi->drag_start.y = event->button.y; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
854 } |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
855 break; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
856 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
857 case GDK_BUTTON_RELEASE: |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
858 if (mdi->drag_button < 0) |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
859 return FALSE; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
860 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
861 if (mdi->drag_button == event->button.button) |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
862 { |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
863 int x, y; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
864 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
865 gdk_pointer_ungrab (event->button.time); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
866 mdi->drag_button = -1; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
867 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
868 x = event->button.x + child->x - mdi->drag_start.x; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
869 y = event->button.y + child->y - mdi->drag_start.y; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
870 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
871 gtk_mdi_move (mdi, child->child, x, y); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
872 } |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
873 break; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
874 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
875 case GDK_MOTION_NOTIFY: |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
876 { |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
877 int x, y; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
878 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
879 if (mdi->drag_button < 0) |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
880 return FALSE; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
881 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
882 gdk_window_get_pointer (widget->window, &x, &y, NULL); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
883 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
884 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
885 x = x - mdi->drag_start.x + child->x; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
886 y = y - mdi->drag_start.y + child->y; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
887 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
888 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
889 gtk_mdi_move (mdi, child->child, x, y); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
890 } |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
891 break; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
892 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
893 default: |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
894 break; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
895 } |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
896 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
897 return FALSE; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
898 } |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
899 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
900 static gboolean resize_child_callback(GtkWidget *widget, GdkEvent *event, gpointer data) |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
901 { |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
902 GtkMdi *mdi; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
903 GtkMdiChild *child; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
904 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
905 child = (GtkMdiChild *) data; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
906 mdi = child->mdi; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
907 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
908 g_return_val_if_fail (GTK_IS_MDI (mdi), FALSE); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
909 g_return_val_if_fail (GTK_IS_EVENT_BOX (widget), FALSE); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
910 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
911 switch (event->type) |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
912 { |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
913 case GDK_BUTTON_PRESS: |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
914 if (mdi->drag_button < 0) |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
915 { |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
916 if (gdk_pointer_grab (event->button.window, |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
917 FALSE, |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
918 GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
919 GDK_BUTTON_RELEASE_MASK, |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
920 NULL, |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
921 NULL, |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
922 event->button.time) != GDK_GRAB_SUCCESS) |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
923 return FALSE; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
924 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
925 mdi->drag_button = event->button.button; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
926 if ((child->state == CHILD_MAXIMIZED) || (child->state == CHILD_ICONIFIED)) |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
927 { |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
928 child->state = CHILD_NORMAL; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
929 child->x = child->widget->allocation.x; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
930 child->y = child->widget->allocation.y; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
931 child->width = child->widget->allocation.width; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
932 child->height = child->widget->allocation.height; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
933 } |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
934 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
935 } |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
936 break; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
937 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
938 case GDK_BUTTON_RELEASE: |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
939 if (mdi->drag_button < 0) |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
940 return FALSE; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
941 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
942 if (mdi->drag_button == event->button.button) |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
943 { |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
944 int width, height; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
945 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
946 gdk_pointer_ungrab (event->button.time); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
947 mdi->drag_button = -1; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
948 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
949 width = event->button.x + widget->allocation.x; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
950 height = event->button.y + widget->allocation.y; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
951 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
952 width = MAX (width, GTK_MDI_MIN_WIDTH); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
953 height = MAX (height, GTK_MDI_MIN_HEIGHT); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
954 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
955 gtk_widget_set_size_request (child->widget, width, height); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
956 gtk_widget_queue_resize (child->widget); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
957 } |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
958 break; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
959 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
960 case GDK_MOTION_NOTIFY: |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
961 { |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
962 int x, y; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
963 int width, height; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
964 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
965 if (mdi->drag_button < 0) |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
966 return FALSE; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
967 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
968 gdk_window_get_pointer (widget->window, &x, &y, NULL); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
969 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
970 width = x + widget->allocation.x; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
971 height = y + widget->allocation.y; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
972 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
973 width = MAX (width, GTK_MDI_MIN_WIDTH); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
974 height = MAX (height, GTK_MDI_MIN_HEIGHT); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
975 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
976 gtk_widget_set_size_request (child->widget, width, height); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
977 gtk_widget_queue_resize (child->widget); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
978 } |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
979 break; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
980 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
981 default: |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
982 break; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
983 } |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
984 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
985 return FALSE; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
986 } |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
987 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
988 static gboolean iconify_child_callback (GtkWidget *widget, GdkEvent *event, gpointer data) |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
989 { |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
990 GtkMdiChild *child; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
991 child = (GtkMdiChild *) data; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
992 if (child->state == CHILD_ICONIFIED) |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
993 { |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
994 child->state = CHILD_NORMAL; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
995 } |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
996 else |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
997 { |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
998 child->state = CHILD_ICONIFIED; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
999 } |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
1000 if (GTK_WIDGET_VISIBLE (child->widget)) |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
1001 gtk_widget_queue_resize (GTK_WIDGET (child->widget)); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
1002 return FALSE; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
1003 } |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
1004 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
1005 static gboolean maximize_child_callback (GtkWidget *widget, GdkEvent * event, gpointer data) |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
1006 { |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
1007 GtkMdiChild *child; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
1008 child = (GtkMdiChild *) data; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
1009 if (child->state == CHILD_MAXIMIZED) |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
1010 { |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
1011 child->state = CHILD_NORMAL; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
1012 } |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
1013 else |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
1014 { |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
1015 child->state = CHILD_MAXIMIZED; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
1016 } |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
1017 if (GTK_WIDGET_VISIBLE (child->widget)) |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
1018 gtk_widget_queue_resize (GTK_WIDGET (child->widget)); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
1019 return FALSE; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
1020 } |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
1021 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
1022 static gboolean kill_child_callback (GtkWidget *widget, GdkEvent *event, gpointer data) |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
1023 { |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
1024 GtkMdiChild *child; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
1025 GtkMdi *mdi; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
1026 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
1027 child = (GtkMdiChild *) data; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
1028 mdi = child->mdi; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
1029 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
1030 g_return_val_if_fail (GTK_IS_MDI (mdi), FALSE); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
1031 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
1032 gtk_mdi_remove_true (GTK_CONTAINER (mdi), child->widget); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
1033 return FALSE; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
1034 } |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
1035 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
1036 static GtkMdiChild *get_child (GtkMdi *mdi, GtkWidget *widget) |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
1037 { |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
1038 GList *children; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
1039 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
1040 children = mdi->children; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
1041 while (children) |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
1042 { |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
1043 GtkMdiChild *child; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
1044 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
1045 child = children->data; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
1046 children = children->next; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
1047 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
1048 if (child->child == widget) |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
1049 return child; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
1050 } |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
1051 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
1052 return NULL; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
1053 } |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
1054 #endif |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
1055 |
258
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
1056 static void _dw_msleep(long period) |
237
efa724294b5f
Use an internal sleep function to avoid needing dwcompat.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
233
diff
changeset
|
1057 { |
efa724294b5f
Use an internal sleep function to avoid needing dwcompat.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
233
diff
changeset
|
1058 #ifdef __sun__ |
efa724294b5f
Use an internal sleep function to avoid needing dwcompat.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
233
diff
changeset
|
1059 /* usleep() isn't threadsafe on Solaris */ |
efa724294b5f
Use an internal sleep function to avoid needing dwcompat.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
233
diff
changeset
|
1060 struct timespec req; |
efa724294b5f
Use an internal sleep function to avoid needing dwcompat.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
233
diff
changeset
|
1061 |
efa724294b5f
Use an internal sleep function to avoid needing dwcompat.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
233
diff
changeset
|
1062 req.tv_sec = 0; |
efa724294b5f
Use an internal sleep function to avoid needing dwcompat.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
233
diff
changeset
|
1063 req.tv_nsec = period * 10000000; |
efa724294b5f
Use an internal sleep function to avoid needing dwcompat.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
233
diff
changeset
|
1064 |
efa724294b5f
Use an internal sleep function to avoid needing dwcompat.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
233
diff
changeset
|
1065 nanosleep(&req, NULL); |
efa724294b5f
Use an internal sleep function to avoid needing dwcompat.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
233
diff
changeset
|
1066 #else |
efa724294b5f
Use an internal sleep function to avoid needing dwcompat.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
233
diff
changeset
|
1067 usleep(period * 1000); |
efa724294b5f
Use an internal sleep function to avoid needing dwcompat.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
233
diff
changeset
|
1068 #endif |
efa724294b5f
Use an internal sleep function to avoid needing dwcompat.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
233
diff
changeset
|
1069 } |
efa724294b5f
Use an internal sleep function to avoid needing dwcompat.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
233
diff
changeset
|
1070 |
3 | 1071 /* Finds the translation function for a given signal name */ |
258
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
1072 static void *_findsigfunc(char *signame) |
3 | 1073 { |
1074 int z; | |
1075 | |
1076 for(z=0;z<SIGNALMAX;z++) | |
1077 { | |
1078 if(strcasecmp(signame, SignalTranslate[z].name) == 0) | |
1079 return SignalTranslate[z].func; | |
1080 } | |
1081 return NULL; | |
1082 } | |
1083 | |
361
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1084 static SignalHandler _get_signal_handler(GtkWidget *widget, gpointer data) |
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1085 { |
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1086 int counter = (int)data; |
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1087 SignalHandler sh; |
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1088 char text[100]; |
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1089 |
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1090 sprintf(text, "_dw_sigwindow%d", counter); |
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1091 sh.window = (HWND)gtk_object_get_data(GTK_OBJECT(widget), text); |
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1092 sprintf(text, "_dw_sigfunc%d", counter); |
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1093 sh.func = (void *)gtk_object_get_data(GTK_OBJECT(widget), text); |
409
1d7be77cbfb5
Implemented signal removal system so it works like OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
407
diff
changeset
|
1094 sprintf(text, "_dw_intfunc%d", counter); |
1d7be77cbfb5
Implemented signal removal system so it works like OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
407
diff
changeset
|
1095 sh.intfunc = (void *)gtk_object_get_data(GTK_OBJECT(widget), text); |
361
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1096 sprintf(text, "_dw_sigdata%d", counter); |
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1097 sh.data = gtk_object_get_data(GTK_OBJECT(widget), text); |
409
1d7be77cbfb5
Implemented signal removal system so it works like OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
407
diff
changeset
|
1098 sprintf(text, "_dw_sigcid%d", counter); |
1d7be77cbfb5
Implemented signal removal system so it works like OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
407
diff
changeset
|
1099 sh.cid = (gint)gtk_object_get_data(GTK_OBJECT(widget), text); |
361
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1100 |
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1101 return sh; |
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1102 } |
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1103 |
409
1d7be77cbfb5
Implemented signal removal system so it works like OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
407
diff
changeset
|
1104 static void _remove_signal_handler(GtkWidget *widget, int counter) |
1d7be77cbfb5
Implemented signal removal system so it works like OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
407
diff
changeset
|
1105 { |
1d7be77cbfb5
Implemented signal removal system so it works like OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
407
diff
changeset
|
1106 char text[100]; |
1d7be77cbfb5
Implemented signal removal system so it works like OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
407
diff
changeset
|
1107 gint cid; |
1d7be77cbfb5
Implemented signal removal system so it works like OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
407
diff
changeset
|
1108 |
1d7be77cbfb5
Implemented signal removal system so it works like OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
407
diff
changeset
|
1109 sprintf(text, "_dw_sigcid%d", counter); |
1d7be77cbfb5
Implemented signal removal system so it works like OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
407
diff
changeset
|
1110 cid = (gint)gtk_object_get_data(GTK_OBJECT(widget), text); |
1d7be77cbfb5
Implemented signal removal system so it works like OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
407
diff
changeset
|
1111 gtk_signal_disconnect(GTK_OBJECT(widget), cid); |
1d7be77cbfb5
Implemented signal removal system so it works like OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
407
diff
changeset
|
1112 gtk_object_set_data(GTK_OBJECT(widget), text, NULL); |
1d7be77cbfb5
Implemented signal removal system so it works like OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
407
diff
changeset
|
1113 sprintf(text, "_dw_sigwindow%d", counter); |
1d7be77cbfb5
Implemented signal removal system so it works like OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
407
diff
changeset
|
1114 gtk_object_set_data(GTK_OBJECT(widget), text, NULL); |
1d7be77cbfb5
Implemented signal removal system so it works like OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
407
diff
changeset
|
1115 sprintf(text, "_dw_sigfunc%d", counter); |
1d7be77cbfb5
Implemented signal removal system so it works like OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
407
diff
changeset
|
1116 gtk_object_set_data(GTK_OBJECT(widget), text, NULL); |
1d7be77cbfb5
Implemented signal removal system so it works like OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
407
diff
changeset
|
1117 sprintf(text, "_dw_intfunc%d", counter); |
1d7be77cbfb5
Implemented signal removal system so it works like OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
407
diff
changeset
|
1118 gtk_object_set_data(GTK_OBJECT(widget), text, NULL); |
1d7be77cbfb5
Implemented signal removal system so it works like OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
407
diff
changeset
|
1119 sprintf(text, "_dw_sigdata%d", counter); |
1d7be77cbfb5
Implemented signal removal system so it works like OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
407
diff
changeset
|
1120 gtk_object_set_data(GTK_OBJECT(widget), text, NULL); |
1d7be77cbfb5
Implemented signal removal system so it works like OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
407
diff
changeset
|
1121 } |
1d7be77cbfb5
Implemented signal removal system so it works like OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
407
diff
changeset
|
1122 |
1d7be77cbfb5
Implemented signal removal system so it works like OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
407
diff
changeset
|
1123 static int _set_signal_handler(GtkWidget *widget, HWND window, void *func, gpointer data, void *intfunc) |
361
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1124 { |
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1125 int counter = (int)gtk_object_get_data(GTK_OBJECT(widget), "_dw_sigcounter"); |
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1126 char text[100]; |
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1127 |
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1128 sprintf(text, "_dw_sigwindow%d", counter); |
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1129 gtk_object_set_data(GTK_OBJECT(widget), text, (gpointer)window); |
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1130 sprintf(text, "_dw_sigfunc%d", counter); |
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1131 gtk_object_set_data(GTK_OBJECT(widget), text, (gpointer)func); |
409
1d7be77cbfb5
Implemented signal removal system so it works like OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
407
diff
changeset
|
1132 sprintf(text, "_dw_intfunc%d", counter); |
1d7be77cbfb5
Implemented signal removal system so it works like OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
407
diff
changeset
|
1133 gtk_object_set_data(GTK_OBJECT(widget), text, (gpointer)intfunc); |
361
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1134 sprintf(text, "_dw_sigdata%d", counter); |
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1135 gtk_object_set_data(GTK_OBJECT(widget), text, (gpointer)data); |
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1136 |
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1137 counter++; |
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1138 gtk_object_set_data(GTK_OBJECT(widget), "_dw_sigcounter", (gpointer)counter); |
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1139 |
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1140 return counter - 1; |
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1141 } |
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1142 |
409
1d7be77cbfb5
Implemented signal removal system so it works like OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
407
diff
changeset
|
1143 static void _set_signal_handler_id(GtkWidget *widget, int counter, gint cid) |
1d7be77cbfb5
Implemented signal removal system so it works like OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
407
diff
changeset
|
1144 { |
1d7be77cbfb5
Implemented signal removal system so it works like OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
407
diff
changeset
|
1145 char text[100]; |
1d7be77cbfb5
Implemented signal removal system so it works like OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
407
diff
changeset
|
1146 |
1d7be77cbfb5
Implemented signal removal system so it works like OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
407
diff
changeset
|
1147 sprintf(text, "_dw_sigcid%d", counter); |
1d7be77cbfb5
Implemented signal removal system so it works like OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
407
diff
changeset
|
1148 gtk_object_set_data(GTK_OBJECT(widget), text, (gpointer)cid); |
1d7be77cbfb5
Implemented signal removal system so it works like OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
407
diff
changeset
|
1149 } |
1d7be77cbfb5
Implemented signal removal system so it works like OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
407
diff
changeset
|
1150 |
258
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
1151 static gint _set_focus_event(GtkWindow *window, GtkWidget *widget, gpointer data) |
14
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
1152 { |
361
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1153 SignalHandler work = _get_signal_handler((GtkWidget *)window, data); |
131
594307469c79
Signal handler code cleanups for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
130
diff
changeset
|
1154 int retval = FALSE; |
14
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
1155 |
361
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1156 if(work.window) |
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1157 { |
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1158 int (*setfocusfunc)(HWND, void *) = work.func; |
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1159 |
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1160 retval = setfocusfunc(work.window, work.data); |
131
594307469c79
Signal handler code cleanups for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
130
diff
changeset
|
1161 } |
594307469c79
Signal handler code cleanups for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
130
diff
changeset
|
1162 return retval; |
14
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
1163 } |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
1164 |
258
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
1165 static gint _button_press_event(GtkWidget *widget, GdkEventButton *event, gpointer data) |
3 | 1166 { |
361
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1167 SignalHandler work = _get_signal_handler(widget, data); |
131
594307469c79
Signal handler code cleanups for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
130
diff
changeset
|
1168 int retval = FALSE; |
3 | 1169 |
361
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1170 if(work.window) |
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1171 { |
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1172 int (*buttonfunc)(HWND, int, int, int, void *) = work.func; |
3 | 1173 int mybutton = event->button; |
1174 | |
1175 if(event->button == 3) | |
1176 mybutton = 2; | |
1177 else if(event->button == 2) | |
1178 mybutton = 3; | |
1179 | |
361
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1180 retval = buttonfunc(work.window, event->x, event->y, mybutton, work.data); |
131
594307469c79
Signal handler code cleanups for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
130
diff
changeset
|
1181 } |
594307469c79
Signal handler code cleanups for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
130
diff
changeset
|
1182 return retval; |
3 | 1183 } |
1184 | |
258
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
1185 static gint _button_release_event(GtkWidget *widget, GdkEventButton *event, gpointer data) |
3 | 1186 { |
361
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1187 SignalHandler work = _get_signal_handler(widget, data); |
131
594307469c79
Signal handler code cleanups for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
130
diff
changeset
|
1188 int retval = FALSE; |
3 | 1189 |
361
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1190 if(work.window) |
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1191 { |
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1192 int (*buttonfunc)(HWND, int, int, int, void *) = work.func; |
3 | 1193 int mybutton = event->button; |
1194 | |
1195 if(event->button == 3) | |
1196 mybutton = 2; | |
1197 else if(event->button == 2) | |
1198 mybutton = 3; | |
1199 | |
361
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1200 retval = buttonfunc(work.window, event->x, event->y, mybutton, work.data); |
131
594307469c79
Signal handler code cleanups for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
130
diff
changeset
|
1201 } |
594307469c79
Signal handler code cleanups for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
130
diff
changeset
|
1202 return retval; |
3 | 1203 } |
1204 | |
258
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
1205 static gint _motion_notify_event(GtkWidget *widget, GdkEventMotion *event, gpointer data) |
3 | 1206 { |
361
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1207 SignalHandler work = _get_signal_handler(widget, data); |
131
594307469c79
Signal handler code cleanups for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
130
diff
changeset
|
1208 int retval = FALSE; |
3 | 1209 |
361
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1210 if(work.window) |
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1211 { |
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1212 int (*motionfunc)(HWND, int, int, int, void *) = work.func; |
3 | 1213 int keys = 0, x, y; |
1214 GdkModifierType state; | |
1215 | |
1216 if (event->is_hint) | |
1217 gdk_window_get_pointer (event->window, &x, &y, &state); | |
1218 else | |
1219 { | |
1220 x = event->x; | |
1221 y = event->y; | |
1222 state = event->state; | |
1223 } | |
1224 | |
1225 if (state & GDK_BUTTON1_MASK) | |
1226 keys = DW_BUTTON1_MASK; | |
1227 if (state & GDK_BUTTON3_MASK) | |
1228 keys |= DW_BUTTON2_MASK; | |
1229 if (state & GDK_BUTTON2_MASK) | |
1230 keys |= DW_BUTTON3_MASK; | |
14
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
1231 |
361
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1232 retval = motionfunc(work.window, x, y, keys, work.data); |
131
594307469c79
Signal handler code cleanups for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
130
diff
changeset
|
1233 } |
594307469c79
Signal handler code cleanups for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
130
diff
changeset
|
1234 return retval; |
3 | 1235 } |
1236 | |
258
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
1237 static gint _delete_event(GtkWidget *widget, GdkEvent *event, gpointer data) |
3 | 1238 { |
361
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1239 SignalHandler work = _get_signal_handler(widget, data); |
131
594307469c79
Signal handler code cleanups for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
130
diff
changeset
|
1240 int retval = FALSE; |
3 | 1241 |
361
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1242 if(work.window) |
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1243 { |
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1244 int (*closefunc)(HWND, void *) = work.func; |
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1245 |
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1246 retval = closefunc(work.window, work.data); |
131
594307469c79
Signal handler code cleanups for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
130
diff
changeset
|
1247 } |
594307469c79
Signal handler code cleanups for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
130
diff
changeset
|
1248 return retval; |
3 | 1249 } |
1250 | |
258
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
1251 static gint _key_press_event(GtkWidget *widget, GdkEventKey *event, gpointer data) |
3 | 1252 { |
361
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1253 SignalHandler work = _get_signal_handler(widget, data); |
131
594307469c79
Signal handler code cleanups for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
130
diff
changeset
|
1254 int retval = FALSE; |
3 | 1255 |
361
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1256 if(work.window) |
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1257 { |
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1258 int (*keypressfunc)(HWND, char, int, int, void *) = work.func; |
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1259 |
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1260 retval = keypressfunc(work.window, *event->string, event->keyval, |
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1261 event->state & (GDK_CONTROL_MASK | GDK_SHIFT_MASK | GDK_MOD1_MASK), work.data); |
131
594307469c79
Signal handler code cleanups for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
130
diff
changeset
|
1262 } |
594307469c79
Signal handler code cleanups for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
130
diff
changeset
|
1263 return retval; |
3 | 1264 } |
1265 | |
258
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
1266 static gint _generic_event(GtkWidget *widget, gpointer data) |
3 | 1267 { |
361
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1268 SignalHandler work = _get_signal_handler(widget, data); |
131
594307469c79
Signal handler code cleanups for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
130
diff
changeset
|
1269 int retval = FALSE; |
3 | 1270 |
361
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1271 if(work.window) |
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1272 { |
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1273 int (*genericfunc)(HWND, void *) = work.func; |
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1274 |
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1275 retval = genericfunc(work.window, work.data); |
131
594307469c79
Signal handler code cleanups for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
130
diff
changeset
|
1276 } |
594307469c79
Signal handler code cleanups for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
130
diff
changeset
|
1277 return retval; |
594307469c79
Signal handler code cleanups for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
130
diff
changeset
|
1278 } |
594307469c79
Signal handler code cleanups for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
130
diff
changeset
|
1279 |
258
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
1280 static gint _activate_event(GtkWidget *widget, gpointer data) |
3 | 1281 { |
361
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1282 SignalHandler work = _get_signal_handler(widget, data); |
131
594307469c79
Signal handler code cleanups for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
130
diff
changeset
|
1283 int retval = FALSE; |
3 | 1284 |
361
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1285 if(work.window && !_dw_ignore_click) |
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1286 { |
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1287 int (*activatefunc)(HWND, void *) = work.func; |
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1288 |
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1289 retval = activatefunc(popup ? popup : work.window, work.data); |
131
594307469c79
Signal handler code cleanups for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
130
diff
changeset
|
1290 } |
594307469c79
Signal handler code cleanups for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
130
diff
changeset
|
1291 return retval; |
3 | 1292 } |
1293 | |
258
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
1294 static gint _configure_event(GtkWidget *widget, GdkEventConfigure *event, gpointer data) |
3 | 1295 { |
361
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1296 SignalHandler work = _get_signal_handler(widget, data); |
131
594307469c79
Signal handler code cleanups for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
130
diff
changeset
|
1297 int retval = FALSE; |
3 | 1298 |
361
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1299 if(work.window) |
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1300 { |
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1301 int (*sizefunc)(HWND, int, int, void *) = work.func; |
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1302 |
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1303 retval = sizefunc(work.window, event->width, event->height, work.data); |
131
594307469c79
Signal handler code cleanups for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
130
diff
changeset
|
1304 } |
594307469c79
Signal handler code cleanups for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
130
diff
changeset
|
1305 return retval; |
594307469c79
Signal handler code cleanups for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
130
diff
changeset
|
1306 } |
594307469c79
Signal handler code cleanups for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
130
diff
changeset
|
1307 |
258
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
1308 static gint _expose_event(GtkWidget *widget, GdkEventExpose *event, gpointer data) |
3 | 1309 { |
361
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1310 SignalHandler work = _get_signal_handler(widget, data); |
131
594307469c79
Signal handler code cleanups for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
130
diff
changeset
|
1311 int retval = FALSE; |
3 | 1312 |
361
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1313 if(work.window) |
3 | 1314 { |
1315 DWExpose exp; | |
361
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1316 int (*exposefunc)(HWND, DWExpose *, void *) = work.func; |
3 | 1317 |
1318 exp.x = event->area.x; | |
1319 exp.y = event->area.y; | |
1320 exp.width = event->area.width; | |
1321 exp.height = event->area.height; | |
361
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1322 retval = exposefunc(work.window, &exp, work.data); |
131
594307469c79
Signal handler code cleanups for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
130
diff
changeset
|
1323 } |
594307469c79
Signal handler code cleanups for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
130
diff
changeset
|
1324 return retval; |
594307469c79
Signal handler code cleanups for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
130
diff
changeset
|
1325 } |
594307469c79
Signal handler code cleanups for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
130
diff
changeset
|
1326 |
258
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
1327 static gint _item_select_event(GtkWidget *widget, GtkWidget *child, gpointer data) |
3 | 1328 { |
361
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1329 SignalHandler work = _get_signal_handler(widget, data); |
39
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
37
diff
changeset
|
1330 static int _dw_recursing = 0; |
131
594307469c79
Signal handler code cleanups for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
130
diff
changeset
|
1331 int retval = FALSE; |
39
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
37
diff
changeset
|
1332 |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
37
diff
changeset
|
1333 if(_dw_recursing) |
131
594307469c79
Signal handler code cleanups for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
130
diff
changeset
|
1334 return FALSE; |
3 | 1335 |
361
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1336 if(work.window) |
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1337 { |
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1338 int (*selectfunc)(HWND, int, void *) = work.func; |
3 | 1339 GList *list; |
1340 int item = 0; | |
1341 | |
39
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
37
diff
changeset
|
1342 _dw_recursing = 1; |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
37
diff
changeset
|
1343 |
361
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1344 if(GTK_IS_COMBO(work.window)) |
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1345 list = GTK_LIST(GTK_COMBO(work.window)->list)->children; |
3 | 1346 else if(GTK_IS_LIST(widget)) |
1347 list = GTK_LIST(widget)->children; | |
1348 else | |
131
594307469c79
Signal handler code cleanups for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
130
diff
changeset
|
1349 return FALSE; |
3 | 1350 |
1351 while(list) | |
1352 { | |
1353 if(list->data == (gpointer)child) | |
1354 { | |
361
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1355 if(!gtk_object_get_data(GTK_OBJECT(work.window), "_dw_appending")) |
114
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
1356 { |
361
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1357 gtk_object_set_data(GTK_OBJECT(work.window), "_dw_item", (gpointer)item); |
115
2d121d4d90c0
Run the _item_select_event() handler on comboboxes even if a handler
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
114
diff
changeset
|
1358 if(selectfunc) |
361
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1359 retval = selectfunc(work.window, item, work.data); |
114
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
1360 } |
3 | 1361 break; |
1362 } | |
1363 item++; | |
1364 list = list->next; | |
1365 } | |
39
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
37
diff
changeset
|
1366 _dw_recursing = 0; |
3 | 1367 } |
131
594307469c79
Signal handler code cleanups for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
130
diff
changeset
|
1368 return retval; |
594307469c79
Signal handler code cleanups for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
130
diff
changeset
|
1369 } |
594307469c79
Signal handler code cleanups for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
130
diff
changeset
|
1370 |
258
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
1371 static gint _container_context_event(GtkWidget *widget, GdkEventButton *event, gpointer data) |
3 | 1372 { |
361
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1373 SignalHandler work = _get_signal_handler(widget, data); |
131
594307469c79
Signal handler code cleanups for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
130
diff
changeset
|
1374 int retval = FALSE; |
3 | 1375 |
361
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1376 if(work.window) |
3 | 1377 { |
1378 if(event->button == 3) | |
1379 { | |
361
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1380 int (*contextfunc)(HWND, char *, int, int, void *, void *) = work.func; |
3 | 1381 char *text; |
1382 int row, col; | |
1383 | |
1384 gtk_clist_get_selection_info(GTK_CLIST(widget), event->x, event->y, &row, &col); | |
1385 | |
1386 text = (char *)gtk_clist_get_row_data(GTK_CLIST(widget), row); | |
361
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1387 retval = contextfunc(work.window, text, event->x, event->y, work.data, NULL); |
3 | 1388 } |
1389 } | |
131
594307469c79
Signal handler code cleanups for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
130
diff
changeset
|
1390 return retval; |
594307469c79
Signal handler code cleanups for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
130
diff
changeset
|
1391 } |
594307469c79
Signal handler code cleanups for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
130
diff
changeset
|
1392 |
258
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
1393 static gint _tree_context_event(GtkWidget *widget, GdkEventButton *event, gpointer data) |
54
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
1394 { |
361
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1395 SignalHandler work = _get_signal_handler(widget, data); |
131
594307469c79
Signal handler code cleanups for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
130
diff
changeset
|
1396 int retval = FALSE; |
54
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
1397 |
361
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1398 if(work.window) |
54
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
1399 { |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
1400 if(event->button == 3) |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
1401 { |
140
e0e73b4372a6
GTK 2.0 tree control is now fully functional. I just need to check for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
139
diff
changeset
|
1402 #if GTK_MAJOR_VERSION > 1 |
361
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1403 int (*contextfunc)(HWND, char *, int, int, void *, void *) = work.func; |
140
e0e73b4372a6
GTK 2.0 tree control is now fully functional. I just need to check for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
139
diff
changeset
|
1404 char *text = NULL; |
e0e73b4372a6
GTK 2.0 tree control is now fully functional. I just need to check for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
139
diff
changeset
|
1405 void *itemdata = NULL; |
e0e73b4372a6
GTK 2.0 tree control is now fully functional. I just need to check for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
139
diff
changeset
|
1406 |
e0e73b4372a6
GTK 2.0 tree control is now fully functional. I just need to check for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
139
diff
changeset
|
1407 if(widget && GTK_IS_TREE_VIEW(widget)) |
e0e73b4372a6
GTK 2.0 tree control is now fully functional. I just need to check for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
139
diff
changeset
|
1408 { |
e0e73b4372a6
GTK 2.0 tree control is now fully functional. I just need to check for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
139
diff
changeset
|
1409 GtkTreeSelection *sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(widget)); |
e0e73b4372a6
GTK 2.0 tree control is now fully functional. I just need to check for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
139
diff
changeset
|
1410 GtkTreeIter iter; |
e0e73b4372a6
GTK 2.0 tree control is now fully functional. I just need to check for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
139
diff
changeset
|
1411 |
e0e73b4372a6
GTK 2.0 tree control is now fully functional. I just need to check for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
139
diff
changeset
|
1412 if(sel && gtk_tree_selection_get_selected(sel, NULL, &iter)) |
e0e73b4372a6
GTK 2.0 tree control is now fully functional. I just need to check for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
139
diff
changeset
|
1413 { |
e0e73b4372a6
GTK 2.0 tree control is now fully functional. I just need to check for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
139
diff
changeset
|
1414 GtkTreeModel *store = (GtkTreeModel *)gtk_object_get_data(GTK_OBJECT(widget), "_dw_tree_store"); |
e0e73b4372a6
GTK 2.0 tree control is now fully functional. I just need to check for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
139
diff
changeset
|
1415 gtk_tree_model_get(store, &iter, 0, &text, 2, &itemdata, -1); |
e0e73b4372a6
GTK 2.0 tree control is now fully functional. I just need to check for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
139
diff
changeset
|
1416 } |
e0e73b4372a6
GTK 2.0 tree control is now fully functional. I just need to check for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
139
diff
changeset
|
1417 } |
e0e73b4372a6
GTK 2.0 tree control is now fully functional. I just need to check for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
139
diff
changeset
|
1418 |
361
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1419 retval = contextfunc(work.window, text, event->x, event->y, work.data, itemdata); |
140
e0e73b4372a6
GTK 2.0 tree control is now fully functional. I just need to check for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
139
diff
changeset
|
1420 #else |
361
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1421 int (*contextfunc)(HWND, char *, int, int, void *, void *) = work.func; |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
1422 char *text = (char *)gtk_object_get_data(GTK_OBJECT(widget), "_dw_text"); |
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
1423 void *itemdata = (void *)gtk_object_get_data(GTK_OBJECT(widget), "_dw_itemdata"); |
54
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
1424 |
361
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1425 if(widget != work.window) |
54
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
1426 { |
361
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1427 GtkWidget *tree = (GtkWidget *)gtk_object_get_user_data(GTK_OBJECT(work.window)); |
54
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
1428 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
1429 if(tree && GTK_IS_TREE(tree)) |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
1430 { |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
1431 GtkWidget *lastselect = (GtkWidget *)gtk_object_get_data(GTK_OBJECT(tree), "_dw_lastselect"); |
54
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
1432 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
1433 if(lastselect && GTK_IS_TREE_ITEM(lastselect)) |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
1434 { |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
1435 text = (char *)gtk_object_get_data(GTK_OBJECT(lastselect), "_dw_text"); |
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
1436 itemdata = (void *)gtk_object_get_data(GTK_OBJECT(lastselect), "_dw_itemdata"); |
54
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
1437 } |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
1438 } |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
1439 } |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
1440 |
361
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1441 retval = contextfunc(work.window, text, event->x, event->y, work.data, itemdata); |
140
e0e73b4372a6
GTK 2.0 tree control is now fully functional. I just need to check for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
139
diff
changeset
|
1442 #endif |
54
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
1443 } |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
1444 } |
131
594307469c79
Signal handler code cleanups for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
130
diff
changeset
|
1445 return retval; |
594307469c79
Signal handler code cleanups for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
130
diff
changeset
|
1446 } |
594307469c79
Signal handler code cleanups for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
130
diff
changeset
|
1447 |
140
e0e73b4372a6
GTK 2.0 tree control is now fully functional. I just need to check for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
139
diff
changeset
|
1448 #if GTK_MAJOR_VERSION > 1 |
258
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
1449 static gint _tree_select_event(GtkTreeSelection *sel, gpointer data) |
140
e0e73b4372a6
GTK 2.0 tree control is now fully functional. I just need to check for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
139
diff
changeset
|
1450 { |
361
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1451 GtkWidget *item, *widget = (GtkWidget *)gtk_tree_selection_get_tree_view(sel); |
140
e0e73b4372a6
GTK 2.0 tree control is now fully functional. I just need to check for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
139
diff
changeset
|
1452 int retval = FALSE; |
e0e73b4372a6
GTK 2.0 tree control is now fully functional. I just need to check for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
139
diff
changeset
|
1453 |
362
eb61b854fd58
Fixes for new signal handler code, for GTK 2.x tree control.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
361
diff
changeset
|
1454 if(widget) |
eb61b854fd58
Fixes for new signal handler code, for GTK 2.x tree control.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
361
diff
changeset
|
1455 { |
eb61b854fd58
Fixes for new signal handler code, for GTK 2.x tree control.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
361
diff
changeset
|
1456 SignalHandler work = _get_signal_handler(widget, data); |
eb61b854fd58
Fixes for new signal handler code, for GTK 2.x tree control.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
361
diff
changeset
|
1457 |
eb61b854fd58
Fixes for new signal handler code, for GTK 2.x tree control.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
361
diff
changeset
|
1458 if(work.window) |
140
e0e73b4372a6
GTK 2.0 tree control is now fully functional. I just need to check for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
139
diff
changeset
|
1459 { |
362
eb61b854fd58
Fixes for new signal handler code, for GTK 2.x tree control.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
361
diff
changeset
|
1460 int (*treeselectfunc)(HWND, HTREEITEM, char *, void *, void *) = work.func; |
eb61b854fd58
Fixes for new signal handler code, for GTK 2.x tree control.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
361
diff
changeset
|
1461 GtkTreeIter iter; |
eb61b854fd58
Fixes for new signal handler code, for GTK 2.x tree control.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
361
diff
changeset
|
1462 char *text = NULL; |
eb61b854fd58
Fixes for new signal handler code, for GTK 2.x tree control.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
361
diff
changeset
|
1463 void *itemdata = NULL; |
eb61b854fd58
Fixes for new signal handler code, for GTK 2.x tree control.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
361
diff
changeset
|
1464 |
eb61b854fd58
Fixes for new signal handler code, for GTK 2.x tree control.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
361
diff
changeset
|
1465 if(gtk_tree_selection_get_selected(sel, NULL, &iter)) |
eb61b854fd58
Fixes for new signal handler code, for GTK 2.x tree control.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
361
diff
changeset
|
1466 { |
eb61b854fd58
Fixes for new signal handler code, for GTK 2.x tree control.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
361
diff
changeset
|
1467 GtkTreeModel *store = (GtkTreeModel *)gtk_object_get_data(GTK_OBJECT(widget), "_dw_tree_store"); |
eb61b854fd58
Fixes for new signal handler code, for GTK 2.x tree control.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
361
diff
changeset
|
1468 gtk_tree_model_get(store, &iter, 0, &text, 2, &itemdata, 3, &item, -1); |
eb61b854fd58
Fixes for new signal handler code, for GTK 2.x tree control.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
361
diff
changeset
|
1469 retval = treeselectfunc(work.window, (HTREEITEM)item, text, work.data, itemdata); |
eb61b854fd58
Fixes for new signal handler code, for GTK 2.x tree control.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
361
diff
changeset
|
1470 } |
140
e0e73b4372a6
GTK 2.0 tree control is now fully functional. I just need to check for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
139
diff
changeset
|
1471 } |
e0e73b4372a6
GTK 2.0 tree control is now fully functional. I just need to check for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
139
diff
changeset
|
1472 } |
e0e73b4372a6
GTK 2.0 tree control is now fully functional. I just need to check for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
139
diff
changeset
|
1473 return retval; |
e0e73b4372a6
GTK 2.0 tree control is now fully functional. I just need to check for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
139
diff
changeset
|
1474 } |
478
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
472
diff
changeset
|
1475 |
480
8832ad52486f
New tree code fixes for GTK 2.x
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
479
diff
changeset
|
1476 static gint _tree_expand_event(GtkTreeView *widget, GtkTreeIter *iter, GtkTreePath *path, gpointer data) |
8832ad52486f
New tree code fixes for GTK 2.x
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
479
diff
changeset
|
1477 { |
8832ad52486f
New tree code fixes for GTK 2.x
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
479
diff
changeset
|
1478 SignalHandler work = _get_signal_handler((GtkWidget *)widget, data); |
478
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
472
diff
changeset
|
1479 int retval = FALSE; |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
472
diff
changeset
|
1480 |
483
1cb1b87bbd30
Fixes for the Unix file browser... seems to have revealed a problem in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
482
diff
changeset
|
1481 if(!_dw_ignore_expand && work.window) |
478
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
472
diff
changeset
|
1482 { |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
472
diff
changeset
|
1483 int (*treeexpandfunc)(HWND, HTREEITEM, void *) = work.func; |
480
8832ad52486f
New tree code fixes for GTK 2.x
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
479
diff
changeset
|
1484 retval = treeexpandfunc(work.window, (HTREEITEM)iter, work.data); |
478
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
472
diff
changeset
|
1485 } |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
472
diff
changeset
|
1486 return retval; |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
472
diff
changeset
|
1487 } |
140
e0e73b4372a6
GTK 2.0 tree control is now fully functional. I just need to check for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
139
diff
changeset
|
1488 #else |
258
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
1489 static gint _tree_select_event(GtkTree *tree, GtkWidget *child, gpointer data) |
30
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
22
diff
changeset
|
1490 { |
361
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1491 SignalHandler work = _get_signal_handler((GtkWidget *)tree, data); |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
1492 GtkWidget *treeroot = (GtkWidget *)gtk_object_get_data(GTK_OBJECT(child), "_dw_tree"); |
131
594307469c79
Signal handler code cleanups for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
130
diff
changeset
|
1493 int retval = FALSE; |
107
cd0e5cf92f6a
Rewrote the Windows packing code so it is more like OS/2 to improve window
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
96
diff
changeset
|
1494 |
cd0e5cf92f6a
Rewrote the Windows packing code so it is more like OS/2 to improve window
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
96
diff
changeset
|
1495 if(treeroot && GTK_IS_TREE(treeroot)) |
cd0e5cf92f6a
Rewrote the Windows packing code so it is more like OS/2 to improve window
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
96
diff
changeset
|
1496 { |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
1497 GtkWidget *lastselect = (GtkWidget *)gtk_object_get_data(GTK_OBJECT(treeroot), "_dw_lastselect"); |
107
cd0e5cf92f6a
Rewrote the Windows packing code so it is more like OS/2 to improve window
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
96
diff
changeset
|
1498 if(lastselect && GTK_IS_TREE_ITEM(lastselect)) |
cd0e5cf92f6a
Rewrote the Windows packing code so it is more like OS/2 to improve window
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
96
diff
changeset
|
1499 gtk_tree_item_deselect(GTK_TREE_ITEM(lastselect)); |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
1500 gtk_object_set_data(GTK_OBJECT(treeroot), "_dw_lastselect", (gpointer)child); |
107
cd0e5cf92f6a
Rewrote the Windows packing code so it is more like OS/2 to improve window
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
96
diff
changeset
|
1501 } |
30
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
22
diff
changeset
|
1502 |
361
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1503 if(work.window) |
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1504 { |
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1505 int (*treeselectfunc)(HWND, HTREEITEM, char *, void *, void *) = work.func; |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
1506 char *text = (char *)gtk_object_get_data(GTK_OBJECT(child), "_dw_text"); |
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
1507 void *itemdata = (void *)gtk_object_get_data(GTK_OBJECT(child), "_dw_itemdata"); |
361
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1508 retval = treeselectfunc(work.window, (HTREEITEM)child, text, work.data, itemdata); |
131
594307469c79
Signal handler code cleanups for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
130
diff
changeset
|
1509 } |
594307469c79
Signal handler code cleanups for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
130
diff
changeset
|
1510 return retval; |
594307469c79
Signal handler code cleanups for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
130
diff
changeset
|
1511 } |
478
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
472
diff
changeset
|
1512 |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
472
diff
changeset
|
1513 static gint _tree_expand_event(GtkTreeItem *treeitem, gpointer data) |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
472
diff
changeset
|
1514 { |
479
61e2973ad093
Minor compile fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
478
diff
changeset
|
1515 SignalHandler work = _get_signal_handler((GtkWidget *)treeitem, data); |
478
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
472
diff
changeset
|
1516 int retval = FALSE; |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
472
diff
changeset
|
1517 |
483
1cb1b87bbd30
Fixes for the Unix file browser... seems to have revealed a problem in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
482
diff
changeset
|
1518 if(!_dw_ignore_expand && work.window) |
478
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
472
diff
changeset
|
1519 { |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
472
diff
changeset
|
1520 int (*treeexpandfunc)(HWND, HTREEITEM, void *) = work.func; |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
472
diff
changeset
|
1521 retval = treeexpandfunc(work.window, (HTREEITEM)treeitem, work.data); |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
472
diff
changeset
|
1522 } |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
472
diff
changeset
|
1523 return retval; |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
472
diff
changeset
|
1524 } |
140
e0e73b4372a6
GTK 2.0 tree control is now fully functional. I just need to check for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
139
diff
changeset
|
1525 #endif |
131
594307469c79
Signal handler code cleanups for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
130
diff
changeset
|
1526 |
258
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
1527 static gint _container_select_event(GtkWidget *widget, GdkEventButton *event, gpointer data) |
3 | 1528 { |
361
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1529 SignalHandler work = _get_signal_handler(widget, data); |
131
594307469c79
Signal handler code cleanups for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
130
diff
changeset
|
1530 int retval = FALSE; |
3 | 1531 |
361
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1532 if(work.window) |
3 | 1533 { |
1534 if(event->button == 1 && event->type == GDK_2BUTTON_PRESS) | |
1535 { | |
361
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1536 int (*contextfunc)(HWND, char *, void *) = work.func; |
3 | 1537 char *text; |
1538 int row, col; | |
1539 | |
1540 gtk_clist_get_selection_info(GTK_CLIST(widget), event->x, event->y, &row, &col); | |
1541 | |
1542 text = (char *)gtk_clist_get_row_data(GTK_CLIST(widget), row); | |
361
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1543 retval = contextfunc(work.window, text, work.data); |
320
ae5b1eecea12
Don't send a DW_SIGNAL_ITEM_SELECT after DW_SIGNAL_ENTER.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
319
diff
changeset
|
1544 gtk_object_set_data(GTK_OBJECT(widget), "_dw_double_click", (gpointer)1); |
3 | 1545 } |
1546 } | |
131
594307469c79
Signal handler code cleanups for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
130
diff
changeset
|
1547 return retval; |
594307469c79
Signal handler code cleanups for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
130
diff
changeset
|
1548 } |
594307469c79
Signal handler code cleanups for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
130
diff
changeset
|
1549 |
364
aa827971da39
Handle ENTER keypress on the container control. Also make
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
362
diff
changeset
|
1550 static gint _container_enter_event(GtkWidget *widget, GdkEventKey *event, gpointer data) |
aa827971da39
Handle ENTER keypress on the container control. Also make
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
362
diff
changeset
|
1551 { |
aa827971da39
Handle ENTER keypress on the container control. Also make
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
362
diff
changeset
|
1552 SignalHandler work = _get_signal_handler(widget, data); |
aa827971da39
Handle ENTER keypress on the container control. Also make
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
362
diff
changeset
|
1553 int retval = FALSE; |
aa827971da39
Handle ENTER keypress on the container control. Also make
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
362
diff
changeset
|
1554 |
aa827971da39
Handle ENTER keypress on the container control. Also make
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
362
diff
changeset
|
1555 if(work.window && event->keyval == VK_RETURN) |
aa827971da39
Handle ENTER keypress on the container control. Also make
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
362
diff
changeset
|
1556 { |
aa827971da39
Handle ENTER keypress on the container control. Also make
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
362
diff
changeset
|
1557 int (*contextfunc)(HWND, char *, void *) = work.func; |
aa827971da39
Handle ENTER keypress on the container control. Also make
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
362
diff
changeset
|
1558 char *text; |
aa827971da39
Handle ENTER keypress on the container control. Also make
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
362
diff
changeset
|
1559 |
aa827971da39
Handle ENTER keypress on the container control. Also make
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
362
diff
changeset
|
1560 text = (char *)gtk_clist_get_row_data(GTK_CLIST(widget), GTK_CLIST(widget)->focus_row); |
aa827971da39
Handle ENTER keypress on the container control. Also make
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
362
diff
changeset
|
1561 retval = contextfunc(work.window, text, work.data); |
aa827971da39
Handle ENTER keypress on the container control. Also make
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
362
diff
changeset
|
1562 } |
aa827971da39
Handle ENTER keypress on the container control. Also make
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
362
diff
changeset
|
1563 return retval; |
aa827971da39
Handle ENTER keypress on the container control. Also make
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
362
diff
changeset
|
1564 } |
aa827971da39
Handle ENTER keypress on the container control. Also make
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
362
diff
changeset
|
1565 |
345
599644ca9064
Use _get_logical_page() to get the logical page from the physical page.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
340
diff
changeset
|
1566 /* Return the logical page id from the physical page id */ |
599644ca9064
Use _get_logical_page() to get the logical page from the physical page.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
340
diff
changeset
|
1567 int _get_logical_page(HWND handle, unsigned long pageid) |
599644ca9064
Use _get_logical_page() to get the logical page from the physical page.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
340
diff
changeset
|
1568 { |
599644ca9064
Use _get_logical_page() to get the logical page from the physical page.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
340
diff
changeset
|
1569 int z; |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
1570 GtkWidget **pagearray = gtk_object_get_data(GTK_OBJECT(handle), "_dw_pagearray"); |
345
599644ca9064
Use _get_logical_page() to get the logical page from the physical page.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
340
diff
changeset
|
1571 GtkWidget *thispage = gtk_notebook_get_nth_page(GTK_NOTEBOOK(handle), pageid); |
599644ca9064
Use _get_logical_page() to get the logical page from the physical page.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
340
diff
changeset
|
1572 |
599644ca9064
Use _get_logical_page() to get the logical page from the physical page.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
340
diff
changeset
|
1573 if(pagearray && thispage) |
599644ca9064
Use _get_logical_page() to get the logical page from the physical page.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
340
diff
changeset
|
1574 { |
599644ca9064
Use _get_logical_page() to get the logical page from the physical page.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
340
diff
changeset
|
1575 for(z=0;z<256;z++) |
599644ca9064
Use _get_logical_page() to get the logical page from the physical page.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
340
diff
changeset
|
1576 { |
599644ca9064
Use _get_logical_page() to get the logical page from the physical page.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
340
diff
changeset
|
1577 if(thispage == pagearray[z]) |
599644ca9064
Use _get_logical_page() to get the logical page from the physical page.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
340
diff
changeset
|
1578 return z; |
599644ca9064
Use _get_logical_page() to get the logical page from the physical page.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
340
diff
changeset
|
1579 } |
599644ca9064
Use _get_logical_page() to get the logical page from the physical page.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
340
diff
changeset
|
1580 } |
599644ca9064
Use _get_logical_page() to get the logical page from the physical page.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
340
diff
changeset
|
1581 return 256; |
599644ca9064
Use _get_logical_page() to get the logical page from the physical page.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
340
diff
changeset
|
1582 } |
599644ca9064
Use _get_logical_page() to get the logical page from the physical page.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
340
diff
changeset
|
1583 |
599644ca9064
Use _get_logical_page() to get the logical page from the physical page.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
340
diff
changeset
|
1584 |
331
20def3eaae8d
Implement handling of switch-page signal for notebooks.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
329
diff
changeset
|
1585 static gint _switch_page_event(GtkNotebook *notebook, GtkNotebookPage *page, guint page_num, gpointer data) |
20def3eaae8d
Implement handling of switch-page signal for notebooks.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
329
diff
changeset
|
1586 { |
361
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1587 SignalHandler work = _get_signal_handler((GtkWidget *)notebook, data); |
331
20def3eaae8d
Implement handling of switch-page signal for notebooks.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
329
diff
changeset
|
1588 int retval = FALSE; |
20def3eaae8d
Implement handling of switch-page signal for notebooks.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
329
diff
changeset
|
1589 |
361
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1590 if(work.window) |
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1591 { |
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1592 int (*switchpagefunc)(HWND, unsigned long, void *) = work.func; |
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1593 retval = switchpagefunc(work.window, _get_logical_page(GTK_WIDGET(notebook), page_num), work.data); |
331
20def3eaae8d
Implement handling of switch-page signal for notebooks.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
329
diff
changeset
|
1594 } |
20def3eaae8d
Implement handling of switch-page signal for notebooks.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
329
diff
changeset
|
1595 return retval; |
20def3eaae8d
Implement handling of switch-page signal for notebooks.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
329
diff
changeset
|
1596 } |
20def3eaae8d
Implement handling of switch-page signal for notebooks.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
329
diff
changeset
|
1597 |
472
d11be1f40f8c
Add support for column-click signal.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
464
diff
changeset
|
1598 static gint _column_click_event(GtkWidget *widget, gint column_num, gpointer data) |
d11be1f40f8c
Add support for column-click signal.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
464
diff
changeset
|
1599 { |
d11be1f40f8c
Add support for column-click signal.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
464
diff
changeset
|
1600 SignalHandler work = _get_signal_handler(widget, data); |
d11be1f40f8c
Add support for column-click signal.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
464
diff
changeset
|
1601 int retval = FALSE; |
d11be1f40f8c
Add support for column-click signal.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
464
diff
changeset
|
1602 |
d11be1f40f8c
Add support for column-click signal.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
464
diff
changeset
|
1603 if(work.window) |
d11be1f40f8c
Add support for column-click signal.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
464
diff
changeset
|
1604 { |
d11be1f40f8c
Add support for column-click signal.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
464
diff
changeset
|
1605 int (*clickcolumnfunc)(HWND, int, void *) = work.func; |
d11be1f40f8c
Add support for column-click signal.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
464
diff
changeset
|
1606 retval = clickcolumnfunc(work.window, column_num, work.data); |
d11be1f40f8c
Add support for column-click signal.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
464
diff
changeset
|
1607 } |
d11be1f40f8c
Add support for column-click signal.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
464
diff
changeset
|
1608 return retval; |
d11be1f40f8c
Add support for column-click signal.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
464
diff
changeset
|
1609 } |
d11be1f40f8c
Add support for column-click signal.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
464
diff
changeset
|
1610 |
258
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
1611 static gint _container_select_row(GtkWidget *widget, gint row, gint column, GdkEventButton *event, gpointer data) |
164
d35771f70bdd
Allow tree-select to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
163
diff
changeset
|
1612 { |
361
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1613 SignalHandler work = _get_signal_handler(widget, data); |
164
d35771f70bdd
Allow tree-select to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
163
diff
changeset
|
1614 char *rowdata = gtk_clist_get_row_data(GTK_CLIST(widget), row); |
361
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1615 int (*contextfunc)(HWND, HWND, char *, void *, void *) = work.func; |
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1616 |
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1617 if(!work.window) |
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1618 return TRUE; |
311
24c1dfffe97e
Unified the callback functions for tree and container widgets.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
310
diff
changeset
|
1619 |
320
ae5b1eecea12
Don't send a DW_SIGNAL_ITEM_SELECT after DW_SIGNAL_ENTER.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
319
diff
changeset
|
1620 if(gtk_object_get_data(GTK_OBJECT(widget), "_dw_double_click")) |
ae5b1eecea12
Don't send a DW_SIGNAL_ITEM_SELECT after DW_SIGNAL_ENTER.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
319
diff
changeset
|
1621 { |
ae5b1eecea12
Don't send a DW_SIGNAL_ITEM_SELECT after DW_SIGNAL_ENTER.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
319
diff
changeset
|
1622 gtk_object_set_data(GTK_OBJECT(widget), "_dw_double_click", (gpointer)0); |
ae5b1eecea12
Don't send a DW_SIGNAL_ITEM_SELECT after DW_SIGNAL_ENTER.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
319
diff
changeset
|
1623 return TRUE; |
ae5b1eecea12
Don't send a DW_SIGNAL_ITEM_SELECT after DW_SIGNAL_ENTER.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
319
diff
changeset
|
1624 } |
361
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1625 return contextfunc(work.window, 0, rowdata, work.data, 0);; |
164
d35771f70bdd
Allow tree-select to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
163
diff
changeset
|
1626 } |
d35771f70bdd
Allow tree-select to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
163
diff
changeset
|
1627 |
258
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
1628 static int _round_value(gfloat val) |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
1629 { |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
1630 int newval = (int)val; |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
1631 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
1632 if(val >= 0.5 + (gfloat)newval) |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
1633 newval++; |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
1634 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
1635 return newval; |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
1636 } |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
1637 |
258
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
1638 static gint _value_changed_event(GtkAdjustment *adjustment, gpointer data) |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
1639 { |
361
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1640 int max = _round_value(adjustment->upper); |
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1641 int val = _round_value(adjustment->value); |
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1642 GtkWidget *slider = (GtkWidget *)gtk_object_get_data(GTK_OBJECT(adjustment), "_dw_slider"); |
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1643 GtkWidget *scrollbar = (GtkWidget *)gtk_object_get_data(GTK_OBJECT(adjustment), "_dw_scrollbar"); |
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1644 |
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1645 if(slider) |
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1646 { |
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1647 SignalHandler work = _get_signal_handler((GtkWidget *)adjustment, data); |
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1648 |
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1649 if(work.window) |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
1650 { |
361
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1651 int (*valuechangedfunc)(HWND, int, void *) = work.func; |
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1652 |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
1653 if(GTK_IS_VSCALE(slider)) |
361
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1654 valuechangedfunc(work.window, (max - val) - 1, work.data); |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
1655 else |
361
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1656 valuechangedfunc(work.window, val, work.data); |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
1657 } |
361
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1658 } |
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1659 else if(scrollbar) |
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1660 { |
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1661 SignalHandler work = _get_signal_handler((GtkWidget *)adjustment, data); |
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1662 |
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1663 if(work.window) |
208
5349a0735fda
Hopefully fixed value_changed signal handler on GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
205
diff
changeset
|
1664 { |
361
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1665 int (*valuechangedfunc)(HWND, int, void *) = work.func; |
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1666 |
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
1667 valuechangedfunc(work.window, val, work.data); |
208
5349a0735fda
Hopefully fixed value_changed signal handler on GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
205
diff
changeset
|
1668 } |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
1669 } |
131
594307469c79
Signal handler code cleanups for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
130
diff
changeset
|
1670 return FALSE; |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
1671 } |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
1672 |
258
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
1673 static gint _default_key_press_event(GtkWidget *widget, GdkEventKey *event, gpointer data) |
40
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1674 { |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1675 GtkWidget *next = (GtkWidget *)data; |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1676 |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1677 if(next) |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1678 { |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1679 if(event->keyval == GDK_Return) |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1680 { |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1681 if(GTK_IS_BUTTON(next)) |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1682 gtk_signal_emit_by_name(GTK_OBJECT(next), "clicked"); |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1683 else |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1684 gtk_widget_grab_focus(next); |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1685 } |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1686 } |
131
594307469c79
Signal handler code cleanups for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
130
diff
changeset
|
1687 return FALSE; |
40
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1688 } |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1689 |
258
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
1690 static GdkPixmap *_find_private_pixmap(GdkBitmap **bitmap, long id, unsigned long *userwidth, unsigned long *userheight) |
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
1691 { |
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
1692 if(id < _PixmapCount && _PixmapArray[id].used) |
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
1693 { |
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
1694 *bitmap = _PixmapArray[id].mask; |
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
1695 if(userwidth) |
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
1696 *userwidth = _PixmapArray[id].width; |
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
1697 if(userheight) |
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
1698 *userheight = _PixmapArray[id].height; |
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
1699 return _PixmapArray[id].pixmap; |
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
1700 } |
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
1701 return NULL; |
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
1702 } |
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
1703 |
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
1704 static GdkPixmap *_find_pixmap(GdkBitmap **bitmap, long id, HWND handle, unsigned long *userwidth, unsigned long *userheight) |
3 | 1705 { |
1706 char *data = NULL; | |
1707 int z; | |
1708 | |
258
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
1709 if(id & (1 << 31)) |
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
1710 return _find_private_pixmap(bitmap, (id & 0xFFFFFF), userwidth, userheight); |
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
1711 |
3 | 1712 for(z=0;z<_resources.resource_max;z++) |
1713 { | |
1714 if(_resources.resource_id[z] == id) | |
1715 { | |
1716 data = _resources.resource_data[z]; | |
1717 break; | |
1718 } | |
1719 } | |
1720 | |
1721 if(data) | |
1722 { | |
1723 GdkPixmap *icon_pixmap = NULL; | |
120
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
1724 #if GTK_MAJOR_VERSION > 1 |
121
d8af32b1b1cd
Switch back to using pixmaps and bitmaps, only use pixbufs for doing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
120
diff
changeset
|
1725 GdkPixbuf *icon_pixbuf = gdk_pixbuf_new_from_xpm_data((const char **)data); |
d8af32b1b1cd
Switch back to using pixmaps and bitmaps, only use pixbufs for doing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
120
diff
changeset
|
1726 |
d8af32b1b1cd
Switch back to using pixmaps and bitmaps, only use pixbufs for doing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
120
diff
changeset
|
1727 if(userwidth) |
d8af32b1b1cd
Switch back to using pixmaps and bitmaps, only use pixbufs for doing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
120
diff
changeset
|
1728 *userwidth = gdk_pixbuf_get_width(icon_pixbuf); |
d8af32b1b1cd
Switch back to using pixmaps and bitmaps, only use pixbufs for doing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
120
diff
changeset
|
1729 if(userheight) |
d8af32b1b1cd
Switch back to using pixmaps and bitmaps, only use pixbufs for doing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
120
diff
changeset
|
1730 *userheight = gdk_pixbuf_get_height(icon_pixbuf); |
d8af32b1b1cd
Switch back to using pixmaps and bitmaps, only use pixbufs for doing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
120
diff
changeset
|
1731 |
d8af32b1b1cd
Switch back to using pixmaps and bitmaps, only use pixbufs for doing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
120
diff
changeset
|
1732 gdk_pixbuf_render_pixmap_and_mask(icon_pixbuf, &icon_pixmap, bitmap, 1); |
d8af32b1b1cd
Switch back to using pixmaps and bitmaps, only use pixbufs for doing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
120
diff
changeset
|
1733 g_object_unref(icon_pixbuf); |
120
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
1734 #elif defined(USE_IMLIB) |
47
997e9ed670ef
Fixes for box alignment problem on OS/2, crash in dw_bitmap_new() on unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
46
diff
changeset
|
1735 gdk_imlib_data_to_pixmap((char **)data, &icon_pixmap, bitmap); |
3 | 1736 #else |
121
d8af32b1b1cd
Switch back to using pixmaps and bitmaps, only use pixbufs for doing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
120
diff
changeset
|
1737 icon_pixmap = gdk_pixmap_create_from_xpm_d(handle->window, bitmap, &_colors[DW_CLR_PALEGRAY], (char **)data); |
3 | 1738 #endif |
1739 return icon_pixmap; | |
1740 } | |
1741 return NULL; | |
1742 } | |
1743 | |
138
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
1744 #if GTK_MAJOR_VERSION > 1 |
316
a07e08f708d6
Fixed icons in the tree control in GTK 2.x when loaded from a file.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
312
diff
changeset
|
1745 static GdkPixbuf *_find_private_pixbuf(long id) |
a07e08f708d6
Fixed icons in the tree control in GTK 2.x when loaded from a file.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
312
diff
changeset
|
1746 { |
a07e08f708d6
Fixed icons in the tree control in GTK 2.x when loaded from a file.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
312
diff
changeset
|
1747 if(id < _PixmapCount && _PixmapArray[id].used) |
a07e08f708d6
Fixed icons in the tree control in GTK 2.x when loaded from a file.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
312
diff
changeset
|
1748 return _PixmapArray[id].pixbuf; |
a07e08f708d6
Fixed icons in the tree control in GTK 2.x when loaded from a file.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
312
diff
changeset
|
1749 return NULL; |
a07e08f708d6
Fixed icons in the tree control in GTK 2.x when loaded from a file.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
312
diff
changeset
|
1750 } |
a07e08f708d6
Fixed icons in the tree control in GTK 2.x when loaded from a file.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
312
diff
changeset
|
1751 |
258
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
1752 static GdkPixbuf *_find_pixbuf(long id) |
138
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
1753 { |
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
1754 char *data = NULL; |
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
1755 int z; |
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
1756 |
316
a07e08f708d6
Fixed icons in the tree control in GTK 2.x when loaded from a file.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
312
diff
changeset
|
1757 if(id & (1 << 31)) |
a07e08f708d6
Fixed icons in the tree control in GTK 2.x when loaded from a file.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
312
diff
changeset
|
1758 return _find_private_pixbuf((id & 0xFFFFFF)); |
a07e08f708d6
Fixed icons in the tree control in GTK 2.x when loaded from a file.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
312
diff
changeset
|
1759 |
138
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
1760 for(z=0;z<_resources.resource_max;z++) |
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
1761 { |
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
1762 if(_resources.resource_id[z] == id) |
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
1763 { |
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
1764 data = _resources.resource_data[z]; |
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
1765 break; |
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
1766 } |
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
1767 } |
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
1768 |
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
1769 if(data) |
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
1770 return gdk_pixbuf_new_from_xpm_data((const char **)data); |
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
1771 return NULL; |
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
1772 } |
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
1773 #endif |
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
1774 |
258
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
1775 static void _size_allocate(GtkWindow *window) |
3 | 1776 { |
1777 XSizeHints sizehints; | |
1778 | |
1779 sizehints.base_width = 1; | |
1780 sizehints.base_height = 1; | |
1781 sizehints.width_inc = 1; | |
1782 sizehints.height_inc = 1; | |
1783 sizehints.min_width = 8; | |
1784 sizehints.min_height = 8; | |
1785 | |
1786 sizehints.flags = (PBaseSize|PMinSize|PResizeInc); | |
1787 | |
1788 XSetWMNormalHints (GDK_DISPLAY(), | |
1789 GDK_WINDOW_XWINDOW (GTK_WIDGET (window)->window), | |
1790 &sizehints); | |
1791 gdk_flush (); | |
1792 } | |
1793 | |
48
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
1794 /* Find the index of a given thread */ |
258
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
1795 static int _find_thread_index(DWTID tid) |
48
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
1796 { |
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
1797 int z; |
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
1798 |
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
1799 for(z=0;z<DW_THREAD_LIMIT;z++) |
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
1800 { |
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
1801 if(_dw_thread_list[z] == tid) |
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
1802 return z; |
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
1803 } |
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
1804 return 0; |
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
1805 } |
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
1806 |
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
1807 /* Add a thread id to the thread list */ |
258
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
1808 static void _dw_thread_add(DWTID tid) |
48
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
1809 { |
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
1810 int z; |
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
1811 |
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
1812 for(z=0;z<DW_THREAD_LIMIT;z++) |
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
1813 { |
264
20becf7df38a
Prevent duplicate thread IDs from getting added to the thread list.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
259
diff
changeset
|
1814 if(_dw_thread_list[z] == tid) |
20becf7df38a
Prevent duplicate thread IDs from getting added to the thread list.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
259
diff
changeset
|
1815 return; |
20becf7df38a
Prevent duplicate thread IDs from getting added to the thread list.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
259
diff
changeset
|
1816 |
48
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
1817 if(_dw_thread_list[z] == (DWTID)-1) |
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
1818 { |
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
1819 _dw_thread_list[z] = tid; |
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
1820 _foreground[z].pixel = _foreground[z].red =_foreground[z].green = _foreground[z].blue = 0; |
372
3ef2cf70ee07
Code for drawing text with a background color on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
369
diff
changeset
|
1821 _background[z].pixel = 1; |
3ef2cf70ee07
Code for drawing text with a background color on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
369
diff
changeset
|
1822 _background[z].red = _background[z].green = _background[z].blue = 0; |
373
d04b0699fc28
Fixes for background color drawing on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
372
diff
changeset
|
1823 _transparent[z] = 1; |
48
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
1824 return; |
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
1825 } |
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
1826 } |
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
1827 } |
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
1828 |
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
1829 /* Remove a thread id to the thread list */ |
258
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
1830 static void _dw_thread_remove(DWTID tid) |
48
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
1831 { |
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
1832 int z; |
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
1833 |
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
1834 for(z=0;z<DW_THREAD_LIMIT;z++) |
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
1835 { |
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
1836 if(_dw_thread_list[z] == (DWTID)tid) |
51
d97de82f0b6e
Fix warning on FreeBSD.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
49
diff
changeset
|
1837 _dw_thread_list[z] = (DWTID)-1; |
48
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
1838 } |
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
1839 } |
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
1840 |
3 | 1841 /* |
1842 * Initializes the Dynamic Windows engine. | |
1843 * Parameters: | |
1844 * newthread: True if this is the only thread. | |
1845 * False if there is already a message loop running. | |
1846 */ | |
134
caeb52bb5ef4
Pass pointers to argc and argv on Unix.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
133
diff
changeset
|
1847 int dw_int_init(DWResources *res, int newthread, int *argc, char **argv[]) |
3 | 1848 { |
1849 int z; | |
37
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
36
diff
changeset
|
1850 char *tmp; |
3 | 1851 |
1852 if(res) | |
1853 { | |
1854 _resources.resource_max = res->resource_max; | |
1855 _resources.resource_id = res->resource_id; | |
1856 _resources.resource_data = res->resource_data; | |
1857 } | |
1858 gtk_set_locale(); | |
1859 g_thread_init(NULL); | |
135
f57ef391f104
For GTK to be thread safe in 2.0 we must call gdk_threads_init().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
134
diff
changeset
|
1860 #if GTK_MAJOR_VERSION > 1 |
f57ef391f104
For GTK to be thread safe in 2.0 we must call gdk_threads_init().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
134
diff
changeset
|
1861 gdk_threads_init(); |
f57ef391f104
For GTK to be thread safe in 2.0 we must call gdk_threads_init().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
134
diff
changeset
|
1862 #endif |
14
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
1863 |
134
caeb52bb5ef4
Pass pointers to argc and argv on Unix.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
133
diff
changeset
|
1864 gtk_init(argc, argv); |
3 | 1865 #ifdef USE_IMLIB |
1866 gdk_imlib_init(); | |
1867 #endif | |
1868 /* Add colors to the system colormap */ | |
1869 _dw_cmap = gdk_colormap_get_system(); | |
1870 for(z=0;z<16;z++) | |
1871 gdk_color_alloc(_dw_cmap, &_colors[z]); | |
37
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
36
diff
changeset
|
1872 |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
36
diff
changeset
|
1873 tmp = getenv("DW_BORDER_WIDTH"); |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
36
diff
changeset
|
1874 if(tmp) |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
36
diff
changeset
|
1875 _dw_border_width = atoi(tmp); |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
36
diff
changeset
|
1876 tmp = getenv("DW_BORDER_HEIGHT"); |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
36
diff
changeset
|
1877 if(tmp) |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
36
diff
changeset
|
1878 _dw_border_height = atoi(tmp); |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
36
diff
changeset
|
1879 |
48
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
1880 for(z=0;z<DW_THREAD_LIMIT;z++) |
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
1881 _dw_thread_list[z] = (DWTID)-1; |
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
1882 |
77
002da4d18ac6
Set tooltip background color to yellow.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
76
diff
changeset
|
1883 gtk_rc_parse_string("style \"gtk-tooltips-style\" { bg[NORMAL] = \"#eeee00\" } widget \"gtk-tooltips\" style \"gtk-tooltips-style\""); |
002da4d18ac6
Set tooltip background color to yellow.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
76
diff
changeset
|
1884 |
3 | 1885 return TRUE; |
1886 } | |
1887 | |
1888 /* | |
1889 * Runs a message loop for Dynamic Windows. | |
150
2a0d7b57a6da
Removed unnecessary parameters from dw_main().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
149
diff
changeset
|
1890 */ |
2a0d7b57a6da
Removed unnecessary parameters from dw_main().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
149
diff
changeset
|
1891 void dw_main(void) |
3 | 1892 { |
265
84471d53ab58
Changes to dw_main_* so that the _dw_thread is set to -1 when the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
264
diff
changeset
|
1893 gdk_threads_enter(); |
3 | 1894 _dw_thread = pthread_self(); |
48
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
1895 _dw_thread_add(_dw_thread); |
3 | 1896 gtk_main(); |
265
84471d53ab58
Changes to dw_main_* so that the _dw_thread is set to -1 when the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
264
diff
changeset
|
1897 _dw_thread = (pthread_t)-1; |
3 | 1898 gdk_threads_leave(); |
1899 } | |
1900 | |
1901 /* | |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
1902 * Runs a message loop for Dynamic Windows, for a period of milliseconds. |
37
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
36
diff
changeset
|
1903 * Parameters: |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
1904 * milliseconds: Number of milliseconds to run the loop for. |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
1905 */ |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
1906 void dw_main_sleep(int milliseconds) |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
1907 { |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
1908 struct timeval tv, start; |
340
eff674cb4935
Test fix for Mark's dw_main_sleep() hang.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
338
diff
changeset
|
1909 pthread_t curr = pthread_self(); |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
1910 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
1911 gettimeofday(&start, NULL); |
37
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
36
diff
changeset
|
1912 |
340
eff674cb4935
Test fix for Mark's dw_main_sleep() hang.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
338
diff
changeset
|
1913 if(_dw_thread == (pthread_t)-1 || _dw_thread == curr) |
eff674cb4935
Test fix for Mark's dw_main_sleep() hang.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
338
diff
changeset
|
1914 { |
eff674cb4935
Test fix for Mark's dw_main_sleep() hang.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
338
diff
changeset
|
1915 pthread_t orig = _dw_thread; |
eff674cb4935
Test fix for Mark's dw_main_sleep() hang.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
338
diff
changeset
|
1916 |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
1917 gettimeofday(&tv, NULL); |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
1918 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
1919 while(((tv.tv_sec - start.tv_sec)*1000) + ((tv.tv_usec - start.tv_usec)/1000) <= milliseconds) |
37
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
36
diff
changeset
|
1920 { |
340
eff674cb4935
Test fix for Mark's dw_main_sleep() hang.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
338
diff
changeset
|
1921 if(orig == (pthread_t)-1) |
eff674cb4935
Test fix for Mark's dw_main_sleep() hang.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
338
diff
changeset
|
1922 { |
eff674cb4935
Test fix for Mark's dw_main_sleep() hang.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
338
diff
changeset
|
1923 gdk_threads_enter(); |
eff674cb4935
Test fix for Mark's dw_main_sleep() hang.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
338
diff
changeset
|
1924 _dw_thread = curr; |
eff674cb4935
Test fix for Mark's dw_main_sleep() hang.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
338
diff
changeset
|
1925 } |
37
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
36
diff
changeset
|
1926 if(gtk_events_pending()) |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
36
diff
changeset
|
1927 gtk_main_iteration(); |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
36
diff
changeset
|
1928 else |
237
efa724294b5f
Use an internal sleep function to avoid needing dwcompat.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
233
diff
changeset
|
1929 _dw_msleep(1); |
340
eff674cb4935
Test fix for Mark's dw_main_sleep() hang.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
338
diff
changeset
|
1930 if(orig == (pthread_t)-1) |
eff674cb4935
Test fix for Mark's dw_main_sleep() hang.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
338
diff
changeset
|
1931 { |
eff674cb4935
Test fix for Mark's dw_main_sleep() hang.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
338
diff
changeset
|
1932 _dw_thread = orig; |
eff674cb4935
Test fix for Mark's dw_main_sleep() hang.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
338
diff
changeset
|
1933 gdk_threads_leave(); |
eff674cb4935
Test fix for Mark's dw_main_sleep() hang.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
338
diff
changeset
|
1934 } |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
1935 gettimeofday(&tv, NULL); |
37
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
36
diff
changeset
|
1936 } |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
36
diff
changeset
|
1937 } |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
36
diff
changeset
|
1938 else |
237
efa724294b5f
Use an internal sleep function to avoid needing dwcompat.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
233
diff
changeset
|
1939 _dw_msleep(milliseconds); |
37
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
36
diff
changeset
|
1940 } |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
36
diff
changeset
|
1941 |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
36
diff
changeset
|
1942 /* |
205
b9283fd56d69
Updated scrollbar code on Unix and added dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
202
diff
changeset
|
1943 * Processes a single message iteration and returns. |
b9283fd56d69
Updated scrollbar code on Unix and added dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
202
diff
changeset
|
1944 */ |
b9283fd56d69
Updated scrollbar code on Unix and added dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
202
diff
changeset
|
1945 void dw_main_iteration(void) |
b9283fd56d69
Updated scrollbar code on Unix and added dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
202
diff
changeset
|
1946 { |
265
84471d53ab58
Changes to dw_main_* so that the _dw_thread is set to -1 when the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
264
diff
changeset
|
1947 gdk_threads_enter(); |
205
b9283fd56d69
Updated scrollbar code on Unix and added dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
202
diff
changeset
|
1948 _dw_thread = pthread_self(); |
b9283fd56d69
Updated scrollbar code on Unix and added dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
202
diff
changeset
|
1949 _dw_thread_add(_dw_thread); |
b9283fd56d69
Updated scrollbar code on Unix and added dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
202
diff
changeset
|
1950 gtk_main_iteration(); |
265
84471d53ab58
Changes to dw_main_* so that the _dw_thread is set to -1 when the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
264
diff
changeset
|
1951 _dw_thread = (pthread_t)-1; |
205
b9283fd56d69
Updated scrollbar code on Unix and added dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
202
diff
changeset
|
1952 gdk_threads_leave(); |
b9283fd56d69
Updated scrollbar code on Unix and added dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
202
diff
changeset
|
1953 } |
b9283fd56d69
Updated scrollbar code on Unix and added dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
202
diff
changeset
|
1954 |
b9283fd56d69
Updated scrollbar code on Unix and added dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
202
diff
changeset
|
1955 /* |
3 | 1956 * Free's memory allocated by dynamic windows. |
1957 * Parameters: | |
1958 * ptr: Pointer to dynamic windows allocated | |
1959 * memory to be free()'d. | |
1960 */ | |
1961 void dw_free(void *ptr) | |
1962 { | |
1963 free(ptr); | |
1964 } | |
1965 | |
1966 /* | |
1967 * Allocates and initializes a dialog struct. | |
1968 * Parameters: | |
1969 * data: User defined data to be passed to functions. | |
1970 */ | |
1971 DWDialog *dw_dialog_new(void *data) | |
1972 { | |
1973 DWDialog *tmp = malloc(sizeof(DWDialog)); | |
1974 | |
1975 tmp->eve = dw_event_new(); | |
1976 dw_event_reset(tmp->eve); | |
1977 tmp->data = data; | |
1978 tmp->done = FALSE; | |
494
edcf9ec12f8c
Fixed a bug in the dialog system on Unix where, gtk_main() could exit
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
493
diff
changeset
|
1979 tmp->method = FALSE; |
3 | 1980 tmp->result = NULL; |
1981 | |
1982 return tmp; | |
1983 } | |
1984 | |
1985 /* | |
1986 * Accepts a dialog struct and returns the given data to the | |
1987 * initial called of dw_dialog_wait(). | |
1988 * Parameters: | |
1989 * dialog: Pointer to a dialog struct aquired by dw_dialog_new). | |
1990 * result: Data to be returned by dw_dialog_wait(). | |
1991 */ | |
1992 int dw_dialog_dismiss(DWDialog *dialog, void *result) | |
1993 { | |
1994 dialog->result = result; | |
494
edcf9ec12f8c
Fixed a bug in the dialog system on Unix where, gtk_main() could exit
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
493
diff
changeset
|
1995 if(dialog->method) |
3 | 1996 gtk_main_quit(); |
1997 else | |
1998 dw_event_post(dialog->eve); | |
1999 dialog->done = TRUE; | |
2000 return 0; | |
2001 } | |
2002 | |
2003 /* | |
2004 * Accepts a dialog struct waits for dw_dialog_dismiss() to be | |
2005 * called by a signal handler with the given dialog struct. | |
2006 * Parameters: | |
2007 * dialog: Pointer to a dialog struct aquired by dw_dialog_new). | |
2008 */ | |
2009 void *dw_dialog_wait(DWDialog *dialog) | |
2010 { | |
2011 void *tmp; | |
41
af0a78aa0d45
More updates, and a more comprehensive unix install scheme. Use target
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
40
diff
changeset
|
2012 int newprocess = 0; |
af0a78aa0d45
More updates, and a more comprehensive unix install scheme. Use target
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
40
diff
changeset
|
2013 |
af0a78aa0d45
More updates, and a more comprehensive unix install scheme. Use target
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
40
diff
changeset
|
2014 /* _dw_thread will be -1 if dw_main hasn't been run yet. */ |
af0a78aa0d45
More updates, and a more comprehensive unix install scheme. Use target
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
40
diff
changeset
|
2015 if(_dw_thread == (pthread_t)-1) |
af0a78aa0d45
More updates, and a more comprehensive unix install scheme. Use target
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
40
diff
changeset
|
2016 { |
af0a78aa0d45
More updates, and a more comprehensive unix install scheme. Use target
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
40
diff
changeset
|
2017 _dw_thread = pthread_self(); |
af0a78aa0d45
More updates, and a more comprehensive unix install scheme. Use target
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
40
diff
changeset
|
2018 newprocess = 1; |
af0a78aa0d45
More updates, and a more comprehensive unix install scheme. Use target
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
40
diff
changeset
|
2019 gdk_threads_enter(); |
af0a78aa0d45
More updates, and a more comprehensive unix install scheme. Use target
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
40
diff
changeset
|
2020 } |
3 | 2021 |
2022 if(pthread_self() == _dw_thread) | |
494
edcf9ec12f8c
Fixed a bug in the dialog system on Unix where, gtk_main() could exit
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
493
diff
changeset
|
2023 { |
edcf9ec12f8c
Fixed a bug in the dialog system on Unix where, gtk_main() could exit
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
493
diff
changeset
|
2024 dialog->method = TRUE; |
3 | 2025 gtk_main(); |
494
edcf9ec12f8c
Fixed a bug in the dialog system on Unix where, gtk_main() could exit
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
493
diff
changeset
|
2026 } |
3 | 2027 else |
494
edcf9ec12f8c
Fixed a bug in the dialog system on Unix where, gtk_main() could exit
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
493
diff
changeset
|
2028 { |
edcf9ec12f8c
Fixed a bug in the dialog system on Unix where, gtk_main() could exit
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
493
diff
changeset
|
2029 dialog->method = FALSE; |
3 | 2030 dw_event_wait(dialog->eve, -1); |
494
edcf9ec12f8c
Fixed a bug in the dialog system on Unix where, gtk_main() could exit
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
493
diff
changeset
|
2031 } |
3 | 2032 |
41
af0a78aa0d45
More updates, and a more comprehensive unix install scheme. Use target
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
40
diff
changeset
|
2033 if(newprocess) |
af0a78aa0d45
More updates, and a more comprehensive unix install scheme. Use target
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
40
diff
changeset
|
2034 { |
af0a78aa0d45
More updates, and a more comprehensive unix install scheme. Use target
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
40
diff
changeset
|
2035 _dw_thread = (pthread_t)-1; |
af0a78aa0d45
More updates, and a more comprehensive unix install scheme. Use target
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
40
diff
changeset
|
2036 gdk_threads_leave(); |
af0a78aa0d45
More updates, and a more comprehensive unix install scheme. Use target
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
40
diff
changeset
|
2037 } |
af0a78aa0d45
More updates, and a more comprehensive unix install scheme. Use target
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
40
diff
changeset
|
2038 |
3 | 2039 dw_event_close(&dialog->eve); |
2040 tmp = dialog->result; | |
2041 free(dialog); | |
2042 return tmp; | |
2043 } | |
2044 | |
258
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
2045 static int _dw_ok_func(HWND window, void *data) |
40
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
2046 { |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
2047 DWDialog *dwwait = (DWDialog *)data; |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
2048 |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
2049 if(!dwwait) |
134
caeb52bb5ef4
Pass pointers to argc and argv on Unix.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
133
diff
changeset
|
2050 return FALSE; |
40
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
2051 |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
2052 dw_window_destroy((HWND)dwwait->data); |
399
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
2053 dw_dialog_dismiss((DWDialog *)data, (void *)DW_MB_RETURN_OK); |
134
caeb52bb5ef4
Pass pointers to argc and argv on Unix.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
133
diff
changeset
|
2054 return FALSE; |
40
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
2055 } |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
2056 |
134
caeb52bb5ef4
Pass pointers to argc and argv on Unix.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
133
diff
changeset
|
2057 int _dw_yes_func(HWND window, void *data) |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
2058 { |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
2059 DWDialog *dwwait = (DWDialog *)data; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
2060 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
2061 if(!dwwait) |
134
caeb52bb5ef4
Pass pointers to argc and argv on Unix.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
133
diff
changeset
|
2062 return FALSE; |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
2063 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
2064 dw_window_destroy((HWND)dwwait->data); |
399
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
2065 dw_dialog_dismiss((DWDialog *)data, (void *)DW_MB_RETURN_YES); |
134
caeb52bb5ef4
Pass pointers to argc and argv on Unix.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
133
diff
changeset
|
2066 return FALSE; |
caeb52bb5ef4
Pass pointers to argc and argv on Unix.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
133
diff
changeset
|
2067 } |
caeb52bb5ef4
Pass pointers to argc and argv on Unix.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
133
diff
changeset
|
2068 |
caeb52bb5ef4
Pass pointers to argc and argv on Unix.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
133
diff
changeset
|
2069 int _dw_no_func(HWND window, void *data) |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
2070 { |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
2071 DWDialog *dwwait = (DWDialog *)data; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
2072 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
2073 if(!dwwait) |
134
caeb52bb5ef4
Pass pointers to argc and argv on Unix.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
133
diff
changeset
|
2074 return FALSE; |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
2075 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
2076 dw_window_destroy((HWND)dwwait->data); |
399
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
2077 dw_dialog_dismiss((DWDialog *)data, (void *)DW_MB_RETURN_NO); |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
2078 return FALSE; |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
2079 } |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
2080 |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
2081 int _dw_cancel_func(HWND window, void *data) |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
2082 { |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
2083 DWDialog *dwwait = (DWDialog *)data; |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
2084 |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
2085 if(!dwwait) |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
2086 return FALSE; |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
2087 |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
2088 dw_window_destroy((HWND)dwwait->data); |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
2089 dw_dialog_dismiss((DWDialog *)data, (void *)DW_MB_RETURN_CANCEL); |
134
caeb52bb5ef4
Pass pointers to argc and argv on Unix.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
133
diff
changeset
|
2090 return FALSE; |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
2091 } |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
2092 |
3 | 2093 /* |
2094 * Displays a Message Box with given text and title.. | |
2095 * Parameters: | |
2096 * title: The title of the message box. | |
399
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
2097 * flags: Defines buttons and icons to display |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
2098 * format: printf style format string. |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
2099 * ...: Additional variables for use in the format. |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
2100 */ |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
2101 int dw_messagebox(char *title, int flags, char *format, ...) |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
2102 { |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
2103 HWND entrywindow, texttargetbox, imagetextbox, mainbox, okbutton, nobutton, yesbutton, cancelbutton, buttonbox, stext; |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
2104 ULONG flStyle = DW_FCF_TITLEBAR | DW_FCF_SHELLPOSITION | DW_FCF_DLGBORDER; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
2105 DWDialog *dwwait; |
399
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
2106 va_list args; |
463
2d7b27204cd4
Add support for DW_BROWSER to specify browser executable fir dw_browse()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
460
diff
changeset
|
2107 char outbuf[1000]; |
399
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
2108 char **xpm_data = NULL; |
463
2d7b27204cd4
Add support for DW_BROWSER to specify browser executable fir dw_browse()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
460
diff
changeset
|
2109 int x, y, extra_width=0,text_width,text_height; |
464
3251fbca6fb3
dw_listbox_delete() needs index+1 for end arg
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
463
diff
changeset
|
2110 int width,height; |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
2111 |
399
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
2112 va_start(args, format); |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
2113 vsprintf(outbuf, format, args); |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
2114 va_end(args); |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
2115 |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
2116 entrywindow = dw_window_new(HWND_DESKTOP, title, flStyle); |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
282
diff
changeset
|
2117 mainbox = dw_box_new(DW_VERT, 10); |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
2118 dw_box_pack_start(entrywindow, mainbox, 0, 0, TRUE, TRUE, 0); |
401
306ce9765a61
Fixes for new message box code. Also incorporated a fix from dw_window_set
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
399
diff
changeset
|
2119 |
306ce9765a61
Fixes for new message box code. Also incorporated a fix from dw_window_set
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
399
diff
changeset
|
2120 /* determine if an icon is to be used - if so we need another HORZ box */ |
399
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
2121 if((flags & DW_MB_ERROR) | (flags & DW_MB_WARNING) | (flags & DW_MB_INFORMATION) | (flags & DW_MB_QUESTION)) |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
2122 { |
401
306ce9765a61
Fixes for new message box code. Also incorporated a fix from dw_window_set
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
399
diff
changeset
|
2123 imagetextbox = dw_box_new(DW_HORZ, 0); |
399
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
2124 dw_box_pack_start(mainbox, imagetextbox, 0, 0, TRUE, TRUE, 2); |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
2125 texttargetbox = imagetextbox; |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
2126 } |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
2127 else |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
2128 { |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
2129 imagetextbox = NULL; |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
2130 texttargetbox = mainbox; |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
2131 } |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
2132 |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
2133 if(flags & DW_MB_ERROR) |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
2134 xpm_data = (char **)_dw_messagebox_error; |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
2135 else if(flags & DW_MB_WARNING) |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
2136 xpm_data = (char **)_dw_messagebox_warning; |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
2137 else if(flags & DW_MB_INFORMATION) |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
2138 xpm_data = (char **)_dw_messagebox_information; |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
2139 else if(flags & DW_MB_QUESTION) |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
2140 xpm_data = (char **)_dw_messagebox_question; |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
2141 |
427
b0e2ba7c46c5
For message boxes that have icons, increase the size of the text area (and hence the
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
426
diff
changeset
|
2142 if(xpm_data) |
b0e2ba7c46c5
For message boxes that have icons, increase the size of the text area (and hence the
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
426
diff
changeset
|
2143 extra_width = 32; |
b0e2ba7c46c5
For message boxes that have icons, increase the size of the text area (and hence the
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
426
diff
changeset
|
2144 |
399
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
2145 if(texttargetbox == imagetextbox) |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
2146 { |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
2147 GdkPixmap *icon_pixmap = NULL; |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
2148 GdkBitmap *bitmap = NULL; |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
2149 HWND handle = dw_bitmap_new( 100 ); |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
2150 #if GTK_MAJOR_VERSION > 1 |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
2151 GdkPixbuf *icon_pixbuf = gdk_pixbuf_new_from_xpm_data((const char **)xpm_data); |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
2152 |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
2153 gdk_pixbuf_render_pixmap_and_mask(icon_pixbuf, &icon_pixmap, &bitmap, 1); |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
2154 g_object_unref(icon_pixbuf); |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
2155 #elif defined(USE_IMLIB) |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
2156 gdk_imlib_data_to_pixmap((char **)xpm_data, &icon_pixmap, &bitmap); |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
2157 #else |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
2158 icon_pixmap = gdk_pixmap_create_from_xpm_d(handle->window, &bitmap, &_colors[DW_CLR_PALEGRAY], (char **)xpm_data); |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
2159 #endif |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
2160 |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
2161 #if GTK_MAJOR_VERSION > 1 |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
2162 gtk_image_set_from_pixmap(GTK_IMAGE(handle), icon_pixmap, bitmap); |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
2163 #else |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
2164 gtk_pixmap_set(GTK_PIXMAP(handle), icon_pixmap, bitmap); |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
2165 #endif |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
2166 |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
2167 dw_box_pack_start( texttargetbox, handle, 32, 32, FALSE, FALSE, 2); |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
2168 } |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
2169 |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
2170 /* Create text */ |
463
2d7b27204cd4
Add support for DW_BROWSER to specify browser executable fir dw_browse()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
460
diff
changeset
|
2171 text_width = 240; |
2d7b27204cd4
Add support for DW_BROWSER to specify browser executable fir dw_browse()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
460
diff
changeset
|
2172 text_height = 0; |
399
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
2173 stext = dw_text_new(outbuf, 0); |
40
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
2174 dw_window_set_style(stext, DW_DT_WORDBREAK, DW_DT_WORDBREAK); |
514
08d770271709
More function name changes for Rexx/DW compatibility.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
513
diff
changeset
|
2175 dw_font_text_extents_get(stext, NULL, outbuf, &width, &height); |
463
2d7b27204cd4
Add support for DW_BROWSER to specify browser executable fir dw_browse()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
460
diff
changeset
|
2176 height = height+3; |
2d7b27204cd4
Add support for DW_BROWSER to specify browser executable fir dw_browse()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
460
diff
changeset
|
2177 if(width < text_width) |
2d7b27204cd4
Add support for DW_BROWSER to specify browser executable fir dw_browse()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
460
diff
changeset
|
2178 text_height = height*2; |
2d7b27204cd4
Add support for DW_BROWSER to specify browser executable fir dw_browse()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
460
diff
changeset
|
2179 else if(width < text_width*2) |
2d7b27204cd4
Add support for DW_BROWSER to specify browser executable fir dw_browse()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
460
diff
changeset
|
2180 text_height = height*3; |
2d7b27204cd4
Add support for DW_BROWSER to specify browser executable fir dw_browse()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
460
diff
changeset
|
2181 else if(width < text_width*3) |
2d7b27204cd4
Add support for DW_BROWSER to specify browser executable fir dw_browse()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
460
diff
changeset
|
2182 text_height = height*4; |
2d7b27204cd4
Add support for DW_BROWSER to specify browser executable fir dw_browse()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
460
diff
changeset
|
2183 else /* width > (3*text_width) */ |
2d7b27204cd4
Add support for DW_BROWSER to specify browser executable fir dw_browse()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
460
diff
changeset
|
2184 { |
2d7b27204cd4
Add support for DW_BROWSER to specify browser executable fir dw_browse()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
460
diff
changeset
|
2185 text_width = (width / 3) + 60; |
2d7b27204cd4
Add support for DW_BROWSER to specify browser executable fir dw_browse()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
460
diff
changeset
|
2186 text_height = height*4; |
2d7b27204cd4
Add support for DW_BROWSER to specify browser executable fir dw_browse()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
460
diff
changeset
|
2187 } |
2d7b27204cd4
Add support for DW_BROWSER to specify browser executable fir dw_browse()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
460
diff
changeset
|
2188 dw_box_pack_start(texttargetbox, stext, text_width, text_height, TRUE, TRUE, 2); |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
2189 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
2190 /* Buttons */ |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
282
diff
changeset
|
2191 buttonbox = dw_box_new(DW_HORZ, 10); |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
2192 |
429
f977c80a1dfa
Check for inconsistent parameters in dw_box_pack_start() and
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
427
diff
changeset
|
2193 dw_box_pack_start(mainbox, buttonbox, 0, 40, TRUE, FALSE, 0); |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
2194 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
2195 dwwait = dw_dialog_new((void *)entrywindow); |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
2196 |
401
306ce9765a61
Fixes for new message box code. Also incorporated a fix from dw_window_set
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
399
diff
changeset
|
2197 /* which buttons ? */ |
399
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
2198 if(flags & DW_MB_OK) |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
2199 { |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
2200 okbutton = dw_button_new("Ok", 1001L); |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
2201 dw_box_pack_start(buttonbox, okbutton, 50, 30, TRUE, FALSE, 2); |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
2202 dw_signal_connect(okbutton, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(_dw_ok_func), (void *)dwwait); |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
2203 } |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
2204 else if(flags & DW_MB_OKCANCEL) |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
2205 { |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
2206 okbutton = dw_button_new("Ok", 1001L); |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
2207 dw_box_pack_start(buttonbox, okbutton, 50, 30, TRUE, FALSE, 2); |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
2208 dw_signal_connect(okbutton, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(_dw_ok_func), (void *)dwwait); |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
2209 cancelbutton = dw_button_new("Cancel", 1002L); |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
2210 dw_box_pack_start(buttonbox, cancelbutton, 50, 30, TRUE, FALSE, 2); |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
2211 dw_signal_connect(cancelbutton, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(_dw_cancel_func), (void *)dwwait); |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
2212 } |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
2213 else if(flags & DW_MB_YESNO) |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
2214 { |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
2215 yesbutton = dw_button_new("Yes", 1001L); |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
2216 dw_box_pack_start(buttonbox, yesbutton, 50, 30, TRUE, FALSE, 2); |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
2217 dw_signal_connect(yesbutton, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(_dw_yes_func), (void *)dwwait); |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
2218 nobutton = dw_button_new("No", 1002L); |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
2219 dw_box_pack_start(buttonbox, nobutton, 50, 30, TRUE, FALSE, 2); |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
2220 dw_signal_connect(nobutton, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(_dw_no_func), (void *)dwwait); |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
2221 } |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
2222 else if(flags & DW_MB_YESNOCANCEL) |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
2223 { |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
2224 yesbutton = dw_button_new("Yes", 1001L); |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
2225 dw_box_pack_start(buttonbox, yesbutton, 50, 30, TRUE, FALSE, 2); |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
2226 dw_signal_connect(yesbutton, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(_dw_yes_func), (void *)dwwait); |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
2227 nobutton = dw_button_new("No", 1002L); |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
2228 dw_box_pack_start(buttonbox, nobutton, 50, 30, TRUE, FALSE, 2); |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
2229 dw_signal_connect(nobutton, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(_dw_no_func), (void *)dwwait); |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
2230 cancelbutton = dw_button_new("Cancel", 1003L); |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
2231 dw_box_pack_start(buttonbox, cancelbutton, 50, 30, TRUE, FALSE, 2); |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
2232 dw_signal_connect(cancelbutton, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(_dw_cancel_func), (void *)dwwait); |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
386
diff
changeset
|
2233 } |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
2234 |
463
2d7b27204cd4
Add support for DW_BROWSER to specify browser executable fir dw_browse()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
460
diff
changeset
|
2235 height = max(50,text_height)+100; |
2d7b27204cd4
Add support for DW_BROWSER to specify browser executable fir dw_browse()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
460
diff
changeset
|
2236 x = (dw_screen_width() - (text_width+60+extra_width))/2; |
2d7b27204cd4
Add support for DW_BROWSER to specify browser executable fir dw_browse()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
460
diff
changeset
|
2237 y = (dw_screen_height() - height)/2; |
2d7b27204cd4
Add support for DW_BROWSER to specify browser executable fir dw_browse()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
460
diff
changeset
|
2238 |
2d7b27204cd4
Add support for DW_BROWSER to specify browser executable fir dw_browse()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
460
diff
changeset
|
2239 dw_window_set_pos_size(entrywindow, x, y, (text_width+60+extra_width), height); |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
2240 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
2241 dw_window_show(entrywindow); |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
2242 |
427
b0e2ba7c46c5
For message boxes that have icons, increase the size of the text area (and hence the
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
426
diff
changeset
|
2243 return (int)dw_dialog_wait(dwwait); |
3 | 2244 } |
2245 | |
2246 /* | |
14
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
2247 * Minimizes or Iconifies a top-level window. |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
2248 * Parameters: |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
2249 * handle: The window handle to minimize. |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
2250 */ |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
2251 int dw_window_minimize(HWND handle) |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
2252 { |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
2253 int _locked_by_me = FALSE; |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
2254 |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
2255 if(!handle) |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
2256 return 0; |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
2257 |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
2258 DW_MUTEX_LOCK; |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
2259 XIconifyWindow(GDK_WINDOW_XDISPLAY(GTK_WIDGET(handle)->window), |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
2260 GDK_WINDOW_XWINDOW(GTK_WIDGET(handle)->window), |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
2261 DefaultScreen (GDK_DISPLAY ())); |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
2262 DW_MUTEX_UNLOCK; |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
2263 return 0; |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
2264 } |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
2265 |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
2266 /* |
40
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
2267 * Makes the window topmost. |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
2268 * Parameters: |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
2269 * handle: The window handle to make topmost. |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
2270 */ |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
2271 int dw_window_raise(HWND handle) |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
2272 { |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
2273 int _locked_by_me = FALSE; |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
2274 |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
2275 if(!handle) |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
2276 return 0; |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
2277 |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
2278 DW_MUTEX_LOCK; |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
2279 gdk_window_raise(GTK_WIDGET(handle)->window); |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
2280 DW_MUTEX_UNLOCK; |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
2281 return 0; |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
2282 } |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
2283 |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
2284 /* |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
2285 * Makes the window bottommost. |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
2286 * Parameters: |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
2287 * handle: The window handle to make bottommost. |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
2288 */ |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
2289 int dw_window_lower(HWND handle) |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
2290 { |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
2291 int _locked_by_me = FALSE; |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
2292 |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
2293 if(!handle) |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
2294 return 0; |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
2295 |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
2296 DW_MUTEX_LOCK; |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
2297 gdk_window_lower(GTK_WIDGET(handle)->window); |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
2298 DW_MUTEX_UNLOCK; |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
2299 return 0; |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
2300 } |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
2301 |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
2302 /* |
3 | 2303 * Makes the window visible. |
2304 * Parameters: | |
2305 * handle: The window handle to make visible. | |
2306 */ | |
2307 int dw_window_show(HWND handle) | |
2308 { | |
2309 int _locked_by_me = FALSE; | |
34
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
2310 GtkWidget *defaultitem; |
3 | 2311 |
12
26e2130135b9
Many Win32 and GTK fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
7
diff
changeset
|
2312 if(!handle) |
26e2130135b9
Many Win32 and GTK fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
7
diff
changeset
|
2313 return 0; |
26e2130135b9
Many Win32 and GTK fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
7
diff
changeset
|
2314 |
3 | 2315 DW_MUTEX_LOCK; |
2316 gtk_widget_show(handle); | |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2317 if(GTK_WIDGET(handle)->window) |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2318 { |
272
49ac97060328
Fixes for default window size when the window does not have the sizeable
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
271
diff
changeset
|
2319 int width = (int)gtk_object_get_data(GTK_OBJECT(handle), "_dw_width"); |
49ac97060328
Fixes for default window size when the window does not have the sizeable
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
271
diff
changeset
|
2320 int height = (int)gtk_object_get_data(GTK_OBJECT(handle), "_dw_height"); |
49ac97060328
Fixes for default window size when the window does not have the sizeable
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
271
diff
changeset
|
2321 |
49ac97060328
Fixes for default window size when the window does not have the sizeable
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
271
diff
changeset
|
2322 if(width && height) |
49ac97060328
Fixes for default window size when the window does not have the sizeable
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
271
diff
changeset
|
2323 { |
273
95bfcd2deb94
Slight change to get it to work on GTK 2.x, although there is a momentary
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
272
diff
changeset
|
2324 gtk_widget_set_usize(handle, width, height); |
272
49ac97060328
Fixes for default window size when the window does not have the sizeable
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
271
diff
changeset
|
2325 gtk_object_set_data(GTK_OBJECT(handle), "_dw_width", 0); |
49ac97060328
Fixes for default window size when the window does not have the sizeable
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
271
diff
changeset
|
2326 gtk_object_set_data(GTK_OBJECT(handle), "_dw_height", 0); |
49ac97060328
Fixes for default window size when the window does not have the sizeable
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
271
diff
changeset
|
2327 } |
49ac97060328
Fixes for default window size when the window does not have the sizeable
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
271
diff
changeset
|
2328 |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2329 gdk_window_raise(GTK_WIDGET(handle)->window); |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2330 gdk_flush(); |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2331 gdk_window_show(GTK_WIDGET(handle)->window); |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2332 gdk_flush(); |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2333 } |
273
95bfcd2deb94
Slight change to get it to work on GTK 2.x, although there is a momentary
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
272
diff
changeset
|
2334 defaultitem = (GtkWidget *)gtk_object_get_data(GTK_OBJECT(handle), "_dw_defaultitem"); |
34
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
2335 if(defaultitem) |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
2336 gtk_widget_grab_focus(defaultitem); |
3 | 2337 DW_MUTEX_UNLOCK; |
2338 return 0; | |
2339 } | |
2340 | |
2341 /* | |
2342 * Makes the window invisible. | |
2343 * Parameters: | |
2344 * handle: The window handle to make visible. | |
2345 */ | |
2346 int dw_window_hide(HWND handle) | |
2347 { | |
2348 int _locked_by_me = FALSE; | |
2349 | |
12
26e2130135b9
Many Win32 and GTK fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
7
diff
changeset
|
2350 if(!handle) |
26e2130135b9
Many Win32 and GTK fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
7
diff
changeset
|
2351 return 0; |
26e2130135b9
Many Win32 and GTK fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
7
diff
changeset
|
2352 |
3 | 2353 DW_MUTEX_LOCK; |
2354 gtk_widget_hide(handle); | |
2355 DW_MUTEX_UNLOCK; | |
2356 return 0; | |
2357 } | |
2358 | |
2359 /* | |
2360 * Destroys a window and all of it's children. | |
2361 * Parameters: | |
2362 * handle: The window handle to destroy. | |
2363 */ | |
2364 int dw_window_destroy(HWND handle) | |
2365 { | |
2366 int _locked_by_me = FALSE; | |
2367 | |
12
26e2130135b9
Many Win32 and GTK fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
7
diff
changeset
|
2368 if(!handle) |
26e2130135b9
Many Win32 and GTK fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
7
diff
changeset
|
2369 return 0; |
26e2130135b9
Many Win32 and GTK fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
7
diff
changeset
|
2370 |
3 | 2371 DW_MUTEX_LOCK; |
17
f26eced21a30
Some more updates.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
15
diff
changeset
|
2372 if(GTK_IS_WIDGET(handle)) |
357
5df54ebc44dd
Fixed a bug where the eventbox associated with a box was not destroyed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
355
diff
changeset
|
2373 { |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
2374 GtkWidget *eventbox = (GtkWidget *)gtk_object_get_data(GTK_OBJECT(handle), "_dw_eventbox"); |
357
5df54ebc44dd
Fixed a bug where the eventbox associated with a box was not destroyed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
355
diff
changeset
|
2375 |
5df54ebc44dd
Fixed a bug where the eventbox associated with a box was not destroyed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
355
diff
changeset
|
2376 if(eventbox && GTK_IS_WIDGET(eventbox)) |
5df54ebc44dd
Fixed a bug where the eventbox associated with a box was not destroyed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
355
diff
changeset
|
2377 gtk_widget_destroy(eventbox); |
5df54ebc44dd
Fixed a bug where the eventbox associated with a box was not destroyed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
355
diff
changeset
|
2378 else |
5df54ebc44dd
Fixed a bug where the eventbox associated with a box was not destroyed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
355
diff
changeset
|
2379 gtk_widget_destroy(handle); |
5df54ebc44dd
Fixed a bug where the eventbox associated with a box was not destroyed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
355
diff
changeset
|
2380 } |
3 | 2381 DW_MUTEX_UNLOCK; |
2382 return 0; | |
2383 } | |
2384 | |
54
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
2385 /* Causes entire window to be invalidated and redrawn. |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
2386 * Parameters: |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
2387 * handle: Toplevel window handle to be redrawn. |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
2388 */ |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
2389 void dw_window_redraw(HWND handle) |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
2390 { |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
2391 } |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
2392 |
3 | 2393 /* |
2394 * Changes a window's parent to newparent. | |
2395 * Parameters: | |
2396 * handle: The window handle to destroy. | |
2397 * newparent: The window's new parent window. | |
2398 */ | |
2399 void dw_window_reparent(HWND handle, HWND newparent) | |
2400 { | |
14
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
2401 int _locked_by_me = FALSE; |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
2402 |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
2403 DW_MUTEX_LOCK; |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
2404 gdk_window_reparent(GTK_WIDGET(handle)->window, newparent ? GTK_WIDGET(newparent)->window : GDK_ROOT_PARENT(), 0, 0); |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
2405 DW_MUTEX_UNLOCK; |
3 | 2406 } |
2407 | |
258
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
2408 static int _set_font(HWND handle, char *fontname) |
3 | 2409 { |
120
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
2410 int retval = FALSE; |
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
2411 #if GTK_MAJOR_VERSION < 2 |
3 | 2412 GtkStyle *style; |
2413 GdkFont *font = NULL; | |
2414 | |
2415 font = gdk_font_load(fontname); | |
2416 | |
2417 if(font) | |
2418 { | |
2419 style = gtk_widget_get_style(handle); | |
2420 style->font = font; | |
2421 gtk_widget_set_style(handle, style); | |
2422 retval = TRUE; | |
2423 } | |
120
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
2424 #else |
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
2425 PangoFontDescription *font = pango_font_description_from_string(fontname); |
144
c68bc269ed58
Updated dw_window_set_font() to use GTK 2.0 semantics. Also improved the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
143
diff
changeset
|
2426 |
120
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
2427 if(font) |
147
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
2428 { |
120
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
2429 gtk_widget_modify_font(handle, font); |
147
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
2430 pango_font_description_free(font); |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
2431 } |
120
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
2432 #endif |
3 | 2433 return retval; |
2434 } | |
2435 | |
2436 /* | |
2437 * Sets the font used by a specified window (widget) handle. | |
2438 * Parameters: | |
2439 * handle: The window (widget) handle. | |
2440 * fontname: Name and size of the font in the form "size.fontname" | |
2441 */ | |
2442 int dw_window_set_font(HWND handle, char *fontname) | |
2443 { | |
144
c68bc269ed58
Updated dw_window_set_font() to use GTK 2.0 semantics. Also improved the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
143
diff
changeset
|
2444 #if GTK_MAJOR_VERSION > 1 |
c68bc269ed58
Updated dw_window_set_font() to use GTK 2.0 semantics. Also improved the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
143
diff
changeset
|
2445 PangoFontDescription *pfont; |
147
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
2446 #else |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
2447 GdkFont *gdkfont; |
144
c68bc269ed58
Updated dw_window_set_font() to use GTK 2.0 semantics. Also improved the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
143
diff
changeset
|
2448 #endif |
3 | 2449 GtkWidget *handle2 = handle; |
2450 char *font; | |
2451 int _locked_by_me = FALSE; | |
2452 gpointer data; | |
2453 | |
2454 DW_MUTEX_LOCK; | |
2455 if(GTK_IS_SCROLLED_WINDOW(handle)) | |
2456 { | |
2457 GtkWidget *tmp = (GtkWidget *)gtk_object_get_user_data(GTK_OBJECT(handle)); | |
2458 if(tmp) | |
2459 handle2 = tmp; | |
2460 } | |
2461 font = strdup(fontname); | |
2462 | |
147
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
2463 #if GTK_MAJOR_VERSION < 2 |
36
cddb02f847e1
Added unix versions of functions in compat, and added getfsname, plus
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
2464 /* Free old font if it exists */ |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
2465 gdkfont = (GdkFont *)gtk_object_get_data(GTK_OBJECT(handle2), "_dw_gdkfont"); |
36
cddb02f847e1
Added unix versions of functions in compat, and added getfsname, plus
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
2466 if(gdkfont) |
cddb02f847e1
Added unix versions of functions in compat, and added getfsname, plus
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
2467 gdk_font_unref(gdkfont); |
cddb02f847e1
Added unix versions of functions in compat, and added getfsname, plus
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
2468 gdkfont = gdk_font_load(fontname); |
147
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
2469 if(!gdkfont) |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
2470 gdkfont = gdk_font_load("fixed"); |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
2471 gtk_object_set_data(GTK_OBJECT(handle2), "_dw_gdkfont", (gpointer)gdkfont); |
147
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
2472 #endif |
36
cddb02f847e1
Added unix versions of functions in compat, and added getfsname, plus
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
2473 |
cddb02f847e1
Added unix versions of functions in compat, and added getfsname, plus
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
2474 /* Free old font name if one is allocated */ |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
2475 data = gtk_object_get_data(GTK_OBJECT(handle2), "_dw_fontname"); |
3 | 2476 if(data) |
2477 free(data); | |
2478 | |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
2479 gtk_object_set_data(GTK_OBJECT(handle2), "_dw_fontname", (gpointer)font); |
144
c68bc269ed58
Updated dw_window_set_font() to use GTK 2.0 semantics. Also improved the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
143
diff
changeset
|
2480 #if GTK_MAJOR_VERSION > 1 |
c68bc269ed58
Updated dw_window_set_font() to use GTK 2.0 semantics. Also improved the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
143
diff
changeset
|
2481 pfont = pango_font_description_from_string(fontname); |
c68bc269ed58
Updated dw_window_set_font() to use GTK 2.0 semantics. Also improved the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
143
diff
changeset
|
2482 |
c68bc269ed58
Updated dw_window_set_font() to use GTK 2.0 semantics. Also improved the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
143
diff
changeset
|
2483 if(pfont) |
147
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
2484 { |
144
c68bc269ed58
Updated dw_window_set_font() to use GTK 2.0 semantics. Also improved the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
143
diff
changeset
|
2485 gtk_widget_modify_font(handle2, pfont); |
147
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
2486 pango_font_description_free(pfont); |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
2487 } |
144
c68bc269ed58
Updated dw_window_set_font() to use GTK 2.0 semantics. Also improved the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
143
diff
changeset
|
2488 #endif |
c68bc269ed58
Updated dw_window_set_font() to use GTK 2.0 semantics. Also improved the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
143
diff
changeset
|
2489 DW_MUTEX_UNLOCK; |
3 | 2490 return TRUE; |
2491 } | |
2492 | |
14
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
2493 void _free_gdk_colors(HWND handle) |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
2494 { |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
2495 GdkColor *old = (GdkColor *)gtk_object_get_data(GTK_OBJECT(handle), "_dw_foregdk"); |
14
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
2496 |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
2497 if(old) |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
2498 free(old); |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
2499 |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
2500 old = (GdkColor *)gtk_object_get_data(GTK_OBJECT(handle), "_dw_backgdk"); |
14
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
2501 |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
2502 if(old) |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
2503 free(old); |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
2504 } |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
2505 |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
2506 /* Free old color pointers and allocate new ones */ |
258
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
2507 static void _save_gdk_colors(HWND handle, GdkColor fore, GdkColor back) |
14
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
2508 { |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
2509 GdkColor *foregdk = malloc(sizeof(GdkColor)); |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
2510 GdkColor *backgdk = malloc(sizeof(GdkColor)); |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
2511 |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
2512 _free_gdk_colors(handle); |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
2513 |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
2514 *foregdk = fore; |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
2515 *backgdk = back; |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
2516 |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
2517 gtk_object_set_data(GTK_OBJECT(handle), "_dw_foregdk", (gpointer)foregdk); |
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
2518 gtk_object_set_data(GTK_OBJECT(handle), "_dw_backgdk", (gpointer)backgdk); |
14
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
2519 } |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
2520 |
258
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
2521 static int _set_color(HWND handle, unsigned long fore, unsigned long back) |
3 | 2522 { |
155
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
2523 /* Remember that each color component in X11 use 16 bit no matter |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
2524 * what the destination display supports. (and thus GDK) |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
2525 */ |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
2526 GdkColor forecolor, backcolor; |
147
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
2527 #if GTK_MAJOR_VERSION < 2 |
155
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
2528 GtkStyle *style = gtk_style_copy(gtk_widget_get_style(handle)); |
147
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
2529 #endif |
3 | 2530 |
155
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
2531 if(fore & DW_RGB_COLOR) |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
2532 { |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
2533 forecolor.pixel = 0; |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
2534 forecolor.red = DW_RED_VALUE(fore) << 8; |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
2535 forecolor.green = DW_GREEN_VALUE(fore) << 8; |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
2536 forecolor.blue = DW_BLUE_VALUE(fore) << 8; |
3 | 2537 |
2538 gdk_color_alloc(_dw_cmap, &forecolor); | |
2539 | |
147
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
2540 #if GTK_MAJOR_VERSION > 1 |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
2541 gtk_widget_modify_text(handle, 0, &forecolor); |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
2542 gtk_widget_modify_text(handle, 1, &forecolor); |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
2543 gtk_widget_modify_fg(handle, 0, &forecolor); |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
2544 gtk_widget_modify_fg(handle, 1, &forecolor); |
155
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
2545 #else |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
2546 if(style) |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
2547 style->text[0] = style->text[1] = style->fg[0] = style->fg[1] = forecolor; |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
2548 #endif |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
2549 } |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
2550 else if(fore != DW_CLR_DEFAULT) |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
2551 { |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
2552 forecolor = _colors[fore]; |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
2553 |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
2554 #if GTK_MAJOR_VERSION > 1 |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
2555 gtk_widget_modify_text(handle, 0, &_colors[fore]); |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
2556 gtk_widget_modify_text(handle, 1, &_colors[fore]); |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
2557 gtk_widget_modify_fg(handle, 0, &_colors[fore]); |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
2558 gtk_widget_modify_fg(handle, 1, &_colors[fore]); |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
2559 #else |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
2560 if(style) |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
2561 style->text[0] = style->text[1] = style->fg[0] = style->fg[1] = _colors[fore]; |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
2562 #endif |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
2563 } |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
2564 if(back & DW_RGB_COLOR) |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
2565 { |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
2566 backcolor.pixel = 0; |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
2567 backcolor.red = DW_RED_VALUE(back) << 8; |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
2568 backcolor.green = DW_GREEN_VALUE(back) << 8; |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
2569 backcolor.blue = DW_BLUE_VALUE(back) << 8; |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
2570 |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
2571 gdk_color_alloc(_dw_cmap, &backcolor); |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
2572 |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
2573 #if GTK_MAJOR_VERSION > 1 |
147
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
2574 gtk_widget_modify_base(handle, 0, &backcolor); |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
2575 gtk_widget_modify_base(handle, 1, &backcolor); |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
2576 gtk_widget_modify_bg(handle, 0, &backcolor); |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
2577 gtk_widget_modify_bg(handle, 1, &backcolor); |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
2578 #else |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
2579 if(style) |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
2580 style->base[0] = style->base[1] = style->bg[0] = style->bg[1] = backcolor; |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
2581 #endif |
155
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
2582 } |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
2583 else if(back != DW_CLR_DEFAULT) |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
2584 { |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
2585 backcolor = _colors[back]; |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
2586 |
147
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
2587 #if GTK_MAJOR_VERSION > 1 |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
2588 gtk_widget_modify_base(handle, 0, &_colors[back]); |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
2589 gtk_widget_modify_base(handle, 1, &_colors[back]); |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
2590 gtk_widget_modify_bg(handle, 0, &_colors[back]); |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
2591 gtk_widget_modify_bg(handle, 1, &_colors[back]); |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
2592 #else |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
2593 if(style) |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
2594 style->base[0] = style->base[1] = style->bg[0] = style->bg[1] = _colors[back]; |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
2595 #endif |
155
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
2596 } |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
2597 |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
2598 _save_gdk_colors(handle, forecolor, backcolor); |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
2599 |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
2600 if(GTK_IS_CLIST(handle)) |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
2601 { |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
2602 int z, rowcount = (int)gtk_object_get_data(GTK_OBJECT(handle), "_dw_rowcount"); |
155
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
2603 |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
2604 for(z=0;z<rowcount;z++) |
14
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
2605 { |
155
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
2606 gtk_clist_set_foreground(GTK_CLIST(handle), z, &forecolor); |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
2607 gtk_clist_set_background(GTK_CLIST(handle), z, &backcolor); |
14
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
2608 } |
3 | 2609 } |
2610 | |
155
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
2611 #if GTK_MAJOR_VERSION < 2 |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
2612 if(style) |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
2613 { |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
2614 gtk_widget_set_style(handle, style); |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
2615 gtk_style_unref(style); |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
2616 } |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
2617 #endif |
3 | 2618 return TRUE; |
2619 } | |
2620 /* | |
2621 * Sets the colors used by a specified window (widget) handle. | |
2622 * Parameters: | |
2623 * handle: The window (widget) handle. | |
2624 * fore: Foreground color in RGB format. | |
2625 * back: Background color in RGB format. | |
2626 */ | |
2627 int dw_window_set_color(HWND handle, unsigned long fore, unsigned long back) | |
2628 { | |
2629 GtkWidget *handle2 = handle; | |
2630 int _locked_by_me = FALSE; | |
2631 | |
2632 DW_MUTEX_LOCK; | |
2633 | |
147
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
2634 if(GTK_IS_SCROLLED_WINDOW(handle) || GTK_IS_BOX(handle)) |
3 | 2635 { |
2636 GtkWidget *tmp = (GtkWidget *)gtk_object_get_user_data(GTK_OBJECT(handle)); | |
2637 if(tmp) | |
2638 handle2 = tmp; | |
2639 } | |
48
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
2640 else if(GTK_IS_TABLE(handle)) |
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
2641 { |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
2642 GtkWidget *tmp = (GtkWidget *)gtk_object_get_data(GTK_OBJECT(handle), "_dw_eventbox"); |
48
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
2643 if(tmp) |
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
2644 handle2 = tmp; |
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
2645 } |
12
26e2130135b9
Many Win32 and GTK fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
7
diff
changeset
|
2646 |
3 | 2647 _set_color(handle2, fore, back); |
2648 | |
2649 DW_MUTEX_UNLOCK; | |
2650 return TRUE; | |
2651 } | |
2652 | |
2653 /* | |
2654 * Sets the font used by a specified window (widget) handle. | |
2655 * Parameters: | |
2656 * handle: The window (widget) handle. | |
2657 * border: Size of the window border in pixels. | |
2658 */ | |
2659 int dw_window_set_border(HWND handle, int border) | |
2660 { | |
2661 /* TODO */ | |
2662 return 0; | |
2663 } | |
2664 | |
2665 /* | |
2666 * Captures the mouse input to this window. | |
2667 * Parameters: | |
2668 * handle: Handle to receive mouse input. | |
2669 */ | |
2670 void dw_window_capture(HWND handle) | |
2671 { | |
2672 int _locked_by_me = FALSE; | |
2673 | |
2674 DW_MUTEX_LOCK; | |
37
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
36
diff
changeset
|
2675 gdk_pointer_grab(handle->window, TRUE, GDK_BUTTON_RELEASE_MASK | GDK_BUTTON_PRESS_MASK | GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK, NULL, NULL, GDK_CURRENT_TIME); |
3 | 2676 DW_MUTEX_UNLOCK; |
2677 } | |
2678 | |
2679 /* | |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
2680 * Changes the appearance of the mouse pointer. |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
2681 * Parameters: |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
2682 * handle: Handle to widget for which to change. |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
2683 * cursortype: ID of the pointer you want. |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
2684 */ |
510
710f82598210
Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
508
diff
changeset
|
2685 void dw_window_set_pointer(HWND handle, int pointertype) |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
2686 { |
114
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
2687 int _locked_by_me = FALSE; |
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
2688 GdkCursor *cursor; |
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
2689 |
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
2690 DW_MUTEX_LOCK; |
337
e9a424e641ff
Some pointer changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
331
diff
changeset
|
2691 if(pointertype & (1 << 31)) |
e9a424e641ff
Some pointer changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
331
diff
changeset
|
2692 { |
e9a424e641ff
Some pointer changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
331
diff
changeset
|
2693 GdkBitmap *bitmap = NULL; |
338 | 2694 GdkPixmap *pixmap = _find_private_pixmap(&bitmap, (pointertype & 0xFFFFFF), NULL, NULL); |
2695 cursor = gdk_cursor_new_from_pixmap(pixmap, (GdkPixmap *)bitmap, &_colors[DW_CLR_WHITE], &_colors[DW_CLR_BLACK], 8, 8); | |
337
e9a424e641ff
Some pointer changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
331
diff
changeset
|
2696 } |
e9a424e641ff
Some pointer changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
331
diff
changeset
|
2697 else |
e9a424e641ff
Some pointer changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
331
diff
changeset
|
2698 cursor = gdk_cursor_new(pointertype); |
30
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
22
diff
changeset
|
2699 if(handle && handle->window) |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
22
diff
changeset
|
2700 gdk_window_set_cursor(handle->window, cursor); |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
2701 gdk_cursor_destroy(cursor); |
114
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
2702 DW_MUTEX_UNLOCK; |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
2703 } |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
2704 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
2705 /* |
3 | 2706 * Releases previous mouse capture. |
2707 */ | |
2708 void dw_window_release(void) | |
2709 { | |
2710 int _locked_by_me = FALSE; | |
2711 | |
2712 DW_MUTEX_LOCK; | |
2713 gdk_pointer_ungrab(GDK_CURRENT_TIME); | |
2714 DW_MUTEX_UNLOCK; | |
2715 } | |
2716 | |
2717 /* | |
2718 * Create a new Window Frame. | |
2719 * Parameters: | |
2720 * owner: The Owner's window handle or HWND_DESKTOP. | |
2721 * title: The Window title. | |
2722 * flStyle: Style flags, see the PM reference. | |
2723 */ | |
2724 HWND dw_window_new(HWND hwndOwner, char *title, unsigned long flStyle) | |
2725 { | |
2726 GtkWidget *tmp; | |
2727 int _locked_by_me = FALSE; | |
36
cddb02f847e1
Added unix versions of functions in compat, and added getfsname, plus
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
2728 int flags = 0; |
3 | 2729 |
2730 DW_MUTEX_LOCK; | |
472
d11be1f40f8c
Add support for column-click signal.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
464
diff
changeset
|
2731 #if GTK_MAJOR_VERSION > 1 |
515
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
2732 if(hwndOwner && GTK_IS_MDI(hwndOwner)) |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
2733 { |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
2734 GtkWidget *label; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
2735 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
2736 tmp = dw_box_new(DW_VERT, 0); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
2737 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
2738 label = gtk_label_new(title); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
2739 gtk_widget_show(label); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
2740 gtk_object_set_data(GTK_OBJECT(tmp), "_dw_mdi_child", (gpointer)1); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
2741 gtk_object_set_data(GTK_OBJECT(tmp), "_dw_mdi_title", (gpointer)label); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
2742 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
2743 gtk_mdi_put(GTK_MDI(hwndOwner), tmp, 100, 75, label); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
2744 } |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
2745 else |
472
d11be1f40f8c
Add support for column-click signal.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
464
diff
changeset
|
2746 #endif |
515
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
2747 { |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
2748 last_window = tmp = gtk_window_new(GTK_WINDOW_TOPLEVEL); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
2749 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
2750 gtk_window_set_title(GTK_WINDOW(tmp), title); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
2751 if(!(flStyle & DW_FCF_SIZEBORDER)) |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
2752 gtk_window_set_policy(GTK_WINDOW(tmp), FALSE, FALSE, TRUE); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
2753 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
2754 gtk_widget_realize(tmp); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
2755 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
2756 if(flStyle & DW_FCF_TITLEBAR) |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
2757 flags |= GDK_DECOR_TITLE; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
2758 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
2759 if(flStyle & DW_FCF_MINMAX) |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
2760 flags |= GDK_DECOR_MINIMIZE | GDK_DECOR_MAXIMIZE; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
2761 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
2762 if(flStyle & DW_FCF_SIZEBORDER) |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
2763 flags |= GDK_DECOR_RESIZEH | GDK_DECOR_BORDER; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
2764 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
2765 if(flStyle & DW_FCF_BORDER || flStyle & DW_FCF_DLGBORDER) |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
2766 flags |= GDK_DECOR_BORDER; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
2767 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
2768 if(flStyle & DW_FCF_MAXIMIZE) |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
2769 { |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
2770 flags &= ~DW_FCF_MAXIMIZE; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
2771 #if GTK_MAJOR_VERSION > 1 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
2772 gtk_window_maximize(GTK_WINDOW(tmp)); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
2773 #endif |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
2774 } |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
2775 if(flStyle & DW_FCF_MINIMIZE) |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
2776 { |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
2777 flags &= ~DW_FCF_MINIMIZE; |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
2778 #if GTK_MAJOR_VERSION > 1 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
2779 gtk_window_iconify(GTK_WINDOW(tmp)); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
2780 #endif |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
2781 } |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
2782 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
2783 gdk_window_set_decorations(tmp->window, flags); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
2784 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
2785 if(hwndOwner) |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
2786 gdk_window_reparent(GTK_WIDGET(tmp)->window, GTK_WIDGET(hwndOwner)->window, 0, 0); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
2787 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
2788 if(flStyle & DW_FCF_SIZEBORDER) |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
2789 gtk_object_set_data(GTK_OBJECT(tmp), "_dw_size", (gpointer)1); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
2790 } |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
2791 gtk_object_set_data(GTK_OBJECT(tmp), "_dw_style", (gpointer)flStyle); |
3 | 2792 DW_MUTEX_UNLOCK; |
2793 return tmp; | |
2794 } | |
2795 | |
2796 /* | |
2797 * Create a new Box to be packed. | |
2798 * Parameters: | |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
282
diff
changeset
|
2799 * type: Either DW_VERT (vertical) or DW_HORZ (horizontal). |
3 | 2800 * pad: Number of pixels to pad around the box. |
2801 */ | |
2802 HWND dw_box_new(int type, int pad) | |
2803 { | |
48
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
2804 GtkWidget *tmp, *eventbox; |
3 | 2805 int _locked_by_me = FALSE; |
2806 | |
2807 DW_MUTEX_LOCK; | |
36
cddb02f847e1
Added unix versions of functions in compat, and added getfsname, plus
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
2808 tmp = gtk_table_new(1, 1, FALSE); |
48
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
2809 eventbox = gtk_event_box_new(); |
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
2810 |
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
2811 gtk_widget_show(eventbox); |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
2812 gtk_object_set_data(GTK_OBJECT(tmp), "_dw_eventbox", (gpointer)eventbox); |
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
2813 gtk_object_set_data(GTK_OBJECT(tmp), "_dw_boxtype", (gpointer)type); |
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
2814 gtk_object_set_data(GTK_OBJECT(tmp), "_dw_boxpad", (gpointer)pad); |
3 | 2815 gtk_widget_show(tmp); |
2816 DW_MUTEX_UNLOCK; | |
2817 return tmp; | |
2818 } | |
2819 | |
2820 /* | |
2821 * Create a new Group Box to be packed. | |
2822 * Parameters: | |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
282
diff
changeset
|
2823 * type: Either DW_VERT (vertical) or DW_HORZ (horizontal). |
3 | 2824 * pad: Number of pixels to pad around the box. |
2825 * title: Text to be displayined in the group outline. | |
2826 */ | |
2827 HWND dw_groupbox_new(int type, int pad, char *title) | |
2828 { | |
37
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
36
diff
changeset
|
2829 GtkWidget *tmp, *frame; |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
36
diff
changeset
|
2830 int _locked_by_me = FALSE; |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
36
diff
changeset
|
2831 |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
36
diff
changeset
|
2832 DW_MUTEX_LOCK; |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
36
diff
changeset
|
2833 frame = gtk_frame_new(NULL); |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
36
diff
changeset
|
2834 gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_ETCHED_IN); |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
36
diff
changeset
|
2835 gtk_frame_set_label(GTK_FRAME(frame), title && *title ? title : NULL); |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
36
diff
changeset
|
2836 tmp = gtk_table_new(1, 1, FALSE); |
48
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
2837 gtk_container_border_width(GTK_CONTAINER(tmp), pad); |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
2838 gtk_object_set_data(GTK_OBJECT(tmp), "_dw_boxtype", (gpointer)type); |
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
2839 gtk_object_set_data(GTK_OBJECT(tmp), "_dw_boxpad", (gpointer)pad); |
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
2840 gtk_object_set_data(GTK_OBJECT(frame), "_dw_boxhandle", (gpointer)tmp); |
37
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
36
diff
changeset
|
2841 gtk_container_add(GTK_CONTAINER(frame), tmp); |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
36
diff
changeset
|
2842 gtk_widget_show(tmp); |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
36
diff
changeset
|
2843 gtk_widget_show(frame); |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
36
diff
changeset
|
2844 DW_MUTEX_UNLOCK; |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
36
diff
changeset
|
2845 return frame; |
3 | 2846 } |
2847 | |
2848 /* | |
14
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
2849 * Create a new MDI Frame to be packed. |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
2850 * Parameters: |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
2851 * id: An ID to be used with dw_window_from_id or 0L. |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
2852 */ |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
2853 HWND dw_mdi_new(unsigned long id) |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
2854 { |
114
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
2855 GtkWidget *tmp; |
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
2856 int _locked_by_me = FALSE; |
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
2857 |
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
2858 DW_MUTEX_LOCK; |
515
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
2859 #if GTK_MAJOR_VERSION > 1 |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
2860 tmp = gtk_mdi_new(); |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
2861 #else |
114
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
2862 tmp = gtk_vbox_new(FALSE, 0); |
515
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
2863 #endif |
c3c5d8e36aa3
Implemented MDI Window in Window code on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
2864 gtk_widget_show(tmp); |
114
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
2865 DW_MUTEX_UNLOCK; |
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
2866 return tmp; |
14
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
2867 } |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
2868 |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
2869 /* |
3 | 2870 * Create a bitmap object to be packed. |
2871 * Parameters: | |
278
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
273
diff
changeset
|
2872 * id: An ID to be used with dw_window_from_id() or 0L. |
3 | 2873 */ |
2874 HWND dw_bitmap_new(unsigned long id) | |
2875 { | |
121
d8af32b1b1cd
Switch back to using pixmaps and bitmaps, only use pixbufs for doing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
120
diff
changeset
|
2876 #if GTK_MAJOR_VERSION < 2 |
120
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
2877 GdkPixmap *pixmap = NULL; |
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
2878 GdkBitmap *bitmap = NULL; |
47
997e9ed670ef
Fixes for box alignment problem on OS/2, crash in dw_bitmap_new() on unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
46
diff
changeset
|
2879 static char * test_xpm[] = { |
997e9ed670ef
Fixes for box alignment problem on OS/2, crash in dw_bitmap_new() on unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
46
diff
changeset
|
2880 "1 1 2 1", |
997e9ed670ef
Fixes for box alignment problem on OS/2, crash in dw_bitmap_new() on unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
46
diff
changeset
|
2881 " c None", |
997e9ed670ef
Fixes for box alignment problem on OS/2, crash in dw_bitmap_new() on unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
46
diff
changeset
|
2882 ". c #FFFFFF", |
997e9ed670ef
Fixes for box alignment problem on OS/2, crash in dw_bitmap_new() on unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
46
diff
changeset
|
2883 "."}; |
121
d8af32b1b1cd
Switch back to using pixmaps and bitmaps, only use pixbufs for doing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
120
diff
changeset
|
2884 #endif |
d8af32b1b1cd
Switch back to using pixmaps and bitmaps, only use pixbufs for doing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
120
diff
changeset
|
2885 GtkWidget *tmp; |
3 | 2886 int _locked_by_me = FALSE; |
2887 | |
2888 DW_MUTEX_LOCK; | |
120
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
2889 #if GTK_MAJOR_VERSION > 1 |
121
d8af32b1b1cd
Switch back to using pixmaps and bitmaps, only use pixbufs for doing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
120
diff
changeset
|
2890 tmp = gtk_image_new(); |
120
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
2891 #elif defined(USE_IMLIB) |
47
997e9ed670ef
Fixes for box alignment problem on OS/2, crash in dw_bitmap_new() on unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
46
diff
changeset
|
2892 gdk_imlib_data_to_pixmap(test_xpm, &pixmap, &bitmap); |
3 | 2893 #else |
47
997e9ed670ef
Fixes for box alignment problem on OS/2, crash in dw_bitmap_new() on unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
46
diff
changeset
|
2894 gtk_widget_realize(last_window); |
997e9ed670ef
Fixes for box alignment problem on OS/2, crash in dw_bitmap_new() on unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
46
diff
changeset
|
2895 |
997e9ed670ef
Fixes for box alignment problem on OS/2, crash in dw_bitmap_new() on unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
46
diff
changeset
|
2896 if(last_window) |
997e9ed670ef
Fixes for box alignment problem on OS/2, crash in dw_bitmap_new() on unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
46
diff
changeset
|
2897 pixmap = gdk_pixmap_create_from_xpm_d(last_window->window, &bitmap, &_colors[DW_CLR_PALEGRAY], test_xpm); |
3 | 2898 #endif |
120
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
2899 #if GTK_MAJOR_VERSION < 2 |
3 | 2900 tmp = gtk_pixmap_new(pixmap, bitmap); |
120
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
2901 #endif |
3 | 2902 gtk_widget_show(tmp); |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
2903 gtk_object_set_data(GTK_OBJECT(tmp), "_dw_id", (gpointer)id); |
3 | 2904 DW_MUTEX_UNLOCK; |
2905 return tmp; | |
2906 } | |
2907 | |
2908 /* | |
2909 * Create a notebook object to be packed. | |
2910 * Parameters: | |
2911 * id: An ID to be used for getting the resource from the | |
2912 * resource file. | |
2913 */ | |
2914 HWND dw_notebook_new(unsigned long id, int top) | |
2915 { | |
114
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
2916 GtkWidget *tmp, **pagearray = calloc(sizeof(GtkWidget *), 256); |
3 | 2917 int _locked_by_me = FALSE; |
2918 | |
2919 DW_MUTEX_LOCK; | |
2920 tmp = gtk_notebook_new(); | |
2921 if(top) | |
2922 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(tmp), GTK_POS_TOP); | |
2923 else | |
2924 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(tmp), GTK_POS_BOTTOM); | |
83
1062b0409938
Set notebook scrollable and enable popup so it will act like OS/2. :)
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
77
diff
changeset
|
2925 gtk_notebook_set_scrollable(GTK_NOTEBOOK(tmp), TRUE); |
84
510c28aace3c
Ok the popup menu acted a bit funny so I am disabling it for now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
83
diff
changeset
|
2926 #if 0 |
83
1062b0409938
Set notebook scrollable and enable popup so it will act like OS/2. :)
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
77
diff
changeset
|
2927 gtk_notebook_popup_enable(GTK_NOTEBOOK(tmp)); |
84
510c28aace3c
Ok the popup menu acted a bit funny so I am disabling it for now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
83
diff
changeset
|
2928 #endif |
3 | 2929 gtk_widget_show(tmp); |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
2930 gtk_object_set_data(GTK_OBJECT(tmp), "_dw_id", (gpointer)id); |
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
2931 gtk_object_set_data(GTK_OBJECT(tmp), "_dw_pagearray", (gpointer)pagearray); |
3 | 2932 DW_MUTEX_UNLOCK; |
2933 return tmp; | |
2934 } | |
2935 | |
2936 /* | |
2937 * Create a menu object to be popped up. | |
2938 * Parameters: | |
2939 * id: An ID to be used for getting the resource from the | |
2940 * resource file. | |
2941 */ | |
2942 HMENUI dw_menu_new(unsigned long id) | |
2943 { | |
2944 int _locked_by_me = FALSE; | |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
2945 GtkAccelGroup *accel_group; |
185
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
167
diff
changeset
|
2946 HMENUI tmp; |
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
167
diff
changeset
|
2947 |
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
167
diff
changeset
|
2948 DW_MUTEX_LOCK; |
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
167
diff
changeset
|
2949 tmp = gtk_menu_new(); |
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
167
diff
changeset
|
2950 gtk_widget_show(tmp); |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
2951 accel_group = gtk_accel_group_new(); |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
2952 gtk_object_set_data(GTK_OBJECT(tmp), "_dw_id", (gpointer)id); |
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
2953 gtk_object_set_data(GTK_OBJECT(tmp), "_dw_accel", (gpointer)accel_group); |
3 | 2954 DW_MUTEX_UNLOCK; |
2955 return tmp; | |
2956 } | |
2957 | |
2958 /* | |
2959 * Create a menubar on a window. | |
2960 * Parameters: | |
2961 * location: Handle of a window frame to be attached to. | |
2962 */ | |
2963 HMENUI dw_menubar_new(HWND location) | |
2964 { | |
2965 GtkWidget *box; | |
2966 int _locked_by_me = FALSE; | |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
2967 GtkAccelGroup *accel_group; |
185
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
167
diff
changeset
|
2968 HMENUI tmp; |
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
167
diff
changeset
|
2969 |
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
167
diff
changeset
|
2970 DW_MUTEX_LOCK; |
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
167
diff
changeset
|
2971 tmp = gtk_menu_bar_new(); |
3 | 2972 box = (GtkWidget *)gtk_object_get_user_data(GTK_OBJECT(location)); |
185
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
167
diff
changeset
|
2973 gtk_widget_show(tmp); |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
2974 accel_group = gtk_accel_group_new(); |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
2975 gtk_object_set_data(GTK_OBJECT(tmp), "_dw_accel", (gpointer)accel_group); |
3 | 2976 |
2977 if(box) | |
185
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
167
diff
changeset
|
2978 gtk_box_pack_end(GTK_BOX(box), tmp, FALSE, FALSE, 0); |
3 | 2979 |
2980 DW_MUTEX_UNLOCK; | |
2981 return tmp; | |
2982 } | |
2983 | |
2984 /* | |
2985 * Destroys a menu created with dw_menubar_new or dw_menu_new. | |
2986 * Parameters: | |
2987 * menu: Handle of a menu. | |
2988 */ | |
2989 void dw_menu_destroy(HMENUI *menu) | |
2990 { | |
2991 if(menu && *menu) | |
2992 { | |
2993 int _locked_by_me = FALSE; | |
2994 | |
2995 DW_MUTEX_LOCK; | |
185
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
167
diff
changeset
|
2996 gtk_widget_destroy(*menu); |
3 | 2997 *menu = NULL; |
2998 DW_MUTEX_UNLOCK; | |
2999 } | |
3000 } | |
3001 | |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
3002 char _removetilde(char *dest, char *src) |
3 | 3003 { |
3004 int z, cur=0; | |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
3005 char accel = '\0'; |
3 | 3006 |
3007 for(z=0;z<strlen(src);z++) | |
3008 { | |
3009 if(src[z] != '~') | |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
3010 { |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
3011 dest[cur] = src[z]; |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
3012 cur++; |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
3013 } |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
3014 else |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
3015 { |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
3016 dest[cur] = '_'; |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
3017 accel = src[z+1]; |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
3018 cur++; |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
3019 } |
3 | 3020 } |
3021 dest[cur] = 0; | |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
3022 return accel; |
3 | 3023 } |
3024 | |
3025 /* | |
3026 * Adds a menuitem or submenu to an existing menu. | |
3027 * Parameters: | |
3028 * menu: The handle the the existing menu. | |
3029 * title: The title text on the menu item to be added. | |
3030 * id: An ID to be used for message passing. | |
3031 * flags: Extended attributes to set on the menu. | |
3032 * end: If TRUE memu is positioned at the end of the menu. | |
3033 * check: If TRUE menu is "check"able. | |
3034 * submenu: Handle to an existing menu to be a submenu or NULL. | |
3035 */ | |
3036 HWND dw_menu_append_item(HMENUI menu, char *title, unsigned long id, unsigned long flags, int end, int check, HMENUI submenu) | |
3037 { | |
3038 GtkWidget *tmphandle; | |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
3039 char accel, *tempbuf = malloc(strlen(title)+1); |
12
26e2130135b9
Many Win32 and GTK fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
7
diff
changeset
|
3040 int _locked_by_me = FALSE, submenucount; |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
3041 guint tmp_key; |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
3042 GtkAccelGroup *accel_group; |
3 | 3043 |
185
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
167
diff
changeset
|
3044 if(!menu) |
3 | 3045 { |
3046 free(tempbuf); | |
3047 return NULL; | |
3048 } | |
3049 | |
3050 DW_MUTEX_LOCK; | |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
3051 accel = _removetilde(tempbuf, title); |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
3052 |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
3053 accel_group = (GtkAccelGroup *)gtk_object_get_data(GTK_OBJECT(menu), "_dw_accel"); |
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
3054 submenucount = (int)gtk_object_get_data(GTK_OBJECT(menu), "_dw_submenucount"); |
3 | 3055 |
3056 if(strlen(tempbuf) == 0) | |
3057 tmphandle=gtk_menu_item_new(); | |
3058 else | |
3059 { | |
3060 if(check) | |
3061 { | |
3062 char numbuf[10]; | |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
3063 if(accel && accel_group) |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
3064 { |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
3065 tmphandle=gtk_check_menu_item_new_with_label(""); |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
3066 tmp_key = gtk_label_parse_uline(GTK_LABEL(GTK_BIN(tmphandle)->child), tempbuf); |
141
36dc19aa7773
Added tree cleanup code for GTK 2.0, and disabled some of the accellerator
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
140
diff
changeset
|
3067 #if 0 /* This isn't working right */ |
120
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
3068 gtk_widget_add_accelerator(tmphandle, "activate", accel_group, tmp_key, GDK_MOD1_MASK, 0); |
141
36dc19aa7773
Added tree cleanup code for GTK 2.0, and disabled some of the accellerator
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
140
diff
changeset
|
3069 #endif |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
3070 } |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
3071 else |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
3072 tmphandle=gtk_check_menu_item_new_with_label(tempbuf); |
3 | 3073 gtk_check_menu_item_set_show_toggle(GTK_CHECK_MENU_ITEM(tmphandle), TRUE); |
3074 sprintf(numbuf, "%lu", id); | |
185
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
167
diff
changeset
|
3075 gtk_object_set_data(GTK_OBJECT(menu), numbuf, (gpointer)tmphandle); |
3 | 3076 } |
3077 else | |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
3078 { |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
3079 if(accel && accel_group) |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
3080 { |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
3081 tmphandle=gtk_menu_item_new_with_label(""); |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
3082 tmp_key = gtk_label_parse_uline(GTK_LABEL(GTK_BIN(tmphandle)->child), tempbuf); |
141
36dc19aa7773
Added tree cleanup code for GTK 2.0, and disabled some of the accellerator
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
140
diff
changeset
|
3083 #if 0 /* This isn't working right */ |
120
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
3084 gtk_widget_add_accelerator(tmphandle, "activate", accel_group, tmp_key, GDK_MOD1_MASK, 0); |
141
36dc19aa7773
Added tree cleanup code for GTK 2.0, and disabled some of the accellerator
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
140
diff
changeset
|
3085 #endif |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
3086 } |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
3087 else |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
3088 tmphandle=gtk_menu_item_new_with_label(tempbuf); |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
3089 } |
3 | 3090 } |
3091 | |
3092 gtk_widget_show(tmphandle); | |
3093 | |
3094 if(submenu) | |
12
26e2130135b9
Many Win32 and GTK fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
7
diff
changeset
|
3095 { |
26e2130135b9
Many Win32 and GTK fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
7
diff
changeset
|
3096 char tempbuf[100]; |
26e2130135b9
Many Win32 and GTK fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
7
diff
changeset
|
3097 |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
3098 sprintf(tempbuf, "_dw_submenu%d", submenucount); |
12
26e2130135b9
Many Win32 and GTK fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
7
diff
changeset
|
3099 submenucount++; |
185
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
167
diff
changeset
|
3100 gtk_menu_item_set_submenu(GTK_MENU_ITEM(tmphandle), submenu); |
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
167
diff
changeset
|
3101 gtk_object_set_data(GTK_OBJECT(menu), tempbuf, (gpointer)submenu); |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
3102 gtk_object_set_data(GTK_OBJECT(menu), "_dw_submenucount", (gpointer)submenucount); |
185
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
167
diff
changeset
|
3103 } |
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
167
diff
changeset
|
3104 |
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
167
diff
changeset
|
3105 if(GTK_IS_MENU_BAR(menu)) |
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
167
diff
changeset
|
3106 gtk_menu_bar_append(GTK_MENU_BAR(menu), tmphandle); |
3 | 3107 else |
185
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
167
diff
changeset
|
3108 gtk_menu_append(GTK_MENU(menu), tmphandle); |
3 | 3109 |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
3110 gtk_object_set_data(GTK_OBJECT(tmphandle), "_dw_id", (gpointer)id); |
3 | 3111 free(tempbuf); |
3112 DW_MUTEX_UNLOCK; | |
3113 return tmphandle; | |
3114 } | |
3115 | |
12
26e2130135b9
Many Win32 and GTK fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
7
diff
changeset
|
3116 GtkWidget *_find_submenu_id(GtkWidget *start, char *name) |
26e2130135b9
Many Win32 and GTK fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
7
diff
changeset
|
3117 { |
26e2130135b9
Many Win32 and GTK fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
7
diff
changeset
|
3118 GtkWidget *tmp; |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
3119 int z, submenucount = (int)gtk_object_get_data(GTK_OBJECT(start), "_dw_submenucount"); |
12
26e2130135b9
Many Win32 and GTK fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
7
diff
changeset
|
3120 |
26e2130135b9
Many Win32 and GTK fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
7
diff
changeset
|
3121 if((tmp = gtk_object_get_data(GTK_OBJECT(start), name))) |
26e2130135b9
Many Win32 and GTK fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
7
diff
changeset
|
3122 return tmp; |
26e2130135b9
Many Win32 and GTK fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
7
diff
changeset
|
3123 |
26e2130135b9
Many Win32 and GTK fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
7
diff
changeset
|
3124 for(z=0;z<submenucount;z++) |
26e2130135b9
Many Win32 and GTK fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
7
diff
changeset
|
3125 { |
26e2130135b9
Many Win32 and GTK fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
7
diff
changeset
|
3126 char tempbuf[100]; |
26e2130135b9
Many Win32 and GTK fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
7
diff
changeset
|
3127 GtkWidget *submenu, *menuitem; |
26e2130135b9
Many Win32 and GTK fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
7
diff
changeset
|
3128 |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
3129 sprintf(tempbuf, "_dw_submenu%d", z); |
12
26e2130135b9
Many Win32 and GTK fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
7
diff
changeset
|
3130 |
26e2130135b9
Many Win32 and GTK fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
7
diff
changeset
|
3131 if((submenu = gtk_object_get_data(GTK_OBJECT(start), tempbuf))) |
26e2130135b9
Many Win32 and GTK fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
7
diff
changeset
|
3132 { |
26e2130135b9
Many Win32 and GTK fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
7
diff
changeset
|
3133 if((menuitem = _find_submenu_id(submenu, name))) |
26e2130135b9
Many Win32 and GTK fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
7
diff
changeset
|
3134 return menuitem; |
26e2130135b9
Many Win32 and GTK fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
7
diff
changeset
|
3135 } |
26e2130135b9
Many Win32 and GTK fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
7
diff
changeset
|
3136 } |
26e2130135b9
Many Win32 and GTK fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
7
diff
changeset
|
3137 return NULL; |
26e2130135b9
Many Win32 and GTK fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
7
diff
changeset
|
3138 } |
26e2130135b9
Many Win32 and GTK fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
7
diff
changeset
|
3139 |
3 | 3140 /* |
3141 * Sets the state of a menu item check. | |
3142 * Parameters: | |
3143 * menu: The handle the the existing menu. | |
3144 * id: Menuitem id. | |
3145 * check: TRUE for checked FALSE for not checked. | |
3146 */ | |
12
26e2130135b9
Many Win32 and GTK fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
7
diff
changeset
|
3147 void dw_menu_item_set_check(HMENUI menu, unsigned long id, int check) |
3 | 3148 { |
3149 char numbuf[10]; | |
3150 GtkWidget *tmphandle; | |
3151 int _locked_by_me = FALSE; | |
3152 | |
185
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
167
diff
changeset
|
3153 if(!menu) |
3 | 3154 return; |
3155 | |
3156 DW_MUTEX_LOCK; | |
12
26e2130135b9
Many Win32 and GTK fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
7
diff
changeset
|
3157 sprintf(numbuf, "%lu", id); |
185
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
167
diff
changeset
|
3158 tmphandle = _find_submenu_id(menu, numbuf); |
3 | 3159 |
3160 if(tmphandle) | |
3161 { | |
14
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3162 _dw_ignore_click = 1; |
3 | 3163 if(GTK_CHECK_MENU_ITEM(tmphandle)->active != check) |
3164 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(tmphandle), check); | |
14
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3165 _dw_ignore_click = 0; |
3 | 3166 } |
3167 DW_MUTEX_UNLOCK; | |
3168 } | |
3169 | |
3170 /* | |
3171 * Pops up a context menu at given x and y coordinates. | |
3172 * Parameters: | |
3173 * menu: The handle the the existing menu. | |
3174 * parent: Handle to the window initiating the popup. | |
3175 * x: X coordinate. | |
3176 * y: Y coordinate. | |
3177 */ | |
3178 void dw_menu_popup(HMENUI *menu, HWND parent, int x, int y) | |
3179 { | |
3180 int _locked_by_me = FALSE; | |
3181 | |
3182 if(!menu || !*menu) | |
3183 return; | |
3184 | |
93
98cce029a611
Changed handling of menu item click events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
92
diff
changeset
|
3185 popup = parent; |
98cce029a611
Changed handling of menu item click events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
92
diff
changeset
|
3186 |
3 | 3187 DW_MUTEX_LOCK; |
185
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
167
diff
changeset
|
3188 gtk_menu_popup(GTK_MENU(*menu), NULL, NULL, NULL, NULL, 1, GDK_CURRENT_TIME); |
3 | 3189 *menu = NULL; |
3190 DW_MUTEX_UNLOCK; | |
3191 } | |
3192 | |
3193 | |
3194 /* | |
3195 * Returns the current X and Y coordinates of the mouse pointer. | |
3196 * Parameters: | |
3197 * x: Pointer to variable to store X coordinate. | |
3198 * y: Pointer to variable to store Y coordinate. | |
3199 */ | |
3200 void dw_pointer_query_pos(long *x, long *y) | |
3201 { | |
3202 GdkModifierType state; | |
3203 int gx, gy; | |
57
1ed95c8ec2ff
Added a mutex lock and unlock in the pointer calls. And fixed a warning
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
55
diff
changeset
|
3204 int _locked_by_me = FALSE; |
1ed95c8ec2ff
Added a mutex lock and unlock in the pointer calls. And fixed a warning
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
55
diff
changeset
|
3205 |
1ed95c8ec2ff
Added a mutex lock and unlock in the pointer calls. And fixed a warning
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
55
diff
changeset
|
3206 DW_MUTEX_LOCK; |
3 | 3207 gdk_window_get_pointer (GDK_ROOT_PARENT(), &gx, &gy, &state); |
3208 *x = gx; | |
3209 *y = gy; | |
57
1ed95c8ec2ff
Added a mutex lock and unlock in the pointer calls. And fixed a warning
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
55
diff
changeset
|
3210 DW_MUTEX_UNLOCK; |
3 | 3211 } |
3212 | |
3213 /* | |
3214 * Sets the X and Y coordinates of the mouse pointer. | |
3215 * Parameters: | |
3216 * x: X coordinate. | |
3217 * y: Y coordinate. | |
3218 */ | |
3219 void dw_pointer_set_pos(long x, long y) | |
3220 { | |
57
1ed95c8ec2ff
Added a mutex lock and unlock in the pointer calls. And fixed a warning
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
55
diff
changeset
|
3221 int _locked_by_me = FALSE; |
1ed95c8ec2ff
Added a mutex lock and unlock in the pointer calls. And fixed a warning
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
55
diff
changeset
|
3222 |
1ed95c8ec2ff
Added a mutex lock and unlock in the pointer calls. And fixed a warning
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
55
diff
changeset
|
3223 DW_MUTEX_LOCK; |
3 | 3224 XWarpPointer(GDK_DISPLAY(), None, GDK_ROOT_WINDOW(), 0,0,0,0, x, y); |
57
1ed95c8ec2ff
Added a mutex lock and unlock in the pointer calls. And fixed a warning
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
55
diff
changeset
|
3225 DW_MUTEX_UNLOCK; |
3 | 3226 } |
3227 | |
3228 /* | |
3229 * Create a container object to be packed. | |
3230 * Parameters: | |
3231 * id: An ID to be used for getting the resource from the | |
3232 * resource file. | |
3233 */ | |
350
2216e65ad2ae
Removed slider flags and container selection flags from the header file.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
346
diff
changeset
|
3234 HWND dw_container_new(unsigned long id, int multi) |
3 | 3235 { |
3236 GtkWidget *tmp; | |
3237 int _locked_by_me = FALSE; | |
3238 | |
3239 DW_MUTEX_LOCK; | |
3240 tmp = gtk_scrolled_window_new (NULL, NULL); | |
3241 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (tmp), | |
3242 GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); | |
3243 | |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
3244 gtk_object_set_data(GTK_OBJECT(tmp), "_dw_multi", (gpointer)multi); |
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
3245 gtk_object_set_data(GTK_OBJECT(tmp), "_dw_id", (gpointer)id); |
3 | 3246 gtk_widget_show(tmp); |
3247 | |
3248 DW_MUTEX_UNLOCK; | |
3249 return tmp; | |
3250 } | |
3251 | |
3252 /* | |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
3253 * Create a tree object to be packed. |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
3254 * Parameters: |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
3255 * id: An ID to be used for getting the resource from the |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
3256 * resource file. |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
3257 */ |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
3258 HWND dw_tree_new(ULONG id) |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
3259 { |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
3260 GtkWidget *tmp, *tree; |
138
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
3261 #if GTK_MAJOR_VERSION > 1 |
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
3262 GtkTreeStore *store; |
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
3263 GtkTreeViewColumn *col; |
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
3264 GtkCellRenderer *rend; |
140
e0e73b4372a6
GTK 2.0 tree control is now fully functional. I just need to check for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
139
diff
changeset
|
3265 GtkTreeSelection *sel; |
138
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
3266 #endif |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
3267 int _locked_by_me = FALSE; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
3268 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
3269 DW_MUTEX_LOCK; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
3270 tmp = gtk_scrolled_window_new(NULL, NULL); |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
3271 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW (tmp), |
138
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
3272 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
3273 |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
3274 gtk_object_set_data(GTK_OBJECT(tmp), "_dw_id", (gpointer)id); |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
3275 gtk_widget_show(tmp); |
138
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
3276 #if GTK_MAJOR_VERSION > 1 |
484
f18c70cb3e38
Fixes for GTK 2.x, and correctly check for the directory bit. NOTE:
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
483
diff
changeset
|
3277 store = gtk_tree_store_new(4, G_TYPE_STRING, GDK_TYPE_PIXBUF, G_TYPE_POINTER, G_TYPE_POINTER); |
138
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
3278 tree = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store)); |
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
3279 gtk_object_set_data(GTK_OBJECT(tree), "_dw_tree_store", (gpointer)store); |
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
3280 col = gtk_tree_view_column_new(); |
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
3281 |
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
3282 rend = gtk_cell_renderer_pixbuf_new(); |
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
3283 gtk_tree_view_column_pack_start(col, rend, FALSE); |
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
3284 gtk_tree_view_column_add_attribute(col, rend, "pixbuf", 1); |
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
3285 rend = gtk_cell_renderer_text_new(); |
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
3286 gtk_tree_view_column_pack_start(col, rend, TRUE); |
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
3287 gtk_tree_view_column_add_attribute(col, rend, "text", 0); |
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
3288 |
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
3289 gtk_tree_view_append_column(GTK_TREE_VIEW (tree), col); |
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
3290 gtk_tree_view_set_expander_column(GTK_TREE_VIEW(tree), col); |
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
3291 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(tree), FALSE); |
140
e0e73b4372a6
GTK 2.0 tree control is now fully functional. I just need to check for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
139
diff
changeset
|
3292 |
e0e73b4372a6
GTK 2.0 tree control is now fully functional. I just need to check for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
139
diff
changeset
|
3293 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(tree)); |
e0e73b4372a6
GTK 2.0 tree control is now fully functional. I just need to check for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
139
diff
changeset
|
3294 gtk_tree_selection_set_mode(sel, GTK_SELECTION_SINGLE); |
138
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
3295 #else |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
3296 tree = gtk_tree_new(); |
138
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
3297 #endif |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
3298 if(!tree) |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
3299 { |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
3300 gtk_widget_destroy(tmp); |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
3301 DW_MUTEX_UNLOCK; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
3302 return FALSE; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
3303 } |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
3304 gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(tmp), tree); |
138
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
3305 #if GTK_MAJOR_VERSION < 2 |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
3306 /* Set the selection mode */ |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
3307 gtk_tree_set_selection_mode (GTK_TREE(tree), GTK_SELECTION_SINGLE); |
138
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
3308 gtk_tree_set_view_mode(GTK_TREE(tree), GTK_TREE_VIEW_ITEM); |
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
3309 #endif |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
3310 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
3311 gtk_object_set_user_data(GTK_OBJECT(tmp), (gpointer)tree); |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
3312 gtk_widget_show(tree); |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
3313 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
3314 DW_MUTEX_UNLOCK; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
3315 return tmp; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
3316 } |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
3317 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
3318 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
3319 /* |
3 | 3320 * Create a new static text window (widget) to be packed. |
3321 * Parameters: | |
3322 * text: The text to be display by the static text widget. | |
278
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
273
diff
changeset
|
3323 * id: An ID to be used with dw_window_from_id() or 0L. |
3 | 3324 */ |
3325 HWND dw_text_new(char *text, unsigned long id) | |
3326 { | |
3327 GtkWidget *tmp; | |
3328 int _locked_by_me = FALSE; | |
3329 | |
3330 DW_MUTEX_LOCK; | |
3331 tmp = gtk_label_new(text); | |
36
cddb02f847e1
Added unix versions of functions in compat, and added getfsname, plus
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
3332 |
cddb02f847e1
Added unix versions of functions in compat, and added getfsname, plus
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
3333 /* Left and centered */ |
cddb02f847e1
Added unix versions of functions in compat, and added getfsname, plus
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
3334 gtk_misc_set_alignment(GTK_MISC(tmp), 0.0f, 0.5f); |
3 | 3335 gtk_widget_show(tmp); |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
3336 gtk_object_set_data(GTK_OBJECT(tmp), "_dw_id", (gpointer)id); |
37
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
36
diff
changeset
|
3337 gtk_misc_set_alignment(GTK_MISC(tmp), DW_LEFT, DW_LEFT); |
3 | 3338 DW_MUTEX_UNLOCK; |
3339 return tmp; | |
3340 } | |
3341 | |
3342 /* | |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
3343 * Create a new status text window (widget) to be packed. |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
3344 * Parameters: |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
3345 * text: The text to be display by the static text widget. |
278
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
273
diff
changeset
|
3346 * id: An ID to be used with dw_window_from_id() or 0L. |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
3347 */ |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
3348 HWND dw_status_text_new(char *text, ULONG id) |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
3349 { |
14
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3350 GtkWidget *tmp, *frame; |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
3351 int _locked_by_me = FALSE; |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
3352 |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
3353 DW_MUTEX_LOCK; |
14
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3354 frame = gtk_frame_new(NULL); |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3355 gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_ETCHED_IN); |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
3356 tmp = gtk_label_new(text); |
14
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3357 gtk_container_add(GTK_CONTAINER(frame), tmp); |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
3358 gtk_widget_show(tmp); |
14
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3359 gtk_widget_show(frame); |
36
cddb02f847e1
Added unix versions of functions in compat, and added getfsname, plus
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
3360 |
cddb02f847e1
Added unix versions of functions in compat, and added getfsname, plus
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
3361 /* Left and centered */ |
cddb02f847e1
Added unix versions of functions in compat, and added getfsname, plus
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
3362 gtk_misc_set_alignment(GTK_MISC(tmp), 0.0f, 0.5f); |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
3363 gtk_object_set_data(GTK_OBJECT(frame), "_dw_id", (gpointer)id); |
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
3364 gtk_object_set_data(GTK_OBJECT(frame), "_dw_label", (gpointer)tmp); |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
3365 DW_MUTEX_UNLOCK; |
14
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3366 return frame; |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
3367 } |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
3368 |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
3369 /* |
3 | 3370 * Create a new Multiline Editbox window (widget) to be packed. |
3371 * Parameters: | |
278
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
273
diff
changeset
|
3372 * id: An ID to be used with dw_window_from_id() or 0L. |
3 | 3373 */ |
3374 HWND dw_mle_new(unsigned long id) | |
3375 { | |
3376 GtkWidget *tmp, *tmpbox, *scroller; | |
3377 int _locked_by_me = FALSE; | |
3378 | |
3379 DW_MUTEX_LOCK; | |
120
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
3380 #if GTK_MAJOR_VERSION > 1 |
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
3381 tmpbox = gtk_scrolled_window_new (NULL, NULL); |
144
c68bc269ed58
Updated dw_window_set_font() to use GTK 2.0 semantics. Also improved the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
143
diff
changeset
|
3382 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW(tmpbox), |
120
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
3383 GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); |
144
c68bc269ed58
Updated dw_window_set_font() to use GTK 2.0 semantics. Also improved the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
143
diff
changeset
|
3384 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(tmpbox), GTK_SHADOW_ETCHED_IN); |
120
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
3385 tmp = gtk_text_view_new(); |
144
c68bc269ed58
Updated dw_window_set_font() to use GTK 2.0 semantics. Also improved the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
143
diff
changeset
|
3386 gtk_container_add (GTK_CONTAINER(tmpbox), tmp); |
120
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
3387 gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(tmp), GTK_WRAP_NONE); |
353
08e56a0f9541
dw_mle_set() now moves the viewport to the cursor location.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
352
diff
changeset
|
3388 |
122
a05b6fb9c545
Minor bug fixes and code cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
121
diff
changeset
|
3389 scroller = NULL; |
120
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
3390 #else |
3 | 3391 tmpbox = gtk_hbox_new(FALSE, 0); |
3392 tmp = gtk_text_new(NULL, NULL); | |
3393 gtk_text_set_word_wrap(GTK_TEXT(tmp), FALSE); | |
3394 gtk_text_set_line_wrap(GTK_TEXT(tmp), FALSE); | |
3395 scroller = gtk_vscrollbar_new(GTK_TEXT(tmp)->vadj); | |
3396 GTK_WIDGET_UNSET_FLAGS(scroller, GTK_CAN_FOCUS); | |
120
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
3397 gtk_box_pack_start(GTK_BOX(tmpbox), tmp, TRUE, TRUE, 0); |
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
3398 gtk_box_pack_start(GTK_BOX(tmpbox), scroller, FALSE, TRUE, 0); |
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
3399 gtk_widget_show(scroller); |
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
3400 #endif |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
3401 gtk_object_set_data(GTK_OBJECT(tmp), "_dw_id", (gpointer)id); |
147
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
3402 gtk_object_set_user_data(GTK_OBJECT(tmpbox), (gpointer)tmp); |
3 | 3403 gtk_widget_show(tmp); |
3404 gtk_widget_show(tmpbox); | |
3405 DW_MUTEX_UNLOCK; | |
3406 return tmpbox; | |
3407 } | |
3408 | |
3409 /* | |
3410 * Create a new Entryfield window (widget) to be packed. | |
3411 * Parameters: | |
3412 * text: The default text to be in the entryfield widget. | |
278
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
273
diff
changeset
|
3413 * id: An ID to be used with dw_window_from_id() or 0L. |
3 | 3414 */ |
3415 HWND dw_entryfield_new(char *text, unsigned long id) | |
3416 { | |
3417 GtkWidget *tmp; | |
3418 int _locked_by_me = FALSE; | |
3419 | |
3420 DW_MUTEX_LOCK; | |
3421 tmp = gtk_entry_new(); | |
3422 | |
3423 gtk_entry_set_text(GTK_ENTRY(tmp), text); | |
3424 | |
3425 gtk_widget_show(tmp); | |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
3426 gtk_object_set_data(GTK_OBJECT(tmp), "_dw_id", (gpointer)id); |
3 | 3427 |
3428 DW_MUTEX_UNLOCK; | |
3429 return tmp; | |
3430 } | |
3431 | |
3432 /* | |
3433 * Create a new Entryfield (password) window (widget) to be packed. | |
3434 * Parameters: | |
3435 * text: The default text to be in the entryfield widget. | |
278
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
273
diff
changeset
|
3436 * id: An ID to be used with dw_window_from_id() or 0L. |
3 | 3437 */ |
3438 HWND dw_entryfield_password_new(char *text, ULONG id) | |
3439 { | |
3440 GtkWidget *tmp; | |
3441 int _locked_by_me = FALSE; | |
3442 | |
3443 DW_MUTEX_LOCK; | |
3444 tmp = gtk_entry_new(); | |
3445 | |
3446 gtk_entry_set_visibility(GTK_ENTRY(tmp), FALSE); | |
3447 gtk_entry_set_text(GTK_ENTRY(tmp), text); | |
3448 | |
3449 gtk_widget_show(tmp); | |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
3450 gtk_object_set_data(GTK_OBJECT(tmp), "_dw_id", (gpointer)id); |
3 | 3451 |
3452 DW_MUTEX_UNLOCK; | |
3453 return tmp; | |
3454 } | |
3455 | |
3456 /* | |
3457 * Create a new Combobox window (widget) to be packed. | |
3458 * Parameters: | |
3459 * text: The default text to be in the combpbox widget. | |
278
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
273
diff
changeset
|
3460 * id: An ID to be used with dw_window_from_id() or 0L. |
3 | 3461 */ |
3462 HWND dw_combobox_new(char *text, unsigned long id) | |
3463 { | |
3464 GtkWidget *tmp; | |
424
5cc81d3c2bca
Combobox code was using the old signal handler method. Updated it to thenew
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
423
diff
changeset
|
3465 int sigid, _locked_by_me = FALSE; |
5cc81d3c2bca
Combobox code was using the old signal handler method. Updated it to thenew
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
423
diff
changeset
|
3466 gint cid; |
3 | 3467 |
3468 DW_MUTEX_LOCK; | |
3469 tmp = gtk_combo_new(); | |
3470 gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(tmp)->entry), text); | |
3471 gtk_combo_set_use_arrows(GTK_COMBO(tmp), TRUE); | |
3472 gtk_object_set_user_data(GTK_OBJECT(tmp), NULL); | |
3473 gtk_widget_show(tmp); | |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
3474 gtk_object_set_data(GTK_OBJECT(tmp), "_dw_id", (gpointer)id); |
115
2d121d4d90c0
Run the _item_select_event() handler on comboboxes even if a handler
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
114
diff
changeset
|
3475 |
424
5cc81d3c2bca
Combobox code was using the old signal handler method. Updated it to thenew
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
423
diff
changeset
|
3476 sigid = _set_signal_handler(GTK_COMBO(tmp)->list, tmp, NULL, NULL, NULL); |
5cc81d3c2bca
Combobox code was using the old signal handler method. Updated it to thenew
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
423
diff
changeset
|
3477 cid = gtk_signal_connect(GTK_OBJECT(GTK_COMBO(tmp)->list), "select_child", GTK_SIGNAL_FUNC(_item_select_event), (gpointer)sigid); |
5cc81d3c2bca
Combobox code was using the old signal handler method. Updated it to thenew
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
423
diff
changeset
|
3478 _set_signal_handler_id(GTK_COMBO(tmp)->list, sigid, cid); |
3 | 3479 DW_MUTEX_UNLOCK; |
3480 return tmp; | |
3481 } | |
3482 | |
3483 /* | |
3484 * Create a new button window (widget) to be packed. | |
3485 * Parameters: | |
3486 * text: The text to be display by the static text widget. | |
278
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
273
diff
changeset
|
3487 * id: An ID to be used with dw_window_from_id() or 0L. |
3 | 3488 */ |
3489 HWND dw_button_new(char *text, unsigned long id) | |
3490 { | |
3491 GtkWidget *tmp; | |
3492 int _locked_by_me = FALSE; | |
3493 | |
3494 DW_MUTEX_LOCK; | |
3495 tmp = gtk_button_new_with_label(text); | |
3496 gtk_widget_show(tmp); | |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
3497 gtk_object_set_data(GTK_OBJECT(tmp), "_dw_id", (gpointer)id); |
3 | 3498 DW_MUTEX_UNLOCK; |
3499 return tmp; | |
3500 } | |
3501 | |
3502 /* | |
3503 * Create a new bitmap button window (widget) to be packed. | |
3504 * Parameters: | |
3505 * text: Bubble help text to be displayed. | |
3506 * id: An ID of a bitmap in the resource file. | |
3507 */ | |
3508 HWND dw_bitmapbutton_new(char *text, unsigned long id) | |
3509 { | |
3510 GtkWidget *tmp; | |
3511 GtkWidget *bitmap; | |
3512 GtkTooltips *tooltips; | |
3513 int _locked_by_me = FALSE; | |
3514 | |
3515 DW_MUTEX_LOCK; | |
3516 tmp = gtk_button_new(); | |
3517 bitmap = dw_bitmap_new(id); | |
3518 | |
3519 if(bitmap) | |
3520 { | |
278
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
273
diff
changeset
|
3521 dw_window_set_bitmap(bitmap, id, NULL); |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
273
diff
changeset
|
3522 gtk_container_add (GTK_CONTAINER(tmp), bitmap); |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
273
diff
changeset
|
3523 } |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
273
diff
changeset
|
3524 gtk_widget_show(tmp); |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
273
diff
changeset
|
3525 if(text) |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
273
diff
changeset
|
3526 { |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
273
diff
changeset
|
3527 tooltips = gtk_tooltips_new(); |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
273
diff
changeset
|
3528 gtk_tooltips_set_tip(tooltips, tmp, text, NULL); |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
273
diff
changeset
|
3529 gtk_object_set_data(GTK_OBJECT(tmp), "tooltip", (gpointer)tooltips); |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
273
diff
changeset
|
3530 } |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
3531 gtk_object_set_data(GTK_OBJECT(tmp), "_dw_id", (gpointer)id); |
278
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
273
diff
changeset
|
3532 DW_MUTEX_UNLOCK; |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
273
diff
changeset
|
3533 return tmp; |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
273
diff
changeset
|
3534 } |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
273
diff
changeset
|
3535 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
273
diff
changeset
|
3536 /* |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
273
diff
changeset
|
3537 * Create a new bitmap button window (widget) to be packed from a file. |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
273
diff
changeset
|
3538 * Parameters: |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
273
diff
changeset
|
3539 * text: Bubble help text to be displayed. |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
273
diff
changeset
|
3540 * id: An ID to be used with dw_window_from_id() or 0L. |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
273
diff
changeset
|
3541 * filename: Name of the file, omit extention to have |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
273
diff
changeset
|
3542 * DW pick the appropriate file extension. |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
273
diff
changeset
|
3543 * (BMP on OS/2 or Windows, XPM on Unix) |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
273
diff
changeset
|
3544 */ |
279
984db8aefd7f
Build fixes for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
278
diff
changeset
|
3545 HWND dw_bitmapbutton_new_from_file(char *text, unsigned long id, char *filename) |
278
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
273
diff
changeset
|
3546 { |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
273
diff
changeset
|
3547 GtkWidget *tmp; |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
273
diff
changeset
|
3548 GtkWidget *bitmap; |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
273
diff
changeset
|
3549 GtkTooltips *tooltips; |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
273
diff
changeset
|
3550 int _locked_by_me = FALSE; |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
273
diff
changeset
|
3551 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
273
diff
changeset
|
3552 DW_MUTEX_LOCK; |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
273
diff
changeset
|
3553 tmp = gtk_button_new(); |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
273
diff
changeset
|
3554 bitmap = dw_bitmap_new(id); |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
273
diff
changeset
|
3555 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
273
diff
changeset
|
3556 if(bitmap) |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
273
diff
changeset
|
3557 { |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
273
diff
changeset
|
3558 dw_window_set_bitmap(bitmap, 0, filename); |
3 | 3559 gtk_container_add (GTK_CONTAINER(tmp), bitmap); |
3560 } | |
3561 gtk_widget_show(tmp); | |
3562 if(text) | |
3563 { | |
3564 tooltips = gtk_tooltips_new(); | |
3565 gtk_tooltips_set_tip(tooltips, tmp, text, NULL); | |
3566 gtk_object_set_data(GTK_OBJECT(tmp), "tooltip", (gpointer)tooltips); | |
3567 } | |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
3568 gtk_object_set_data(GTK_OBJECT(tmp), "_dw_id", (gpointer)id); |
3 | 3569 DW_MUTEX_UNLOCK; |
3570 return tmp; | |
3571 } | |
3572 | |
3573 /* | |
3574 * Create a new spinbutton window (widget) to be packed. | |
3575 * Parameters: | |
3576 * text: The text to be display by the static text widget. | |
278
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
273
diff
changeset
|
3577 * id: An ID to be used with dw_window_from_id() or 0L. |
3 | 3578 */ |
3579 HWND dw_spinbutton_new(char *text, unsigned long id) | |
3580 { | |
3581 GtkAdjustment *adj; | |
3582 GtkWidget *tmp; | |
3583 int _locked_by_me = FALSE; | |
3584 | |
3585 DW_MUTEX_LOCK; | |
3586 adj = (GtkAdjustment *)gtk_adjustment_new (1.0, 0.0, 100.0, 1.0, 5.0, 0.0); | |
3587 tmp = gtk_spin_button_new (adj, 0, 0); | |
3588 gtk_spin_button_set_numeric(GTK_SPIN_BUTTON(tmp), TRUE); | |
3589 gtk_spin_button_set_wrap(GTK_SPIN_BUTTON(tmp), TRUE); | |
3590 gtk_widget_show(tmp); | |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
3591 gtk_object_set_data(GTK_OBJECT(tmp), "_dw_id", (gpointer)id); |
3 | 3592 DW_MUTEX_UNLOCK; |
3593 return tmp; | |
3594 } | |
3595 | |
3596 /* | |
3597 * Create a new radiobutton window (widget) to be packed. | |
3598 * Parameters: | |
3599 * text: The text to be display by the static text widget. | |
278
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
273
diff
changeset
|
3600 * id: An ID to be used with dw_window_from_id() or 0L. |
3 | 3601 */ |
3602 HWND dw_radiobutton_new(char *text, ULONG id) | |
3603 { | |
3604 /* This will have to be fixed in the future. */ | |
3605 GtkWidget *tmp; | |
3606 int _locked_by_me = FALSE; | |
3607 | |
3608 DW_MUTEX_LOCK; | |
3609 tmp = gtk_radio_button_new_with_label(NULL, text); | |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
3610 gtk_object_set_data(GTK_OBJECT(tmp), "_dw_id", (gpointer)id); |
3 | 3611 gtk_widget_show(tmp); |
3612 | |
3613 DW_MUTEX_UNLOCK; | |
3614 return tmp; | |
3615 } | |
3616 | |
3617 /* | |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
3618 * Create a new slider window (widget) to be packed. |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
3619 * Parameters: |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
3620 * vertical: TRUE or FALSE if slider is vertical. |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
3621 * increments: Number of increments available. |
278
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
273
diff
changeset
|
3622 * id: An ID to be used with dw_window_from_id() or 0L. |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
3623 */ |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
3624 HWND dw_slider_new(int vertical, int increments, ULONG id) |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
3625 { |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
3626 GtkWidget *tmp; |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
3627 GtkAdjustment *adjustment; |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
3628 int _locked_by_me = FALSE; |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
3629 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
3630 DW_MUTEX_LOCK; |
67
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
66
diff
changeset
|
3631 adjustment = (GtkAdjustment *)gtk_adjustment_new(0, 0, (gfloat)increments, 1, 1, 1); |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
3632 if(vertical) |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
3633 tmp = gtk_vscale_new(adjustment); |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
3634 else |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
3635 tmp = gtk_hscale_new(adjustment); |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
3636 gtk_widget_show(tmp); |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
3637 gtk_scale_set_draw_value(GTK_SCALE(tmp), 0); |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
3638 gtk_scale_set_digits(GTK_SCALE(tmp), 0); |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
3639 gtk_object_set_data(GTK_OBJECT(tmp), "_dw_adjustment", (gpointer)adjustment); |
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
3640 gtk_object_set_data(GTK_OBJECT(adjustment), "_dw_slider", (gpointer)tmp); |
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
3641 gtk_object_set_data(GTK_OBJECT(tmp), "_dw_id", (gpointer)id); |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
3642 DW_MUTEX_UNLOCK; |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
3643 return tmp; |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
3644 } |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
3645 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
3646 /* |
195
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
3647 * Create a new scrollbar window (widget) to be packed. |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
3648 * Parameters: |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
3649 * vertical: TRUE or FALSE if scrollbar is vertical. |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
3650 * increments: Number of increments available. |
278
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
273
diff
changeset
|
3651 * id: An ID to be used with dw_window_from_id() or 0L. |
195
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
3652 */ |
511
80dbd5a1f403
Removed the increments parameter from dw_scrollbar_new().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
510
diff
changeset
|
3653 HWND dw_scrollbar_new(int vertical, ULONG id) |
195
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
3654 { |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
3655 GtkWidget *tmp; |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
3656 GtkAdjustment *adjustment; |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
3657 int _locked_by_me = FALSE; |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
3658 |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
3659 DW_MUTEX_LOCK; |
511
80dbd5a1f403
Removed the increments parameter from dw_scrollbar_new().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
510
diff
changeset
|
3660 adjustment = (GtkAdjustment *)gtk_adjustment_new(0, 0, 0, 1, 1, 1); |
195
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
3661 if(vertical) |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
3662 tmp = gtk_vscrollbar_new(adjustment); |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
3663 else |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
3664 tmp = gtk_hscrollbar_new(adjustment); |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
3665 GTK_WIDGET_UNSET_FLAGS(tmp, GTK_CAN_FOCUS); |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
3666 gtk_widget_show(tmp); |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
3667 gtk_object_set_data(GTK_OBJECT(tmp), "_dw_adjustment", (gpointer)adjustment); |
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
3668 gtk_object_set_data(GTK_OBJECT(adjustment), "_dw_scrollbar", (gpointer)tmp); |
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
3669 gtk_object_set_data(GTK_OBJECT(tmp), "_dw_id", (gpointer)id); |
195
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
3670 DW_MUTEX_UNLOCK; |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
3671 return tmp; |
196
3dc60d60007f
Fixed a missing bracket.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
195
diff
changeset
|
3672 } |
195
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
3673 |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
3674 /* |
33
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
30
diff
changeset
|
3675 * Create a new percent bar window (widget) to be packed. |
3 | 3676 * Parameters: |
278
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
273
diff
changeset
|
3677 * id: An ID to be used with dw_window_from_id() or 0L. |
3 | 3678 */ |
33
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
30
diff
changeset
|
3679 HWND dw_percent_new(unsigned long id) |
3 | 3680 { |
3681 GtkWidget *tmp; | |
3682 int _locked_by_me = FALSE; | |
3683 | |
3684 DW_MUTEX_LOCK; | |
3685 tmp = gtk_progress_bar_new(); | |
3686 gtk_widget_show(tmp); | |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
3687 gtk_object_set_data(GTK_OBJECT(tmp), "_dw_id", (gpointer)id); |
3 | 3688 DW_MUTEX_UNLOCK; |
3689 return tmp; | |
3690 } | |
3691 | |
3692 /* | |
3693 * Create a new checkbox window (widget) to be packed. | |
3694 * Parameters: | |
3695 * text: The text to be display by the static text widget. | |
278
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
273
diff
changeset
|
3696 * id: An ID to be used with dw_window_from_id() or 0L. |
3 | 3697 */ |
3698 HWND dw_checkbox_new(char *text, unsigned long id) | |
3699 { | |
3700 GtkWidget *tmp; | |
3701 int _locked_by_me = FALSE; | |
3702 | |
3703 DW_MUTEX_LOCK; | |
3704 tmp = gtk_check_button_new_with_label(text); | |
3705 gtk_widget_show(tmp); | |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
3706 gtk_object_set_data(GTK_OBJECT(tmp), "_dw_id", (gpointer)id); |
3 | 3707 DW_MUTEX_UNLOCK; |
3708 return tmp; | |
3709 } | |
3710 | |
3711 /* | |
3712 * Create a new listbox window (widget) to be packed. | |
3713 * Parameters: | |
278
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
273
diff
changeset
|
3714 * id: An ID to be used with dw_window_from_id() or 0L. |
3 | 3715 * multi: Multiple select TRUE or FALSE. |
3716 */ | |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3717 HWND dw_listbox_new(unsigned long id, int multi) |
3 | 3718 { |
3719 GtkWidget *tmp, *list; | |
3720 int _locked_by_me = FALSE; | |
3721 | |
3722 DW_MUTEX_LOCK; | |
3723 tmp = gtk_scrolled_window_new(NULL, NULL); | |
3724 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW (tmp), | |
3725 GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); | |
3726 | |
3727 list = gtk_list_new(); | |
3728 gtk_list_set_selection_mode(GTK_LIST(list), multi ? GTK_SELECTION_MULTIPLE : GTK_SELECTION_SINGLE); | |
3729 | |
3730 gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(tmp), | |
3731 list); | |
3732 gtk_object_set_user_data(GTK_OBJECT(tmp), list); | |
3733 gtk_widget_show(list); | |
3734 gtk_widget_show(tmp); | |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
3735 gtk_object_set_data(GTK_OBJECT(tmp), "_dw_id", (gpointer)id); |
3 | 3736 |
3737 DW_MUTEX_UNLOCK; | |
3738 return tmp; | |
3739 } | |
3740 | |
3741 /* | |
3742 * Sets the icon used for a given window. | |
3743 * Parameters: | |
3744 * handle: Handle to the window. | |
3745 * id: An ID to be used to specify the icon. | |
3746 */ | |
3747 void dw_window_set_icon(HWND handle, unsigned long id) | |
3748 { | |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3749 GdkBitmap *bitmap = NULL; |
3 | 3750 GdkPixmap *icon_pixmap; |
3751 int _locked_by_me = FALSE; | |
3752 | |
3753 DW_MUTEX_LOCK; | |
121
d8af32b1b1cd
Switch back to using pixmaps and bitmaps, only use pixbufs for doing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
120
diff
changeset
|
3754 icon_pixmap = _find_pixmap(&bitmap, id, handle, NULL, NULL); |
3 | 3755 |
3756 if(handle->window && icon_pixmap) | |
3757 gdk_window_set_icon(handle->window, NULL, icon_pixmap, bitmap); | |
3758 | |
3759 DW_MUTEX_UNLOCK; | |
3760 } | |
3761 | |
3762 /* | |
3763 * Sets the bitmap used for a given static window. | |
3764 * Parameters: | |
3765 * handle: Handle to the window. | |
278
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
273
diff
changeset
|
3766 * id: An ID to be used to specify the icon, |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
273
diff
changeset
|
3767 * (pass 0 if you use the filename param) |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
273
diff
changeset
|
3768 * filename: a path to a file (Bitmap on OS/2 or |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
273
diff
changeset
|
3769 * Windows and a pixmap on Unix, pass |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
273
diff
changeset
|
3770 * NULL if you use the id param) |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
273
diff
changeset
|
3771 */ |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
273
diff
changeset
|
3772 void dw_window_set_bitmap(HWND handle, unsigned long id, char *filename) |
3 | 3773 { |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3774 GdkBitmap *bitmap = NULL; |
3 | 3775 GdkPixmap *tmp; |
3776 int _locked_by_me = FALSE; | |
3777 | |
278
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
273
diff
changeset
|
3778 if(!id && !filename) |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
273
diff
changeset
|
3779 return; |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
273
diff
changeset
|
3780 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
273
diff
changeset
|
3781 DW_MUTEX_LOCK; |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
273
diff
changeset
|
3782 if(id) |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
273
diff
changeset
|
3783 tmp = _find_pixmap(&bitmap, id, handle, NULL, NULL); |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
273
diff
changeset
|
3784 else |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
273
diff
changeset
|
3785 { |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
273
diff
changeset
|
3786 char *file = alloca(strlen(filename) + 5); |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
273
diff
changeset
|
3787 #if GTK_MAJOR_VERSION > 1 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
273
diff
changeset
|
3788 GdkPixbuf *pixbuf; |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
273
diff
changeset
|
3789 #elif defined(USE_IMLIB) |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
273
diff
changeset
|
3790 GdkImlibImage *image; |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
273
diff
changeset
|
3791 #endif |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
273
diff
changeset
|
3792 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
273
diff
changeset
|
3793 if (!file) |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
273
diff
changeset
|
3794 { |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
273
diff
changeset
|
3795 DW_MUTEX_UNLOCK; |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
273
diff
changeset
|
3796 return; |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
273
diff
changeset
|
3797 } |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
273
diff
changeset
|
3798 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
273
diff
changeset
|
3799 strcpy(file, filename); |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
273
diff
changeset
|
3800 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
273
diff
changeset
|
3801 /* check if we can read from this file (it exists and read permission) */ |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
273
diff
changeset
|
3802 if(access(file, 04) != 0) |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
273
diff
changeset
|
3803 { |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
273
diff
changeset
|
3804 /* Try with .xpm extention */ |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
273
diff
changeset
|
3805 strcat(file, ".xpm"); |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
273
diff
changeset
|
3806 if(access(file, 04) != 0) |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
273
diff
changeset
|
3807 { |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
273
diff
changeset
|
3808 DW_MUTEX_UNLOCK; |
279
984db8aefd7f
Build fixes for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
278
diff
changeset
|
3809 return; |
278
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
273
diff
changeset
|
3810 } |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
273
diff
changeset
|
3811 } |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
273
diff
changeset
|
3812 #if GTK_MAJOR_VERSION > 1 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
273
diff
changeset
|
3813 pixbuf = gdk_pixbuf_new_from_file(file, NULL); |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
273
diff
changeset
|
3814 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
273
diff
changeset
|
3815 gdk_pixbuf_render_pixmap_and_mask(pixbuf, &tmp, &bitmap, 1); |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
273
diff
changeset
|
3816 g_object_unref(pixbuf); |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
273
diff
changeset
|
3817 #elif defined(USE_IMLIB) |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
273
diff
changeset
|
3818 image = gdk_imlib_load_image(file); |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
273
diff
changeset
|
3819 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
273
diff
changeset
|
3820 gdk_imlib_render(image, image->rgb_width, image->rgb_height); |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
273
diff
changeset
|
3821 tmp = gdk_imlib_copy_image(image); |
282
916045924784
Fixed the mask in dw_window_set_bitmap() when using imlib.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
279
diff
changeset
|
3822 bitmap = gdk_imlib_copy_mask(image); |
278
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
273
diff
changeset
|
3823 gdk_imlib_destroy_image(image); |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
273
diff
changeset
|
3824 #else |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
273
diff
changeset
|
3825 tmp = gdk_pixmap_create_from_xpm(handle->window, &bitmap, &_colors[DW_CLR_PALEGRAY], file); |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
273
diff
changeset
|
3826 #endif |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
273
diff
changeset
|
3827 } |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
273
diff
changeset
|
3828 |
3 | 3829 if(tmp) |
120
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
3830 #if GTK_MAJOR_VERSION > 1 |
121
d8af32b1b1cd
Switch back to using pixmaps and bitmaps, only use pixbufs for doing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
120
diff
changeset
|
3831 gtk_image_set_from_pixmap(GTK_IMAGE(handle), tmp, bitmap); |
120
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
3832 #else |
3 | 3833 gtk_pixmap_set(GTK_PIXMAP(handle), tmp, bitmap); |
120
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
3834 #endif |
3 | 3835 DW_MUTEX_UNLOCK; |
3836 } | |
3837 | |
3838 /* | |
3839 * Sets the text used for a given window. | |
3840 * Parameters: | |
3841 * handle: Handle to the window. | |
407
a8124a9561c7
Fix for dw_window_set_text() on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
403
diff
changeset
|
3842 * text: The text associsated with a given window. f |
3 | 3843 */ |
3844 void dw_window_set_text(HWND handle, char *text) | |
3845 { | |
3846 int _locked_by_me = FALSE; | |
3847 | |
3848 DW_MUTEX_LOCK; | |
3849 if(GTK_IS_ENTRY(handle)) | |
3850 gtk_entry_set_text(GTK_ENTRY(handle), text); | |
3851 else if(GTK_IS_COMBO(handle)) | |
3852 gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(handle)->entry), text); | |
3853 else if(GTK_IS_LABEL(handle)) | |
3854 gtk_label_set_text(GTK_LABEL(handle), text); | |
402
0f0183aa2b05
Fixed dw_window_set_text() to work on buttons.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
401
diff
changeset
|
3855 else if(GTK_IS_BUTTON(handle)) |
403
6a3ef130962f
Check that the child is actually a label before trying to operate on it.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
402
diff
changeset
|
3856 { |
407
a8124a9561c7
Fix for dw_window_set_text() on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
403
diff
changeset
|
3857 #if GTK_MAJOR_VERSION < 2 |
403
6a3ef130962f
Check that the child is actually a label before trying to operate on it.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
402
diff
changeset
|
3858 GtkWidget *label = GTK_BUTTON(handle)->child; |
6a3ef130962f
Check that the child is actually a label before trying to operate on it.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
402
diff
changeset
|
3859 |
6a3ef130962f
Check that the child is actually a label before trying to operate on it.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
402
diff
changeset
|
3860 if(GTK_IS_LABEL(label)) |
6a3ef130962f
Check that the child is actually a label before trying to operate on it.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
402
diff
changeset
|
3861 gtk_label_set_text(GTK_LABEL(label), text); |
407
a8124a9561c7
Fix for dw_window_set_text() on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
403
diff
changeset
|
3862 #else |
a8124a9561c7
Fix for dw_window_set_text() on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
403
diff
changeset
|
3863 gtk_button_set_label(GTK_BUTTON(handle), text); |
a8124a9561c7
Fix for dw_window_set_text() on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
403
diff
changeset
|
3864 #endif |
403
6a3ef130962f
Check that the child is actually a label before trying to operate on it.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
402
diff
changeset
|
3865 } |
420
0cc801c0f2b6
dw_window_set_text() on a toplevel widget from dw_window_new() now works.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
415
diff
changeset
|
3866 else if(GTK_WIDGET_TOPLEVEL(handle)) |
0cc801c0f2b6
dw_window_set_text() on a toplevel widget from dw_window_new() now works.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
415
diff
changeset
|
3867 gtk_window_set_title(GTK_WINDOW(handle), text); |
14
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3868 else if(GTK_IS_FRAME(handle)) |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3869 { |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
3870 GtkWidget *tmp = (GtkWidget *)gtk_object_get_data(GTK_OBJECT(handle), "_dw_label"); |
14
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3871 if(tmp && GTK_IS_LABEL(tmp)) |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3872 gtk_label_set_text(GTK_LABEL(tmp), text); |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3873 } |
3 | 3874 DW_MUTEX_UNLOCK; |
3875 } | |
3876 | |
3877 /* | |
3878 * Gets the text used for a given window. | |
3879 * Parameters: | |
3880 * handle: Handle to the window. | |
3881 * Returns: | |
3882 * text: The text associsated with a given window. | |
3883 */ | |
3884 char *dw_window_get_text(HWND handle) | |
3885 { | |
120
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
3886 #if GTK_MAJOR_VERSION > 1 |
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
3887 const char *possible = ""; |
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
3888 #else |
3 | 3889 char *possible = ""; |
120
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
3890 #endif |
3 | 3891 int _locked_by_me = FALSE; |
3892 | |
3893 DW_MUTEX_LOCK; | |
3894 if(GTK_IS_ENTRY(handle)) | |
3895 possible = gtk_entry_get_text(GTK_ENTRY(handle)); | |
3896 else if(GTK_IS_COMBO(handle)) | |
3897 possible = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(handle)->entry)); | |
3898 | |
3899 DW_MUTEX_UNLOCK; | |
3900 return strdup(possible); | |
3901 } | |
3902 | |
3903 /* | |
3904 * Disables given window (widget). | |
3905 * Parameters: | |
3906 * handle: Handle to the window. | |
3907 */ | |
3908 void dw_window_disable(HWND handle) | |
3909 { | |
3910 int _locked_by_me = FALSE; | |
3911 | |
3912 DW_MUTEX_LOCK; | |
3913 gtk_widget_set_sensitive(handle, FALSE); | |
3914 DW_MUTEX_UNLOCK; | |
3915 } | |
3916 | |
3917 /* | |
3918 * Enables given window (widget). | |
3919 * Parameters: | |
3920 * handle: Handle to the window. | |
3921 */ | |
3922 void dw_window_enable(HWND handle) | |
3923 { | |
3924 int _locked_by_me = FALSE; | |
3925 | |
3926 DW_MUTEX_LOCK; | |
3927 gtk_widget_set_sensitive(handle, TRUE); | |
3928 DW_MUTEX_UNLOCK; | |
3929 } | |
3930 | |
249
5a594058687f
Added empty dw_window_from_id()... will try to implement it shortly.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
246
diff
changeset
|
3931 /* |
5a594058687f
Added empty dw_window_from_id()... will try to implement it shortly.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
246
diff
changeset
|
3932 * Gets the child window handle with specified ID. |
5a594058687f
Added empty dw_window_from_id()... will try to implement it shortly.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
246
diff
changeset
|
3933 * Parameters: |
5a594058687f
Added empty dw_window_from_id()... will try to implement it shortly.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
246
diff
changeset
|
3934 * handle: Handle to the parent window. |
5a594058687f
Added empty dw_window_from_id()... will try to implement it shortly.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
246
diff
changeset
|
3935 * id: Integer ID of the child. |
5a594058687f
Added empty dw_window_from_id()... will try to implement it shortly.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
246
diff
changeset
|
3936 */ |
5a594058687f
Added empty dw_window_from_id()... will try to implement it shortly.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
246
diff
changeset
|
3937 HWND API dw_window_from_id(HWND handle, int id) |
5a594058687f
Added empty dw_window_from_id()... will try to implement it shortly.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
246
diff
changeset
|
3938 { |
267
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
265
diff
changeset
|
3939 GList *orig = NULL, *list = NULL; |
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
265
diff
changeset
|
3940 int _locked_by_me = FALSE; |
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
265
diff
changeset
|
3941 |
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
265
diff
changeset
|
3942 DW_MUTEX_LOCK; |
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
265
diff
changeset
|
3943 if(handle && GTK_IS_CONTAINER(handle)) |
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
265
diff
changeset
|
3944 { |
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
265
diff
changeset
|
3945 #if GTK_MAJOR_VERSION > 1 |
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
265
diff
changeset
|
3946 orig = list = gtk_container_get_children(GTK_CONTAINER(handle)); |
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
265
diff
changeset
|
3947 #else |
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
265
diff
changeset
|
3948 orig = list = gtk_container_children(GTK_CONTAINER(handle)); |
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
265
diff
changeset
|
3949 #endif |
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
265
diff
changeset
|
3950 } |
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
265
diff
changeset
|
3951 while(list) |
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
265
diff
changeset
|
3952 { |
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
265
diff
changeset
|
3953 if(GTK_IS_WIDGET(list->data)) |
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
265
diff
changeset
|
3954 { |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
3955 if(id == (int)gtk_object_get_data(GTK_OBJECT(list->data), "_dw_id")) |
267
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
265
diff
changeset
|
3956 { |
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
265
diff
changeset
|
3957 HWND ret = (HWND)list->data; |
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
265
diff
changeset
|
3958 g_list_free(orig); |
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
265
diff
changeset
|
3959 DW_MUTEX_UNLOCK; |
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
265
diff
changeset
|
3960 return ret; |
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
265
diff
changeset
|
3961 } |
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
265
diff
changeset
|
3962 } |
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
265
diff
changeset
|
3963 list = list->next; |
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
265
diff
changeset
|
3964 } |
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
265
diff
changeset
|
3965 if(orig) |
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
265
diff
changeset
|
3966 g_list_free(orig); |
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
265
diff
changeset
|
3967 DW_MUTEX_UNLOCK; |
249
5a594058687f
Added empty dw_window_from_id()... will try to implement it shortly.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
246
diff
changeset
|
3968 return 0L; |
5a594058687f
Added empty dw_window_from_id()... will try to implement it shortly.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
246
diff
changeset
|
3969 } |
5a594058687f
Added empty dw_window_from_id()... will try to implement it shortly.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
246
diff
changeset
|
3970 |
36
cddb02f847e1
Added unix versions of functions in compat, and added getfsname, plus
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
3971 void _strip_cr(char *dest, char *src) |
cddb02f847e1
Added unix versions of functions in compat, and added getfsname, plus
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
3972 { |
cddb02f847e1
Added unix versions of functions in compat, and added getfsname, plus
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
3973 int z, x = 0; |
cddb02f847e1
Added unix versions of functions in compat, and added getfsname, plus
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
3974 |
cddb02f847e1
Added unix versions of functions in compat, and added getfsname, plus
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
3975 for(z=0;z<strlen(src);z++) |
cddb02f847e1
Added unix versions of functions in compat, and added getfsname, plus
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
3976 { |
cddb02f847e1
Added unix versions of functions in compat, and added getfsname, plus
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
3977 if(src[z] != '\r') |
cddb02f847e1
Added unix versions of functions in compat, and added getfsname, plus
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
3978 { |
cddb02f847e1
Added unix versions of functions in compat, and added getfsname, plus
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
3979 dest[x] = src[z]; |
cddb02f847e1
Added unix versions of functions in compat, and added getfsname, plus
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
3980 x++; |
cddb02f847e1
Added unix versions of functions in compat, and added getfsname, plus
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
3981 } |
cddb02f847e1
Added unix versions of functions in compat, and added getfsname, plus
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
3982 } |
cddb02f847e1
Added unix versions of functions in compat, and added getfsname, plus
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
3983 dest[x] = 0; |
cddb02f847e1
Added unix versions of functions in compat, and added getfsname, plus
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
3984 } |
cddb02f847e1
Added unix versions of functions in compat, and added getfsname, plus
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
3985 |
3 | 3986 /* |
3987 * Adds text to an MLE box and returns the current point. | |
3988 * Parameters: | |
3989 * handle: Handle to the MLE to be queried. | |
3990 * buffer: Text buffer to be imported. | |
3991 * startpoint: Point to start entering text. | |
3992 */ | |
3993 unsigned int dw_mle_import(HWND handle, char *buffer, int startpoint) | |
3994 { | |
3995 unsigned int tmppoint = startpoint; | |
3996 int _locked_by_me = FALSE; | |
3997 | |
3998 DW_MUTEX_LOCK; | |
120
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
3999 #if GTK_MAJOR_VERSION > 1 |
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
4000 if(GTK_IS_SCROLLED_WINDOW(handle)) |
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
4001 #else |
3 | 4002 if(GTK_IS_BOX(handle)) |
120
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
4003 #endif |
3 | 4004 { |
147
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
4005 GtkWidget *tmp = (GtkWidget *)gtk_object_get_user_data(GTK_OBJECT(handle)); |
3 | 4006 |
120
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
4007 #if GTK_MAJOR_VERSION > 1 |
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
4008 if(tmp && GTK_IS_TEXT_VIEW(tmp)) |
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
4009 { |
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
4010 char *impbuf = malloc(strlen(buffer)+1); |
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
4011 GtkTextBuffer *tbuffer; |
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
4012 GtkTextIter iter; |
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
4013 |
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
4014 _strip_cr(impbuf, buffer); |
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
4015 |
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
4016 tbuffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (tmp)); |
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
4017 gtk_text_buffer_get_iter_at_offset(tbuffer, &iter, startpoint); |
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
4018 gtk_text_buffer_place_cursor(tbuffer, &iter); |
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
4019 gtk_text_buffer_insert_at_cursor(tbuffer, impbuf, -1); |
147
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
4020 tmppoint = (startpoint > -1 ? startpoint : 0) + strlen(impbuf); |
120
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
4021 free(impbuf); |
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
4022 } |
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
4023 #else |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
4024 GdkFont *font = (GdkFont *)gtk_object_get_data(GTK_OBJECT(handle), "_dw_gdkfont"); |
122
a05b6fb9c545
Minor bug fixes and code cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
121
diff
changeset
|
4025 |
3 | 4026 if(tmp && GTK_IS_TEXT(tmp)) |
4027 { | |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
4028 GdkColor *fore = (GdkColor *)gtk_object_get_data(GTK_OBJECT(handle), "_dw_foregdk"); |
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
4029 GdkColor *back = (GdkColor *)gtk_object_get_data(GTK_OBJECT(handle), "_dw_backgdk"); |
36
cddb02f847e1
Added unix versions of functions in compat, and added getfsname, plus
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
4030 char *impbuf = malloc(strlen(buffer)+1); |
cddb02f847e1
Added unix versions of functions in compat, and added getfsname, plus
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
4031 |
cddb02f847e1
Added unix versions of functions in compat, and added getfsname, plus
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
4032 _strip_cr(impbuf, buffer); |
cddb02f847e1
Added unix versions of functions in compat, and added getfsname, plus
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
4033 |
3 | 4034 gtk_text_set_point(GTK_TEXT(tmp), startpoint < 0 ? 0 : startpoint); |
36
cddb02f847e1
Added unix versions of functions in compat, and added getfsname, plus
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
4035 gtk_text_insert(GTK_TEXT(tmp), font, fore, back, impbuf, -1); |
3 | 4036 tmppoint = gtk_text_get_point(GTK_TEXT(tmp)); |
36
cddb02f847e1
Added unix versions of functions in compat, and added getfsname, plus
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
4037 free(impbuf); |
3 | 4038 } |
120
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
4039 #endif |
3 | 4040 } |
4041 DW_MUTEX_UNLOCK; | |
4042 return tmppoint; | |
4043 } | |
4044 | |
4045 /* | |
4046 * Grabs text from an MLE box. | |
4047 * Parameters: | |
4048 * handle: Handle to the MLE to be queried. | |
4049 * buffer: Text buffer to be exported. | |
4050 * startpoint: Point to start grabbing text. | |
4051 * length: Amount of text to be grabbed. | |
4052 */ | |
4053 void dw_mle_export(HWND handle, char *buffer, int startpoint, int length) | |
4054 { | |
4055 int _locked_by_me = FALSE; | |
4056 gchar *text; | |
4057 | |
4058 DW_MUTEX_LOCK; | |
427
b0e2ba7c46c5
For message boxes that have icons, increase the size of the text area (and hence the
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
426
diff
changeset
|
4059 /* force the return value to nul in case the following tests fail */ |
b0e2ba7c46c5
For message boxes that have icons, increase the size of the text area (and hence the
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
426
diff
changeset
|
4060 if(buffer) |
b0e2ba7c46c5
For message boxes that have icons, increase the size of the text area (and hence the
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
426
diff
changeset
|
4061 strcpy(buffer,""); |
130
54014258099a
Added most of the missing code for the MLE's for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
122
diff
changeset
|
4062 #if GTK_MAJOR_VERSION > 1 |
54014258099a
Added most of the missing code for the MLE's for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
122
diff
changeset
|
4063 if(GTK_IS_SCROLLED_WINDOW(handle)) |
54014258099a
Added most of the missing code for the MLE's for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
122
diff
changeset
|
4064 #else |
3 | 4065 if(GTK_IS_BOX(handle)) |
130
54014258099a
Added most of the missing code for the MLE's for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
122
diff
changeset
|
4066 #endif |
3 | 4067 { |
147
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
4068 GtkWidget *tmp = (GtkWidget *)gtk_object_get_user_data(GTK_OBJECT(handle)); |
3 | 4069 |
130
54014258099a
Added most of the missing code for the MLE's for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
122
diff
changeset
|
4070 #if GTK_MAJOR_VERSION > 1 |
54014258099a
Added most of the missing code for the MLE's for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
122
diff
changeset
|
4071 if(tmp && GTK_IS_TEXT_VIEW(tmp)) |
54014258099a
Added most of the missing code for the MLE's for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
122
diff
changeset
|
4072 { |
54014258099a
Added most of the missing code for the MLE's for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
122
diff
changeset
|
4073 GtkTextBuffer *tbuffer; |
54014258099a
Added most of the missing code for the MLE's for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
122
diff
changeset
|
4074 GtkTextIter start, end; |
54014258099a
Added most of the missing code for the MLE's for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
122
diff
changeset
|
4075 |
54014258099a
Added most of the missing code for the MLE's for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
122
diff
changeset
|
4076 tbuffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (tmp)); |
54014258099a
Added most of the missing code for the MLE's for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
122
diff
changeset
|
4077 gtk_text_buffer_get_iter_at_offset(tbuffer, &start, startpoint); |
54014258099a
Added most of the missing code for the MLE's for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
122
diff
changeset
|
4078 gtk_text_buffer_get_iter_at_offset(tbuffer, &end, startpoint + length); |
54014258099a
Added most of the missing code for the MLE's for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
122
diff
changeset
|
4079 text = gtk_text_iter_get_text(&start, &end); |
54014258099a
Added most of the missing code for the MLE's for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
122
diff
changeset
|
4080 if(text) /* Should this get freed? */ |
427
b0e2ba7c46c5
For message boxes that have icons, increase the size of the text area (and hence the
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
426
diff
changeset
|
4081 { |
b0e2ba7c46c5
For message boxes that have icons, increase the size of the text area (and hence the
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
426
diff
changeset
|
4082 if(buffer) |
b0e2ba7c46c5
For message boxes that have icons, increase the size of the text area (and hence the
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
426
diff
changeset
|
4083 strcpy(buffer, text); |
b0e2ba7c46c5
For message boxes that have icons, increase the size of the text area (and hence the
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
426
diff
changeset
|
4084 } |
130
54014258099a
Added most of the missing code for the MLE's for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
122
diff
changeset
|
4085 } |
54014258099a
Added most of the missing code for the MLE's for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
122
diff
changeset
|
4086 #else |
3 | 4087 if(tmp && GTK_IS_TEXT(tmp)) |
4088 { | |
427
b0e2ba7c46c5
For message boxes that have icons, increase the size of the text area (and hence the
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
426
diff
changeset
|
4089 text = gtk_editable_get_chars(GTK_EDITABLE(&(GTK_TEXT(tmp)->editable)), startpoint, startpoint + length - 1); |
3 | 4090 if(text) |
4091 { | |
427
b0e2ba7c46c5
For message boxes that have icons, increase the size of the text area (and hence the
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
426
diff
changeset
|
4092 if(buffer) |
b0e2ba7c46c5
For message boxes that have icons, increase the size of the text area (and hence the
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
426
diff
changeset
|
4093 strcpy(buffer, text); |
3 | 4094 g_free(text); |
4095 } | |
4096 } | |
130
54014258099a
Added most of the missing code for the MLE's for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
122
diff
changeset
|
4097 #endif |
3 | 4098 } |
4099 DW_MUTEX_UNLOCK; | |
4100 } | |
4101 | |
4102 /* | |
4103 * Obtains information about an MLE box. | |
4104 * Parameters: | |
4105 * handle: Handle to the MLE to be queried. | |
4106 * bytes: A pointer to a variable to return the total bytes. | |
4107 * lines: A pointer to a variable to return the number of lines. | |
4108 */ | |
510
710f82598210
Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
508
diff
changeset
|
4109 void dw_mle_get_size(HWND handle, unsigned long *bytes, unsigned long *lines) |
3 | 4110 { |
4111 int _locked_by_me = FALSE; | |
4112 | |
4113 if(bytes) | |
4114 *bytes = 0; | |
4115 if(lines) | |
4116 *lines = 0; | |
4117 | |
4118 DW_MUTEX_LOCK; | |
120
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
4119 #if GTK_MAJOR_VERSION > 1 |
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
4120 if(GTK_IS_SCROLLED_WINDOW(handle)) |
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
4121 { |
147
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
4122 GtkWidget *tmp = (GtkWidget *)gtk_object_get_user_data(GTK_OBJECT(handle)); |
120
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
4123 |
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
4124 if(tmp && GTK_IS_TEXT_VIEW(tmp)) |
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
4125 { |
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
4126 GtkTextBuffer *buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(tmp)); |
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
4127 |
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
4128 if(bytes) |
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
4129 *bytes = gtk_text_buffer_get_char_count(buffer) + 1; |
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
4130 if(lines) |
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
4131 *lines = gtk_text_buffer_get_line_count(buffer) + 1; |
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
4132 } |
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
4133 } |
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
4134 #else |
3 | 4135 if(GTK_IS_BOX(handle)) |
4136 { | |
147
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
4137 GtkWidget *tmp = (GtkWidget *)gtk_object_get_user_data(GTK_OBJECT(handle)); |
3 | 4138 |
4139 if(tmp && GTK_IS_TEXT(tmp)) | |
4140 { | |
4141 if(bytes) | |
40
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
4142 *bytes = gtk_text_get_length(GTK_TEXT(tmp)) + 1; |
3 | 4143 if(lines) |
4144 { | |
4145 gchar *text; | |
4146 | |
4147 *lines = 0; | |
386
5326544ab2ec
Change dw_mle_query() under GTK 1.2 so that it returns the correct number of lines.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
383
diff
changeset
|
4148 text = gtk_editable_get_chars(GTK_EDITABLE(&(GTK_TEXT(tmp)->editable)), 0, gtk_text_get_length(GTK_TEXT(tmp))); |
3 | 4149 |
4150 if(text) | |
4151 { | |
4152 int z, len = strlen(text); | |
4153 | |
4154 for(z=0;z<len;z++) | |
4155 { | |
4156 if(text[z] == '\n') | |
4157 (*lines)++; | |
4158 } | |
4159 g_free(text); | |
4160 } | |
4161 } | |
4162 } | |
4163 } | |
120
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
4164 #endif |
3 | 4165 DW_MUTEX_UNLOCK; |
4166 } | |
4167 | |
4168 /* | |
4169 * Deletes text from an MLE box. | |
4170 * Parameters: | |
4171 * handle: Handle to the MLE to be deleted from. | |
4172 * startpoint: Point to start deleting text. | |
4173 * length: Amount of text to be deleted. | |
4174 */ | |
4175 void dw_mle_delete(HWND handle, int startpoint, int length) | |
4176 { | |
4177 int _locked_by_me = FALSE; | |
4178 | |
4179 DW_MUTEX_LOCK; | |
120
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
4180 #if GTK_MAJOR_VERSION > 1 |
130
54014258099a
Added most of the missing code for the MLE's for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
122
diff
changeset
|
4181 if(GTK_IS_SCROLLED_WINDOW(handle)) |
120
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
4182 #else |
3 | 4183 if(GTK_IS_BOX(handle)) |
130
54014258099a
Added most of the missing code for the MLE's for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
122
diff
changeset
|
4184 #endif |
3 | 4185 { |
147
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
4186 GtkWidget *tmp = (GtkWidget *)gtk_object_get_user_data(GTK_OBJECT(handle)); |
3 | 4187 |
130
54014258099a
Added most of the missing code for the MLE's for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
122
diff
changeset
|
4188 #if GTK_MAJOR_VERSION > 1 |
54014258099a
Added most of the missing code for the MLE's for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
122
diff
changeset
|
4189 if(tmp && GTK_IS_TEXT_VIEW(tmp)) |
54014258099a
Added most of the missing code for the MLE's for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
122
diff
changeset
|
4190 { |
54014258099a
Added most of the missing code for the MLE's for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
122
diff
changeset
|
4191 GtkTextBuffer *tbuffer; |
54014258099a
Added most of the missing code for the MLE's for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
122
diff
changeset
|
4192 GtkTextIter start, end; |
54014258099a
Added most of the missing code for the MLE's for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
122
diff
changeset
|
4193 |
54014258099a
Added most of the missing code for the MLE's for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
122
diff
changeset
|
4194 tbuffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (tmp)); |
54014258099a
Added most of the missing code for the MLE's for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
122
diff
changeset
|
4195 gtk_text_buffer_get_iter_at_offset(tbuffer, &start, startpoint); |
54014258099a
Added most of the missing code for the MLE's for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
122
diff
changeset
|
4196 gtk_text_buffer_get_iter_at_offset(tbuffer, &end, startpoint + length); |
54014258099a
Added most of the missing code for the MLE's for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
122
diff
changeset
|
4197 gtk_text_buffer_delete(tbuffer, &start, &end); |
54014258099a
Added most of the missing code for the MLE's for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
122
diff
changeset
|
4198 } |
54014258099a
Added most of the missing code for the MLE's for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
122
diff
changeset
|
4199 #else |
3 | 4200 if(tmp && GTK_IS_TEXT(tmp)) |
4201 { | |
4202 gtk_text_set_point(GTK_TEXT(tmp), startpoint); | |
4203 gtk_text_forward_delete(GTK_TEXT(tmp), length); | |
4204 } | |
120
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
4205 #endif |
130
54014258099a
Added most of the missing code for the MLE's for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
122
diff
changeset
|
4206 } |
3 | 4207 DW_MUTEX_UNLOCK; |
4208 } | |
4209 | |
4210 /* | |
4211 * Clears all text from an MLE box. | |
4212 * Parameters: | |
4213 * handle: Handle to the MLE to be cleared. | |
4214 */ | |
4215 void dw_mle_clear(HWND handle) | |
4216 { | |
4217 int length, _locked_by_me = FALSE; | |
4218 | |
4219 DW_MUTEX_LOCK; | |
120
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
4220 #if GTK_MAJOR_VERSION > 1 |
122
a05b6fb9c545
Minor bug fixes and code cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
121
diff
changeset
|
4221 if(GTK_IS_SCROLLED_WINDOW(handle)) |
a05b6fb9c545
Minor bug fixes and code cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
121
diff
changeset
|
4222 { |
147
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
4223 GtkWidget *tmp = (GtkWidget *)gtk_object_get_user_data(GTK_OBJECT(handle)); |
122
a05b6fb9c545
Minor bug fixes and code cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
121
diff
changeset
|
4224 |
a05b6fb9c545
Minor bug fixes and code cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
121
diff
changeset
|
4225 if(tmp && GTK_IS_TEXT_VIEW(tmp)) |
a05b6fb9c545
Minor bug fixes and code cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
121
diff
changeset
|
4226 { |
a05b6fb9c545
Minor bug fixes and code cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
121
diff
changeset
|
4227 GtkTextBuffer *buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(tmp)); |
a05b6fb9c545
Minor bug fixes and code cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
121
diff
changeset
|
4228 |
a05b6fb9c545
Minor bug fixes and code cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
121
diff
changeset
|
4229 length = -1; |
a05b6fb9c545
Minor bug fixes and code cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
121
diff
changeset
|
4230 gtk_text_buffer_set_text(buffer, "", length); |
a05b6fb9c545
Minor bug fixes and code cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
121
diff
changeset
|
4231 } |
a05b6fb9c545
Minor bug fixes and code cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
121
diff
changeset
|
4232 } |
120
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
4233 #else |
3 | 4234 if(GTK_IS_BOX(handle)) |
4235 { | |
147
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
4236 GtkWidget *tmp = (GtkWidget *)gtk_object_get_user_data(GTK_OBJECT(handle)); |
3 | 4237 |
4238 if(tmp && GTK_IS_TEXT(tmp)) | |
4239 { | |
4240 length = gtk_text_get_length(GTK_TEXT(tmp)); | |
4241 gtk_text_set_point(GTK_TEXT(tmp), 0); | |
4242 gtk_text_forward_delete(GTK_TEXT(tmp), length); | |
4243 } | |
4244 } | |
120
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
4245 #endif |
3 | 4246 DW_MUTEX_UNLOCK; |
4247 } | |
4248 | |
4249 /* | |
4250 * Sets the visible line of an MLE box. | |
4251 * Parameters: | |
4252 * handle: Handle to the MLE. | |
4253 * line: Line to be visible. | |
4254 */ | |
513
7755599311d4
Fixes search and replace errors.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
511
diff
changeset
|
4255 void dw_mle_set_visible(HWND handle, int line) |
3 | 4256 { |
4257 int _locked_by_me = FALSE; | |
4258 | |
4259 DW_MUTEX_LOCK; | |
120
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
4260 #if GTK_MAJOR_VERSION > 1 |
354
3a51ecc8383a
Implemented dw_mle_set_visible() for GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
353
diff
changeset
|
4261 if(GTK_IS_SCROLLED_WINDOW(handle)) |
3a51ecc8383a
Implemented dw_mle_set_visible() for GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
353
diff
changeset
|
4262 { |
3a51ecc8383a
Implemented dw_mle_set_visible() for GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
353
diff
changeset
|
4263 GtkWidget *tmp = (GtkWidget *)gtk_object_get_user_data(GTK_OBJECT(handle)); |
3a51ecc8383a
Implemented dw_mle_set_visible() for GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
353
diff
changeset
|
4264 |
3a51ecc8383a
Implemented dw_mle_set_visible() for GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
353
diff
changeset
|
4265 if(tmp && GTK_IS_TEXT_VIEW(tmp)) |
3a51ecc8383a
Implemented dw_mle_set_visible() for GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
353
diff
changeset
|
4266 { |
3a51ecc8383a
Implemented dw_mle_set_visible() for GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
353
diff
changeset
|
4267 GtkTextBuffer *tbuffer; |
3a51ecc8383a
Implemented dw_mle_set_visible() for GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
353
diff
changeset
|
4268 GtkTextIter iter; |
3a51ecc8383a
Implemented dw_mle_set_visible() for GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
353
diff
changeset
|
4269 GtkTextMark *mark = (GtkTextMark *)gtk_object_get_data(GTK_OBJECT(handle), "_dw_mark"); |
3a51ecc8383a
Implemented dw_mle_set_visible() for GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
353
diff
changeset
|
4270 |
3a51ecc8383a
Implemented dw_mle_set_visible() for GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
353
diff
changeset
|
4271 tbuffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (tmp)); |
3a51ecc8383a
Implemented dw_mle_set_visible() for GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
353
diff
changeset
|
4272 gtk_text_buffer_get_iter_at_offset(tbuffer, &iter, 0); |
3a51ecc8383a
Implemented dw_mle_set_visible() for GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
353
diff
changeset
|
4273 gtk_text_iter_set_line(&iter, line); |
3a51ecc8383a
Implemented dw_mle_set_visible() for GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
353
diff
changeset
|
4274 if(!mark) |
3a51ecc8383a
Implemented dw_mle_set_visible() for GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
353
diff
changeset
|
4275 { |
3a51ecc8383a
Implemented dw_mle_set_visible() for GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
353
diff
changeset
|
4276 mark = gtk_text_buffer_create_mark(tbuffer, NULL, &iter, FALSE); |
3a51ecc8383a
Implemented dw_mle_set_visible() for GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
353
diff
changeset
|
4277 gtk_object_set_data(GTK_OBJECT(handle), "_dw_mark", (gpointer)mark); |
3a51ecc8383a
Implemented dw_mle_set_visible() for GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
353
diff
changeset
|
4278 } |
3a51ecc8383a
Implemented dw_mle_set_visible() for GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
353
diff
changeset
|
4279 else |
3a51ecc8383a
Implemented dw_mle_set_visible() for GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
353
diff
changeset
|
4280 gtk_text_buffer_move_mark(tbuffer, mark, &iter); |
3a51ecc8383a
Implemented dw_mle_set_visible() for GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
353
diff
changeset
|
4281 gtk_text_view_scroll_to_mark(GTK_TEXT_VIEW(tmp), mark, |
3a51ecc8383a
Implemented dw_mle_set_visible() for GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
353
diff
changeset
|
4282 0, FALSE, 0, 0); |
3a51ecc8383a
Implemented dw_mle_set_visible() for GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
353
diff
changeset
|
4283 } |
3a51ecc8383a
Implemented dw_mle_set_visible() for GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
353
diff
changeset
|
4284 } |
120
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
4285 #else |
3 | 4286 if(GTK_IS_BOX(handle)) |
4287 { | |
147
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
4288 GtkWidget *tmp = (GtkWidget *)gtk_object_get_user_data(GTK_OBJECT(handle)); |
3 | 4289 |
4290 if(tmp && GTK_IS_TEXT(tmp)) | |
4291 { | |
4292 unsigned long lines; | |
4293 float pos, ratio; | |
4294 | |
510
710f82598210
Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
508
diff
changeset
|
4295 dw_mle_get_size(handle, NULL, &lines); |
3 | 4296 |
4297 if(lines) | |
4298 { | |
4299 ratio = (float)line/(float)lines; | |
4300 | |
4301 pos = (ratio * (float)(GTK_TEXT(tmp)->vadj->upper - GTK_TEXT(tmp)->vadj->lower)) + GTK_TEXT(tmp)->vadj->lower; | |
4302 | |
4303 gtk_adjustment_set_value(GTK_TEXT(tmp)->vadj, pos); | |
4304 } | |
4305 } | |
4306 } | |
120
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
4307 #endif |
3 | 4308 DW_MUTEX_UNLOCK; |
4309 } | |
4310 | |
4311 /* | |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4312 * Sets the editablity of an MLE box. |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4313 * Parameters: |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4314 * handle: Handle to the MLE. |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4315 * state: TRUE if it can be edited, FALSE for readonly. |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4316 */ |
513
7755599311d4
Fixes search and replace errors.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
511
diff
changeset
|
4317 void dw_mle_set_editable(HWND handle, int state) |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4318 { |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4319 int _locked_by_me = FALSE; |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4320 |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4321 DW_MUTEX_LOCK; |
120
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
4322 #if GTK_MAJOR_VERSION > 1 |
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
4323 if(GTK_IS_SCROLLED_WINDOW(handle)) |
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
4324 { |
147
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
4325 GtkWidget *tmp = (GtkWidget *)gtk_object_get_user_data(GTK_OBJECT(handle)); |
120
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
4326 |
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
4327 if(tmp && GTK_IS_TEXT_VIEW(tmp)) |
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
4328 gtk_text_view_set_editable(GTK_TEXT_VIEW(tmp), state); |
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
4329 } |
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
4330 #else |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4331 if(GTK_IS_BOX(handle)) |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4332 { |
147
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
4333 GtkWidget *tmp = (GtkWidget *)gtk_object_get_user_data(GTK_OBJECT(handle)); |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4334 |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4335 if(tmp && GTK_IS_TEXT(tmp)) |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4336 gtk_text_set_editable(GTK_TEXT(tmp), state); |
120
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
4337 } |
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
4338 #endif |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4339 DW_MUTEX_UNLOCK; |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4340 } |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4341 |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4342 /* |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4343 * Sets the word wrap state of an MLE box. |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4344 * Parameters: |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4345 * handle: Handle to the MLE. |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4346 * state: TRUE if it wraps, FALSE if it doesn't. |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4347 */ |
513
7755599311d4
Fixes search and replace errors.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
511
diff
changeset
|
4348 void dw_mle_set_word_wrap(HWND handle, int state) |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4349 { |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4350 int _locked_by_me = FALSE; |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4351 |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4352 DW_MUTEX_LOCK; |
120
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
4353 #if GTK_MAJOR_VERSION > 1 |
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
4354 if(GTK_IS_SCROLLED_WINDOW(handle)) |
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
4355 { |
147
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
4356 GtkWidget *tmp = (GtkWidget *)gtk_object_get_user_data(GTK_OBJECT(handle)); |
120
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
4357 |
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
4358 if(tmp && GTK_IS_TEXT_VIEW(tmp)) |
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
4359 gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(tmp), GTK_WRAP_WORD); |
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
4360 } |
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
4361 #else |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4362 if(GTK_IS_BOX(handle)) |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4363 { |
147
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
4364 GtkWidget *tmp = (GtkWidget *)gtk_object_get_user_data(GTK_OBJECT(handle)); |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4365 |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4366 if(tmp && GTK_IS_TEXT(tmp)) |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4367 { |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4368 gtk_text_set_word_wrap(GTK_TEXT(tmp), state); |
36
cddb02f847e1
Added unix versions of functions in compat, and added getfsname, plus
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
4369 gtk_text_set_line_wrap(GTK_TEXT(tmp), state); |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4370 } |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4371 } |
120
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
4372 #endif |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4373 DW_MUTEX_UNLOCK; |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4374 } |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4375 |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4376 /* |
3 | 4377 * Sets the current cursor position of an MLE box. |
4378 * Parameters: | |
4379 * handle: Handle to the MLE to be positioned. | |
4380 * point: Point to position cursor. | |
4381 */ | |
510
710f82598210
Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
508
diff
changeset
|
4382 void dw_mle_set_cursor(HWND handle, int point) |
3 | 4383 { |
4384 int _locked_by_me = FALSE; | |
4385 | |
4386 DW_MUTEX_LOCK; | |
120
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
4387 #if GTK_MAJOR_VERSION > 1 |
130
54014258099a
Added most of the missing code for the MLE's for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
122
diff
changeset
|
4388 if(GTK_IS_SCROLLED_WINDOW(handle)) |
120
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
4389 #else |
3 | 4390 if(GTK_IS_BOX(handle)) |
130
54014258099a
Added most of the missing code for the MLE's for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
122
diff
changeset
|
4391 #endif |
3 | 4392 { |
147
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
4393 GtkWidget *tmp = (GtkWidget *)gtk_object_get_user_data(GTK_OBJECT(handle)); |
3 | 4394 |
130
54014258099a
Added most of the missing code for the MLE's for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
122
diff
changeset
|
4395 #if GTK_MAJOR_VERSION > 1 |
54014258099a
Added most of the missing code for the MLE's for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
122
diff
changeset
|
4396 if(tmp && GTK_IS_TEXT_VIEW(tmp)) |
54014258099a
Added most of the missing code for the MLE's for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
122
diff
changeset
|
4397 { |
54014258099a
Added most of the missing code for the MLE's for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
122
diff
changeset
|
4398 GtkTextBuffer *tbuffer; |
54014258099a
Added most of the missing code for the MLE's for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
122
diff
changeset
|
4399 GtkTextIter iter; |
353
08e56a0f9541
dw_mle_set() now moves the viewport to the cursor location.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
352
diff
changeset
|
4400 GtkTextMark *mark = (GtkTextMark *)gtk_object_get_data(GTK_OBJECT(handle), "_dw_mark"); |
130
54014258099a
Added most of the missing code for the MLE's for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
122
diff
changeset
|
4401 |
54014258099a
Added most of the missing code for the MLE's for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
122
diff
changeset
|
4402 tbuffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (tmp)); |
54014258099a
Added most of the missing code for the MLE's for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
122
diff
changeset
|
4403 gtk_text_buffer_get_iter_at_offset(tbuffer, &iter, point); |
353
08e56a0f9541
dw_mle_set() now moves the viewport to the cursor location.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
352
diff
changeset
|
4404 if(!mark) |
08e56a0f9541
dw_mle_set() now moves the viewport to the cursor location.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
352
diff
changeset
|
4405 { |
08e56a0f9541
dw_mle_set() now moves the viewport to the cursor location.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
352
diff
changeset
|
4406 mark = gtk_text_buffer_create_mark(tbuffer, NULL, &iter, FALSE); |
08e56a0f9541
dw_mle_set() now moves the viewport to the cursor location.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
352
diff
changeset
|
4407 gtk_object_set_data(GTK_OBJECT(handle), "_dw_mark", (gpointer)mark); |
08e56a0f9541
dw_mle_set() now moves the viewport to the cursor location.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
352
diff
changeset
|
4408 } |
08e56a0f9541
dw_mle_set() now moves the viewport to the cursor location.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
352
diff
changeset
|
4409 else |
08e56a0f9541
dw_mle_set() now moves the viewport to the cursor location.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
352
diff
changeset
|
4410 gtk_text_buffer_move_mark(tbuffer, mark, &iter); |
130
54014258099a
Added most of the missing code for the MLE's for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
122
diff
changeset
|
4411 gtk_text_buffer_place_cursor(tbuffer, &iter); |
353
08e56a0f9541
dw_mle_set() now moves the viewport to the cursor location.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
352
diff
changeset
|
4412 gtk_text_view_scroll_to_mark(GTK_TEXT_VIEW(tmp), mark, |
08e56a0f9541
dw_mle_set() now moves the viewport to the cursor location.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
352
diff
changeset
|
4413 0, FALSE, 0, 0); |
130
54014258099a
Added most of the missing code for the MLE's for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
122
diff
changeset
|
4414 } |
54014258099a
Added most of the missing code for the MLE's for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
122
diff
changeset
|
4415 #else |
3 | 4416 if(tmp && GTK_IS_TEXT(tmp)) |
4417 { | |
40
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
4418 unsigned long chars; |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
4419 float pos, ratio; |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
4420 |
510
710f82598210
Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
508
diff
changeset
|
4421 dw_mle_get_size(handle, &chars, NULL); |
40
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
4422 |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
4423 if(chars) |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
4424 { |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
4425 ratio = (float)point/(float)chars; |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
4426 |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
4427 pos = (ratio * (float)(GTK_TEXT(tmp)->vadj->upper - GTK_TEXT(tmp)->vadj->lower)) + GTK_TEXT(tmp)->vadj->lower; |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
4428 |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
4429 gtk_adjustment_set_value(GTK_TEXT(tmp)->vadj, pos); |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
4430 } |
3 | 4431 gtk_text_set_point(GTK_TEXT(tmp), point); |
4432 } | |
120
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
4433 #endif |
130
54014258099a
Added most of the missing code for the MLE's for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
122
diff
changeset
|
4434 } |
3 | 4435 DW_MUTEX_UNLOCK; |
4436 } | |
4437 | |
4438 /* | |
4439 * Finds text in an MLE box. | |
4440 * Parameters: | |
4441 * handle: Handle to the MLE to be cleared. | |
4442 * text: Text to search for. | |
4443 * point: Start point of search. | |
4444 * flags: Search specific flags. | |
4445 */ | |
4446 int dw_mle_search(HWND handle, char *text, int point, unsigned long flags) | |
4447 { | |
4448 int _locked_by_me = FALSE, retval = 0; | |
4449 | |
4450 DW_MUTEX_LOCK; | |
120
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
4451 #if GTK_MAJOR_VERSION > 1 |
130
54014258099a
Added most of the missing code for the MLE's for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
122
diff
changeset
|
4452 if(GTK_IS_SCROLLED_WINDOW(handle)) |
120
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
4453 #else |
3 | 4454 if(GTK_IS_BOX(handle)) |
130
54014258099a
Added most of the missing code for the MLE's for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
122
diff
changeset
|
4455 #endif |
3 | 4456 { |
147
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
4457 GtkWidget *tmp = (GtkWidget *)gtk_object_get_user_data(GTK_OBJECT(handle)); |
3 | 4458 |
130
54014258099a
Added most of the missing code for the MLE's for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
122
diff
changeset
|
4459 #if GTK_MAJOR_VERSION > 1 |
54014258099a
Added most of the missing code for the MLE's for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
122
diff
changeset
|
4460 if(tmp && GTK_IS_TEXT_VIEW(tmp)) |
54014258099a
Added most of the missing code for the MLE's for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
122
diff
changeset
|
4461 { |
54014258099a
Added most of the missing code for the MLE's for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
122
diff
changeset
|
4462 GtkTextBuffer *tbuffer; |
54014258099a
Added most of the missing code for the MLE's for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
122
diff
changeset
|
4463 GtkTextIter iter, found; |
54014258099a
Added most of the missing code for the MLE's for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
122
diff
changeset
|
4464 |
54014258099a
Added most of the missing code for the MLE's for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
122
diff
changeset
|
4465 tbuffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (tmp)); |
54014258099a
Added most of the missing code for the MLE's for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
122
diff
changeset
|
4466 gtk_text_buffer_get_iter_at_offset(tbuffer, &iter, point); |
54014258099a
Added most of the missing code for the MLE's for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
122
diff
changeset
|
4467 gtk_text_iter_forward_search(&iter, text, GTK_TEXT_SEARCH_TEXT_ONLY, &found, NULL, NULL); |
54014258099a
Added most of the missing code for the MLE's for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
122
diff
changeset
|
4468 retval = gtk_text_iter_get_offset(&found); |
54014258099a
Added most of the missing code for the MLE's for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
122
diff
changeset
|
4469 } |
54014258099a
Added most of the missing code for the MLE's for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
122
diff
changeset
|
4470 #else |
3 | 4471 if(tmp && GTK_IS_TEXT(tmp)) |
4472 { | |
4473 int len = gtk_text_get_length(GTK_TEXT(tmp)); | |
4474 gchar *tmpbuf; | |
4475 | |
4476 tmpbuf = gtk_editable_get_chars(GTK_EDITABLE(&(GTK_TEXT(tmp)->editable)), 0, len); | |
4477 if(tmpbuf) | |
4478 { | |
4479 int z, textlen; | |
4480 | |
4481 textlen = strlen(text); | |
4482 | |
4483 if(flags & DW_MLE_CASESENSITIVE) | |
4484 { | |
4485 for(z=point;z<(len-textlen) && !retval;z++) | |
4486 { | |
4487 if(strncmp(&tmpbuf[z], text, textlen) == 0) | |
4488 retval = z + textlen; | |
4489 } | |
4490 } | |
4491 else | |
4492 { | |
4493 for(z=point;z<(len-textlen) && !retval;z++) | |
4494 { | |
4495 if(strncasecmp(&tmpbuf[z], text, textlen) == 0) | |
4496 retval = z + textlen; | |
4497 } | |
4498 } | |
4499 | |
4500 if(retval) | |
4501 { | |
4502 gtk_text_set_point(GTK_TEXT(tmp), retval - textlen); | |
4503 gtk_editable_select_region(&(GTK_TEXT(tmp)->editable), retval - textlen, retval); | |
4504 } | |
4505 | |
4506 g_free(tmpbuf); | |
4507 } | |
4508 } | |
120
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
4509 #endif |
130
54014258099a
Added most of the missing code for the MLE's for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
122
diff
changeset
|
4510 } |
3 | 4511 DW_MUTEX_UNLOCK; |
4512 return retval; | |
4513 } | |
4514 | |
4515 /* | |
4516 * Stops redrawing of an MLE box. | |
4517 * Parameters: | |
4518 * handle: Handle to the MLE to freeze. | |
4519 */ | |
4520 void dw_mle_freeze(HWND handle) | |
4521 { | |
130
54014258099a
Added most of the missing code for the MLE's for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
122
diff
changeset
|
4522 #if GTK_MAJOR_VERSION < 2 |
3 | 4523 int _locked_by_me = FALSE; |
4524 | |
4525 DW_MUTEX_LOCK; | |
4526 if(GTK_IS_BOX(handle)) | |
4527 { | |
147
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
4528 GtkWidget *tmp = (GtkWidget *)gtk_object_get_user_data(GTK_OBJECT(handle)); |
3 | 4529 |
4530 if(tmp && GTK_IS_TEXT(tmp)) | |
4531 { | |
4532 gtk_text_freeze(GTK_TEXT(tmp)); | |
4533 } | |
4534 } | |
130
54014258099a
Added most of the missing code for the MLE's for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
122
diff
changeset
|
4535 DW_MUTEX_UNLOCK; |
120
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
4536 #endif |
3 | 4537 } |
4538 | |
4539 /* | |
4540 * Resumes redrawing of an MLE box. | |
4541 * Parameters: | |
4542 * handle: Handle to the MLE to thaw. | |
4543 */ | |
4544 void dw_mle_thaw(HWND handle) | |
4545 { | |
130
54014258099a
Added most of the missing code for the MLE's for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
122
diff
changeset
|
4546 #if GTK_MAJOR_VERSION < 2 |
3 | 4547 int _locked_by_me = FALSE; |
4548 | |
4549 DW_MUTEX_LOCK; | |
4550 if(GTK_IS_BOX(handle)) | |
4551 { | |
147
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
4552 GtkWidget *tmp = (GtkWidget *)gtk_object_get_user_data(GTK_OBJECT(handle)); |
3 | 4553 |
4554 if(tmp && GTK_IS_TEXT(tmp)) | |
4555 { | |
4556 gtk_text_thaw(GTK_TEXT(tmp)); | |
4557 } | |
4558 } | |
130
54014258099a
Added most of the missing code for the MLE's for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
122
diff
changeset
|
4559 DW_MUTEX_UNLOCK; |
120
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
4560 #endif |
3 | 4561 } |
4562 | |
4563 /* | |
33
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
30
diff
changeset
|
4564 * Returns the range of the percent bar. |
3 | 4565 * Parameters: |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
4566 * handle: Handle to the percent bar to be queried. |
3 | 4567 */ |
510
710f82598210
Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
508
diff
changeset
|
4568 unsigned int dw_percent_get_range(HWND handle) |
3 | 4569 { |
4570 return 100; | |
4571 } | |
4572 | |
4573 /* | |
33
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
30
diff
changeset
|
4574 * Sets the percent bar position. |
3 | 4575 * Parameters: |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
4576 * handle: Handle to the percent bar to be set. |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
4577 * position: Position of the percent bar withing the range. |
3 | 4578 */ |
33
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
30
diff
changeset
|
4579 void dw_percent_set_pos(HWND handle, unsigned int position) |
3 | 4580 { |
4581 int _locked_by_me = FALSE; | |
4582 | |
4583 DW_MUTEX_LOCK; | |
4584 gtk_progress_bar_update(GTK_PROGRESS_BAR(handle), (gfloat)position/100); | |
4585 DW_MUTEX_UNLOCK; | |
4586 } | |
4587 | |
4588 /* | |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
4589 * Returns the position of the slider. |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
4590 * Parameters: |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
4591 * handle: Handle to the slider to be queried. |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
4592 */ |
510
710f82598210
Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
508
diff
changeset
|
4593 unsigned int dw_slider_get_pos(HWND handle) |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
4594 { |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
4595 int val = 0, _locked_by_me = FALSE; |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
4596 GtkAdjustment *adjustment; |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
4597 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
4598 if(!handle) |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
4599 return 0; |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
4600 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
4601 DW_MUTEX_LOCK; |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
4602 adjustment = (GtkAdjustment *)gtk_object_get_data(GTK_OBJECT(handle), "_dw_adjustment"); |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
4603 if(adjustment) |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
4604 { |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
4605 int max = _round_value(adjustment->upper) - 1; |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
4606 int thisval = _round_value(adjustment->value); |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
4607 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
4608 if(GTK_IS_VSCALE(handle)) |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
4609 val = max - thisval; |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
4610 else |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
4611 val = thisval; |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
4612 } |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
4613 DW_MUTEX_UNLOCK; |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
4614 return val; |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
4615 } |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
4616 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
4617 /* |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
4618 * Sets the slider position. |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
4619 * Parameters: |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
4620 * handle: Handle to the slider to be set. |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
4621 * position: Position of the slider withing the range. |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
4622 */ |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
4623 void dw_slider_set_pos(HWND handle, unsigned int position) |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
4624 { |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
4625 int _locked_by_me = FALSE; |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
4626 GtkAdjustment *adjustment; |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
4627 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
4628 if(!handle) |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
4629 return; |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
4630 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
4631 DW_MUTEX_LOCK; |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
4632 adjustment = (GtkAdjustment *)gtk_object_get_data(GTK_OBJECT(handle), "_dw_adjustment"); |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
4633 if(adjustment) |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
4634 { |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
4635 int max = _round_value(adjustment->upper) - 1; |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
4636 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
4637 if(GTK_IS_VSCALE(handle)) |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
4638 gtk_adjustment_set_value(adjustment, (gfloat)(max - position)); |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
4639 else |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
4640 gtk_adjustment_set_value(adjustment, (gfloat)position); |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
4641 } |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
4642 DW_MUTEX_UNLOCK; |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
4643 } |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
4644 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
4645 /* |
195
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
4646 * Returns the position of the scrollbar. |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
4647 * Parameters: |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
4648 * handle: Handle to the scrollbar to be queried. |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
4649 */ |
510
710f82598210
Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
508
diff
changeset
|
4650 unsigned int dw_scrollbar_get_pos(HWND handle) |
195
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
4651 { |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
4652 int val = 0, _locked_by_me = FALSE; |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
4653 GtkAdjustment *adjustment; |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
4654 |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
4655 if(!handle) |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
4656 return 0; |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
4657 |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
4658 DW_MUTEX_LOCK; |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
4659 adjustment = (GtkAdjustment *)gtk_object_get_data(GTK_OBJECT(handle), "_dw_adjustment"); |
195
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
4660 if(adjustment) |
415
9ffdbfd83652
Don't distinguish between vertical and horizontal scrollbars in
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
410
diff
changeset
|
4661 val = _round_value(adjustment->value); |
195
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
4662 DW_MUTEX_UNLOCK; |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
4663 return val; |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
4664 } |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
4665 |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
4666 /* |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
4667 * Sets the scrollbar position. |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
4668 * Parameters: |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
4669 * handle: Handle to the scrollbar to be set. |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
4670 * position: Position of the scrollbar withing the range. |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
4671 */ |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
4672 void dw_scrollbar_set_pos(HWND handle, unsigned int position) |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
4673 { |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
4674 int _locked_by_me = FALSE; |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
4675 GtkAdjustment *adjustment; |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
4676 |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
4677 if(!handle) |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
4678 return; |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
4679 |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
4680 DW_MUTEX_LOCK; |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
4681 adjustment = (GtkAdjustment *)gtk_object_get_data(GTK_OBJECT(handle), "_dw_adjustment"); |
195
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
4682 if(adjustment) |
215
03e68274623d
Two scrollbar fixes for GTK... one from Mark Hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
214
diff
changeset
|
4683 gtk_adjustment_set_value(adjustment, (gfloat)position); |
195
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
4684 DW_MUTEX_UNLOCK; |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
4685 } |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
4686 |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
4687 /* |
198
11b5da6196c2
Implemented dw_scrollbar_set_range() on Unix and fixed a bug in the test
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
196
diff
changeset
|
4688 * Sets the scrollbar range. |
11b5da6196c2
Implemented dw_scrollbar_set_range() on Unix and fixed a bug in the test
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
196
diff
changeset
|
4689 * Parameters: |
11b5da6196c2
Implemented dw_scrollbar_set_range() on Unix and fixed a bug in the test
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
196
diff
changeset
|
4690 * handle: Handle to the scrollbar to be set. |
11b5da6196c2
Implemented dw_scrollbar_set_range() on Unix and fixed a bug in the test
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
196
diff
changeset
|
4691 * range: Maximum range value. |
205
b9283fd56d69
Updated scrollbar code on Unix and added dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
202
diff
changeset
|
4692 * visible: Visible area relative to the range. |
b9283fd56d69
Updated scrollbar code on Unix and added dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
202
diff
changeset
|
4693 */ |
b9283fd56d69
Updated scrollbar code on Unix and added dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
202
diff
changeset
|
4694 void API dw_scrollbar_set_range(HWND handle, unsigned int range, unsigned int visible) |
198
11b5da6196c2
Implemented dw_scrollbar_set_range() on Unix and fixed a bug in the test
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
196
diff
changeset
|
4695 { |
11b5da6196c2
Implemented dw_scrollbar_set_range() on Unix and fixed a bug in the test
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
196
diff
changeset
|
4696 int _locked_by_me = FALSE; |
11b5da6196c2
Implemented dw_scrollbar_set_range() on Unix and fixed a bug in the test
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
196
diff
changeset
|
4697 GtkAdjustment *adjustment; |
11b5da6196c2
Implemented dw_scrollbar_set_range() on Unix and fixed a bug in the test
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
196
diff
changeset
|
4698 |
11b5da6196c2
Implemented dw_scrollbar_set_range() on Unix and fixed a bug in the test
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
196
diff
changeset
|
4699 if(!handle) |
11b5da6196c2
Implemented dw_scrollbar_set_range() on Unix and fixed a bug in the test
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
196
diff
changeset
|
4700 return; |
11b5da6196c2
Implemented dw_scrollbar_set_range() on Unix and fixed a bug in the test
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
196
diff
changeset
|
4701 |
11b5da6196c2
Implemented dw_scrollbar_set_range() on Unix and fixed a bug in the test
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
196
diff
changeset
|
4702 DW_MUTEX_LOCK; |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
4703 adjustment = (GtkAdjustment *)gtk_object_get_data(GTK_OBJECT(handle), "_dw_adjustment"); |
198
11b5da6196c2
Implemented dw_scrollbar_set_range() on Unix and fixed a bug in the test
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
196
diff
changeset
|
4704 if(adjustment) |
205
b9283fd56d69
Updated scrollbar code on Unix and added dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
202
diff
changeset
|
4705 { |
b9283fd56d69
Updated scrollbar code on Unix and added dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
202
diff
changeset
|
4706 adjustment->upper = (gdouble)range; |
216 | 4707 adjustment->page_increment = adjustment->page_size = (gdouble)visible; |
205
b9283fd56d69
Updated scrollbar code on Unix and added dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
202
diff
changeset
|
4708 } |
198
11b5da6196c2
Implemented dw_scrollbar_set_range() on Unix and fixed a bug in the test
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
196
diff
changeset
|
4709 DW_MUTEX_UNLOCK; |
11b5da6196c2
Implemented dw_scrollbar_set_range() on Unix and fixed a bug in the test
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
196
diff
changeset
|
4710 } |
11b5da6196c2
Implemented dw_scrollbar_set_range() on Unix and fixed a bug in the test
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
196
diff
changeset
|
4711 |
11b5da6196c2
Implemented dw_scrollbar_set_range() on Unix and fixed a bug in the test
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
196
diff
changeset
|
4712 /* |
3 | 4713 * Sets the spinbutton value. |
4714 * Parameters: | |
4715 * handle: Handle to the spinbutton to be set. | |
4716 * position: Current value of the spinbutton. | |
4717 */ | |
4718 void dw_spinbutton_set_pos(HWND handle, long position) | |
4719 { | |
4720 int _locked_by_me = FALSE; | |
4721 | |
4722 DW_MUTEX_LOCK; | |
4723 gtk_spin_button_set_value(GTK_SPIN_BUTTON(handle), (gfloat)position); | |
4724 DW_MUTEX_UNLOCK; | |
4725 } | |
4726 | |
4727 /* | |
4728 * Sets the spinbutton limits. | |
4729 * Parameters: | |
4730 * handle: Handle to the spinbutton to be set. | |
4731 * position: Current value of the spinbutton. | |
4732 * position: Current value of the spinbutton. | |
4733 */ | |
4734 void dw_spinbutton_set_limits(HWND handle, long upper, long lower) | |
4735 { | |
4736 long curval; | |
4737 GtkAdjustment *adj; | |
4738 int _locked_by_me = FALSE; | |
4739 | |
510
710f82598210
Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
508
diff
changeset
|
4740 curval = dw_spinbutton_get_pos(handle); |
3 | 4741 DW_MUTEX_LOCK; |
4742 adj = (GtkAdjustment *)gtk_adjustment_new((gfloat)curval, (gfloat)lower, (gfloat)upper, 1.0, 5.0, 0.0); | |
447
5a0779561d0f
Add more tests for dw_pac*() functions. Throw up a messagebox if you try and
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
442
diff
changeset
|
4743 gtk_spin_button_set_adjustment(GTK_SPIN_BUTTON(handle), adj); |
3 | 4744 DW_MUTEX_UNLOCK; |
4745 } | |
4746 | |
4747 /* | |
4748 * Sets the entryfield character limit. | |
4749 * Parameters: | |
4750 * handle: Handle to the spinbutton to be set. | |
4751 * limit: Number of characters the entryfield will take. | |
4752 */ | |
4753 void dw_entryfield_set_limit(HWND handle, ULONG limit) | |
4754 { | |
270
d2a80e648d33
Implemented dw_entryfield_set_limit() on GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
269
diff
changeset
|
4755 int _locked_by_me = FALSE; |
d2a80e648d33
Implemented dw_entryfield_set_limit() on GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
269
diff
changeset
|
4756 |
d2a80e648d33
Implemented dw_entryfield_set_limit() on GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
269
diff
changeset
|
4757 DW_MUTEX_LOCK; |
271
38d8908c4438
Corrected incorrect typecast.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
270
diff
changeset
|
4758 gtk_entry_set_max_length(GTK_ENTRY(handle), limit); |
270
d2a80e648d33
Implemented dw_entryfield_set_limit() on GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
269
diff
changeset
|
4759 DW_MUTEX_UNLOCK; |
3 | 4760 } |
4761 | |
4762 /* | |
4763 * Returns the current value of the spinbutton. | |
4764 * Parameters: | |
4765 * handle: Handle to the spinbutton to be queried. | |
4766 */ | |
510
710f82598210
Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
508
diff
changeset
|
4767 long dw_spinbutton_get_pos(HWND handle) |
3 | 4768 { |
4769 long retval; | |
4770 int _locked_by_me = FALSE; | |
4771 | |
4772 DW_MUTEX_LOCK; | |
4773 retval = (long)gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(handle)); | |
4774 DW_MUTEX_UNLOCK; | |
4775 | |
4776 return retval; | |
4777 } | |
4778 | |
4779 /* | |
4780 * Returns the state of the checkbox. | |
4781 * Parameters: | |
4782 * handle: Handle to the checkbox to be queried. | |
4783 */ | |
510
710f82598210
Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
508
diff
changeset
|
4784 int dw_checkbox_get(HWND handle) |
3 | 4785 { |
4786 int retval; | |
4787 int _locked_by_me = FALSE; | |
4788 | |
4789 DW_MUTEX_LOCK; | |
4790 retval = GTK_TOGGLE_BUTTON(handle)->active; | |
4791 DW_MUTEX_UNLOCK; | |
4792 | |
4793 return retval; | |
4794 } | |
4795 | |
4796 /* | |
4797 * Sets the state of the checkbox. | |
4798 * Parameters: | |
4799 * handle: Handle to the checkbox to be queried. | |
4800 * value: TRUE for checked, FALSE for unchecked. | |
4801 */ | |
4802 void dw_checkbox_set(HWND handle, int value) | |
4803 { | |
4804 int _locked_by_me = FALSE; | |
4805 | |
4806 DW_MUTEX_LOCK; | |
4807 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(handle), value); | |
4808 DW_MUTEX_UNLOCK; | |
4809 } | |
4810 | |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
4811 /* |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4812 * Inserts an item into a tree window (widget) after another item. |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4813 * Parameters: |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4814 * handle: Handle to the tree to be inserted. |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4815 * item: Handle to the item to be positioned after. |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4816 * title: The text title of the entry. |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4817 * icon: Handle to coresponding icon. |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4818 * parent: Parent handle or 0 if root. |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4819 * itemdata: Item specific data. |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4820 */ |
329
9b1953ed0bff
Oops missed one parameter change.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
328
diff
changeset
|
4821 HTREEITEM dw_tree_insert_after(HWND handle, HTREEITEM item, char *title, unsigned long icon, HTREEITEM parent, void *itemdata) |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4822 { |
138
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
4823 #if GTK_MAJOR_VERSION > 1 |
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
4824 GtkWidget *tree; |
140
e0e73b4372a6
GTK 2.0 tree control is now fully functional. I just need to check for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
139
diff
changeset
|
4825 GtkTreeIter *iter; |
138
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
4826 GtkTreeStore *store; |
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
4827 GdkPixbuf *pixbuf; |
328
e00aff2b899e
Tree item handles are now of the type HTREEITEM instead of HWND since they
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
322
diff
changeset
|
4828 HTREEITEM retval = 0; |
138
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
4829 int _locked_by_me = FALSE; |
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
4830 |
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
4831 if(!handle) |
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
4832 return NULL; |
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
4833 |
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
4834 DW_MUTEX_LOCK; |
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
4835 if((tree = (GtkWidget *)gtk_object_get_user_data(GTK_OBJECT(handle))) |
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
4836 && GTK_IS_TREE_VIEW(tree) && |
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
4837 (store = (GtkTreeStore *)gtk_object_get_data(GTK_OBJECT(tree), "_dw_tree_store"))) |
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
4838 { |
140
e0e73b4372a6
GTK 2.0 tree control is now fully functional. I just need to check for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
139
diff
changeset
|
4839 iter = (GtkTreeIter *)malloc(sizeof(GtkTreeIter)); |
e0e73b4372a6
GTK 2.0 tree control is now fully functional. I just need to check for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
139
diff
changeset
|
4840 |
138
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
4841 pixbuf = _find_pixbuf(icon); |
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
4842 |
140
e0e73b4372a6
GTK 2.0 tree control is now fully functional. I just need to check for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
139
diff
changeset
|
4843 gtk_tree_store_insert_after(store, iter, (GtkTreeIter *)parent, (GtkTreeIter *)item); |
484
f18c70cb3e38
Fixes for GTK 2.x, and correctly check for the directory bit. NOTE:
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
483
diff
changeset
|
4844 gtk_tree_store_set (store, iter, 0, title, 1, pixbuf, 2, itemdata, 3, iter, -1); |
460
65bc397a7233
Don't unreference private pixbufs on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
450
diff
changeset
|
4845 if(pixbuf && !(icon & (1 << 31))) |
256
63d68387d924
Don't unref a non-existant pixmap. (GTK 2.x)
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
255
diff
changeset
|
4846 g_object_unref(pixbuf); |
328
e00aff2b899e
Tree item handles are now of the type HTREEITEM instead of HWND since they
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
322
diff
changeset
|
4847 retval = (HTREEITEM)iter; |
138
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
4848 } |
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
4849 DW_MUTEX_UNLOCK; |
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
4850 |
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
4851 return retval; |
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
4852 #else |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4853 GtkWidget *newitem, *tree, *subtree, *label, *hbox, *pixmap; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4854 GdkPixmap *gdkpix; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4855 GdkBitmap *gdkbmp = NULL; |
107
cd0e5cf92f6a
Rewrote the Windows packing code so it is more like OS/2 to improve window
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
96
diff
changeset
|
4856 int position = -1; |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4857 int _locked_by_me = FALSE; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4858 |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4859 if(!handle) |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4860 return NULL; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4861 |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4862 DW_MUTEX_LOCK; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4863 tree = (GtkWidget *)gtk_object_get_user_data(GTK_OBJECT(handle)); |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4864 if(!tree || !GTK_IS_TREE(tree)) |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4865 { |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4866 DW_MUTEX_UNLOCK; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4867 return NULL; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4868 } |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4869 |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4870 if(item && GTK_IS_TREE_ITEM(item)) |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4871 position = gtk_tree_child_position(GTK_TREE(tree), item); |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4872 |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4873 position++; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4874 |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4875 newitem = gtk_tree_item_new(); |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4876 label = gtk_label_new(title); |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
4877 gtk_object_set_data(GTK_OBJECT(newitem), "_dw_text", (gpointer)strdup(title)); |
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
4878 gtk_object_set_data(GTK_OBJECT(newitem), "_dw_itemdata", (gpointer)itemdata); |
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
4879 gtk_object_set_data(GTK_OBJECT(newitem), "_dw_tree", (gpointer)tree); |
478
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
472
diff
changeset
|
4880 gtk_object_set_data(GTK_OBJECT(newitem), "_dw_parent", (gpointer)parent); |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4881 hbox = gtk_hbox_new(FALSE, 2); |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
4882 gtk_object_set_data(GTK_OBJECT(newitem), "_dw_hbox", (gpointer)hbox); |
121
d8af32b1b1cd
Switch back to using pixmaps and bitmaps, only use pixbufs for doing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
120
diff
changeset
|
4883 gdkpix = _find_pixmap(&gdkbmp, icon, hbox, NULL, NULL); |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4884 gtk_container_add(GTK_CONTAINER(newitem), hbox); |
255
a167001c56df
Check that _find_pixmap() returns a pixmap handle before packing the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
249
diff
changeset
|
4885 if(gdkpix) |
a167001c56df
Check that _find_pixmap() returns a pixmap handle before packing the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
249
diff
changeset
|
4886 { |
a167001c56df
Check that _find_pixmap() returns a pixmap handle before packing the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
249
diff
changeset
|
4887 pixmap = gtk_pixmap_new(gdkpix, gdkbmp); |
a167001c56df
Check that _find_pixmap() returns a pixmap handle before packing the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
249
diff
changeset
|
4888 gtk_box_pack_start(GTK_BOX(hbox), pixmap, FALSE, TRUE, 0); |
a167001c56df
Check that _find_pixmap() returns a pixmap handle before packing the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
249
diff
changeset
|
4889 gtk_widget_show(pixmap); |
a167001c56df
Check that _find_pixmap() returns a pixmap handle before packing the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
249
diff
changeset
|
4890 } |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4891 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, TRUE, 0); |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4892 gtk_widget_show(label); |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4893 gtk_widget_show(hbox); |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4894 |
483
1cb1b87bbd30
Fixes for the Unix file browser... seems to have revealed a problem in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
482
diff
changeset
|
4895 { |
510
710f82598210
Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
508
diff
changeset
|
4896 void *thisfunc = (void *)gtk_object_get_data(GTK_OBJECT(tree), "_dw_tree_item_expand_func"); |
710f82598210
Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
508
diff
changeset
|
4897 void *mydata = (void *)gtk_object_get_data(GTK_OBJECT(tree), "_dw_tree_item_expand_data"); |
483
1cb1b87bbd30
Fixes for the Unix file browser... seems to have revealed a problem in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
482
diff
changeset
|
4898 SignalHandler work = _get_signal_handler(tree, mydata); |
1cb1b87bbd30
Fixes for the Unix file browser... seems to have revealed a problem in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
482
diff
changeset
|
4899 |
1cb1b87bbd30
Fixes for the Unix file browser... seems to have revealed a problem in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
482
diff
changeset
|
4900 if(thisfunc && work.window) |
1cb1b87bbd30
Fixes for the Unix file browser... seems to have revealed a problem in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
482
diff
changeset
|
4901 { |
1cb1b87bbd30
Fixes for the Unix file browser... seems to have revealed a problem in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
482
diff
changeset
|
4902 int sigid = _set_signal_handler(newitem, work.window, work.func, work.data, thisfunc); |
1cb1b87bbd30
Fixes for the Unix file browser... seems to have revealed a problem in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
482
diff
changeset
|
4903 gint cid =gtk_signal_connect(GTK_OBJECT(newitem), "expand", GTK_SIGNAL_FUNC(thisfunc),(gpointer)sigid); |
1cb1b87bbd30
Fixes for the Unix file browser... seems to have revealed a problem in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
482
diff
changeset
|
4904 _set_signal_handler_id(newitem, sigid, cid); |
1cb1b87bbd30
Fixes for the Unix file browser... seems to have revealed a problem in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
482
diff
changeset
|
4905 } |
1cb1b87bbd30
Fixes for the Unix file browser... seems to have revealed a problem in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
482
diff
changeset
|
4906 } |
1cb1b87bbd30
Fixes for the Unix file browser... seems to have revealed a problem in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
482
diff
changeset
|
4907 |
1cb1b87bbd30
Fixes for the Unix file browser... seems to have revealed a problem in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
482
diff
changeset
|
4908 _dw_ignore_expand = 1; |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4909 if(parent) |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4910 { |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4911 subtree = (GtkWidget *)gtk_object_get_user_data(GTK_OBJECT(parent)); |
483
1cb1b87bbd30
Fixes for the Unix file browser... seems to have revealed a problem in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
482
diff
changeset
|
4912 if(!subtree || !GTK_IS_TREE(subtree)) |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4913 { |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
4914 void *thisfunc = (void *)gtk_object_get_data(GTK_OBJECT(tree), "_dw_select_child_func"); |
361
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
4915 void *mydata = (void *)gtk_object_get_data(GTK_OBJECT(tree), "_dw_select_child_data"); |
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
4916 SignalHandler work = _get_signal_handler(tree, mydata); |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4917 |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4918 subtree = gtk_tree_new(); |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4919 |
361
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
4920 if(thisfunc && work.window) |
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
4921 { |
409
1d7be77cbfb5
Implemented signal removal system so it works like OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
407
diff
changeset
|
4922 int sigid = _set_signal_handler(subtree, work.window, work.func, work.data, thisfunc); |
1d7be77cbfb5
Implemented signal removal system so it works like OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
407
diff
changeset
|
4923 gint cid =gtk_signal_connect(GTK_OBJECT(subtree), "select-child", GTK_SIGNAL_FUNC(thisfunc),(gpointer)sigid); |
1d7be77cbfb5
Implemented signal removal system so it works like OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
407
diff
changeset
|
4924 _set_signal_handler_id(subtree, sigid, cid); |
361
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
4925 } |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4926 |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
4927 thisfunc = (void *)gtk_object_get_data(GTK_OBJECT(tree), "_dw_container_context_func"); |
361
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
4928 mydata = (void *)gtk_object_get_data(GTK_OBJECT(tree), "_dw_container_context_data"); |
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
4929 work = _get_signal_handler(tree, mydata); |
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
4930 |
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
4931 if(thisfunc && work.window) |
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
4932 { |
409
1d7be77cbfb5
Implemented signal removal system so it works like OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
407
diff
changeset
|
4933 int sigid = _set_signal_handler(subtree, work.window, work.func, work.data, thisfunc); |
1d7be77cbfb5
Implemented signal removal system so it works like OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
407
diff
changeset
|
4934 gint cid =gtk_signal_connect(GTK_OBJECT(subtree), "button_press_event", GTK_SIGNAL_FUNC(thisfunc),(gpointer)sigid); |
1d7be77cbfb5
Implemented signal removal system so it works like OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
407
diff
changeset
|
4935 _set_signal_handler_id(subtree, sigid, cid); |
361
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
4936 } |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4937 |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4938 gtk_object_set_user_data(GTK_OBJECT(parent), subtree); |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4939 gtk_tree_set_selection_mode(GTK_TREE(subtree), GTK_SELECTION_SINGLE); |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4940 gtk_tree_set_view_mode(GTK_TREE(subtree), GTK_TREE_VIEW_ITEM); |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4941 gtk_tree_item_set_subtree(GTK_TREE_ITEM(parent), subtree); |
483
1cb1b87bbd30
Fixes for the Unix file browser... seems to have revealed a problem in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
482
diff
changeset
|
4942 gtk_object_set_data(GTK_OBJECT(subtree), "_dw_parentitem", (gpointer)parent); |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4943 gtk_tree_item_collapse(GTK_TREE_ITEM(parent)); |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4944 gtk_widget_show(subtree); |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4945 gtk_tree_item_expand(GTK_TREE_ITEM(parent)); |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4946 gtk_tree_item_collapse(GTK_TREE_ITEM(parent)); |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4947 } |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
4948 gtk_object_set_data(GTK_OBJECT(newitem), "_dw_parenttree", (gpointer)subtree); |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4949 gtk_tree_insert(GTK_TREE(subtree), newitem, position); |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4950 } |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4951 else |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4952 { |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
4953 gtk_object_set_data(GTK_OBJECT(newitem), "_dw_parenttree", (gpointer)tree); |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4954 gtk_tree_insert(GTK_TREE(tree), newitem, position); |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4955 } |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4956 gtk_tree_item_expand(GTK_TREE_ITEM(newitem)); |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4957 gtk_tree_item_collapse(GTK_TREE_ITEM(newitem)); |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4958 gtk_widget_show(newitem); |
483
1cb1b87bbd30
Fixes for the Unix file browser... seems to have revealed a problem in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
482
diff
changeset
|
4959 _dw_ignore_expand = 0; |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4960 DW_MUTEX_UNLOCK; |
328
e00aff2b899e
Tree item handles are now of the type HTREEITEM instead of HWND since they
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
322
diff
changeset
|
4961 return (HTREEITEM)newitem; |
138
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
4962 #endif |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4963 } |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4964 |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4965 /* |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
4966 * Inserts an item into a tree window (widget). |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
4967 * Parameters: |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
4968 * handle: Handle to the tree to be inserted. |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
4969 * title: The text title of the entry. |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
4970 * icon: Handle to coresponding icon. |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
4971 * parent: Parent handle or 0 if root. |
54
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
4972 * itemdata: Item specific data. |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
4973 */ |
328
e00aff2b899e
Tree item handles are now of the type HTREEITEM instead of HWND since they
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
322
diff
changeset
|
4974 HTREEITEM dw_tree_insert(HWND handle, char *title, unsigned long icon, HTREEITEM parent, void *itemdata) |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
4975 { |
138
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
4976 #if GTK_MAJOR_VERSION > 1 |
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
4977 GtkWidget *tree; |
140
e0e73b4372a6
GTK 2.0 tree control is now fully functional. I just need to check for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
139
diff
changeset
|
4978 GtkTreeIter *iter; |
138
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
4979 GtkTreeStore *store; |
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
4980 GdkPixbuf *pixbuf; |
328
e00aff2b899e
Tree item handles are now of the type HTREEITEM instead of HWND since they
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
322
diff
changeset
|
4981 HTREEITEM retval = 0; |
138
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
4982 int _locked_by_me = FALSE; |
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
4983 |
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
4984 if(!handle) |
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
4985 return NULL; |
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
4986 |
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
4987 DW_MUTEX_LOCK; |
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
4988 if((tree = (GtkWidget *)gtk_object_get_user_data(GTK_OBJECT(handle))) |
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
4989 && GTK_IS_TREE_VIEW(tree) && |
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
4990 (store = (GtkTreeStore *)gtk_object_get_data(GTK_OBJECT(tree), "_dw_tree_store"))) |
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
4991 { |
140
e0e73b4372a6
GTK 2.0 tree control is now fully functional. I just need to check for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
139
diff
changeset
|
4992 iter = (GtkTreeIter *)malloc(sizeof(GtkTreeIter)); |
e0e73b4372a6
GTK 2.0 tree control is now fully functional. I just need to check for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
139
diff
changeset
|
4993 |
138
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
4994 pixbuf = _find_pixbuf(icon); |
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
4995 |
140
e0e73b4372a6
GTK 2.0 tree control is now fully functional. I just need to check for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
139
diff
changeset
|
4996 gtk_tree_store_append (store, iter, (GtkTreeIter *)parent); |
484
f18c70cb3e38
Fixes for GTK 2.x, and correctly check for the directory bit. NOTE:
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
483
diff
changeset
|
4997 gtk_tree_store_set (store, iter, 0, title, 1, pixbuf, 2, itemdata, 3, iter, -1); |
460
65bc397a7233
Don't unreference private pixbufs on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
450
diff
changeset
|
4998 if(pixbuf && !(icon & (1 << 31))) |
256
63d68387d924
Don't unref a non-existant pixmap. (GTK 2.x)
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
255
diff
changeset
|
4999 g_object_unref(pixbuf); |
328
e00aff2b899e
Tree item handles are now of the type HTREEITEM instead of HWND since they
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
322
diff
changeset
|
5000 retval = (HTREEITEM)iter; |
138
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
5001 } |
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
5002 DW_MUTEX_UNLOCK; |
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
5003 |
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
5004 return retval; |
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
5005 #else |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
5006 GtkWidget *item, *tree, *subtree, *label, *hbox, *pixmap; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
5007 GdkPixmap *gdkpix; |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5008 GdkBitmap *gdkbmp = NULL; |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
5009 int _locked_by_me = FALSE; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
5010 |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5011 if(!handle) |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5012 return NULL; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5013 |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
5014 DW_MUTEX_LOCK; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
5015 tree = (GtkWidget *)gtk_object_get_user_data(GTK_OBJECT(handle)); |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
5016 if(!tree || !GTK_IS_TREE(tree)) |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
5017 { |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
5018 DW_MUTEX_UNLOCK; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
5019 return NULL; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
5020 } |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
5021 item = gtk_tree_item_new(); |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
5022 label = gtk_label_new(title); |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
5023 gtk_object_set_data(GTK_OBJECT(item), "_dw_text", (gpointer)strdup(title)); |
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
5024 gtk_object_set_data(GTK_OBJECT(item), "_dw_itemdata", (gpointer)itemdata); |
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
5025 gtk_object_set_data(GTK_OBJECT(item), "_dw_tree", (gpointer)tree); |
483
1cb1b87bbd30
Fixes for the Unix file browser... seems to have revealed a problem in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
482
diff
changeset
|
5026 gtk_object_set_data(GTK_OBJECT(item), "_dw_parent", (gpointer)parent); |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
5027 hbox = gtk_hbox_new(FALSE, 2); |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
5028 gtk_object_set_data(GTK_OBJECT(item), "_dw_hbox", (gpointer)hbox); |
121
d8af32b1b1cd
Switch back to using pixmaps and bitmaps, only use pixbufs for doing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
120
diff
changeset
|
5029 gdkpix = _find_pixmap(&gdkbmp, icon, hbox, NULL, NULL); |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
5030 gtk_container_add(GTK_CONTAINER(item), hbox); |
255
a167001c56df
Check that _find_pixmap() returns a pixmap handle before packing the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
249
diff
changeset
|
5031 if(gdkpix) |
a167001c56df
Check that _find_pixmap() returns a pixmap handle before packing the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
249
diff
changeset
|
5032 { |
a167001c56df
Check that _find_pixmap() returns a pixmap handle before packing the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
249
diff
changeset
|
5033 pixmap = gtk_pixmap_new(gdkpix, gdkbmp); |
a167001c56df
Check that _find_pixmap() returns a pixmap handle before packing the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
249
diff
changeset
|
5034 gtk_box_pack_start(GTK_BOX(hbox), pixmap, FALSE, TRUE, 0); |
a167001c56df
Check that _find_pixmap() returns a pixmap handle before packing the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
249
diff
changeset
|
5035 gtk_widget_show(pixmap); |
a167001c56df
Check that _find_pixmap() returns a pixmap handle before packing the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
249
diff
changeset
|
5036 } |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
5037 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, TRUE, 0); |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
5038 gtk_widget_show(label); |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
5039 gtk_widget_show(hbox); |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
5040 |
483
1cb1b87bbd30
Fixes for the Unix file browser... seems to have revealed a problem in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
482
diff
changeset
|
5041 { |
510
710f82598210
Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
508
diff
changeset
|
5042 void *thisfunc = (void *)gtk_object_get_data(GTK_OBJECT(tree), "_dw_tree_item_expand_func"); |
710f82598210
Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
508
diff
changeset
|
5043 void *mydata = (void *)gtk_object_get_data(GTK_OBJECT(tree), "_dw_tree_item_expand_data"); |
483
1cb1b87bbd30
Fixes for the Unix file browser... seems to have revealed a problem in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
482
diff
changeset
|
5044 SignalHandler work = _get_signal_handler(tree, mydata); |
1cb1b87bbd30
Fixes for the Unix file browser... seems to have revealed a problem in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
482
diff
changeset
|
5045 |
1cb1b87bbd30
Fixes for the Unix file browser... seems to have revealed a problem in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
482
diff
changeset
|
5046 if(thisfunc && work.window) |
1cb1b87bbd30
Fixes for the Unix file browser... seems to have revealed a problem in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
482
diff
changeset
|
5047 { |
1cb1b87bbd30
Fixes for the Unix file browser... seems to have revealed a problem in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
482
diff
changeset
|
5048 int sigid = _set_signal_handler(item, work.window, work.func, work.data, thisfunc); |
1cb1b87bbd30
Fixes for the Unix file browser... seems to have revealed a problem in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
482
diff
changeset
|
5049 gint cid =gtk_signal_connect(GTK_OBJECT(item), "expand", GTK_SIGNAL_FUNC(thisfunc),(gpointer)sigid); |
1cb1b87bbd30
Fixes for the Unix file browser... seems to have revealed a problem in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
482
diff
changeset
|
5050 _set_signal_handler_id(item, sigid, cid); |
1cb1b87bbd30
Fixes for the Unix file browser... seems to have revealed a problem in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
482
diff
changeset
|
5051 } |
1cb1b87bbd30
Fixes for the Unix file browser... seems to have revealed a problem in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
482
diff
changeset
|
5052 } |
1cb1b87bbd30
Fixes for the Unix file browser... seems to have revealed a problem in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
482
diff
changeset
|
5053 |
1cb1b87bbd30
Fixes for the Unix file browser... seems to have revealed a problem in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
482
diff
changeset
|
5054 _dw_ignore_expand = 1; |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
5055 if(parent) |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
5056 { |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
5057 subtree = (GtkWidget *)gtk_object_get_user_data(GTK_OBJECT(parent)); |
483
1cb1b87bbd30
Fixes for the Unix file browser... seems to have revealed a problem in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
482
diff
changeset
|
5058 if(!subtree || !GTK_IS_TREE(subtree)) |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
5059 { |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
5060 void *thisfunc = (void *)gtk_object_get_data(GTK_OBJECT(tree), "_dw_select_child_func"); |
361
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
5061 void *mydata = (void *)gtk_object_get_data(GTK_OBJECT(tree), "_dw_select_child_data"); |
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
5062 SignalHandler work = _get_signal_handler(tree, mydata); |
30
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
22
diff
changeset
|
5063 |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
5064 subtree = gtk_tree_new(); |
30
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
22
diff
changeset
|
5065 |
361
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
5066 if(thisfunc && work.window) |
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
5067 { |
409
1d7be77cbfb5
Implemented signal removal system so it works like OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
407
diff
changeset
|
5068 int sigid = _set_signal_handler(subtree, work.window, work.func, work.data, thisfunc); |
1d7be77cbfb5
Implemented signal removal system so it works like OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
407
diff
changeset
|
5069 gint cid =gtk_signal_connect(GTK_OBJECT(subtree), "select-child", GTK_SIGNAL_FUNC(thisfunc),(gpointer)sigid); |
1d7be77cbfb5
Implemented signal removal system so it works like OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
407
diff
changeset
|
5070 _set_signal_handler_id(subtree, sigid, cid); |
361
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
5071 } |
30
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
22
diff
changeset
|
5072 |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
5073 thisfunc = (void *)gtk_object_get_data(GTK_OBJECT(tree), "_dw_container_context_func"); |
361
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
5074 mydata = (void *)gtk_object_get_data(GTK_OBJECT(tree), "_dw_container_context_data"); |
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
5075 work = _get_signal_handler(tree, mydata); |
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
5076 |
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
5077 if(thisfunc && work.window) |
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
5078 { |
409
1d7be77cbfb5
Implemented signal removal system so it works like OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
407
diff
changeset
|
5079 int sigid = _set_signal_handler(subtree, work.window, work.func, work.data, thisfunc); |
1d7be77cbfb5
Implemented signal removal system so it works like OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
407
diff
changeset
|
5080 gint cid =gtk_signal_connect(GTK_OBJECT(subtree), "button_press_event", GTK_SIGNAL_FUNC(thisfunc),(gpointer)sigid); |
1d7be77cbfb5
Implemented signal removal system so it works like OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
407
diff
changeset
|
5081 _set_signal_handler_id(subtree, sigid, cid); |
361
8c0212f70914
Signal handler changes to avoid a memory leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
359
diff
changeset
|
5082 } |
54
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5083 |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
5084 gtk_object_set_user_data(GTK_OBJECT(parent), subtree); |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
5085 gtk_tree_set_selection_mode(GTK_TREE(subtree), GTK_SELECTION_SINGLE); |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
5086 gtk_tree_set_view_mode(GTK_TREE(subtree), GTK_TREE_VIEW_ITEM); |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
5087 gtk_tree_item_set_subtree(GTK_TREE_ITEM(parent), subtree); |
483
1cb1b87bbd30
Fixes for the Unix file browser... seems to have revealed a problem in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
482
diff
changeset
|
5088 gtk_object_set_data(GTK_OBJECT(subtree), "_dw_parentitem", (gpointer)parent); |
54
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5089 gtk_tree_item_collapse(GTK_TREE_ITEM(parent)); |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
5090 gtk_widget_show(subtree); |
54
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5091 gtk_tree_item_expand(GTK_TREE_ITEM(parent)); |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5092 gtk_tree_item_collapse(GTK_TREE_ITEM(parent)); |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
5093 } |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
5094 gtk_object_set_data(GTK_OBJECT(item), "_dw_parenttree", (gpointer)subtree); |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
5095 gtk_tree_append(GTK_TREE(subtree), item); |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
5096 } |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
5097 else |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5098 { |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
5099 gtk_object_set_data(GTK_OBJECT(item), "_dw_parenttree", (gpointer)tree); |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
5100 gtk_tree_append(GTK_TREE(tree), item); |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5101 } |
54
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5102 gtk_tree_item_expand(GTK_TREE_ITEM(item)); |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5103 gtk_tree_item_collapse(GTK_TREE_ITEM(item)); |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
5104 gtk_widget_show(item); |
483
1cb1b87bbd30
Fixes for the Unix file browser... seems to have revealed a problem in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
482
diff
changeset
|
5105 _dw_ignore_expand = 0; |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
5106 DW_MUTEX_UNLOCK; |
328
e00aff2b899e
Tree item handles are now of the type HTREEITEM instead of HWND since they
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
322
diff
changeset
|
5107 return (HTREEITEM)item; |
138
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
5108 #endif |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
5109 } |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
5110 |
30
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
22
diff
changeset
|
5111 /* |
54
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5112 * Sets the text and icon of an item in a tree window (widget). |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5113 * Parameters: |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5114 * handle: Handle to the tree containing the item. |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5115 * item: Handle of the item to be modified. |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5116 * title: The text title of the entry. |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5117 * icon: Handle to coresponding icon. |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5118 */ |
510
710f82598210
Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
508
diff
changeset
|
5119 void dw_tree_item_change(HWND handle, HTREEITEM item, char *title, unsigned long icon) |
54
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5120 { |
138
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
5121 #if GTK_MAJOR_VERSION > 1 |
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
5122 GtkWidget *tree; |
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
5123 GtkTreeStore *store; |
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
5124 GdkPixbuf *pixbuf; |
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
5125 int _locked_by_me = FALSE; |
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
5126 |
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
5127 if(!handle) |
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
5128 return; |
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
5129 |
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
5130 DW_MUTEX_LOCK; |
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
5131 if((tree = (GtkWidget *)gtk_object_get_user_data(GTK_OBJECT(handle))) |
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
5132 && GTK_IS_TREE_VIEW(tree) && |
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
5133 (store = (GtkTreeStore *)gtk_object_get_data(GTK_OBJECT(tree), "_dw_tree_store"))) |
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
5134 { |
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
5135 pixbuf = _find_pixbuf(icon); |
460
65bc397a7233
Don't unreference private pixbufs on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
450
diff
changeset
|
5136 |
139
ccf210251c99
Implemented GTK 2.0 tree delete etc. just signal handlers left.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
138
diff
changeset
|
5137 gtk_tree_store_set(store, (GtkTreeIter *)item, 0, title, 1, pixbuf, -1); |
460
65bc397a7233
Don't unreference private pixbufs on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
450
diff
changeset
|
5138 if(pixbuf && !(icon & (1 << 31))) |
256
63d68387d924
Don't unref a non-existant pixmap. (GTK 2.x)
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
255
diff
changeset
|
5139 g_object_unref(pixbuf); |
138
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
5140 } |
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
5141 DW_MUTEX_UNLOCK; |
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
5142 #else |
54
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5143 GtkWidget *label, *hbox, *pixmap; |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5144 GdkPixmap *gdkpix; |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5145 GdkBitmap *gdkbmp = NULL; |
54
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5146 char *oldtext; |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5147 int _locked_by_me = FALSE; |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5148 |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5149 if(!handle || !item) |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5150 return; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5151 |
54
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5152 DW_MUTEX_LOCK; |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
5153 oldtext = (char *)gtk_object_get_data(GTK_OBJECT(item), "_dw_text"); |
54
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5154 if(oldtext) |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5155 free(oldtext); |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5156 label = gtk_label_new(title); |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
5157 gtk_object_set_data(GTK_OBJECT(item), "_dw_text", (gpointer)strdup(title)); |
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
5158 hbox = (GtkWidget *)gtk_object_get_data(GTK_OBJECT(item), "_dw_hbox"); |
54
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5159 gtk_widget_destroy(hbox); |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5160 hbox = gtk_hbox_new(FALSE, 2); |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
5161 gtk_object_set_data(GTK_OBJECT(item), "_dw_hbox", (gpointer)hbox); |
121
d8af32b1b1cd
Switch back to using pixmaps and bitmaps, only use pixbufs for doing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
120
diff
changeset
|
5162 gdkpix = _find_pixmap(&gdkbmp, icon, hbox, NULL, NULL); |
54
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5163 gtk_container_add(GTK_CONTAINER(item), hbox); |
255
a167001c56df
Check that _find_pixmap() returns a pixmap handle before packing the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
249
diff
changeset
|
5164 if(gdkpix) |
a167001c56df
Check that _find_pixmap() returns a pixmap handle before packing the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
249
diff
changeset
|
5165 { |
a167001c56df
Check that _find_pixmap() returns a pixmap handle before packing the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
249
diff
changeset
|
5166 pixmap = gtk_pixmap_new(gdkpix, gdkbmp); |
a167001c56df
Check that _find_pixmap() returns a pixmap handle before packing the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
249
diff
changeset
|
5167 gtk_box_pack_start(GTK_BOX(hbox), pixmap, FALSE, TRUE, 0); |
a167001c56df
Check that _find_pixmap() returns a pixmap handle before packing the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
249
diff
changeset
|
5168 gtk_widget_show(pixmap); |
a167001c56df
Check that _find_pixmap() returns a pixmap handle before packing the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
249
diff
changeset
|
5169 } |
54
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5170 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, TRUE, 0); |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5171 gtk_widget_show(label); |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5172 gtk_widget_show(hbox); |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5173 DW_MUTEX_UNLOCK; |
138
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
5174 #endif |
54
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5175 } |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5176 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5177 /* |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5178 * Sets the item data of a tree item. |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5179 * Parameters: |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5180 * handle: Handle to the tree containing the item. |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5181 * item: Handle of the item to be modified. |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5182 * itemdata: User defined data to be associated with item. |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5183 */ |
513
7755599311d4
Fixes search and replace errors.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
511
diff
changeset
|
5184 void dw_tree_item_set_data(HWND handle, HTREEITEM item, void *itemdata) |
54
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5185 { |
140
e0e73b4372a6
GTK 2.0 tree control is now fully functional. I just need to check for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
139
diff
changeset
|
5186 #if GTK_MAJOR_VERSION > 1 |
e0e73b4372a6
GTK 2.0 tree control is now fully functional. I just need to check for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
139
diff
changeset
|
5187 GtkWidget *tree; |
e0e73b4372a6
GTK 2.0 tree control is now fully functional. I just need to check for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
139
diff
changeset
|
5188 GtkTreeStore *store; |
e0e73b4372a6
GTK 2.0 tree control is now fully functional. I just need to check for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
139
diff
changeset
|
5189 int _locked_by_me = FALSE; |
e0e73b4372a6
GTK 2.0 tree control is now fully functional. I just need to check for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
139
diff
changeset
|
5190 |
e0e73b4372a6
GTK 2.0 tree control is now fully functional. I just need to check for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
139
diff
changeset
|
5191 if(!handle || !item) |
e0e73b4372a6
GTK 2.0 tree control is now fully functional. I just need to check for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
139
diff
changeset
|
5192 return; |
e0e73b4372a6
GTK 2.0 tree control is now fully functional. I just need to check for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
139
diff
changeset
|
5193 |
e0e73b4372a6
GTK 2.0 tree control is now fully functional. I just need to check for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
139
diff
changeset
|
5194 DW_MUTEX_LOCK; |
e0e73b4372a6
GTK 2.0 tree control is now fully functional. I just need to check for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
139
diff
changeset
|
5195 if((tree = (GtkWidget *)gtk_object_get_user_data(GTK_OBJECT(handle))) |
e0e73b4372a6
GTK 2.0 tree control is now fully functional. I just need to check for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
139
diff
changeset
|
5196 && GTK_IS_TREE_VIEW(tree) && |
e0e73b4372a6
GTK 2.0 tree control is now fully functional. I just need to check for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
139
diff
changeset
|
5197 (store = (GtkTreeStore *)gtk_object_get_data(GTK_OBJECT(tree), "_dw_tree_store"))) |
e0e73b4372a6
GTK 2.0 tree control is now fully functional. I just need to check for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
139
diff
changeset
|
5198 gtk_tree_store_set(store, (GtkTreeIter *)item, 2, itemdata, -1); |
e0e73b4372a6
GTK 2.0 tree control is now fully functional. I just need to check for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
139
diff
changeset
|
5199 DW_MUTEX_UNLOCK; |
e0e73b4372a6
GTK 2.0 tree control is now fully functional. I just need to check for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
139
diff
changeset
|
5200 #else |
54
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5201 int _locked_by_me = FALSE; |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5202 |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5203 if(!handle || !item) |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5204 return; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5205 |
54
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5206 DW_MUTEX_LOCK; |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
5207 gtk_object_set_data(GTK_OBJECT(item), "_dw_itemdata", (gpointer)itemdata); |
54
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5208 DW_MUTEX_UNLOCK; |
140
e0e73b4372a6
GTK 2.0 tree control is now fully functional. I just need to check for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
139
diff
changeset
|
5209 #endif |
54
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5210 } |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5211 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5212 /* |
478
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
472
diff
changeset
|
5213 * Gets the text an item in a tree window (widget). |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
472
diff
changeset
|
5214 * Parameters: |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
472
diff
changeset
|
5215 * handle: Handle to the tree containing the item. |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
472
diff
changeset
|
5216 * item: Handle of the item to be modified. |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
472
diff
changeset
|
5217 */ |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
472
diff
changeset
|
5218 char * API dw_tree_get_title(HWND handle, HTREEITEM item) |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
472
diff
changeset
|
5219 { |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
472
diff
changeset
|
5220 int _locked_by_me = FALSE; |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
472
diff
changeset
|
5221 char *text = NULL; |
501
8267a3066476
Move variable definitions to after first line of code so C compilers work.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
494
diff
changeset
|
5222 #if GTK_MAJOR_VERSION > 1 |
8267a3066476
Move variable definitions to after first line of code so C compilers work.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
494
diff
changeset
|
5223 GtkWidget *tree; |
8267a3066476
Move variable definitions to after first line of code so C compilers work.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
494
diff
changeset
|
5224 GtkTreeModel *store; |
8267a3066476
Move variable definitions to after first line of code so C compilers work.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
494
diff
changeset
|
5225 #endif |
478
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
472
diff
changeset
|
5226 |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
472
diff
changeset
|
5227 if(!handle || !item) |
479
61e2973ad093
Minor compile fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
478
diff
changeset
|
5228 return text; |
478
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
472
diff
changeset
|
5229 |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
472
diff
changeset
|
5230 DW_MUTEX_LOCK; |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
472
diff
changeset
|
5231 #if GTK_MAJOR_VERSION > 1 |
501
8267a3066476
Move variable definitions to after first line of code so C compilers work.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
494
diff
changeset
|
5232 tree = (GtkWidget *)gtk_object_get_user_data(GTK_OBJECT(handle)); |
482
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
5233 |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
5234 if(tree && GTK_IS_TREE_VIEW(tree) && |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
5235 (store = (GtkTreeModel *)gtk_object_get_data(GTK_OBJECT(tree), "_dw_tree_store"))) |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
5236 gtk_tree_model_get(store, (GtkTreeIter *)item, 0, &text, -1); |
478
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
472
diff
changeset
|
5237 #else |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
472
diff
changeset
|
5238 text = (char *)gtk_object_get_data(GTK_OBJECT(item), "_dw_text"); |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
472
diff
changeset
|
5239 #endif |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
472
diff
changeset
|
5240 DW_MUTEX_UNLOCK; |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
472
diff
changeset
|
5241 return text; |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
472
diff
changeset
|
5242 } |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
472
diff
changeset
|
5243 |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
472
diff
changeset
|
5244 /* |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
472
diff
changeset
|
5245 * Gets the text an item in a tree window (widget). |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
472
diff
changeset
|
5246 * Parameters: |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
472
diff
changeset
|
5247 * handle: Handle to the tree containing the item. |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
472
diff
changeset
|
5248 * item: Handle of the item to be modified. |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
472
diff
changeset
|
5249 */ |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
472
diff
changeset
|
5250 HTREEITEM API dw_tree_get_parent(HWND handle, HTREEITEM item) |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
472
diff
changeset
|
5251 { |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
472
diff
changeset
|
5252 int _locked_by_me = FALSE; |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
472
diff
changeset
|
5253 HTREEITEM parent = (HTREEITEM)0; |
501
8267a3066476
Move variable definitions to after first line of code so C compilers work.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
494
diff
changeset
|
5254 #if GTK_MAJOR_VERSION > 1 |
8267a3066476
Move variable definitions to after first line of code so C compilers work.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
494
diff
changeset
|
5255 GtkWidget *tree; |
8267a3066476
Move variable definitions to after first line of code so C compilers work.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
494
diff
changeset
|
5256 GtkTreeModel *store; |
8267a3066476
Move variable definitions to after first line of code so C compilers work.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
494
diff
changeset
|
5257 #endif |
478
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
472
diff
changeset
|
5258 |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
472
diff
changeset
|
5259 if(!handle || !item) |
479
61e2973ad093
Minor compile fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
478
diff
changeset
|
5260 return parent; |
478
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
472
diff
changeset
|
5261 |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
472
diff
changeset
|
5262 DW_MUTEX_LOCK; |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
472
diff
changeset
|
5263 #if GTK_MAJOR_VERSION > 1 |
501
8267a3066476
Move variable definitions to after first line of code so C compilers work.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
494
diff
changeset
|
5264 tree = (GtkWidget *)gtk_object_get_user_data(GTK_OBJECT(handle)); |
482
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
5265 |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
5266 if(tree && GTK_IS_TREE_VIEW(tree) && |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
5267 (store = (GtkTreeModel *)gtk_object_get_data(GTK_OBJECT(tree), "_dw_tree_store"))) |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
5268 { |
484
f18c70cb3e38
Fixes for GTK 2.x, and correctly check for the directory bit. NOTE:
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
483
diff
changeset
|
5269 GtkTreeIter *p = malloc(sizeof(GtkTreeIter)); |
f18c70cb3e38
Fixes for GTK 2.x, and correctly check for the directory bit. NOTE:
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
483
diff
changeset
|
5270 |
f18c70cb3e38
Fixes for GTK 2.x, and correctly check for the directory bit. NOTE:
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
483
diff
changeset
|
5271 if(gtk_tree_model_iter_parent(store, p, (GtkTreeIter *)item)) |
f18c70cb3e38
Fixes for GTK 2.x, and correctly check for the directory bit. NOTE:
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
483
diff
changeset
|
5272 parent = p; |
f18c70cb3e38
Fixes for GTK 2.x, and correctly check for the directory bit. NOTE:
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
483
diff
changeset
|
5273 else |
f18c70cb3e38
Fixes for GTK 2.x, and correctly check for the directory bit. NOTE:
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
483
diff
changeset
|
5274 free(p); |
482
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
5275 } |
478
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
472
diff
changeset
|
5276 #else |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
472
diff
changeset
|
5277 parent = (HTREEITEM)gtk_object_get_data(GTK_OBJECT(item), "_dw_parent"); |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
472
diff
changeset
|
5278 #endif |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
472
diff
changeset
|
5279 DW_MUTEX_UNLOCK; |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
472
diff
changeset
|
5280 return parent; |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
472
diff
changeset
|
5281 } |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
472
diff
changeset
|
5282 |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
472
diff
changeset
|
5283 /* |
317
83edbd751da9
Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
316
diff
changeset
|
5284 * Gets the item data of a tree item. |
83edbd751da9
Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
316
diff
changeset
|
5285 * Parameters: |
83edbd751da9
Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
316
diff
changeset
|
5286 * handle: Handle to the tree containing the item. |
83edbd751da9
Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
316
diff
changeset
|
5287 * item: Handle of the item to be modified. |
83edbd751da9
Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
316
diff
changeset
|
5288 */ |
510
710f82598210
Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
508
diff
changeset
|
5289 void *dw_tree_item_get_data(HWND handle, HTREEITEM item) |
317
83edbd751da9
Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
316
diff
changeset
|
5290 { |
83edbd751da9
Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
316
diff
changeset
|
5291 void *ret = NULL; |
83edbd751da9
Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
316
diff
changeset
|
5292 #if GTK_MAJOR_VERSION > 1 |
83edbd751da9
Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
316
diff
changeset
|
5293 GtkWidget *tree; |
322
78be9770960c
Oops, used wrong type in GTK 2.x dw_tree_get_data(), thanks Mark.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
320
diff
changeset
|
5294 GtkTreeModel *store; |
317
83edbd751da9
Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
316
diff
changeset
|
5295 int _locked_by_me = FALSE; |
83edbd751da9
Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
316
diff
changeset
|
5296 |
83edbd751da9
Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
316
diff
changeset
|
5297 if(!handle || !item) |
319
aed5d742896d
Fixed errant returns on failure.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
5298 return NULL; |
317
83edbd751da9
Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
316
diff
changeset
|
5299 |
83edbd751da9
Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
316
diff
changeset
|
5300 DW_MUTEX_LOCK; |
83edbd751da9
Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
316
diff
changeset
|
5301 if((tree = (GtkWidget *)gtk_object_get_user_data(GTK_OBJECT(handle))) |
83edbd751da9
Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
316
diff
changeset
|
5302 && GTK_IS_TREE_VIEW(tree) && |
322
78be9770960c
Oops, used wrong type in GTK 2.x dw_tree_get_data(), thanks Mark.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
320
diff
changeset
|
5303 (store = (GtkTreeModel *)gtk_object_get_data(GTK_OBJECT(tree), "_dw_tree_store"))) |
317
83edbd751da9
Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
316
diff
changeset
|
5304 gtk_tree_model_get(store, (GtkTreeIter *)item, 2, &ret, -1); |
83edbd751da9
Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
316
diff
changeset
|
5305 DW_MUTEX_UNLOCK; |
83edbd751da9
Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
316
diff
changeset
|
5306 #else |
83edbd751da9
Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
316
diff
changeset
|
5307 int _locked_by_me = FALSE; |
83edbd751da9
Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
316
diff
changeset
|
5308 |
83edbd751da9
Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
316
diff
changeset
|
5309 if(!handle || !item) |
319
aed5d742896d
Fixed errant returns on failure.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
5310 return NULL; |
317
83edbd751da9
Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
316
diff
changeset
|
5311 |
83edbd751da9
Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
316
diff
changeset
|
5312 DW_MUTEX_LOCK; |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
5313 ret = (void *)gtk_object_get_data(GTK_OBJECT(item), "_dw_itemdata"); |
317
83edbd751da9
Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
316
diff
changeset
|
5314 DW_MUTEX_UNLOCK; |
83edbd751da9
Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
316
diff
changeset
|
5315 #endif |
83edbd751da9
Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
316
diff
changeset
|
5316 return ret; |
83edbd751da9
Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
316
diff
changeset
|
5317 } |
83edbd751da9
Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
316
diff
changeset
|
5318 |
83edbd751da9
Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
316
diff
changeset
|
5319 /* |
54
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5320 * Sets this item as the active selection. |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5321 * Parameters: |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5322 * handle: Handle to the tree window (widget) to be selected. |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5323 * item: Handle to the item to be selected. |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5324 */ |
328
e00aff2b899e
Tree item handles are now of the type HTREEITEM instead of HWND since they
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
322
diff
changeset
|
5325 void dw_tree_item_select(HWND handle, HTREEITEM item) |
54
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5326 { |
138
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
5327 #if GTK_MAJOR_VERSION > 1 |
139
ccf210251c99
Implemented GTK 2.0 tree delete etc. just signal handlers left.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
138
diff
changeset
|
5328 GtkWidget *tree; |
ccf210251c99
Implemented GTK 2.0 tree delete etc. just signal handlers left.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
138
diff
changeset
|
5329 GtkTreeStore *store; |
ccf210251c99
Implemented GTK 2.0 tree delete etc. just signal handlers left.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
138
diff
changeset
|
5330 int _locked_by_me = FALSE; |
ccf210251c99
Implemented GTK 2.0 tree delete etc. just signal handlers left.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
138
diff
changeset
|
5331 |
141
36dc19aa7773
Added tree cleanup code for GTK 2.0, and disabled some of the accellerator
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
140
diff
changeset
|
5332 if(!handle || !item) |
139
ccf210251c99
Implemented GTK 2.0 tree delete etc. just signal handlers left.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
138
diff
changeset
|
5333 return; |
ccf210251c99
Implemented GTK 2.0 tree delete etc. just signal handlers left.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
138
diff
changeset
|
5334 |
ccf210251c99
Implemented GTK 2.0 tree delete etc. just signal handlers left.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
138
diff
changeset
|
5335 DW_MUTEX_LOCK; |
ccf210251c99
Implemented GTK 2.0 tree delete etc. just signal handlers left.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
138
diff
changeset
|
5336 if((tree = (GtkWidget *)gtk_object_get_user_data(GTK_OBJECT(handle))) |
ccf210251c99
Implemented GTK 2.0 tree delete etc. just signal handlers left.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
138
diff
changeset
|
5337 && GTK_IS_TREE_VIEW(tree) && |
ccf210251c99
Implemented GTK 2.0 tree delete etc. just signal handlers left.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
138
diff
changeset
|
5338 (store = (GtkTreeStore *)gtk_object_get_data(GTK_OBJECT(tree), "_dw_tree_store"))) |
ccf210251c99
Implemented GTK 2.0 tree delete etc. just signal handlers left.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
138
diff
changeset
|
5339 { |
ccf210251c99
Implemented GTK 2.0 tree delete etc. just signal handlers left.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
138
diff
changeset
|
5340 GtkTreePath *path = gtk_tree_model_get_path(GTK_TREE_MODEL(store), (GtkTreeIter *)item); |
140
e0e73b4372a6
GTK 2.0 tree control is now fully functional. I just need to check for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
139
diff
changeset
|
5341 GtkTreeSelection *sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(tree)); |
e0e73b4372a6
GTK 2.0 tree control is now fully functional. I just need to check for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
139
diff
changeset
|
5342 |
139
ccf210251c99
Implemented GTK 2.0 tree delete etc. just signal handlers left.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
138
diff
changeset
|
5343 gtk_tree_view_set_cursor(GTK_TREE_VIEW(tree), path, NULL, FALSE); |
140
e0e73b4372a6
GTK 2.0 tree control is now fully functional. I just need to check for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
139
diff
changeset
|
5344 gtk_tree_selection_select_iter(sel, (GtkTreeIter *)item); |
139
ccf210251c99
Implemented GTK 2.0 tree delete etc. just signal handlers left.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
138
diff
changeset
|
5345 gtk_tree_path_free(path); |
ccf210251c99
Implemented GTK 2.0 tree delete etc. just signal handlers left.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
138
diff
changeset
|
5346 } |
ccf210251c99
Implemented GTK 2.0 tree delete etc. just signal handlers left.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
138
diff
changeset
|
5347 DW_MUTEX_UNLOCK; |
138
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
5348 #else |
107
cd0e5cf92f6a
Rewrote the Windows packing code so it is more like OS/2 to improve window
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
96
diff
changeset
|
5349 GtkWidget *lastselect, *tree; |
54
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5350 int _locked_by_me = FALSE; |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5351 |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5352 if(!handle || !item) |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5353 return; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5354 |
54
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5355 DW_MUTEX_LOCK; |
107
cd0e5cf92f6a
Rewrote the Windows packing code so it is more like OS/2 to improve window
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
96
diff
changeset
|
5356 tree = (GtkWidget *)gtk_object_get_user_data(GTK_OBJECT(handle)); |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
5357 lastselect = (GtkWidget *)gtk_object_get_data(GTK_OBJECT(tree), "_dw_lastselect"); |
54
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5358 if(lastselect && GTK_IS_TREE_ITEM(lastselect)) |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5359 gtk_tree_item_deselect(GTK_TREE_ITEM(lastselect)); |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5360 gtk_tree_item_select(GTK_TREE_ITEM(item)); |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
5361 gtk_object_set_data(GTK_OBJECT(tree), "_dw_lastselect", (gpointer)item); |
54
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5362 DW_MUTEX_UNLOCK; |
138
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
5363 #endif |
54
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5364 } |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5365 |
143
1d57c27e4adc
Moved _dw_recursive_free into GTK 2.0 #ifdefs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
142
diff
changeset
|
5366 #if GTK_MAJOR_VERSION > 1 |
258
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
5367 static void _dw_recursive_free(GtkTreeModel *store, GtkTreeIter parent) |
141
36dc19aa7773
Added tree cleanup code for GTK 2.0, and disabled some of the accellerator
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
140
diff
changeset
|
5368 { |
36dc19aa7773
Added tree cleanup code for GTK 2.0, and disabled some of the accellerator
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
140
diff
changeset
|
5369 void *data; |
36dc19aa7773
Added tree cleanup code for GTK 2.0, and disabled some of the accellerator
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
140
diff
changeset
|
5370 GtkTreeIter iter; |
36dc19aa7773
Added tree cleanup code for GTK 2.0, and disabled some of the accellerator
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
140
diff
changeset
|
5371 |
36dc19aa7773
Added tree cleanup code for GTK 2.0, and disabled some of the accellerator
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
140
diff
changeset
|
5372 gtk_tree_model_get(store, &parent, 3, &data, -1); |
36dc19aa7773
Added tree cleanup code for GTK 2.0, and disabled some of the accellerator
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
140
diff
changeset
|
5373 if(data) |
36dc19aa7773
Added tree cleanup code for GTK 2.0, and disabled some of the accellerator
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
140
diff
changeset
|
5374 free(data); |
36dc19aa7773
Added tree cleanup code for GTK 2.0, and disabled some of the accellerator
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
140
diff
changeset
|
5375 gtk_tree_store_set(GTK_TREE_STORE(store), &parent, 3, NULL, -1); |
36dc19aa7773
Added tree cleanup code for GTK 2.0, and disabled some of the accellerator
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
140
diff
changeset
|
5376 |
36dc19aa7773
Added tree cleanup code for GTK 2.0, and disabled some of the accellerator
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
140
diff
changeset
|
5377 if(gtk_tree_model_iter_children(store, &iter, &parent)) |
36dc19aa7773
Added tree cleanup code for GTK 2.0, and disabled some of the accellerator
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
140
diff
changeset
|
5378 { |
36dc19aa7773
Added tree cleanup code for GTK 2.0, and disabled some of the accellerator
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
140
diff
changeset
|
5379 do { |
36dc19aa7773
Added tree cleanup code for GTK 2.0, and disabled some of the accellerator
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
140
diff
changeset
|
5380 _dw_recursive_free(GTK_TREE_MODEL(store), iter); |
36dc19aa7773
Added tree cleanup code for GTK 2.0, and disabled some of the accellerator
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
140
diff
changeset
|
5381 } while(gtk_tree_model_iter_next(GTK_TREE_MODEL(store), &iter)); |
36dc19aa7773
Added tree cleanup code for GTK 2.0, and disabled some of the accellerator
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
140
diff
changeset
|
5382 } |
36dc19aa7773
Added tree cleanup code for GTK 2.0, and disabled some of the accellerator
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
140
diff
changeset
|
5383 } |
143
1d57c27e4adc
Moved _dw_recursive_free into GTK 2.0 #ifdefs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
142
diff
changeset
|
5384 #endif |
141
36dc19aa7773
Added tree cleanup code for GTK 2.0, and disabled some of the accellerator
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
140
diff
changeset
|
5385 |
54
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5386 /* |
30
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
22
diff
changeset
|
5387 * Removes all nodes from a tree. |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
22
diff
changeset
|
5388 * Parameters: |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
22
diff
changeset
|
5389 * handle: Handle to the window (widget) to be cleared. |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
22
diff
changeset
|
5390 */ |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
22
diff
changeset
|
5391 void dw_tree_clear(HWND handle) |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
22
diff
changeset
|
5392 { |
138
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
5393 #if GTK_MAJOR_VERSION > 1 |
141
36dc19aa7773
Added tree cleanup code for GTK 2.0, and disabled some of the accellerator
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
140
diff
changeset
|
5394 GtkWidget *tree; |
139
ccf210251c99
Implemented GTK 2.0 tree delete etc. just signal handlers left.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
138
diff
changeset
|
5395 GtkTreeStore *store; |
ccf210251c99
Implemented GTK 2.0 tree delete etc. just signal handlers left.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
138
diff
changeset
|
5396 int _locked_by_me = FALSE; |
ccf210251c99
Implemented GTK 2.0 tree delete etc. just signal handlers left.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
138
diff
changeset
|
5397 |
ccf210251c99
Implemented GTK 2.0 tree delete etc. just signal handlers left.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
138
diff
changeset
|
5398 if(!handle) |
ccf210251c99
Implemented GTK 2.0 tree delete etc. just signal handlers left.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
138
diff
changeset
|
5399 return; |
ccf210251c99
Implemented GTK 2.0 tree delete etc. just signal handlers left.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
138
diff
changeset
|
5400 |
ccf210251c99
Implemented GTK 2.0 tree delete etc. just signal handlers left.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
138
diff
changeset
|
5401 DW_MUTEX_LOCK; |
ccf210251c99
Implemented GTK 2.0 tree delete etc. just signal handlers left.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
138
diff
changeset
|
5402 if((tree = (GtkWidget *)gtk_object_get_user_data(GTK_OBJECT(handle))) |
ccf210251c99
Implemented GTK 2.0 tree delete etc. just signal handlers left.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
138
diff
changeset
|
5403 && GTK_IS_TREE_VIEW(tree) && |
ccf210251c99
Implemented GTK 2.0 tree delete etc. just signal handlers left.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
138
diff
changeset
|
5404 (store = (GtkTreeStore *)gtk_object_get_data(GTK_OBJECT(tree), "_dw_tree_store"))) |
141
36dc19aa7773
Added tree cleanup code for GTK 2.0, and disabled some of the accellerator
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
140
diff
changeset
|
5405 { |
36dc19aa7773
Added tree cleanup code for GTK 2.0, and disabled some of the accellerator
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
140
diff
changeset
|
5406 GtkTreeIter iter; |
36dc19aa7773
Added tree cleanup code for GTK 2.0, and disabled some of the accellerator
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
140
diff
changeset
|
5407 |
36dc19aa7773
Added tree cleanup code for GTK 2.0, and disabled some of the accellerator
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
140
diff
changeset
|
5408 if(gtk_tree_model_get_iter_first(GTK_TREE_MODEL(store), &iter)) |
36dc19aa7773
Added tree cleanup code for GTK 2.0, and disabled some of the accellerator
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
140
diff
changeset
|
5409 { |
36dc19aa7773
Added tree cleanup code for GTK 2.0, and disabled some of the accellerator
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
140
diff
changeset
|
5410 do { |
36dc19aa7773
Added tree cleanup code for GTK 2.0, and disabled some of the accellerator
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
140
diff
changeset
|
5411 _dw_recursive_free(GTK_TREE_MODEL(store), iter); |
36dc19aa7773
Added tree cleanup code for GTK 2.0, and disabled some of the accellerator
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
140
diff
changeset
|
5412 } while(gtk_tree_model_iter_next(GTK_TREE_MODEL(store), &iter)); |
36dc19aa7773
Added tree cleanup code for GTK 2.0, and disabled some of the accellerator
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
140
diff
changeset
|
5413 } |
139
ccf210251c99
Implemented GTK 2.0 tree delete etc. just signal handlers left.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
138
diff
changeset
|
5414 gtk_tree_store_clear(store); |
141
36dc19aa7773
Added tree cleanup code for GTK 2.0, and disabled some of the accellerator
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
140
diff
changeset
|
5415 } |
139
ccf210251c99
Implemented GTK 2.0 tree delete etc. just signal handlers left.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
138
diff
changeset
|
5416 DW_MUTEX_UNLOCK; |
ccf210251c99
Implemented GTK 2.0 tree delete etc. just signal handlers left.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
138
diff
changeset
|
5417 #else |
ccf210251c99
Implemented GTK 2.0 tree delete etc. just signal handlers left.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
138
diff
changeset
|
5418 GtkWidget *tree; |
30
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
22
diff
changeset
|
5419 int _locked_by_me = FALSE; |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
22
diff
changeset
|
5420 |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5421 if(!handle) |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5422 return; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5423 |
30
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
22
diff
changeset
|
5424 DW_MUTEX_LOCK; |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
22
diff
changeset
|
5425 tree = (GtkWidget *)gtk_object_get_user_data(GTK_OBJECT(handle)); |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
22
diff
changeset
|
5426 if(!tree || !GTK_IS_TREE(tree)) |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
22
diff
changeset
|
5427 { |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
22
diff
changeset
|
5428 DW_MUTEX_UNLOCK; |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
22
diff
changeset
|
5429 return; |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
22
diff
changeset
|
5430 } |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
5431 gtk_object_set_data(GTK_OBJECT(tree), "_dw_lastselect", NULL); |
30
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
22
diff
changeset
|
5432 gtk_tree_clear_items(GTK_TREE(tree), 0, 1000000); |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
22
diff
changeset
|
5433 DW_MUTEX_UNLOCK; |
138
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
5434 #endif |
30
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
22
diff
changeset
|
5435 } |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
22
diff
changeset
|
5436 |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
22
diff
changeset
|
5437 /* |
54
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5438 * Expands a node on a tree. |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5439 * Parameters: |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5440 * handle: Handle to the tree window (widget). |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5441 * item: Handle to node to be expanded. |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5442 */ |
510
710f82598210
Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
508
diff
changeset
|
5443 void dw_tree_item_expand(HWND handle, HTREEITEM item) |
54
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5444 { |
138
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
5445 #if GTK_MAJOR_VERSION > 1 |
139
ccf210251c99
Implemented GTK 2.0 tree delete etc. just signal handlers left.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
138
diff
changeset
|
5446 GtkWidget *tree; |
ccf210251c99
Implemented GTK 2.0 tree delete etc. just signal handlers left.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
138
diff
changeset
|
5447 GtkTreeStore *store; |
ccf210251c99
Implemented GTK 2.0 tree delete etc. just signal handlers left.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
138
diff
changeset
|
5448 int _locked_by_me = FALSE; |
ccf210251c99
Implemented GTK 2.0 tree delete etc. just signal handlers left.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
138
diff
changeset
|
5449 |
ccf210251c99
Implemented GTK 2.0 tree delete etc. just signal handlers left.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
138
diff
changeset
|
5450 if(!handle) |
ccf210251c99
Implemented GTK 2.0 tree delete etc. just signal handlers left.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
138
diff
changeset
|
5451 return; |
ccf210251c99
Implemented GTK 2.0 tree delete etc. just signal handlers left.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
138
diff
changeset
|
5452 |
ccf210251c99
Implemented GTK 2.0 tree delete etc. just signal handlers left.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
138
diff
changeset
|
5453 DW_MUTEX_LOCK; |
ccf210251c99
Implemented GTK 2.0 tree delete etc. just signal handlers left.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
138
diff
changeset
|
5454 if((tree = (GtkWidget *)gtk_object_get_user_data(GTK_OBJECT(handle))) |
ccf210251c99
Implemented GTK 2.0 tree delete etc. just signal handlers left.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
138
diff
changeset
|
5455 && GTK_IS_TREE_VIEW(tree) && |
ccf210251c99
Implemented GTK 2.0 tree delete etc. just signal handlers left.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
138
diff
changeset
|
5456 (store = (GtkTreeStore *)gtk_object_get_data(GTK_OBJECT(tree), "_dw_tree_store"))) |
ccf210251c99
Implemented GTK 2.0 tree delete etc. just signal handlers left.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
138
diff
changeset
|
5457 { |
ccf210251c99
Implemented GTK 2.0 tree delete etc. just signal handlers left.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
138
diff
changeset
|
5458 GtkTreePath *path = gtk_tree_model_get_path(GTK_TREE_MODEL(store), (GtkTreeIter *)item); |
ccf210251c99
Implemented GTK 2.0 tree delete etc. just signal handlers left.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
138
diff
changeset
|
5459 gtk_tree_view_expand_row(GTK_TREE_VIEW(tree), path, FALSE); |
ccf210251c99
Implemented GTK 2.0 tree delete etc. just signal handlers left.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
138
diff
changeset
|
5460 gtk_tree_path_free(path); |
ccf210251c99
Implemented GTK 2.0 tree delete etc. just signal handlers left.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
138
diff
changeset
|
5461 } |
ccf210251c99
Implemented GTK 2.0 tree delete etc. just signal handlers left.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
138
diff
changeset
|
5462 DW_MUTEX_UNLOCK; |
138
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
5463 #else |
54
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5464 int _locked_by_me = FALSE; |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5465 |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5466 if(!handle || !item) |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5467 return; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5468 |
54
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5469 DW_MUTEX_LOCK; |
483
1cb1b87bbd30
Fixes for the Unix file browser... seems to have revealed a problem in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
482
diff
changeset
|
5470 _dw_ignore_expand = 1; |
54
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5471 if(GTK_IS_TREE_ITEM(item)) |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5472 gtk_tree_item_expand(GTK_TREE_ITEM(item)); |
483
1cb1b87bbd30
Fixes for the Unix file browser... seems to have revealed a problem in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
482
diff
changeset
|
5473 _dw_ignore_expand = 0; |
54
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5474 DW_MUTEX_UNLOCK; |
138
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
5475 #endif |
54
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5476 } |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5477 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5478 /* |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5479 * Collapses a node on a tree. |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5480 * Parameters: |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5481 * handle: Handle to the tree window (widget). |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5482 * item: Handle to node to be collapsed. |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5483 */ |
510
710f82598210
Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
508
diff
changeset
|
5484 void dw_tree_item_collapse(HWND handle, HTREEITEM item) |
54
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5485 { |
138
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
5486 #if GTK_MAJOR_VERSION > 1 |
139
ccf210251c99
Implemented GTK 2.0 tree delete etc. just signal handlers left.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
138
diff
changeset
|
5487 GtkWidget *tree; |
ccf210251c99
Implemented GTK 2.0 tree delete etc. just signal handlers left.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
138
diff
changeset
|
5488 GtkTreeStore *store; |
ccf210251c99
Implemented GTK 2.0 tree delete etc. just signal handlers left.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
138
diff
changeset
|
5489 int _locked_by_me = FALSE; |
ccf210251c99
Implemented GTK 2.0 tree delete etc. just signal handlers left.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
138
diff
changeset
|
5490 |
ccf210251c99
Implemented GTK 2.0 tree delete etc. just signal handlers left.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
138
diff
changeset
|
5491 if(!handle) |
ccf210251c99
Implemented GTK 2.0 tree delete etc. just signal handlers left.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
138
diff
changeset
|
5492 return; |
ccf210251c99
Implemented GTK 2.0 tree delete etc. just signal handlers left.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
138
diff
changeset
|
5493 |
ccf210251c99
Implemented GTK 2.0 tree delete etc. just signal handlers left.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
138
diff
changeset
|
5494 DW_MUTEX_LOCK; |
ccf210251c99
Implemented GTK 2.0 tree delete etc. just signal handlers left.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
138
diff
changeset
|
5495 if((tree = (GtkWidget *)gtk_object_get_user_data(GTK_OBJECT(handle))) |
ccf210251c99
Implemented GTK 2.0 tree delete etc. just signal handlers left.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
138
diff
changeset
|
5496 && GTK_IS_TREE_VIEW(tree) && |
ccf210251c99
Implemented GTK 2.0 tree delete etc. just signal handlers left.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
138
diff
changeset
|
5497 (store = (GtkTreeStore *)gtk_object_get_data(GTK_OBJECT(tree), "_dw_tree_store"))) |
ccf210251c99
Implemented GTK 2.0 tree delete etc. just signal handlers left.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
138
diff
changeset
|
5498 { |
ccf210251c99
Implemented GTK 2.0 tree delete etc. just signal handlers left.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
138
diff
changeset
|
5499 GtkTreePath *path = gtk_tree_model_get_path(GTK_TREE_MODEL(store), (GtkTreeIter *)item); |
ccf210251c99
Implemented GTK 2.0 tree delete etc. just signal handlers left.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
138
diff
changeset
|
5500 gtk_tree_view_collapse_row(GTK_TREE_VIEW(tree), path); |
ccf210251c99
Implemented GTK 2.0 tree delete etc. just signal handlers left.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
138
diff
changeset
|
5501 gtk_tree_path_free(path); |
ccf210251c99
Implemented GTK 2.0 tree delete etc. just signal handlers left.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
138
diff
changeset
|
5502 } |
ccf210251c99
Implemented GTK 2.0 tree delete etc. just signal handlers left.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
138
diff
changeset
|
5503 DW_MUTEX_UNLOCK; |
138
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
5504 #else |
54
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5505 int _locked_by_me = FALSE; |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5506 |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5507 if(!handle || !item) |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5508 return; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5509 |
54
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5510 DW_MUTEX_LOCK; |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5511 if(GTK_IS_TREE_ITEM(item)) |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5512 gtk_tree_item_collapse(GTK_TREE_ITEM(item)); |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5513 DW_MUTEX_UNLOCK; |
138
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
5514 #endif |
54
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5515 } |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5516 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5517 /* |
30
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
22
diff
changeset
|
5518 * Removes a node from a tree. |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
22
diff
changeset
|
5519 * Parameters: |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
22
diff
changeset
|
5520 * handle: Handle to the window (widget) to be cleared. |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
22
diff
changeset
|
5521 * item: Handle to node to be deleted. |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
22
diff
changeset
|
5522 */ |
510
710f82598210
Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
508
diff
changeset
|
5523 void dw_tree_item_delete(HWND handle, HTREEITEM item) |
30
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
22
diff
changeset
|
5524 { |
138
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
5525 #if GTK_MAJOR_VERSION > 1 |
139
ccf210251c99
Implemented GTK 2.0 tree delete etc. just signal handlers left.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
138
diff
changeset
|
5526 GtkWidget *tree; |
ccf210251c99
Implemented GTK 2.0 tree delete etc. just signal handlers left.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
138
diff
changeset
|
5527 GtkTreeStore *store; |
ccf210251c99
Implemented GTK 2.0 tree delete etc. just signal handlers left.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
138
diff
changeset
|
5528 int _locked_by_me = FALSE; |
ccf210251c99
Implemented GTK 2.0 tree delete etc. just signal handlers left.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
138
diff
changeset
|
5529 |
ccf210251c99
Implemented GTK 2.0 tree delete etc. just signal handlers left.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
138
diff
changeset
|
5530 if(!handle) |
ccf210251c99
Implemented GTK 2.0 tree delete etc. just signal handlers left.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
138
diff
changeset
|
5531 return; |
ccf210251c99
Implemented GTK 2.0 tree delete etc. just signal handlers left.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
138
diff
changeset
|
5532 |
ccf210251c99
Implemented GTK 2.0 tree delete etc. just signal handlers left.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
138
diff
changeset
|
5533 DW_MUTEX_LOCK; |
ccf210251c99
Implemented GTK 2.0 tree delete etc. just signal handlers left.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
138
diff
changeset
|
5534 if((tree = (GtkWidget *)gtk_object_get_user_data(GTK_OBJECT(handle))) |
ccf210251c99
Implemented GTK 2.0 tree delete etc. just signal handlers left.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
138
diff
changeset
|
5535 && GTK_IS_TREE_VIEW(tree) && |
ccf210251c99
Implemented GTK 2.0 tree delete etc. just signal handlers left.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
138
diff
changeset
|
5536 (store = (GtkTreeStore *)gtk_object_get_data(GTK_OBJECT(tree), "_dw_tree_store"))) |
ccf210251c99
Implemented GTK 2.0 tree delete etc. just signal handlers left.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
138
diff
changeset
|
5537 { |
ccf210251c99
Implemented GTK 2.0 tree delete etc. just signal handlers left.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
138
diff
changeset
|
5538 gtk_tree_store_remove(store, (GtkTreeIter *)item); |
140
e0e73b4372a6
GTK 2.0 tree control is now fully functional. I just need to check for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
139
diff
changeset
|
5539 free(item); |
139
ccf210251c99
Implemented GTK 2.0 tree delete etc. just signal handlers left.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
138
diff
changeset
|
5540 } |
ccf210251c99
Implemented GTK 2.0 tree delete etc. just signal handlers left.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
138
diff
changeset
|
5541 DW_MUTEX_UNLOCK; |
138
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
5542 #else |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5543 GtkWidget *tree, *lastselect, *parenttree; |
30
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
22
diff
changeset
|
5544 int _locked_by_me = FALSE; |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
22
diff
changeset
|
5545 |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5546 if(!handle || !item || !GTK_IS_WIDGET(handle) || !GTK_IS_WIDGET(item)) |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5547 return; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5548 |
30
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
22
diff
changeset
|
5549 DW_MUTEX_LOCK; |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
22
diff
changeset
|
5550 tree = (GtkWidget *)gtk_object_get_user_data(GTK_OBJECT(handle)); |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
22
diff
changeset
|
5551 if(!tree || !GTK_IS_TREE(tree)) |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
22
diff
changeset
|
5552 { |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
22
diff
changeset
|
5553 DW_MUTEX_UNLOCK; |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
22
diff
changeset
|
5554 return; |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
22
diff
changeset
|
5555 } |
54
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5556 |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
5557 lastselect = (GtkWidget *)gtk_object_get_data(GTK_OBJECT(tree), "_dw_lastselect"); |
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
5558 |
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
5559 parenttree = (GtkWidget *)gtk_object_get_data(GTK_OBJECT(item), "_dw_parenttree"); |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5560 |
54
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5561 if(lastselect == item) |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5562 { |
107
cd0e5cf92f6a
Rewrote the Windows packing code so it is more like OS/2 to improve window
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
96
diff
changeset
|
5563 gtk_tree_item_deselect(GTK_TREE_ITEM(lastselect)); |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
5564 gtk_object_set_data(GTK_OBJECT(tree), "_dw_lastselect", NULL); |
107
cd0e5cf92f6a
Rewrote the Windows packing code so it is more like OS/2 to improve window
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
96
diff
changeset
|
5565 } |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5566 |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5567 if(parenttree && GTK_IS_WIDGET(parenttree)) |
107
cd0e5cf92f6a
Rewrote the Windows packing code so it is more like OS/2 to improve window
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
96
diff
changeset
|
5568 gtk_container_remove(GTK_CONTAINER(parenttree), item); |
30
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
22
diff
changeset
|
5569 DW_MUTEX_UNLOCK; |
138
d22b50184e3b
Initial tree code for GTK 2.0, populating finished. Signal handlers and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
135
diff
changeset
|
5570 #endif |
30
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
22
diff
changeset
|
5571 } |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
22
diff
changeset
|
5572 |
258
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
5573 static int _dw_container_setup(HWND handle, unsigned long *flags, char **titles, int count, int separator, int extra) |
3 | 5574 { |
5575 GtkWidget *clist; | |
5576 char numbuf[10]; | |
350
2216e65ad2ae
Removed slider flags and container selection flags from the header file.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
346
diff
changeset
|
5577 int z, multi; |
3 | 5578 int _locked_by_me = FALSE; |
355
3a71623fc219
Changes to implement justification on container columns.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
354
diff
changeset
|
5579 GtkJustification justification; |
3 | 5580 |
5581 DW_MUTEX_LOCK; | |
5582 clist = gtk_clist_new_with_titles(count, (gchar **)titles); | |
5583 if(!clist) | |
5584 { | |
5585 DW_MUTEX_UNLOCK; | |
5586 return FALSE; | |
5587 } | |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
5588 multi = (int)gtk_object_get_data(GTK_OBJECT(handle), "_dw_multi"); |
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
5589 gtk_object_set_data(GTK_OBJECT(handle), "_dw_multi", (gpointer)multi); |
3 | 5590 |
5591 gtk_clist_set_column_auto_resize(GTK_CLIST(clist), 0, TRUE); | |
350
2216e65ad2ae
Removed slider flags and container selection flags from the header file.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
346
diff
changeset
|
5592 if(multi) |
2216e65ad2ae
Removed slider flags and container selection flags from the header file.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
346
diff
changeset
|
5593 gtk_clist_set_selection_mode(GTK_CLIST(clist), GTK_SELECTION_EXTENDED); |
2216e65ad2ae
Removed slider flags and container selection flags from the header file.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
346
diff
changeset
|
5594 else |
2216e65ad2ae
Removed slider flags and container selection flags from the header file.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
346
diff
changeset
|
5595 gtk_clist_set_selection_mode(GTK_CLIST(clist), GTK_SELECTION_SINGLE); |
3 | 5596 gtk_container_add(GTK_CONTAINER(handle), clist); |
5597 gtk_object_set_user_data(GTK_OBJECT(handle), (gpointer)clist); | |
5598 gtk_widget_show(clist); | |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
5599 gtk_object_set_data(GTK_OBJECT(clist), "_dw_colcount", (gpointer)count); |
3 | 5600 |
5601 if(extra) | |
5602 gtk_clist_set_column_width(GTK_CLIST(clist), 1, 120); | |
5603 | |
5604 for(z=0;z<count;z++) | |
5605 { | |
5606 if(!extra || z > 1) | |
5607 gtk_clist_set_column_width(GTK_CLIST(clist), z, 50); | |
5608 sprintf(numbuf, "%d", z); | |
5609 gtk_object_set_data(GTK_OBJECT(clist), numbuf, (gpointer)flags[z]); | |
355
3a71623fc219
Changes to implement justification on container columns.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
354
diff
changeset
|
5610 if(flags[z]&DW_CFA_RIGHT) |
3a71623fc219
Changes to implement justification on container columns.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
354
diff
changeset
|
5611 justification = GTK_JUSTIFY_RIGHT; |
3a71623fc219
Changes to implement justification on container columns.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
354
diff
changeset
|
5612 else if(flags[z]&DW_CFA_CENTER) |
3a71623fc219
Changes to implement justification on container columns.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
354
diff
changeset
|
5613 justification = GTK_JUSTIFY_CENTER; |
3a71623fc219
Changes to implement justification on container columns.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
354
diff
changeset
|
5614 else |
3a71623fc219
Changes to implement justification on container columns.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
354
diff
changeset
|
5615 justification = GTK_JUSTIFY_LEFT; |
3a71623fc219
Changes to implement justification on container columns.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
354
diff
changeset
|
5616 gtk_clist_set_column_justification(GTK_CLIST(clist),z,justification); |
3 | 5617 } |
5618 | |
5619 DW_MUTEX_UNLOCK; | |
5620 return TRUE; | |
5621 } | |
5622 | |
5623 /* | |
5624 * Sets up the container columns. | |
5625 * Parameters: | |
5626 * handle: Handle to the container to be configured. | |
5627 * flags: An array of unsigned longs with column flags. | |
5628 * titles: An array of strings with column text titles. | |
5629 * count: The number of columns (this should match the arrays). | |
5630 * separator: The column number that contains the main separator. | |
5631 * (this item may only be used in OS/2) | |
5632 */ | |
5633 int dw_container_setup(HWND handle, unsigned long *flags, char **titles, int count, int separator) | |
5634 { | |
5635 return _dw_container_setup(handle, flags, titles, count, separator, 0); | |
5636 } | |
5637 | |
5638 /* | |
5639 * Sets up the filesystem columns, note: filesystem always has an icon/filename field. | |
5640 * Parameters: | |
5641 * handle: Handle to the container to be configured. | |
5642 * flags: An array of unsigned longs with column flags. | |
5643 * titles: An array of strings with column text titles. | |
5644 * count: The number of columns (this should match the arrays). | |
5645 */ | |
5646 int dw_filesystem_setup(HWND handle, unsigned long *flags, char **titles, int count) | |
5647 { | |
472
d11be1f40f8c
Add support for column-click signal.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
464
diff
changeset
|
5648 char **newtitles = malloc(sizeof(char *) * (count + 1)); |
d11be1f40f8c
Add support for column-click signal.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
464
diff
changeset
|
5649 unsigned long *newflags = malloc(sizeof(unsigned long) * (count + 1)); |
d11be1f40f8c
Add support for column-click signal.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
464
diff
changeset
|
5650 |
d11be1f40f8c
Add support for column-click signal.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
464
diff
changeset
|
5651 newtitles[0] = "Filename"; |
d11be1f40f8c
Add support for column-click signal.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
464
diff
changeset
|
5652 |
d11be1f40f8c
Add support for column-click signal.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
464
diff
changeset
|
5653 newflags[0] = DW_CFA_STRINGANDICON | DW_CFA_LEFT | DW_CFA_HORZSEPARATOR; |
d11be1f40f8c
Add support for column-click signal.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
464
diff
changeset
|
5654 |
d11be1f40f8c
Add support for column-click signal.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
464
diff
changeset
|
5655 memcpy(&newtitles[1], titles, sizeof(char *) * count); |
d11be1f40f8c
Add support for column-click signal.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
464
diff
changeset
|
5656 memcpy(&newflags[1], flags, sizeof(unsigned long) * count); |
d11be1f40f8c
Add support for column-click signal.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
464
diff
changeset
|
5657 |
d11be1f40f8c
Add support for column-click signal.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
464
diff
changeset
|
5658 _dw_container_setup(handle, newflags, newtitles, count + 1, 1, 1); |
3 | 5659 |
5660 free(newtitles); | |
5661 free(newflags); | |
5662 return TRUE; | |
5663 } | |
5664 | |
5665 /* | |
5666 * Obtains an icon from a module (or header in GTK). | |
5667 * Parameters: | |
5668 * module: Handle to module (DLL) in OS/2 and Windows. | |
5669 * id: A unsigned long id int the resources on OS/2 and | |
5670 * Windows, on GTK this is converted to a pointer | |
5671 * to an embedded XPM. | |
5672 */ | |
5673 unsigned long dw_icon_load(unsigned long module, unsigned long id) | |
5674 { | |
5675 return id; | |
5676 } | |
5677 | |
5678 /* | |
257
9ea4ac9a097f
Added dw_icon_load_from_file() on OS/2 and Windows. Added a stub on Unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
256
diff
changeset
|
5679 * Obtains an icon from a file. |
9ea4ac9a097f
Added dw_icon_load_from_file() on OS/2 and Windows. Added a stub on Unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
256
diff
changeset
|
5680 * Parameters: |
9ea4ac9a097f
Added dw_icon_load_from_file() on OS/2 and Windows. Added a stub on Unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
256
diff
changeset
|
5681 * filename: Name of the file, omit extention to have |
9ea4ac9a097f
Added dw_icon_load_from_file() on OS/2 and Windows. Added a stub on Unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
256
diff
changeset
|
5682 * DW pick the appropriate file extension. |
9ea4ac9a097f
Added dw_icon_load_from_file() on OS/2 and Windows. Added a stub on Unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
256
diff
changeset
|
5683 * (ICO on OS/2 or Windows, XPM on Unix) |
9ea4ac9a097f
Added dw_icon_load_from_file() on OS/2 and Windows. Added a stub on Unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
256
diff
changeset
|
5684 */ |
9ea4ac9a097f
Added dw_icon_load_from_file() on OS/2 and Windows. Added a stub on Unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
256
diff
changeset
|
5685 unsigned long API dw_icon_load_from_file(char *filename) |
9ea4ac9a097f
Added dw_icon_load_from_file() on OS/2 and Windows. Added a stub on Unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
256
diff
changeset
|
5686 { |
265
84471d53ab58
Changes to dw_main_* so that the _dw_thread is set to -1 when the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
264
diff
changeset
|
5687 int found = -1, _locked_by_me = FALSE; |
258
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
5688 #if GTK_MAJOR_VERSION > 1 |
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
5689 GdkPixbuf *pixbuf; |
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
5690 #elif defined(USE_IMLIB) |
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
5691 GdkImlibImage *image; |
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
5692 #endif |
257
9ea4ac9a097f
Added dw_icon_load_from_file() on OS/2 and Windows. Added a stub on Unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
256
diff
changeset
|
5693 char *file = alloca(strlen(filename) + 5); |
265
84471d53ab58
Changes to dw_main_* so that the _dw_thread is set to -1 when the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
264
diff
changeset
|
5694 unsigned long z, ret = 0; |
257
9ea4ac9a097f
Added dw_icon_load_from_file() on OS/2 and Windows. Added a stub on Unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
256
diff
changeset
|
5695 |
258
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
5696 if (!file) |
257
9ea4ac9a097f
Added dw_icon_load_from_file() on OS/2 and Windows. Added a stub on Unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
256
diff
changeset
|
5697 return 0; |
9ea4ac9a097f
Added dw_icon_load_from_file() on OS/2 and Windows. Added a stub on Unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
256
diff
changeset
|
5698 |
9ea4ac9a097f
Added dw_icon_load_from_file() on OS/2 and Windows. Added a stub on Unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
256
diff
changeset
|
5699 strcpy(file, filename); |
9ea4ac9a097f
Added dw_icon_load_from_file() on OS/2 and Windows. Added a stub on Unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
256
diff
changeset
|
5700 |
9ea4ac9a097f
Added dw_icon_load_from_file() on OS/2 and Windows. Added a stub on Unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
256
diff
changeset
|
5701 /* check if we can read from this file (it exists and read permission) */ |
9ea4ac9a097f
Added dw_icon_load_from_file() on OS/2 and Windows. Added a stub on Unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
256
diff
changeset
|
5702 if(access(file, 04) != 0) |
9ea4ac9a097f
Added dw_icon_load_from_file() on OS/2 and Windows. Added a stub on Unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
256
diff
changeset
|
5703 { |
258
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
5704 /* Try with .xpm extention */ |
257
9ea4ac9a097f
Added dw_icon_load_from_file() on OS/2 and Windows. Added a stub on Unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
256
diff
changeset
|
5705 strcat(file, ".xpm"); |
9ea4ac9a097f
Added dw_icon_load_from_file() on OS/2 and Windows. Added a stub on Unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
256
diff
changeset
|
5706 if(access(file, 04) != 0) |
9ea4ac9a097f
Added dw_icon_load_from_file() on OS/2 and Windows. Added a stub on Unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
256
diff
changeset
|
5707 return 0; |
9ea4ac9a097f
Added dw_icon_load_from_file() on OS/2 and Windows. Added a stub on Unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
256
diff
changeset
|
5708 } |
258
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
5709 |
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
5710 DW_MUTEX_LOCK; |
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
5711 /* Find a free entry in the array */ |
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
5712 for(z=0;z<_PixmapCount;z++) |
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
5713 { |
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
5714 if(!_PixmapArray[z].used) |
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
5715 { |
265
84471d53ab58
Changes to dw_main_* so that the _dw_thread is set to -1 when the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
264
diff
changeset
|
5716 ret = found = z; |
258
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
5717 break; |
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
5718 } |
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
5719 } |
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
5720 |
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
5721 /* If there are no free entries, expand the |
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
5722 * array. |
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
5723 */ |
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
5724 if(found == -1) |
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
5725 { |
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
5726 DWPrivatePixmap *old = _PixmapArray; |
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
5727 |
265
84471d53ab58
Changes to dw_main_* so that the _dw_thread is set to -1 when the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
264
diff
changeset
|
5728 ret = found = _PixmapCount; |
258
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
5729 _PixmapCount++; |
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
5730 |
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
5731 _PixmapArray = malloc(sizeof(DWPrivatePixmap) * _PixmapCount); |
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
5732 |
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
5733 if(found) |
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
5734 memcpy(_PixmapArray, old, sizeof(DWPrivatePixmap) * found); |
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
5735 if(old) |
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
5736 free(old); |
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
5737 _PixmapArray[found].used = 1; |
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
5738 _PixmapArray[found].pixmap = _PixmapArray[found].mask = NULL; |
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
5739 } |
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
5740 |
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
5741 #if GTK_MAJOR_VERSION > 1 |
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
5742 pixbuf = gdk_pixbuf_new_from_file(file, NULL); |
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
5743 |
265
84471d53ab58
Changes to dw_main_* so that the _dw_thread is set to -1 when the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
264
diff
changeset
|
5744 if(pixbuf) |
84471d53ab58
Changes to dw_main_* so that the _dw_thread is set to -1 when the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
264
diff
changeset
|
5745 { |
316
a07e08f708d6
Fixed icons in the tree control in GTK 2.x when loaded from a file.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
312
diff
changeset
|
5746 _PixmapArray[found].pixbuf = pixbuf; |
265
84471d53ab58
Changes to dw_main_* so that the _dw_thread is set to -1 when the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
264
diff
changeset
|
5747 _PixmapArray[found].width = gdk_pixbuf_get_width(pixbuf); |
84471d53ab58
Changes to dw_main_* so that the _dw_thread is set to -1 when the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
264
diff
changeset
|
5748 _PixmapArray[found].height = gdk_pixbuf_get_height(pixbuf); |
84471d53ab58
Changes to dw_main_* so that the _dw_thread is set to -1 when the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
264
diff
changeset
|
5749 |
84471d53ab58
Changes to dw_main_* so that the _dw_thread is set to -1 when the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
264
diff
changeset
|
5750 gdk_pixbuf_render_pixmap_and_mask(pixbuf, &_PixmapArray[found].pixmap, &_PixmapArray[found].mask, 1); |
84471d53ab58
Changes to dw_main_* so that the _dw_thread is set to -1 when the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
264
diff
changeset
|
5751 } |
258
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
5752 #elif defined(USE_IMLIB) |
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
5753 image = gdk_imlib_load_image(file); |
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
5754 |
265
84471d53ab58
Changes to dw_main_* so that the _dw_thread is set to -1 when the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
264
diff
changeset
|
5755 if(image) |
84471d53ab58
Changes to dw_main_* so that the _dw_thread is set to -1 when the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
264
diff
changeset
|
5756 { |
84471d53ab58
Changes to dw_main_* so that the _dw_thread is set to -1 when the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
264
diff
changeset
|
5757 _PixmapArray[found].width = image->rgb_width; |
84471d53ab58
Changes to dw_main_* so that the _dw_thread is set to -1 when the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
264
diff
changeset
|
5758 _PixmapArray[found].height = image->rgb_height; |
84471d53ab58
Changes to dw_main_* so that the _dw_thread is set to -1 when the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
264
diff
changeset
|
5759 |
84471d53ab58
Changes to dw_main_* so that the _dw_thread is set to -1 when the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
264
diff
changeset
|
5760 gdk_imlib_render(image, image->rgb_width, image->rgb_height); |
84471d53ab58
Changes to dw_main_* so that the _dw_thread is set to -1 when the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
264
diff
changeset
|
5761 _PixmapArray[found].pixmap = gdk_imlib_copy_image(image); |
84471d53ab58
Changes to dw_main_* so that the _dw_thread is set to -1 when the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
264
diff
changeset
|
5762 _PixmapArray[found].mask = gdk_imlib_copy_mask(image); |
84471d53ab58
Changes to dw_main_* so that the _dw_thread is set to -1 when the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
264
diff
changeset
|
5763 gdk_imlib_destroy_image(image); |
84471d53ab58
Changes to dw_main_* so that the _dw_thread is set to -1 when the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
264
diff
changeset
|
5764 } |
258
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
5765 #else |
296
d2392cf845e4
Fix crash if dw_icon_load_from_file() called before creating a toplevel
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
285
diff
changeset
|
5766 if (last_window) |
d2392cf845e4
Fix crash if dw_icon_load_from_file() called before creating a toplevel
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
285
diff
changeset
|
5767 _PixmapArray[found].pixmap = gdk_pixmap_create_from_xpm(last_window->window, &_PixmapArray[found].mask, &_colors[DW_CLR_PALEGRAY], file); |
258
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
5768 #endif |
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
5769 DW_MUTEX_UNLOCK; |
265
84471d53ab58
Changes to dw_main_* so that the _dw_thread is set to -1 when the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
264
diff
changeset
|
5770 if(!_PixmapArray[found].pixmap || !_PixmapArray[found].mask) |
84471d53ab58
Changes to dw_main_* so that the _dw_thread is set to -1 when the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
264
diff
changeset
|
5771 { |
84471d53ab58
Changes to dw_main_* so that the _dw_thread is set to -1 when the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
264
diff
changeset
|
5772 _PixmapArray[found].used = 0; |
84471d53ab58
Changes to dw_main_* so that the _dw_thread is set to -1 when the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
264
diff
changeset
|
5773 _PixmapArray[found].pixmap = _PixmapArray[found].mask = NULL; |
84471d53ab58
Changes to dw_main_* so that the _dw_thread is set to -1 when the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
264
diff
changeset
|
5774 return 0; |
84471d53ab58
Changes to dw_main_* so that the _dw_thread is set to -1 when the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
264
diff
changeset
|
5775 } |
84471d53ab58
Changes to dw_main_* so that the _dw_thread is set to -1 when the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
264
diff
changeset
|
5776 return ret | (1 << 31); |
257
9ea4ac9a097f
Added dw_icon_load_from_file() on OS/2 and Windows. Added a stub on Unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
256
diff
changeset
|
5777 } |
9ea4ac9a097f
Added dw_icon_load_from_file() on OS/2 and Windows. Added a stub on Unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
256
diff
changeset
|
5778 |
9ea4ac9a097f
Added dw_icon_load_from_file() on OS/2 and Windows. Added a stub on Unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
256
diff
changeset
|
5779 /* |
3 | 5780 * Frees a loaded resource in OS/2 and Windows. |
5781 * Parameters: | |
5782 * handle: Handle to icon returned by dw_icon_load(). | |
5783 */ | |
5784 void dw_icon_free(unsigned long handle) | |
5785 { | |
258
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
5786 /* If it is a private icon, find the item |
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
5787 * free the associated structures and set |
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
5788 * the entry to unused. |
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
5789 */ |
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
5790 if(handle & (1 << 31)) |
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
5791 { |
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
5792 unsigned long id = handle & 0xFFFFFF; |
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
5793 |
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
5794 if(id < _PixmapCount && _PixmapArray[id].used) |
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
5795 { |
316
a07e08f708d6
Fixed icons in the tree control in GTK 2.x when loaded from a file.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
312
diff
changeset
|
5796 #if GTK_MAJOR_VERSION > 1 |
a07e08f708d6
Fixed icons in the tree control in GTK 2.x when loaded from a file.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
312
diff
changeset
|
5797 if(_PixmapArray[id].pixbuf) |
a07e08f708d6
Fixed icons in the tree control in GTK 2.x when loaded from a file.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
312
diff
changeset
|
5798 { |
a07e08f708d6
Fixed icons in the tree control in GTK 2.x when loaded from a file.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
312
diff
changeset
|
5799 g_object_unref(_PixmapArray[id].pixbuf); |
a07e08f708d6
Fixed icons in the tree control in GTK 2.x when loaded from a file.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
312
diff
changeset
|
5800 _PixmapArray[id].pixbuf = NULL; |
a07e08f708d6
Fixed icons in the tree control in GTK 2.x when loaded from a file.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
312
diff
changeset
|
5801 } |
a07e08f708d6
Fixed icons in the tree control in GTK 2.x when loaded from a file.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
312
diff
changeset
|
5802 #endif |
258
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
5803 if(_PixmapArray[id].mask) |
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
5804 { |
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
5805 gdk_bitmap_unref(_PixmapArray[id].mask); |
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
5806 _PixmapArray[id].mask = NULL; |
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
5807 } |
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
5808 if(_PixmapArray[id].pixmap) |
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
5809 { |
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
5810 gdk_pixmap_unref(_PixmapArray[id].pixmap); |
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
5811 _PixmapArray[id].pixmap = NULL; |
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
5812 } |
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
5813 _PixmapArray[id].used = 0; |
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
5814 } |
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
5815 } |
3 | 5816 } |
5817 | |
72
ab77a22a2a36
Added localization APIs as well as some miscellaneous bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
5818 /* Clears a CList selection and associated selection list */ |
ab77a22a2a36
Added localization APIs as well as some miscellaneous bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
5819 void _dw_unselect(GtkWidget *clist) |
ab77a22a2a36
Added localization APIs as well as some miscellaneous bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
5820 { |
ab77a22a2a36
Added localization APIs as well as some miscellaneous bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
5821 gtk_clist_unselect_all(GTK_CLIST(clist)); |
ab77a22a2a36
Added localization APIs as well as some miscellaneous bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
5822 } |
ab77a22a2a36
Added localization APIs as well as some miscellaneous bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
5823 |
3 | 5824 /* |
5825 * Allocates memory used to populate a container. | |
5826 * Parameters: | |
5827 * handle: Handle to the container window (widget). | |
5828 * rowcount: The number of items to be populated. | |
5829 */ | |
5830 void *dw_container_alloc(HWND handle, int rowcount) | |
5831 { | |
5832 int z, count = 0; | |
5833 GtkWidget *clist; | |
14
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
5834 GdkColor *fore, *back; |
3 | 5835 char **blah; |
5836 int _locked_by_me = FALSE; | |
5837 | |
5838 DW_MUTEX_LOCK; | |
5839 clist = (GtkWidget *)gtk_object_get_user_data(GTK_OBJECT(handle)); | |
5840 if(!clist) | |
5841 { | |
5842 DW_MUTEX_UNLOCK; | |
5843 return NULL; | |
5844 } | |
5845 | |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
5846 count = (int)gtk_object_get_data(GTK_OBJECT(clist), "_dw_colcount"); |
3 | 5847 |
5848 if(!count) | |
5849 { | |
5850 DW_MUTEX_UNLOCK; | |
5851 return NULL; | |
5852 } | |
5853 | |
5854 blah = malloc(sizeof(char *) * count); | |
5855 memset(blah, 0, sizeof(char *) * count); | |
5856 | |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
5857 fore = (GdkColor *)gtk_object_get_data(GTK_OBJECT(clist), "_dw_foregdk"); |
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
5858 back = (GdkColor *)gtk_object_get_data(GTK_OBJECT(clist), "_dw_backgdk"); |
3 | 5859 gtk_clist_freeze(GTK_CLIST(clist)); |
5860 for(z=0;z<rowcount;z++) | |
5861 { | |
5862 gtk_clist_append(GTK_CLIST(clist), blah); | |
14
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
5863 if(fore) |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
5864 gtk_clist_set_foreground(GTK_CLIST(clist), z, fore); |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
5865 if(back) |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
5866 gtk_clist_set_background(GTK_CLIST(clist), z, back); |
3 | 5867 } |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
5868 gtk_object_set_data(GTK_OBJECT(clist), "_dw_rowcount", (gpointer)rowcount); |
3 | 5869 free(blah); |
5870 DW_MUTEX_UNLOCK; | |
5871 return (void *)handle; | |
5872 } | |
5873 | |
5874 /* | |
472
d11be1f40f8c
Add support for column-click signal.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
464
diff
changeset
|
5875 * Internal representation of dw_container_set_item() extracted so we can pass |
d11be1f40f8c
Add support for column-click signal.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
464
diff
changeset
|
5876 * two data pointers; icon and text for dw_filesystem_set_item(). |
d11be1f40f8c
Add support for column-click signal.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
464
diff
changeset
|
5877 */ |
d11be1f40f8c
Add support for column-click signal.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
464
diff
changeset
|
5878 void _dw_container_set_item(HWND handle, void *pointer, int column, int row, void *data, char *text) |
3 | 5879 { |
5880 char numbuf[10], textbuffer[100]; | |
5881 int flag = 0; | |
5882 GtkWidget *clist; | |
5883 int _locked_by_me = FALSE; | |
5884 | |
5885 DW_MUTEX_LOCK; | |
5886 clist = (GtkWidget *)gtk_object_get_user_data(GTK_OBJECT(handle)); | |
5887 if(!clist) | |
5888 { | |
5889 DW_MUTEX_UNLOCK; | |
5890 return; | |
5891 } | |
5892 | |
5893 sprintf(numbuf, "%d", column); | |
5894 flag = (int)gtk_object_get_data(GTK_OBJECT(clist), numbuf); | |
5895 | |
5896 if(flag & DW_CFA_BITMAPORICON) | |
5897 { | |
5898 long hicon = *((long *)data); | |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5899 GdkBitmap *bitmap = NULL; |
121
d8af32b1b1cd
Switch back to using pixmaps and bitmaps, only use pixbufs for doing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
120
diff
changeset
|
5900 GdkPixmap *pixmap = _find_pixmap(&bitmap, hicon, clist, NULL, NULL); |
d8af32b1b1cd
Switch back to using pixmaps and bitmaps, only use pixbufs for doing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
120
diff
changeset
|
5901 |
3 | 5902 if(pixmap) |
5903 gtk_clist_set_pixmap(GTK_CLIST(clist), row, column, pixmap, bitmap); | |
5904 } | |
472
d11be1f40f8c
Add support for column-click signal.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
464
diff
changeset
|
5905 else if(flag & DW_CFA_STRINGANDICON) |
d11be1f40f8c
Add support for column-click signal.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
464
diff
changeset
|
5906 { |
d11be1f40f8c
Add support for column-click signal.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
464
diff
changeset
|
5907 long hicon = *((long *)data); |
d11be1f40f8c
Add support for column-click signal.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
464
diff
changeset
|
5908 GdkBitmap *bitmap = NULL; |
d11be1f40f8c
Add support for column-click signal.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
464
diff
changeset
|
5909 GdkPixmap *pixmap = _find_pixmap(&bitmap, hicon, clist, NULL, NULL); |
d11be1f40f8c
Add support for column-click signal.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
464
diff
changeset
|
5910 |
d11be1f40f8c
Add support for column-click signal.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
464
diff
changeset
|
5911 if(pixmap) |
d11be1f40f8c
Add support for column-click signal.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
464
diff
changeset
|
5912 gtk_clist_set_pixtext(GTK_CLIST(clist), row, column, text, 2, pixmap, bitmap); |
d11be1f40f8c
Add support for column-click signal.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
464
diff
changeset
|
5913 } |
3 | 5914 else if(flag & DW_CFA_STRING) |
5915 { | |
5916 char *tmp = *((char **)data); | |
5917 gtk_clist_set_text(GTK_CLIST(clist), row, column, tmp); | |
5918 } | |
5919 else if(flag & DW_CFA_ULONG) | |
5920 { | |
5921 ULONG tmp = *((ULONG *)data); | |
5922 | |
5923 sprintf(textbuffer, "%lu", tmp); | |
5924 | |
5925 gtk_clist_set_text(GTK_CLIST(clist), row, column, textbuffer); | |
5926 } | |
5927 else if(flag & DW_CFA_DATE) | |
5928 { | |
165
d03716228b7f
Use strftime to display time and date on Windows and unix.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
164
diff
changeset
|
5929 struct tm curtm; |
d03716228b7f
Use strftime to display time and date on Windows and unix.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
164
diff
changeset
|
5930 CDATE cdate = *((CDATE *)data); |
d03716228b7f
Use strftime to display time and date on Windows and unix.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
164
diff
changeset
|
5931 |
d03716228b7f
Use strftime to display time and date on Windows and unix.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
164
diff
changeset
|
5932 curtm.tm_mday = cdate.day; |
d03716228b7f
Use strftime to display time and date on Windows and unix.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
164
diff
changeset
|
5933 curtm.tm_mon = cdate.month - 1; |
d03716228b7f
Use strftime to display time and date on Windows and unix.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
164
diff
changeset
|
5934 curtm.tm_year = cdate.year - 1900; |
d03716228b7f
Use strftime to display time and date on Windows and unix.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
164
diff
changeset
|
5935 |
d03716228b7f
Use strftime to display time and date on Windows and unix.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
164
diff
changeset
|
5936 strftime(textbuffer, 100, "%x", &curtm); |
46
30d091bc7899
Fixed an error in the container date code on Windows and Unix.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
41
diff
changeset
|
5937 |
3 | 5938 gtk_clist_set_text(GTK_CLIST(clist), row, column, textbuffer); |
5939 } | |
5940 else if(flag & DW_CFA_TIME) | |
5941 { | |
165
d03716228b7f
Use strftime to display time and date on Windows and unix.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
164
diff
changeset
|
5942 struct tm curtm; |
d03716228b7f
Use strftime to display time and date on Windows and unix.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
164
diff
changeset
|
5943 CTIME ctime = *((CTIME *)data); |
d03716228b7f
Use strftime to display time and date on Windows and unix.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
164
diff
changeset
|
5944 |
d03716228b7f
Use strftime to display time and date on Windows and unix.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
164
diff
changeset
|
5945 curtm.tm_hour = ctime.hours; |
d03716228b7f
Use strftime to display time and date on Windows and unix.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
164
diff
changeset
|
5946 curtm.tm_min = ctime.minutes; |
d03716228b7f
Use strftime to display time and date on Windows and unix.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
164
diff
changeset
|
5947 curtm.tm_sec = ctime.seconds; |
d03716228b7f
Use strftime to display time and date on Windows and unix.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
164
diff
changeset
|
5948 |
d03716228b7f
Use strftime to display time and date on Windows and unix.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
164
diff
changeset
|
5949 strftime(textbuffer, 100, "%X", &curtm); |
d03716228b7f
Use strftime to display time and date on Windows and unix.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
164
diff
changeset
|
5950 |
3 | 5951 gtk_clist_set_text(GTK_CLIST(clist), row, column, textbuffer); |
5952 } | |
5953 DW_MUTEX_UNLOCK; | |
5954 } | |
5955 | |
5956 /* | |
472
d11be1f40f8c
Add support for column-click signal.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
464
diff
changeset
|
5957 * Sets an item in specified row and column to the given data. |
d11be1f40f8c
Add support for column-click signal.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
464
diff
changeset
|
5958 * Parameters: |
d11be1f40f8c
Add support for column-click signal.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
464
diff
changeset
|
5959 * handle: Handle to the container window (widget). |
d11be1f40f8c
Add support for column-click signal.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
464
diff
changeset
|
5960 * pointer: Pointer to the allocated memory in dw_container_alloc(). |
d11be1f40f8c
Add support for column-click signal.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
464
diff
changeset
|
5961 * column: Zero based column of data being set. |
d11be1f40f8c
Add support for column-click signal.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
464
diff
changeset
|
5962 * row: Zero based row of data being set. |
d11be1f40f8c
Add support for column-click signal.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
464
diff
changeset
|
5963 * data: Pointer to the data to be added. |
d11be1f40f8c
Add support for column-click signal.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
464
diff
changeset
|
5964 */ |
d11be1f40f8c
Add support for column-click signal.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
464
diff
changeset
|
5965 void dw_container_set_item(HWND handle, void *pointer, int column, int row, void *data) |
d11be1f40f8c
Add support for column-click signal.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
464
diff
changeset
|
5966 { |
d11be1f40f8c
Add support for column-click signal.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
464
diff
changeset
|
5967 _dw_container_set_item(handle, NULL, column, row, data, NULL); |
d11be1f40f8c
Add support for column-click signal.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
464
diff
changeset
|
5968 } |
d11be1f40f8c
Add support for column-click signal.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
464
diff
changeset
|
5969 |
d11be1f40f8c
Add support for column-click signal.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
464
diff
changeset
|
5970 /* |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
5971 * Changes an existing item in specified row and column to the given data. |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
5972 * Parameters: |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
5973 * handle: Handle to the container window (widget). |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
5974 * column: Zero based column of data being set. |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
5975 * row: Zero based row of data being set. |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
5976 * data: Pointer to the data to be added. |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
5977 */ |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
5978 void dw_container_change_item(HWND handle, int column, int row, void *data) |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
5979 { |
472
d11be1f40f8c
Add support for column-click signal.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
464
diff
changeset
|
5980 _dw_container_set_item(handle, NULL, column, row, data, NULL); |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
5981 } |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
5982 |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
5983 /* |
503
f3ed8dda02f8
Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
501
diff
changeset
|
5984 * Changes an existing item in specified row and column to the given data. |
f3ed8dda02f8
Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
501
diff
changeset
|
5985 * Parameters: |
f3ed8dda02f8
Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
501
diff
changeset
|
5986 * handle: Handle to the container window (widget). |
f3ed8dda02f8
Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
501
diff
changeset
|
5987 * column: Zero based column of data being set. |
f3ed8dda02f8
Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
501
diff
changeset
|
5988 * row: Zero based row of data being set. |
f3ed8dda02f8
Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
501
diff
changeset
|
5989 * data: Pointer to the data to be added. |
f3ed8dda02f8
Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
501
diff
changeset
|
5990 */ |
f3ed8dda02f8
Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
501
diff
changeset
|
5991 void API dw_filesystem_change_item(HWND handle, int column, int row, void *data) |
f3ed8dda02f8
Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
501
diff
changeset
|
5992 { |
504
7061da3532d7
Fix minor error in new dw_filesystem_change_*() code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
503
diff
changeset
|
5993 dw_filesystem_set_item(handle, NULL, column, row, data); |
503
f3ed8dda02f8
Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
501
diff
changeset
|
5994 } |
f3ed8dda02f8
Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
501
diff
changeset
|
5995 |
f3ed8dda02f8
Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
501
diff
changeset
|
5996 /* |
f3ed8dda02f8
Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
501
diff
changeset
|
5997 * Changes an item in specified row and column to the given data. |
f3ed8dda02f8
Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
501
diff
changeset
|
5998 * Parameters: |
f3ed8dda02f8
Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
501
diff
changeset
|
5999 * handle: Handle to the container window (widget). |
f3ed8dda02f8
Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
501
diff
changeset
|
6000 * pointer: Pointer to the allocated memory in dw_container_alloc(). |
f3ed8dda02f8
Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
501
diff
changeset
|
6001 * column: Zero based column of data being set. |
f3ed8dda02f8
Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
501
diff
changeset
|
6002 * row: Zero based row of data being set. |
f3ed8dda02f8
Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
501
diff
changeset
|
6003 * data: Pointer to the data to be added. |
f3ed8dda02f8
Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
501
diff
changeset
|
6004 */ |
f3ed8dda02f8
Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
501
diff
changeset
|
6005 void API dw_filesystem_change_file(HWND handle, int row, char *filename, unsigned long icon) |
f3ed8dda02f8
Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
501
diff
changeset
|
6006 { |
504
7061da3532d7
Fix minor error in new dw_filesystem_change_*() code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
503
diff
changeset
|
6007 dw_filesystem_set_file(handle, NULL, row, filename, icon); |
503
f3ed8dda02f8
Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
501
diff
changeset
|
6008 } |
f3ed8dda02f8
Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
501
diff
changeset
|
6009 |
f3ed8dda02f8
Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
501
diff
changeset
|
6010 /* |
3 | 6011 * Sets an item in specified row and column to the given data. |
6012 * Parameters: | |
6013 * handle: Handle to the container window (widget). | |
6014 * pointer: Pointer to the allocated memory in dw_container_alloc(). | |
6015 * column: Zero based column of data being set. | |
6016 * row: Zero based row of data being set. | |
6017 * data: Pointer to the data to be added. | |
6018 */ | |
6019 void dw_filesystem_set_file(HWND handle, void *pointer, int row, char *filename, unsigned long icon) | |
6020 { | |
472
d11be1f40f8c
Add support for column-click signal.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
464
diff
changeset
|
6021 _dw_container_set_item(handle, pointer, 0, row, (void *)&icon, filename); |
3 | 6022 } |
6023 | |
6024 /* | |
6025 * Sets an item in specified row and column to the given data. | |
6026 * Parameters: | |
6027 * handle: Handle to the container window (widget). | |
6028 * pointer: Pointer to the allocated memory in dw_container_alloc(). | |
6029 * column: Zero based column of data being set. | |
6030 * row: Zero based row of data being set. | |
6031 * data: Pointer to the data to be added. | |
6032 */ | |
6033 void dw_filesystem_set_item(HWND handle, void *pointer, int column, int row, void *data) | |
6034 { | |
472
d11be1f40f8c
Add support for column-click signal.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
464
diff
changeset
|
6035 _dw_container_set_item(handle, pointer, column + 1, row, data, NULL); |
3 | 6036 } |
6037 | |
6038 /* | |
508
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
504
diff
changeset
|
6039 * Gets column type for a container column |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
504
diff
changeset
|
6040 * Parameters: |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
504
diff
changeset
|
6041 * handle: Handle to the container window (widget). |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
504
diff
changeset
|
6042 * column: Zero based column. |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
504
diff
changeset
|
6043 */ |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
504
diff
changeset
|
6044 int dw_container_get_column_type(HWND handle, int column) |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
504
diff
changeset
|
6045 { |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
504
diff
changeset
|
6046 char numbuf[10]; |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
504
diff
changeset
|
6047 int flag, rc; |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
504
diff
changeset
|
6048 GtkWidget *clist; |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
504
diff
changeset
|
6049 int _locked_by_me = FALSE; |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
504
diff
changeset
|
6050 |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
504
diff
changeset
|
6051 DW_MUTEX_LOCK; |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
504
diff
changeset
|
6052 clist = (GtkWidget *)gtk_object_get_user_data(GTK_OBJECT(handle)); |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
504
diff
changeset
|
6053 if(!clist) |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
504
diff
changeset
|
6054 { |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
504
diff
changeset
|
6055 DW_MUTEX_UNLOCK; |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
504
diff
changeset
|
6056 return 0; |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
504
diff
changeset
|
6057 } |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
504
diff
changeset
|
6058 |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
504
diff
changeset
|
6059 sprintf(numbuf, "%d", column); |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
504
diff
changeset
|
6060 flag = (int)gtk_object_get_data(GTK_OBJECT(clist), numbuf); |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
504
diff
changeset
|
6061 |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
504
diff
changeset
|
6062 if(flag & DW_CFA_BITMAPORICON) |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
504
diff
changeset
|
6063 rc = DW_CFA_BITMAPORICON; |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
504
diff
changeset
|
6064 else if(flag & DW_CFA_STRING) |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
504
diff
changeset
|
6065 rc = DW_CFA_STRING; |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
504
diff
changeset
|
6066 else if(flag & DW_CFA_ULONG) |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
504
diff
changeset
|
6067 rc = DW_CFA_ULONG; |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
504
diff
changeset
|
6068 else if(flag & DW_CFA_DATE) |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
504
diff
changeset
|
6069 rc = DW_CFA_DATE; |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
504
diff
changeset
|
6070 else if(flag & DW_CFA_TIME) |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
504
diff
changeset
|
6071 rc = DW_CFA_TIME; |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
504
diff
changeset
|
6072 else |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
504
diff
changeset
|
6073 rc = 0; |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
504
diff
changeset
|
6074 DW_MUTEX_UNLOCK; |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
504
diff
changeset
|
6075 return rc; |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
504
diff
changeset
|
6076 } |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
504
diff
changeset
|
6077 |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
504
diff
changeset
|
6078 /* |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
504
diff
changeset
|
6079 * Gets column type for a filesystem container column |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
504
diff
changeset
|
6080 * Parameters: |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
504
diff
changeset
|
6081 * handle: Handle to the container window (widget). |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
504
diff
changeset
|
6082 * column: Zero based column. |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
504
diff
changeset
|
6083 */ |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
504
diff
changeset
|
6084 int API dw_filesystem_get_column_type(HWND handle, int column) |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
504
diff
changeset
|
6085 { |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
504
diff
changeset
|
6086 return dw_container_get_column_type( handle, column + 1 ); |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
504
diff
changeset
|
6087 } |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
504
diff
changeset
|
6088 |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
504
diff
changeset
|
6089 /* |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
6090 * Sets the width of a column in the container. |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
6091 * Parameters: |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
6092 * handle: Handle to window (widget) of container. |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
6093 * column: Zero based column of width being set. |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
6094 * width: Width of column in pixels. |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
6095 */ |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
6096 void dw_container_set_column_width(HWND handle, int column, int width) |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
6097 { |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
6098 GtkWidget *clist; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
6099 int _locked_by_me = FALSE; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
6100 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
6101 DW_MUTEX_LOCK; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
6102 clist = gtk_object_get_user_data(GTK_OBJECT(handle)); |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
6103 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
6104 if(clist && GTK_IS_CLIST(clist)) |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
6105 gtk_clist_set_column_width(GTK_CLIST(clist), column, width); |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
6106 DW_MUTEX_UNLOCK; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
6107 } |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
6108 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
6109 /* |
3 | 6110 * Sets the title of a row in the container. |
6111 * Parameters: | |
6112 * pointer: Pointer to the allocated memory in dw_container_alloc(). | |
6113 * row: Zero based row of data being set. | |
6114 * title: String title of the item. | |
6115 */ | |
6116 void dw_container_set_row_title(void *pointer, int row, char *title) | |
6117 { | |
6118 GtkWidget *clist; | |
6119 int _locked_by_me = FALSE; | |
6120 | |
6121 DW_MUTEX_LOCK; | |
6122 clist = (GtkWidget *)gtk_object_get_user_data(GTK_OBJECT(pointer)); | |
6123 | |
6124 if(clist) | |
6125 gtk_clist_set_row_data(GTK_CLIST(clist), row, (gpointer)title); | |
6126 DW_MUTEX_UNLOCK; | |
6127 } | |
6128 | |
6129 /* | |
6130 * Sets the title of a row in the container. | |
6131 * Parameters: | |
6132 * handle: Handle to the container window (widget). | |
6133 * pointer: Pointer to the allocated memory in dw_container_alloc(). | |
6134 * rowcount: The number of rows to be inserted. | |
6135 */ | |
6136 void dw_container_insert(HWND handle, void *pointer, int rowcount) | |
6137 { | |
6138 GtkWidget *clist; | |
6139 int _locked_by_me = FALSE; | |
6140 | |
6141 DW_MUTEX_LOCK; | |
6142 clist = gtk_object_get_user_data(GTK_OBJECT(handle)); | |
6143 | |
6144 if(clist && GTK_IS_CLIST(clist)) | |
6145 gtk_clist_thaw(GTK_CLIST(clist)); | |
6146 DW_MUTEX_UNLOCK; | |
6147 } | |
6148 | |
6149 /* | |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
6150 * Removes the first x rows from a container. |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
6151 * Parameters: |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
6152 * handle: Handle to the window (widget) to be deleted from. |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
6153 * rowcount: The number of rows to be deleted. |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
6154 */ |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
6155 void dw_container_delete(HWND handle, int rowcount) |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
6156 { |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
6157 GtkWidget *clist; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
6158 int _locked_by_me = FALSE; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
6159 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
6160 DW_MUTEX_LOCK; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
6161 clist = (GtkWidget*)gtk_object_get_user_data(GTK_OBJECT(handle)); |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
6162 if(clist && GTK_IS_CLIST(clist)) |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
6163 { |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
6164 int rows, z; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
6165 |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
6166 rows = (int)gtk_object_get_data(GTK_OBJECT(clist), "_dw_rowcount"); |
72
ab77a22a2a36
Added localization APIs as well as some miscellaneous bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
6167 |
ab77a22a2a36
Added localization APIs as well as some miscellaneous bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
6168 _dw_unselect(clist); |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
6169 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
6170 for(z=0;z<rowcount;z++) |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
6171 gtk_clist_remove(GTK_CLIST(clist), 0); |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
6172 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
6173 if(rows - rowcount < 0) |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
6174 rows = 0; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
6175 else |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
6176 rows -= rowcount; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
6177 |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
6178 gtk_object_set_data(GTK_OBJECT(clist), "_dw_rowcount", (gpointer)rows); |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
6179 } |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
6180 DW_MUTEX_UNLOCK; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
6181 } |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
6182 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
6183 /* |
3 | 6184 * Removes all rows from a container. |
6185 * Parameters: | |
6186 * handle: Handle to the window (widget) to be cleared. | |
52
0804483f6320
Added a redraw parameter to dw_container_clear().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
51
diff
changeset
|
6187 * redraw: TRUE to cause the container to redraw immediately. |
3 | 6188 */ |
52
0804483f6320
Added a redraw parameter to dw_container_clear().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
51
diff
changeset
|
6189 void dw_container_clear(HWND handle, int redraw) |
3 | 6190 { |
6191 GtkWidget *clist; | |
6192 int _locked_by_me = FALSE; | |
6193 | |
6194 DW_MUTEX_LOCK; | |
6195 clist = (GtkWidget*)gtk_object_get_user_data(GTK_OBJECT(handle)); | |
6196 if(clist && GTK_IS_CLIST(clist)) | |
6197 { | |
72
ab77a22a2a36
Added localization APIs as well as some miscellaneous bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
6198 _dw_unselect(clist); |
3 | 6199 gtk_clist_clear(GTK_CLIST(clist)); |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
6200 gtk_object_set_data(GTK_OBJECT(clist), "_dw_rowcount", (gpointer)0); |
3 | 6201 } |
6202 DW_MUTEX_UNLOCK; | |
6203 } | |
6204 | |
6205 /* | |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
6206 * Scrolls container up or down. |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
6207 * Parameters: |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
6208 * handle: Handle to the window (widget) to be scrolled. |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
6209 * direction: DW_SCROLL_UP, DW_SCROLL_DOWN, DW_SCROLL_TOP or |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
6210 * DW_SCROLL_BOTTOM. (rows is ignored for last two) |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
6211 * rows: The number of rows to be scrolled. |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
6212 */ |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
6213 void dw_container_scroll(HWND handle, int direction, long rows) |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
6214 { |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
6215 GtkAdjustment *adj; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
6216 GtkWidget *clist; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
6217 int _locked_by_me = FALSE; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
6218 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
6219 DW_MUTEX_LOCK; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
6220 clist = (GtkWidget*)gtk_object_get_user_data(GTK_OBJECT(handle)); |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
6221 if(clist && GTK_IS_CLIST(clist)) |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
6222 { |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
6223 adj = gtk_clist_get_vadjustment(GTK_CLIST(clist)); |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
6224 if(adj) |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
6225 { |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
6226 switch(direction) |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
6227 { |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
6228 case DW_SCROLL_TOP: |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
6229 adj->value = adj->lower; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
6230 break; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
6231 case DW_SCROLL_BOTTOM: |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
6232 adj->value = adj->upper; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
6233 break; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
6234 } |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
6235 gtk_clist_set_vadjustment(GTK_CLIST(clist), adj); |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
6236 } |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
6237 } |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
6238 DW_MUTEX_UNLOCK; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
6239 } |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
6240 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
6241 /* |
3 | 6242 * Starts a new query of a container. |
6243 * Parameters: | |
6244 * handle: Handle to the window (widget) to be queried. | |
6245 * flags: If this parameter is DW_CRA_SELECTED it will only | |
6246 * return items that are currently selected. Otherwise | |
6247 * it will return all records in the container. | |
6248 */ | |
6249 char *dw_container_query_start(HWND handle, unsigned long flags) | |
6250 { | |
6251 GtkWidget *clist; | |
6252 GList *list; | |
6253 char *retval = NULL; | |
6254 int _locked_by_me = FALSE; | |
6255 | |
6256 DW_MUTEX_LOCK; | |
6257 clist = (GtkWidget*)gtk_object_get_user_data(GTK_OBJECT(handle)); | |
6258 | |
6259 if(!clist) | |
6260 { | |
6261 DW_MUTEX_UNLOCK; | |
6262 return NULL; | |
6263 } | |
6264 | |
69
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
6265 /* These should be separate but right now this will work */ |
364
aa827971da39
Handle ENTER keypress on the container control. Also make
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
362
diff
changeset
|
6266 if(flags & DW_CRA_SELECTED) |
3 | 6267 { |
352
feed7567764f
Rewrote the selection code. It is much more simple now and no longer
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
350
diff
changeset
|
6268 list = GTK_CLIST(clist)->selection; |
69
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
6269 |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
6270 if(list) |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
6271 { |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
6272 gtk_object_set_data(GTK_OBJECT(clist), "_dw_querypos", (gpointer)1); |
352
feed7567764f
Rewrote the selection code. It is much more simple now and no longer
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
350
diff
changeset
|
6273 retval = (char *)gtk_clist_get_row_data(GTK_CLIST(clist), GPOINTER_TO_UINT(list->data)); |
69
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
6274 } |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
6275 } |
364
aa827971da39
Handle ENTER keypress on the container control. Also make
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
362
diff
changeset
|
6276 else if(flags & DW_CRA_CURSORED) |
aa827971da39
Handle ENTER keypress on the container control. Also make
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
362
diff
changeset
|
6277 { |
aa827971da39
Handle ENTER keypress on the container control. Also make
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
362
diff
changeset
|
6278 retval = (char *)gtk_clist_get_row_data(GTK_CLIST(clist), GTK_CLIST(clist)->focus_row); |
aa827971da39
Handle ENTER keypress on the container control. Also make
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
362
diff
changeset
|
6279 } |
69
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
6280 else |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
6281 { |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
6282 retval = (char *)gtk_clist_get_row_data(GTK_CLIST(clist), 0); |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
6283 gtk_object_set_data(GTK_OBJECT(clist), "_dw_querypos", (gpointer)1); |
3 | 6284 } |
6285 DW_MUTEX_UNLOCK; | |
6286 return retval; | |
6287 } | |
6288 | |
6289 /* | |
6290 * Continues an existing query of a container. | |
6291 * Parameters: | |
6292 * handle: Handle to the window (widget) to be queried. | |
6293 * flags: If this parameter is DW_CRA_SELECTED it will only | |
6294 * return items that are currently selected. Otherwise | |
6295 * it will return all records in the container. | |
6296 */ | |
6297 char *dw_container_query_next(HWND handle, unsigned long flags) | |
6298 { | |
6299 GtkWidget *clist; | |
6300 GList *list; | |
6301 char *retval = NULL; | |
6302 int _locked_by_me = FALSE; | |
6303 | |
6304 DW_MUTEX_LOCK; | |
6305 clist = (GtkWidget*)gtk_object_get_user_data(GTK_OBJECT(handle)); | |
6306 | |
6307 if(!clist) | |
6308 { | |
6309 DW_MUTEX_UNLOCK; | |
6310 return NULL; | |
6311 } | |
6312 | |
69
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
6313 /* These should be separate but right now this will work */ |
364
aa827971da39
Handle ENTER keypress on the container control. Also make
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
362
diff
changeset
|
6314 if(flags & DW_CRA_SELECTED) |
3 | 6315 { |
352
feed7567764f
Rewrote the selection code. It is much more simple now and no longer
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
350
diff
changeset
|
6316 list = GTK_CLIST(clist)->selection; |
69
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
6317 |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
6318 if(list) |
3 | 6319 { |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
6320 int counter = 0, pos = (int)gtk_object_get_data(GTK_OBJECT(clist), "_dw_querypos"); |
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
6321 gtk_object_set_data(GTK_OBJECT(clist), "_dw_querypos", (gpointer)pos+1); |
69
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
6322 |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
6323 while(list && counter < pos) |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
6324 { |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
6325 list = list->next; |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
6326 counter++; |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
6327 } |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
6328 |
352
feed7567764f
Rewrote the selection code. It is much more simple now and no longer
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
350
diff
changeset
|
6329 if(list) |
feed7567764f
Rewrote the selection code. It is much more simple now and no longer
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
350
diff
changeset
|
6330 retval = (char *)gtk_clist_get_row_data(GTK_CLIST(clist), GPOINTER_TO_UINT(list->data)); |
3 | 6331 } |
69
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
6332 } |
364
aa827971da39
Handle ENTER keypress on the container control. Also make
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
362
diff
changeset
|
6333 else if(flags & DW_CRA_CURSORED) |
aa827971da39
Handle ENTER keypress on the container control. Also make
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
362
diff
changeset
|
6334 { |
aa827971da39
Handle ENTER keypress on the container control. Also make
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
362
diff
changeset
|
6335 /* There will only be one item cursored, |
aa827971da39
Handle ENTER keypress on the container control. Also make
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
362
diff
changeset
|
6336 * retrieve it with dw_container_query_start() |
aa827971da39
Handle ENTER keypress on the container control. Also make
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
362
diff
changeset
|
6337 */ |
aa827971da39
Handle ENTER keypress on the container control. Also make
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
362
diff
changeset
|
6338 retval = NULL; |
aa827971da39
Handle ENTER keypress on the container control. Also make
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
362
diff
changeset
|
6339 } |
69
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
6340 else |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
6341 { |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
6342 int pos = (int)gtk_object_get_data(GTK_OBJECT(clist), "_dw_querypos"); |
69
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
6343 |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
6344 retval = (char *)gtk_clist_get_row_data(GTK_CLIST(clist), pos); |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
6345 gtk_object_set_data(GTK_OBJECT(clist), "_dw_querypos", (gpointer)pos+1); |
3 | 6346 } |
6347 DW_MUTEX_UNLOCK; | |
6348 return retval; | |
6349 } | |
6350 | |
6351 /* | |
69
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
6352 * Cursors the item with the text speficied, and scrolls to that item. |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
6353 * Parameters: |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
6354 * handle: Handle to the window (widget) to be queried. |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
6355 * text: Text usually returned by dw_container_query(). |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
6356 */ |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
6357 void dw_container_cursor(HWND handle, char *text) |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
6358 { |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
6359 int _locked_by_me = FALSE; |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
6360 GtkWidget *clist; |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
6361 int rowcount, z; |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
6362 char *rowdata; |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
6363 |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
6364 DW_MUTEX_LOCK; |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
6365 clist = (GtkWidget*)gtk_object_get_user_data(GTK_OBJECT(handle)); |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
6366 |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
6367 if(!clist) |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
6368 { |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
6369 DW_MUTEX_UNLOCK; |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
6370 return; |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
6371 } |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
6372 rowcount = (int)gtk_object_get_data(GTK_OBJECT(clist), "_dw_rowcount"); |
69
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
6373 |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
6374 for(z=0;z<rowcount;z++) |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
6375 { |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
6376 rowdata = gtk_clist_get_row_data(GTK_CLIST(clist), z); |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
6377 if(rowdata == text) |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
6378 { |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
6379 gfloat pos; |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
6380 GtkAdjustment *adj = gtk_clist_get_vadjustment(GTK_CLIST(clist)); |
72
ab77a22a2a36
Added localization APIs as well as some miscellaneous bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
6381 |
ab77a22a2a36
Added localization APIs as well as some miscellaneous bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
6382 _dw_unselect(clist); |
ab77a22a2a36
Added localization APIs as well as some miscellaneous bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
6383 |
69
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
6384 gtk_clist_select_row(GTK_CLIST(clist), z, 0); |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
6385 |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
6386 pos = ((adj->upper - adj->lower) * ((gfloat)z/(gfloat)rowcount)) + adj->lower; |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
6387 gtk_adjustment_set_value(adj, pos); |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
6388 DW_MUTEX_UNLOCK; |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
6389 return; |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
6390 } |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
6391 } |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
6392 |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
6393 DW_MUTEX_UNLOCK; |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
6394 } |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
6395 |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
6396 /* |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
6397 * Deletes the item with the text speficied. |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
6398 * Parameters: |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
6399 * handle: Handle to the window (widget). |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
6400 * text: Text usually returned by dw_container_query(). |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
6401 */ |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
6402 void dw_container_delete_row(HWND handle, char *text) |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
6403 { |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
6404 int _locked_by_me = FALSE; |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
6405 GtkWidget *clist; |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
6406 int rowcount, z; |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
6407 char *rowdata; |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
6408 |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
6409 DW_MUTEX_LOCK; |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
6410 clist = (GtkWidget*)gtk_object_get_user_data(GTK_OBJECT(handle)); |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
6411 |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
6412 if(!clist) |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
6413 { |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
6414 DW_MUTEX_UNLOCK; |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
6415 return; |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
6416 } |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
6417 rowcount = (int)gtk_object_get_data(GTK_OBJECT(clist), "_dw_rowcount"); |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
6418 |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
6419 for(z=0;z<rowcount;z++) |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
6420 { |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
6421 rowdata = gtk_clist_get_row_data(GTK_CLIST(clist), z); |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
6422 if(rowdata == text) |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
6423 { |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
6424 _dw_unselect(clist); |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
6425 |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
6426 gtk_clist_remove(GTK_CLIST(clist), z); |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
6427 |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
6428 rowcount--; |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
6429 |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
6430 gtk_object_set_data(GTK_OBJECT(clist), "_dw_rowcount", (gpointer)rowcount); |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
6431 DW_MUTEX_UNLOCK; |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
6432 return; |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
6433 } |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
6434 } |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
6435 |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
6436 DW_MUTEX_UNLOCK; |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
6437 } |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
6438 |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
6439 /* |
69
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
6440 * Optimizes the column widths so that all data is visible. |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
6441 * Parameters: |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
6442 * handle: Handle to the window (widget) to be optimized. |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
6443 */ |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
6444 void dw_container_optimize(HWND handle) |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
6445 { |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
6446 int _locked_by_me = FALSE; |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
6447 GtkWidget *clist; |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
6448 int colcount, z; |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
6449 |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
6450 DW_MUTEX_LOCK; |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
6451 clist = (GtkWidget*)gtk_object_get_user_data(GTK_OBJECT(handle)); |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
6452 |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
6453 if(!clist) |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
6454 { |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
6455 DW_MUTEX_UNLOCK; |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
6456 return; |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
6457 } |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
6458 colcount = (int)gtk_object_get_data(GTK_OBJECT(clist), "_dw_colcount"); |
69
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
6459 for(z=0;z<colcount;z++) |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
6460 { |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
6461 int width = gtk_clist_optimal_column_width(GTK_CLIST(clist), z); |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
6462 gtk_clist_set_column_width(GTK_CLIST(clist), z, width); |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
6463 } |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
6464 DW_MUTEX_UNLOCK; |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
6465 } |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
6466 |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
6467 /* |
487
d6e07d292145
Implemented taskbar icons on windows, so I can keep feature for feature
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
486
diff
changeset
|
6468 * Inserts an icon into the taskbar. |
d6e07d292145
Implemented taskbar icons on windows, so I can keep feature for feature
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
486
diff
changeset
|
6469 * Parameters: |
d6e07d292145
Implemented taskbar icons on windows, so I can keep feature for feature
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
486
diff
changeset
|
6470 * handle: Window handle that will handle taskbar icon messages. |
d6e07d292145
Implemented taskbar icons on windows, so I can keep feature for feature
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
486
diff
changeset
|
6471 * icon: Icon handle to display in the taskbar. |
d6e07d292145
Implemented taskbar icons on windows, so I can keep feature for feature
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
486
diff
changeset
|
6472 * bubbletext: Text to show when the mouse is above the icon. |
d6e07d292145
Implemented taskbar icons on windows, so I can keep feature for feature
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
486
diff
changeset
|
6473 */ |
d6e07d292145
Implemented taskbar icons on windows, so I can keep feature for feature
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
486
diff
changeset
|
6474 void dw_taskbar_insert(HWND handle, unsigned long icon, char *bubbletext) |
d6e07d292145
Implemented taskbar icons on windows, so I can keep feature for feature
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
486
diff
changeset
|
6475 { |
491 | 6476 /* TODO */ |
487
d6e07d292145
Implemented taskbar icons on windows, so I can keep feature for feature
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
486
diff
changeset
|
6477 } |
d6e07d292145
Implemented taskbar icons on windows, so I can keep feature for feature
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
486
diff
changeset
|
6478 |
d6e07d292145
Implemented taskbar icons on windows, so I can keep feature for feature
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
486
diff
changeset
|
6479 /* |
d6e07d292145
Implemented taskbar icons on windows, so I can keep feature for feature
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
486
diff
changeset
|
6480 * Deletes an icon from the taskbar. |
d6e07d292145
Implemented taskbar icons on windows, so I can keep feature for feature
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
486
diff
changeset
|
6481 * Parameters: |
d6e07d292145
Implemented taskbar icons on windows, so I can keep feature for feature
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
486
diff
changeset
|
6482 * handle: Window handle that was used with dw_taskbar_insert(). |
d6e07d292145
Implemented taskbar icons on windows, so I can keep feature for feature
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
486
diff
changeset
|
6483 * icon: Icon handle that was used with dw_taskbar_insert(). |
d6e07d292145
Implemented taskbar icons on windows, so I can keep feature for feature
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
486
diff
changeset
|
6484 */ |
d6e07d292145
Implemented taskbar icons on windows, so I can keep feature for feature
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
486
diff
changeset
|
6485 void dw_taskbar_delete(HWND handle, unsigned long icon) |
d6e07d292145
Implemented taskbar icons on windows, so I can keep feature for feature
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
486
diff
changeset
|
6486 { |
491 | 6487 /* TODO */ |
487
d6e07d292145
Implemented taskbar icons on windows, so I can keep feature for feature
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
486
diff
changeset
|
6488 } |
d6e07d292145
Implemented taskbar icons on windows, so I can keep feature for feature
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
486
diff
changeset
|
6489 |
d6e07d292145
Implemented taskbar icons on windows, so I can keep feature for feature
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
486
diff
changeset
|
6490 /* |
3 | 6491 * Creates a rendering context widget (window) to be packed. |
6492 * Parameters: | |
6493 * id: An id to be used with dw_window_from_id. | |
6494 * Returns: | |
6495 * A handle to the widget or NULL on failure. | |
6496 */ | |
6497 HWND dw_render_new(unsigned long id) | |
6498 { | |
6499 int _locked_by_me = FALSE; | |
6500 GtkWidget *tmp; | |
6501 | |
6502 DW_MUTEX_LOCK; | |
6503 tmp = gtk_drawing_area_new(); | |
6504 gtk_widget_set_events(tmp, GDK_EXPOSURE_MASK | |
6505 | GDK_LEAVE_NOTIFY_MASK | |
6506 | GDK_BUTTON_PRESS_MASK | |
267
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
265
diff
changeset
|
6507 | GDK_KEY_PRESS_MASK |
3 | 6508 | GDK_POINTER_MOTION_MASK |
6509 | GDK_POINTER_MOTION_HINT_MASK); | |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
6510 gtk_object_set_data(GTK_OBJECT(tmp), "_dw_id", (gpointer)id); |
267
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
265
diff
changeset
|
6511 GTK_WIDGET_SET_FLAGS(tmp, GTK_CAN_FOCUS); |
3 | 6512 gtk_widget_show(tmp); |
6513 DW_MUTEX_UNLOCK; | |
6514 return tmp; | |
6515 } | |
6516 | |
193
efd4703450fa
Build test application on Unix too... and also fixed GTK to allow
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
185
diff
changeset
|
6517 /* Returns a GdkColor from a DW color */ |
258
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
6518 static GdkColor _internal_color(unsigned long value) |
193
efd4703450fa
Build test application on Unix too... and also fixed GTK to allow
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
185
diff
changeset
|
6519 { |
efd4703450fa
Build test application on Unix too... and also fixed GTK to allow
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
185
diff
changeset
|
6520 if(DW_RGB_COLOR & value) |
efd4703450fa
Build test application on Unix too... and also fixed GTK to allow
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
185
diff
changeset
|
6521 { |
efd4703450fa
Build test application on Unix too... and also fixed GTK to allow
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
185
diff
changeset
|
6522 GdkColor color = { 0, DW_RED_VALUE(value) << 8, DW_GREEN_VALUE(value) << 8, DW_BLUE_VALUE(value) << 8 }; |
efd4703450fa
Build test application on Unix too... and also fixed GTK to allow
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
185
diff
changeset
|
6523 return color; |
efd4703450fa
Build test application on Unix too... and also fixed GTK to allow
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
185
diff
changeset
|
6524 } |
372
3ef2cf70ee07
Code for drawing text with a background color on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
369
diff
changeset
|
6525 if (value < 16) |
193
efd4703450fa
Build test application on Unix too... and also fixed GTK to allow
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
185
diff
changeset
|
6526 return _colors[value]; |
efd4703450fa
Build test application on Unix too... and also fixed GTK to allow
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
185
diff
changeset
|
6527 return _colors[0]; |
efd4703450fa
Build test application on Unix too... and also fixed GTK to allow
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
185
diff
changeset
|
6528 } |
efd4703450fa
Build test application on Unix too... and also fixed GTK to allow
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
185
diff
changeset
|
6529 |
3 | 6530 /* Sets the current foreground drawing color. |
6531 * Parameters: | |
6532 * red: red value. | |
6533 * green: green value. | |
6534 * blue: blue value. | |
6535 */ | |
6536 void dw_color_foreground_set(unsigned long value) | |
6537 { | |
48
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
6538 int _locked_by_me = FALSE, index = _find_thread_index(dw_thread_id()); |
193
efd4703450fa
Build test application on Unix too... and also fixed GTK to allow
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
185
diff
changeset
|
6539 GdkColor color = _internal_color(value); |
3 | 6540 |
6541 DW_MUTEX_LOCK; | |
373
d04b0699fc28
Fixes for background color drawing on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
372
diff
changeset
|
6542 gdk_color_alloc(_dw_cmap, &color); |
48
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
6543 _foreground[index] = color; |
3 | 6544 DW_MUTEX_UNLOCK; |
6545 } | |
6546 | |
6547 /* Sets the current background drawing color. | |
6548 * Parameters: | |
6549 * red: red value. | |
6550 * green: green value. | |
6551 * blue: blue value. | |
6552 */ | |
6553 void dw_color_background_set(unsigned long value) | |
6554 { | |
48
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
6555 int _locked_by_me = FALSE, index = _find_thread_index(dw_thread_id()); |
193
efd4703450fa
Build test application on Unix too... and also fixed GTK to allow
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
185
diff
changeset
|
6556 GdkColor color = _internal_color(value); |
3 | 6557 |
6558 DW_MUTEX_LOCK; | |
373
d04b0699fc28
Fixes for background color drawing on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
372
diff
changeset
|
6559 gdk_color_alloc(_dw_cmap, &color); |
d04b0699fc28
Fixes for background color drawing on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
372
diff
changeset
|
6560 if(value == DW_CLR_DEFAULT) |
d04b0699fc28
Fixes for background color drawing on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
372
diff
changeset
|
6561 _transparent[index] = 1; |
d04b0699fc28
Fixes for background color drawing on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
372
diff
changeset
|
6562 else |
d04b0699fc28
Fixes for background color drawing on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
372
diff
changeset
|
6563 _transparent[index] = 0; |
d04b0699fc28
Fixes for background color drawing on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
372
diff
changeset
|
6564 |
48
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
6565 _background[index] = color; |
3 | 6566 DW_MUTEX_UNLOCK; |
6567 } | |
6568 | |
6569 GdkGC *_set_colors(GdkWindow *window) | |
6570 { | |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6571 GdkGC *gc = NULL; |
48
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
6572 int index = _find_thread_index(dw_thread_id()); |
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
6573 |
3 | 6574 if(!window) |
6575 return NULL; | |
6576 gc = gdk_gc_new(window); | |
6577 if(gc) | |
6578 { | |
373
d04b0699fc28
Fixes for background color drawing on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
372
diff
changeset
|
6579 gdk_gc_set_foreground(gc, &_foreground[index]); |
d04b0699fc28
Fixes for background color drawing on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
372
diff
changeset
|
6580 gdk_gc_set_background(gc, &_background[index]); |
3 | 6581 } |
6582 return gc; | |
6583 } | |
6584 | |
6585 /* Draw a point on a window (preferably a render window). | |
6586 * Parameters: | |
6587 * handle: Handle to the window. | |
6588 * pixmap: Handle to the pixmap. (choose only one of these) | |
6589 * x: X coordinate. | |
6590 * y: Y coordinate. | |
6591 */ | |
6592 void dw_draw_point(HWND handle, HPIXMAP pixmap, int x, int y) | |
6593 { | |
6594 int _locked_by_me = FALSE; | |
6595 GdkGC *gc = NULL; | |
6596 | |
6597 DW_MUTEX_LOCK; | |
6598 if(handle) | |
6599 gc = _set_colors(handle->window); | |
6600 else if(pixmap) | |
6601 gc = _set_colors(pixmap->pixmap); | |
6602 if(gc) | |
6603 { | |
6604 gdk_draw_point(handle ? handle->window : pixmap->pixmap, gc, x, y); | |
6605 gdk_gc_unref(gc); | |
6606 } | |
6607 DW_MUTEX_UNLOCK; | |
6608 } | |
6609 | |
6610 /* Draw a line on a window (preferably a render window). | |
6611 * Parameters: | |
6612 * handle: Handle to the window. | |
6613 * pixmap: Handle to the pixmap. (choose only one of these) | |
6614 * x1: First X coordinate. | |
6615 * y1: First Y coordinate. | |
6616 * x2: Second X coordinate. | |
6617 * y2: Second Y coordinate. | |
6618 */ | |
6619 void dw_draw_line(HWND handle, HPIXMAP pixmap, int x1, int y1, int x2, int y2) | |
6620 { | |
6621 int _locked_by_me = FALSE; | |
6622 GdkGC *gc = NULL; | |
6623 | |
6624 DW_MUTEX_LOCK; | |
6625 if(handle) | |
6626 gc = _set_colors(handle->window); | |
6627 else if(pixmap) | |
6628 gc = _set_colors(pixmap->pixmap); | |
6629 if(gc) | |
6630 { | |
6631 gdk_draw_line(handle ? handle->window : pixmap->pixmap, gc, x1, y1, x2, y2); | |
6632 gdk_gc_unref(gc); | |
6633 } | |
6634 DW_MUTEX_UNLOCK; | |
6635 } | |
6636 | |
6637 /* Draw a rectangle on a window (preferably a render window). | |
6638 * Parameters: | |
6639 * handle: Handle to the window. | |
6640 * pixmap: Handle to the pixmap. (choose only one of these) | |
6641 * x: X coordinate. | |
6642 * y: Y coordinate. | |
6643 * width: Width of rectangle. | |
6644 * height: Height of rectangle. | |
6645 */ | |
6646 void dw_draw_rect(HWND handle, HPIXMAP pixmap, int fill, int x, int y, int width, int height) | |
6647 { | |
6648 int _locked_by_me = FALSE; | |
6649 GdkGC *gc = NULL; | |
6650 | |
6651 DW_MUTEX_LOCK; | |
6652 if(handle) | |
6653 gc = _set_colors(handle->window); | |
6654 else if(pixmap) | |
6655 gc = _set_colors(pixmap->pixmap); | |
6656 if(gc) | |
6657 { | |
6658 gdk_draw_rectangle(handle ? handle->window : pixmap->pixmap, gc, fill, x, y, width, height); | |
6659 gdk_gc_unref(gc); | |
6660 } | |
6661 DW_MUTEX_UNLOCK; | |
6662 } | |
6663 | |
6664 /* Draw text on a window (preferably a render window). | |
6665 * Parameters: | |
6666 * handle: Handle to the window. | |
6667 * pixmap: Handle to the pixmap. (choose only one of these) | |
6668 * x: X coordinate. | |
6669 * y: Y coordinate. | |
6670 * text: Text to be displayed. | |
6671 */ | |
6672 void dw_draw_text(HWND handle, HPIXMAP pixmap, int x, int y, char *text) | |
6673 { | |
6674 int _locked_by_me = FALSE; | |
6675 GdkGC *gc = NULL; | |
147
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
6676 #if GTK_MAJOR_VERSION > 1 |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
6677 PangoFontDescription *font; |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
6678 #else |
3 | 6679 GdkFont *font; |
147
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
6680 #endif |
3 | 6681 char *fontname = "fixed"; |
6682 | |
49
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
48
diff
changeset
|
6683 if(!text) |
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
48
diff
changeset
|
6684 return; |
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
48
diff
changeset
|
6685 |
3 | 6686 DW_MUTEX_LOCK; |
6687 if(handle) | |
6688 { | |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
6689 fontname = (char *)gtk_object_get_data(GTK_OBJECT(handle), "_dw_fontname"); |
3 | 6690 gc = _set_colors(handle->window); |
6691 } | |
6692 else if(pixmap) | |
6693 { | |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
6694 fontname = (char *)gtk_object_get_data(GTK_OBJECT(pixmap->handle), "_dw_fontname"); |
3 | 6695 gc = _set_colors(pixmap->pixmap); |
6696 } | |
6697 if(gc) | |
6698 { | |
147
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
6699 #if GTK_MAJOR_VERSION > 1 |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
6700 font = pango_font_description_from_string(fontname); |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
6701 if(font) |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
6702 { |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
6703 PangoContext *context = gdk_pango_context_get(); |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
6704 |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
6705 if(context) |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
6706 { |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
6707 PangoLayout *layout = pango_layout_new(context); |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
6708 |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
6709 if(layout) |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
6710 { |
372
3ef2cf70ee07
Code for drawing text with a background color on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
369
diff
changeset
|
6711 int index = _find_thread_index(dw_thread_id()); |
3ef2cf70ee07
Code for drawing text with a background color on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
369
diff
changeset
|
6712 |
373
d04b0699fc28
Fixes for background color drawing on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
372
diff
changeset
|
6713 gdk_pango_context_set_colormap(context, _dw_cmap); |
147
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
6714 pango_layout_set_font_description(layout, font); |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
6715 pango_layout_set_text(layout, text, strlen(text)); |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
6716 |
375
84f79737b7d9
Manually draw the background rectangle with GTK 1.x since it doesn't appear
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
374
diff
changeset
|
6717 if(_transparent[index]) |
450
f9ba403b15ad
Finally sort out correct location of text with dw_draw_text() under GTK 2.0
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
449
diff
changeset
|
6718 gdk_draw_layout(handle ? handle->window : pixmap->pixmap, gc, x, y, layout); |
372
3ef2cf70ee07
Code for drawing text with a background color on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
369
diff
changeset
|
6719 else |
450
f9ba403b15ad
Finally sort out correct location of text with dw_draw_text() under GTK 2.0
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
449
diff
changeset
|
6720 gdk_draw_layout_with_colors(handle ? handle->window : pixmap->pixmap, gc, x, y, layout, &_foreground[index], &_background[index]); |
147
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
6721 |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
6722 g_object_unref(layout); |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
6723 } |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
6724 g_object_unref(context); |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
6725 } |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
6726 pango_font_description_free(font); |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
6727 } |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
6728 #else |
3 | 6729 font = gdk_font_load(fontname); |
148
830f591c87f1
dw_window_set_usize fixes and fallback to "fixed" on GTK 1.2 if pango
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
147
diff
changeset
|
6730 if(!font) |
830f591c87f1
dw_window_set_usize fixes and fallback to "fixed" on GTK 1.2 if pango
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
147
diff
changeset
|
6731 font = gdk_font_load("fixed"); |
3 | 6732 if(font) |
6733 { | |
379
2e5f3cb38d19
Fix calculations of font heights under GTK 1.2. Unsure full ascent and descent
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
375
diff
changeset
|
6734 gint ascent, descent, width, junk_ascent, junk_descent, junk_width; |
375
84f79737b7d9
Manually draw the background rectangle with GTK 1.x since it doesn't appear
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
374
diff
changeset
|
6735 int index = _find_thread_index(dw_thread_id()); |
84f79737b7d9
Manually draw the background rectangle with GTK 1.x since it doesn't appear
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
374
diff
changeset
|
6736 |
379
2e5f3cb38d19
Fix calculations of font heights under GTK 1.2. Unsure full ascent and descent
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
375
diff
changeset
|
6737 /* gdk_text_extents() calculates ascent and descent based on the string, so |
2e5f3cb38d19
Fix calculations of font heights under GTK 1.2. Unsure full ascent and descent
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
375
diff
changeset
|
6738 * a string without a character with a descent or without an ascent will have |
2e5f3cb38d19
Fix calculations of font heights under GTK 1.2. Unsure full ascent and descent
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
375
diff
changeset
|
6739 * incorrect ascent/descent values |
2e5f3cb38d19
Fix calculations of font heights under GTK 1.2. Unsure full ascent and descent
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
375
diff
changeset
|
6740 */ |
2e5f3cb38d19
Fix calculations of font heights under GTK 1.2. Unsure full ascent and descent
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
375
diff
changeset
|
6741 gdk_text_extents(font, text, strlen(text), NULL, NULL, &width, &junk_ascent, &junk_descent); |
2e5f3cb38d19
Fix calculations of font heights under GTK 1.2. Unsure full ascent and descent
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
375
diff
changeset
|
6742 /* force ascent/descent to be maximum values */ |
383
f040c24bcf26
Slight change to determining font height under GTK 1.2. The solution may
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
379
diff
changeset
|
6743 gdk_text_extents(font, "(g", 2, NULL, NULL, &junk_width, &ascent, &descent); |
375
84f79737b7d9
Manually draw the background rectangle with GTK 1.x since it doesn't appear
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
374
diff
changeset
|
6744 if(!_transparent[index]) |
84f79737b7d9
Manually draw the background rectangle with GTK 1.x since it doesn't appear
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
374
diff
changeset
|
6745 { |
84f79737b7d9
Manually draw the background rectangle with GTK 1.x since it doesn't appear
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
374
diff
changeset
|
6746 GdkGC *gc2 = NULL; |
84f79737b7d9
Manually draw the background rectangle with GTK 1.x since it doesn't appear
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
374
diff
changeset
|
6747 |
84f79737b7d9
Manually draw the background rectangle with GTK 1.x since it doesn't appear
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
374
diff
changeset
|
6748 gc2 = gdk_gc_new(handle ? handle->window : pixmap->pixmap); |
84f79737b7d9
Manually draw the background rectangle with GTK 1.x since it doesn't appear
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
374
diff
changeset
|
6749 if(gc2) |
84f79737b7d9
Manually draw the background rectangle with GTK 1.x since it doesn't appear
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
374
diff
changeset
|
6750 { |
84f79737b7d9
Manually draw the background rectangle with GTK 1.x since it doesn't appear
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
374
diff
changeset
|
6751 gdk_gc_set_foreground(gc2, &_background[index]); |
84f79737b7d9
Manually draw the background rectangle with GTK 1.x since it doesn't appear
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
374
diff
changeset
|
6752 gdk_gc_set_background(gc2, &_background[index]); |
84f79737b7d9
Manually draw the background rectangle with GTK 1.x since it doesn't appear
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
374
diff
changeset
|
6753 } |
383
f040c24bcf26
Slight change to determining font height under GTK 1.2. The solution may
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
379
diff
changeset
|
6754 gdk_draw_rectangle(handle ? handle->window : pixmap->pixmap, gc2, TRUE, x, y, width, ascent + descent + 1); |
375
84f79737b7d9
Manually draw the background rectangle with GTK 1.x since it doesn't appear
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
374
diff
changeset
|
6755 gdk_gc_unref(gc2); |
84f79737b7d9
Manually draw the background rectangle with GTK 1.x since it doesn't appear
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
374
diff
changeset
|
6756 } |
383
f040c24bcf26
Slight change to determining font height under GTK 1.2. The solution may
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
379
diff
changeset
|
6757 gdk_draw_text(handle ? handle->window : pixmap->pixmap, font, gc, x, y + ascent + 1, text, strlen(text)); |
3 | 6758 gdk_font_unref(font); |
6759 } | |
147
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
6760 #endif |
149
6028f787f7c8
Fixed a graphics context leak in dw_draw_text().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
148
diff
changeset
|
6761 gdk_gc_unref(gc); |
3 | 6762 } |
6763 DW_MUTEX_UNLOCK; | |
6764 } | |
6765 | |
49
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
48
diff
changeset
|
6766 /* Query the width and height of a text string. |
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
48
diff
changeset
|
6767 * Parameters: |
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
48
diff
changeset
|
6768 * handle: Handle to the window. |
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
48
diff
changeset
|
6769 * pixmap: Handle to the pixmap. (choose only one of these) |
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
48
diff
changeset
|
6770 * text: Text to be queried. |
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
48
diff
changeset
|
6771 * width: Pointer to a variable to be filled in with the width. |
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
48
diff
changeset
|
6772 * height Pointer to a variable to be filled in with the height. |
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
48
diff
changeset
|
6773 */ |
514
08d770271709
More function name changes for Rexx/DW compatibility.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
513
diff
changeset
|
6774 void dw_font_text_extents_get(HWND handle, HPIXMAP pixmap, char *text, int *width, int *height) |
49
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
48
diff
changeset
|
6775 { |
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
48
diff
changeset
|
6776 int _locked_by_me = FALSE; |
147
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
6777 #if GTK_MAJOR_VERSION > 1 |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
6778 PangoFontDescription *font; |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
6779 #else |
49
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
48
diff
changeset
|
6780 GdkFont *font; |
147
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
6781 #endif |
49
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
48
diff
changeset
|
6782 char *fontname = NULL; |
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
48
diff
changeset
|
6783 |
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
48
diff
changeset
|
6784 if(!text) |
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
48
diff
changeset
|
6785 return; |
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
48
diff
changeset
|
6786 |
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
48
diff
changeset
|
6787 DW_MUTEX_LOCK; |
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
48
diff
changeset
|
6788 if(handle) |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
6789 fontname = (char *)gtk_object_get_data(GTK_OBJECT(handle), "_dw_fontname"); |
49
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
48
diff
changeset
|
6790 else if(pixmap) |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
6791 fontname = (char *)gtk_object_get_data(GTK_OBJECT(pixmap->handle), "_dw_fontname"); |
49
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
48
diff
changeset
|
6792 |
147
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
6793 #if GTK_MAJOR_VERSION > 1 |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
6794 font = pango_font_description_from_string(fontname ? fontname : "monospace 10"); |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
6795 if(font) |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
6796 { |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
6797 PangoContext *context = gdk_pango_context_get(); |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
6798 |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
6799 if(context) |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
6800 { |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
6801 PangoLayout *layout = pango_layout_new(context); |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
6802 |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
6803 if(layout) |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
6804 { |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
6805 PangoRectangle rect; |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
6806 |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
6807 pango_layout_set_font_description(layout, font); |
233
f2435b378aed
We should use the logical_rect not the ink_rect when querying the font
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
216
diff
changeset
|
6808 pango_layout_set_text(layout, text, -1); |
f2435b378aed
We should use the logical_rect not the ink_rect when querying the font
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
216
diff
changeset
|
6809 pango_layout_get_pixel_extents(layout, NULL, &rect); |
147
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
6810 |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
6811 if(width) |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
6812 *width = rect.width; |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
6813 if(height) |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
6814 *height = rect.height; |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
6815 |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
6816 g_object_unref(layout); |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
6817 } |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
6818 g_object_unref(context); |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
6819 } |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
6820 pango_font_description_free(font); |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
6821 } |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
6822 #else |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
6823 |
49
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
48
diff
changeset
|
6824 font = gdk_font_load(fontname ? fontname : "fixed"); |
148
830f591c87f1
dw_window_set_usize fixes and fallback to "fixed" on GTK 1.2 if pango
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
147
diff
changeset
|
6825 if(!font) |
830f591c87f1
dw_window_set_usize fixes and fallback to "fixed" on GTK 1.2 if pango
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
147
diff
changeset
|
6826 font = gdk_font_load("fixed"); |
49
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
48
diff
changeset
|
6827 if(font) |
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
48
diff
changeset
|
6828 { |
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
48
diff
changeset
|
6829 if(width) |
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
48
diff
changeset
|
6830 *width = gdk_string_width(font, text); |
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
48
diff
changeset
|
6831 if(height) |
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
48
diff
changeset
|
6832 *height = gdk_string_height(font, text); |
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
48
diff
changeset
|
6833 gdk_font_unref(font); |
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
48
diff
changeset
|
6834 } |
147
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
6835 #endif |
49
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
48
diff
changeset
|
6836 DW_MUTEX_UNLOCK; |
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
48
diff
changeset
|
6837 } |
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
48
diff
changeset
|
6838 |
3 | 6839 /* |
6840 * Creates a pixmap with given parameters. | |
6841 * Parameters: | |
6842 * handle: Window handle the pixmap is associated with. | |
6843 * width: Width of the pixmap in pixels. | |
6844 * height: Height of the pixmap in pixels. | |
6845 * depth: Color depth of the pixmap. | |
6846 * Returns: | |
6847 * A handle to a pixmap or NULL on failure. | |
6848 */ | |
6849 HPIXMAP dw_pixmap_new(HWND handle, unsigned long width, unsigned long height, int depth) | |
6850 { | |
6851 int _locked_by_me = FALSE; | |
6852 HPIXMAP pixmap; | |
6853 | |
6854 if (!(pixmap = calloc(1,sizeof(struct _hpixmap)))) | |
6855 return NULL; | |
6856 | |
6857 if (!depth) | |
66
664a274a46a6
Fixed color depth problem when creating a new pixmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
6858 depth = -1; |
3 | 6859 |
6860 pixmap->width = width; pixmap->height = height; | |
6861 | |
6862 | |
6863 DW_MUTEX_LOCK; | |
6864 pixmap->handle = handle; | |
6865 pixmap->pixmap = gdk_pixmap_new(handle->window, width, height, depth); | |
6866 DW_MUTEX_UNLOCK; | |
6867 return pixmap; | |
6868 } | |
6869 | |
6870 /* | |
241
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
239
diff
changeset
|
6871 * Creates a pixmap from a file. |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
239
diff
changeset
|
6872 * Parameters: |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
239
diff
changeset
|
6873 * handle: Window handle the pixmap is associated with. |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
239
diff
changeset
|
6874 * filename: Name of the file, omit extention to have |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
239
diff
changeset
|
6875 * DW pick the appropriate file extension. |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
239
diff
changeset
|
6876 * (BMP on OS/2 or Windows, XPM on Unix) |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
239
diff
changeset
|
6877 * Returns: |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
239
diff
changeset
|
6878 * A handle to a pixmap or NULL on failure. |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
239
diff
changeset
|
6879 */ |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
239
diff
changeset
|
6880 HPIXMAP dw_pixmap_new_from_file(HWND handle, char *filename) |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
239
diff
changeset
|
6881 { |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
239
diff
changeset
|
6882 int _locked_by_me = FALSE; |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
239
diff
changeset
|
6883 HPIXMAP pixmap; |
244
68158098a092
Implemented dw_pixmap_new_from_file() for GTK 1.x with and without imlib.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
241
diff
changeset
|
6884 #ifndef USE_IMLIB |
241
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
239
diff
changeset
|
6885 GdkBitmap *bitmap = NULL; |
244
68158098a092
Implemented dw_pixmap_new_from_file() for GTK 1.x with and without imlib.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
241
diff
changeset
|
6886 #endif |
241
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
239
diff
changeset
|
6887 #if GTK_MAJOR_VERSION > 1 |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
239
diff
changeset
|
6888 GdkPixbuf *pixbuf; |
244
68158098a092
Implemented dw_pixmap_new_from_file() for GTK 1.x with and without imlib.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
241
diff
changeset
|
6889 #elif defined(USE_IMLIB) |
68158098a092
Implemented dw_pixmap_new_from_file() for GTK 1.x with and without imlib.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
241
diff
changeset
|
6890 GdkImlibImage *image; |
241
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
239
diff
changeset
|
6891 #endif |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
239
diff
changeset
|
6892 char *file = alloca(strlen(filename) + 5); |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
239
diff
changeset
|
6893 |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
239
diff
changeset
|
6894 if (!file || !(pixmap = calloc(1,sizeof(struct _hpixmap)))) |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
239
diff
changeset
|
6895 return NULL; |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
239
diff
changeset
|
6896 |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
239
diff
changeset
|
6897 strcpy(file, filename); |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
239
diff
changeset
|
6898 |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
239
diff
changeset
|
6899 /* check if we can read from this file (it exists and read permission) */ |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
239
diff
changeset
|
6900 if(access(file, 04) != 0) |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
239
diff
changeset
|
6901 { |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
239
diff
changeset
|
6902 /* Try with .xpm extention */ |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
239
diff
changeset
|
6903 strcat(file, ".xpm"); |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
239
diff
changeset
|
6904 if(access(file, 04) != 0) |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
239
diff
changeset
|
6905 { |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
239
diff
changeset
|
6906 free(pixmap); |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
239
diff
changeset
|
6907 return NULL; |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
239
diff
changeset
|
6908 } |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
239
diff
changeset
|
6909 } |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
239
diff
changeset
|
6910 |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
239
diff
changeset
|
6911 DW_MUTEX_LOCK; |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
239
diff
changeset
|
6912 #if GTK_MAJOR_VERSION > 1 |
246
bdaaa06285fd
Missing parameter to gdk_pixmap_new_from_file() for GTK 2.0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
245
diff
changeset
|
6913 pixbuf = gdk_pixbuf_new_from_file(file, NULL); |
241
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
239
diff
changeset
|
6914 |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
239
diff
changeset
|
6915 pixmap->width = gdk_pixbuf_get_width(pixbuf); |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
239
diff
changeset
|
6916 pixmap->height = gdk_pixbuf_get_height(pixbuf); |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
239
diff
changeset
|
6917 |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
239
diff
changeset
|
6918 gdk_pixbuf_render_pixmap_and_mask(pixbuf, &pixmap->pixmap, &bitmap, 1); |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
239
diff
changeset
|
6919 g_object_unref(pixbuf); |
244
68158098a092
Implemented dw_pixmap_new_from_file() for GTK 1.x with and without imlib.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
241
diff
changeset
|
6920 #elif defined(USE_IMLIB) |
68158098a092
Implemented dw_pixmap_new_from_file() for GTK 1.x with and without imlib.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
241
diff
changeset
|
6921 image = gdk_imlib_load_image(file); |
68158098a092
Implemented dw_pixmap_new_from_file() for GTK 1.x with and without imlib.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
241
diff
changeset
|
6922 |
68158098a092
Implemented dw_pixmap_new_from_file() for GTK 1.x with and without imlib.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
241
diff
changeset
|
6923 pixmap->width = image->rgb_width; |
68158098a092
Implemented dw_pixmap_new_from_file() for GTK 1.x with and without imlib.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
241
diff
changeset
|
6924 pixmap->height = image->rgb_height; |
68158098a092
Implemented dw_pixmap_new_from_file() for GTK 1.x with and without imlib.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
241
diff
changeset
|
6925 |
245
11baf43efbc2
Must call gdk_imlib_render() before gdk_imlib_copy_image().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
244
diff
changeset
|
6926 gdk_imlib_render(image, pixmap->width, pixmap->height); |
11baf43efbc2
Must call gdk_imlib_render() before gdk_imlib_copy_image().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
244
diff
changeset
|
6927 pixmap->pixmap = gdk_imlib_copy_image(image); |
244
68158098a092
Implemented dw_pixmap_new_from_file() for GTK 1.x with and without imlib.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
241
diff
changeset
|
6928 gdk_imlib_destroy_image(image); |
68158098a092
Implemented dw_pixmap_new_from_file() for GTK 1.x with and without imlib.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
241
diff
changeset
|
6929 #else |
68158098a092
Implemented dw_pixmap_new_from_file() for GTK 1.x with and without imlib.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
241
diff
changeset
|
6930 pixmap->pixmap = gdk_pixmap_create_from_xpm(handle->window, &bitmap, &_colors[DW_CLR_PALEGRAY], file); |
241
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
239
diff
changeset
|
6931 #endif |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
239
diff
changeset
|
6932 pixmap->handle = handle; |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
239
diff
changeset
|
6933 DW_MUTEX_UNLOCK; |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
239
diff
changeset
|
6934 return pixmap; |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
239
diff
changeset
|
6935 } |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
239
diff
changeset
|
6936 |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
239
diff
changeset
|
6937 /* |
3 | 6938 * Creates a pixmap from internal resource graphic specified by id. |
6939 * Parameters: | |
6940 * handle: Window handle the pixmap is associated with. | |
6941 * id: Resource ID associated with requested pixmap. | |
6942 * Returns: | |
6943 * A handle to a pixmap or NULL on failure. | |
6944 */ | |
6945 HPIXMAP dw_pixmap_grab(HWND handle, ULONG id) | |
6946 { | |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6947 GdkBitmap *bitmap = NULL; |
3 | 6948 HPIXMAP pixmap; |
6949 int _locked_by_me = FALSE; | |
6950 | |
6951 if (!(pixmap = calloc(1,sizeof(struct _hpixmap)))) | |
6952 return NULL; | |
6953 | |
6954 | |
6955 DW_MUTEX_LOCK; | |
121
d8af32b1b1cd
Switch back to using pixmaps and bitmaps, only use pixbufs for doing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
120
diff
changeset
|
6956 pixmap->pixmap = _find_pixmap(&bitmap, id, handle, &pixmap->width, &pixmap->height); |
3 | 6957 if(pixmap->pixmap) |
6958 { | |
120
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
6959 #if GTK_MAJOR_VERSION < 2 |
3 | 6960 GdkPixmapPrivate *pvt = (GdkPixmapPrivate *)pixmap->pixmap; |
6961 pixmap->width = pvt->width; pixmap->height = pvt->height; | |
120
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
6962 #endif |
3 | 6963 } |
6964 DW_MUTEX_UNLOCK; | |
6965 return pixmap; | |
6966 } | |
6967 | |
6968 /* Call this after drawing to the screen to make sure | |
6969 * anything you have drawn is visible. | |
6970 */ | |
6971 void dw_flush(void) | |
6972 { | |
133
85f8ba78736d
Don't call gdk_flush() in GTK 2.0. It doesn't seem to be necessary and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
132
diff
changeset
|
6973 #if GTK_MAJOR_VERSION < 2 |
3 | 6974 int _locked_by_me = FALSE; |
6975 | |
6976 DW_MUTEX_LOCK; | |
6977 gdk_flush(); | |
6978 DW_MUTEX_UNLOCK; | |
133
85f8ba78736d
Don't call gdk_flush() in GTK 2.0. It doesn't seem to be necessary and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
132
diff
changeset
|
6979 #endif |
3 | 6980 } |
6981 | |
6982 /* | |
6983 * Destroys an allocated pixmap. | |
6984 * Parameters: | |
6985 * pixmap: Handle to a pixmap returned by | |
6986 * dw_pixmap_new.. | |
6987 */ | |
6988 void dw_pixmap_destroy(HPIXMAP pixmap) | |
6989 { | |
6990 int _locked_by_me = FALSE; | |
6991 | |
6992 DW_MUTEX_LOCK; | |
6993 gdk_pixmap_unref(pixmap->pixmap); | |
6994 free(pixmap); | |
6995 DW_MUTEX_UNLOCK; | |
6996 } | |
6997 | |
6998 /* | |
6999 * Copies from one item to another. | |
7000 * Parameters: | |
7001 * dest: Destination window handle. | |
7002 * destp: Destination pixmap. (choose only one). | |
7003 * xdest: X coordinate of destination. | |
7004 * ydest: Y coordinate of destination. | |
7005 * width: Width of area to copy. | |
7006 * height: Height of area to copy. | |
7007 * src: Source window handle. | |
7008 * srcp: Source pixmap. (choose only one). | |
7009 * xsrc: X coordinate of source. | |
7010 * ysrc: Y coordinate of source. | |
7011 */ | |
7012 void dw_pixmap_bitblt(HWND dest, HPIXMAP destp, int xdest, int ydest, int width, int height, HWND src, HPIXMAP srcp, int xsrc, int ysrc) | |
7013 { | |
47
997e9ed670ef
Fixes for box alignment problem on OS/2, crash in dw_bitmap_new() on unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
46
diff
changeset
|
7014 /* Ok, these #ifdefs are going to get a bit confusing because |
997e9ed670ef
Fixes for box alignment problem on OS/2, crash in dw_bitmap_new() on unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
46
diff
changeset
|
7015 * when using gdk-pixbuf, pixmaps are really pixbufs, so we |
997e9ed670ef
Fixes for box alignment problem on OS/2, crash in dw_bitmap_new() on unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
46
diff
changeset
|
7016 * have to use the pixbuf functions on them, and thus convoluting |
997e9ed670ef
Fixes for box alignment problem on OS/2, crash in dw_bitmap_new() on unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
46
diff
changeset
|
7017 * the code here a bit. -Brian |
997e9ed670ef
Fixes for box alignment problem on OS/2, crash in dw_bitmap_new() on unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
46
diff
changeset
|
7018 */ |
3 | 7019 int _locked_by_me = FALSE; |
7020 GdkGC *gc = NULL; | |
7021 | |
47
997e9ed670ef
Fixes for box alignment problem on OS/2, crash in dw_bitmap_new() on unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
46
diff
changeset
|
7022 if((!dest && (!destp || !destp->pixmap)) || (!src && (!srcp || !srcp->pixmap))) |
3 | 7023 return; |
7024 | |
7025 DW_MUTEX_LOCK; | |
7026 if(dest) | |
7027 gc = _set_colors(dest->window); | |
7028 else if(src) | |
7029 gc = _set_colors(src->window); | |
7030 else if(destp) | |
7031 gc = gdk_gc_new(destp->pixmap); | |
7032 else if(srcp) | |
7033 gc = gdk_gc_new(srcp->pixmap); | |
122
a05b6fb9c545
Minor bug fixes and code cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
121
diff
changeset
|
7034 |
a05b6fb9c545
Minor bug fixes and code cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
121
diff
changeset
|
7035 if(gc) |
a05b6fb9c545
Minor bug fixes and code cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
121
diff
changeset
|
7036 { |
a05b6fb9c545
Minor bug fixes and code cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
121
diff
changeset
|
7037 gdk_draw_pixmap(dest ? dest->window : destp->pixmap, gc, src ? src->window : srcp->pixmap, xsrc, ysrc, xdest, ydest, width, height); |
47
997e9ed670ef
Fixes for box alignment problem on OS/2, crash in dw_bitmap_new() on unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
46
diff
changeset
|
7038 gdk_gc_unref(gc); |
3 | 7039 } |
7040 DW_MUTEX_UNLOCK; | |
7041 } | |
7042 | |
7043 /* | |
7044 * Emits a beep. | |
7045 * Parameters: | |
7046 * freq: Frequency. | |
7047 * dur: Duration. | |
7048 */ | |
7049 void dw_beep(int freq, int dur) | |
7050 { | |
7051 int _locked_by_me = FALSE; | |
7052 | |
7053 DW_MUTEX_LOCK; | |
7054 gdk_beep(); | |
7055 DW_MUTEX_UNLOCK; | |
7056 } | |
7057 | |
157
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7058 void _my_strlwr(char *buf) |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7059 { |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7060 int z, len = strlen(buf); |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7061 |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7062 for(z=0;z<len;z++) |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7063 { |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7064 if(buf[z] >= 'A' && buf[z] <= 'Z') |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7065 buf[z] -= 'A' - 'a'; |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7066 } |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7067 } |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7068 |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7069 /* Open a shared library and return a handle. |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7070 * Parameters: |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7071 * name: Base name of the shared library. |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7072 * handle: Pointer to a module handle, |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7073 * will be filled in with the handle. |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7074 */ |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7075 int dw_module_load(char *name, HMOD *handle) |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7076 { |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7077 int len; |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7078 char *newname; |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7079 char errorbuf[1024]; |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7080 |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7081 |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7082 if(!handle) |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7083 return -1; |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7084 |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7085 if((len = strlen(name)) == 0) |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7086 return -1; |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7087 |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7088 /* Lenth + "lib" + ".so" + NULL */ |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7089 newname = malloc(len + 7); |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7090 |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7091 if(!newname) |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7092 return -1; |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7093 |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7094 sprintf(newname, "lib%s.so", name); |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7095 _my_strlwr(newname); |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7096 |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7097 *handle = dlopen(newname, RTLD_NOW); |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7098 if(*handle == NULL) |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7099 { |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7100 strncpy(errorbuf, dlerror(), 1024); |
482
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
7101 printf("%s\n", errorbuf); |
157
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7102 sprintf(newname, "lib%s.so", name); |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7103 *handle = dlopen(newname, RTLD_NOW); |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7104 } |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7105 |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7106 free(newname); |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7107 |
163
0322836c5299
Return -1 on error from dw_module_load().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
162
diff
changeset
|
7108 return (NULL == *handle) ? -1 : 0; |
157
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7109 } |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7110 |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7111 /* Queries the address of a symbol within open handle. |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7112 * Parameters: |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7113 * handle: Module handle returned by dw_module_load() |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7114 * name: Name of the symbol you want the address of. |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7115 * func: A pointer to a function pointer, to obtain |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7116 * the address. |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7117 */ |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7118 int dw_module_symbol(HMOD handle, char *name, void**func) |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7119 { |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7120 if(!func || !name) |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7121 return -1; |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7122 |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7123 if(strlen(name) == 0) |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7124 return -1; |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7125 |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7126 *func = (void*)dlsym(handle, name); |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7127 return (NULL == *func); |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7128 } |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7129 |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7130 /* Frees the shared library previously opened. |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7131 * Parameters: |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7132 * handle: Module handle returned by dw_module_load() |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7133 */ |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7134 int dw_module_close(HMOD handle) |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7135 { |
162
df59a3fc6de6
Fixed a minor bug in dw_module_close().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
7136 if(handle) |
df59a3fc6de6
Fixed a minor bug in dw_module_close().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
7137 return dlclose(handle); |
df59a3fc6de6
Fixed a minor bug in dw_module_close().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
7138 return 0; |
157
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7139 } |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7140 |
3 | 7141 /* |
7142 * Returns the handle to an unnamed mutex semaphore. | |
7143 */ | |
7144 HMTX dw_mutex_new(void) | |
7145 { | |
239
403b07f873e1
Use a pointer for HMTX instead of a pthread_mutex_t struct.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
237
diff
changeset
|
7146 HMTX mutex = malloc(sizeof(pthread_mutex_t)); |
403b07f873e1
Use a pointer for HMTX instead of a pthread_mutex_t struct.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
237
diff
changeset
|
7147 |
403b07f873e1
Use a pointer for HMTX instead of a pthread_mutex_t struct.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
237
diff
changeset
|
7148 pthread_mutex_init(mutex, NULL); |
3 | 7149 return mutex; |
7150 } | |
7151 | |
7152 /* | |
7153 * Closes a semaphore created by dw_mutex_new(). | |
7154 * Parameters: | |
7155 * mutex: The handle to the mutex returned by dw_mutex_new(). | |
7156 */ | |
7157 void dw_mutex_close(HMTX mutex) | |
7158 { | |
239
403b07f873e1
Use a pointer for HMTX instead of a pthread_mutex_t struct.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
237
diff
changeset
|
7159 if(mutex) |
403b07f873e1
Use a pointer for HMTX instead of a pthread_mutex_t struct.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
237
diff
changeset
|
7160 { |
403b07f873e1
Use a pointer for HMTX instead of a pthread_mutex_t struct.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
237
diff
changeset
|
7161 pthread_mutex_destroy(mutex); |
403b07f873e1
Use a pointer for HMTX instead of a pthread_mutex_t struct.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
237
diff
changeset
|
7162 free(mutex); |
403b07f873e1
Use a pointer for HMTX instead of a pthread_mutex_t struct.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
237
diff
changeset
|
7163 } |
3 | 7164 } |
7165 | |
7166 /* | |
7167 * Tries to gain access to the semaphore, if it can't it blocks. | |
7168 * Parameters: | |
7169 * mutex: The handle to the mutex returned by dw_mutex_new(). | |
7170 */ | |
7171 void dw_mutex_lock(HMTX mutex) | |
7172 { | |
96
baaf4b04d284
Fixed a deadlock when locking a mutex from an event handler on FreeBSD.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
94
diff
changeset
|
7173 /* If we are being called from an event handler we must release |
baaf4b04d284
Fixed a deadlock when locking a mutex from an event handler on FreeBSD.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
94
diff
changeset
|
7174 * the GTK mutex so we don't deadlock. |
baaf4b04d284
Fixed a deadlock when locking a mutex from an event handler on FreeBSD.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
94
diff
changeset
|
7175 */ |
baaf4b04d284
Fixed a deadlock when locking a mutex from an event handler on FreeBSD.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
94
diff
changeset
|
7176 if(pthread_self() == _dw_thread) |
baaf4b04d284
Fixed a deadlock when locking a mutex from an event handler on FreeBSD.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
94
diff
changeset
|
7177 gdk_threads_leave(); |
baaf4b04d284
Fixed a deadlock when locking a mutex from an event handler on FreeBSD.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
94
diff
changeset
|
7178 |
239
403b07f873e1
Use a pointer for HMTX instead of a pthread_mutex_t struct.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
237
diff
changeset
|
7179 pthread_mutex_lock(mutex); |
96
baaf4b04d284
Fixed a deadlock when locking a mutex from an event handler on FreeBSD.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
94
diff
changeset
|
7180 |
baaf4b04d284
Fixed a deadlock when locking a mutex from an event handler on FreeBSD.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
94
diff
changeset
|
7181 /* And of course relock it when we have acquired the mutext */ |
baaf4b04d284
Fixed a deadlock when locking a mutex from an event handler on FreeBSD.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
94
diff
changeset
|
7182 if(pthread_self() == _dw_thread) |
baaf4b04d284
Fixed a deadlock when locking a mutex from an event handler on FreeBSD.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
94
diff
changeset
|
7183 gdk_threads_enter(); |
3 | 7184 } |
7185 | |
7186 /* | |
7187 * Reliquishes the access to the semaphore. | |
7188 * Parameters: | |
7189 * mutex: The handle to the mutex returned by dw_mutex_new(). | |
7190 */ | |
7191 void dw_mutex_unlock(HMTX mutex) | |
7192 { | |
239
403b07f873e1
Use a pointer for HMTX instead of a pthread_mutex_t struct.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
237
diff
changeset
|
7193 pthread_mutex_unlock(mutex); |
3 | 7194 } |
7195 | |
7196 /* | |
7197 * Returns the handle to an unnamed event semaphore. | |
7198 */ | |
7199 HEV dw_event_new(void) | |
7200 { | |
7201 HEV eve = (HEV)malloc(sizeof(struct _dw_unix_event)); | |
7202 | |
7203 if(!eve) | |
7204 return NULL; | |
7205 | |
7206 /* We need to be careful here, mutexes on Linux are | |
7207 * FAST by default but are error checking on other | |
7208 * systems such as FreeBSD and OS/2, perhaps others. | |
7209 */ | |
7210 pthread_mutex_init (&(eve->mutex), NULL); | |
7211 pthread_mutex_lock (&(eve->mutex)); | |
7212 pthread_cond_init (&(eve->event), NULL); | |
7213 | |
7214 pthread_mutex_unlock (&(eve->mutex)); | |
7215 eve->alive = 1; | |
7216 eve->posted = 0; | |
7217 | |
7218 return eve; | |
7219 } | |
7220 | |
7221 /* | |
7222 * Resets a semaphore created by dw_event_new(). | |
7223 * Parameters: | |
7224 * eve: The handle to the event returned by dw_event_new(). | |
7225 */ | |
7226 int dw_event_reset (HEV eve) | |
7227 { | |
7228 if(!eve) | |
7229 return FALSE; | |
7230 | |
7231 pthread_mutex_lock (&(eve->mutex)); | |
7232 pthread_cond_broadcast (&(eve->event)); | |
7233 pthread_cond_init (&(eve->event), NULL); | |
7234 eve->posted = 0; | |
7235 pthread_mutex_unlock (&(eve->mutex)); | |
7236 return 0; | |
7237 } | |
7238 | |
7239 /* | |
7240 * Posts a semaphore created by dw_event_new(). Causing all threads | |
7241 * waiting on this event in dw_event_wait to continue. | |
7242 * Parameters: | |
7243 * eve: The handle to the event returned by dw_event_new(). | |
7244 */ | |
7245 int dw_event_post (HEV eve) | |
7246 { | |
7247 if(!eve) | |
7248 return FALSE; | |
7249 | |
7250 pthread_mutex_lock (&(eve->mutex)); | |
7251 pthread_cond_broadcast (&(eve->event)); | |
7252 eve->posted = 1; | |
7253 pthread_mutex_unlock (&(eve->mutex)); | |
7254 return 0; | |
7255 } | |
7256 | |
7257 /* | |
7258 * Waits on a semaphore created by dw_event_new(), until the | |
7259 * event gets posted or until the timeout expires. | |
7260 * Parameters: | |
7261 * eve: The handle to the event returned by dw_event_new(). | |
7262 */ | |
7263 int dw_event_wait(HEV eve, unsigned long timeout) | |
7264 { | |
7265 int rc; | |
7266 struct timeval now; | |
7267 struct timespec timeo; | |
7268 | |
7269 if(!eve) | |
7270 return FALSE; | |
7271 | |
7272 if(eve->posted) | |
7273 return 0; | |
7274 | |
7275 pthread_mutex_lock (&(eve->mutex)); | |
7276 gettimeofday(&now, 0); | |
7277 timeo.tv_sec = now.tv_sec + (timeout / 1000); | |
7278 timeo.tv_nsec = now.tv_usec * 1000; | |
7279 rc = pthread_cond_timedwait (&(eve->event), &(eve->mutex), &timeo); | |
7280 pthread_mutex_unlock (&(eve->mutex)); | |
7281 if(!rc) | |
7282 return 1; | |
7283 if(rc == ETIMEDOUT) | |
7284 return -1; | |
7285 return 0; | |
7286 } | |
7287 | |
7288 /* | |
7289 * Closes a semaphore created by dw_event_new(). | |
7290 * Parameters: | |
7291 * eve: The handle to the event returned by dw_event_new(). | |
7292 */ | |
7293 int dw_event_close(HEV *eve) | |
7294 { | |
7295 if(!eve || !(*eve)) | |
7296 return FALSE; | |
7297 | |
7298 pthread_mutex_lock (&((*eve)->mutex)); | |
7299 pthread_cond_destroy (&((*eve)->event)); | |
7300 pthread_mutex_unlock (&((*eve)->mutex)); | |
7301 pthread_mutex_destroy (&((*eve)->mutex)); | |
7302 free(*eve); | |
7303 *eve = NULL; | |
7304 | |
7305 return TRUE; | |
7306 } | |
7307 | |
7308 /* | |
48
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
7309 * Setup thread independent color sets. |
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
7310 */ |
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
7311 void _dwthreadstart(void *data) |
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
7312 { |
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
7313 void (*threadfunc)(void *) = NULL; |
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
7314 void **tmp = (void **)data; |
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
7315 |
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
7316 threadfunc = (void (*)(void *))tmp[0]; |
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
7317 |
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
7318 _dw_thread_add(dw_thread_id()); |
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
7319 threadfunc(tmp[1]); |
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
7320 _dw_thread_remove(dw_thread_id()); |
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
7321 free(tmp); |
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
7322 } |
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
7323 /* |
3 | 7324 * Creates a new thread with a starting point of func. |
7325 * Parameters: | |
7326 * func: Function which will be run in the new thread. | |
7327 * data: Parameter(s) passed to the function. | |
7328 * stack: Stack size of new thread (OS/2 and Windows only). | |
7329 */ | |
7330 DWTID dw_thread_new(void *func, void *data, int stack) | |
7331 { | |
7332 DWTID gtkthread; | |
48
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
7333 void **tmp = malloc(sizeof(void *) * 2); |
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
7334 |
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
7335 tmp[0] = func; |
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
7336 tmp[1] = data; |
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
7337 |
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
7338 pthread_create(>kthread, NULL, (void *)_dwthreadstart, (void *)tmp); |
3 | 7339 return gtkthread; |
7340 } | |
7341 | |
7342 /* | |
7343 * Ends execution of current thread immediately. | |
7344 */ | |
7345 void dw_thread_end(void) | |
7346 { | |
7347 pthread_exit(NULL); | |
7348 } | |
7349 | |
7350 /* | |
48
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
7351 * Returns the current thread's ID. |
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
7352 */ |
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
7353 DWTID dw_thread_id(void) |
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
7354 { |
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
7355 return (DWTID)pthread_self(); |
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
7356 } |
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
7357 |
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
7358 /* |
3 | 7359 * Cleanly terminates a DW session, should be signal handler safe. |
7360 * Parameters: | |
7361 * exitcode: Exit code reported to the operating system. | |
7362 */ | |
7363 void dw_exit(int exitcode) | |
7364 { | |
7365 exit(exitcode); | |
7366 } | |
7367 | |
36
cddb02f847e1
Added unix versions of functions in compat, and added getfsname, plus
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
7368 #define DW_EXPAND (GTK_EXPAND | GTK_SHRINK | GTK_FILL) |
cddb02f847e1
Added unix versions of functions in compat, and added getfsname, plus
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
7369 |
3 | 7370 /* |
7371 * Pack windows (widgets) into a box from the end (or bottom). | |
7372 * Parameters: | |
7373 * box: Window handle of the box to be packed into. | |
7374 * item: Window handle of the item to be back. | |
7375 * width: Width in pixels of the item or -1 to be self determined. | |
7376 * height: Height in pixels of the item or -1 to be self determined. | |
7377 * hsize: TRUE if the window (widget) should expand horizontally to fill space given. | |
7378 * vsize: TRUE if the window (widget) should expand vertically to fill space given. | |
7379 * pad: Number of pixels of padding around the item. | |
7380 */ | |
7381 void dw_box_pack_end(HWND box, HWND item, int width, int height, int hsize, int vsize, int pad) | |
7382 { | |
442
7c8bd3bc6c27
Throw the warning after the mutex has been released in dw_box_pack_*
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
438
diff
changeset
|
7383 int warn = FALSE, _locked_by_me = FALSE; |
493
84e471a4ec7e
Don't warn in dw_box_pack_*() for groupboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
491
diff
changeset
|
7384 GtkWidget *tmp, *tmpitem; |
3 | 7385 |
7386 if(!box) | |
7387 return; | |
7388 | |
447
5a0779561d0f
Add more tests for dw_pac*() functions. Throw up a messagebox if you try and
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
442
diff
changeset
|
7389 /* |
5a0779561d0f
Add more tests for dw_pac*() functions. Throw up a messagebox if you try and
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
442
diff
changeset
|
7390 * If you try and pack an item into itself VERY bad things can happen; like at least an |
5a0779561d0f
Add more tests for dw_pac*() functions. Throw up a messagebox if you try and
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
442
diff
changeset
|
7391 * infinite loop on GTK! Lets be safe! |
5a0779561d0f
Add more tests for dw_pac*() functions. Throw up a messagebox if you try and
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
442
diff
changeset
|
7392 */ |
5a0779561d0f
Add more tests for dw_pac*() functions. Throw up a messagebox if you try and
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
442
diff
changeset
|
7393 if(box == item) |
5a0779561d0f
Add more tests for dw_pac*() functions. Throw up a messagebox if you try and
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
442
diff
changeset
|
7394 { |
5a0779561d0f
Add more tests for dw_pac*() functions. Throw up a messagebox if you try and
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
442
diff
changeset
|
7395 dw_messagebox("dw_box_pack_end()", DW_MB_OK|DW_MB_ERROR, "Danger! Danger! Will Robinson; box and item are the same!",box,item); |
5a0779561d0f
Add more tests for dw_pac*() functions. Throw up a messagebox if you try and
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
442
diff
changeset
|
7396 return; |
5a0779561d0f
Add more tests for dw_pac*() functions. Throw up a messagebox if you try and
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
442
diff
changeset
|
7397 } |
5a0779561d0f
Add more tests for dw_pac*() functions. Throw up a messagebox if you try and
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
442
diff
changeset
|
7398 |
3 | 7399 DW_MUTEX_LOCK; |
7400 | |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
7401 if((tmp = gtk_object_get_data(GTK_OBJECT(box), "_dw_boxhandle"))) |
37
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
36
diff
changeset
|
7402 box = tmp; |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
36
diff
changeset
|
7403 |
3 | 7404 if(!item) |
7405 { | |
7406 item = gtk_label_new(""); | |
7407 gtk_widget_show(item); | |
7408 } | |
7409 | |
493
84e471a4ec7e
Don't warn in dw_box_pack_*() for groupboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
491
diff
changeset
|
7410 tmpitem = (GtkWidget *)gtk_object_get_data(GTK_OBJECT(item), "_dw_boxhandle"); |
84e471a4ec7e
Don't warn in dw_box_pack_*() for groupboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
491
diff
changeset
|
7411 |
36
cddb02f847e1
Added unix versions of functions in compat, and added getfsname, plus
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
7412 if(GTK_IS_TABLE(box)) |
3 | 7413 { |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
7414 int boxcount = (int)gtk_object_get_data(GTK_OBJECT(box), "_dw_boxcount"); |
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
7415 int boxtype = (int)gtk_object_get_data(GTK_OBJECT(box), "_dw_boxtype"); |
36
cddb02f847e1
Added unix versions of functions in compat, and added getfsname, plus
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
7416 |
cddb02f847e1
Added unix versions of functions in compat, and added getfsname, plus
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
7417 /* If the item being packed is a box, then we use it's padding |
cddb02f847e1
Added unix versions of functions in compat, and added getfsname, plus
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
7418 * instead of the padding specified on the pack line, this is |
cddb02f847e1
Added unix versions of functions in compat, and added getfsname, plus
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
7419 * due to a bug in the OS/2 and Win32 renderer and a limitation |
cddb02f847e1
Added unix versions of functions in compat, and added getfsname, plus
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
7420 * of the GtkTable class. |
cddb02f847e1
Added unix versions of functions in compat, and added getfsname, plus
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
7421 */ |
493
84e471a4ec7e
Don't warn in dw_box_pack_*() for groupboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
491
diff
changeset
|
7422 if(GTK_IS_TABLE(item) || (tmpitem && GTK_IS_TABLE(tmpitem))) |
48
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
7423 { |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
7424 GtkWidget *eventbox = (GtkWidget *)gtk_object_get_data(GTK_OBJECT(item), "_dw_eventbox"); |
48
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
7425 |
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
7426 if(eventbox) |
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
7427 { |
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
7428 gtk_container_add(GTK_CONTAINER(eventbox), item); |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
7429 pad = (int)gtk_object_get_data(GTK_OBJECT(item), "_dw_boxpad"); |
48
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
7430 item = eventbox; |
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
7431 } |
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
7432 } |
438
fac2afe7bda3
Only throw up the messagebox when expand and size are both 0 and the item
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
429
diff
changeset
|
7433 else |
fac2afe7bda3
Only throw up the messagebox when expand and size are both 0 and the item
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
429
diff
changeset
|
7434 { |
442
7c8bd3bc6c27
Throw the warning after the mutex has been released in dw_box_pack_*
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
438
diff
changeset
|
7435 /* Only show warning if item is not a box */ |
7c8bd3bc6c27
Throw the warning after the mutex has been released in dw_box_pack_*
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
438
diff
changeset
|
7436 warn = TRUE; |
438
fac2afe7bda3
Only throw up the messagebox when expand and size are both 0 and the item
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
429
diff
changeset
|
7437 } |
36
cddb02f847e1
Added unix versions of functions in compat, and added getfsname, plus
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
7438 |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
282
diff
changeset
|
7439 if(boxtype == DW_VERT) |
36
cddb02f847e1
Added unix versions of functions in compat, and added getfsname, plus
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
7440 gtk_table_resize(GTK_TABLE(box), boxcount + 1, 1); |
cddb02f847e1
Added unix versions of functions in compat, and added getfsname, plus
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
7441 else |
cddb02f847e1
Added unix versions of functions in compat, and added getfsname, plus
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
7442 gtk_table_resize(GTK_TABLE(box), 1, boxcount + 1); |
cddb02f847e1
Added unix versions of functions in compat, and added getfsname, plus
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
7443 |
cddb02f847e1
Added unix versions of functions in compat, and added getfsname, plus
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
7444 gtk_table_attach(GTK_TABLE(box), item, 0, 1, 0, 1, hsize ? DW_EXPAND : 0, vsize ? DW_EXPAND : 0, pad, pad); |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
7445 gtk_object_set_data(GTK_OBJECT(box), "_dw_boxcount", (gpointer)boxcount + 1); |
3 | 7446 gtk_widget_set_usize(item, width, height); |
7447 if(GTK_IS_RADIO_BUTTON(item)) | |
7448 { | |
7449 GSList *group; | |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
7450 GtkWidget *groupstart = (GtkWidget *)gtk_object_get_data(GTK_OBJECT(box), "_dw_group"); |
3 | 7451 |
7452 if(groupstart) | |
7453 { | |
7454 group = gtk_radio_button_group(GTK_RADIO_BUTTON(groupstart)); | |
7455 gtk_radio_button_set_group(GTK_RADIO_BUTTON(item), group); | |
7456 } | |
7457 else | |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
7458 gtk_object_set_data(GTK_OBJECT(box), "_dw_group", (gpointer)item); |
3 | 7459 } |
7460 } | |
7461 else | |
7462 { | |
7463 GtkWidget *vbox = gtk_vbox_new(FALSE, 0); | |
7464 | |
493
84e471a4ec7e
Don't warn in dw_box_pack_*() for groupboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
491
diff
changeset
|
7465 if(GTK_IS_TABLE(item) || (tmpitem && GTK_IS_TABLE(tmpitem))) |
48
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
7466 { |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
7467 GtkWidget *eventbox = (GtkWidget *)gtk_object_get_data(GTK_OBJECT(item), "_dw_eventbox"); |
48
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
7468 |
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
7469 if(eventbox) |
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
7470 { |
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
7471 gtk_container_add(GTK_CONTAINER(eventbox), item); |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
7472 pad = (int)gtk_object_get_data(GTK_OBJECT(item), "_dw_boxpad"); |
48
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
7473 item = eventbox; |
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
7474 } |
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
7475 } |
438
fac2afe7bda3
Only throw up the messagebox when expand and size are both 0 and the item
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
429
diff
changeset
|
7476 else |
fac2afe7bda3
Only throw up the messagebox when expand and size are both 0 and the item
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
429
diff
changeset
|
7477 { |
442
7c8bd3bc6c27
Throw the warning after the mutex has been released in dw_box_pack_*
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
438
diff
changeset
|
7478 /* Only show warning if item is not a box */ |
7c8bd3bc6c27
Throw the warning after the mutex has been released in dw_box_pack_*
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
438
diff
changeset
|
7479 warn = TRUE; |
438
fac2afe7bda3
Only throw up the messagebox when expand and size are both 0 and the item
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
429
diff
changeset
|
7480 } |
48
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
7481 |
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
7482 gtk_container_border_width(GTK_CONTAINER(box), pad); |
3 | 7483 gtk_container_add(GTK_CONTAINER(box), vbox); |
36
cddb02f847e1
Added unix versions of functions in compat, and added getfsname, plus
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
7484 gtk_box_pack_end(GTK_BOX(vbox), item, TRUE, TRUE, 0); |
3 | 7485 gtk_widget_show(vbox); |
7486 | |
7487 gtk_widget_set_usize(item, width, height); | |
7488 gtk_object_set_user_data(GTK_OBJECT(box), vbox); | |
7489 } | |
7490 DW_MUTEX_UNLOCK; | |
442
7c8bd3bc6c27
Throw the warning after the mutex has been released in dw_box_pack_*
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
438
diff
changeset
|
7491 |
7c8bd3bc6c27
Throw the warning after the mutex has been released in dw_box_pack_*
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
438
diff
changeset
|
7492 if(warn) |
7c8bd3bc6c27
Throw the warning after the mutex has been released in dw_box_pack_*
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
438
diff
changeset
|
7493 { |
7c8bd3bc6c27
Throw the warning after the mutex has been released in dw_box_pack_*
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
438
diff
changeset
|
7494 if ( width == 0 && hsize == FALSE ) |
7c8bd3bc6c27
Throw the warning after the mutex has been released in dw_box_pack_*
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
438
diff
changeset
|
7495 dw_messagebox("dw_box_pack_end()", DW_MB_OK|DW_MB_ERROR, "Width and expand Horizonal both unset for box: %x item: %x",box,item); |
7c8bd3bc6c27
Throw the warning after the mutex has been released in dw_box_pack_*
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
438
diff
changeset
|
7496 if ( height == 0 && vsize == FALSE ) |
7c8bd3bc6c27
Throw the warning after the mutex has been released in dw_box_pack_*
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
438
diff
changeset
|
7497 dw_messagebox("dw_box_pack_end()", DW_MB_OK|DW_MB_ERROR, "Height and expand Vertical both unset for box: %x item: %x",box,item); |
7c8bd3bc6c27
Throw the warning after the mutex has been released in dw_box_pack_*
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
438
diff
changeset
|
7498 } |
3 | 7499 } |
7500 | |
7501 /* | |
7502 * Sets the size of a given window (widget). | |
7503 * Parameters: | |
7504 * handle: Window (widget) handle. | |
7505 * width: New width in pixels. | |
7506 * height: New height in pixels. | |
7507 */ | |
510
710f82598210
Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
508
diff
changeset
|
7508 void dw_window_set_size(HWND handle, unsigned long width, unsigned long height) |
3 | 7509 { |
7510 int _locked_by_me = FALSE; | |
7511 | |
148
830f591c87f1
dw_window_set_usize fixes and fallback to "fixed" on GTK 1.2 if pango
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
147
diff
changeset
|
7512 if(!handle) |
830f591c87f1
dw_window_set_usize fixes and fallback to "fixed" on GTK 1.2 if pango
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
147
diff
changeset
|
7513 return; |
830f591c87f1
dw_window_set_usize fixes and fallback to "fixed" on GTK 1.2 if pango
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
147
diff
changeset
|
7514 |
3 | 7515 DW_MUTEX_LOCK; |
7516 if(GTK_IS_WINDOW(handle)) | |
148
830f591c87f1
dw_window_set_usize fixes and fallback to "fixed" on GTK 1.2 if pango
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
147
diff
changeset
|
7517 { |
3 | 7518 _size_allocate(GTK_WINDOW(handle)); |
148
830f591c87f1
dw_window_set_usize fixes and fallback to "fixed" on GTK 1.2 if pango
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
147
diff
changeset
|
7519 if(handle->window) |
830f591c87f1
dw_window_set_usize fixes and fallback to "fixed" on GTK 1.2 if pango
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
147
diff
changeset
|
7520 gdk_window_resize(handle->window, width - _dw_border_width, height - _dw_border_height); |
830f591c87f1
dw_window_set_usize fixes and fallback to "fixed" on GTK 1.2 if pango
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
147
diff
changeset
|
7521 gtk_window_set_default_size(GTK_WINDOW(handle), width - _dw_border_width, height - _dw_border_height); |
272
49ac97060328
Fixes for default window size when the window does not have the sizeable
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
271
diff
changeset
|
7522 if(!gtk_object_get_data(GTK_OBJECT(handle), "_dw_size")) |
49ac97060328
Fixes for default window size when the window does not have the sizeable
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
271
diff
changeset
|
7523 { |
49ac97060328
Fixes for default window size when the window does not have the sizeable
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
271
diff
changeset
|
7524 gtk_object_set_data(GTK_OBJECT(handle), "_dw_width", (gpointer)width - _dw_border_width); |
49ac97060328
Fixes for default window size when the window does not have the sizeable
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
271
diff
changeset
|
7525 gtk_object_set_data(GTK_OBJECT(handle), "_dw_height", (gpointer)height - _dw_border_height); |
49ac97060328
Fixes for default window size when the window does not have the sizeable
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
271
diff
changeset
|
7526 } |
148
830f591c87f1
dw_window_set_usize fixes and fallback to "fixed" on GTK 1.2 if pango
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
147
diff
changeset
|
7527 } |
3 | 7528 else |
7529 gtk_widget_set_usize(handle, width, height); | |
7530 DW_MUTEX_UNLOCK; | |
7531 } | |
7532 | |
7533 /* | |
7534 * Returns the width of the screen. | |
7535 */ | |
7536 int dw_screen_width(void) | |
7537 { | |
7538 int retval; | |
7539 int _locked_by_me = FALSE; | |
7540 | |
7541 DW_MUTEX_LOCK; | |
7542 retval = gdk_screen_width(); | |
7543 DW_MUTEX_UNLOCK; | |
7544 return retval; | |
7545 } | |
7546 | |
7547 /* | |
7548 * Returns the height of the screen. | |
7549 */ | |
7550 int dw_screen_height(void) | |
7551 { | |
7552 int retval; | |
7553 int _locked_by_me = FALSE; | |
7554 | |
7555 DW_MUTEX_UNLOCK; | |
7556 retval = gdk_screen_height(); | |
7557 DW_MUTEX_UNLOCK; | |
7558 return retval; | |
7559 } | |
7560 | |
7561 /* This should return the current color depth */ | |
514
08d770271709
More function name changes for Rexx/DW compatibility.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
513
diff
changeset
|
7562 unsigned long dw_color_depth_get(void) |
3 | 7563 { |
7564 int retval; | |
7565 int _locked_by_me = FALSE; | |
7566 | |
7567 DW_MUTEX_UNLOCK; | |
86
a2b13e127d25
Make dw_color_depth() return the correct value on Unix.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
85
diff
changeset
|
7568 retval = gdk_visual_get_best_depth(); |
3 | 7569 DW_MUTEX_UNLOCK; |
7570 return retval; | |
7571 } | |
7572 | |
7573 /* | |
7574 * Sets the position of a given window (widget). | |
7575 * Parameters: | |
7576 * handle: Window (widget) handle. | |
7577 * x: X location from the bottom left. | |
7578 * y: Y location from the bottom left. | |
7579 */ | |
7580 void dw_window_set_pos(HWND handle, unsigned long x, unsigned long y) | |
7581 { | |
7582 int _locked_by_me = FALSE; | |
7583 | |
7584 DW_MUTEX_LOCK; | |
14
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
7585 if(handle && handle->window) |
3 | 7586 gdk_window_move(handle->window, x, y); |
7587 DW_MUTEX_UNLOCK; | |
7588 } | |
7589 | |
7590 /* | |
7591 * Sets the position and size of a given window (widget). | |
7592 * Parameters: | |
7593 * handle: Window (widget) handle. | |
7594 * x: X location from the bottom left. | |
7595 * y: Y location from the bottom left. | |
7596 * width: Width of the widget. | |
7597 * height: Height of the widget. | |
7598 */ | |
7599 void dw_window_set_pos_size(HWND handle, unsigned long x, unsigned long y, unsigned long width, unsigned long height) | |
7600 { | |
7601 int _locked_by_me = FALSE; | |
7602 | |
148
830f591c87f1
dw_window_set_usize fixes and fallback to "fixed" on GTK 1.2 if pango
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
147
diff
changeset
|
7603 if(!handle) |
830f591c87f1
dw_window_set_usize fixes and fallback to "fixed" on GTK 1.2 if pango
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
147
diff
changeset
|
7604 return; |
830f591c87f1
dw_window_set_usize fixes and fallback to "fixed" on GTK 1.2 if pango
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
147
diff
changeset
|
7605 |
830f591c87f1
dw_window_set_usize fixes and fallback to "fixed" on GTK 1.2 if pango
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
147
diff
changeset
|
7606 DW_MUTEX_LOCK; |
830f591c87f1
dw_window_set_usize fixes and fallback to "fixed" on GTK 1.2 if pango
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
147
diff
changeset
|
7607 if(GTK_IS_WINDOW(handle)) |
3 | 7608 { |
510
710f82598210
Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
508
diff
changeset
|
7609 dw_window_set_size(handle, width, height); |
15
81833f25b1aa
Added new Dynamic Windows build information to the DWEnv struct.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
14
diff
changeset
|
7610 gtk_widget_set_uposition(handle, x, y); |
3 | 7611 } |
148
830f591c87f1
dw_window_set_usize fixes and fallback to "fixed" on GTK 1.2 if pango
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
147
diff
changeset
|
7612 else if(handle->window) |
3 | 7613 { |
7614 gdk_window_resize(handle->window, width, height); | |
7615 gdk_window_move(handle->window, x, y); | |
7616 } | |
7617 DW_MUTEX_UNLOCK; | |
7618 } | |
7619 | |
7620 /* | |
7621 * Gets the position and size of a given window (widget). | |
7622 * Parameters: | |
7623 * handle: Window (widget) handle. | |
7624 * x: X location from the bottom left. | |
7625 * y: Y location from the bottom left. | |
7626 * width: Width of the widget. | |
7627 * height: Height of the widget. | |
7628 */ | |
7629 void dw_window_get_pos_size(HWND handle, ULONG *x, ULONG *y, ULONG *width, ULONG *height) | |
7630 { | |
7631 int _locked_by_me = FALSE; | |
7632 gint gx, gy, gwidth, gheight, gdepth; | |
7633 | |
12
26e2130135b9
Many Win32 and GTK fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
7
diff
changeset
|
7634 if(handle && handle->window) |
3 | 7635 { |
7636 DW_MUTEX_LOCK; | |
14
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
7637 |
3 | 7638 gdk_window_get_geometry(handle->window, &gx, &gy, &gwidth, &gheight, &gdepth); |
7639 gdk_window_get_root_origin(handle->window, &gx, &gy); | |
7640 if(x) | |
7641 *x = gx; | |
7642 if(y) | |
7643 *y = gy; | |
37
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
36
diff
changeset
|
7644 if(GTK_IS_WINDOW(handle)) |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
36
diff
changeset
|
7645 { |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
36
diff
changeset
|
7646 if(width) |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
36
diff
changeset
|
7647 *width = gwidth + _dw_border_width; |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
36
diff
changeset
|
7648 if(height) |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
36
diff
changeset
|
7649 *height = gheight + _dw_border_height; |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
36
diff
changeset
|
7650 } |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
36
diff
changeset
|
7651 else |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
36
diff
changeset
|
7652 { |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
36
diff
changeset
|
7653 if(width) |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
36
diff
changeset
|
7654 *width = gwidth; |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
36
diff
changeset
|
7655 if(height) |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
36
diff
changeset
|
7656 *height = gheight; |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
36
diff
changeset
|
7657 } |
3 | 7658 DW_MUTEX_UNLOCK; |
7659 } | |
7660 } | |
7661 | |
7662 /* | |
7663 * Sets the style of a given window (widget). | |
7664 * Parameters: | |
7665 * handle: Window (widget) handle. | |
7666 * width: New width in pixels. | |
7667 * height: New height in pixels. | |
7668 */ | |
7669 void dw_window_set_style(HWND handle, unsigned long style, unsigned long mask) | |
7670 { | |
7671 GtkWidget *handle2 = handle; | |
7672 int _locked_by_me = FALSE; | |
7673 | |
7674 DW_MUTEX_LOCK; | |
7675 if(GTK_IS_SCROLLED_WINDOW(handle)) | |
7676 { | |
7677 GtkWidget *tmp = (GtkWidget *)gtk_object_get_user_data(GTK_OBJECT(handle)); | |
7678 if(tmp) | |
7679 handle2 = tmp; | |
7680 } | |
426
1f92eadea7d3
Allow dw_window_set_style() on status_text widgets.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
424
diff
changeset
|
7681 else if(GTK_IS_FRAME(handle)) |
1f92eadea7d3
Allow dw_window_set_style() on status_text widgets.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
424
diff
changeset
|
7682 { |
1f92eadea7d3
Allow dw_window_set_style() on status_text widgets.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
424
diff
changeset
|
7683 GtkWidget *tmp = (GtkWidget *)gtk_object_get_data(GTK_OBJECT(handle), "_dw_label"); |
1f92eadea7d3
Allow dw_window_set_style() on status_text widgets.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
424
diff
changeset
|
7684 if(tmp && GTK_IS_LABEL(tmp)) |
1f92eadea7d3
Allow dw_window_set_style() on status_text widgets.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
424
diff
changeset
|
7685 handle2 = tmp; |
1f92eadea7d3
Allow dw_window_set_style() on status_text widgets.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
424
diff
changeset
|
7686 } |
36
cddb02f847e1
Added unix versions of functions in compat, and added getfsname, plus
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
7687 if(GTK_IS_LABEL(handle2)) |
cddb02f847e1
Added unix versions of functions in compat, and added getfsname, plus
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
7688 { |
37
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
36
diff
changeset
|
7689 if(style & DW_DT_CENTER || style & DW_DT_VCENTER) |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
36
diff
changeset
|
7690 { |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
36
diff
changeset
|
7691 gfloat x, y; |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
36
diff
changeset
|
7692 |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
36
diff
changeset
|
7693 x = y = DW_LEFT; |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
36
diff
changeset
|
7694 |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
36
diff
changeset
|
7695 if(style & DW_DT_CENTER) |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
36
diff
changeset
|
7696 x = DW_CENTER; |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
36
diff
changeset
|
7697 |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
36
diff
changeset
|
7698 if(style & DW_DT_VCENTER) |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
36
diff
changeset
|
7699 y = DW_CENTER; |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
36
diff
changeset
|
7700 |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
36
diff
changeset
|
7701 gtk_misc_set_alignment(GTK_MISC(handle2), x, y); |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
36
diff
changeset
|
7702 } |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
36
diff
changeset
|
7703 if(style & DW_DT_WORDBREAK) |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
36
diff
changeset
|
7704 gtk_label_set_line_wrap(GTK_LABEL(handle), TRUE); |
36
cddb02f847e1
Added unix versions of functions in compat, and added getfsname, plus
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
7705 } |
3 | 7706 DW_MUTEX_UNLOCK; |
7707 } | |
7708 | |
7709 /* | |
7710 * Adds a new page to specified notebook. | |
7711 * Parameters: | |
7712 * handle: Window (widget) handle. | |
7713 * flags: Any additional page creation flags. | |
7714 * front: If TRUE page is added at the beginning. | |
7715 */ | |
7716 unsigned long dw_notebook_page_new(HWND handle, unsigned long flags, int front) | |
7717 { | |
7718 int z; | |
7719 int _locked_by_me = FALSE; | |
114
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
7720 GtkWidget **pagearray; |
3 | 7721 |
7722 DW_MUTEX_LOCK; | |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
7723 pagearray = (GtkWidget **)gtk_object_get_data(GTK_OBJECT(handle), "_dw_pagearray"); |
114
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
7724 |
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
7725 if(pagearray) |
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
7726 { |
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
7727 for(z=0;z<256;z++) |
3 | 7728 { |
114
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
7729 if(!pagearray[z]) |
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
7730 { |
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
7731 char text[100]; |
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
7732 int num = z; |
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
7733 |
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
7734 if(front) |
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
7735 num |= 1 << 16; |
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
7736 |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
7737 sprintf(text, "_dw_page%d", z); |
114
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
7738 /* Save the real id and the creation flags */ |
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
7739 gtk_object_set_data(GTK_OBJECT(handle), text, (gpointer)num); |
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
7740 DW_MUTEX_UNLOCK; |
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
7741 return z; |
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
7742 } |
3 | 7743 } |
15
81833f25b1aa
Added new Dynamic Windows build information to the DWEnv struct.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
14
diff
changeset
|
7744 } |
3 | 7745 DW_MUTEX_UNLOCK; |
114
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
7746 |
3 | 7747 /* Hopefully this won't happen. */ |
7748 return 256; | |
7749 } | |
7750 | |
114
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
7751 /* Return the physical page id from the logical page id */ |
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
7752 int _get_physical_page(HWND handle, unsigned long pageid) |
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
7753 { |
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
7754 int z; |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
7755 GtkWidget *thispage, **pagearray = gtk_object_get_data(GTK_OBJECT(handle), "_dw_pagearray"); |
114
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
7756 |
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
7757 if(pagearray) |
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
7758 { |
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
7759 for(z=0;z<256;z++) |
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
7760 { |
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
7761 if((thispage = gtk_notebook_get_nth_page(GTK_NOTEBOOK(handle), z))) |
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
7762 { |
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
7763 if(thispage == pagearray[pageid]) |
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
7764 return z; |
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
7765 } |
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
7766 } |
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
7767 } |
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
7768 return 256; |
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
7769 } |
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
7770 |
3 | 7771 /* |
7772 * Remove a page from a notebook. | |
7773 * Parameters: | |
7774 * handle: Handle to the notebook widget. | |
7775 * pageid: ID of the page to be destroyed. | |
7776 */ | |
7777 void dw_notebook_page_destroy(HWND handle, unsigned int pageid) | |
7778 { | |
114
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
7779 int realpage, _locked_by_me = FALSE; |
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
7780 GtkWidget **pagearray; |
3 | 7781 |
7782 DW_MUTEX_LOCK; | |
114
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
7783 realpage = _get_physical_page(handle, pageid); |
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
7784 if(realpage > -1 && realpage < 256) |
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
7785 { |
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
7786 gtk_notebook_remove_page(GTK_NOTEBOOK(handle), realpage); |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
7787 if((pagearray = gtk_object_get_data(GTK_OBJECT(handle), "_dw_pagearray"))) |
114
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
7788 pagearray[pageid] = NULL; |
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
7789 } |
3 | 7790 DW_MUTEX_UNLOCK; |
7791 } | |
7792 | |
7793 /* | |
7794 * Queries the currently visible page ID. | |
7795 * Parameters: | |
7796 * handle: Handle to the notebook widget. | |
7797 */ | |
510
710f82598210
Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
508
diff
changeset
|
7798 unsigned long dw_notebook_page_get(HWND handle) |
3 | 7799 { |
114
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
7800 int retval, phys; |
3 | 7801 int _locked_by_me = FALSE; |
7802 | |
7803 DW_MUTEX_LOCK; | |
114
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
7804 phys = gtk_notebook_get_current_page(GTK_NOTEBOOK(handle)); |
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
7805 retval = _get_logical_page(handle, phys); |
3 | 7806 DW_MUTEX_UNLOCK; |
7807 return retval; | |
7808 } | |
7809 | |
7810 /* | |
7811 * Sets the currently visibale page ID. | |
7812 * Parameters: | |
7813 * handle: Handle to the notebook widget. | |
7814 * pageid: ID of the page to be made visible. | |
7815 */ | |
7816 void dw_notebook_page_set(HWND handle, unsigned int pageid) | |
7817 { | |
114
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
7818 int realpage, _locked_by_me = FALSE; |
3 | 7819 |
7820 DW_MUTEX_LOCK; | |
114
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
7821 realpage = _get_physical_page(handle, pageid); |
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
7822 if(realpage > -1 && realpage < 256) |
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
7823 gtk_notebook_set_page(GTK_NOTEBOOK(handle), pageid); |
3 | 7824 DW_MUTEX_UNLOCK; |
7825 } | |
7826 | |
7827 | |
7828 /* | |
7829 * Sets the text on the specified notebook tab. | |
7830 * Parameters: | |
7831 * handle: Notebook handle. | |
7832 * pageid: Page ID of the tab to set. | |
7833 * text: Pointer to the text to set. | |
7834 */ | |
7835 void dw_notebook_page_set_text(HWND handle, unsigned long pageid, char *text) | |
7836 { | |
7837 GtkWidget *child; | |
114
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
7838 int realpage, _locked_by_me = FALSE; |
3 | 7839 |
7840 DW_MUTEX_LOCK; | |
114
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
7841 realpage = _get_physical_page(handle, pageid); |
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
7842 if(realpage < 0 || realpage > 255) |
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
7843 { |
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
7844 char ptext[100]; |
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
7845 int num; |
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
7846 |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
7847 sprintf(ptext, "_dw_page%d", (int)pageid); |
114
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
7848 num = (int)gtk_object_get_data(GTK_OBJECT(handle), ptext); |
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
7849 realpage = 0xFF & num; |
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
7850 } |
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
7851 |
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
7852 if(realpage > -1 && realpage < 256) |
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
7853 { |
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
7854 child = gtk_notebook_get_nth_page(GTK_NOTEBOOK(handle), realpage); |
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
7855 if(child) |
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
7856 gtk_notebook_set_tab_label_text(GTK_NOTEBOOK(handle), child, text); |
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
7857 } |
3 | 7858 DW_MUTEX_UNLOCK; |
7859 } | |
7860 | |
7861 /* | |
7862 * Sets the text on the specified notebook tab status area. | |
7863 * Parameters: | |
7864 * handle: Notebook handle. | |
7865 * pageid: Page ID of the tab to set. | |
7866 * text: Pointer to the text to set. | |
7867 */ | |
7868 void dw_notebook_page_set_status_text(HWND handle, unsigned long pageid, char *text) | |
7869 { | |
7870 /* TODO (if possible) */ | |
7871 } | |
7872 | |
7873 /* | |
7874 * Packs the specified box into the notebook page. | |
7875 * Parameters: | |
7876 * handle: Handle to the notebook to be packed. | |
7877 * pageid: Page ID in the notebook which is being packed. | |
7878 * page: Box handle to be packed. | |
7879 */ | |
7880 void dw_notebook_pack(HWND handle, unsigned long pageid, HWND page) | |
7881 { | |
114
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
7882 GtkWidget *label, *child, *oldlabel, **pagearray; |
15
81833f25b1aa
Added new Dynamic Windows build information to the DWEnv struct.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
14
diff
changeset
|
7883 gchar *text = NULL; |
114
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
7884 int num, z, realpage = -1, pad, _locked_by_me = FALSE; |
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
7885 char ptext[100]; |
3 | 7886 |
7887 DW_MUTEX_LOCK; | |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
7888 sprintf(ptext, "_dw_page%d", (int)pageid); |
114
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
7889 num = (int)gtk_object_get_data(GTK_OBJECT(handle), ptext); |
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
7890 gtk_object_set_data(GTK_OBJECT(handle), ptext, NULL); |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
7891 pagearray = (GtkWidget **)gtk_object_get_data(GTK_OBJECT(handle), "_dw_pagearray"); |
114
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
7892 |
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
7893 if(!pagearray) |
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
7894 { |
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
7895 DW_MUTEX_UNLOCK; |
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
7896 return; |
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
7897 } |
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
7898 |
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
7899 /* The page already exists... so get it's current page */ |
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
7900 if(pagearray[pageid]) |
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
7901 { |
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
7902 for(z=0;z<256;z++) |
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
7903 { |
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
7904 child = gtk_notebook_get_nth_page(GTK_NOTEBOOK(handle), z); |
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
7905 if(child == pagearray[pageid]) |
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
7906 { |
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
7907 oldlabel = gtk_notebook_get_tab_label(GTK_NOTEBOOK(handle), child); |
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
7908 if(oldlabel) |
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
7909 gtk_label_get(GTK_LABEL(oldlabel), &text); |
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
7910 gtk_notebook_remove_page(GTK_NOTEBOOK(handle), z); |
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
7911 realpage = z; |
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
7912 break; |
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
7913 } |
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
7914 } |
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
7915 } |
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
7916 |
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
7917 pagearray[pageid] = page; |
15
81833f25b1aa
Added new Dynamic Windows build information to the DWEnv struct.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
14
diff
changeset
|
7918 |
81833f25b1aa
Added new Dynamic Windows build information to the DWEnv struct.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
14
diff
changeset
|
7919 label = gtk_label_new(text ? text : ""); |
81833f25b1aa
Added new Dynamic Windows build information to the DWEnv struct.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
14
diff
changeset
|
7920 |
48
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
7921 if(GTK_IS_TABLE(page)) |
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
7922 { |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
7923 pad = (int)gtk_object_get_data(GTK_OBJECT(page), "_dw_boxpad"); |
48
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
7924 gtk_container_border_width(GTK_CONTAINER(page), pad); |
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
7925 } |
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
7926 |
114
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
7927 if(realpage != -1) |
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
7928 gtk_notebook_insert_page(GTK_NOTEBOOK(handle), page, label, realpage); |
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
7929 else if(num & ~(0xFF)) |
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
7930 gtk_notebook_insert_page(GTK_NOTEBOOK(handle), page, label, 0); |
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
7931 else |
39932767ef46
Fixes to the notebook code to better handle removing of pages. Also,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
112
diff
changeset
|
7932 gtk_notebook_insert_page(GTK_NOTEBOOK(handle), page, label, 256); |
3 | 7933 DW_MUTEX_UNLOCK; |
7934 } | |
7935 | |
7936 /* | |
7937 * Appends the specified text to the listbox's (or combobox) entry list. | |
7938 * Parameters: | |
7939 * handle: Handle to the listbox to be appended to. | |
7940 * text: Text to append into listbox. | |
7941 */ | |
7942 void dw_listbox_append(HWND handle, char *text) | |
7943 { | |
7944 GtkWidget *handle2 = handle; | |
7945 int _locked_by_me = FALSE; | |
7946 | |
7947 DW_MUTEX_LOCK; | |
7948 if(GTK_IS_SCROLLED_WINDOW(handle)) | |
7949 { | |
7950 GtkWidget *tmp = (GtkWidget *)gtk_object_get_user_data(GTK_OBJECT(handle)); | |
7951 if(tmp) | |
7952 handle2 = tmp; | |
7953 } | |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
7954 gtk_object_set_data(GTK_OBJECT(handle), "_dw_appending", (gpointer)1); |
3 | 7955 if(GTK_IS_LIST(handle2)) |
7956 { | |
7957 GtkWidget *list_item; | |
7958 GList *tmp; | |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
7959 char *font = (char *)gtk_object_get_data(GTK_OBJECT(handle), "_dw_font"); |
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
7960 GdkColor *fore = (GdkColor *)gtk_object_get_data(GTK_OBJECT(handle2), "_dw_foregdk"); |
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
7961 GdkColor *back = (GdkColor *)gtk_object_get_data(GTK_OBJECT(handle2), "_dw_backgdk"); |
3 | 7962 |
7963 list_item=gtk_list_item_new_with_label(text); | |
7964 | |
7965 if(font) | |
7966 _set_font(GTK_LIST_ITEM(list_item)->item.bin.child, font); | |
7967 if(fore && back) | |
14
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
7968 _set_color(GTK_LIST_ITEM(list_item)->item.bin.child, |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
7969 DW_RGB(fore->red, fore->green, fore->blue), |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
7970 DW_RGB(back->red, back->green, back->blue)); |
3 | 7971 |
7972 tmp = g_list_append(NULL, list_item); | |
7973 gtk_widget_show(list_item); | |
7974 gtk_list_append_items(GTK_LIST(handle2),tmp); | |
7975 } | |
7976 else if(GTK_IS_COMBO(handle2)) | |
7977 { | |
7978 GList *tmp = (GList *)gtk_object_get_user_data(GTK_OBJECT(handle2)); | |
7979 char *addtext = strdup(text); | |
7980 | |
7981 if(addtext) | |
7982 { | |
7983 tmp = g_list_append(tmp, addtext); | |
7984 gtk_object_set_user_data(GTK_OBJECT(handle2), tmp); | |
7985 gtk_combo_set_popdown_strings(GTK_COMBO(handle2), tmp); | |
7986 } | |
7987 } | |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
7988 gtk_object_set_data(GTK_OBJECT(handle), "_dw_appending", NULL); |
3 | 7989 DW_MUTEX_UNLOCK; |
7990 } | |
7991 | |
7992 /* | |
7993 * Clears the listbox's (or combobox) list of all entries. | |
7994 * Parameters: | |
7995 * handle: Handle to the listbox to be cleared. | |
7996 */ | |
7997 void dw_listbox_clear(HWND handle) | |
7998 { | |
7999 GtkWidget *handle2 = handle; | |
8000 int _locked_by_me = FALSE; | |
8001 | |
8002 DW_MUTEX_LOCK; | |
8003 if(GTK_IS_SCROLLED_WINDOW(handle)) | |
8004 { | |
8005 GtkWidget *tmp = (GtkWidget *)gtk_object_get_user_data(GTK_OBJECT(handle)); | |
8006 if(tmp) | |
8007 handle2 = tmp; | |
8008 } | |
8009 if(GTK_IS_COMBO(handle2)) | |
8010 { | |
8011 GList *list, *tmp = (GList *)gtk_object_get_user_data(GTK_OBJECT(handle2)); | |
8012 | |
8013 if(tmp) | |
8014 { | |
8015 list = tmp; | |
8016 while(list) | |
8017 { | |
8018 if(list->data) | |
8019 free(list->data); | |
8020 list=list->next; | |
8021 } | |
8022 g_list_free(tmp); | |
8023 } | |
8024 gtk_object_set_user_data(GTK_OBJECT(handle2), NULL); | |
8025 } | |
8026 else if(GTK_IS_LIST(handle2)) | |
8027 { | |
8028 int count = dw_listbox_count(handle); | |
8029 | |
8030 gtk_list_clear_items(GTK_LIST(handle2), 0, count - 1); | |
8031 } | |
8032 DW_MUTEX_UNLOCK; | |
8033 } | |
8034 | |
8035 /* | |
8036 * Returns the listbox's item count. | |
8037 * Parameters: | |
8038 * handle: Handle to the listbox to be counted | |
8039 */ | |
8040 int dw_listbox_count(HWND handle) | |
8041 { | |
8042 GtkWidget *handle2 = handle; | |
8043 int retval = 0; | |
8044 int _locked_by_me = FALSE; | |
8045 | |
8046 DW_MUTEX_LOCK; | |
8047 if(GTK_IS_SCROLLED_WINDOW(handle)) | |
8048 { | |
8049 GtkWidget *tmp = (GtkWidget *)gtk_object_get_user_data(GTK_OBJECT(handle)); | |
8050 if(tmp) | |
8051 handle2 = tmp; | |
8052 } | |
8053 else if(GTK_IS_COMBO(handle)) | |
8054 { | |
8055 handle2 = GTK_COMBO(handle)->list; | |
8056 } | |
8057 if(GTK_IS_LIST(handle2)) | |
8058 { | |
8059 GList *list = GTK_LIST(handle2)->children; | |
8060 while(list) | |
8061 { | |
8062 list = list->next; | |
8063 retval++; | |
8064 } | |
8065 } | |
8066 DW_MUTEX_UNLOCK; | |
8067 return retval; | |
8068 } | |
8069 | |
8070 /* | |
8071 * Sets the topmost item in the viewport. | |
8072 * Parameters: | |
8073 * handle: Handle to the listbox to be cleared. | |
8074 * top: Index to the top item. | |
8075 */ | |
8076 void dw_listbox_set_top(HWND handle, int top) | |
8077 { | |
8078 GtkWidget *handle2 = handle; | |
8079 int _locked_by_me = FALSE; | |
8080 | |
8081 DW_MUTEX_LOCK; | |
8082 if(GTK_IS_SCROLLED_WINDOW(handle)) | |
8083 { | |
8084 GtkWidget *tmp = (GtkWidget *)gtk_object_get_user_data(GTK_OBJECT(handle)); | |
8085 if(tmp) | |
8086 handle2 = tmp; | |
8087 } | |
8088 if(GTK_IS_LIST(handle2)) | |
8089 { | |
8090 int count = dw_listbox_count(handle); | |
8091 GtkAdjustment *adj = gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(handle)); | |
8092 float pos, ratio; | |
8093 | |
8094 if(count) | |
8095 { | |
8096 ratio = (float)top/(float)count; | |
8097 | |
8098 pos = (ratio * (float)(adj->upper - adj->lower)) + adj->lower; | |
8099 | |
8100 gtk_adjustment_set_value(adj, pos); | |
8101 } | |
8102 } | |
8103 DW_MUTEX_UNLOCK; | |
8104 } | |
8105 | |
8106 /* | |
8107 * Copies the given index item's text into buffer. | |
8108 * Parameters: | |
8109 * handle: Handle to the listbox to be queried. | |
8110 * index: Index into the list to be queried. | |
8111 * buffer: Buffer where text will be copied. | |
8112 * length: Length of the buffer (including NULL). | |
8113 */ | |
510
710f82598210
Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
508
diff
changeset
|
8114 void dw_listbox_get_text(HWND handle, unsigned int index, char *buffer, unsigned int length) |
3 | 8115 { |
8116 GtkWidget *handle2 = handle; | |
8117 int _locked_by_me = FALSE; | |
8118 | |
8119 DW_MUTEX_LOCK; | |
8120 if(GTK_IS_SCROLLED_WINDOW(handle)) | |
8121 { | |
8122 GtkWidget *tmp = (GtkWidget *)gtk_object_get_user_data(GTK_OBJECT(handle)); | |
8123 if(tmp) | |
8124 handle2 = tmp; | |
8125 } | |
8126 else if(GTK_IS_COMBO(handle)) | |
8127 { | |
8128 handle2 = GTK_COMBO(handle)->list; | |
8129 } | |
8130 if(GTK_IS_LIST(handle2)) | |
8131 { | |
8132 int counter = 0; | |
8133 GList *list = GTK_LIST(handle2)->children; | |
8134 | |
8135 while(list) | |
8136 { | |
8137 if(counter == index) | |
8138 { | |
8139 gchar *text = ""; | |
8140 | |
8141 if(GTK_IS_LIST_ITEM(list->data)) | |
8142 { | |
8143 GtkListItem *li = GTK_LIST_ITEM(list->data); | |
8144 | |
8145 if(GTK_IS_ITEM(&(li->item))) | |
8146 { | |
8147 GtkItem *i = &(li->item); | |
8148 | |
8149 if(GTK_IS_BIN(&(i->bin))) | |
8150 { | |
8151 GtkBin *b = &(i->bin); | |
8152 | |
8153 if(GTK_IS_LABEL(b->child)) | |
8154 gtk_label_get(GTK_LABEL(b->child), &text); | |
8155 } | |
8156 } | |
8157 } | |
8158 else if(GTK_IS_COMBO(handle) && list->data) | |
8159 text = (gchar *)list->data; | |
8160 | |
8161 strncpy(buffer, (char *)text, length); | |
8162 break; | |
8163 } | |
8164 list = list->next; | |
8165 counter++; | |
8166 } | |
8167 } | |
8168 DW_MUTEX_UNLOCK; | |
8169 } | |
8170 | |
8171 /* | |
8172 * Sets the text of a given listbox entry. | |
8173 * Parameters: | |
8174 * handle: Handle to the listbox to be queried. | |
8175 * index: Index into the list to be queried. | |
8176 * buffer: Buffer where text will be copied. | |
8177 */ | |
8178 void dw_listbox_set_text(HWND handle, unsigned int index, char *buffer) | |
8179 { | |
8180 GtkWidget *handle2 = handle; | |
8181 int _locked_by_me = FALSE; | |
8182 | |
8183 DW_MUTEX_LOCK; | |
8184 if(GTK_IS_SCROLLED_WINDOW(handle)) | |
8185 { | |
8186 GtkWidget *tmp = (GtkWidget *)gtk_object_get_user_data(GTK_OBJECT(handle)); | |
8187 if(tmp) | |
8188 handle2 = tmp; | |
8189 } | |
8190 else if(GTK_IS_COMBO(handle)) | |
8191 { | |
8192 handle2 = GTK_COMBO(handle)->list; | |
8193 } | |
8194 if(GTK_IS_LIST(handle2)) | |
8195 { | |
8196 int counter = 0; | |
8197 GList *list = GTK_LIST(handle2)->children; | |
8198 | |
8199 while(list) | |
8200 { | |
8201 if(counter == index) | |
8202 { | |
8203 | |
8204 if(GTK_IS_LIST_ITEM(list->data)) | |
8205 { | |
8206 GtkListItem *li = GTK_LIST_ITEM(list->data); | |
8207 | |
8208 if(GTK_IS_ITEM(&(li->item))) | |
8209 { | |
8210 GtkItem *i = &(li->item); | |
8211 | |
8212 if(GTK_IS_BIN(&(i->bin))) | |
8213 { | |
8214 GtkBin *b = &(i->bin); | |
8215 | |
8216 if(GTK_IS_LABEL(b->child)) | |
8217 gtk_label_set_text(GTK_LABEL(b->child), buffer); | |
8218 } | |
8219 } | |
8220 } | |
8221 else if(GTK_IS_COMBO(handle)) | |
8222 { | |
8223 if(list->data) | |
8224 g_free(list->data); | |
8225 list->data = g_strdup(buffer); | |
8226 } | |
8227 break; | |
8228 } | |
8229 list = list->next; | |
8230 counter++; | |
8231 } | |
8232 } | |
8233 DW_MUTEX_UNLOCK; | |
8234 } | |
8235 | |
147
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
8236 #if GTK_MAJOR_VERSION < 2 |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
8237 /* Check if a GList item is in another GList */ |
258
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
8238 static int _dw_in_list(GList *item, GList *list) |
147
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
8239 { |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
8240 while(list) |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
8241 { |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
8242 if(list->data == item->data) |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
8243 return TRUE; |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
8244 |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
8245 list = list->next; |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
8246 } |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
8247 return FALSE; |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
8248 } |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
8249 #endif |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
8250 |
3 | 8251 /* |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
8252 * Returns the index to the current selected item or -1 when done. |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
8253 * Parameters: |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
8254 * handle: Handle to the listbox to be queried. |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
8255 * where: Either the previous return or -1 to restart. |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
8256 */ |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
8257 int dw_listbox_selected_multi(HWND handle, int where) |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
8258 { |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
8259 GtkWidget *handle2 = handle; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
8260 int retval = DW_LIT_NONE; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
8261 int _locked_by_me = FALSE; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
8262 |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
8263 DW_MUTEX_LOCK; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
8264 if(GTK_IS_SCROLLED_WINDOW(handle)) |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
8265 { |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
8266 GtkWidget *tmp = (GtkWidget *)gtk_object_get_user_data(GTK_OBJECT(handle)); |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
8267 if(tmp) |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
8268 handle2 = tmp; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
8269 } |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
8270 if(GTK_IS_LIST(handle2)) |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
8271 { |
147
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
8272 #if GTK_MAJOR_VERSION > 1 |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
8273 int counter = 0; |
147
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
8274 GList *list = GTK_LIST(handle2)->children; |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
8275 |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
8276 while(list) |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
8277 { |
147
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
8278 GtkItem *item = (GtkItem *)list->data; |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
8279 |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
8280 if(item && |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
8281 item->bin.container.widget.state == GTK_STATE_SELECTED |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
8282 && counter > where) |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
8283 { |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
8284 retval = counter; |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
8285 break; |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
8286 } |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
8287 |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
8288 |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
8289 list = list->next; |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
8290 counter++; |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
8291 } |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
8292 #else |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
8293 int counter = 0; |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
8294 GList *list = GTK_LIST(handle2)->children; |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
8295 |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
8296 while(list) |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
8297 { |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
8298 if(counter > where && _dw_in_list(list, GTK_LIST(handle2)->selection)) |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
8299 { |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
8300 retval = counter; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
8301 break; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
8302 } |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
8303 |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
8304 list = list->next; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
8305 counter++; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
8306 } |
147
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
8307 #endif |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
8308 } |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
8309 DW_MUTEX_UNLOCK; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
8310 return retval; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
8311 } |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
8312 |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
8313 /* |
3 | 8314 * Returns the index to the item in the list currently selected. |
8315 * Parameters: | |
8316 * handle: Handle to the listbox to be queried. | |
8317 */ | |
8318 unsigned int dw_listbox_selected(HWND handle) | |
8319 { | |
8320 GtkWidget *handle2 = handle; | |
8321 int retval = DW_LIT_NONE; | |
8322 int _locked_by_me = FALSE; | |
8323 | |
8324 DW_MUTEX_LOCK; | |
8325 if(GTK_IS_SCROLLED_WINDOW(handle)) | |
8326 { | |
8327 GtkWidget *tmp = (GtkWidget *)gtk_object_get_user_data(GTK_OBJECT(handle)); | |
8328 if(tmp) | |
8329 handle2 = tmp; | |
8330 } | |
8331 else if(GTK_IS_COMBO(handle)) | |
8332 { | |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
8333 retval = (unsigned int)gtk_object_get_data(GTK_OBJECT(handle), "_dw_item"); |
3 | 8334 DW_MUTEX_UNLOCK; |
8335 return retval; | |
8336 } | |
8337 if(GTK_IS_LIST(handle2)) | |
8338 { | |
8339 int counter = 0; | |
8340 GList *list = GTK_LIST(handle2)->children; | |
147
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
8341 #if GTK_MAJOR_VERSION > 1 |
423
c1c75e363a91
Hopefully fixed dw_listbox_selected() on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
422
diff
changeset
|
8342 |
c1c75e363a91
Hopefully fixed dw_listbox_selected() on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
422
diff
changeset
|
8343 while(list) |
c1c75e363a91
Hopefully fixed dw_listbox_selected() on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
422
diff
changeset
|
8344 { |
c1c75e363a91
Hopefully fixed dw_listbox_selected() on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
422
diff
changeset
|
8345 GtkItem *item = (GtkItem *)list->data; |
c1c75e363a91
Hopefully fixed dw_listbox_selected() on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
422
diff
changeset
|
8346 |
c1c75e363a91
Hopefully fixed dw_listbox_selected() on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
422
diff
changeset
|
8347 if(item && item->bin.container.widget.state == GTK_STATE_SELECTED) |
c1c75e363a91
Hopefully fixed dw_listbox_selected() on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
422
diff
changeset
|
8348 { |
c1c75e363a91
Hopefully fixed dw_listbox_selected() on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
422
diff
changeset
|
8349 retval = counter; |
c1c75e363a91
Hopefully fixed dw_listbox_selected() on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
422
diff
changeset
|
8350 break; |
c1c75e363a91
Hopefully fixed dw_listbox_selected() on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
422
diff
changeset
|
8351 } |
c1c75e363a91
Hopefully fixed dw_listbox_selected() on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
422
diff
changeset
|
8352 |
c1c75e363a91
Hopefully fixed dw_listbox_selected() on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
422
diff
changeset
|
8353 list = list->next; |
c1c75e363a91
Hopefully fixed dw_listbox_selected() on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
422
diff
changeset
|
8354 counter++; |
c1c75e363a91
Hopefully fixed dw_listbox_selected() on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
422
diff
changeset
|
8355 } |
147
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
8356 #else |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
8357 GList *selection = GTK_LIST(handle2)->selection; |
423
c1c75e363a91
Hopefully fixed dw_listbox_selected() on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
422
diff
changeset
|
8358 |
147
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
8359 if(selection) |
3 | 8360 { |
147
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
8361 while(list) |
3 | 8362 { |
147
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
8363 if(list->data == selection->data) |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
8364 { |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
8365 retval = counter; |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
8366 break; |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
8367 } |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
8368 |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
8369 list = list->next; |
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
145
diff
changeset
|
8370 counter++; |
3 | 8371 } |
8372 } | |
423
c1c75e363a91
Hopefully fixed dw_listbox_selected() on GTK 2.x.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
422
diff
changeset
|
8373 #endif |
3 | 8374 } |
8375 DW_MUTEX_UNLOCK; | |
8376 return retval; | |
8377 } | |
8378 | |
8379 /* | |
8380 * Sets the selection state of a given index. | |
8381 * Parameters: | |
8382 * handle: Handle to the listbox to be set. | |
8383 * index: Item index. | |
8384 * state: TRUE if selected FALSE if unselected. | |
8385 */ | |
8386 void dw_listbox_select(HWND handle, int index, int state) | |
8387 { | |
8388 GtkWidget *handle2 = handle; | |
8389 int _locked_by_me = FALSE; | |
8390 | |
8391 DW_MUTEX_LOCK; | |
8392 if(GTK_IS_SCROLLED_WINDOW(handle)) | |
8393 { | |
8394 GtkWidget *tmp = (GtkWidget *)gtk_object_get_user_data(GTK_OBJECT(handle)); | |
8395 if(tmp) | |
8396 handle2 = tmp; | |
8397 } | |
8398 else if(GTK_IS_COMBO(handle)) | |
8399 { | |
8400 handle2 = GTK_COMBO(handle)->list; | |
8401 } | |
8402 if(GTK_IS_LIST(handle2)) | |
8403 { | |
8404 if(state) | |
8405 gtk_list_select_item(GTK_LIST(handle2), index); | |
8406 else | |
8407 gtk_list_unselect_item(GTK_LIST(handle2), index); | |
8408 } | |
8409 DW_MUTEX_UNLOCK; | |
8410 } | |
8411 | |
8412 /* | |
8413 * Deletes the item with given index from the list. | |
8414 * Parameters: | |
8415 * handle: Handle to the listbox to be set. | |
8416 * index: Item index. | |
8417 */ | |
8418 void dw_listbox_delete(HWND handle, int index) | |
8419 { | |
8420 GtkWidget *handle2 = handle; | |
8421 int _locked_by_me = FALSE; | |
8422 | |
8423 DW_MUTEX_LOCK; | |
8424 if(GTK_IS_SCROLLED_WINDOW(handle)) | |
8425 { | |
8426 GtkWidget *tmp = (GtkWidget *)gtk_object_get_user_data(GTK_OBJECT(handle)); | |
8427 if(tmp) | |
8428 handle2 = tmp; | |
8429 } | |
8430 else if(GTK_IS_COMBO(handle)) | |
8431 { | |
8432 handle2 = GTK_COMBO(handle)->list; | |
8433 } | |
8434 if(GTK_IS_LIST(handle2)) | |
472
d11be1f40f8c
Add support for column-click signal.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
464
diff
changeset
|
8435 { |
464
3251fbca6fb3
dw_listbox_delete() needs index+1 for end arg
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
463
diff
changeset
|
8436 gtk_list_clear_items(GTK_LIST(handle2), index, index+1); |
472
d11be1f40f8c
Add support for column-click signal.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
464
diff
changeset
|
8437 } |
3 | 8438 DW_MUTEX_UNLOCK; |
8439 } | |
8440 | |
119
1cad81b7cc4c
Implemented initial splitbar code on Unix. And made some fixes for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
115
diff
changeset
|
8441 /* Reposition the bar according to the percentage */ |
258
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
8442 static gint _splitbar_size_allocate(GtkWidget *widget, GtkAllocation *event, gpointer data) |
119
1cad81b7cc4c
Implemented initial splitbar code on Unix. And made some fixes for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
115
diff
changeset
|
8443 { |
120
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
8444 float *percent = (float *)gtk_object_get_data(GTK_OBJECT(widget), "_dw_percent"); |
119
1cad81b7cc4c
Implemented initial splitbar code on Unix. And made some fixes for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
115
diff
changeset
|
8445 int lastwidth = (int)gtk_object_get_data(GTK_OBJECT(widget), "_dw_lastwidth"); |
1cad81b7cc4c
Implemented initial splitbar code on Unix. And made some fixes for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
115
diff
changeset
|
8446 int lastheight = (int)gtk_object_get_data(GTK_OBJECT(widget), "_dw_lastheight"); |
1cad81b7cc4c
Implemented initial splitbar code on Unix. And made some fixes for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
115
diff
changeset
|
8447 |
1cad81b7cc4c
Implemented initial splitbar code on Unix. And made some fixes for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
115
diff
changeset
|
8448 /* Prevent infinite recursion ;) */ |
120
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
8449 if(!percent || (lastwidth == event->width && lastheight == event->height)) |
134
caeb52bb5ef4
Pass pointers to argc and argv on Unix.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
133
diff
changeset
|
8450 return FALSE; |
119
1cad81b7cc4c
Implemented initial splitbar code on Unix. And made some fixes for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
115
diff
changeset
|
8451 |
1cad81b7cc4c
Implemented initial splitbar code on Unix. And made some fixes for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
115
diff
changeset
|
8452 lastwidth = event->width; lastheight = event->height; |
1cad81b7cc4c
Implemented initial splitbar code on Unix. And made some fixes for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
115
diff
changeset
|
8453 |
1cad81b7cc4c
Implemented initial splitbar code on Unix. And made some fixes for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
115
diff
changeset
|
8454 gtk_object_set_data(GTK_OBJECT(widget), "_dw_lastwidth", (gpointer)lastwidth); |
1cad81b7cc4c
Implemented initial splitbar code on Unix. And made some fixes for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
115
diff
changeset
|
8455 gtk_object_set_data(GTK_OBJECT(widget), "_dw_lastheight", (gpointer)lastheight); |
1cad81b7cc4c
Implemented initial splitbar code on Unix. And made some fixes for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
115
diff
changeset
|
8456 |
1cad81b7cc4c
Implemented initial splitbar code on Unix. And made some fixes for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
115
diff
changeset
|
8457 if(GTK_IS_HPANED(widget)) |
120
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
8458 gtk_paned_set_position(GTK_PANED(widget), (int)(event->width * (*percent / 100.0))); |
119
1cad81b7cc4c
Implemented initial splitbar code on Unix. And made some fixes for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
115
diff
changeset
|
8459 if(GTK_IS_VPANED(widget)) |
120
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
8460 gtk_paned_set_position(GTK_PANED(widget), (int)(event->height * (*percent / 100.0))); |
145
659c1a2bccad
Fixed the calculations in the splitbar widget. Finished all the splitbar
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
144
diff
changeset
|
8461 gtk_object_set_data(GTK_OBJECT(widget), "_dw_waiting", NULL); |
134
caeb52bb5ef4
Pass pointers to argc and argv on Unix.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
133
diff
changeset
|
8462 return FALSE; |
119
1cad81b7cc4c
Implemented initial splitbar code on Unix. And made some fixes for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
115
diff
changeset
|
8463 } |
1cad81b7cc4c
Implemented initial splitbar code on Unix. And made some fixes for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
115
diff
changeset
|
8464 |
122
a05b6fb9c545
Minor bug fixes and code cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
121
diff
changeset
|
8465 #if GTK_MAJOR_VERSION > 1 |
119
1cad81b7cc4c
Implemented initial splitbar code on Unix. And made some fixes for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
115
diff
changeset
|
8466 /* Figure out the new percentage */ |
258
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
8467 static void _splitbar_accept_position(GObject *object, GParamSpec *pspec, gpointer data) |
145
659c1a2bccad
Fixed the calculations in the splitbar widget. Finished all the splitbar
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
144
diff
changeset
|
8468 { |
659c1a2bccad
Fixed the calculations in the splitbar widget. Finished all the splitbar
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
144
diff
changeset
|
8469 GtkWidget *widget = (GtkWidget *)data; |
120
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
8470 float *percent = (float *)gtk_object_get_data(GTK_OBJECT(widget), "_dw_percent"); |
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
8471 int size = 0, position = gtk_paned_get_position(GTK_PANED(widget)); |
122
a05b6fb9c545
Minor bug fixes and code cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
121
diff
changeset
|
8472 |
145
659c1a2bccad
Fixed the calculations in the splitbar widget. Finished all the splitbar
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
144
diff
changeset
|
8473 if(!percent || gtk_object_get_data(GTK_OBJECT(widget), "_dw_waiting")) |
659c1a2bccad
Fixed the calculations in the splitbar widget. Finished all the splitbar
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
144
diff
changeset
|
8474 return; |
120
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
8475 |
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
8476 if(GTK_IS_VPANED(widget)) |
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
8477 size = widget->allocation.height; |
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
8478 else if(GTK_IS_HPANED(widget)) |
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
8479 size = widget->allocation.width; |
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
8480 |
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
8481 if(size > 0) |
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
8482 *percent = ((float)(position * 100) / (float)size); |
119
1cad81b7cc4c
Implemented initial splitbar code on Unix. And made some fixes for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
115
diff
changeset
|
8483 } |
120
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
8484 #endif |
119
1cad81b7cc4c
Implemented initial splitbar code on Unix. And made some fixes for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
115
diff
changeset
|
8485 |
1cad81b7cc4c
Implemented initial splitbar code on Unix. And made some fixes for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
115
diff
changeset
|
8486 /* |
1cad81b7cc4c
Implemented initial splitbar code on Unix. And made some fixes for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
115
diff
changeset
|
8487 * Creates a splitbar window (widget) with given parameters. |
1cad81b7cc4c
Implemented initial splitbar code on Unix. And made some fixes for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
115
diff
changeset
|
8488 * Parameters: |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
282
diff
changeset
|
8489 * type: Value can be DW_VERT or DW_HORZ. |
119
1cad81b7cc4c
Implemented initial splitbar code on Unix. And made some fixes for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
115
diff
changeset
|
8490 * topleft: Handle to the window to be top or left. |
1cad81b7cc4c
Implemented initial splitbar code on Unix. And made some fixes for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
115
diff
changeset
|
8491 * bottomright: Handle to the window to be bottom or right. |
1cad81b7cc4c
Implemented initial splitbar code on Unix. And made some fixes for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
115
diff
changeset
|
8492 * Returns: |
1cad81b7cc4c
Implemented initial splitbar code on Unix. And made some fixes for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
115
diff
changeset
|
8493 * A handle to a splitbar window or NULL on failure. |
1cad81b7cc4c
Implemented initial splitbar code on Unix. And made some fixes for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
115
diff
changeset
|
8494 */ |
1cad81b7cc4c
Implemented initial splitbar code on Unix. And made some fixes for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
115
diff
changeset
|
8495 HWND dw_splitbar_new(int type, HWND topleft, HWND bottomright, unsigned long id) |
1cad81b7cc4c
Implemented initial splitbar code on Unix. And made some fixes for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
115
diff
changeset
|
8496 { |
1cad81b7cc4c
Implemented initial splitbar code on Unix. And made some fixes for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
115
diff
changeset
|
8497 GtkWidget *tmp = NULL; |
1cad81b7cc4c
Implemented initial splitbar code on Unix. And made some fixes for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
115
diff
changeset
|
8498 int _locked_by_me = FALSE; |
120
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
8499 float *percent = malloc(sizeof(float)); |
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
8500 |
119
1cad81b7cc4c
Implemented initial splitbar code on Unix. And made some fixes for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
115
diff
changeset
|
8501 DW_MUTEX_LOCK; |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
282
diff
changeset
|
8502 if(type == DW_HORZ) |
119
1cad81b7cc4c
Implemented initial splitbar code on Unix. And made some fixes for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
115
diff
changeset
|
8503 tmp = gtk_hpaned_new(); |
1cad81b7cc4c
Implemented initial splitbar code on Unix. And made some fixes for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
115
diff
changeset
|
8504 else |
1cad81b7cc4c
Implemented initial splitbar code on Unix. And made some fixes for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
115
diff
changeset
|
8505 tmp = gtk_vpaned_new(); |
1cad81b7cc4c
Implemented initial splitbar code on Unix. And made some fixes for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
115
diff
changeset
|
8506 gtk_paned_add1(GTK_PANED(tmp), topleft); |
1cad81b7cc4c
Implemented initial splitbar code on Unix. And made some fixes for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
115
diff
changeset
|
8507 gtk_paned_add2(GTK_PANED(tmp), bottomright); |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
8508 gtk_object_set_data(GTK_OBJECT(tmp), "_dw_id", (gpointer)id); |
120
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
8509 *percent = 50.0; |
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
8510 gtk_object_set_data(GTK_OBJECT(tmp), "_dw_percent", (gpointer)percent); |
145
659c1a2bccad
Fixed the calculations in the splitbar widget. Finished all the splitbar
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
144
diff
changeset
|
8511 gtk_object_set_data(GTK_OBJECT(tmp), "_dw_waiting", (gpointer)1); |
120
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
8512 gtk_signal_connect(GTK_OBJECT(tmp), "size-allocate", GTK_SIGNAL_FUNC(_splitbar_size_allocate), NULL); |
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
8513 #if GTK_MAJOR_VERSION > 1 |
145
659c1a2bccad
Fixed the calculations in the splitbar widget. Finished all the splitbar
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
144
diff
changeset
|
8514 g_signal_connect(G_OBJECT(tmp), "notify::position", (GCallback)_splitbar_accept_position, (gpointer)tmp); |
120
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
8515 #else |
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
8516 gtk_paned_set_handle_size(GTK_PANED(tmp), 3); |
119
1cad81b7cc4c
Implemented initial splitbar code on Unix. And made some fixes for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
115
diff
changeset
|
8517 #endif |
1cad81b7cc4c
Implemented initial splitbar code on Unix. And made some fixes for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
115
diff
changeset
|
8518 gtk_widget_show(tmp); |
1cad81b7cc4c
Implemented initial splitbar code on Unix. And made some fixes for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
115
diff
changeset
|
8519 DW_MUTEX_UNLOCK; |
1cad81b7cc4c
Implemented initial splitbar code on Unix. And made some fixes for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
115
diff
changeset
|
8520 return tmp; |
1cad81b7cc4c
Implemented initial splitbar code on Unix. And made some fixes for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
115
diff
changeset
|
8521 } |
1cad81b7cc4c
Implemented initial splitbar code on Unix. And made some fixes for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
115
diff
changeset
|
8522 |
1cad81b7cc4c
Implemented initial splitbar code on Unix. And made some fixes for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
115
diff
changeset
|
8523 /* |
1cad81b7cc4c
Implemented initial splitbar code on Unix. And made some fixes for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
115
diff
changeset
|
8524 * Sets the position of a splitbar (pecentage). |
1cad81b7cc4c
Implemented initial splitbar code on Unix. And made some fixes for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
115
diff
changeset
|
8525 * Parameters: |
1cad81b7cc4c
Implemented initial splitbar code on Unix. And made some fixes for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
115
diff
changeset
|
8526 * handle: The handle to the splitbar returned by dw_splitbar_new(). |
1cad81b7cc4c
Implemented initial splitbar code on Unix. And made some fixes for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
115
diff
changeset
|
8527 */ |
120
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
8528 void dw_splitbar_set(HWND handle, float percent) |
119
1cad81b7cc4c
Implemented initial splitbar code on Unix. And made some fixes for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
115
diff
changeset
|
8529 { |
120
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
8530 float *mypercent = (float *)dw_window_get_data(handle, "_dw_percent"); |
145
659c1a2bccad
Fixed the calculations in the splitbar widget. Finished all the splitbar
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
144
diff
changeset
|
8531 int size = 0, position; |
659c1a2bccad
Fixed the calculations in the splitbar widget. Finished all the splitbar
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
144
diff
changeset
|
8532 |
659c1a2bccad
Fixed the calculations in the splitbar widget. Finished all the splitbar
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
144
diff
changeset
|
8533 if(GTK_IS_VPANED(handle)) |
659c1a2bccad
Fixed the calculations in the splitbar widget. Finished all the splitbar
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
144
diff
changeset
|
8534 size = handle->allocation.height; |
659c1a2bccad
Fixed the calculations in the splitbar widget. Finished all the splitbar
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
144
diff
changeset
|
8535 else if(GTK_IS_HPANED(handle)) |
659c1a2bccad
Fixed the calculations in the splitbar widget. Finished all the splitbar
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
144
diff
changeset
|
8536 size = handle->allocation.width; |
120
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
8537 |
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
8538 if(mypercent) |
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
8539 *mypercent = percent; |
145
659c1a2bccad
Fixed the calculations in the splitbar widget. Finished all the splitbar
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
144
diff
changeset
|
8540 |
659c1a2bccad
Fixed the calculations in the splitbar widget. Finished all the splitbar
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
144
diff
changeset
|
8541 if(size > 10) |
659c1a2bccad
Fixed the calculations in the splitbar widget. Finished all the splitbar
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
144
diff
changeset
|
8542 { |
659c1a2bccad
Fixed the calculations in the splitbar widget. Finished all the splitbar
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
144
diff
changeset
|
8543 position = (int)((float)size * (percent / 100.0)); |
659c1a2bccad
Fixed the calculations in the splitbar widget. Finished all the splitbar
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
144
diff
changeset
|
8544 |
659c1a2bccad
Fixed the calculations in the splitbar widget. Finished all the splitbar
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
144
diff
changeset
|
8545 gtk_paned_set_position(GTK_PANED(handle), position); |
659c1a2bccad
Fixed the calculations in the splitbar widget. Finished all the splitbar
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
144
diff
changeset
|
8546 } |
119
1cad81b7cc4c
Implemented initial splitbar code on Unix. And made some fixes for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
115
diff
changeset
|
8547 } |
1cad81b7cc4c
Implemented initial splitbar code on Unix. And made some fixes for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
115
diff
changeset
|
8548 |
1cad81b7cc4c
Implemented initial splitbar code on Unix. And made some fixes for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
115
diff
changeset
|
8549 /* |
1cad81b7cc4c
Implemented initial splitbar code on Unix. And made some fixes for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
115
diff
changeset
|
8550 * Gets the position of a splitbar (pecentage). |
1cad81b7cc4c
Implemented initial splitbar code on Unix. And made some fixes for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
115
diff
changeset
|
8551 * Parameters: |
1cad81b7cc4c
Implemented initial splitbar code on Unix. And made some fixes for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
115
diff
changeset
|
8552 * handle: The handle to the splitbar returned by dw_splitbar_new(). |
1cad81b7cc4c
Implemented initial splitbar code on Unix. And made some fixes for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
115
diff
changeset
|
8553 */ |
120
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
8554 float dw_splitbar_get(HWND handle) |
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
8555 { |
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
8556 float *percent = (float *)dw_window_get_data(handle, "_dw_percent"); |
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
8557 |
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
8558 if(percent) |
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
8559 return *percent; |
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
8560 return 0.0; |
3 | 8561 } |
8562 | |
8563 /* | |
8564 * Pack windows (widgets) into a box from the start (or top). | |
8565 * Parameters: | |
8566 * box: Window handle of the box to be packed into. | |
8567 * item: Window handle of the item to be back. | |
8568 * width: Width in pixels of the item or -1 to be self determined. | |
8569 * height: Height in pixels of the item or -1 to be self determined. | |
8570 * hsize: TRUE if the window (widget) should expand horizontally to fill space given. | |
8571 * vsize: TRUE if the window (widget) should expand vertically to fill space given. | |
8572 * pad: Number of pixels of padding around the item. | |
8573 */ | |
8574 void dw_box_pack_start(HWND box, HWND item, int width, int height, int hsize, int vsize, int pad) | |
8575 { | |
442
7c8bd3bc6c27
Throw the warning after the mutex has been released in dw_box_pack_*
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
438
diff
changeset
|
8576 int warn = FALSE, _locked_by_me = FALSE; |
493
84e471a4ec7e
Don't warn in dw_box_pack_*() for groupboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
491
diff
changeset
|
8577 GtkWidget *tmp, *tmpitem; |
3 | 8578 |
8579 if(!box) | |
8580 return; | |
8581 | |
447
5a0779561d0f
Add more tests for dw_pac*() functions. Throw up a messagebox if you try and
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
442
diff
changeset
|
8582 /* |
5a0779561d0f
Add more tests for dw_pac*() functions. Throw up a messagebox if you try and
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
442
diff
changeset
|
8583 * If you try and pack an item into itself VERY bad things can happen; like at least an |
5a0779561d0f
Add more tests for dw_pac*() functions. Throw up a messagebox if you try and
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
442
diff
changeset
|
8584 * infinite loop on GTK! Lets be safe! |
5a0779561d0f
Add more tests for dw_pac*() functions. Throw up a messagebox if you try and
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
442
diff
changeset
|
8585 */ |
5a0779561d0f
Add more tests for dw_pac*() functions. Throw up a messagebox if you try and
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
442
diff
changeset
|
8586 if(box == item) |
5a0779561d0f
Add more tests for dw_pac*() functions. Throw up a messagebox if you try and
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
442
diff
changeset
|
8587 { |
5a0779561d0f
Add more tests for dw_pac*() functions. Throw up a messagebox if you try and
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
442
diff
changeset
|
8588 dw_messagebox("dw_box_pack_start()", DW_MB_OK|DW_MB_ERROR, "Danger! Danger! Will Robinson; box and item are the same!",box,item); |
5a0779561d0f
Add more tests for dw_pac*() functions. Throw up a messagebox if you try and
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
442
diff
changeset
|
8589 return; |
5a0779561d0f
Add more tests for dw_pac*() functions. Throw up a messagebox if you try and
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
442
diff
changeset
|
8590 } |
5a0779561d0f
Add more tests for dw_pac*() functions. Throw up a messagebox if you try and
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
442
diff
changeset
|
8591 |
3 | 8592 DW_MUTEX_LOCK; |
8593 | |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
8594 if((tmp = gtk_object_get_data(GTK_OBJECT(box), "_dw_boxhandle"))) |
37
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
36
diff
changeset
|
8595 box = tmp; |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
36
diff
changeset
|
8596 |
3 | 8597 if(!item) |
8598 { | |
8599 item = gtk_label_new(""); | |
8600 gtk_widget_show(item); | |
8601 } | |
8602 | |
493
84e471a4ec7e
Don't warn in dw_box_pack_*() for groupboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
491
diff
changeset
|
8603 tmpitem = (GtkWidget *)gtk_object_get_data(GTK_OBJECT(item), "_dw_boxhandle"); |
84e471a4ec7e
Don't warn in dw_box_pack_*() for groupboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
491
diff
changeset
|
8604 |
36
cddb02f847e1
Added unix versions of functions in compat, and added getfsname, plus
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
8605 if(GTK_IS_TABLE(box)) |
3 | 8606 { |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
8607 int boxcount = (int)gtk_object_get_data(GTK_OBJECT(box), "_dw_boxcount"); |
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
8608 int boxtype = (int)gtk_object_get_data(GTK_OBJECT(box), "_dw_boxtype"); |
36
cddb02f847e1
Added unix versions of functions in compat, and added getfsname, plus
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
8609 int x, y; |
cddb02f847e1
Added unix versions of functions in compat, and added getfsname, plus
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
8610 |
cddb02f847e1
Added unix versions of functions in compat, and added getfsname, plus
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
8611 /* If the item being packed is a box, then we use it's padding |
cddb02f847e1
Added unix versions of functions in compat, and added getfsname, plus
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
8612 * instead of the padding specified on the pack line, this is |
cddb02f847e1
Added unix versions of functions in compat, and added getfsname, plus
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
8613 * due to a bug in the OS/2 and Win32 renderer and a limitation |
cddb02f847e1
Added unix versions of functions in compat, and added getfsname, plus
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
8614 * of the GtkTable class. |
cddb02f847e1
Added unix versions of functions in compat, and added getfsname, plus
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
8615 */ |
493
84e471a4ec7e
Don't warn in dw_box_pack_*() for groupboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
491
diff
changeset
|
8616 if(GTK_IS_TABLE(item) || (tmpitem && GTK_IS_TABLE(tmpitem))) |
48
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
8617 { |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
8618 GtkWidget *eventbox = (GtkWidget *)gtk_object_get_data(GTK_OBJECT(item), "_dw_eventbox"); |
48
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
8619 |
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
8620 if(eventbox) |
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
8621 { |
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
8622 gtk_container_add(GTK_CONTAINER(eventbox), item); |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
8623 pad = (int)gtk_object_get_data(GTK_OBJECT(item), "_dw_boxpad"); |
48
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
8624 item = eventbox; |
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
8625 } |
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
8626 } |
438
fac2afe7bda3
Only throw up the messagebox when expand and size are both 0 and the item
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
429
diff
changeset
|
8627 else |
fac2afe7bda3
Only throw up the messagebox when expand and size are both 0 and the item
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
429
diff
changeset
|
8628 { |
442
7c8bd3bc6c27
Throw the warning after the mutex has been released in dw_box_pack_*
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
438
diff
changeset
|
8629 /* Only show warning if item is not a box */ |
7c8bd3bc6c27
Throw the warning after the mutex has been released in dw_box_pack_*
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
438
diff
changeset
|
8630 warn = TRUE; |
438
fac2afe7bda3
Only throw up the messagebox when expand and size are both 0 and the item
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
429
diff
changeset
|
8631 } |
36
cddb02f847e1
Added unix versions of functions in compat, and added getfsname, plus
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
8632 |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
282
diff
changeset
|
8633 if(boxtype == DW_VERT) |
36
cddb02f847e1
Added unix versions of functions in compat, and added getfsname, plus
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
8634 { |
cddb02f847e1
Added unix versions of functions in compat, and added getfsname, plus
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
8635 x = 0; |
cddb02f847e1
Added unix versions of functions in compat, and added getfsname, plus
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
8636 y = boxcount; |
cddb02f847e1
Added unix versions of functions in compat, and added getfsname, plus
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
8637 gtk_table_resize(GTK_TABLE(box), boxcount + 1, 1); |
cddb02f847e1
Added unix versions of functions in compat, and added getfsname, plus
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
8638 } |
cddb02f847e1
Added unix versions of functions in compat, and added getfsname, plus
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
8639 else |
cddb02f847e1
Added unix versions of functions in compat, and added getfsname, plus
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
8640 { |
cddb02f847e1
Added unix versions of functions in compat, and added getfsname, plus
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
8641 x = boxcount; |
cddb02f847e1
Added unix versions of functions in compat, and added getfsname, plus
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
8642 y = 0; |
cddb02f847e1
Added unix versions of functions in compat, and added getfsname, plus
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
8643 gtk_table_resize(GTK_TABLE(box), 1, boxcount + 1); |
cddb02f847e1
Added unix versions of functions in compat, and added getfsname, plus
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
8644 } |
cddb02f847e1
Added unix versions of functions in compat, and added getfsname, plus
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
8645 |
cddb02f847e1
Added unix versions of functions in compat, and added getfsname, plus
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
8646 gtk_table_attach(GTK_TABLE(box), item, x, x + 1, y, y + 1, hsize ? DW_EXPAND : 0, vsize ? DW_EXPAND : 0, pad, pad); |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
8647 gtk_object_set_data(GTK_OBJECT(box), "_dw_boxcount", (gpointer)boxcount + 1); |
3 | 8648 gtk_widget_set_usize(item, width, height); |
8649 if(GTK_IS_RADIO_BUTTON(item)) | |
8650 { | |
8651 GSList *group; | |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
8652 GtkWidget *groupstart = (GtkWidget *)gtk_object_get_data(GTK_OBJECT(box), "_dw_group"); |
3 | 8653 |
8654 if(groupstart) | |
8655 { | |
8656 group = gtk_radio_button_group(GTK_RADIO_BUTTON(groupstart)); | |
8657 gtk_radio_button_set_group(GTK_RADIO_BUTTON(item), group); | |
8658 } | |
8659 else | |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
8660 gtk_object_set_data(GTK_OBJECT(box), "_dw_group", (gpointer)item); |
3 | 8661 } |
8662 } | |
8663 else | |
8664 { | |
8665 GtkWidget *vbox = gtk_vbox_new(FALSE, 0); | |
8666 | |
493
84e471a4ec7e
Don't warn in dw_box_pack_*() for groupboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
491
diff
changeset
|
8667 if(GTK_IS_TABLE(item) || (tmpitem && GTK_IS_TABLE(tmpitem))) |
48
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
8668 { |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
8669 GtkWidget *eventbox = (GtkWidget *)gtk_object_get_data(GTK_OBJECT(item), "_dw_eventbox"); |
48
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
8670 |
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
8671 if(eventbox) |
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
8672 { |
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
8673 gtk_container_add(GTK_CONTAINER(eventbox), item); |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
8674 pad = (int)gtk_object_get_data(GTK_OBJECT(item), "_dw_boxpad"); |
48
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
8675 item = eventbox; |
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
8676 } |
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
8677 } |
438
fac2afe7bda3
Only throw up the messagebox when expand and size are both 0 and the item
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
429
diff
changeset
|
8678 else |
fac2afe7bda3
Only throw up the messagebox when expand and size are both 0 and the item
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
429
diff
changeset
|
8679 { |
442
7c8bd3bc6c27
Throw the warning after the mutex has been released in dw_box_pack_*
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
438
diff
changeset
|
8680 /* Only show warning if item is not a box */ |
7c8bd3bc6c27
Throw the warning after the mutex has been released in dw_box_pack_*
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
438
diff
changeset
|
8681 warn = TRUE; |
438
fac2afe7bda3
Only throw up the messagebox when expand and size are both 0 and the item
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
429
diff
changeset
|
8682 } |
48
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
8683 |
16eac0f8b45f
Latest fixes, mainly for GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
8684 gtk_container_border_width(GTK_CONTAINER(box), pad); |
3 | 8685 gtk_container_add(GTK_CONTAINER(box), vbox); |
36
cddb02f847e1
Added unix versions of functions in compat, and added getfsname, plus
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
8686 gtk_box_pack_end(GTK_BOX(vbox), item, TRUE, TRUE, 0); |
3 | 8687 gtk_widget_show(vbox); |
8688 | |
8689 gtk_widget_set_usize(item, width, height); | |
8690 gtk_object_set_user_data(GTK_OBJECT(box), vbox); | |
8691 } | |
8692 DW_MUTEX_UNLOCK; | |
442
7c8bd3bc6c27
Throw the warning after the mutex has been released in dw_box_pack_*
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
438
diff
changeset
|
8693 |
7c8bd3bc6c27
Throw the warning after the mutex has been released in dw_box_pack_*
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
438
diff
changeset
|
8694 if(warn) |
7c8bd3bc6c27
Throw the warning after the mutex has been released in dw_box_pack_*
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
438
diff
changeset
|
8695 { |
7c8bd3bc6c27
Throw the warning after the mutex has been released in dw_box_pack_*
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
438
diff
changeset
|
8696 if ( width == 0 && hsize == FALSE ) |
7c8bd3bc6c27
Throw the warning after the mutex has been released in dw_box_pack_*
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
438
diff
changeset
|
8697 dw_messagebox("dw_box_pack_start()", DW_MB_OK|DW_MB_ERROR, "Width and expand Horizonal both unset for box: %x item: %x",box,item); |
7c8bd3bc6c27
Throw the warning after the mutex has been released in dw_box_pack_*
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
438
diff
changeset
|
8698 if ( height == 0 && vsize == FALSE ) |
7c8bd3bc6c27
Throw the warning after the mutex has been released in dw_box_pack_*
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
438
diff
changeset
|
8699 dw_messagebox("dw_box_pack_start()", DW_MB_OK|DW_MB_ERROR, "Height and expand Vertical both unset for box: %x item: %x",box,item); |
7c8bd3bc6c27
Throw the warning after the mutex has been released in dw_box_pack_*
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
438
diff
changeset
|
8700 } |
3 | 8701 } |
8702 | |
8703 /* | |
34
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
8704 * Sets the default focus item for a window/dialog. |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
8705 * Parameters: |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
8706 * window: Toplevel window or dialog. |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
8707 * defaultitem: Handle to the dialog item to be default. |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
8708 */ |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
8709 void dw_window_default(HWND window, HWND defaultitem) |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
8710 { |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
8711 int _locked_by_me = FALSE; |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
8712 |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
8713 if(!window) |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
8714 return; |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
8715 |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
8716 DW_MUTEX_LOCK; |
273
95bfcd2deb94
Slight change to get it to work on GTK 2.x, although there is a momentary
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
272
diff
changeset
|
8717 gtk_object_set_data(GTK_OBJECT(window), "_dw_defaultitem", (gpointer)defaultitem); |
34
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
8718 DW_MUTEX_UNLOCK; |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
8719 } |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
8720 |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
8721 /* |
40
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
8722 * Sets window to click the default dialog item when an ENTER is pressed. |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
8723 * Parameters: |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
8724 * window: Window (widget) to look for the ENTER press. |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
8725 * next: Window (widget) to move to next (or click) |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
8726 */ |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
8727 void dw_window_click_default(HWND window, HWND next) |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
8728 { |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
8729 int _locked_by_me = FALSE; |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
8730 |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
8731 if(!window) |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
8732 return; |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
8733 |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
8734 DW_MUTEX_LOCK; |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
8735 gtk_signal_connect(GTK_OBJECT(window), "key_press_event", GTK_SIGNAL_FUNC(_default_key_press_event), next); |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
8736 DW_MUTEX_UNLOCK; |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
8737 } |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
8738 |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
8739 /* |
3 | 8740 * Returns some information about the current operating environment. |
8741 * Parameters: | |
8742 * env: Pointer to a DWEnv struct. | |
8743 */ | |
8744 void dw_environment_query(DWEnv *env) | |
8745 { | |
8746 struct utsname name; | |
8747 char tempbuf[100]; | |
8748 int len, z; | |
8749 | |
8750 uname(&name); | |
8751 strcpy(env->osName, name.sysname); | |
8752 strcpy(tempbuf, name.release); | |
8753 | |
8754 env->MajorBuild = env->MinorBuild = 0; | |
8755 | |
8756 len = strlen(tempbuf); | |
8757 | |
15
81833f25b1aa
Added new Dynamic Windows build information to the DWEnv struct.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
14
diff
changeset
|
8758 strcpy(env->buildDate, __DATE__); |
81833f25b1aa
Added new Dynamic Windows build information to the DWEnv struct.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
14
diff
changeset
|
8759 strcpy(env->buildTime, __TIME__); |
81833f25b1aa
Added new Dynamic Windows build information to the DWEnv struct.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
14
diff
changeset
|
8760 env->DWMajorVersion = DW_MAJOR_VERSION; |
81833f25b1aa
Added new Dynamic Windows build information to the DWEnv struct.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
14
diff
changeset
|
8761 env->DWMinorVersion = DW_MINOR_VERSION; |
81833f25b1aa
Added new Dynamic Windows build information to the DWEnv struct.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
14
diff
changeset
|
8762 env->DWSubVersion = DW_SUB_VERSION; |
81833f25b1aa
Added new Dynamic Windows build information to the DWEnv struct.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
14
diff
changeset
|
8763 |
3 | 8764 for(z=1;z<len;z++) |
8765 { | |
8766 if(tempbuf[z] == '.') | |
8767 { | |
8768 tempbuf[z] = '\0'; | |
8769 env->MajorVersion = atoi(&tempbuf[z-1]); | |
8770 env->MinorVersion = atoi(&tempbuf[z+1]); | |
8771 return; | |
8772 } | |
8773 } | |
8774 env->MajorVersion = atoi(tempbuf); | |
8775 env->MinorVersion = 0; | |
8776 } | |
8777 | |
8778 /* Internal function to handle the file OK press */ | |
258
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
8779 static gint _gtk_file_ok(GtkWidget *widget, DWDialog *dwwait) |
3 | 8780 { |
120
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
8781 #if GTK_MAJOR_VERSION > 1 |
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
8782 const char *tmp; |
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
8783 #else |
3 | 8784 char *tmp; |
120
7d2108cbcd3e
Porting DW to GTK 2.0... and changed the percent value from into to a float
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
8785 #endif |
214
0e98514a3905
Applied patch from Mark Hessling to prevent the return buffer from the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
208
diff
changeset
|
8786 char *tmpdup=NULL; |
3 | 8787 |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
8788 if(!dwwait) |
134
caeb52bb5ef4
Pass pointers to argc and argv on Unix.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
133
diff
changeset
|
8789 return FALSE; |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
8790 |
214
0e98514a3905
Applied patch from Mark Hessling to prevent the return buffer from the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
208
diff
changeset
|
8791 if((tmp = gtk_file_selection_get_filename(GTK_FILE_SELECTION(dwwait->data)))) |
0e98514a3905
Applied patch from Mark Hessling to prevent the return buffer from the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
208
diff
changeset
|
8792 tmpdup = strdup(tmp); |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
8793 gtk_widget_destroy(GTK_WIDGET(dwwait->data)); |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
8794 _dw_file_active = 0; |
214
0e98514a3905
Applied patch from Mark Hessling to prevent the return buffer from the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
208
diff
changeset
|
8795 dw_dialog_dismiss(dwwait, (void *)tmpdup); |
134
caeb52bb5ef4
Pass pointers to argc and argv on Unix.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
133
diff
changeset
|
8796 return FALSE; |
3 | 8797 } |
8798 | |
8799 /* Internal function to handle the file Cancel press */ | |
258
b2c436c84e5d
Added code to create a lookup table for icon data loaded in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
8800 static gint _gtk_file_cancel(GtkWidget *widget, DWDialog *dwwait) |
3 | 8801 { |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
8802 if(!dwwait) |
134
caeb52bb5ef4
Pass pointers to argc and argv on Unix.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
133
diff
changeset
|
8803 return FALSE; |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
8804 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
8805 gtk_widget_destroy(GTK_WIDGET(dwwait->data)); |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
8806 _dw_file_active = 0; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
8807 dw_dialog_dismiss(dwwait, NULL); |
134
caeb52bb5ef4
Pass pointers to argc and argv on Unix.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
133
diff
changeset
|
8808 return FALSE; |
3 | 8809 } |
8810 | |
482
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8811 /* The next few functions are support functions for the UNIX folder browser */ |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8812 static void _populate_directory(HWND tree, HTREEITEM parent, char *path) |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8813 { |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8814 struct dirent *dent; |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8815 HTREEITEM item; |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8816 DIR *hdir; |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8817 |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8818 if((hdir = opendir(path))) |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8819 { |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8820 while((dent = readdir(hdir))) |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8821 { |
484
f18c70cb3e38
Fixes for GTK 2.x, and correctly check for the directory bit. NOTE:
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
483
diff
changeset
|
8822 if(strcmp(dent->d_name, ".") && strcmp(dent->d_name, "..")) |
482
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8823 { |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8824 int len = strlen(path); |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8825 char *folder = malloc(len + strlen(dent->d_name) + 2); |
484
f18c70cb3e38
Fixes for GTK 2.x, and correctly check for the directory bit. NOTE:
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
483
diff
changeset
|
8826 struct stat bleah; |
482
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8827 HTREEITEM tempitem; |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8828 |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8829 strcpy(folder, path); |
484
f18c70cb3e38
Fixes for GTK 2.x, and correctly check for the directory bit. NOTE:
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
483
diff
changeset
|
8830 strcpy(&folder[len], dent->d_name); |
f18c70cb3e38
Fixes for GTK 2.x, and correctly check for the directory bit. NOTE:
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
483
diff
changeset
|
8831 |
f18c70cb3e38
Fixes for GTK 2.x, and correctly check for the directory bit. NOTE:
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
483
diff
changeset
|
8832 stat(folder, &bleah); |
f18c70cb3e38
Fixes for GTK 2.x, and correctly check for the directory bit. NOTE:
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
483
diff
changeset
|
8833 |
f18c70cb3e38
Fixes for GTK 2.x, and correctly check for the directory bit. NOTE:
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
483
diff
changeset
|
8834 if(S_IFDIR & bleah.st_mode) |
f18c70cb3e38
Fixes for GTK 2.x, and correctly check for the directory bit. NOTE:
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
483
diff
changeset
|
8835 { |
f18c70cb3e38
Fixes for GTK 2.x, and correctly check for the directory bit. NOTE:
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
483
diff
changeset
|
8836 item = dw_tree_insert(tree, dent->d_name, 0, parent, (void *)parent); |
f18c70cb3e38
Fixes for GTK 2.x, and correctly check for the directory bit. NOTE:
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
483
diff
changeset
|
8837 tempitem = dw_tree_insert(tree, "", 0, item, 0); |
513
7755599311d4
Fixes search and replace errors.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
511
diff
changeset
|
8838 dw_tree_item_set_data(tree, item, (void *)tempitem); |
484
f18c70cb3e38
Fixes for GTK 2.x, and correctly check for the directory bit. NOTE:
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
483
diff
changeset
|
8839 } |
482
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8840 |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8841 free(folder); |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8842 } |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8843 } |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8844 closedir(hdir); |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8845 } |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8846 } |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8847 |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8848 static int DWSIGNAL _dw_folder_ok_func(HWND window, void *data) |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8849 { |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8850 DWDialog *dwwait = (DWDialog *)data; |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8851 void *treedata; |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8852 |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8853 if(!dwwait) |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8854 return FALSE; |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8855 |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8856 treedata = dw_window_get_data((HWND)dwwait->data, "_dw_tree_selected"); |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8857 dw_window_destroy((HWND)dwwait->data); |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8858 dw_dialog_dismiss(dwwait, treedata); |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8859 return FALSE; |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8860 } |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8861 |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8862 static int DWSIGNAL _dw_folder_cancel_func(HWND window, void *data) |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8863 { |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8864 DWDialog *dwwait = (DWDialog *)data; |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8865 |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8866 if(!dwwait) |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8867 return FALSE; |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8868 |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8869 dw_window_destroy((HWND)dwwait->data); |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8870 dw_dialog_dismiss(dwwait, NULL); |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8871 return FALSE; |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8872 } |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8873 |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8874 static char *_tree_folder(HWND tree, HTREEITEM item) |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8875 { |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8876 char *folder=strdup(""); |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8877 HTREEITEM parent = item; |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8878 |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8879 while(parent) |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8880 { |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8881 char *temp, *text = dw_tree_get_title(tree, parent); |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8882 |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8883 if(text) |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8884 { |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8885 temp = malloc(strlen(text) + strlen(folder) + 3); |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8886 strcpy(temp, text); |
493
84e471a4ec7e
Don't warn in dw_box_pack_*() for groupboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
491
diff
changeset
|
8887 if(strcmp(text, "/")) |
482
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8888 strcat(temp, "/"); |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8889 strcat(temp, folder); |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8890 free(folder); |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8891 folder = temp; |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8892 } |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8893 parent = dw_tree_get_parent(tree, parent); |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8894 } |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8895 return folder; |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8896 } |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8897 |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8898 static int DWSIGNAL _item_select(HWND window, HTREEITEM item, char *text, void *data, void *itemdata) |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8899 { |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8900 DWDialog *dwwait = (DWDialog *)data; |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8901 char *treedata = (char *)dw_window_get_data((HWND)dwwait->data, "_dw_tree_selected"); |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8902 |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8903 text = text; itemdata = itemdata; |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8904 if(treedata) |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8905 free(treedata); |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8906 |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8907 treedata = _tree_folder(window, item); |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8908 dw_window_set_data((HWND)dwwait->data, "_dw_tree_selected", (void *)treedata); |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8909 |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8910 return FALSE; |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8911 } |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8912 |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8913 static int DWSIGNAL _tree_expand(HWND window, HTREEITEM item, void *data) |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8914 { |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8915 DWDialog *dwwait = (DWDialog *)data; |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8916 HWND tree = (HWND)dw_window_get_data((HWND)dwwait->data, "_dw_tree"); |
510
710f82598210
Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
508
diff
changeset
|
8917 HTREEITEM tempitem = (HTREEITEM)dw_tree_item_get_data(tree, item); |
482
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8918 |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8919 if(tempitem) |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8920 { |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8921 char *folder = _tree_folder(tree, item); |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8922 |
513
7755599311d4
Fixes search and replace errors.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
511
diff
changeset
|
8923 dw_tree_item_set_data(tree, item, 0); |
486
3bc712d2c362
Delete the temporary item _after_ populating the subtree. This prevents
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
484
diff
changeset
|
8924 |
3bc712d2c362
Delete the temporary item _after_ populating the subtree. This prevents
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
484
diff
changeset
|
8925 if(*folder) |
3bc712d2c362
Delete the temporary item _after_ populating the subtree. This prevents
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
484
diff
changeset
|
8926 _populate_directory(tree, item, folder); |
3bc712d2c362
Delete the temporary item _after_ populating the subtree. This prevents
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
484
diff
changeset
|
8927 |
483
1cb1b87bbd30
Fixes for the Unix file browser... seems to have revealed a problem in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
482
diff
changeset
|
8928 #if GTK_MAJOR_VERSION > 1 |
1cb1b87bbd30
Fixes for the Unix file browser... seems to have revealed a problem in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
482
diff
changeset
|
8929 /* FIXME: GTK 1.x tree control goes crazy when |
1cb1b87bbd30
Fixes for the Unix file browser... seems to have revealed a problem in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
482
diff
changeset
|
8930 * I delete the temporary item. The subtree |
1cb1b87bbd30
Fixes for the Unix file browser... seems to have revealed a problem in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
482
diff
changeset
|
8931 * it sits on ceases to be valid and attempts |
1cb1b87bbd30
Fixes for the Unix file browser... seems to have revealed a problem in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
482
diff
changeset
|
8932 * to delete or recreate it fail horribly. |
1cb1b87bbd30
Fixes for the Unix file browser... seems to have revealed a problem in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
482
diff
changeset
|
8933 */ |
510
710f82598210
Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
508
diff
changeset
|
8934 dw_tree_item_delete(tree, tempitem); |
483
1cb1b87bbd30
Fixes for the Unix file browser... seems to have revealed a problem in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
482
diff
changeset
|
8935 #endif |
482
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8936 free(folder); |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8937 } |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8938 |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8939 return FALSE; |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8940 } |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8941 |
3 | 8942 /* |
8943 * Opens a file dialog and queries user selection. | |
8944 * Parameters: | |
8945 * title: Title bar text for dialog. | |
8946 * defpath: The default path of the open dialog. | |
8947 * ext: Default file extention. | |
449
787cc1e27897
Add support for directory browsing under Win32. DW_DIRECTORY_OPEN can be
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
447
diff
changeset
|
8948 * flags: DW_FILE_OPEN or DW_FILE_SAVE or DW_DIRECTORY_OPEN |
3 | 8949 * Returns: |
8950 * NULL on error. A malloced buffer containing | |
8951 * the file path on success. | |
8952 * | |
8953 */ | |
8954 char *dw_file_browse(char *title, char *defpath, char *ext, int flags) | |
8955 { | |
8956 GtkWidget *filew; | |
8957 int _locked_by_me = FALSE; | |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
8958 DWDialog *dwwait; |
3 | 8959 |
482
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8960 if(flags == DW_DIRECTORY_OPEN) |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8961 { |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8962 HWND window, hbox, vbox, tree, button; |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8963 HTREEITEM item, tempitem; |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8964 |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8965 window = dw_window_new( HWND_DESKTOP, title, DW_FCF_SHELLPOSITION | DW_FCF_TITLEBAR | DW_FCF_SIZEBORDER | DW_FCF_MINMAX); |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8966 |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8967 vbox = dw_box_new(DW_VERT, 5); |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8968 |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8969 dw_box_pack_start(window, vbox, 0, 0, TRUE, TRUE, 0); |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8970 |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8971 tree = dw_tree_new(60); |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8972 |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8973 dw_box_pack_start(vbox, tree, 1, 1, TRUE, TRUE, 0); |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8974 dw_window_set_data(window, "_dw_tree", (void *)tree); |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8975 |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8976 hbox = dw_box_new(DW_HORZ, 0); |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8977 |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8978 dw_box_pack_start(vbox, hbox, 0, 0, TRUE, FALSE, 0); |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8979 |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8980 dwwait = dw_dialog_new((void *)window); |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8981 |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8982 dw_signal_connect(tree, DW_SIGNAL_ITEM_SELECT, DW_SIGNAL_FUNC(_item_select), (void *)dwwait); |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8983 dw_signal_connect(tree, DW_SIGNAL_TREE_EXPAND, DW_SIGNAL_FUNC(_tree_expand), (void *)dwwait); |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8984 |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8985 button = dw_button_new("Ok", 1001L); |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8986 dw_box_pack_start(hbox, button, 50, 30, TRUE, FALSE, 3); |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8987 dw_signal_connect(button, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(_dw_folder_ok_func), (void *)dwwait); |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8988 |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8989 button = dw_button_new("Cancel", 1002L); |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8990 dw_box_pack_start(hbox, button, 50, 30, TRUE, FALSE, 3); |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8991 dw_signal_connect(button, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(_dw_folder_cancel_func), (void *)dwwait); |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8992 |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8993 item = dw_tree_insert(tree, "/", 0, NULL, 0); |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8994 tempitem = dw_tree_insert(tree, "", 0, item, 0); |
513
7755599311d4
Fixes search and replace errors.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
511
diff
changeset
|
8995 dw_tree_item_set_data(tree, item, (void *)tempitem); |
510
710f82598210
Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
508
diff
changeset
|
8996 |
710f82598210
Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
508
diff
changeset
|
8997 dw_window_set_size(window, 225, 300); |
482
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8998 dw_window_show(window); |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
8999 } |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
9000 else |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
9001 { |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
9002 DW_MUTEX_LOCK; |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
9003 |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
9004 /* The DW mutex should be sufficient for |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
9005 * insuring no thread changes this unknowingly. |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
9006 */ |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
9007 if(_dw_file_active) |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
9008 { |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
9009 DW_MUTEX_UNLOCK; |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
9010 return NULL; |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
9011 } |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
9012 |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
9013 _dw_file_active = 1; |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
9014 |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
9015 filew = gtk_file_selection_new(title); |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
9016 |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
9017 dwwait = dw_dialog_new((void *)filew); |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
9018 |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
9019 gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(filew)->ok_button), "clicked", (GtkSignalFunc) _gtk_file_ok, dwwait); |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
9020 gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(filew)->cancel_button), "clicked", (GtkSignalFunc) _gtk_file_cancel, dwwait); |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
9021 |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
9022 if(defpath) |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
9023 gtk_file_selection_set_filename(GTK_FILE_SELECTION(filew), defpath); |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
9024 |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
9025 gtk_widget_show(filew); |
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
9026 |
3 | 9027 DW_MUTEX_UNLOCK; |
482
89b1b40d7e12
Initial port of the OS/2 folder browser to unix. dw_tree_get_parent()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
480
diff
changeset
|
9028 } |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
19
diff
changeset
|
9029 return (char *)dw_dialog_wait(dwwait); |
3 | 9030 } |
9031 | |
9032 | |
9033 /* | |
9034 * Execute and external program in a seperate session. | |
9035 * Parameters: | |
9036 * program: Program name with optional path. | |
9037 * type: Either DW_EXEC_CON or DW_EXEC_GUI. | |
9038 * params: An array of pointers to string arguements. | |
9039 * Returns: | |
9040 * -1 on error. | |
9041 */ | |
9042 int dw_exec(char *program, int type, char **params) | |
9043 { | |
9044 int ret = -1; | |
9045 | |
9046 if((ret = fork()) == 0) | |
9047 { | |
9048 int i; | |
9049 | |
9050 for (i = 3; i < 256; i++) | |
9051 close(i); | |
9052 setsid(); | |
9053 if(type == DW_EXEC_GUI) | |
9054 { | |
9055 execvp(program, params); | |
9056 } | |
9057 else if(type == DW_EXEC_CON) | |
9058 { | |
9059 char **tmpargs; | |
9060 | |
9061 if(!params) | |
9062 { | |
9063 tmpargs = malloc(sizeof(char *)); | |
9064 tmpargs[0] = NULL; | |
9065 } | |
9066 else | |
9067 { | |
9068 int z = 0; | |
9069 | |
9070 while(params[z]) | |
9071 { | |
9072 z++; | |
9073 } | |
9074 tmpargs = malloc(sizeof(char *)*(z+3)); | |
9075 z=0; | |
9076 tmpargs[0] = "xterm"; | |
9077 tmpargs[1] = "-e"; | |
9078 while(params[z]) | |
9079 { | |
9080 tmpargs[z+2] = params[z]; | |
9081 z++; | |
9082 } | |
9083 tmpargs[z+2] = NULL; | |
9084 } | |
9085 execvp("xterm", tmpargs); | |
9086 free(tmpargs); | |
9087 } | |
9088 /* If we got here exec failed */ | |
9089 _exit(-1); | |
9090 } | |
9091 return ret; | |
9092 } | |
9093 | |
9094 /* | |
9095 * Loads a web browser pointed at the given URL. | |
9096 * Parameters: | |
9097 * url: Uniform resource locator. | |
9098 */ | |
9099 int dw_browse(char *url) | |
9100 { | |
9101 /* Is there a way to find the webbrowser in Unix? */ | |
463
2d7b27204cd4
Add support for DW_BROWSER to specify browser executable fir dw_browse()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
460
diff
changeset
|
9102 char *execargs[3], *browser = "netscape", *tmp; |
2d7b27204cd4
Add support for DW_BROWSER to specify browser executable fir dw_browse()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
460
diff
changeset
|
9103 |
2d7b27204cd4
Add support for DW_BROWSER to specify browser executable fir dw_browse()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
460
diff
changeset
|
9104 tmp = getenv( "DW_BROWSER" ); |
2d7b27204cd4
Add support for DW_BROWSER to specify browser executable fir dw_browse()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
460
diff
changeset
|
9105 if(tmp) browser = tmp; |
3 | 9106 execargs[0] = browser; |
9107 execargs[1] = url; | |
9108 execargs[2] = NULL; | |
9109 | |
9110 return dw_exec(browser, DW_EXEC_GUI, execargs); | |
9111 } | |
9112 | |
9113 /* | |
9114 * Returns a pointer to a static buffer which containes the | |
9115 * current user directory. Or the root directory (C:\ on | |
9116 * OS/2 and Windows). | |
9117 */ | |
9118 char *dw_user_dir(void) | |
9119 { | |
9120 static char _user_dir[1024] = ""; | |
9121 | |
9122 if(!_user_dir[0]) | |
9123 { | |
9124 char *home = getenv("HOME"); | |
9125 | |
9126 if(home) | |
9127 strcpy(_user_dir, home); | |
9128 else | |
9129 strcpy(_user_dir, "/"); | |
9130 } | |
9131 return _user_dir; | |
9132 } | |
9133 | |
9134 /* | |
9135 * Call a function from the window (widget)'s context. | |
9136 * Parameters: | |
9137 * handle: Window handle of the widget. | |
9138 * function: Function pointer to be called. | |
9139 * data: Pointer to the data to be passed to the function. | |
9140 */ | |
9141 void dw_window_function(HWND handle, void *function, void *data) | |
9142 { | |
37
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
36
diff
changeset
|
9143 void (* windowfunc)(void *); |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
36
diff
changeset
|
9144 |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
36
diff
changeset
|
9145 windowfunc = function; |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
36
diff
changeset
|
9146 |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
36
diff
changeset
|
9147 if(windowfunc) |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
36
diff
changeset
|
9148 windowfunc(data); |
3 | 9149 } |
9150 | |
90
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
87
diff
changeset
|
9151 /* |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
87
diff
changeset
|
9152 * Add a named user data item to a window handle. |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
87
diff
changeset
|
9153 * Parameters: |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
87
diff
changeset
|
9154 * window: Window handle of signal to be called back. |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
87
diff
changeset
|
9155 * dataname: A string pointer identifying which signal to be hooked. |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
87
diff
changeset
|
9156 * data: User data to be passed to the handler function. |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
87
diff
changeset
|
9157 */ |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
87
diff
changeset
|
9158 void dw_window_set_data(HWND window, char *dataname, void *data) |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
87
diff
changeset
|
9159 { |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
87
diff
changeset
|
9160 int _locked_by_me = FALSE; |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
87
diff
changeset
|
9161 |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
87
diff
changeset
|
9162 if(!window) |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
87
diff
changeset
|
9163 return; |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
87
diff
changeset
|
9164 |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
87
diff
changeset
|
9165 DW_MUTEX_LOCK; |
112
cf0115e38ef0
On multi-widget windows, set the data on all components.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
107
diff
changeset
|
9166 if(GTK_IS_OBJECT(window)) |
cf0115e38ef0
On multi-widget windows, set the data on all components.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
107
diff
changeset
|
9167 { |
cf0115e38ef0
On multi-widget windows, set the data on all components.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
107
diff
changeset
|
9168 if(GTK_IS_SCROLLED_WINDOW(window)) |
cf0115e38ef0
On multi-widget windows, set the data on all components.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
107
diff
changeset
|
9169 { |
cf0115e38ef0
On multi-widget windows, set the data on all components.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
107
diff
changeset
|
9170 HWND thiswindow = (HWND)gtk_object_get_user_data(GTK_OBJECT(window)); |
cf0115e38ef0
On multi-widget windows, set the data on all components.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
107
diff
changeset
|
9171 |
cf0115e38ef0
On multi-widget windows, set the data on all components.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
107
diff
changeset
|
9172 if(thiswindow && GTK_IS_OBJECT(thiswindow)) |
cf0115e38ef0
On multi-widget windows, set the data on all components.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
107
diff
changeset
|
9173 gtk_object_set_data(GTK_OBJECT(thiswindow), dataname, (gpointer)data); |
cf0115e38ef0
On multi-widget windows, set the data on all components.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
107
diff
changeset
|
9174 } |
cf0115e38ef0
On multi-widget windows, set the data on all components.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
107
diff
changeset
|
9175 if(GTK_IS_COMBO(window)) |
cf0115e38ef0
On multi-widget windows, set the data on all components.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
107
diff
changeset
|
9176 gtk_object_set_data(GTK_OBJECT(GTK_COMBO(window)->entry), dataname, (gpointer)data); |
cf0115e38ef0
On multi-widget windows, set the data on all components.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
107
diff
changeset
|
9177 gtk_object_set_data(GTK_OBJECT(window), dataname, (gpointer)data); |
cf0115e38ef0
On multi-widget windows, set the data on all components.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
107
diff
changeset
|
9178 } |
90
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
87
diff
changeset
|
9179 DW_MUTEX_UNLOCK; |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
87
diff
changeset
|
9180 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
87
diff
changeset
|
9181 |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
87
diff
changeset
|
9182 /* |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
87
diff
changeset
|
9183 * Gets a named user data item to a window handle. |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
87
diff
changeset
|
9184 * Parameters: |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
87
diff
changeset
|
9185 * window: Window handle of signal to be called back. |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
87
diff
changeset
|
9186 * dataname: A string pointer identifying which signal to be hooked. |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
87
diff
changeset
|
9187 * data: User data to be passed to the handler function. |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
87
diff
changeset
|
9188 */ |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
87
diff
changeset
|
9189 void *dw_window_get_data(HWND window, char *dataname) |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
87
diff
changeset
|
9190 { |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
87
diff
changeset
|
9191 int _locked_by_me = FALSE; |
112
cf0115e38ef0
On multi-widget windows, set the data on all components.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
107
diff
changeset
|
9192 void *ret = NULL; |
90
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
87
diff
changeset
|
9193 |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
87
diff
changeset
|
9194 if(!window) |
92
0a085f295e81
A couple more minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
91
diff
changeset
|
9195 return NULL; |
90
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
87
diff
changeset
|
9196 |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
87
diff
changeset
|
9197 DW_MUTEX_LOCK; |
112
cf0115e38ef0
On multi-widget windows, set the data on all components.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
107
diff
changeset
|
9198 if(GTK_IS_OBJECT(window)) |
cf0115e38ef0
On multi-widget windows, set the data on all components.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
107
diff
changeset
|
9199 ret = (void *)gtk_object_get_data(GTK_OBJECT(window), dataname); |
90
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
87
diff
changeset
|
9200 DW_MUTEX_UNLOCK; |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
87
diff
changeset
|
9201 return ret; |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
87
diff
changeset
|
9202 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
87
diff
changeset
|
9203 |
3 | 9204 /* |
195
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
9205 * Add a callback to a timer event. |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
9206 * Parameters: |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
9207 * interval: Milliseconds to delay between calls. |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
9208 * sigfunc: The pointer to the function to be used as the callback. |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
9209 * data: User data to be passed to the handler function. |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
9210 * Returns: |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
9211 * Timer ID for use with dw_timer_disconnect(), 0 on error. |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
9212 */ |
199
b955228477b3
Removed the window parameter to dw_timer_connect() it was no needed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
198
diff
changeset
|
9213 int API dw_timer_connect(int interval, void *sigfunc, void *data) |
195
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
9214 { |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
9215 int tag, _locked_by_me = FALSE; |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
9216 |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
9217 DW_MUTEX_LOCK; |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
9218 tag = gtk_timeout_add(interval, (GtkFunction)sigfunc, data); |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
9219 DW_MUTEX_UNLOCK; |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
9220 return tag; |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
9221 } |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
9222 |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
9223 /* |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
9224 * Removes timer callback. |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
9225 * Parameters: |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
9226 * id: Timer ID returned by dw_timer_connect(). |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
9227 */ |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
9228 void API dw_timer_disconnect(int id) |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
9229 { |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
9230 int _locked_by_me = FALSE; |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
9231 |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
9232 DW_MUTEX_LOCK; |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
9233 gtk_timeout_remove(id); |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
9234 DW_MUTEX_UNLOCK; |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
9235 } |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
9236 |
410
47273b6a8500
Fixes for signal removal. Some limitations still exist... like some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
409
diff
changeset
|
9237 /* Get the actual signal window handle not the user window handle |
47273b6a8500
Fixes for signal removal. Some limitations still exist... like some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
409
diff
changeset
|
9238 * Should mimic the code in dw_signal_connect() below. |
47273b6a8500
Fixes for signal removal. Some limitations still exist... like some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
409
diff
changeset
|
9239 */ |
47273b6a8500
Fixes for signal removal. Some limitations still exist... like some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
409
diff
changeset
|
9240 static HWND _find_signal_window(HWND window, char *signame) |
47273b6a8500
Fixes for signal removal. Some limitations still exist... like some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
409
diff
changeset
|
9241 { |
47273b6a8500
Fixes for signal removal. Some limitations still exist... like some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
409
diff
changeset
|
9242 HWND thiswindow = window; |
47273b6a8500
Fixes for signal removal. Some limitations still exist... like some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
409
diff
changeset
|
9243 |
47273b6a8500
Fixes for signal removal. Some limitations still exist... like some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
409
diff
changeset
|
9244 if(GTK_IS_SCROLLED_WINDOW(thiswindow)) |
47273b6a8500
Fixes for signal removal. Some limitations still exist... like some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
409
diff
changeset
|
9245 thiswindow = (HWND)gtk_object_get_user_data(GTK_OBJECT(window)); |
47273b6a8500
Fixes for signal removal. Some limitations still exist... like some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
409
diff
changeset
|
9246 else if(GTK_IS_COMBO(thiswindow) && signame && strcmp(signame, DW_SIGNAL_LIST_SELECT) == 0) |
47273b6a8500
Fixes for signal removal. Some limitations still exist... like some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
409
diff
changeset
|
9247 thiswindow = GTK_COMBO(thiswindow)->list; |
47273b6a8500
Fixes for signal removal. Some limitations still exist... like some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
409
diff
changeset
|
9248 else if(GTK_IS_COMBO(thiswindow) && signame && strcmp(signame, DW_SIGNAL_SET_FOCUS) == 0) |
47273b6a8500
Fixes for signal removal. Some limitations still exist... like some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
409
diff
changeset
|
9249 thiswindow = GTK_COMBO(thiswindow)->entry; |
47273b6a8500
Fixes for signal removal. Some limitations still exist... like some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
409
diff
changeset
|
9250 else if(GTK_IS_VSCALE(thiswindow) || GTK_IS_HSCALE(thiswindow) || |
47273b6a8500
Fixes for signal removal. Some limitations still exist... like some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
409
diff
changeset
|
9251 GTK_IS_VSCROLLBAR(thiswindow) || GTK_IS_HSCROLLBAR(thiswindow)) |
47273b6a8500
Fixes for signal removal. Some limitations still exist... like some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
409
diff
changeset
|
9252 thiswindow = (GtkWidget *)gtk_object_get_data(GTK_OBJECT(thiswindow), "_dw_adjustment"); |
47273b6a8500
Fixes for signal removal. Some limitations still exist... like some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
409
diff
changeset
|
9253 #if GTK_MAJOR_VERSION > 1 |
47273b6a8500
Fixes for signal removal. Some limitations still exist... like some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
409
diff
changeset
|
9254 else if(GTK_IS_TREE_VIEW(thiswindow) && strcmp(signame, DW_SIGNAL_ITEM_SELECT) == 0) |
47273b6a8500
Fixes for signal removal. Some limitations still exist... like some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
409
diff
changeset
|
9255 thiswindow = (GtkWidget *)gtk_tree_view_get_selection(GTK_TREE_VIEW(thiswindow)); |
47273b6a8500
Fixes for signal removal. Some limitations still exist... like some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
409
diff
changeset
|
9256 #endif |
47273b6a8500
Fixes for signal removal. Some limitations still exist... like some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
409
diff
changeset
|
9257 return thiswindow; |
47273b6a8500
Fixes for signal removal. Some limitations still exist... like some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
409
diff
changeset
|
9258 } |
47273b6a8500
Fixes for signal removal. Some limitations still exist... like some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
409
diff
changeset
|
9259 |
195
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
9260 /* |
3 | 9261 * Add a callback to a window event. |
9262 * Parameters: | |
9263 * window: Window handle of signal to be called back. | |
9264 * signame: A string pointer identifying which signal to be hooked. | |
9265 * sigfunc: The pointer to the function to be used as the callback. | |
9266 * data: User data to be passed to the handler function. | |
9267 */ | |
9268 void dw_signal_connect(HWND window, char *signame, void *sigfunc, void *data) | |
9269 { | |
9270 void *thisfunc = _findsigfunc(signame); | |
9271 char *thisname = signame; | |
9272 HWND thiswindow = window; | |
409
1d7be77cbfb5
Implemented signal removal system so it works like OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
407
diff
changeset
|
9273 int sigid, _locked_by_me = FALSE; |
1d7be77cbfb5
Implemented signal removal system so it works like OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
407
diff
changeset
|
9274 gint cid; |
3 | 9275 |
9276 DW_MUTEX_LOCK; | |
9277 if(GTK_IS_SCROLLED_WINDOW(thiswindow)) | |
9278 { | |
9279 thiswindow = (HWND)gtk_object_get_user_data(GTK_OBJECT(window)); | |
9280 } | |
9281 | |
307
324587c06cea
Use the signal #defines internally so all that is required to change
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
296
diff
changeset
|
9282 if(GTK_IS_MENU_ITEM(thiswindow) && strcmp(signame, DW_SIGNAL_CLICKED) == 0) |
3 | 9283 { |
9284 thisname = "activate"; | |
9285 thisfunc = _findsigfunc(thisname); | |
9286 } | |
307
324587c06cea
Use the signal #defines internally so all that is required to change
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
296
diff
changeset
|
9287 else if(GTK_IS_CLIST(thiswindow) && strcmp(signame, DW_SIGNAL_ITEM_CONTEXT) == 0) |
3 | 9288 { |
9289 thisname = "button_press_event"; | |
307
324587c06cea
Use the signal #defines internally so all that is required to change
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
296
diff
changeset
|
9290 thisfunc = _findsigfunc(DW_SIGNAL_ITEM_CONTEXT); |
3 | 9291 } |
140
e0e73b4372a6
GTK 2.0 tree control is now fully functional. I just need to check for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
139
diff
changeset
|
9292 #if GTK_MAJOR_VERSION > 1 |
307
324587c06cea
Use the signal #defines internally so all that is required to change
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
296
diff
changeset
|
9293 else if(GTK_IS_TREE_VIEW(thiswindow) && strcmp(signame, DW_SIGNAL_ITEM_CONTEXT) == 0) |
140
e0e73b4372a6
GTK 2.0 tree control is now fully functional. I just need to check for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
139
diff
changeset
|
9294 { |
e0e73b4372a6
GTK 2.0 tree control is now fully functional. I just need to check for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
139
diff
changeset
|
9295 thisfunc = _findsigfunc("tree-context"); |
409
1d7be77cbfb5
Implemented signal removal system so it works like OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
407
diff
changeset
|
9296 sigid = _set_signal_handler(thiswindow, window, sigfunc, data, thisfunc); |
1d7be77cbfb5
Implemented signal removal system so it works like OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
407
diff
changeset
|
9297 cid = gtk_signal_connect(GTK_OBJECT(thiswindow), "button_press_event", GTK_SIGNAL_FUNC(thisfunc), (gpointer)sigid); |
1d7be77cbfb5
Implemented signal removal system so it works like OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
407
diff
changeset
|
9298 _set_signal_handler_id(thiswindow, sigid, cid); |
1d7be77cbfb5
Implemented signal removal system so it works like OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
407
diff
changeset
|
9299 sigid = _set_signal_handler(window, window, sigfunc, data, thisfunc); |
1d7be77cbfb5
Implemented signal removal system so it works like OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
407
diff
changeset
|
9300 cid = gtk_signal_connect(GTK_OBJECT(window), "button_press_event", GTK_SIGNAL_FUNC(thisfunc), (gpointer)sigid); |
1d7be77cbfb5
Implemented signal removal system so it works like OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
407
diff
changeset
|
9301 _set_signal_handler_id(window, sigid, cid); |
140
e0e73b4372a6
GTK 2.0 tree control is now fully functional. I just need to check for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
139
diff
changeset
|
9302 DW_MUTEX_UNLOCK; |
e0e73b4372a6
GTK 2.0 tree control is now fully functional. I just need to check for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
139
diff
changeset
|
9303 return; |
e0e73b4372a6
GTK 2.0 tree control is now fully functional. I just need to check for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
139
diff
changeset
|
9304 } |
307
324587c06cea
Use the signal #defines internally so all that is required to change
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
296
diff
changeset
|
9305 else if(GTK_IS_TREE_VIEW(thiswindow) && strcmp(signame, DW_SIGNAL_ITEM_SELECT) == 0) |
140
e0e73b4372a6
GTK 2.0 tree control is now fully functional. I just need to check for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
139
diff
changeset
|
9306 { |
362
eb61b854fd58
Fixes for new signal handler code, for GTK 2.x tree control.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
361
diff
changeset
|
9307 GtkWidget *treeview = thiswindow; |
eb61b854fd58
Fixes for new signal handler code, for GTK 2.x tree control.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
361
diff
changeset
|
9308 |
140
e0e73b4372a6
GTK 2.0 tree control is now fully functional. I just need to check for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
139
diff
changeset
|
9309 thiswindow = (GtkWidget *)gtk_tree_view_get_selection(GTK_TREE_VIEW(thiswindow)); |
e0e73b4372a6
GTK 2.0 tree control is now fully functional. I just need to check for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
139
diff
changeset
|
9310 thisname = "changed"; |
409
1d7be77cbfb5
Implemented signal removal system so it works like OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
407
diff
changeset
|
9311 |
1d7be77cbfb5
Implemented signal removal system so it works like OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
407
diff
changeset
|
9312 sigid = _set_signal_handler(treeview, window, sigfunc, data, thisfunc); |
1d7be77cbfb5
Implemented signal removal system so it works like OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
407
diff
changeset
|
9313 cid = g_signal_connect(G_OBJECT(thiswindow), thisname, (GCallback)thisfunc, (gpointer)sigid); |
422
3269c10bc243
Using GtkTreeSelection instead of GtkTreeView in the signal handler code
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
420
diff
changeset
|
9314 _set_signal_handler_id(treeview, sigid, cid); |
140
e0e73b4372a6
GTK 2.0 tree control is now fully functional. I just need to check for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
139
diff
changeset
|
9315 DW_MUTEX_UNLOCK; |
e0e73b4372a6
GTK 2.0 tree control is now fully functional. I just need to check for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
139
diff
changeset
|
9316 return; |
e0e73b4372a6
GTK 2.0 tree control is now fully functional. I just need to check for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
139
diff
changeset
|
9317 } |
478
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
472
diff
changeset
|
9318 else if(GTK_IS_TREE_VIEW(thiswindow) && strcmp(signame, DW_SIGNAL_TREE_EXPAND) == 0) |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
472
diff
changeset
|
9319 { |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
472
diff
changeset
|
9320 thisname = "row-expanded"; |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
472
diff
changeset
|
9321 } |
140
e0e73b4372a6
GTK 2.0 tree control is now fully functional. I just need to check for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
139
diff
changeset
|
9322 #else |
307
324587c06cea
Use the signal #defines internally so all that is required to change
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
296
diff
changeset
|
9323 else if(GTK_IS_TREE(thiswindow) && strcmp(signame, DW_SIGNAL_ITEM_CONTEXT) == 0) |
54
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
9324 { |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
9325 thisfunc = _findsigfunc("tree-context"); |
409
1d7be77cbfb5
Implemented signal removal system so it works like OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
407
diff
changeset
|
9326 sigid = _set_signal_handler(thiswindow, window, sigfunc, data, thisfunc); |
54
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
9327 |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
9328 gtk_object_set_data(GTK_OBJECT(thiswindow), "_dw_container_context_func", (gpointer)thisfunc); |
409
1d7be77cbfb5
Implemented signal removal system so it works like OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
407
diff
changeset
|
9329 gtk_object_set_data(GTK_OBJECT(thiswindow), "_dw_container_context_data", (gpointer)sigid); |
1d7be77cbfb5
Implemented signal removal system so it works like OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
407
diff
changeset
|
9330 cid = gtk_signal_connect(GTK_OBJECT(thiswindow), "button_press_event", GTK_SIGNAL_FUNC(thisfunc), (gpointer)sigid); |
1d7be77cbfb5
Implemented signal removal system so it works like OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
407
diff
changeset
|
9331 _set_signal_handler_id(thiswindow, sigid, cid); |
1d7be77cbfb5
Implemented signal removal system so it works like OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
407
diff
changeset
|
9332 sigid = _set_signal_handler(window, window, sigfunc, data, thisfunc); |
1d7be77cbfb5
Implemented signal removal system so it works like OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
407
diff
changeset
|
9333 cid = gtk_signal_connect(GTK_OBJECT(window), "button_press_event", GTK_SIGNAL_FUNC(thisfunc), (gpointer)sigid); |
1d7be77cbfb5
Implemented signal removal system so it works like OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
407
diff
changeset
|
9334 _set_signal_handler_id(window, sigid, cid); |
54
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
9335 DW_MUTEX_UNLOCK; |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
9336 return; |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
9337 } |
307
324587c06cea
Use the signal #defines internally so all that is required to change
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
296
diff
changeset
|
9338 else if(GTK_IS_TREE(thiswindow) && strcmp(signame, DW_SIGNAL_ITEM_SELECT) == 0) |
140
e0e73b4372a6
GTK 2.0 tree control is now fully functional. I just need to check for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
139
diff
changeset
|
9339 { |
e0e73b4372a6
GTK 2.0 tree control is now fully functional. I just need to check for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
139
diff
changeset
|
9340 if(thisfunc) |
e0e73b4372a6
GTK 2.0 tree control is now fully functional. I just need to check for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
139
diff
changeset
|
9341 { |
409
1d7be77cbfb5
Implemented signal removal system so it works like OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
407
diff
changeset
|
9342 sigid = _set_signal_handler(thiswindow, window, sigfunc, data, thisfunc); |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
9343 gtk_object_set_data(GTK_OBJECT(thiswindow), "_dw_select_child_func", (gpointer)thisfunc); |
409
1d7be77cbfb5
Implemented signal removal system so it works like OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
407
diff
changeset
|
9344 gtk_object_set_data(GTK_OBJECT(thiswindow), "_dw_select_child_data", (gpointer)sigid); |
140
e0e73b4372a6
GTK 2.0 tree control is now fully functional. I just need to check for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
139
diff
changeset
|
9345 } |
e0e73b4372a6
GTK 2.0 tree control is now fully functional. I just need to check for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
139
diff
changeset
|
9346 thisname = "select-child"; |
e0e73b4372a6
GTK 2.0 tree control is now fully functional. I just need to check for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
139
diff
changeset
|
9347 } |
483
1cb1b87bbd30
Fixes for the Unix file browser... seems to have revealed a problem in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
482
diff
changeset
|
9348 else if(GTK_IS_TREE(thiswindow) && strcmp(signame, DW_SIGNAL_TREE_EXPAND) == 0) |
1cb1b87bbd30
Fixes for the Unix file browser... seems to have revealed a problem in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
482
diff
changeset
|
9349 { |
1cb1b87bbd30
Fixes for the Unix file browser... seems to have revealed a problem in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
482
diff
changeset
|
9350 if(thisfunc) |
1cb1b87bbd30
Fixes for the Unix file browser... seems to have revealed a problem in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
482
diff
changeset
|
9351 { |
1cb1b87bbd30
Fixes for the Unix file browser... seems to have revealed a problem in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
482
diff
changeset
|
9352 sigid = _set_signal_handler(thiswindow, window, sigfunc, data, thisfunc); |
510
710f82598210
Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
508
diff
changeset
|
9353 gtk_object_set_data(GTK_OBJECT(thiswindow), "_dw_tree_item_expand_func", (gpointer)thisfunc); |
710f82598210
Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
508
diff
changeset
|
9354 gtk_object_set_data(GTK_OBJECT(thiswindow), "_dw_tree_item_expand_data", (gpointer)sigid); |
483
1cb1b87bbd30
Fixes for the Unix file browser... seems to have revealed a problem in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
482
diff
changeset
|
9355 } |
1cb1b87bbd30
Fixes for the Unix file browser... seems to have revealed a problem in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
482
diff
changeset
|
9356 DW_MUTEX_UNLOCK; |
1cb1b87bbd30
Fixes for the Unix file browser... seems to have revealed a problem in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
482
diff
changeset
|
9357 return; |
1cb1b87bbd30
Fixes for the Unix file browser... seems to have revealed a problem in
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
482
diff
changeset
|
9358 } |
140
e0e73b4372a6
GTK 2.0 tree control is now fully functional. I just need to check for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
139
diff
changeset
|
9359 #endif |
307
324587c06cea
Use the signal #defines internally so all that is required to change
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
296
diff
changeset
|
9360 else if(GTK_IS_CLIST(thiswindow) && strcmp(signame, DW_SIGNAL_ITEM_ENTER) == 0) |
3 | 9361 { |
409
1d7be77cbfb5
Implemented signal removal system so it works like OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
407
diff
changeset
|
9362 sigid = _set_signal_handler(thiswindow, window, sigfunc, data, _container_enter_event); |
1d7be77cbfb5
Implemented signal removal system so it works like OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
407
diff
changeset
|
9363 cid = gtk_signal_connect(GTK_OBJECT(thiswindow), "key_press_event", GTK_SIGNAL_FUNC(_container_enter_event), (gpointer)sigid); |
1d7be77cbfb5
Implemented signal removal system so it works like OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
407
diff
changeset
|
9364 _set_signal_handler_id(thiswindow, sigid, cid); |
364
aa827971da39
Handle ENTER keypress on the container control. Also make
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
362
diff
changeset
|
9365 |
3 | 9366 thisname = "button_press_event"; |
307
324587c06cea
Use the signal #defines internally so all that is required to change
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
296
diff
changeset
|
9367 thisfunc = _findsigfunc(DW_SIGNAL_ITEM_ENTER); |
324587c06cea
Use the signal #defines internally so all that is required to change
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
296
diff
changeset
|
9368 } |
324587c06cea
Use the signal #defines internally so all that is required to change
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
296
diff
changeset
|
9369 else if(GTK_IS_CLIST(thiswindow) && strcmp(signame, DW_SIGNAL_ITEM_SELECT) == 0) |
164
d35771f70bdd
Allow tree-select to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
163
diff
changeset
|
9370 { |
d35771f70bdd
Allow tree-select to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
163
diff
changeset
|
9371 thisname = "select_row"; |
d35771f70bdd
Allow tree-select to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
163
diff
changeset
|
9372 thisfunc = (void *)_container_select_row; |
d35771f70bdd
Allow tree-select to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
163
diff
changeset
|
9373 } |
307
324587c06cea
Use the signal #defines internally so all that is required to change
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
296
diff
changeset
|
9374 else if(GTK_IS_COMBO(thiswindow) && strcmp(signame, DW_SIGNAL_LIST_SELECT) == 0) |
3 | 9375 { |
9376 thisname = "select_child"; | |
9377 thiswindow = GTK_COMBO(thiswindow)->list; | |
9378 } | |
307
324587c06cea
Use the signal #defines internally so all that is required to change
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
296
diff
changeset
|
9379 else if(GTK_IS_LIST(thiswindow) && strcmp(signame, DW_SIGNAL_LIST_SELECT) == 0) |
3 | 9380 { |
9381 thisname = "select_child"; | |
9382 } | |
307
324587c06cea
Use the signal #defines internally so all that is required to change
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
296
diff
changeset
|
9383 else if(strcmp(signame, DW_SIGNAL_SET_FOCUS) == 0) |
14
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
9384 { |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
9385 thisname = "focus-in-event"; |
39
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
37
diff
changeset
|
9386 if(GTK_IS_COMBO(thiswindow)) |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
37
diff
changeset
|
9387 thiswindow = GTK_COMBO(thiswindow)->entry; |
14
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
9388 } |
307
324587c06cea
Use the signal #defines internally so all that is required to change
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
296
diff
changeset
|
9389 #if 0 |
324587c06cea
Use the signal #defines internally so all that is required to change
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
296
diff
changeset
|
9390 else if(strcmp(signame, DW_SIGNAL_LOSE_FOCUS) == 0) |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
9391 { |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
9392 thisname = "focus-out-event"; |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
9393 if(GTK_IS_COMBO(thiswindow)) |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
9394 thiswindow = GTK_COMBO(thiswindow)->entry; |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
9395 } |
307
324587c06cea
Use the signal #defines internally so all that is required to change
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
296
diff
changeset
|
9396 #endif |
205
b9283fd56d69
Updated scrollbar code on Unix and added dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
202
diff
changeset
|
9397 else if(GTK_IS_VSCALE(thiswindow) || GTK_IS_HSCALE(thiswindow) || |
b9283fd56d69
Updated scrollbar code on Unix and added dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
202
diff
changeset
|
9398 GTK_IS_VSCROLLBAR(thiswindow) || GTK_IS_HSCROLLBAR(thiswindow)) |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
9399 { |
358
526642f70ddd
Prefix all internally used data with _dw_ to avoid conflicts with user
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
357
diff
changeset
|
9400 thiswindow = (GtkWidget *)gtk_object_get_data(GTK_OBJECT(thiswindow), "_dw_adjustment"); |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
9401 } |
331
20def3eaae8d
Implement handling of switch-page signal for notebooks.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
329
diff
changeset
|
9402 else if(GTK_IS_NOTEBOOK(thiswindow) && strcmp(signame, DW_SIGNAL_SWITCH_PAGE) == 0) |
20def3eaae8d
Implement handling of switch-page signal for notebooks.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
329
diff
changeset
|
9403 { |
20def3eaae8d
Implement handling of switch-page signal for notebooks.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
329
diff
changeset
|
9404 thisname = "switch-page"; |
20def3eaae8d
Implement handling of switch-page signal for notebooks.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
329
diff
changeset
|
9405 } |
472
d11be1f40f8c
Add support for column-click signal.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
464
diff
changeset
|
9406 else if(GTK_IS_CLIST(thiswindow) && strcmp(signame, DW_SIGNAL_COLUMN_CLICK) == 0) |
d11be1f40f8c
Add support for column-click signal.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
464
diff
changeset
|
9407 { |
d11be1f40f8c
Add support for column-click signal.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
464
diff
changeset
|
9408 thisname = "click-column"; |
d11be1f40f8c
Add support for column-click signal.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
464
diff
changeset
|
9409 } |
3 | 9410 |
9411 if(!thisfunc || !thiswindow) | |
9412 { | |
9413 DW_MUTEX_UNLOCK; | |
9414 return; | |
9415 } | |
9416 | |
409
1d7be77cbfb5
Implemented signal removal system so it works like OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
407
diff
changeset
|
9417 sigid = _set_signal_handler(thiswindow, window, sigfunc, data, thisfunc); |
1d7be77cbfb5
Implemented signal removal system so it works like OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
407
diff
changeset
|
9418 cid = gtk_signal_connect(GTK_OBJECT(thiswindow), thisname, GTK_SIGNAL_FUNC(thisfunc),(gpointer)sigid); |
1d7be77cbfb5
Implemented signal removal system so it works like OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
407
diff
changeset
|
9419 _set_signal_handler_id(thiswindow, sigid, cid); |
3 | 9420 DW_MUTEX_UNLOCK; |
9421 } | |
9422 | |
9423 /* | |
9424 * Removes callbacks for a given window with given name. | |
9425 * Parameters: | |
9426 * window: Window handle of callback to be removed. | |
9427 */ | |
9428 void dw_signal_disconnect_by_name(HWND window, char *signame) | |
9429 { | |
410
47273b6a8500
Fixes for signal removal. Some limitations still exist... like some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
409
diff
changeset
|
9430 HWND thiswindow; |
47273b6a8500
Fixes for signal removal. Some limitations still exist... like some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
409
diff
changeset
|
9431 int z, count; |
47273b6a8500
Fixes for signal removal. Some limitations still exist... like some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
409
diff
changeset
|
9432 void *thisfunc; |
47273b6a8500
Fixes for signal removal. Some limitations still exist... like some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
409
diff
changeset
|
9433 int _locked_by_me = FALSE; |
47273b6a8500
Fixes for signal removal. Some limitations still exist... like some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
409
diff
changeset
|
9434 |
47273b6a8500
Fixes for signal removal. Some limitations still exist... like some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
409
diff
changeset
|
9435 DW_MUTEX_LOCK; |
47273b6a8500
Fixes for signal removal. Some limitations still exist... like some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
409
diff
changeset
|
9436 thiswindow = _find_signal_window(window, signame); |
47273b6a8500
Fixes for signal removal. Some limitations still exist... like some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
409
diff
changeset
|
9437 count = (int)gtk_object_get_data(GTK_OBJECT(thiswindow), "_dw_sigcounter"); |
47273b6a8500
Fixes for signal removal. Some limitations still exist... like some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
409
diff
changeset
|
9438 thisfunc = _findsigfunc(signame); |
409
1d7be77cbfb5
Implemented signal removal system so it works like OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
407
diff
changeset
|
9439 |
1d7be77cbfb5
Implemented signal removal system so it works like OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
407
diff
changeset
|
9440 for(z=0;z<count;z++) |
1d7be77cbfb5
Implemented signal removal system so it works like OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
407
diff
changeset
|
9441 { |
410
47273b6a8500
Fixes for signal removal. Some limitations still exist... like some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
409
diff
changeset
|
9442 SignalHandler sh = _get_signal_handler(thiswindow, (gpointer)z); |
409
1d7be77cbfb5
Implemented signal removal system so it works like OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
407
diff
changeset
|
9443 |
1d7be77cbfb5
Implemented signal removal system so it works like OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
407
diff
changeset
|
9444 if(sh.intfunc == thisfunc) |
410
47273b6a8500
Fixes for signal removal. Some limitations still exist... like some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
409
diff
changeset
|
9445 _remove_signal_handler(thiswindow, z); |
47273b6a8500
Fixes for signal removal. Some limitations still exist... like some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
409
diff
changeset
|
9446 } |
47273b6a8500
Fixes for signal removal. Some limitations still exist... like some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
409
diff
changeset
|
9447 DW_MUTEX_UNLOCK; |
3 | 9448 } |
9449 | |
9450 /* | |
9451 * Removes all callbacks for a given window. | |
9452 * Parameters: | |
9453 * window: Window handle of callback to be removed. | |
9454 */ | |
9455 void dw_signal_disconnect_by_window(HWND window) | |
9456 { | |
410
47273b6a8500
Fixes for signal removal. Some limitations still exist... like some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
409
diff
changeset
|
9457 HWND thiswindow; |
47273b6a8500
Fixes for signal removal. Some limitations still exist... like some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
409
diff
changeset
|
9458 int z, count; |
47273b6a8500
Fixes for signal removal. Some limitations still exist... like some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
409
diff
changeset
|
9459 int _locked_by_me = FALSE; |
47273b6a8500
Fixes for signal removal. Some limitations still exist... like some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
409
diff
changeset
|
9460 |
47273b6a8500
Fixes for signal removal. Some limitations still exist... like some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
409
diff
changeset
|
9461 DW_MUTEX_LOCK; |
47273b6a8500
Fixes for signal removal. Some limitations still exist... like some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
409
diff
changeset
|
9462 thiswindow = _find_signal_window(window, NULL); |
47273b6a8500
Fixes for signal removal. Some limitations still exist... like some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
409
diff
changeset
|
9463 count = (int)gtk_object_get_data(GTK_OBJECT(thiswindow), "_dw_sigcounter"); |
409
1d7be77cbfb5
Implemented signal removal system so it works like OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
407
diff
changeset
|
9464 |
1d7be77cbfb5
Implemented signal removal system so it works like OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
407
diff
changeset
|
9465 for(z=0;z<count;z++) |
410
47273b6a8500
Fixes for signal removal. Some limitations still exist... like some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
409
diff
changeset
|
9466 _remove_signal_handler(thiswindow, z); |
47273b6a8500
Fixes for signal removal. Some limitations still exist... like some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
409
diff
changeset
|
9467 gtk_object_set_data(GTK_OBJECT(thiswindow), "_dw_sigcounter", NULL); |
47273b6a8500
Fixes for signal removal. Some limitations still exist... like some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
409
diff
changeset
|
9468 DW_MUTEX_UNLOCK; |
3 | 9469 } |
9470 | |
9471 /* | |
9472 * Removes all callbacks for a given window with specified data. | |
9473 * Parameters: | |
9474 * window: Window handle of callback to be removed. | |
9475 * data: Pointer to the data to be compared against. | |
9476 */ | |
9477 void dw_signal_disconnect_by_data(HWND window, void *data) | |
9478 { | |
410
47273b6a8500
Fixes for signal removal. Some limitations still exist... like some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
409
diff
changeset
|
9479 HWND thiswindow; |
47273b6a8500
Fixes for signal removal. Some limitations still exist... like some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
409
diff
changeset
|
9480 int z, count; |
47273b6a8500
Fixes for signal removal. Some limitations still exist... like some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
409
diff
changeset
|
9481 int _locked_by_me = FALSE; |
47273b6a8500
Fixes for signal removal. Some limitations still exist... like some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
409
diff
changeset
|
9482 |
47273b6a8500
Fixes for signal removal. Some limitations still exist... like some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
409
diff
changeset
|
9483 DW_MUTEX_LOCK; |
47273b6a8500
Fixes for signal removal. Some limitations still exist... like some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
409
diff
changeset
|
9484 thiswindow = _find_signal_window(window, NULL); |
47273b6a8500
Fixes for signal removal. Some limitations still exist... like some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
409
diff
changeset
|
9485 count = (int)gtk_object_get_data(GTK_OBJECT(thiswindow), "_dw_sigcounter"); |
409
1d7be77cbfb5
Implemented signal removal system so it works like OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
407
diff
changeset
|
9486 |
1d7be77cbfb5
Implemented signal removal system so it works like OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
407
diff
changeset
|
9487 for(z=0;z<count;z++) |
1d7be77cbfb5
Implemented signal removal system so it works like OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
407
diff
changeset
|
9488 { |
410
47273b6a8500
Fixes for signal removal. Some limitations still exist... like some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
409
diff
changeset
|
9489 SignalHandler sh = _get_signal_handler(thiswindow, (gpointer)z); |
409
1d7be77cbfb5
Implemented signal removal system so it works like OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
407
diff
changeset
|
9490 |
1d7be77cbfb5
Implemented signal removal system so it works like OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
407
diff
changeset
|
9491 if(sh.data == data) |
410
47273b6a8500
Fixes for signal removal. Some limitations still exist... like some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
409
diff
changeset
|
9492 _remove_signal_handler(thiswindow, z); |
47273b6a8500
Fixes for signal removal. Some limitations still exist... like some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
409
diff
changeset
|
9493 } |
47273b6a8500
Fixes for signal removal. Some limitations still exist... like some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
409
diff
changeset
|
9494 DW_MUTEX_UNLOCK; |
47273b6a8500
Fixes for signal removal. Some limitations still exist... like some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
409
diff
changeset
|
9495 } |
47273b6a8500
Fixes for signal removal. Some limitations still exist... like some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
409
diff
changeset
|
9496 |