Mercurial > dwindows
annotate os2/dw.c @ 514:08d770271709
More function name changes for Rexx/DW compatibility.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Fri, 12 Mar 2004 23:47:37 +0000 |
parents | 7755599311d4 |
children | caa7ed17c132 |
rev | line source |
---|---|
3 | 1 /* |
2 * Dynamic Windows: | |
3 * A GTK like implementation of the PM GUI | |
4 * | |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
5 * (C) 2000-2003 Brian Smith <dbsoft@technologist.com> |
3 | 6 * (C) 2000 Achim Hasenmueller <achimha@innotek.de> |
7 * (C) 2000 Peter Nielsen <peter@pmview.com> | |
8 * (C) 1998 Sergey I. Yevtushenko (some code borrowed from cell toolkit) | |
9 * | |
10 */ | |
11 #define INCL_DOS | |
12 #define INCL_DOSERRORS | |
13 #define INCL_WIN | |
14 #define INCL_GPI | |
15 | |
16 #include <os2.h> | |
17 #include <stdlib.h> | |
18 #include <string.h> | |
19 #include <stdio.h> | |
20 #include <stdarg.h> | |
21 #include <stddef.h> | |
22 #include <ctype.h> | |
23 #include <process.h> | |
37
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
24 #include <time.h> |
241
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
25 #include <io.h> |
171
b8e93557b2c7
EMX does not have dirent.h.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
170
diff
changeset
|
26 #ifndef __EMX__ |
170
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
27 #include <direct.h> |
171
b8e93557b2c7
EMX does not have dirent.h.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
170
diff
changeset
|
28 #endif |
475
1547e8c327d9
Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
470
diff
changeset
|
29 #include <sys/time.h> |
3 | 30 #include "dw.h" |
31 | |
32 #define QWP_USER 0 | |
33 | |
37
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
34 MRESULT EXPENTRY _run_event(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2); |
94
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
35 void _do_resize(Box *thisbox, int x, int y); |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
36 void _handle_splitbar_resize(HWND hwnd, float percent, int type, int x, int y); |
365
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
37 int _load_bitmap_file(char *file, HWND handle, HBITMAP *hbm, HDC *hdc, HPS *hps, unsigned long *width, unsigned long *height); |
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
|
38 void _dw_box_pack_start(HWND box, HWND item, int width, int height, int hsize, int vsize, int pad, char *functionname); |
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
|
39 void _dw_box_pack_end(HWND box, HWND item, int width, int height, int hsize, int vsize, int pad, char *functionname); |
468
0a2f13ba2d5c
More menu fixes, free signal handlers and memory on OS/2, and the begining
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
466
diff
changeset
|
40 void _free_menu_data(HWND menu); |
37
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
41 |
3 | 42 char ClassName[] = "dynamicwindows"; |
43 char SplitbarClassName[] = "dwsplitbar"; | |
360
cf66410d03b4
Use 8.Helv as the default font before Warp 4.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
356
diff
changeset
|
44 char *DefaultFont = "9.WarpSans"; |
3 | 45 |
46 HAB dwhab = 0; | |
47 HMQ dwhmq = 0; | |
48 DWTID _dwtid = 0; | |
369
39983df2b93d
Updated the license information, and copyrights. Code to do background
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
368
diff
changeset
|
49 LONG _foreground = 0xAAAAAA, _background = DW_CLR_DEFAULT; |
3 | 50 |
465
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
51 HWND hwndApp = NULLHANDLE, hwndBubble = NULLHANDLE, hwndBubbleLast = NULLHANDLE, hwndEmph = NULLHANDLE; |
497
a7f478e9c20c
No longer use global variables for dw_container_query*() so it can be
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
489
diff
changeset
|
52 PRECORDCORE pCoreEmph = NULL; |
500
fe12a72bfddf
Added a GlobalID which should allow code written on GTK or Windows to work
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
499
diff
changeset
|
53 ULONG aulBuffer[4], GlobalID = 10000; |
190
f4c9fa77136a
A cleaner way of finding the toplevel window.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
185
diff
changeset
|
54 HWND lasthcnr = 0, lastitem = 0, popup = 0, desktop; |
20
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
55 |
224
e6571c4e4d3b
Use the same DW_CLR_* values on all platforms including OS/2... so I
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
220
diff
changeset
|
56 unsigned long _colors[] = { |
e6571c4e4d3b
Use the same DW_CLR_* values on all platforms including OS/2... so I
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
220
diff
changeset
|
57 CLR_BLACK, |
e6571c4e4d3b
Use the same DW_CLR_* values on all platforms including OS/2... so I
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
220
diff
changeset
|
58 CLR_DARKRED, |
e6571c4e4d3b
Use the same DW_CLR_* values on all platforms including OS/2... so I
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
220
diff
changeset
|
59 CLR_DARKGREEN, |
e6571c4e4d3b
Use the same DW_CLR_* values on all platforms including OS/2... so I
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
220
diff
changeset
|
60 CLR_BROWN, |
e6571c4e4d3b
Use the same DW_CLR_* values on all platforms including OS/2... so I
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
220
diff
changeset
|
61 CLR_DARKBLUE, |
e6571c4e4d3b
Use the same DW_CLR_* values on all platforms including OS/2... so I
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
220
diff
changeset
|
62 CLR_DARKPINK, |
e6571c4e4d3b
Use the same DW_CLR_* values on all platforms including OS/2... so I
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
220
diff
changeset
|
63 CLR_DARKCYAN, |
e6571c4e4d3b
Use the same DW_CLR_* values on all platforms including OS/2... so I
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
220
diff
changeset
|
64 CLR_PALEGRAY, |
e6571c4e4d3b
Use the same DW_CLR_* values on all platforms including OS/2... so I
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
220
diff
changeset
|
65 CLR_DARKGRAY, |
e6571c4e4d3b
Use the same DW_CLR_* values on all platforms including OS/2... so I
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
220
diff
changeset
|
66 CLR_RED, |
e6571c4e4d3b
Use the same DW_CLR_* values on all platforms including OS/2... so I
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
220
diff
changeset
|
67 CLR_GREEN, |
e6571c4e4d3b
Use the same DW_CLR_* values on all platforms including OS/2... so I
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
220
diff
changeset
|
68 CLR_YELLOW, |
e6571c4e4d3b
Use the same DW_CLR_* values on all platforms including OS/2... so I
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
220
diff
changeset
|
69 CLR_BLUE, |
e6571c4e4d3b
Use the same DW_CLR_* values on all platforms including OS/2... so I
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
220
diff
changeset
|
70 CLR_PINK, |
e6571c4e4d3b
Use the same DW_CLR_* values on all platforms including OS/2... so I
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
220
diff
changeset
|
71 CLR_CYAN, |
e6571c4e4d3b
Use the same DW_CLR_* values on all platforms including OS/2... so I
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
220
diff
changeset
|
72 CLR_WHITE |
e6571c4e4d3b
Use the same DW_CLR_* values on all platforms including OS/2... so I
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
220
diff
changeset
|
73 }; |
e6571c4e4d3b
Use the same DW_CLR_* values on all platforms including OS/2... so I
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
220
diff
changeset
|
74 |
20
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
75 #define IS_WARP4() (aulBuffer[0] == 20 && aulBuffer[1] >= 40) |
3 | 76 |
77 #ifndef min | |
78 #define min(a, b) (((a < b) ? a : b)) | |
79 #endif | |
80 | |
81 typedef struct _sighandler | |
82 { | |
83 struct _sighandler *next; | |
84 ULONG message; | |
85 HWND window; | |
195
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
86 int id; |
3 | 87 void *signalfunction; |
88 void *data; | |
89 | |
90 } SignalHandler; | |
91 | |
92 SignalHandler *Root = NULL; | |
93 | |
94 typedef struct | |
95 { | |
96 ULONG message; | |
97 char name[30]; | |
98 | |
99 } SignalList; | |
100 | |
101 /* List of signals and their equivilent OS/2 message */ | |
478
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
102 #define SIGNALMAX 16 |
3 | 103 |
104 SignalList SignalTranslate[SIGNALMAX] = { | |
307
324587c06cea
Use the signal #defines internally so all that is required to change
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
306
diff
changeset
|
105 { WM_SIZE, DW_SIGNAL_CONFIGURE }, |
324587c06cea
Use the signal #defines internally so all that is required to change
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
306
diff
changeset
|
106 { WM_CHAR, DW_SIGNAL_KEY_PRESS }, |
324587c06cea
Use the signal #defines internally so all that is required to change
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
306
diff
changeset
|
107 { WM_BUTTON1DOWN, DW_SIGNAL_BUTTON_PRESS }, |
324587c06cea
Use the signal #defines internally so all that is required to change
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
306
diff
changeset
|
108 { WM_BUTTON1UP, DW_SIGNAL_BUTTON_RELEASE }, |
324587c06cea
Use the signal #defines internally so all that is required to change
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
306
diff
changeset
|
109 { WM_MOUSEMOVE, DW_SIGNAL_MOTION_NOTIFY }, |
324587c06cea
Use the signal #defines internally so all that is required to change
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
306
diff
changeset
|
110 { WM_CLOSE, DW_SIGNAL_DELETE }, |
324587c06cea
Use the signal #defines internally so all that is required to change
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
306
diff
changeset
|
111 { WM_PAINT, DW_SIGNAL_EXPOSE }, |
324587c06cea
Use the signal #defines internally so all that is required to change
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
306
diff
changeset
|
112 { WM_COMMAND, DW_SIGNAL_CLICKED }, |
324587c06cea
Use the signal #defines internally so all that is required to change
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
306
diff
changeset
|
113 { CN_ENTER, DW_SIGNAL_ITEM_ENTER }, |
324587c06cea
Use the signal #defines internally so all that is required to change
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
306
diff
changeset
|
114 { CN_CONTEXTMENU, DW_SIGNAL_ITEM_CONTEXT }, |
324587c06cea
Use the signal #defines internally so all that is required to change
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
306
diff
changeset
|
115 { LN_SELECT, DW_SIGNAL_LIST_SELECT }, |
324587c06cea
Use the signal #defines internally so all that is required to change
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
306
diff
changeset
|
116 { CN_EMPHASIS, DW_SIGNAL_ITEM_SELECT }, |
324587c06cea
Use the signal #defines internally so all that is required to change
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
306
diff
changeset
|
117 { WM_SETFOCUS, DW_SIGNAL_SET_FOCUS }, |
346
81fae15885d7
Implemented switch-page on OS/2, and changed the signal prototype to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
342
diff
changeset
|
118 { SLN_SLIDERTRACK, DW_SIGNAL_VALUE_CHANGED }, |
478
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
119 { BKN_PAGESELECTED,DW_SIGNAL_SWITCH_PAGE }, |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
120 { CN_EXPANDTREE, DW_SIGNAL_TREE_EXPAND } |
3 | 121 }; |
122 | |
123 /* This function adds a signal handler callback into the linked list. | |
124 */ | |
195
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
125 void _new_signal(ULONG message, HWND window, int id, void *signalfunction, void *data) |
3 | 126 { |
127 SignalHandler *new = malloc(sizeof(SignalHandler)); | |
128 | |
129 new->message = message; | |
130 new->window = window; | |
195
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
131 new->id = id; |
3 | 132 new->signalfunction = signalfunction; |
133 new->data = data; | |
134 new->next = NULL; | |
135 | |
136 if (!Root) | |
137 Root = new; | |
138 else | |
139 { | |
140 SignalHandler *prev = NULL, *tmp = Root; | |
141 while(tmp) | |
142 { | |
68
8d6100960adf
Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
143 if(tmp->message == message && |
8d6100960adf
Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
144 tmp->window == window && |
465
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
145 tmp->id == id && |
68
8d6100960adf
Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
146 tmp->signalfunction == signalfunction) |
8d6100960adf
Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
147 { |
8d6100960adf
Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
148 tmp->data = data; |
8d6100960adf
Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
149 free(new); |
8d6100960adf
Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
150 return; |
8d6100960adf
Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
151 } |
3 | 152 prev = tmp; |
153 tmp = tmp->next; | |
154 } | |
155 if(prev) | |
156 prev->next = new; | |
157 else | |
158 Root = new; | |
159 } | |
160 } | |
161 | |
162 /* Finds the message number for a given signal name */ | |
163 ULONG _findsigmessage(char *signame) | |
164 { | |
165 int z; | |
166 | |
167 for(z=0;z<SIGNALMAX;z++) | |
168 { | |
169 if(stricmp(signame, SignalTranslate[z].name) == 0) | |
170 return SignalTranslate[z].message; | |
171 } | |
172 return 0L; | |
173 } | |
174 | |
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
|
175 typedef struct _CNRITEM |
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
|
176 { |
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
|
177 MINIRECORDCORE rc; |
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
|
178 HPOINTER hptrIcon; |
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
|
179 PVOID user; |
478
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
180 HTREEITEM 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
|
181 |
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
|
182 } CNRITEM, *PCNRITEM; |
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
|
183 |
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
|
184 |
159
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
185 int _null_key(HWND window, int key, void *data) |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
186 { |
475
1547e8c327d9
Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
470
diff
changeset
|
187 window = window; /* keep compiler happy */ |
1547e8c327d9
Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
470
diff
changeset
|
188 key = key; /* keep compiler happy */ |
1547e8c327d9
Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
470
diff
changeset
|
189 data = data; /* keep compiler happy */ |
159
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
190 return TRUE; |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
191 } |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
192 |
67
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
193 /* Find the desktop window handle */ |
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
194 HWND _toplevel_window(HWND handle) |
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
195 { |
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
196 HWND box, lastbox = WinQueryWindow(handle, QW_PARENT); |
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
197 |
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
198 /* Find the toplevel window */ |
190
f4c9fa77136a
A cleaner way of finding the toplevel window.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
185
diff
changeset
|
199 while((box = WinQueryWindow(lastbox, QW_PARENT)) != desktop && box > 0) |
67
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
200 { |
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
201 lastbox = box; |
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
202 } |
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
203 if(box > 0) |
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
204 return lastbox; |
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
205 return handle; |
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
206 } |
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
207 |
300
4559a2fd2db2
Keypress handler fixes, more need to be done, because I screwed up and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
298
diff
changeset
|
208 |
476
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
209 /* A "safe" WinSendMsg() that tries multiple times in case the |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
210 * queue is blocked for one reason or another. |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
211 */ |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
212 MRESULT _dw_send_msg(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2, int failure) |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
213 { |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
214 MRESULT res; |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
215 int z = 0; |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
216 |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
217 while((int)(res = WinSendMsg(hwnd, msg, mp1, mp2)) == failure) |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
218 { |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
219 z++; |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
220 if(z > 5000000) |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
221 return (MRESULT)failure; |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
222 dw_main_sleep(1); |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
223 } |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
224 return res; |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
225 } |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
226 |
156 | 227 /* Return the entryfield child of a window */ |
228 HWND _find_entryfield(HWND handle) | |
229 { | |
230 HENUM henum; | |
231 HWND child, entry = 0; | |
232 | |
233 henum = WinBeginEnumWindows(handle); | |
234 while((child = WinGetNextWindow(henum)) != NULLHANDLE) | |
235 { | |
236 char tmpbuf[100]; | |
237 | |
238 WinQueryClassName(child, 99, tmpbuf); | |
239 | |
240 if(strncmp(tmpbuf, "#6", 3)==0) /* Entryfield */ | |
241 { | |
242 entry = child; | |
243 break; | |
244 } | |
245 } | |
246 WinEndEnumWindows(henum); | |
247 return entry; | |
248 } | |
249 | |
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
|
250 /* This function changes the owner of buttons in to the |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
251 * dynamicwindows handle to fix a problem in notebooks. |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
252 */ |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
253 void _fix_button_owner(HWND handle, HWND dw) |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
254 { |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
255 HENUM henum; |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
256 HWND child; |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
257 |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
258 henum = WinBeginEnumWindows(handle); |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
259 while((child = WinGetNextWindow(henum)) != NULLHANDLE) |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
260 { |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
261 char tmpbuf[100]; |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
262 |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
263 WinQueryClassName(child, 99, tmpbuf); |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
264 |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
265 if(strncmp(tmpbuf, "#3", 3)==0 && dw) /* Button */ |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
266 WinSetOwner(child, dw); |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
267 else if(strncmp(tmpbuf, "dynamicwindows", 14) == 0) |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
268 dw = child; |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
269 |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
270 _fix_button_owner(child, dw); |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
271 } |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
272 WinEndEnumWindows(henum); |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
273 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
|
274 } |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
275 |
278
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
276 /* Free bitmap data associated with a window */ |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
277 void _free_bitmap(HWND handle) |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
278 { |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
279 HBITMAP hbm = (HBITMAP)dw_window_get_data(handle, "_dw_bitmap"); |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
280 HPS hps = (HPS)dw_window_get_data(handle, "_dw_hps"); |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
281 HDC hdc = (HDC)dw_window_get_data(handle, "_dw_hdc"); |
365
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
282 HPIXMAP pixmap = (HPIXMAP)dw_window_get_data(handle, "_dw_hpixmap"); |
367
f19440c0ff71
Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
366
diff
changeset
|
283 HPIXMAP disable = (HPIXMAP)dw_window_get_data(handle, "_dw_hpixmap_disabled"); |
365
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
284 |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
285 if(pixmap) |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
286 dw_pixmap_destroy(pixmap); |
278
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
287 |
367
f19440c0ff71
Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
366
diff
changeset
|
288 if(disable) |
f19440c0ff71
Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
366
diff
changeset
|
289 dw_pixmap_destroy(disable); |
f19440c0ff71
Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
366
diff
changeset
|
290 |
278
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
291 if(hps) |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
292 { |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
293 GpiSetBitmap(hps, NULLHANDLE); |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
294 GpiAssociate(hps, NULLHANDLE); |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
295 GpiDestroyPS(hps); |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
296 } |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
297 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
298 if(hdc) |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
299 DevCloseDC(hdc); |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
300 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
301 if(hbm) |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
302 GpiDeleteBitmap(hbm); |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
303 } |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
304 |
503
f3ed8dda02f8
Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
500
diff
changeset
|
305 /* This function removes any handlers on windows and frees |
3 | 306 * the user memory allocated to it. |
307 */ | |
308 void _free_window_memory(HWND handle) | |
309 { | |
310 HENUM henum; | |
311 HWND child; | |
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
|
312 void *ptr = (void *)WinQueryWindowPtr(handle, QWP_USER); |
3 | 313 |
314 dw_signal_disconnect_by_window(handle); | |
315 | |
468
0a2f13ba2d5c
More menu fixes, free signal handlers and memory on OS/2, and the begining
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
466
diff
changeset
|
316 if((child = WinWindowFromID(handle, FID_MENU)) != NULLHANDLE) |
0a2f13ba2d5c
More menu fixes, free signal handlers and memory on OS/2, and the begining
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
466
diff
changeset
|
317 _free_menu_data(child); |
0a2f13ba2d5c
More menu fixes, free signal handlers and memory on OS/2, and the begining
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
466
diff
changeset
|
318 |
180
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
319 if((child = WinWindowFromID(handle, FID_CLIENT)) != NULLHANDLE) |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
320 { |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
321 Box *box = (Box *)WinQueryWindowPtr(child, QWP_USER); |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
322 |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
323 if(box) |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
324 { |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
325 if(box->count && box->items) |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
326 free(box->items); |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
327 |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
328 WinSetWindowPtr(child, QWP_USER, 0); |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
329 free(box); |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
330 } |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
331 } |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
332 |
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
|
333 if(ptr) |
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
|
334 { |
169
b2211123274e
Fixed a minor handl leak when destroying conboboxes... the listbox part
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
167
diff
changeset
|
335 WindowData *wd = (WindowData *)ptr; |
180
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
336 char tmpbuf[100]; |
235
69f2a59ec7d0
Delete associated bitmaps when destroying windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
230
diff
changeset
|
337 |
69f2a59ec7d0
Delete associated bitmaps when destroying windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
230
diff
changeset
|
338 /* If this window has an associate bitmap destroy it. */ |
278
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
339 _free_bitmap(handle); |
180
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
340 |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
341 WinQueryClassName(handle, 99, tmpbuf); |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
342 |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
343 if(strncmp(tmpbuf, "#1", 3)==0) |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
344 { |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
345 Box *box = (Box *)ptr; |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
346 |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
347 if(box->count && box->items) |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
348 free(box->items); |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
349 } |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
350 else if(strncmp(tmpbuf, SplitbarClassName, strlen(SplitbarClassName)+1)==0) |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
351 { |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
352 void *data = dw_window_get_data(handle, "_dw_percent"); |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
353 |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
354 if(data) |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
355 free(data); |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
356 } |
290
8ea5b2c35bfe
Fixed tree memory leak on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
289
diff
changeset
|
357 else if(strncmp(tmpbuf, "#37", 4)==0) |
342
4029240b5e63
Fixed a leak of the container's column data when destroying container
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
337
diff
changeset
|
358 { |
290
8ea5b2c35bfe
Fixed tree memory leak on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
289
diff
changeset
|
359 dw_container_clear(handle, FALSE); |
342
4029240b5e63
Fixed a leak of the container's column data when destroying container
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
337
diff
changeset
|
360 if(wd && dw_window_get_data(handle, "_dw_container")) |
4029240b5e63
Fixed a leak of the container's column data when destroying container
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
337
diff
changeset
|
361 { |
4029240b5e63
Fixed a leak of the container's column data when destroying container
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
337
diff
changeset
|
362 void *oldflags = wd->data; |
4029240b5e63
Fixed a leak of the container's column data when destroying container
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
337
diff
changeset
|
363 |
4029240b5e63
Fixed a leak of the container's column data when destroying container
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
337
diff
changeset
|
364 wd->data = NULL; |
4029240b5e63
Fixed a leak of the container's column data when destroying container
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
337
diff
changeset
|
365 free(oldflags); |
4029240b5e63
Fixed a leak of the container's column data when destroying container
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
337
diff
changeset
|
366 } |
4029240b5e63
Fixed a leak of the container's column data when destroying container
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
337
diff
changeset
|
367 } |
169
b2211123274e
Fixed a minor handl leak when destroying conboboxes... the listbox part
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
167
diff
changeset
|
368 |
b2211123274e
Fixed a minor handl leak when destroying conboboxes... the listbox part
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
167
diff
changeset
|
369 if(wd->oldproc) |
b2211123274e
Fixed a minor handl leak when destroying conboboxes... the listbox part
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
167
diff
changeset
|
370 WinSubclassWindow(handle, wd->oldproc); |
b2211123274e
Fixed a minor handl leak when destroying conboboxes... the listbox part
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
167
diff
changeset
|
371 |
90
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
372 dw_window_set_data(handle, 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
|
373 WinSetWindowPtr(handle, QWP_USER, 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
|
374 free(ptr); |
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
|
375 } |
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
|
376 |
3 | 377 henum = WinBeginEnumWindows(handle); |
378 while((child = WinGetNextWindow(henum)) != NULLHANDLE) | |
379 _free_window_memory(child); | |
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
|
380 |
3 | 381 WinEndEnumWindows(henum); |
382 return; | |
383 } | |
384 | |
468
0a2f13ba2d5c
More menu fixes, free signal handlers and memory on OS/2, and the begining
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
466
diff
changeset
|
385 void _free_menu_data(HWND menu) |
0a2f13ba2d5c
More menu fixes, free signal handlers and memory on OS/2, and the begining
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
466
diff
changeset
|
386 { |
470
6ccac112f1e5
Minor formatting changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
468
diff
changeset
|
387 int i, count = (int)WinSendMsg(menu, MM_QUERYITEMCOUNT, 0, 0); |
468
0a2f13ba2d5c
More menu fixes, free signal handlers and memory on OS/2, and the begining
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
466
diff
changeset
|
388 |
0a2f13ba2d5c
More menu fixes, free signal handlers and memory on OS/2, and the begining
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
466
diff
changeset
|
389 dw_signal_disconnect_by_name(menu, DW_SIGNAL_CLICKED); |
0a2f13ba2d5c
More menu fixes, free signal handlers and memory on OS/2, and the begining
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
466
diff
changeset
|
390 _free_window_memory(menu); |
0a2f13ba2d5c
More menu fixes, free signal handlers and memory on OS/2, and the begining
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
466
diff
changeset
|
391 |
0a2f13ba2d5c
More menu fixes, free signal handlers and memory on OS/2, and the begining
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
466
diff
changeset
|
392 for(i=0;i<count;i++) |
0a2f13ba2d5c
More menu fixes, free signal handlers and memory on OS/2, and the begining
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
466
diff
changeset
|
393 { |
0a2f13ba2d5c
More menu fixes, free signal handlers and memory on OS/2, and the begining
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
466
diff
changeset
|
394 SHORT menuid = (SHORT)WinSendMsg(menu, MM_ITEMIDFROMPOSITION, MPFROMSHORT(i), 0); |
470
6ccac112f1e5
Minor formatting changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
468
diff
changeset
|
395 MENUITEM mi; |
468
0a2f13ba2d5c
More menu fixes, free signal handlers and memory on OS/2, and the begining
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
466
diff
changeset
|
396 |
0a2f13ba2d5c
More menu fixes, free signal handlers and memory on OS/2, and the begining
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
466
diff
changeset
|
397 if(WinSendMsg(menu, MM_QUERYITEM, MPFROMSHORT(menuid), MPFROMP(&mi)) |
0a2f13ba2d5c
More menu fixes, free signal handlers and memory on OS/2, and the begining
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
466
diff
changeset
|
398 && mi.hwndSubMenu) |
0a2f13ba2d5c
More menu fixes, free signal handlers and memory on OS/2, and the begining
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
466
diff
changeset
|
399 _free_menu_data(mi.hwndSubMenu); |
0a2f13ba2d5c
More menu fixes, free signal handlers and memory on OS/2, and the begining
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
466
diff
changeset
|
400 } |
0a2f13ba2d5c
More menu fixes, free signal handlers and memory on OS/2, and the begining
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
466
diff
changeset
|
401 } |
0a2f13ba2d5c
More menu fixes, free signal handlers and memory on OS/2, and the begining
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
466
diff
changeset
|
402 |
3 | 403 /* This function returns 1 if the window (widget) handle |
404 * passed to it is a valid window that can gain input focus. | |
405 */ | |
406 int _validate_focus(HWND handle) | |
407 { | |
408 char tmpbuf[100]; | |
409 | |
410 if(!handle) | |
411 return 0; | |
412 | |
159
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
413 if(!WinIsWindowEnabled(handle) || dw_window_get_data(handle, "_dw_disabled")) |
37
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
414 return 0; |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
415 |
3 | 416 WinQueryClassName(handle, 99, tmpbuf); |
417 | |
418 /* These are the window classes which can | |
419 * obtain input focus. | |
420 */ | |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
421 if(strncmp(tmpbuf, "#2", 3)==0 || /* Combobox */ |
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
|
422 strncmp(tmpbuf, "#3", 3)==0 || /* Button */ |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
423 strncmp(tmpbuf, "#6", 3)==0 || /* Entryfield */ |
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
|
424 strncmp(tmpbuf, "#7", 3)==0 || /* List box */ |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
425 strncmp(tmpbuf, "#10", 4)==0 || /* MLE */ |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
426 strncmp(tmpbuf, "#32", 4)==0 || /* Spinbutton */ |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
427 strncmp(tmpbuf, "#37", 4)==0 || /* Container */ |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
428 strncmp(tmpbuf, "#38", 4)== 0) /* Slider */ |
3 | 429 return 1; |
430 return 0; | |
431 } | |
432 | |
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
|
433 int _focus_check_box(Box *box, HWND handle, int start, HWND defaultitem) |
3 | 434 { |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
435 int z, n; |
3 | 436 static HWND lasthwnd, firsthwnd; |
437 static int finish_searching; | |
438 | |
439 /* Start is 2 when we have cycled completely and | |
440 * need to set the focus to the last widget we found | |
441 * that was valid. | |
442 */ | |
443 if(start == 2) | |
444 { | |
445 if(lasthwnd) | |
446 WinSetFocus(HWND_DESKTOP, lasthwnd); | |
447 return 0; | |
448 } | |
449 | |
450 /* Start is 1 when we are entering the function | |
451 * for the first time, it is zero when entering | |
452 * the function recursively. | |
453 */ | |
454 if(start == 1) | |
455 { | |
456 lasthwnd = handle; | |
457 finish_searching = 0; | |
458 firsthwnd = 0; | |
459 } | |
460 | |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
461 for(n=0;n<box->count;n++) |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
462 { |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
463 /* Vertical boxes are inverted on OS/2 */ |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
464 if(box->type == DW_VERT) |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
465 z = n; |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
466 else |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
467 z = box->count - n - 1; |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
468 |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
469 if(box->items[z].type == TYPEBOX) |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
470 { |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
471 Box *thisbox = WinQueryWindowPtr(box->items[z].hwnd, QWP_USER); |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
472 |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
473 if(thisbox && _focus_check_box(thisbox, handle, start == 3 ? 3 : 0, defaultitem)) |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
474 return 1; |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
475 } |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
476 else |
3 | 477 { |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
478 if(box->items[z].hwnd == handle) |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
479 { |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
480 if(lasthwnd == handle && firsthwnd) |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
481 WinSetFocus(HWND_DESKTOP, firsthwnd); |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
482 else if(lasthwnd == handle && !firsthwnd) |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
483 finish_searching = 1; |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
484 else |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
485 WinSetFocus(HWND_DESKTOP, lasthwnd); |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
486 |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
487 /* If we aren't looking for the last handle, |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
488 * return immediately. |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
489 */ |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
490 if(!finish_searching) |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
491 return 1; |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
492 } |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
493 if(_validate_focus(box->items[z].hwnd)) |
3 | 494 { |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
495 /* Start is 3 when we are looking for the |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
496 * first valid item in the layout. |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
497 */ |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
498 if(start == 3) |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
499 { |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
500 if(!defaultitem || (defaultitem && defaultitem == box->items[z].hwnd)) |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
501 { |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
502 WinSetFocus(HWND_DESKTOP, box->items[z].hwnd); |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
503 return 1; |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
504 } |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
505 } |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
506 |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
507 if(!firsthwnd) |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
508 firsthwnd = box->items[z].hwnd; |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
509 |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
510 lasthwnd = box->items[z].hwnd; |
3 | 511 } |
512 else | |
513 { | |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
514 char tmpbuf[100] = ""; |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
515 |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
516 WinQueryClassName(box->items[z].hwnd, 99, tmpbuf); |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
517 if(strncmp(tmpbuf, SplitbarClassName, strlen(SplitbarClassName)+1)==0) |
3 | 518 { |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
519 /* Then try the bottom or right box */ |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
520 HWND mybox = (HWND)dw_window_get_data(box->items[z].hwnd, "_dw_bottomright"); |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
521 |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
522 if(mybox) |
153
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
523 { |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
524 Box *splitbox = (Box *)WinQueryWindowPtr(mybox, QWP_USER); |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
525 |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
526 if(splitbox && _focus_check_box(splitbox, handle, start == 3 ? 3 : 0, defaultitem)) |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
527 return 1; |
153
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
528 } |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
529 |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
530 /* Try the top or left box */ |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
531 mybox = (HWND)dw_window_get_data(box->items[z].hwnd, "_dw_topleft"); |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
532 |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
533 if(mybox) |
3 | 534 { |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
535 Box *splitbox = (Box *)WinQueryWindowPtr(mybox, QWP_USER); |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
536 |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
537 if(splitbox && _focus_check_box(splitbox, handle, start == 3 ? 3 : 0, defaultitem)) |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
538 return 1; |
3 | 539 } |
540 } | |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
541 else if(strncmp(tmpbuf, "#40", 4)==0) /* Notebook */ |
3 | 542 { |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
543 Box *notebox; |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
544 HWND page = (HWND)WinSendMsg(box->items[z].hwnd, BKM_QUERYPAGEWINDOWHWND, |
510
710f82598210
Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
508
diff
changeset
|
545 (MPARAM)dw_notebook_page_get(box->items[z].hwnd), 0); |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
546 |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
547 if(page) |
3 | 548 { |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
549 notebox = (Box *)WinQueryWindowPtr(page, QWP_USER); |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
550 |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
551 if(notebox && _focus_check_box(notebox, handle, start == 3 ? 3 : 0, 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
|
552 return 1; |
3 | 553 } |
554 } | |
555 } | |
556 } | |
557 } | |
558 return 0; | |
559 } | |
560 | |
61
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
561 int _focus_check_box_back(Box *box, HWND handle, int start, HWND defaultitem) |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
562 { |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
563 int z, n; |
61
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
564 static HWND lasthwnd, firsthwnd; |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
565 static int finish_searching; |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
566 |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
567 /* Start is 2 when we have cycled completely and |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
568 * need to set the focus to the last widget we found |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
569 * that was valid. |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
570 */ |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
571 if(start == 2) |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
572 { |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
573 if(lasthwnd) |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
574 WinSetFocus(HWND_DESKTOP, lasthwnd); |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
575 return 0; |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
576 } |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
577 |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
578 /* Start is 1 when we are entering the function |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
579 * for the first time, it is zero when entering |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
580 * the function recursively. |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
581 */ |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
582 if(start == 1) |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
583 { |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
584 lasthwnd = handle; |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
585 finish_searching = 0; |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
586 firsthwnd = 0; |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
587 } |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
588 |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
589 for(n=0;n<box->count;n++) |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
590 { |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
591 /* Vertical boxes are inverted on OS/2 */ |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
592 if(box->type == DW_VERT) |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
593 z = box->count - n - 1; |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
594 else |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
595 z = n; |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
596 |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
597 if(box->items[z].type == TYPEBOX) |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
598 { |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
599 Box *thisbox = WinQueryWindowPtr(box->items[z].hwnd, QWP_USER); |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
600 |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
601 if(thisbox && _focus_check_box_back(thisbox, handle, start == 3 ? 3 : 0, defaultitem)) |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
602 return 1; |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
603 } |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
604 else |
61
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
605 { |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
606 if(box->items[z].hwnd == handle) |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
607 { |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
608 if(lasthwnd == handle && firsthwnd) |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
609 WinSetFocus(HWND_DESKTOP, firsthwnd); |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
610 else if(lasthwnd == handle && !firsthwnd) |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
611 finish_searching = 1; |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
612 else |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
613 WinSetFocus(HWND_DESKTOP, lasthwnd); |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
614 |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
615 /* If we aren't looking for the last handle, |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
616 * return immediately. |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
617 */ |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
618 if(!finish_searching) |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
619 return 1; |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
620 } |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
621 if(_validate_focus(box->items[z].hwnd)) |
61
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
622 { |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
623 /* Start is 3 when we are looking for the |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
624 * first valid item in the layout. |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
625 */ |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
626 if(start == 3) |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
627 { |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
628 if(!defaultitem || (defaultitem && defaultitem == box->items[z].hwnd)) |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
629 { |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
630 WinSetFocus(HWND_DESKTOP, box->items[z].hwnd); |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
631 return 1; |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
632 } |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
633 } |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
634 |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
635 if(!firsthwnd) |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
636 firsthwnd = box->items[z].hwnd; |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
637 |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
638 lasthwnd = box->items[z].hwnd; |
61
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
639 } |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
640 else |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
641 { |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
642 char tmpbuf[100] = ""; |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
643 |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
644 WinQueryClassName(box->items[z].hwnd, 99, tmpbuf); |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
645 if(strncmp(tmpbuf, SplitbarClassName, strlen(SplitbarClassName)+1)==0) |
61
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
646 { |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
647 /* Try the top or left box */ |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
648 HWND mybox = (HWND)dw_window_get_data(box->items[z].hwnd, "_dw_topleft"); |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
649 |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
650 if(mybox) |
61
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
651 { |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
652 Box *splitbox = (Box *)WinQueryWindowPtr(mybox, QWP_USER); |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
653 |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
654 if(splitbox && _focus_check_box_back(splitbox, handle, start == 3 ? 3 : 0, defaultitem)) |
61
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
655 return 1; |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
656 } |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
657 |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
658 /* Then try the bottom or right box */ |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
659 mybox = (HWND)dw_window_get_data(box->items[z].hwnd, "_dw_bottomright"); |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
660 |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
661 if(mybox) |
61
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
662 { |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
663 Box *splitbox = (Box *)WinQueryWindowPtr(mybox, QWP_USER); |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
664 |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
665 if(splitbox && _focus_check_box_back(splitbox, handle, start == 3 ? 3 : 0, defaultitem)) |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
666 return 1; |
61
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
667 } |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
668 } |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
669 else if(strncmp(tmpbuf, "#40", 4)==0) /* Notebook */ |
61
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
670 { |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
671 Box *notebox; |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
672 HWND page = (HWND)WinSendMsg(box->items[z].hwnd, BKM_QUERYPAGEWINDOWHWND, |
510
710f82598210
Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
508
diff
changeset
|
673 (MPARAM)dw_notebook_page_get(box->items[z].hwnd), 0); |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
674 |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
675 if(page) |
61
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
676 { |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
677 notebox = (Box *)WinQueryWindowPtr(page, QWP_USER); |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
678 |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
679 if(notebox && _focus_check_box_back(notebox, handle, start == 3 ? 3 : 0, defaultitem)) |
61
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
680 return 1; |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
681 } |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
682 } |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
683 } |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
684 } |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
685 } |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
686 return 0; |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
687 } |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
688 |
3 | 689 /* This function finds the first widget in the |
690 * layout and moves the current focus to it. | |
691 */ | |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
692 int _initial_focus(HWND handle) |
3 | 693 { |
14
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
694 Box *thisbox = NULL; |
3 | 695 HWND box; |
696 | |
697 box = WinWindowFromID(handle, FID_CLIENT); | |
698 if(box) | |
699 thisbox = WinQueryWindowPtr(box, QWP_USER); | |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
700 else |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
701 return 1; |
3 | 702 |
703 if(thisbox) | |
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
|
704 _focus_check_box(thisbox, handle, 3, thisbox->defaultitem); |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
705 return 0; |
3 | 706 } |
707 | |
708 /* This function finds the current widget in the | |
709 * layout and moves the current focus to the next item. | |
710 */ | |
711 void _shift_focus(HWND handle) | |
712 { | |
713 Box *thisbox; | |
67
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
714 HWND box, lastbox = _toplevel_window(handle); |
3 | 715 |
14
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
716 box = WinWindowFromID(lastbox, FID_CLIENT); |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
717 if(box) |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
718 thisbox = WinQueryWindowPtr(box, QWP_USER); |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
719 else |
14
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
720 thisbox = WinQueryWindowPtr(lastbox, QWP_USER); |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
721 |
3 | 722 if(thisbox) |
723 { | |
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
|
724 if(_focus_check_box(thisbox, handle, 1, 0) == 0) |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
725 _focus_check_box(thisbox, handle, 2, 0); |
3 | 726 } |
727 } | |
728 | |
61
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
729 /* This function finds the current widget in the |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
730 * layout and moves the current focus to the next item. |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
731 */ |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
732 void _shift_focus_back(HWND handle) |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
733 { |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
734 Box *thisbox; |
67
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
735 HWND box, lastbox = _toplevel_window(handle); |
61
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
736 |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
737 box = WinWindowFromID(lastbox, FID_CLIENT); |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
738 if(box) |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
739 thisbox = WinQueryWindowPtr(box, QWP_USER); |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
740 else |
61
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
741 thisbox = WinQueryWindowPtr(lastbox, QWP_USER); |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
742 |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
743 if(thisbox) |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
744 { |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
745 if(_focus_check_box_back(thisbox, handle, 1, 0) == 0) |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
746 _focus_check_box_back(thisbox, handle, 2, 0); |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
747 } |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
748 } |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
749 |
3 | 750 /* This function will recursively search a box and add up the total height of it */ |
751 void _count_size(HWND box, int type, int *xsize, int *xorigsize) | |
752 { | |
753 int size = 0, origsize = 0, z; | |
754 Box *tmp = WinQueryWindowPtr(box, QWP_USER); | |
755 | |
756 if(!tmp) | |
757 { | |
758 *xsize = *xorigsize = 0; | |
759 return; | |
760 } | |
761 | |
762 if(type == tmp->type) | |
763 { | |
764 /* If the box is going in the direction we want, then we | |
765 * return the entire sum of the items. | |
766 */ | |
767 for(z=0;z<tmp->count;z++) | |
768 { | |
769 if(tmp->items[z].type == TYPEBOX) | |
770 { | |
771 int s, os; | |
772 | |
773 _count_size(tmp->items[z].hwnd, type, &s, &os); | |
774 size += s; | |
775 origsize += os; | |
776 } | |
777 else | |
778 { | |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
779 size += (type == DW_HORZ ? tmp->items[z].width : tmp->items[z].height); |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
780 origsize += (type == DW_HORZ ? tmp->items[z].origwidth : tmp->items[z].origheight); |
3 | 781 } |
782 } | |
783 } | |
784 else | |
785 { | |
786 /* If the box is not going in the direction we want, then we only | |
787 * want to return the maximum value. | |
788 */ | |
789 int tmpsize = 0, tmporigsize = 0; | |
790 | |
791 for(z=0;z<tmp->count;z++) | |
792 { | |
793 if(tmp->items[z].type == TYPEBOX) | |
794 _count_size(tmp->items[z].hwnd, type, &tmpsize, &tmporigsize); | |
795 else | |
796 { | |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
797 tmpsize = (type == DW_HORZ ? tmp->items[z].width : tmp->items[z].height); |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
798 tmporigsize = (type == DW_HORZ ? tmp->items[z].origwidth : tmp->items[z].origheight); |
3 | 799 } |
800 | |
801 if(tmpsize > size) | |
802 size = tmpsize; | |
803 } | |
804 } | |
805 | |
806 *xsize = size; | |
807 *xorigsize = origsize; | |
808 } | |
809 | |
810 | |
811 /* Function: TrackRectangle | |
812 * Abstract: Tracks given rectangle. | |
813 * | |
814 * If rclBounds is NULL, then track rectangle on entire desktop. | |
815 * rclTrack is in window coorditates and will be mapped to | |
816 * desktop. | |
817 */ | |
818 | |
819 BOOL _TrackRectangle(HWND hwndBase, RECTL* rclTrack, RECTL* rclBounds) | |
820 { | |
821 TRACKINFO track; | |
822 APIRET rc; | |
823 | |
824 track.cxBorder = 1; | |
825 track.cyBorder = 1; | |
826 track.cxGrid = 1; | |
827 track.cyGrid = 1; | |
828 track.cxKeyboard = 8; | |
829 track.cyKeyboard = 8; | |
830 | |
831 if(!rclTrack) | |
832 return FALSE; | |
833 | |
834 if(rclBounds) | |
835 { | |
836 track.rclBoundary = *rclBounds; | |
837 } | |
838 else | |
839 { | |
840 track.rclBoundary.yTop = | |
841 track.rclBoundary.xRight = 3000; | |
842 track.rclBoundary.yBottom = | |
843 track.rclBoundary.xLeft = -3000; | |
844 } | |
845 | |
846 track.rclTrack = *rclTrack; | |
847 | |
848 WinMapWindowPoints(hwndBase, | |
849 HWND_DESKTOP, | |
850 (PPOINTL)&track.rclTrack, | |
851 2); | |
852 | |
853 track.ptlMinTrackSize.x = track.rclTrack.xRight | |
854 - track.rclTrack.xLeft; | |
855 track.ptlMinTrackSize.y = track.rclTrack.yTop | |
856 - track.rclTrack.yBottom; | |
857 track.ptlMaxTrackSize.x = track.rclTrack.xRight | |
858 - track.rclTrack.xLeft; | |
859 track.ptlMaxTrackSize.y = track.rclTrack.yTop | |
860 - track.rclTrack.yBottom; | |
861 | |
862 track.fs = TF_MOVE | TF_ALLINBOUNDARY; | |
863 | |
864 rc = WinTrackRect(HWND_DESKTOP, 0, &track); | |
865 | |
866 if(rc) | |
867 *rclTrack = track.rclTrack; | |
868 | |
869 return rc; | |
870 } | |
871 | |
94
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
872 void _check_resize_notebook(HWND hwnd) |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
873 { |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
874 char tmpbuf[100]; |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
875 |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
876 WinQueryClassName(hwnd, 99, tmpbuf); |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
877 |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
878 /* If we have a notebook we resize the page again. */ |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
879 if(strncmp(tmpbuf, "#40", 4)==0) |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
880 { |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
881 unsigned long x, y, width, height; |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
882 ULONG page = (ULONG)WinSendMsg(hwnd, BKM_QUERYPAGEID, 0, MPFROM2SHORT(BKA_FIRST, BKA_MAJOR)); |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
883 |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
884 while(page) |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
885 { |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
886 HWND pagehwnd = (HWND)WinSendMsg(hwnd, BKM_QUERYPAGEWINDOWHWND, MPFROMLONG(page), 0); |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
887 RECTL rc; |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
888 |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
889 Box *pagebox = (Box *)WinQueryWindowPtr(pagehwnd, QWP_USER); |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
890 if(pagebox) |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
891 { |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
892 dw_window_get_pos_size(hwnd, &x, &y, &width, &height); |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
893 |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
894 rc.xLeft = x; |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
895 rc.yBottom = y; |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
896 rc.xRight = x + width; |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
897 rc.yTop = y + height; |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
898 |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
899 WinSendMsg(hwnd, BKM_CALCPAGERECT, (MPARAM)&rc, (MPARAM)TRUE); |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
900 |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
901 _do_resize(pagebox, rc.xRight - rc.xLeft, rc.yTop - rc.yBottom); |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
902 } |
129
e47c52b37cdd
Code cleanup and OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
128
diff
changeset
|
903 page = (ULONG)WinSendMsg(hwnd, BKM_QUERYPAGEID, (MPARAM)page, MPFROM2SHORT(BKA_NEXT, BKA_MAJOR)); |
94
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
904 } |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
905 |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
906 } |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
907 } |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
908 |
192
d946e329670c
Added test application for OS/2, and allow dw_color_xxx_set() to use OS/2
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
190
diff
changeset
|
909 /* Return the OS/2 color from the DW color */ |
d946e329670c
Added test application for OS/2, and allow dw_color_xxx_set() to use OS/2
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
190
diff
changeset
|
910 unsigned long _internal_color(unsigned long color) |
d946e329670c
Added test application for OS/2, and allow dw_color_xxx_set() to use OS/2
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
190
diff
changeset
|
911 { |
224
e6571c4e4d3b
Use the same DW_CLR_* values on all platforms including OS/2... so I
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
220
diff
changeset
|
912 if(color < 16) |
e6571c4e4d3b
Use the same DW_CLR_* values on all platforms including OS/2... so I
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
220
diff
changeset
|
913 return _colors[color]; |
192
d946e329670c
Added test application for OS/2, and allow dw_color_xxx_set() to use OS/2
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
190
diff
changeset
|
914 return color; |
d946e329670c
Added test application for OS/2, and allow dw_color_xxx_set() to use OS/2
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
190
diff
changeset
|
915 } |
d946e329670c
Added test application for OS/2, and allow dw_color_xxx_set() to use OS/2
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
190
diff
changeset
|
916 |
3 | 917 /* This function calculates how much space the widgets and boxes require |
918 * and does expansion as necessary. | |
919 */ | |
920 int _resize_box(Box *thisbox, int *depth, int x, int y, int *usedx, int *usedy, | |
921 int pass, int *usedpadx, int *usedpady) | |
922 { | |
923 int z, currentx = 0, currenty = 0; | |
924 int uymax = 0, uxmax = 0; | |
925 int upymax = 0, upxmax = 0; | |
926 /* Used for the SIZEEXPAND */ | |
927 int nux = *usedx, nuy = *usedy; | |
928 int nupx = *usedpadx, nupy = *usedpady; | |
929 | |
930 (*usedx) += (thisbox->pad * 2); | |
931 (*usedy) += (thisbox->pad * 2); | |
932 | |
416
a4197ddfc50d
Changes to calculate groupbox border widths and take this into account
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
408
diff
changeset
|
933 if(thisbox->grouphwnd) |
a4197ddfc50d
Changes to calculate groupbox border widths and take this into account
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
408
diff
changeset
|
934 { |
a4197ddfc50d
Changes to calculate groupbox border widths and take this into account
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
408
diff
changeset
|
935 char *text = dw_window_get_text(thisbox->grouphwnd); |
a4197ddfc50d
Changes to calculate groupbox border widths and take this into account
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
408
diff
changeset
|
936 |
457
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
937 thisbox->grouppady = 0; |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
938 |
416
a4197ddfc50d
Changes to calculate groupbox border widths and take this into account
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
408
diff
changeset
|
939 if(text) |
a4197ddfc50d
Changes to calculate groupbox border widths and take this into account
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
408
diff
changeset
|
940 { |
514
08d770271709
More function name changes for Rexx/DW compatibility.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
513
diff
changeset
|
941 dw_font_text_extents_get(thisbox->grouphwnd, 0, text, NULL, &thisbox->grouppady); |
416
a4197ddfc50d
Changes to calculate groupbox border widths and take this into account
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
408
diff
changeset
|
942 dw_free(text); |
a4197ddfc50d
Changes to calculate groupbox border widths and take this into account
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
408
diff
changeset
|
943 } |
a4197ddfc50d
Changes to calculate groupbox border widths and take this into account
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
408
diff
changeset
|
944 |
457
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
945 if(thisbox->grouppady) |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
946 thisbox->grouppady += 3; |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
947 else |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
948 thisbox->grouppady = 6; |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
949 |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
950 thisbox->grouppadx = 6; |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
951 |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
952 (*usedx) += thisbox->grouppadx; |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
953 (*usedpadx) += thisbox->grouppadx; |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
954 (*usedy) += thisbox->grouppady; |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
955 (*usedpady) += thisbox->grouppady; |
416
a4197ddfc50d
Changes to calculate groupbox border widths and take this into account
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
408
diff
changeset
|
956 } |
a4197ddfc50d
Changes to calculate groupbox border widths and take this into account
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
408
diff
changeset
|
957 |
3 | 958 for(z=0;z<thisbox->count;z++) |
959 { | |
960 if(thisbox->items[z].type == TYPEBOX) | |
961 { | |
962 int initialx, initialy; | |
963 Box *tmp = WinQueryWindowPtr(thisbox->items[z].hwnd, QWP_USER); | |
964 | |
965 initialx = x - (*usedx); | |
966 initialy = y - (*usedy); | |
967 | |
968 if(tmp) | |
969 { | |
970 int newx, newy; | |
971 int nux = *usedx, nuy = *usedy; | |
972 int upx = *usedpadx + (tmp->pad*2), upy = *usedpady + (tmp->pad*2); | |
973 | |
974 /* On the second pass we know how big the box needs to be and how | |
975 * much space we have, so we can calculate a ratio for the new box. | |
976 */ | |
977 if(pass == 2) | |
978 { | |
979 int deep = *depth + 1; | |
980 | |
981 _resize_box(tmp, &deep, x, y, &nux, &nuy, 1, &upx, &upy); | |
982 | |
983 tmp->upx = upx - *usedpadx; | |
984 tmp->upy = upy - *usedpady; | |
985 | |
986 newx = x - nux; | |
987 newy = y - nuy; | |
988 | |
989 tmp->width = thisbox->items[z].width = initialx - newx; | |
990 tmp->height = thisbox->items[z].height = initialy - newy; | |
991 | |
992 tmp->parentxratio = thisbox->xratio; | |
993 tmp->parentyratio = thisbox->yratio; | |
994 | |
995 tmp->parentpad = tmp->pad; | |
996 | |
997 /* Just in case */ | |
998 tmp->xratio = thisbox->xratio; | |
999 tmp->yratio = thisbox->yratio; | |
1000 | |
457
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1001 if(thisbox->type == DW_VERT) |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1002 { |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1003 int tmppad = (thisbox->items[z].pad*2)+(tmp->pad*2)+tmp->grouppady; |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1004 |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1005 if((thisbox->items[z].width - tmppad)!=0) |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1006 tmp->xratio = ((float)((thisbox->items[z].width * thisbox->xratio)-tmppad))/((float)(thisbox->items[z].width-tmppad)); |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1007 } |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1008 else |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1009 { |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1010 if((thisbox->items[z].width-tmp->upx)!=0) |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1011 tmp->xratio = ((float)((thisbox->items[z].width * thisbox->xratio)-tmp->upx))/((float)(thisbox->items[z].width-tmp->upx)); |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1012 } |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1013 if(thisbox->type == DW_HORZ) |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1014 { |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1015 int tmppad = (thisbox->items[z].pad*2)+(tmp->pad*2)+tmp->grouppadx; |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1016 |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1017 if((thisbox->items[z].height-tmppad)!=0) |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1018 tmp->yratio = ((float)((thisbox->items[z].height * thisbox->yratio)-tmppad))/((float)(thisbox->items[z].height-tmppad)); |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1019 } |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1020 else |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1021 { |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1022 if((thisbox->items[z].height-tmp->upy)!=0) |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1023 tmp->yratio = ((float)((thisbox->items[z].height * thisbox->yratio)-tmp->upy))/((float)(thisbox->items[z].height-tmp->upy)); |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1024 } |
3 | 1025 |
1026 nux = *usedx; nuy = *usedy; | |
1027 upx = *usedpadx + (tmp->pad*2); upy = *usedpady + (tmp->pad*2); | |
1028 } | |
1029 | |
1030 (*depth)++; | |
1031 | |
1032 _resize_box(tmp, depth, x, y, &nux, &nuy, pass, &upx, &upy); | |
1033 | |
1034 (*depth)--; | |
1035 | |
1036 newx = x - nux; | |
1037 newy = y - nuy; | |
1038 | |
1039 tmp->minwidth = thisbox->items[z].width = initialx - newx; | |
1040 tmp->minheight = thisbox->items[z].height = initialy - newy; | |
1041 } | |
1042 } | |
1043 | |
1044 if(pass > 1 && *depth > 0) | |
1045 { | |
457
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1046 if(thisbox->type == DW_VERT) |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1047 { |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1048 int tmppad = (thisbox->items[z].pad*2)+(thisbox->parentpad*2)+thisbox->grouppadx; |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1049 |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1050 if((thisbox->minwidth-tmppad) == 0) |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1051 thisbox->items[z].xratio = 1.0; |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1052 else |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1053 thisbox->items[z].xratio = ((float)((thisbox->width * thisbox->parentxratio)-tmppad))/((float)(thisbox->minwidth-tmppad)); |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1054 } |
3 | 1055 else |
457
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1056 { |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1057 if(thisbox->minwidth-thisbox->upx == 0) |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1058 thisbox->items[z].xratio = 1.0; |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1059 else |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1060 thisbox->items[z].xratio = ((float)((thisbox->width * thisbox->parentxratio)-thisbox->upx))/((float)(thisbox->minwidth-thisbox->upx)); |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1061 } |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1062 |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1063 if(thisbox->type == DW_HORZ) |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1064 { |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1065 int tmppad = (thisbox->items[z].pad*2)+(thisbox->parentpad*2)+thisbox->grouppady; |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1066 |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1067 if((thisbox->minheight-tmppad) == 0) |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1068 thisbox->items[z].yratio = 1.0; |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1069 else |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1070 thisbox->items[z].yratio = ((float)((thisbox->height * thisbox->parentyratio)-tmppad))/((float)(thisbox->minheight-tmppad)); |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1071 } |
3 | 1072 else |
457
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1073 { |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1074 if(thisbox->minheight-thisbox->upy == 0) |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1075 thisbox->items[z].yratio = 1.0; |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1076 else |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1077 thisbox->items[z].yratio = ((float)((thisbox->height * thisbox->parentyratio)-thisbox->upy))/((float)(thisbox->minheight-thisbox->upy)); |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1078 } |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
1079 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
1080 if(thisbox->items[z].type == TYPEBOX) |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
1081 { |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
1082 Box *tmp = WinQueryWindowPtr(thisbox->items[z].hwnd, QWP_USER); |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
1083 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
1084 if(tmp) |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
1085 { |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
1086 tmp->parentxratio = thisbox->items[z].xratio; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
1087 tmp->parentyratio = thisbox->items[z].yratio; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
1088 } |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
1089 } |
3 | 1090 } |
1091 else | |
1092 { | |
1093 thisbox->items[z].xratio = thisbox->xratio; | |
1094 thisbox->items[z].yratio = thisbox->yratio; | |
1095 } | |
1096 | |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
1097 if(thisbox->type == DW_VERT) |
3 | 1098 { |
452
cf00d6e2b3cc
Optimizations to the layout engine on OS/2 and Windows, eliminated 3 MUL
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
448
diff
changeset
|
1099 int itemwidth = thisbox->items[z].width + (thisbox->items[z].pad*2); |
cf00d6e2b3cc
Optimizations to the layout engine on OS/2 and Windows, eliminated 3 MUL
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
448
diff
changeset
|
1100 |
cf00d6e2b3cc
Optimizations to the layout engine on OS/2 and Windows, eliminated 3 MUL
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
448
diff
changeset
|
1101 if(itemwidth > uxmax) |
cf00d6e2b3cc
Optimizations to the layout engine on OS/2 and Windows, eliminated 3 MUL
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
448
diff
changeset
|
1102 uxmax = itemwidth; |
3 | 1103 if(thisbox->items[z].hsize != SIZEEXPAND) |
1104 { | |
452
cf00d6e2b3cc
Optimizations to the layout engine on OS/2 and Windows, eliminated 3 MUL
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
448
diff
changeset
|
1105 if(itemwidth > upxmax) |
cf00d6e2b3cc
Optimizations to the layout engine on OS/2 and Windows, eliminated 3 MUL
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
448
diff
changeset
|
1106 upxmax = itemwidth; |
3 | 1107 } |
1108 else | |
1109 { | |
1110 if(thisbox->items[z].pad*2 > upxmax) | |
1111 upxmax = thisbox->items[z].pad*2; | |
1112 } | |
1113 } | |
1114 else | |
1115 { | |
1116 if(thisbox->items[z].width == -1) | |
1117 { | |
1118 /* figure out how much space this item requires */ | |
1119 /* thisbox->items[z].width = */ | |
1120 } | |
1121 else | |
1122 { | |
1123 (*usedx) += thisbox->items[z].width + (thisbox->items[z].pad*2); | |
1124 if(thisbox->items[z].hsize != SIZEEXPAND) | |
1125 (*usedpadx) += (thisbox->items[z].pad*2) + thisbox->items[z].width; | |
1126 else | |
1127 (*usedpadx) += thisbox->items[z].pad*2; | |
1128 } | |
1129 } | |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
1130 if(thisbox->type == DW_HORZ) |
3 | 1131 { |
452
cf00d6e2b3cc
Optimizations to the layout engine on OS/2 and Windows, eliminated 3 MUL
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
448
diff
changeset
|
1132 int itemheight = thisbox->items[z].height + (thisbox->items[z].pad*2); |
cf00d6e2b3cc
Optimizations to the layout engine on OS/2 and Windows, eliminated 3 MUL
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
448
diff
changeset
|
1133 |
cf00d6e2b3cc
Optimizations to the layout engine on OS/2 and Windows, eliminated 3 MUL
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
448
diff
changeset
|
1134 if(itemheight > uymax) |
cf00d6e2b3cc
Optimizations to the layout engine on OS/2 and Windows, eliminated 3 MUL
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
448
diff
changeset
|
1135 uymax = itemheight; |
3 | 1136 if(thisbox->items[z].vsize != SIZEEXPAND) |
1137 { | |
452
cf00d6e2b3cc
Optimizations to the layout engine on OS/2 and Windows, eliminated 3 MUL
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
448
diff
changeset
|
1138 if(itemheight > upymax) |
cf00d6e2b3cc
Optimizations to the layout engine on OS/2 and Windows, eliminated 3 MUL
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
448
diff
changeset
|
1139 upymax = itemheight; |
3 | 1140 } |
1141 else | |
1142 { | |
1143 if(thisbox->items[z].pad*2 > upymax) | |
1144 upymax = thisbox->items[z].pad*2; | |
1145 } | |
1146 } | |
1147 else | |
1148 { | |
1149 if(thisbox->items[z].height == -1) | |
1150 { | |
1151 /* figure out how much space this item requires */ | |
1152 /* thisbox->items[z].height = */ | |
1153 } | |
1154 else | |
1155 { | |
1156 (*usedy) += thisbox->items[z].height + (thisbox->items[z].pad*2); | |
1157 if(thisbox->items[z].vsize != SIZEEXPAND) | |
1158 (*usedpady) += (thisbox->items[z].pad*2) + thisbox->items[z].height; | |
1159 else | |
1160 (*usedpady) += thisbox->items[z].pad*2; | |
1161 } | |
1162 } | |
1163 } | |
1164 | |
1165 (*usedx) += uxmax; | |
1166 (*usedy) += uymax; | |
1167 (*usedpadx) += upxmax; | |
1168 (*usedpady) += upymax; | |
1169 | |
1170 currentx += thisbox->pad; | |
1171 currenty += thisbox->pad; | |
1172 | |
416
a4197ddfc50d
Changes to calculate groupbox border widths and take this into account
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
408
diff
changeset
|
1173 if(thisbox->grouphwnd) |
a4197ddfc50d
Changes to calculate groupbox border widths and take this into account
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
408
diff
changeset
|
1174 { |
a4197ddfc50d
Changes to calculate groupbox border widths and take this into account
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
408
diff
changeset
|
1175 currentx += 3; |
a4197ddfc50d
Changes to calculate groupbox border widths and take this into account
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
408
diff
changeset
|
1176 currenty += 3; |
a4197ddfc50d
Changes to calculate groupbox border widths and take this into account
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
408
diff
changeset
|
1177 } |
a4197ddfc50d
Changes to calculate groupbox border widths and take this into account
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
408
diff
changeset
|
1178 |
3 | 1179 /* The second pass is for expansion and actual placement. */ |
1180 if(pass > 1) | |
1181 { | |
1182 /* Any SIZEEXPAND items should be set to uxmax/uymax */ | |
1183 for(z=0;z<thisbox->count;z++) | |
1184 { | |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
1185 if(thisbox->items[z].hsize == SIZEEXPAND && thisbox->type == DW_VERT) |
3 | 1186 thisbox->items[z].width = uxmax-(thisbox->items[z].pad*2); |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
1187 if(thisbox->items[z].vsize == SIZEEXPAND && thisbox->type == DW_HORZ) |
3 | 1188 thisbox->items[z].height = uymax-(thisbox->items[z].pad*2); |
1189 /* Run this code segment again to finalize the sized after setting uxmax/uymax values. */ | |
1190 if(thisbox->items[z].type == TYPEBOX) | |
1191 { | |
1192 Box *tmp = WinQueryWindowPtr(thisbox->items[z].hwnd, QWP_USER); | |
1193 | |
1194 if(tmp) | |
1195 { | |
1196 if(*depth > 0) | |
1197 { | |
425
4fe2df53ec9f
Division by zero fix in the layout engine.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
418
diff
changeset
|
1198 float calcval; |
4fe2df53ec9f
Division by zero fix in the layout engine.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
418
diff
changeset
|
1199 |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
1200 if(thisbox->type == DW_VERT) |
3 | 1201 { |
425
4fe2df53ec9f
Division by zero fix in the layout engine.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
418
diff
changeset
|
1202 calcval = (float)(tmp->minwidth-((thisbox->items[z].pad*2)+(thisbox->pad*2))); |
4fe2df53ec9f
Division by zero fix in the layout engine.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
418
diff
changeset
|
1203 if(calcval == 0.0) |
4fe2df53ec9f
Division by zero fix in the layout engine.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
418
diff
changeset
|
1204 tmp->xratio = thisbox->xratio; |
4fe2df53ec9f
Division by zero fix in the layout engine.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
418
diff
changeset
|
1205 else |
4fe2df53ec9f
Division by zero fix in the layout engine.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
418
diff
changeset
|
1206 tmp->xratio = ((float)((thisbox->items[z].width * thisbox->xratio)-((thisbox->items[z].pad*2)+(thisbox->pad*2))))/calcval; |
3 | 1207 tmp->width = thisbox->items[z].width; |
1208 } | |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
1209 if(thisbox->type == DW_HORZ) |
3 | 1210 { |
425
4fe2df53ec9f
Division by zero fix in the layout engine.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
418
diff
changeset
|
1211 calcval = (float)(tmp->minheight-((thisbox->items[z].pad*2)+(thisbox->pad*2))); |
4fe2df53ec9f
Division by zero fix in the layout engine.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
418
diff
changeset
|
1212 if(calcval == 0.0) |
4fe2df53ec9f
Division by zero fix in the layout engine.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
418
diff
changeset
|
1213 tmp->yratio = thisbox->yratio; |
4fe2df53ec9f
Division by zero fix in the layout engine.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
418
diff
changeset
|
1214 else |
4fe2df53ec9f
Division by zero fix in the layout engine.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
418
diff
changeset
|
1215 tmp->yratio = ((float)((thisbox->items[z].height * thisbox->yratio)-((thisbox->items[z].pad*2)+(thisbox->pad*2))))/calcval; |
3 | 1216 tmp->height = thisbox->items[z].height; |
1217 } | |
1218 } | |
1219 | |
1220 (*depth)++; | |
1221 | |
1222 _resize_box(tmp, depth, x, y, &nux, &nuy, 3, &nupx, &nupy); | |
1223 | |
1224 (*depth)--; | |
1225 | |
1226 } | |
1227 } | |
1228 } | |
1229 | |
1230 for(z=0;z<(thisbox->count);z++) | |
1231 { | |
1232 int height = thisbox->items[z].height; | |
1233 int width = thisbox->items[z].width; | |
1234 int pad = thisbox->items[z].pad; | |
1235 HWND handle = thisbox->items[z].hwnd; | |
47
997e9ed670ef
Fixes for box alignment problem on OS/2, crash in dw_bitmap_new() on unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
40
diff
changeset
|
1236 int vectorx, vectory; |
3 | 1237 |
1238 /* When upxmax != pad*2 then ratios are incorrect. */ | |
1239 vectorx = (int)((width*thisbox->items[z].xratio)-width); | |
1240 vectory = (int)((height*thisbox->items[z].yratio)-height); | |
1241 | |
1242 if(width > 0 && height > 0) | |
1243 { | |
1244 char tmpbuf[100]; | |
1245 /* This is a hack to fix rounding of the sizing */ | |
1246 if(*depth == 0) | |
1247 { | |
1248 vectorx++; | |
1249 vectory++; | |
1250 } | |
1251 | |
1252 /* If this item isn't going to expand... reset the vectors to 0 */ | |
1253 if(thisbox->items[z].vsize != SIZEEXPAND) | |
1254 vectory = 0; | |
1255 if(thisbox->items[z].hsize != SIZEEXPAND) | |
1256 vectorx = 0; | |
1257 | |
1258 WinQueryClassName(handle, 99, tmpbuf); | |
1259 | |
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
|
1260 if(strncmp(tmpbuf, "#2", 3)==0) |
3 | 1261 { |
405
4c084ec3e176
Ok, so that last fix has some problems, this new fix is a hybrid of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
404
diff
changeset
|
1262 HWND frame = (HWND)dw_window_get_data(handle, "_dw_combo_box"); |
3 | 1263 /* Make the combobox big enough to drop down. :) */ |
405
4c084ec3e176
Ok, so that last fix has some problems, this new fix is a hybrid of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
404
diff
changeset
|
1264 WinSetWindowPos(handle, HWND_TOP, 0, -100, |
4c084ec3e176
Ok, so that last fix has some problems, this new fix is a hybrid of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
404
diff
changeset
|
1265 width + vectorx, (height + vectory) + 100, SWP_MOVE | SWP_SIZE | SWP_ZORDER); |
4c084ec3e176
Ok, so that last fix has some problems, this new fix is a hybrid of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
404
diff
changeset
|
1266 WinSetWindowPos(frame, HWND_TOP, currentx + pad, currenty + pad, |
4c084ec3e176
Ok, so that last fix has some problems, this new fix is a hybrid of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
404
diff
changeset
|
1267 width + vectorx, height + vectory, SWP_MOVE | SWP_SIZE | SWP_ZORDER); |
3 | 1268 } |
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
|
1269 else if(strncmp(tmpbuf, "#6", 3)==0) |
3 | 1270 { |
1271 /* Entryfields on OS/2 have a thick border that isn't on Windows and GTK */ | |
1272 WinSetWindowPos(handle, HWND_TOP, (currentx + pad) + 3, (currenty + pad) + 3, | |
1273 (width + vectorx) - 6, (height + vectory) - 6, SWP_MOVE | SWP_SIZE | SWP_ZORDER); | |
1274 } | |
94
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1275 else if(strncmp(tmpbuf, "#40", 5)==0) |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1276 { |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1277 WinSetWindowPos(handle, HWND_TOP, currentx + pad, currenty + pad, |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1278 width + vectorx, height + vectory, SWP_MOVE | SWP_SIZE | SWP_ZORDER); |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1279 _check_resize_notebook(handle); |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1280 } |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
1281 else if(strncmp(tmpbuf, SplitbarClassName, strlen(SplitbarClassName)+1)==0) |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
1282 { |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
1283 /* Then try the bottom or right box */ |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
1284 float *percent = (float *)dw_window_get_data(handle, "_dw_percent"); |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
1285 int type = (int)dw_window_get_data(handle, "_dw_type"); |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
1286 int cx = width + vectorx; |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
1287 int cy = height + vectory; |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
1288 |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
1289 WinSetWindowPos(handle, HWND_TOP, currentx + pad, currenty + pad, |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
1290 cx, cy, SWP_MOVE | SWP_SIZE | SWP_ZORDER); |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
1291 |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
1292 if(cx > 0 && cy > 0 && percent) |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
1293 _handle_splitbar_resize(handle, *percent, type, cx, cy); |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
1294 } |
3 | 1295 else |
1296 { | |
1297 WinSetWindowPos(handle, HWND_TOP, currentx + pad, currenty + pad, | |
1298 width + vectorx, height + vectory, SWP_MOVE | SWP_SIZE | SWP_ZORDER); | |
1299 if(thisbox->items[z].type == TYPEBOX) | |
1300 { | |
1301 Box *boxinfo = WinQueryWindowPtr(handle, QWP_USER); | |
1302 | |
1303 if(boxinfo && boxinfo->grouphwnd) | |
1304 WinSetWindowPos(boxinfo->grouphwnd, HWND_TOP, 0, 0, | |
47
997e9ed670ef
Fixes for box alignment problem on OS/2, crash in dw_bitmap_new() on unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
40
diff
changeset
|
1305 width + vectorx, height + vectory, SWP_MOVE | SWP_SIZE); |
3 | 1306 |
1307 } | |
1308 | |
1309 } | |
1310 | |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
1311 if(thisbox->type == DW_HORZ) |
3 | 1312 currentx += width + vectorx + (pad * 2); |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
1313 if(thisbox->type == DW_VERT) |
3 | 1314 currenty += height + vectory + (pad * 2); |
1315 } | |
1316 } | |
1317 } | |
1318 return 0; | |
1319 } | |
1320 | |
1321 void _do_resize(Box *thisbox, int x, int y) | |
1322 { | |
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
|
1323 if(x != 0 && y != 0) |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
1324 { |
3 | 1325 if(thisbox) |
1326 { | |
1327 int usedx = 0, usedy = 0, usedpadx = 0, usedpady = 0, depth = 0; | |
1328 | |
1329 _resize_box(thisbox, &depth, x, y, &usedx, &usedy, 1, &usedpadx, &usedpady); | |
1330 | |
1331 if(usedx-usedpadx == 0 || usedy-usedpady == 0) | |
1332 return; | |
1333 | |
1334 thisbox->xratio = ((float)(x-usedpadx))/((float)(usedx-usedpadx)); | |
1335 thisbox->yratio = ((float)(y-usedpady))/((float)(usedy-usedpady)); | |
1336 | |
1337 usedx = usedy = usedpadx = usedpady = depth = 0; | |
1338 | |
1339 _resize_box(thisbox, &depth, x, y, &usedx, &usedy, 2, &usedpadx, &usedpady); | |
1340 } | |
1341 } | |
1342 } | |
1343 | |
1344 /* This procedure handles WM_QUERYTRACKINFO requests from the frame */ | |
1345 MRESULT EXPENTRY _sizeproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2) | |
1346 { | |
1347 PFNWP *blah = WinQueryWindowPtr(hWnd, QWP_USER); | |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1348 Box *thisbox = NULL; |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1349 HWND box; |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1350 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1351 box = WinWindowFromID(hWnd, FID_CLIENT); |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1352 if(box) |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1353 thisbox = WinQueryWindowPtr(box, QWP_USER); |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1354 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1355 if(thisbox && !thisbox->titlebar) |
3 | 1356 { |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1357 switch(msg) |
3 | 1358 { |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1359 case WM_QUERYTRACKINFO: |
3 | 1360 { |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1361 if(blah && *blah) |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1362 { |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1363 PTRACKINFO ptInfo; |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1364 int res; |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1365 PFNWP myfunc = *blah; |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1366 res = (int)myfunc(hWnd, msg, mp1, mp2); |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1367 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1368 ptInfo = (PTRACKINFO)(mp2); |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1369 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1370 ptInfo->ptlMinTrackSize.y = 8; |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1371 ptInfo->ptlMinTrackSize.x = 8; |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1372 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1373 return (MRESULT)res; |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1374 } |
3 | 1375 } |
1376 } | |
1377 } | |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1378 |
3 | 1379 if(blah && *blah) |
1380 { | |
1381 PFNWP myfunc = *blah; | |
1382 return myfunc(hWnd, msg, mp1, mp2); | |
1383 } | |
1384 | |
1385 return WinDefWindowProc(hWnd, msg, mp1, mp2); | |
1386 } | |
33
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1387 |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1388 void _Top(HPS hpsPaint, RECTL rclPaint) |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1389 { |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1390 POINTL ptl1, ptl2; |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1391 |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1392 ptl1.x = rclPaint.xLeft; |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1393 ptl2.y = ptl1.y = rclPaint.yTop - 1; |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1394 ptl2.x = rclPaint.xRight - 1; |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1395 GpiMove(hpsPaint, &ptl1); |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1396 GpiLine(hpsPaint, &ptl2); |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1397 } |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1398 |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1399 /* Left hits the bottom */ |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1400 void _Left(HPS hpsPaint, RECTL rclPaint) |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1401 { |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1402 POINTL ptl1, ptl2; |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1403 |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1404 ptl2.x = ptl1.x = rclPaint.xLeft; |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1405 ptl1.y = rclPaint.yTop - 1; |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1406 ptl2.y = rclPaint.yBottom; |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1407 GpiMove(hpsPaint, &ptl1); |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1408 GpiLine(hpsPaint, &ptl2); |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1409 } |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1410 |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1411 void _Bottom(HPS hpsPaint, RECTL rclPaint) |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1412 { |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1413 POINTL ptl1, ptl2; |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1414 |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1415 ptl1.x = rclPaint.xRight - 1; |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1416 ptl1.y = ptl2.y = rclPaint.yBottom; |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1417 ptl2.x = rclPaint.xLeft; |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1418 GpiMove(hpsPaint, &ptl1); |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1419 GpiLine(hpsPaint, &ptl2); |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1420 } |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1421 |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1422 /* Right hits the top */ |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1423 void _Right(HPS hpsPaint, RECTL rclPaint) |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1424 { |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1425 POINTL ptl1, ptl2; |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1426 |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1427 ptl2.x = ptl1.x = rclPaint.xRight - 1; |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1428 ptl1.y = rclPaint.yBottom + 1; |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1429 ptl2.y = rclPaint.yTop - 1; |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1430 GpiMove(hpsPaint, &ptl1); |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1431 GpiLine(hpsPaint, &ptl2); |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1432 } |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1433 |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1434 /* This procedure handles drawing of a status border */ |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1435 MRESULT EXPENTRY _statusproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2) |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1436 { |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1437 PFNWP *blah = WinQueryWindowPtr(hWnd, QWP_USER); |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1438 |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1439 if(blah && *blah) |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1440 { |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1441 PFNWP myfunc = *blah; |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1442 |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1443 switch(msg) |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1444 { |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1445 case WM_PAINT: |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1446 { |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1447 HPS hpsPaint; |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1448 RECTL rclPaint; |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1449 char buf[1024]; |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1450 |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1451 hpsPaint = WinBeginPaint(hWnd, 0, 0); |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1452 WinQueryWindowRect(hWnd, &rclPaint); |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1453 WinFillRect(hpsPaint, &rclPaint, CLR_PALEGRAY); |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1454 |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1455 GpiSetColor(hpsPaint, CLR_DARKGRAY); |
33
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1456 _Top(hpsPaint, rclPaint); |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1457 _Left(hpsPaint, rclPaint); |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1458 |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1459 GpiSetColor(hpsPaint, CLR_WHITE); |
33
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1460 _Right(hpsPaint, rclPaint); |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1461 _Bottom(hpsPaint, rclPaint); |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1462 |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1463 WinQueryWindowText(hWnd, 1024, buf); |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1464 rclPaint.xLeft += 3; |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1465 rclPaint.xRight--; |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1466 rclPaint.yTop--; |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1467 rclPaint.yBottom++; |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1468 |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1469 GpiSetColor(hpsPaint, CLR_BLACK); |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1470 WinDrawText(hpsPaint, -1, buf, &rclPaint, DT_TEXTATTRS, DT_TEXTATTRS, DT_VCENTER | DT_LEFT | DT_TEXTATTRS); |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1471 WinEndPaint(hpsPaint); |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1472 |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1473 return (MRESULT)TRUE; |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1474 } |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1475 } |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1476 return myfunc(hWnd, msg, mp1, mp2); |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1477 } |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1478 |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1479 return WinDefWindowProc(hWnd, msg, mp1, mp2); |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1480 } |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1481 |
40
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1482 void _click_default(HWND handle) |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1483 { |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1484 char tmpbuf[100]; |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1485 |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1486 WinQueryClassName(handle, 99, tmpbuf); |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1487 |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1488 /* These are the window classes which can |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1489 * obtain input focus. |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1490 */ |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1491 if(strncmp(tmpbuf, "#3", 3)==0) |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1492 { |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1493 /* Generate click on default item */ |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1494 SignalHandler *tmp = Root; |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1495 |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1496 /* Find any callbacks for this function */ |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1497 while(tmp) |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1498 { |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1499 if(tmp->message == WM_COMMAND) |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1500 { |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1501 int (*clickfunc)(HWND, void *) = (int (*)(HWND, void *))tmp->signalfunction; |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1502 |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1503 /* Make sure it's the right window, and the right ID */ |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1504 if(tmp->window == handle) |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1505 { |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1506 clickfunc(tmp->window, tmp->data); |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1507 tmp = NULL; |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1508 } |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1509 } |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1510 if(tmp) |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1511 tmp= tmp->next; |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1512 } |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1513 } |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1514 else |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1515 WinSetFocus(HWND_DESKTOP, handle); |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1516 } |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1517 |
153
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1518 #define ENTRY_CUT 1001 |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1519 #define ENTRY_COPY 1002 |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1520 #define ENTRY_PASTE 1003 |
155
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
154
diff
changeset
|
1521 #define ENTRY_UNDO 1004 |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
154
diff
changeset
|
1522 #define ENTRY_SALL 1005 |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1523 |
3 | 1524 /* Originally just intended for entryfields, it now serves as a generic |
1525 * procedure for handling TAB presses to change input focus on controls. | |
1526 */ | |
1527 MRESULT EXPENTRY _entryproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2) | |
1528 { | |
40
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1529 WindowData *blah = (WindowData *)WinQueryWindowPtr(hWnd, QWP_USER); |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1530 PFNWP oldproc = 0; |
153
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1531 char tmpbuf[100]; |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1532 |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1533 if(blah) |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1534 oldproc = blah->oldproc; |
3 | 1535 |
153
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1536 WinQueryClassName(hWnd, 99, tmpbuf); |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1537 |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1538 /* These are the window classes which should get a menu */ |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1539 if(strncmp(tmpbuf, "#2", 3)==0 || /* Combobox */ |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1540 strncmp(tmpbuf, "#6", 3)==0 || /* Entryfield */ |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1541 strncmp(tmpbuf, "#10", 4)==0 || /* MLE */ |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1542 strncmp(tmpbuf, "#32", 4)==0) /* Spinbutton */ |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1543 { |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1544 switch(msg) |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1545 { |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1546 case WM_CONTEXTMENU: |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1547 { |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1548 HMENUI hwndMenu = dw_menu_new(0L); |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1549 long x, y; |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1550 |
155
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
154
diff
changeset
|
1551 if(strncmp(tmpbuf, "#10", 4)==0 && !WinSendMsg(hWnd, MLM_QUERYREADONLY, 0, 0)) |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
154
diff
changeset
|
1552 { |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
1553 dw_menu_append_item(hwndMenu, "Undo", ENTRY_UNDO, 0L, TRUE, FALSE, 0L); |
155
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
154
diff
changeset
|
1554 dw_menu_append_item(hwndMenu, "", 0L, 0L, TRUE, FALSE, 0L); |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
154
diff
changeset
|
1555 } |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
1556 dw_menu_append_item(hwndMenu, "Copy", ENTRY_COPY, 0L, TRUE, FALSE, 0L); |
159
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
1557 if((strncmp(tmpbuf, "#10", 4)!=0 && !dw_window_get_data(hWnd, "_dw_disabled")) || (strncmp(tmpbuf, "#10", 4)==0 && !WinSendMsg(hWnd, MLM_QUERYREADONLY, 0, 0))) |
153
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1558 { |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
1559 dw_menu_append_item(hwndMenu, "Cut", ENTRY_CUT, 0L, TRUE, FALSE, 0L); |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
1560 dw_menu_append_item(hwndMenu, "Paste", ENTRY_PASTE, 0L, TRUE, FALSE, 0L); |
153
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1561 } |
155
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
154
diff
changeset
|
1562 dw_menu_append_item(hwndMenu, "", 0L, 0L, TRUE, FALSE, 0L); |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
1563 dw_menu_append_item(hwndMenu, "Select All", ENTRY_SALL, 0L, TRUE, FALSE, 0L); |
155
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
154
diff
changeset
|
1564 |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
154
diff
changeset
|
1565 WinSetFocus(HWND_DESKTOP, hWnd); |
153
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1566 dw_pointer_query_pos(&x, &y); |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1567 dw_menu_popup(&hwndMenu, hWnd, x, y); |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1568 } |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1569 break; |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1570 case WM_COMMAND: |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1571 { |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1572 ULONG command = COMMANDMSG(&msg)->cmd; |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1573 |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1574 /* MLE */ |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1575 if(strncmp(tmpbuf, "#10", 4)==0) |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1576 { |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1577 switch(command) |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1578 { |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1579 case ENTRY_CUT: |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1580 return WinSendMsg(hWnd, MLM_CUT, 0, 0); |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1581 case ENTRY_COPY: |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1582 return WinSendMsg(hWnd, MLM_COPY, 0, 0); |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1583 case ENTRY_PASTE: |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1584 return WinSendMsg(hWnd, MLM_PASTE, 0, 0); |
155
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
154
diff
changeset
|
1585 case ENTRY_UNDO: |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
154
diff
changeset
|
1586 return WinSendMsg(hWnd, MLM_UNDO, 0, 0); |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
154
diff
changeset
|
1587 case ENTRY_SALL: |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
154
diff
changeset
|
1588 { |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
154
diff
changeset
|
1589 ULONG len = (ULONG)WinSendMsg(hWnd, MLM_QUERYTEXTLENGTH, 0, 0); |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
154
diff
changeset
|
1590 return WinSendMsg(hWnd, MLM_SETSEL, 0, (MPARAM)len); |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
154
diff
changeset
|
1591 } |
153
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1592 } |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1593 } |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1594 else /* Other */ |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1595 { |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1596 HWND handle = hWnd; |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1597 |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1598 /* Get the entryfield handle from multi window controls */ |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1599 if(strncmp(tmpbuf, "#2", 3)==0) |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1600 handle = WinWindowFromID(hWnd, 667); |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1601 |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1602 if(handle) |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1603 { |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1604 switch(command) |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1605 { |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1606 case ENTRY_CUT: |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1607 return WinSendMsg(handle, EM_CUT, 0, 0); |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1608 case ENTRY_COPY: |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1609 return WinSendMsg(handle, EM_COPY, 0, 0); |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1610 case ENTRY_PASTE: |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1611 return WinSendMsg(handle, EM_PASTE, 0, 0); |
155
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
154
diff
changeset
|
1612 case ENTRY_SALL: |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
154
diff
changeset
|
1613 { |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
154
diff
changeset
|
1614 LONG len = WinQueryWindowTextLength(hWnd); |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
154
diff
changeset
|
1615 return WinSendMsg(hWnd, EM_SETSEL, MPFROM2SHORT(0, (SHORT)len), 0); |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
154
diff
changeset
|
1616 } |
153
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1617 } |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1618 } |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1619 } |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1620 } |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1621 break; |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1622 } |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1623 } |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1624 |
3 | 1625 switch(msg) |
1626 { | |
37
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
1627 case WM_BUTTON1DOWN: |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
1628 case WM_BUTTON2DOWN: |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
1629 case WM_BUTTON3DOWN: |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
1630 { |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1631 if(strncmp(tmpbuf, "#32", 4)==0) |
38
538db2a48bac
Added typecast to MPARAM.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
37
diff
changeset
|
1632 _run_event(hWnd, WM_SETFOCUS, (MPARAM)FALSE, (MPARAM)TRUE); |
37
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
1633 } |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
1634 break; |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1635 case WM_CONTROL: |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1636 { |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1637 if(strncmp(tmpbuf, "#38", 4)==0) |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1638 _run_event(hWnd, msg, mp1, mp2); |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1639 } |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1640 break; |
37
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
1641 case WM_SETFOCUS: |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
1642 _run_event(hWnd, msg, mp1, mp2); |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
1643 break; |
3 | 1644 case WM_CHAR: |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
1645 if(_run_event(hWnd, msg, mp1, mp2) == (MRESULT)TRUE) |
159
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
1646 return (MRESULT)TRUE; |
3 | 1647 if(SHORT1FROMMP(mp2) == '\t') |
1648 { | |
61
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
1649 if(CHARMSG(&msg)->fs & KC_SHIFT) |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
1650 _shift_focus_back(hWnd); |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
1651 else |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
1652 _shift_focus(hWnd); |
3 | 1653 return FALSE; |
1654 } | |
40
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1655 else if(SHORT1FROMMP(mp2) == '\r' && blah && blah->clickdefault) |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1656 _click_default(blah->clickdefault); |
94
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1657 /* When you hit escape we get this value and the |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1658 * window hangs for reasons unknown. (in an MLE) |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1659 */ |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1660 else if(SHORT1FROMMP(mp2) == 283) |
129
e47c52b37cdd
Code cleanup and OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
128
diff
changeset
|
1661 return (MRESULT)TRUE; |
94
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1662 |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1663 break; |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1664 case WM_SIZE: |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1665 { |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1666 /* If it's a slider... make sure it shows the correct value */ |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1667 if(strncmp(tmpbuf, "#38", 4)==0) |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1668 WinPostMsg(hWnd, WM_USER+7, 0, 0); |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1669 } |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1670 break; |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1671 case WM_USER+7: |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1672 { |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1673 int pos = (int)dw_window_get_data(hWnd, "_dw_slider_value"); |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1674 WinSendMsg(hWnd, SLM_SETSLIDERINFO, MPFROM2SHORT(SMA_SLIDERARMPOSITION, SMA_INCREMENTVALUE), (MPARAM)pos); |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1675 } |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1676 break; |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1677 } |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1678 |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1679 if(oldproc) |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1680 return oldproc(hWnd, msg, mp1, mp2); |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1681 |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1682 return WinDefWindowProc(hWnd, msg, mp1, mp2); |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1683 } |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1684 |
153
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1685 /* Deal with combobox specifics and enhancements */ |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1686 MRESULT EXPENTRY _comboentryproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2) |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1687 { |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1688 WindowData *blah = (WindowData *)WinQueryWindowPtr(hWnd, QWP_USER); |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1689 |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1690 switch(msg) |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1691 { |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1692 case WM_CONTEXTMENU: |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1693 case WM_COMMAND: |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1694 return _entryproc(hWnd, msg, mp1, mp2); |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1695 case WM_SETFOCUS: |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1696 _run_event(hWnd, msg, mp1, mp2); |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1697 break; |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1698 case WM_CHAR: |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
1699 if(_run_event(hWnd, msg, mp1, mp2) == (MRESULT)TRUE) |
159
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
1700 return (MRESULT)TRUE; |
153
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1701 /* A Similar problem to the MLE, if ESC just return */ |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1702 if(SHORT1FROMMP(mp2) == 283) |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1703 return (MRESULT)TRUE; |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1704 break; |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1705 } |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1706 |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1707 if(blah && blah->oldproc) |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1708 return blah->oldproc(hWnd, msg, mp1, mp2); |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1709 |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1710 return WinDefWindowProc(hWnd, msg, mp1, mp2); |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1711 } |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1712 |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1713 /* Enhance the standard OS/2 MLE control */ |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1714 MRESULT EXPENTRY _mleproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2) |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1715 { |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1716 switch(msg) |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1717 { |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1718 case WM_VSCROLL: |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1719 if(SHORT2FROMMP(mp2) == SB_SLIDERTRACK) |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1720 { |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1721 USHORT pos = SHORT1FROMMP(mp2); |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1722 |
155
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
154
diff
changeset
|
1723 WinSendMsg(hWnd, msg, mp1, MPFROM2SHORT(pos, SB_SLIDERPOSITION)); |
153
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1724 } |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1725 break; |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1726 } |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1727 return _entryproc(hWnd, msg, mp1, mp2); |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1728 } |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1729 |
156 | 1730 /* Handle special messages for the spinbutton's entryfield */ |
1731 MRESULT EXPENTRY _spinentryproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2) | |
1732 { | |
1733 WindowData *blah = (WindowData *)WinQueryWindowPtr(hWnd, QWP_USER); | |
1734 PFNWP oldproc = 0; | |
1735 | |
1736 if(blah) | |
1737 oldproc = blah->oldproc; | |
1738 | |
1739 switch(msg) | |
1740 { | |
1741 case WM_CONTEXTMENU: | |
1742 case WM_COMMAND: | |
1743 return _entryproc(hWnd, msg, mp1, mp2); | |
1744 } | |
1745 | |
1746 if(oldproc) | |
1747 return oldproc(hWnd, msg, mp1, mp2); | |
1748 | |
1749 return WinDefWindowProc(hWnd, msg, mp1, mp2); | |
1750 } | |
1751 | |
94
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1752 int _dw_int_pos(HWND hwnd) |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1753 { |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1754 int pos = (int)dw_window_get_data(hwnd, "_dw_percent_value"); |
510
710f82598210
Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
508
diff
changeset
|
1755 int range = dw_percent_get_range(hwnd); |
94
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1756 float fpos = (float)pos; |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1757 float frange = (float)range; |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1758 float fnew = (fpos/1000.0)*frange; |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1759 return (int)fnew; |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1760 } |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1761 |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1762 void _dw_int_set(HWND hwnd, int pos) |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1763 { |
510
710f82598210
Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
508
diff
changeset
|
1764 int inew, range = dw_percent_get_range(hwnd); |
116
bb039d7407f0
Fix for floating point crash when trying to calculate new slider/percent
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
108
diff
changeset
|
1765 if(range) |
bb039d7407f0
Fix for floating point crash when trying to calculate new slider/percent
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
108
diff
changeset
|
1766 { |
bb039d7407f0
Fix for floating point crash when trying to calculate new slider/percent
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
108
diff
changeset
|
1767 float fpos = (float)pos; |
bb039d7407f0
Fix for floating point crash when trying to calculate new slider/percent
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
108
diff
changeset
|
1768 float frange = (float)range; |
bb039d7407f0
Fix for floating point crash when trying to calculate new slider/percent
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
108
diff
changeset
|
1769 float fnew = (fpos/frange)*1000.0; |
bb039d7407f0
Fix for floating point crash when trying to calculate new slider/percent
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
108
diff
changeset
|
1770 inew = (int)fnew; |
bb039d7407f0
Fix for floating point crash when trying to calculate new slider/percent
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
108
diff
changeset
|
1771 dw_window_set_data(hwnd, "_dw_percent_value", (void *)inew); |
bb039d7407f0
Fix for floating point crash when trying to calculate new slider/percent
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
108
diff
changeset
|
1772 } |
94
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1773 } |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1774 |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1775 /* Handle size changes in the percent class */ |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1776 MRESULT EXPENTRY _percentproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2) |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1777 { |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1778 WindowData *blah = (WindowData *)WinQueryWindowPtr(hWnd, QWP_USER); |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1779 PFNWP oldproc = 0; |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1780 |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1781 if(blah) |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1782 oldproc = blah->oldproc; |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1783 |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1784 switch(msg) |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1785 { |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1786 case WM_SIZE: |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1787 WinPostMsg(hWnd, WM_USER+7, 0, 0); |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1788 break; |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1789 case WM_USER+7: |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1790 WinSendMsg(hWnd, SLM_SETSLIDERINFO, MPFROM2SHORT(SMA_SLIDERARMPOSITION,SMA_RANGEVALUE), (MPARAM)_dw_int_pos(hWnd)); |
3 | 1791 break; |
1792 } | |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1793 |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1794 if(oldproc) |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1795 return oldproc(hWnd, msg, mp1, mp2); |
3 | 1796 |
1797 return WinDefWindowProc(hWnd, msg, mp1, mp2); | |
1798 } | |
1799 | |
1800 /* Handle correct painting of a combobox with the WS_CLIPCHILDREN | |
1801 * flag enabled, and also handle TABs to switch input focus. | |
1802 */ | |
1803 MRESULT EXPENTRY _comboproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2) | |
1804 { | |
40
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1805 WindowData *blah = WinQueryWindowPtr(hWnd, QWP_USER); |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1806 PFNWP oldproc = 0; |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1807 |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1808 if(blah) |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1809 oldproc = blah->oldproc; |
3 | 1810 |
1811 switch(msg) | |
1812 { | |
1813 case WM_CHAR: | |
1814 if(SHORT1FROMMP(mp2) == '\t') | |
1815 { | |
61
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
1816 if(CHARMSG(&msg)->fs & KC_SHIFT) |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
1817 _shift_focus_back(hWnd); |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
1818 else |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
1819 _shift_focus(hWnd); |
3 | 1820 return FALSE; |
1821 } | |
40
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1822 else if(SHORT1FROMMP(mp2) == '\r' && blah && blah->clickdefault) |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1823 _click_default(blah->clickdefault); |
3 | 1824 break; |
160
76bc6b4e8b79
Don't allow comboboxes to drop down when disabled.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
159
diff
changeset
|
1825 case WM_BUTTON1DBLCLK: |
76bc6b4e8b79
Don't allow comboboxes to drop down when disabled.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
159
diff
changeset
|
1826 case WM_BUTTON2DBLCLK: |
76bc6b4e8b79
Don't allow comboboxes to drop down when disabled.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
159
diff
changeset
|
1827 case WM_BUTTON3DBLCLK: |
76bc6b4e8b79
Don't allow comboboxes to drop down when disabled.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
159
diff
changeset
|
1828 if(dw_window_get_data(hWnd, "_dw_disabled")) |
76bc6b4e8b79
Don't allow comboboxes to drop down when disabled.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
159
diff
changeset
|
1829 return (MRESULT)TRUE; |
76bc6b4e8b79
Don't allow comboboxes to drop down when disabled.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
159
diff
changeset
|
1830 break; |
39
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
1831 case WM_BUTTON1DOWN: |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
1832 case WM_BUTTON2DOWN: |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
1833 case WM_BUTTON3DOWN: |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
1834 if(_run_event(hWnd, msg, mp1, mp2) == (MRESULT)TRUE) |
160
76bc6b4e8b79
Don't allow comboboxes to drop down when disabled.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
159
diff
changeset
|
1835 return (MRESULT)TRUE; |
39
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
1836 _run_event(hWnd, WM_SETFOCUS, (MPARAM)FALSE, (MPARAM)TRUE); |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
1837 break; |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
1838 case WM_SETFOCUS: |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
1839 _run_event(hWnd, msg, mp1, mp2); |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
1840 break; |
3 | 1841 case WM_PAINT: |
1842 { | |
406
765ec42ee2e4
Minor fix, we need to check the parent of the container widget instead of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
405
diff
changeset
|
1843 HWND entry, frame = (HWND)dw_window_get_data(hWnd, "_dw_combo_box"), parent = WinQueryWindow(frame, QW_PARENT); |
3 | 1844 HPS hpsPaint; |
404
720e61df8cf6
An even better combobox drawing fix. Only add 100 pixels to the size of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
399
diff
changeset
|
1845 POINTL ptl; |
377
d8176c73a081
Fixes for drawing of the combobox on OS/2. It now queries the entryfield
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
376
diff
changeset
|
1846 unsigned long width, height, thumbheight = 0; |
d8176c73a081
Fixes for drawing of the combobox on OS/2. It now queries the entryfield
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
376
diff
changeset
|
1847 ULONG color; |
d8176c73a081
Fixes for drawing of the combobox on OS/2. It now queries the entryfield
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
376
diff
changeset
|
1848 |
d8176c73a081
Fixes for drawing of the combobox on OS/2. It now queries the entryfield
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
376
diff
changeset
|
1849 if((entry = (HWND)dw_window_get_data(hWnd, "_dw_comboentry")) != NULLHANDLE) |
d8176c73a081
Fixes for drawing of the combobox on OS/2. It now queries the entryfield
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
376
diff
changeset
|
1850 dw_window_get_pos_size(entry, 0, 0, 0, &thumbheight); |
d8176c73a081
Fixes for drawing of the combobox on OS/2. It now queries the entryfield
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
376
diff
changeset
|
1851 |
d8176c73a081
Fixes for drawing of the combobox on OS/2. It now queries the entryfield
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
376
diff
changeset
|
1852 if(!thumbheight) |
d8176c73a081
Fixes for drawing of the combobox on OS/2. It now queries the entryfield
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
376
diff
changeset
|
1853 thumbheight = WinQuerySysValue(HWND_DESKTOP, SV_CYVSCROLLARROW); |
d8176c73a081
Fixes for drawing of the combobox on OS/2. It now queries the entryfield
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
376
diff
changeset
|
1854 |
404
720e61df8cf6
An even better combobox drawing fix. Only add 100 pixels to the size of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
399
diff
changeset
|
1855 /* Add 6 because it has a thick border like the entryfield */ |
377
d8176c73a081
Fixes for drawing of the combobox on OS/2. It now queries the entryfield
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
376
diff
changeset
|
1856 thumbheight += 6; |
d8176c73a081
Fixes for drawing of the combobox on OS/2. It now queries the entryfield
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
376
diff
changeset
|
1857 |
d8176c73a081
Fixes for drawing of the combobox on OS/2. It now queries the entryfield
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
376
diff
changeset
|
1858 color = (ULONG)dw_window_get_data(parent, "_dw_fore"); |
d8176c73a081
Fixes for drawing of the combobox on OS/2. It now queries the entryfield
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
376
diff
changeset
|
1859 dw_window_get_pos_size(hWnd, 0, 0, &width, &height); |
3 | 1860 |
404
720e61df8cf6
An even better combobox drawing fix. Only add 100 pixels to the size of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
399
diff
changeset
|
1861 if(height > thumbheight) |
720e61df8cf6
An even better combobox drawing fix. Only add 100 pixels to the size of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
399
diff
changeset
|
1862 { |
720e61df8cf6
An even better combobox drawing fix. Only add 100 pixels to the size of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
399
diff
changeset
|
1863 hpsPaint = WinGetPS(hWnd); |
720e61df8cf6
An even better combobox drawing fix. Only add 100 pixels to the size of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
399
diff
changeset
|
1864 if(color) |
720e61df8cf6
An even better combobox drawing fix. Only add 100 pixels to the size of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
399
diff
changeset
|
1865 GpiSetColor(hpsPaint, _internal_color(color-1)); |
720e61df8cf6
An even better combobox drawing fix. Only add 100 pixels to the size of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
399
diff
changeset
|
1866 else |
720e61df8cf6
An even better combobox drawing fix. Only add 100 pixels to the size of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
399
diff
changeset
|
1867 GpiSetColor(hpsPaint, CLR_PALEGRAY); |
720e61df8cf6
An even better combobox drawing fix. Only add 100 pixels to the size of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
399
diff
changeset
|
1868 |
720e61df8cf6
An even better combobox drawing fix. Only add 100 pixels to the size of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
399
diff
changeset
|
1869 ptl.x = ptl.y = 0; |
720e61df8cf6
An even better combobox drawing fix. Only add 100 pixels to the size of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
399
diff
changeset
|
1870 GpiMove(hpsPaint, &ptl); |
720e61df8cf6
An even better combobox drawing fix. Only add 100 pixels to the size of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
399
diff
changeset
|
1871 |
720e61df8cf6
An even better combobox drawing fix. Only add 100 pixels to the size of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
399
diff
changeset
|
1872 ptl.x = width; |
720e61df8cf6
An even better combobox drawing fix. Only add 100 pixels to the size of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
399
diff
changeset
|
1873 ptl.y = height - thumbheight; |
720e61df8cf6
An even better combobox drawing fix. Only add 100 pixels to the size of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
399
diff
changeset
|
1874 GpiBox(hpsPaint, DRO_FILL, &ptl, 0, 0); |
720e61df8cf6
An even better combobox drawing fix. Only add 100 pixels to the size of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
399
diff
changeset
|
1875 |
720e61df8cf6
An even better combobox drawing fix. Only add 100 pixels to the size of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
399
diff
changeset
|
1876 WinReleasePS(hpsPaint); |
720e61df8cf6
An even better combobox drawing fix. Only add 100 pixels to the size of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
399
diff
changeset
|
1877 } |
3 | 1878 } |
1879 break; | |
1880 } | |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1881 if(oldproc) |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1882 return oldproc(hWnd, msg, mp1, mp2); |
3 | 1883 |
1884 return WinDefWindowProc(hWnd, msg, mp1, mp2); | |
1885 } | |
1886 | |
1887 void _GetPPFont(HWND hwnd, char *buff) | |
1888 { | |
1889 ULONG AttrFound; | |
1890 BYTE AttrValue[128]; | |
1891 ULONG cbRetLen; | |
1892 | |
1893 cbRetLen = WinQueryPresParam(hwnd, | |
1894 PP_FONTNAMESIZE, | |
1895 0, | |
1896 &AttrFound, | |
1897 sizeof(AttrValue), | |
1898 &AttrValue, | |
1899 QPF_NOINHERIT); | |
1900 | |
1901 if(PP_FONTNAMESIZE == AttrFound && cbRetLen) | |
1902 { | |
1903 memcpy(buff, AttrValue, cbRetLen); | |
1904 } | |
1905 } | |
1906 | |
1907 /* Returns height of specified window. */ | |
1908 int _get_height(HWND handle) | |
1909 { | |
1910 unsigned long height; | |
1911 dw_window_get_pos_size(handle, NULL, NULL, NULL, &height); | |
1912 return (int)height; | |
1913 } | |
1914 | |
1915 /* Find the height of the frame a desktop style window is sitting on */ | |
1916 int _get_frame_height(HWND handle) | |
1917 { | |
1918 while(handle) | |
1919 { | |
1920 HWND client; | |
1921 if((client = WinWindowFromID(handle, FID_CLIENT)) != NULLHANDLE) | |
1922 { | |
1923 return _get_height(WinQueryWindow(handle, QW_PARENT)); | |
1924 } | |
1925 handle = WinQueryWindow(handle, QW_PARENT); | |
1926 } | |
1927 return dw_screen_height(); | |
1928 } | |
1929 | |
212
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
1930 int _HandleScroller(HWND handle, int pos, int which) |
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
1931 { |
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
1932 MPARAM res; |
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
1933 int min, max, page; |
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
1934 |
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
1935 if(which == SB_SLIDERTRACK) |
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
1936 return pos; |
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
1937 |
510
710f82598210
Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
508
diff
changeset
|
1938 pos = dw_scrollbar_get_pos(handle); |
212
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
1939 res = WinSendMsg(handle, SBM_QUERYRANGE, 0, 0); |
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
1940 |
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
1941 min = SHORT1FROMMP(res); |
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
1942 max = SHORT2FROMMP(res); |
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
1943 page = (int)dw_window_get_data(handle, "_dw_scrollbar_visible"); |
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
1944 |
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
1945 switch(which) |
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
1946 { |
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
1947 case SB_LINEUP: |
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
1948 pos = pos - 1; |
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
1949 if(pos < min) |
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
1950 pos = min; |
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
1951 dw_scrollbar_set_pos(handle, pos); |
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
1952 return pos; |
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
1953 case SB_LINEDOWN: |
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
1954 pos = pos + 1; |
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
1955 if(pos > max) |
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
1956 pos = max; |
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
1957 dw_scrollbar_set_pos(handle, pos); |
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
1958 return pos; |
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
1959 case SB_PAGEUP: |
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
1960 pos = pos - page; |
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
1961 if(pos < min) |
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
1962 pos = min; |
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
1963 dw_scrollbar_set_pos(handle, pos); |
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
1964 return pos; |
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
1965 case SB_PAGEDOWN: |
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
1966 pos = pos + page; |
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
1967 if(pos > max) |
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
1968 pos = max; |
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
1969 dw_scrollbar_set_pos(handle, pos); |
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
1970 return pos; |
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
1971 } |
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
1972 return -1; |
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
1973 } |
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
1974 |
314
41b890c649e7
Fixed a container emphasis problem when no context menus are created.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
311
diff
changeset
|
1975 void _clear_emphasis(void) |
41b890c649e7
Fixed a container emphasis problem when no context menus are created.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
311
diff
changeset
|
1976 { |
315
89eac0990c67
Safer container code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
314
diff
changeset
|
1977 if(hwndEmph && WinIsWindow(dwhab, hwndEmph) && pCoreEmph) |
314
41b890c649e7
Fixed a container emphasis problem when no context menus are created.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
311
diff
changeset
|
1978 WinSendMsg(hwndEmph, CM_SETRECORDEMPHASIS, pCoreEmph, MPFROM2SHORT(FALSE, CRA_SOURCE)); |
41b890c649e7
Fixed a container emphasis problem when no context menus are created.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
311
diff
changeset
|
1979 hwndEmph = NULLHANDLE; |
41b890c649e7
Fixed a container emphasis problem when no context menus are created.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
311
diff
changeset
|
1980 pCoreEmph = NULL; |
41b890c649e7
Fixed a container emphasis problem when no context menus are created.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
311
diff
changeset
|
1981 } |
41b890c649e7
Fixed a container emphasis problem when no context menus are created.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
311
diff
changeset
|
1982 |
465
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
1983 /* Find the desktop window handle */ |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
1984 HWND _menu_owner(HWND handle) |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
1985 { |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
1986 HWND menuowner = NULLHANDLE, lastowner = (HWND)dw_window_get_data(handle, "_dw_owner"); |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
1987 int menubar = (int)dw_window_get_data(handle, "_dw_menubar"); |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
1988 |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
1989 /* Find the toplevel window */ |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
1990 while(!menubar && (menuowner = (HWND)dw_window_get_data(lastowner, "_dw_owner")) != NULLHANDLE) |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
1991 { |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
1992 menubar = (int)dw_window_get_data(lastowner, "_dw_menubar"); |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
1993 lastowner = menuowner; |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
1994 } |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
1995 if(menuowner && menubar) |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
1996 { |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
1997 HWND client = WinWindowFromID(menuowner, FID_CLIENT); |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
1998 |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
1999 return client ? client : menuowner; |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
2000 } |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
2001 return NULLHANDLE; |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
2002 } |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
2003 |
3 | 2004 MRESULT EXPENTRY _run_event(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2) |
2005 { | |
2006 int result = -1; | |
2007 SignalHandler *tmp = Root; | |
2008 ULONG origmsg = msg; | |
2009 | |
2010 if(msg == WM_BUTTON2DOWN || msg == WM_BUTTON3DOWN) | |
2011 msg = WM_BUTTON1DOWN; | |
2012 if(msg == WM_BUTTON2UP || msg == WM_BUTTON3UP) | |
2013 msg = WM_BUTTON1UP; | |
203
e0beea487e8f
Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
199
diff
changeset
|
2014 if(msg == WM_VSCROLL || msg == WM_HSCROLL) |
207
767fca804cea
Fixed scrollbar value_change on OS/2... ID must be set on the scrollbar,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
203
diff
changeset
|
2015 msg = WM_CONTROL; |
3 | 2016 |
2017 /* Find any callbacks for this function */ | |
2018 while(tmp) | |
2019 { | |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
2020 if(tmp->message == msg || msg == WM_CONTROL || tmp->message == WM_USER+1) |
3 | 2021 { |
2022 switch(msg) | |
2023 { | |
14
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
2024 case WM_SETFOCUS: |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
2025 { |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
2026 if((mp2 && tmp->message == WM_SETFOCUS) || (!mp2 && tmp->message == WM_USER+1)) |
14
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
2027 { |
175
d78d08440246
Use _System/_stdcall for callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
174
diff
changeset
|
2028 int (* API setfocusfunc)(HWND, void *) = (int (* API)(HWND, void *))tmp->signalfunction; |
14
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
2029 |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
2030 if(hWnd == tmp->window || WinWindowFromID(tmp->window, FID_CLIENT) == hWnd) |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
2031 { |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
2032 result = setfocusfunc(tmp->window, tmp->data); |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
2033 tmp = NULL; |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
2034 } |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
2035 } |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
2036 } |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
2037 break; |
195
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
2038 case WM_TIMER: |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
2039 { |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
2040 int (* API timerfunc)(void *) = (int (* API)(void *))tmp->signalfunction; |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
2041 if(tmp->id == (int)mp1) |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
2042 { |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
2043 if(!timerfunc(tmp->data)) |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
2044 dw_timer_disconnect(tmp->id); |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
2045 tmp = NULL; |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
2046 } |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
2047 result = 0; |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
2048 } |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
2049 break; |
3 | 2050 case WM_SIZE: |
2051 { | |
175
d78d08440246
Use _System/_stdcall for callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
174
diff
changeset
|
2052 int (* API sizefunc)(HWND, int, int, void *) = (int (* API)(HWND, int, int, void *))tmp->signalfunction; |
3 | 2053 |
276
dfbda83b7cad
Eliminate configure event callbacks when either the width or height is 0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
267
diff
changeset
|
2054 if((hWnd == tmp->window || WinWindowFromID(tmp->window, FID_CLIENT) == hWnd) && SHORT1FROMMP(mp2) && SHORT2FROMMP(mp2)) |
3 | 2055 { |
2056 result = sizefunc(tmp->window, SHORT1FROMMP(mp2), SHORT2FROMMP(mp2), tmp->data); | |
2057 tmp = NULL; | |
2058 } | |
2059 } | |
2060 break; | |
2061 case WM_BUTTON1DOWN: | |
2062 { | |
2063 POINTS pts = (*((POINTS*)&mp1)); | |
175
d78d08440246
Use _System/_stdcall for callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
174
diff
changeset
|
2064 int (* API buttonfunc)(HWND, int, int, int, void *) = (int (* API)(HWND, int, int, int, void *))tmp->signalfunction; |
3 | 2065 |
2066 if(hWnd == tmp->window || WinWindowFromID(tmp->window, FID_CLIENT) == hWnd || WinQueryCapture(HWND_DESKTOP) == tmp->window) | |
2067 { | |
24
d9e87e8bcf1d
Updated dynamic windows to build with EMX.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
23
diff
changeset
|
2068 int button = 0; |
3 | 2069 |
2070 switch(origmsg) | |
2071 { | |
2072 case WM_BUTTON1DOWN: | |
2073 button = 1; | |
2074 break; | |
2075 case WM_BUTTON2DOWN: | |
2076 button = 2; | |
2077 break; | |
2078 case WM_BUTTON3DOWN: | |
2079 button = 3; | |
2080 break; | |
2081 } | |
2082 | |
2083 result = buttonfunc(tmp->window, pts.x, _get_frame_height(tmp->window) - pts.y, button, tmp->data); | |
2084 tmp = NULL; | |
2085 } | |
2086 } | |
2087 break; | |
2088 case WM_BUTTON1UP: | |
2089 { | |
2090 POINTS pts = (*((POINTS*)&mp1)); | |
175
d78d08440246
Use _System/_stdcall for callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
174
diff
changeset
|
2091 int (* API buttonfunc)(HWND, int, int, int, void *) = (int (* API)(HWND, int, int, int, void *))tmp->signalfunction; |
3 | 2092 |
2093 if(hWnd == tmp->window || WinWindowFromID(tmp->window, FID_CLIENT) == hWnd || WinQueryCapture(HWND_DESKTOP) == tmp->window) | |
2094 { | |
24
d9e87e8bcf1d
Updated dynamic windows to build with EMX.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
23
diff
changeset
|
2095 int button = 0; |
3 | 2096 |
2097 switch(origmsg) | |
2098 { | |
2099 case WM_BUTTON1UP: | |
2100 button = 1; | |
2101 break; | |
2102 case WM_BUTTON2UP: | |
2103 button = 2; | |
2104 break; | |
2105 case WM_BUTTON3UP: | |
2106 button = 3; | |
2107 break; | |
2108 } | |
2109 | |
2110 result = buttonfunc(tmp->window, pts.x, WinQueryWindow(tmp->window, QW_PARENT) == HWND_DESKTOP ? dw_screen_height() - pts.y : _get_height(tmp->window) - pts.y, button, tmp->data); | |
2111 tmp = NULL; | |
2112 } | |
2113 } | |
2114 break; | |
2115 case WM_MOUSEMOVE: | |
2116 { | |
175
d78d08440246
Use _System/_stdcall for callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
174
diff
changeset
|
2117 int (* API motionfunc)(HWND, int, int, int, void *) = (int (* API)(HWND, int, int, int, void *))tmp->signalfunction; |
3 | 2118 |
2119 if(hWnd == tmp->window || WinWindowFromID(tmp->window, FID_CLIENT) == hWnd || WinQueryCapture(HWND_DESKTOP) == tmp->window) | |
2120 { | |
2121 int keys = 0; | |
2122 SHORT x = SHORT1FROMMP(mp1), y = SHORT2FROMMP(mp1); | |
2123 | |
2124 if (WinGetKeyState(HWND_DESKTOP, VK_BUTTON1) & 0x8000) | |
2125 keys = DW_BUTTON1_MASK; | |
2126 if (WinGetKeyState(HWND_DESKTOP, VK_BUTTON2) & 0x8000) | |
2127 keys |= DW_BUTTON2_MASK; | |
2128 if (WinGetKeyState(HWND_DESKTOP, VK_BUTTON3) & 0x8000) | |
2129 keys |= DW_BUTTON3_MASK; | |
2130 | |
2131 result = motionfunc(tmp->window, x, _get_frame_height(tmp->window) - y, keys, tmp->data); | |
2132 tmp = NULL; | |
2133 } | |
2134 } | |
2135 break; | |
2136 case WM_CHAR: | |
2137 { | |
267
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
2138 int (* API keypressfunc)(HWND, char, int, int, void *) = (int (* API)(HWND, char, int, int, void *))tmp->signalfunction; |
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
2139 |
300
4559a2fd2db2
Keypress handler fixes, more need to be done, because I screwed up and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
298
diff
changeset
|
2140 if((hWnd == tmp->window || _toplevel_window(hWnd) == tmp->window) && !(SHORT1FROMMP(mp1) & KC_KEYUP)) |
3 | 2141 { |
267
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
2142 int vk; |
293
315812516608
Changes to the key press handling, if the character is zero check the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
290
diff
changeset
|
2143 char ch = 0; |
267
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
2144 |
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
2145 if(SHORT1FROMMP(mp1) & KC_CHAR) |
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
2146 ch = (char)SHORT1FROMMP(mp2); |
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
2147 if(SHORT1FROMMP(mp1) & KC_VIRTUALKEY) |
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
2148 vk = SHORT2FROMMP(mp2); |
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
2149 else |
300
4559a2fd2db2
Keypress handler fixes, more need to be done, because I screwed up and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
298
diff
changeset
|
2150 vk = SHORT1FROMMP(mp2) + 128; |
267
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
2151 |
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
2152 /* This is a hack to fix shift presses showing |
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
2153 * up as tabs! |
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
2154 */ |
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
2155 if(ch == '\t' && !(SHORT1FROMMP(mp1) & KC_CHAR)) |
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
2156 { |
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
2157 ch = 0; |
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
2158 vk = VK_SHIFT; |
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
2159 } |
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
2160 |
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
2161 result = keypressfunc(tmp->window, ch, vk, |
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
2162 SHORT1FROMMP(mp1) & (KC_ALT | KC_SHIFT | KC_CTRL), tmp->data); |
3 | 2163 tmp = NULL; |
2164 } | |
2165 } | |
2166 break; | |
2167 case WM_CLOSE: | |
2168 { | |
175
d78d08440246
Use _System/_stdcall for callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
174
diff
changeset
|
2169 int (* API closefunc)(HWND, void *) = (int (* API)(HWND, void *))tmp->signalfunction; |
3 | 2170 |
2171 if(hWnd == tmp->window || hWnd == WinWindowFromID(tmp->window, FID_CLIENT)) | |
2172 { | |
2173 result = closefunc(tmp->window, tmp->data); | |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
2174 if(result) |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
2175 result = FALSE; |
3 | 2176 tmp = NULL; |
2177 } | |
2178 } | |
2179 break; | |
2180 case WM_PAINT: | |
2181 { | |
2182 HPS hps; | |
2183 DWExpose exp; | |
175
d78d08440246
Use _System/_stdcall for callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
174
diff
changeset
|
2184 int (* API exposefunc)(HWND, DWExpose *, void *) = (int (* API)(HWND, DWExpose *, void *))tmp->signalfunction; |
3 | 2185 RECTL rc; |
2186 | |
2187 if(hWnd == tmp->window) | |
2188 { | |
2189 int height = _get_height(hWnd); | |
2190 | |
2191 hps = WinBeginPaint(hWnd, 0L, &rc); | |
2192 exp.x = rc.xLeft; | |
2193 exp.y = height - rc.yTop - 1; | |
2194 exp.width = rc.xRight - rc. xLeft; | |
2195 exp.height = rc.yTop - rc.yBottom; | |
2196 result = exposefunc(hWnd, &exp, tmp->data); | |
2197 WinEndPaint(hps); | |
2198 } | |
2199 } | |
2200 break; | |
2201 case WM_COMMAND: | |
2202 { | |
175
d78d08440246
Use _System/_stdcall for callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
174
diff
changeset
|
2203 int (* API clickfunc)(HWND, void *) = (int (* API)(HWND, void *))tmp->signalfunction; |
3 | 2204 ULONG command = COMMANDMSG(&msg)->cmd; |
2205 | |
466
c3dfa117b080
Added new code to make the menu handlers window local instead of global.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
465
diff
changeset
|
2206 if(tmp->id && command == tmp->id) |
465
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
2207 { |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
2208 HWND menuowner = _menu_owner(tmp->window); |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
2209 |
466
c3dfa117b080
Added new code to make the menu handlers window local instead of global.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
465
diff
changeset
|
2210 if(menuowner == hWnd || menuowner == NULLHANDLE) |
465
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
2211 { |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
2212 result = clickfunc(tmp->window, tmp->data); |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
2213 tmp = NULL; |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
2214 } |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
2215 } |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
2216 else if(tmp->window < 65536 && command == tmp->window) |
3 | 2217 { |
93
98cce029a611
Changed handling of menu item click events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
90
diff
changeset
|
2218 result = clickfunc(popup ? popup : tmp->window, tmp->data); |
3 | 2219 tmp = NULL; |
2220 } | |
2221 } | |
2222 break; | |
2223 case WM_CONTROL: | |
207
767fca804cea
Fixed scrollbar value_change on OS/2... ID must be set on the scrollbar,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
203
diff
changeset
|
2224 if(origmsg == WM_VSCROLL || origmsg == WM_HSCROLL || tmp->message == SHORT2FROMMP(mp1) || |
767fca804cea
Fixed scrollbar value_change on OS/2... ID must be set on the scrollbar,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
203
diff
changeset
|
2225 (tmp->message == SLN_SLIDERTRACK && SHORT2FROMMP(mp1) == SLN_CHANGE)) |
3 | 2226 { |
207
767fca804cea
Fixed scrollbar value_change on OS/2... ID must be set on the scrollbar,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
203
diff
changeset
|
2227 int svar = SLN_SLIDERTRACK; |
767fca804cea
Fixed scrollbar value_change on OS/2... ID must be set on the scrollbar,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
203
diff
changeset
|
2228 if(origmsg == WM_CONTROL) |
767fca804cea
Fixed scrollbar value_change on OS/2... ID must be set on the scrollbar,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
203
diff
changeset
|
2229 svar = SHORT2FROMMP(mp1); |
767fca804cea
Fixed scrollbar value_change on OS/2... ID must be set on the scrollbar,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
203
diff
changeset
|
2230 |
767fca804cea
Fixed scrollbar value_change on OS/2... ID must be set on the scrollbar,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
203
diff
changeset
|
2231 switch(svar) |
3 | 2232 { |
2233 case CN_ENTER: | |
2234 { | |
175
d78d08440246
Use _System/_stdcall for callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
174
diff
changeset
|
2235 int (* API containerselectfunc)(HWND, char *, void *) = (int (* API)(HWND, char *, void *))tmp->signalfunction; |
3 | 2236 int id = SHORT1FROMMP(mp1); |
2237 HWND conthwnd = dw_window_from_id(hWnd, id); | |
2238 char *text = NULL; | |
2239 | |
2240 if(mp2) | |
2241 { | |
2242 PRECORDCORE pre; | |
2243 | |
2244 pre = ((PNOTIFYRECORDENTER)mp2)->pRecord; | |
2245 if(pre) | |
2246 text = pre->pszIcon; | |
2247 } | |
2248 | |
2249 if(tmp->window == conthwnd) | |
2250 { | |
2251 result = containerselectfunc(tmp->window, text, tmp->data); | |
2252 tmp = NULL; | |
2253 } | |
2254 } | |
2255 break; | |
478
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
2256 case CN_EXPANDTREE: |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
2257 { |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
2258 int (* API treeexpandfunc)(HWND, HTREEITEM, void *) = (int (* API)(HWND, HTREEITEM, void *))tmp->signalfunction; |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
2259 int id = SHORT1FROMMP(mp1); |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
2260 HWND conthwnd = dw_window_from_id(hWnd, id); |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
2261 |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
2262 if(tmp->window == conthwnd) |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
2263 { |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
2264 result = treeexpandfunc(tmp->window, (HTREEITEM)mp2, tmp->data); |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
2265 tmp = NULL; |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
2266 } |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
2267 } |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
2268 break; |
3 | 2269 case CN_CONTEXTMENU: |
2270 { | |
175
d78d08440246
Use _System/_stdcall for callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
174
diff
changeset
|
2271 int (* API containercontextfunc)(HWND, char *, int, int, void *, void *) = (int (* API)(HWND, char *, int, int, void *, void *))tmp->signalfunction; |
3 | 2272 int id = SHORT1FROMMP(mp1); |
2273 HWND conthwnd = dw_window_from_id(hWnd, id); | |
2274 char *text = 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
|
2275 void *user = NULL; |
3 | 2276 LONG x,y; |
2277 | |
2278 if(mp2) | |
2279 { | |
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
|
2280 PCNRITEM pci; |
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
|
2281 |
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
|
2282 pci = (PCNRITEM)mp2; |
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
|
2283 |
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
|
2284 text = pci->rc.pszIcon; |
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
|
2285 user = pci->user; |
3 | 2286 } |
2287 | |
2288 dw_pointer_query_pos(&x, &y); | |
2289 | |
2290 if(tmp->window == conthwnd) | |
2291 { | |
183
b5a92b04b298
Minor change to handling of right clicks in the container control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
182
diff
changeset
|
2292 int container = (int)dw_window_get_data(tmp->window, "_dw_container"); |
b5a92b04b298
Minor change to handling of right clicks in the container control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
182
diff
changeset
|
2293 |
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
|
2294 if(mp2) |
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
|
2295 { |
183
b5a92b04b298
Minor change to handling of right clicks in the container control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
182
diff
changeset
|
2296 if(!container) |
b5a92b04b298
Minor change to handling of right clicks in the container control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
182
diff
changeset
|
2297 { |
b5a92b04b298
Minor change to handling of right clicks in the container control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
182
diff
changeset
|
2298 NOTIFYRECORDEMPHASIS pre; |
b5a92b04b298
Minor change to handling of right clicks in the container control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
182
diff
changeset
|
2299 |
328
e00aff2b899e
Tree item handles are now of the type HTREEITEM instead of HWND since they
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
326
diff
changeset
|
2300 dw_tree_item_select(tmp->window, (HTREEITEM)mp2); |
183
b5a92b04b298
Minor change to handling of right clicks in the container control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
182
diff
changeset
|
2301 pre.pRecord = mp2; |
b5a92b04b298
Minor change to handling of right clicks in the container control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
182
diff
changeset
|
2302 pre.fEmphasisMask = CRA_CURSORED; |
b5a92b04b298
Minor change to handling of right clicks in the container control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
182
diff
changeset
|
2303 pre.hwndCnr = tmp->window; |
b5a92b04b298
Minor change to handling of right clicks in the container control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
182
diff
changeset
|
2304 _run_event(hWnd, WM_CONTROL, MPFROM2SHORT(0, CN_EMPHASIS), (MPARAM)&pre); |
b5a92b04b298
Minor change to handling of right clicks in the container control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
182
diff
changeset
|
2305 pre.pRecord->flRecordAttr |= CRA_CURSORED; |
b5a92b04b298
Minor change to handling of right clicks in the container control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
182
diff
changeset
|
2306 } |
b5a92b04b298
Minor change to handling of right clicks in the container control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
182
diff
changeset
|
2307 else |
b5a92b04b298
Minor change to handling of right clicks in the container control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
182
diff
changeset
|
2308 { |
314
41b890c649e7
Fixed a container emphasis problem when no context menus are created.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
311
diff
changeset
|
2309 if(pCoreEmph) |
41b890c649e7
Fixed a container emphasis problem when no context menus are created.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
311
diff
changeset
|
2310 _clear_emphasis(); |
183
b5a92b04b298
Minor change to handling of right clicks in the container control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
182
diff
changeset
|
2311 hwndEmph = tmp->window; |
b5a92b04b298
Minor change to handling of right clicks in the container control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
182
diff
changeset
|
2312 pCoreEmph = mp2; |
b5a92b04b298
Minor change to handling of right clicks in the container control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
182
diff
changeset
|
2313 WinSendMsg(tmp->window, CM_SETRECORDEMPHASIS, mp2, MPFROM2SHORT(TRUE, CRA_SOURCE)); |
b5a92b04b298
Minor change to handling of right clicks in the container control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
182
diff
changeset
|
2314 } |
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
|
2315 } |
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
|
2316 result = containercontextfunc(tmp->window, text, x, y, tmp->data, user); |
3 | 2317 tmp = NULL; |
2318 } | |
2319 } | |
2320 break; | |
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
|
2321 case CN_EMPHASIS: |
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
|
2322 { |
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
|
2323 PNOTIFYRECORDEMPHASIS pre = (PNOTIFYRECORDEMPHASIS)mp2; |
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
|
2324 static int emph_recurse = 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
|
2325 |
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
|
2326 if(!emph_recurse) |
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
|
2327 { |
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
|
2328 emph_recurse = 1; |
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
|
2329 |
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
|
2330 if(mp2) |
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
|
2331 { |
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
|
2332 if(tmp->window == pre->hwndCnr) |
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
|
2333 { |
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
|
2334 PCNRITEM pci = (PCNRITEM)pre->pRecord; |
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
|
2335 |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
2336 if(pci && pre->fEmphasisMask & CRA_CURSORED && (pci->rc.flRecordAttr & CRA_CURSORED)) |
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
|
2337 { |
328
e00aff2b899e
Tree item handles are now of the type HTREEITEM instead of HWND since they
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
326
diff
changeset
|
2338 int (* API treeselectfunc)(HWND, HTREEITEM, char *, void *, void *) = (int (* API)(HWND, HTREEITEM, char *, void *, void *))tmp->signalfunction; |
311
24c1dfffe97e
Unified the callback functions for tree and container widgets.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
310
diff
changeset
|
2339 |
161
c555d06b6c93
Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
160
diff
changeset
|
2340 if(dw_window_get_data(tmp->window, "_dw_container")) |
311
24c1dfffe97e
Unified the callback functions for tree and container widgets.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
310
diff
changeset
|
2341 result = treeselectfunc(tmp->window, 0, pci->rc.pszIcon, tmp->data, 0); |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
2342 else |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
2343 { |
161
c555d06b6c93
Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
160
diff
changeset
|
2344 if(lasthcnr == tmp->window && lastitem == (HWND)pci) |
c555d06b6c93
Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
160
diff
changeset
|
2345 { |
c555d06b6c93
Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
160
diff
changeset
|
2346 lasthcnr = 0; |
c555d06b6c93
Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
160
diff
changeset
|
2347 lastitem = 0; |
c555d06b6c93
Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
160
diff
changeset
|
2348 } |
c555d06b6c93
Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
160
diff
changeset
|
2349 else |
c555d06b6c93
Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
160
diff
changeset
|
2350 { |
c555d06b6c93
Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
160
diff
changeset
|
2351 lasthcnr = tmp->window; |
c555d06b6c93
Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
160
diff
changeset
|
2352 lastitem = (HWND)pci; |
328
e00aff2b899e
Tree item handles are now of the type HTREEITEM instead of HWND since they
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
326
diff
changeset
|
2353 result = treeselectfunc(tmp->window, (HTREEITEM)pci, pci->rc.pszIcon, tmp->data, pci->user); |
161
c555d06b6c93
Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
160
diff
changeset
|
2354 } |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
2355 } |
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
|
2356 tmp = NULL; |
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
|
2357 } |
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
|
2358 } |
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
|
2359 } |
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
|
2360 emph_recurse = 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
|
2361 } |
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
|
2362 } |
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
|
2363 break; |
3 | 2364 case LN_SELECT: |
2365 { | |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2366 char classbuf[100]; |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2367 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2368 WinQueryClassName(tmp->window, 99, classbuf); |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2369 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2370 if(strncmp(classbuf, "#38", 4) == 0) |
3 | 2371 { |
175
d78d08440246
Use _System/_stdcall for callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
174
diff
changeset
|
2372 int (* API valuechangedfunc)(HWND, int, void *) = (int (* API)(HWND, int, void *))tmp->signalfunction; |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2373 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2374 if(tmp->window == hWnd || WinQueryWindow(tmp->window, QW_PARENT) == hWnd) |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2375 { |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2376 static int lastvalue = -1; |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2377 static HWND lasthwnd = NULLHANDLE; |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2378 int ulValue = (int)WinSendMsg(tmp->window, SLM_QUERYSLIDERINFO, MPFROM2SHORT(SMA_SLIDERARMPOSITION, SMA_INCREMENTVALUE), 0); |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2379 if(lastvalue != ulValue || lasthwnd != tmp->window) |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2380 { |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2381 result = valuechangedfunc(tmp->window, ulValue, tmp->data); |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2382 lastvalue = ulValue; |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2383 lasthwnd = tmp->window; |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2384 } |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2385 tmp = NULL; |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2386 } |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2387 } |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2388 else |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2389 { |
175
d78d08440246
Use _System/_stdcall for callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
174
diff
changeset
|
2390 int (* API listboxselectfunc)(HWND, int, void *) = (int (* API )(HWND, int, void *))tmp->signalfunction; |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2391 int id = SHORT1FROMMP(mp1); |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2392 HWND conthwnd = dw_window_from_id(hWnd, id); |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2393 static int _recursing = 0; |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2394 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2395 if(_recursing == 0 && (tmp->window == conthwnd || (!id && tmp->window == (HWND)mp2))) |
3 | 2396 { |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2397 char buf1[500]; |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2398 unsigned int index = dw_listbox_selected(tmp->window); |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2399 |
510
710f82598210
Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
508
diff
changeset
|
2400 dw_listbox_get_text(tmp->window, index, buf1, 500); |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2401 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2402 _recursing = 1; |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2403 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2404 if(id && strncmp(classbuf, "#2", 3)==0) |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2405 { |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2406 char *buf2; |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2407 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2408 buf2 = dw_window_get_text(tmp->window); |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2409 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2410 /* This is to make sure the listboxselect function doesn't |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2411 * get called if the user is modifying the entry text. |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2412 */ |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2413 if(buf2 && *buf2 && *buf1 && strncmp(buf1, buf2, 500) == 0) |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2414 result = listboxselectfunc(tmp->window, index, tmp->data); |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2415 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2416 if(buf2) |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2417 free(buf2); |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2418 } |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2419 else |
3 | 2420 result = listboxselectfunc(tmp->window, index, tmp->data); |
2421 | |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2422 _recursing = 0; |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2423 tmp = NULL; |
3 | 2424 } |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2425 } |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2426 } |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2427 break; |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2428 case SLN_SLIDERTRACK: |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2429 { |
175
d78d08440246
Use _System/_stdcall for callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
174
diff
changeset
|
2430 int (* API valuechangedfunc)(HWND, int, void *) = (int (* API)(HWND, int, void *))tmp->signalfunction; |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2431 |
207
767fca804cea
Fixed scrollbar value_change on OS/2... ID must be set on the scrollbar,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
203
diff
changeset
|
2432 if(origmsg == WM_CONTROL) |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2433 { |
203
e0beea487e8f
Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
199
diff
changeset
|
2434 /* Handle Slider control */ |
e0beea487e8f
Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
199
diff
changeset
|
2435 if(tmp->window == hWnd || WinQueryWindow(tmp->window, QW_PARENT) == hWnd) |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2436 { |
203
e0beea487e8f
Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
199
diff
changeset
|
2437 static int lastvalue = -1; |
e0beea487e8f
Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
199
diff
changeset
|
2438 static HWND lasthwnd = NULLHANDLE; |
e0beea487e8f
Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
199
diff
changeset
|
2439 int ulValue = (int)WinSendMsg(tmp->window, SLM_QUERYSLIDERINFO, MPFROM2SHORT(SMA_SLIDERARMPOSITION, SMA_INCREMENTVALUE), 0); |
e0beea487e8f
Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
199
diff
changeset
|
2440 if(lastvalue != ulValue || lasthwnd != tmp->window) |
e0beea487e8f
Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
199
diff
changeset
|
2441 { |
e0beea487e8f
Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
199
diff
changeset
|
2442 dw_window_set_data(tmp->window, "_dw_slider_value", (void *)ulValue); |
e0beea487e8f
Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
199
diff
changeset
|
2443 result = valuechangedfunc(tmp->window, ulValue, tmp->data); |
e0beea487e8f
Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
199
diff
changeset
|
2444 lastvalue = ulValue; |
e0beea487e8f
Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
199
diff
changeset
|
2445 lasthwnd = tmp->window; |
e0beea487e8f
Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
199
diff
changeset
|
2446 } |
e0beea487e8f
Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
199
diff
changeset
|
2447 tmp = NULL; |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2448 } |
203
e0beea487e8f
Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
199
diff
changeset
|
2449 } |
e0beea487e8f
Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
199
diff
changeset
|
2450 else |
e0beea487e8f
Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
199
diff
changeset
|
2451 { |
e0beea487e8f
Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
199
diff
changeset
|
2452 /* Handle scrollbar control */ |
207
767fca804cea
Fixed scrollbar value_change on OS/2... ID must be set on the scrollbar,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
203
diff
changeset
|
2453 if(tmp->window > 65535 && tmp->window == WinWindowFromID(hWnd, (ULONG)mp1)) |
203
e0beea487e8f
Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
199
diff
changeset
|
2454 { |
212
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
2455 int pos = _HandleScroller(tmp->window, (int)SHORT1FROMMP(mp2), (int)SHORT2FROMMP(mp2));; |
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
2456 |
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
2457 if(pos > -1) |
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
2458 { |
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
2459 dw_window_set_data(tmp->window, "_dw_scrollbar_value", (void *)pos); |
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
2460 result = valuechangedfunc(tmp->window, pos, tmp->data); |
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
2461 } |
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
2462 result = 0; |
203
e0beea487e8f
Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
199
diff
changeset
|
2463 tmp = NULL; |
e0beea487e8f
Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
199
diff
changeset
|
2464 } |
3 | 2465 } |
2466 } | |
346
81fae15885d7
Implemented switch-page on OS/2, and changed the signal prototype to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
342
diff
changeset
|
2467 break; |
81fae15885d7
Implemented switch-page on OS/2, and changed the signal prototype to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
342
diff
changeset
|
2468 case BKN_PAGESELECTED: |
81fae15885d7
Implemented switch-page on OS/2, and changed the signal prototype to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
342
diff
changeset
|
2469 { |
81fae15885d7
Implemented switch-page on OS/2, and changed the signal prototype to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
342
diff
changeset
|
2470 PAGESELECTNOTIFY *psn = (PAGESELECTNOTIFY *)mp2; |
81fae15885d7
Implemented switch-page on OS/2, and changed the signal prototype to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
342
diff
changeset
|
2471 |
81fae15885d7
Implemented switch-page on OS/2, and changed the signal prototype to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
342
diff
changeset
|
2472 if(psn && tmp->window == psn->hwndBook) |
81fae15885d7
Implemented switch-page on OS/2, and changed the signal prototype to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
342
diff
changeset
|
2473 { |
81fae15885d7
Implemented switch-page on OS/2, and changed the signal prototype to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
342
diff
changeset
|
2474 int (* API switchpagefunc)(HWND, unsigned long, void *) = (int (* API)(HWND, unsigned long, void *))tmp->signalfunction; |
81fae15885d7
Implemented switch-page on OS/2, and changed the signal prototype to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
342
diff
changeset
|
2475 |
81fae15885d7
Implemented switch-page on OS/2, and changed the signal prototype to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
342
diff
changeset
|
2476 result = switchpagefunc(tmp->window, psn->ulPageIdNew, tmp->data); |
81fae15885d7
Implemented switch-page on OS/2, and changed the signal prototype to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
342
diff
changeset
|
2477 tmp = NULL; |
81fae15885d7
Implemented switch-page on OS/2, and changed the signal prototype to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
342
diff
changeset
|
2478 } |
81fae15885d7
Implemented switch-page on OS/2, and changed the signal prototype to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
342
diff
changeset
|
2479 } |
3 | 2480 break; |
2481 } | |
2482 } | |
2483 break; | |
2484 } | |
2485 } | |
30
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
2486 |
3 | 2487 if(tmp) |
2488 tmp = tmp->next; | |
2489 | |
2490 } | |
2491 return (MRESULT)result; | |
2492 } | |
2493 | |
2494 /* Handles control messages sent to the box (owner). */ | |
2495 MRESULT EXPENTRY _controlproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2) | |
2496 { | |
2497 Box *blah = WinQueryWindowPtr(hWnd, QWP_USER); | |
2498 | |
2499 switch(msg) | |
2500 { | |
207
767fca804cea
Fixed scrollbar value_change on OS/2... ID must be set on the scrollbar,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
203
diff
changeset
|
2501 case WM_VSCROLL: |
767fca804cea
Fixed scrollbar value_change on OS/2... ID must be set on the scrollbar,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
203
diff
changeset
|
2502 case WM_HSCROLL: |
212
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
2503 if(_run_event(hWnd, msg, mp1, mp2)) |
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
2504 { |
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
2505 HWND window = WinWindowFromID(hWnd, (ULONG)mp1); |
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
2506 _HandleScroller(window, (int)SHORT1FROMMP(mp2), (int)SHORT2FROMMP(mp2)); |
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
2507 } |
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
2508 break; |
3 | 2509 case WM_CONTROL: |
2510 _run_event(hWnd, msg, mp1, mp2); | |
2511 break; | |
2512 } | |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2513 |
3 | 2514 if(blah && blah->oldproc) |
2515 return blah->oldproc(hWnd, msg, mp1, mp2); | |
2516 | |
2517 return WinDefWindowProc(hWnd, msg, mp1, mp2); | |
2518 } | |
2519 | |
2520 /* The main window procedure for Dynamic Windows, all the resizing code is done here. */ | |
2521 MRESULT EXPENTRY _wndproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2) | |
2522 { | |
2523 int result = -1; | |
2524 static int command_active = 0; | |
182
b8caec82a4d2
Minor splitbar fixes on OS/2 and Windows. The splitbar width is now 4
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
180
diff
changeset
|
2525 void (* API windowfunc)(PVOID) = 0L; |
3 | 2526 |
150
2a0d7b57a6da
Removed unnecessary parameters from dw_main().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
147
diff
changeset
|
2527 if(!command_active) |
3 | 2528 { |
2529 /* Make sure we don't end up in infinite recursion */ | |
2530 command_active = 1; | |
2531 | |
2532 result = (int)_run_event(hWnd, msg, mp1, mp2); | |
2533 | |
2534 command_active = 0; | |
2535 } | |
2536 | |
2537 /* Now that any handlers are done... do normal processing */ | |
2538 switch( msg ) | |
2539 { | |
2540 case WM_ERASEBACKGROUND: | |
2541 return 0; | |
2542 | |
2543 case WM_PAINT: | |
2544 { | |
2545 HPS hps; | |
2546 RECTL rc; | |
2547 | |
2548 hps = WinBeginPaint( hWnd, 0L, &rc ); | |
2549 WinEndPaint( hps ); | |
2550 break; | |
2551 } | |
2552 | |
2553 case WM_SIZE: | |
2554 { | |
2555 Box *mybox = (Box *)WinQueryWindowPtr(hWnd, QWP_USER); | |
2556 | |
2557 if(!SHORT1FROMMP(mp2) && !SHORT2FROMMP(mp2)) | |
2558 return (MPARAM)TRUE; | |
2559 | |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
2560 if(mybox && mybox->flags != DW_MINIMIZED) |
3 | 2561 { |
2562 /* Hide the window when recalculating to reduce | |
2563 * CPU load. | |
2564 */ | |
2565 WinShowWindow(hWnd, FALSE); | |
2566 | |
2567 _do_resize(mybox, SHORT1FROMMP(mp2), SHORT2FROMMP(mp2)); | |
2568 | |
2569 WinShowWindow(hWnd, TRUE); | |
2570 } | |
2571 } | |
2572 break; | |
2573 case WM_MINMAXFRAME: | |
2574 { | |
2575 Box *mybox = (Box *)WinQueryWindowPtr(hWnd, QWP_USER); | |
2576 SWP *swp = (SWP *)mp1; | |
2577 | |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
2578 if(mybox && (swp->fl & SWP_MINIMIZE)) |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
2579 mybox->flags = DW_MINIMIZED; |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
2580 |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
2581 if(mybox && (swp->fl & SWP_RESTORE)) |
39
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
2582 { |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
2583 if(!mybox->titlebar && mybox->hwndtitle) |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
2584 WinSetParent(mybox->hwndtitle, HWND_OBJECT, FALSE); |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
2585 mybox->flags = 0; |
39
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
2586 } |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
2587 |
3 | 2588 if(mybox && (swp->fl & SWP_MAXIMIZE)) |
2589 { | |
2590 int z; | |
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
|
2591 SWP swp2; |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
2592 |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
2593 WinQueryWindowPos(swp->hwnd, &swp2); |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
2594 |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
2595 if(swp2.cx == swp->cx && swp2.cy == swp->cy) |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
2596 return FALSE; |
3 | 2597 |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
2598 mybox->flags = 0; |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
2599 |
3 | 2600 /* Hide the window when recalculating to reduce |
2601 * CPU load. | |
2602 */ | |
2603 WinShowWindow(hWnd, FALSE); | |
2604 | |
2605 _do_resize(mybox, swp->cx, swp->cy); | |
2606 | |
2607 if(mybox->count == 1 && mybox->items[0].type == TYPEBOX) | |
2608 { | |
2609 mybox = (Box *)WinQueryWindowPtr(mybox->items[0].hwnd, QWP_USER); | |
2610 | |
2611 for(z=0;z<mybox->count;z++) | |
94
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
2612 _check_resize_notebook(mybox->items[z].hwnd); |
3 | 2613 |
2614 } | |
2615 | |
2616 WinShowWindow(hWnd, TRUE); | |
2617 } | |
2618 } | |
2619 break; | |
20
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2620 case WM_CONTROL: |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2621 switch(SHORT2FROMMP(mp1)) |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2622 { |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2623 case BKN_PAGESELECTEDPENDING: |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2624 { |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2625 PAGESELECTNOTIFY *psn = (PAGESELECTNOTIFY *)mp2; |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2626 HWND pagehwnd = (HWND)WinSendMsg(psn->hwndBook, BKM_QUERYPAGEWINDOWHWND, MPFROMLONG(psn->ulPageIdNew), 0); |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2627 Box *pagebox = (Box *)WinQueryWindowPtr(pagehwnd, QWP_USER); |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2628 unsigned long x, y, width, height; |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2629 RECTL rc; |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2630 |
21
c6e76b796b28
Stopped unnecessary redrawing when switching to the same page.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
20
diff
changeset
|
2631 if(pagebox && psn->ulPageIdNew != psn->ulPageIdCur) |
20
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2632 { |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2633 dw_window_get_pos_size(psn->hwndBook, &x, &y, &width, &height); |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2634 |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2635 rc.xLeft = x; |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2636 rc.yBottom = y; |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2637 rc.xRight = x + width; |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2638 rc.yTop = y + height; |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2639 |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2640 WinSendMsg(psn->hwndBook, BKM_CALCPAGERECT, (MPARAM)&rc, (MPARAM)TRUE); |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2641 |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2642 _do_resize(pagebox, rc.xRight - rc.xLeft, rc.yTop - rc.yBottom); |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2643 } |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2644 } |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2645 break; |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2646 } |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2647 break; |
3 | 2648 case WM_CLOSE: |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
2649 if(result == -1) |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
2650 { |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
2651 dw_window_destroy(WinQueryWindow(hWnd, QW_PARENT)); |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
2652 return (MRESULT)TRUE; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
2653 } |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
2654 break; |
404
720e61df8cf6
An even better combobox drawing fix. Only add 100 pixels to the size of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
399
diff
changeset
|
2655 case WM_MOUSEMOVE: |
720e61df8cf6
An even better combobox drawing fix. Only add 100 pixels to the size of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
399
diff
changeset
|
2656 { |
720e61df8cf6
An even better combobox drawing fix. Only add 100 pixels to the size of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
399
diff
changeset
|
2657 HPOINTER ptr = (HPOINTER)dw_window_get_data(hWnd, "_dw_pointer"); |
720e61df8cf6
An even better combobox drawing fix. Only add 100 pixels to the size of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
399
diff
changeset
|
2658 |
720e61df8cf6
An even better combobox drawing fix. Only add 100 pixels to the size of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
399
diff
changeset
|
2659 if(ptr) |
720e61df8cf6
An even better combobox drawing fix. Only add 100 pixels to the size of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
399
diff
changeset
|
2660 WinSetPointer(HWND_DESKTOP, ptr); |
720e61df8cf6
An even better combobox drawing fix. Only add 100 pixels to the size of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
399
diff
changeset
|
2661 } |
720e61df8cf6
An even better combobox drawing fix. Only add 100 pixels to the size of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
399
diff
changeset
|
2662 break; |
3 | 2663 case WM_USER: |
182
b8caec82a4d2
Minor splitbar fixes on OS/2 and Windows. The splitbar width is now 4
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
180
diff
changeset
|
2664 windowfunc = (void (* API)(void *))mp1; |
3 | 2665 |
2666 if(windowfunc) | |
2667 windowfunc((void *)mp2); | |
2668 break; | |
2669 case WM_CHAR: | |
2670 if(SHORT1FROMMP(mp2) == '\t') | |
2671 { | |
61
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
2672 if(CHARMSG(&msg)->fs & KC_SHIFT) |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
2673 _shift_focus_back(hWnd); |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
2674 else |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
2675 _shift_focus(hWnd); |
3 | 2676 return FALSE; |
2677 } | |
2678 break; | |
2679 case WM_DESTROY: | |
468
0a2f13ba2d5c
More menu fixes, free signal handlers and memory on OS/2, and the begining
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
466
diff
changeset
|
2680 { |
0a2f13ba2d5c
More menu fixes, free signal handlers and memory on OS/2, and the begining
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
466
diff
changeset
|
2681 HWND parent = WinQueryWindow(hWnd, QW_PARENT); |
0a2f13ba2d5c
More menu fixes, free signal handlers and memory on OS/2, and the begining
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
466
diff
changeset
|
2682 |
0a2f13ba2d5c
More menu fixes, free signal handlers and memory on OS/2, and the begining
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
466
diff
changeset
|
2683 /* Free memory before destroying */ |
0a2f13ba2d5c
More menu fixes, free signal handlers and memory on OS/2, and the begining
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
466
diff
changeset
|
2684 if(parent && WinWindowFromID(parent, FID_CLIENT) == hWnd) |
0a2f13ba2d5c
More menu fixes, free signal handlers and memory on OS/2, and the begining
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
466
diff
changeset
|
2685 _free_window_memory(parent); |
0a2f13ba2d5c
More menu fixes, free signal handlers and memory on OS/2, and the begining
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
466
diff
changeset
|
2686 else |
0a2f13ba2d5c
More menu fixes, free signal handlers and memory on OS/2, and the begining
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
466
diff
changeset
|
2687 _free_window_memory(hWnd); |
0a2f13ba2d5c
More menu fixes, free signal handlers and memory on OS/2, and the begining
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
466
diff
changeset
|
2688 } |
3 | 2689 break; |
183
b5a92b04b298
Minor change to handling of right clicks in the container control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
182
diff
changeset
|
2690 case WM_MENUEND: |
498
00d0514cadc8
Fixes to the new popup menu code, removed a bogus check that was causing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
497
diff
changeset
|
2691 /* Delay removing the signal until we've executed |
00d0514cadc8
Fixes to the new popup menu code, removed a bogus check that was causing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
497
diff
changeset
|
2692 * the signal handler. |
00d0514cadc8
Fixes to the new popup menu code, removed a bogus check that was causing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
497
diff
changeset
|
2693 */ |
00d0514cadc8
Fixes to the new popup menu code, removed a bogus check that was causing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
497
diff
changeset
|
2694 WinPostMsg(hWnd, WM_USER+2, mp1, mp2); |
00d0514cadc8
Fixes to the new popup menu code, removed a bogus check that was causing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
497
diff
changeset
|
2695 break; |
00d0514cadc8
Fixes to the new popup menu code, removed a bogus check that was causing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
497
diff
changeset
|
2696 case WM_USER+2: |
314
41b890c649e7
Fixed a container emphasis problem when no context menus are created.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
311
diff
changeset
|
2697 _clear_emphasis(); |
499
b658d9628f41
Ok, so the code I just removed wasn't quite as bogus as I thought, but it
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
498
diff
changeset
|
2698 if(dw_window_get_data((HWND)mp2, "_dw_popup")) |
b658d9628f41
Ok, so the code I just removed wasn't quite as bogus as I thought, but it
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
498
diff
changeset
|
2699 _free_menu_data((HWND)mp2); |
183
b5a92b04b298
Minor change to handling of right clicks in the container control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
182
diff
changeset
|
2700 break; |
3 | 2701 } |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2702 |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
2703 if(result != -1) |
3 | 2704 return (MRESULT)result; |
2705 else | |
2706 return WinDefWindowProc(hWnd, msg, mp1, mp2); | |
2707 } | |
2708 | |
2709 void _changebox(Box *thisbox, int percent, int type) | |
2710 { | |
2711 int z; | |
2712 | |
2713 for(z=0;z<thisbox->count;z++) | |
2714 { | |
2715 if(thisbox->items[z].type == TYPEBOX) | |
2716 { | |
2717 Box *tmp = WinQueryWindowPtr(thisbox->items[z].hwnd, QWP_USER); | |
2718 _changebox(tmp, percent, type); | |
2719 } | |
2720 else | |
2721 { | |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
2722 if(type == DW_HORZ) |
3 | 2723 { |
2724 if(thisbox->items[z].hsize == SIZEEXPAND) | |
2725 thisbox->items[z].width = (int)(((float)thisbox->items[z].origwidth) * (((float)percent)/((float)100.0))); | |
2726 } | |
2727 else | |
2728 { | |
2729 if(thisbox->items[z].vsize == SIZEEXPAND) | |
2730 thisbox->items[z].height = (int)(((float)thisbox->items[z].origheight) * (((float)percent)/((float)100.0))); | |
2731 } | |
2732 } | |
2733 } | |
2734 } | |
2735 | |
125
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2736 void _handle_splitbar_resize(HWND hwnd, float percent, int type, int x, int y) |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2737 { |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
2738 if(type == DW_HORZ) |
125
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2739 { |
182
b8caec82a4d2
Minor splitbar fixes on OS/2 and Windows. The splitbar width is now 4
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
180
diff
changeset
|
2740 int newx = x; |
125
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2741 float ratio = (float)percent/(float)100.0; |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2742 HWND handle1 = (HWND)dw_window_get_data(hwnd, "_dw_topleft"); |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2743 HWND handle2 = (HWND)dw_window_get_data(hwnd, "_dw_bottomright"); |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2744 Box *tmp = WinQueryWindowPtr(handle1, QWP_USER); |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2745 |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2746 WinShowWindow(handle1, FALSE); |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2747 WinShowWindow(handle2, FALSE); |
125
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2748 |
182
b8caec82a4d2
Minor splitbar fixes on OS/2 and Windows. The splitbar width is now 4
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
180
diff
changeset
|
2749 newx = (int)((float)newx * ratio) - (SPLITBAR_WIDTH/2); |
125
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2750 |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2751 WinSetWindowPos(handle1, NULLHANDLE, 0, 0, newx, y, SWP_MOVE | SWP_SIZE); |
182
b8caec82a4d2
Minor splitbar fixes on OS/2 and Windows. The splitbar width is now 4
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
180
diff
changeset
|
2752 _do_resize(tmp, newx - 1, y - 1); |
125
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2753 |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2754 dw_window_set_data(hwnd, "_dw_start", (void *)newx); |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2755 |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2756 tmp = WinQueryWindowPtr(handle2, QWP_USER); |
125
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2757 |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2758 newx = x - newx - SPLITBAR_WIDTH; |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2759 |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2760 WinSetWindowPos(handle2, NULLHANDLE, x - newx, 0, newx, y, SWP_MOVE | SWP_SIZE); |
182
b8caec82a4d2
Minor splitbar fixes on OS/2 and Windows. The splitbar width is now 4
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
180
diff
changeset
|
2761 _do_resize(tmp, newx - 1, y - 1); |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2762 |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2763 WinShowWindow(handle1, TRUE); |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2764 WinShowWindow(handle2, TRUE); |
125
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2765 } |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2766 else |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2767 { |
182
b8caec82a4d2
Minor splitbar fixes on OS/2 and Windows. The splitbar width is now 4
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
180
diff
changeset
|
2768 int newy = y; |
125
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2769 float ratio = (float)percent/(float)100.0; |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2770 HWND handle1 = (HWND)dw_window_get_data(hwnd, "_dw_topleft"); |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2771 HWND handle2 = (HWND)dw_window_get_data(hwnd, "_dw_bottomright"); |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2772 Box *tmp = WinQueryWindowPtr(handle1, QWP_USER); |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2773 |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2774 WinShowWindow(handle1, FALSE); |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2775 WinShowWindow(handle2, FALSE); |
125
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2776 |
182
b8caec82a4d2
Minor splitbar fixes on OS/2 and Windows. The splitbar width is now 4
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
180
diff
changeset
|
2777 newy = (int)((float)newy * ratio) - (SPLITBAR_WIDTH/2); |
125
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2778 |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2779 WinSetWindowPos(handle1, NULLHANDLE, 0, y - newy, x, newy, SWP_MOVE | SWP_SIZE); |
182
b8caec82a4d2
Minor splitbar fixes on OS/2 and Windows. The splitbar width is now 4
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
180
diff
changeset
|
2780 _do_resize(tmp, x - 1, newy - 1); |
125
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2781 |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2782 tmp = WinQueryWindowPtr(handle2, QWP_USER); |
125
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2783 |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2784 newy = y - newy - SPLITBAR_WIDTH; |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2785 |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2786 WinSetWindowPos(handle2, NULLHANDLE, 0, 0, x, newy, SWP_MOVE | SWP_SIZE); |
182
b8caec82a4d2
Minor splitbar fixes on OS/2 and Windows. The splitbar width is now 4
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
180
diff
changeset
|
2787 _do_resize(tmp, x - 1, newy - 1); |
125
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2788 |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2789 WinShowWindow(handle1, TRUE); |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2790 WinShowWindow(handle2, TRUE); |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2791 |
125
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2792 dw_window_set_data(hwnd, "_dw_start", (void *)newy); |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2793 } |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2794 } |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2795 |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2796 |
3 | 2797 /* This handles any activity on the splitbars (sizers) */ |
2798 MRESULT EXPENTRY _splitwndproc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) | |
2799 { | |
123
63f61a702b17
Updates to use floats to save the splitbar percentage.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
2800 float *percent = (float *)dw_window_get_data(hwnd, "_dw_percent"); |
117
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
2801 int type = (int)dw_window_get_data(hwnd, "_dw_type"); |
125
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2802 int start = (int)dw_window_get_data(hwnd, "_dw_start"); |
3 | 2803 |
2804 switch (msg) | |
2805 { | |
2806 case WM_ACTIVATE: | |
2807 case WM_SETFOCUS: | |
2808 return (MRESULT)(FALSE); | |
2809 | |
2810 case WM_PAINT: | |
2811 { | |
128
ac616f625443
Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
127
diff
changeset
|
2812 HPS hps; |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2813 POINTL ptl[2]; |
128
ac616f625443
Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
127
diff
changeset
|
2814 RECTL rcl; |
ac616f625443
Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
127
diff
changeset
|
2815 |
ac616f625443
Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
127
diff
changeset
|
2816 hps = WinBeginPaint(hwnd, 0, 0); |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2817 |
128
ac616f625443
Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
127
diff
changeset
|
2818 WinQueryWindowRect(hwnd, &rcl); |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2819 |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
2820 if(type == DW_HORZ) |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2821 { |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2822 ptl[0].x = rcl.xLeft + start; |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2823 ptl[0].y = rcl.yBottom; |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2824 ptl[1].x = rcl.xRight + start + 3; |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2825 ptl[1].y = rcl.yTop; |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2826 } |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2827 else |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2828 { |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2829 ptl[0].x = rcl.xLeft; |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2830 ptl[0].y = rcl.yBottom + start; |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2831 ptl[1].x = rcl.xRight; |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2832 ptl[1].y = rcl.yTop + start + 3; |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2833 } |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2834 |
128
ac616f625443
Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
127
diff
changeset
|
2835 |
ac616f625443
Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
127
diff
changeset
|
2836 GpiSetColor(hps, CLR_PALEGRAY); |
ac616f625443
Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
127
diff
changeset
|
2837 GpiMove(hps, &ptl[0]); |
ac616f625443
Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
127
diff
changeset
|
2838 GpiBox(hps, DRO_OUTLINEFILL, &ptl[1], 0, 0); |
ac616f625443
Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
127
diff
changeset
|
2839 WinEndPaint(hps); |
3 | 2840 } |
2841 return MRFROMSHORT(FALSE); | |
2842 | |
2843 case WM_MOUSEMOVE: | |
2844 { | |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
2845 if(type == DW_HORZ) |
3 | 2846 WinSetPointer(HWND_DESKTOP, |
2847 WinQuerySysPointer(HWND_DESKTOP, | |
2848 SPTR_SIZEWE, | |
2849 FALSE)); | |
2850 else | |
2851 WinSetPointer(HWND_DESKTOP, | |
2852 WinQuerySysPointer(HWND_DESKTOP, | |
2853 SPTR_SIZENS, | |
2854 FALSE)); | |
2855 } | |
2856 return MRFROMSHORT(FALSE); | |
2857 case WM_BUTTON1DOWN: | |
2858 { | |
2859 APIRET rc; | |
2860 RECTL rclFrame; | |
2861 RECTL rclBounds; | |
2862 | |
2863 WinQueryWindowRect(hwnd, &rclFrame); | |
125
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2864 WinQueryWindowRect(hwnd, &rclBounds); |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2865 |
3 | 2866 WinMapWindowPoints(hwnd, HWND_DESKTOP, |
125
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2867 (PPOINTL)&rclBounds, 2); |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2868 |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2869 |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
2870 if(type == DW_HORZ) |
125
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2871 { |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2872 rclFrame.xLeft = start; |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2873 rclFrame.xRight = start + SPLITBAR_WIDTH; |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2874 } |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2875 else |
3 | 2876 { |
125
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2877 rclFrame.yBottom = start; |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2878 rclFrame.yTop = start + SPLITBAR_WIDTH; |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2879 } |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2880 |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2881 if(percent) |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2882 { |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2883 rc = _TrackRectangle(hwnd, &rclFrame, &rclBounds); |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2884 |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2885 if(rc == TRUE) |
3 | 2886 { |
125
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2887 int width = (rclBounds.xRight - rclBounds.xLeft); |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2888 int height = (rclBounds.yTop - rclBounds.yBottom); |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2889 |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
2890 if(type == DW_HORZ) |
3 | 2891 { |
125
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2892 start = rclFrame.xLeft - rclBounds.xLeft; |
127
c5c3ccb84ac7
Safety checks in the splitbar calculations on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
125
diff
changeset
|
2893 if(width - SPLITBAR_WIDTH > 1 && start < width - SPLITBAR_WIDTH) |
c5c3ccb84ac7
Safety checks in the splitbar calculations on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
125
diff
changeset
|
2894 *percent = ((float)start / (float)(width - SPLITBAR_WIDTH)) * 100.0; |
3 | 2895 } |
2896 else | |
2897 { | |
125
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2898 start = rclFrame.yBottom - rclBounds.yBottom; |
127
c5c3ccb84ac7
Safety checks in the splitbar calculations on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
125
diff
changeset
|
2899 if(height - SPLITBAR_WIDTH > 1 && start < height - SPLITBAR_WIDTH) |
c5c3ccb84ac7
Safety checks in the splitbar calculations on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
125
diff
changeset
|
2900 *percent = 100.0 - (((float)start / (float)(height - SPLITBAR_WIDTH)) * 100.0); |
3 | 2901 } |
125
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2902 _handle_splitbar_resize(hwnd, *percent, type, width, height); |
3 | 2903 } |
2904 } | |
2905 } | |
2906 return MRFROMSHORT(FALSE); | |
2907 } | |
2908 return WinDefWindowProc(hwnd, msg, mp1, mp2); | |
2909 } | |
2910 | |
2911 /* Function: BubbleProc | |
2912 * Abstract: Subclass procedure for bubble help | |
2913 */ | |
2914 MRESULT EXPENTRY _BubbleProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) | |
2915 { | |
2916 MRESULT res; | |
2917 PFNWP proc = (PFNWP)WinQueryWindowPtr(hwnd, QWL_USER); | |
2918 | |
2919 if(proc) | |
2920 res = proc(hwnd, msg, mp1, mp2); | |
2921 else | |
2922 res = WinDefWindowProc(hwnd, msg, mp1, mp2); | |
2923 | |
2924 if(msg == WM_PAINT) | |
2925 { | |
2926 POINTL ptl; | |
2927 HPS hpsTemp; | |
2928 RECTL rcl; | |
2929 int height, width; | |
2930 | |
2931 WinQueryWindowRect(hwnd, &rcl); | |
2932 height = rcl.yTop - rcl.yBottom - 1; | |
2933 width = rcl.xRight - rcl.xLeft - 1; | |
2934 | |
2935 /* Draw a border around the bubble help */ | |
2936 hpsTemp = WinGetPS(hwnd); | |
230
15810221d4ea
Don't use DW_CLR_* when making direct OS/2 API calls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
228
diff
changeset
|
2937 GpiSetColor(hpsTemp, CLR_BLACK); |
3 | 2938 ptl.x = ptl.y = 0; |
2939 GpiMove(hpsTemp, &ptl); | |
2940 ptl.x = 0; | |
2941 ptl.y = height; | |
2942 GpiLine(hpsTemp, &ptl); | |
2943 ptl.x = ptl.y = 0; | |
2944 GpiMove(hpsTemp, &ptl); | |
2945 ptl.y = 0; | |
2946 ptl.x = width; | |
2947 GpiLine(hpsTemp, &ptl); | |
2948 ptl.x = width; | |
2949 ptl.y = height; | |
2950 GpiMove(hpsTemp, &ptl); | |
2951 ptl.x = 0; | |
2952 ptl.y = height; | |
2953 GpiLine(hpsTemp, &ptl); | |
2954 ptl.x = width; | |
2955 ptl.y = height; | |
2956 GpiMove(hpsTemp, &ptl); | |
2957 ptl.y = 0; | |
2958 ptl.x = width; | |
2959 GpiLine(hpsTemp, &ptl); | |
2960 WinReleasePS(hpsTemp); | |
2961 } | |
2962 return res; | |
2963 } | |
2964 | |
366
4ed3b13ee48c
Code to do the OS/2 style indent when the button is pressed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
365
diff
changeset
|
2965 MRESULT EXPENTRY _button_draw(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2, PFNWP oldproc, int indent) |
365
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
2966 { |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
2967 HPIXMAP pixmap = (HPIXMAP)dw_window_get_data(hwnd, "_dw_hpixmap"); |
367
f19440c0ff71
Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
366
diff
changeset
|
2968 HPIXMAP disable = (HPIXMAP)dw_window_get_data(hwnd, "_dw_hpixmap_disabled"); |
365
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
2969 MRESULT res; |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
2970 |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
2971 if(!oldproc) |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
2972 res = WinDefWindowProc(hwnd, msg, mp1, mp2); |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
2973 res = oldproc(hwnd, msg, mp1, mp2); |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
2974 |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
2975 if(pixmap) |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
2976 { |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
2977 unsigned long width, height; |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
2978 int x, y; |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
2979 |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
2980 dw_window_get_pos_size(hwnd, NULL, NULL, &width, &height); |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
2981 |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
2982 x = (width - pixmap->width)/2; |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
2983 y = (height - pixmap->height)/2; |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
2984 |
367
f19440c0ff71
Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
366
diff
changeset
|
2985 if(disable && dw_window_get_data(hwnd, "_dw_disabled")) |
f19440c0ff71
Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
366
diff
changeset
|
2986 dw_pixmap_bitblt(hwnd, 0, x + indent, y + indent, pixmap->width, pixmap->height, 0, disable, 0, 0); |
f19440c0ff71
Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
366
diff
changeset
|
2987 else |
f19440c0ff71
Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
366
diff
changeset
|
2988 dw_pixmap_bitblt(hwnd, 0, x + indent, y + indent, pixmap->width, pixmap->height, 0, pixmap, 0, 0); |
365
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
2989 } |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
2990 return res; |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
2991 } |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
2992 |
3 | 2993 /* Function: BtProc |
2994 * Abstract: Subclass procedure for buttons | |
2995 */ | |
2996 | |
2997 MRESULT EXPENTRY _BtProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) | |
2998 { | |
2999 BubbleButton *bubble; | |
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
|
3000 PFNWP oldproc; |
3 | 3001 |
3002 bubble = (BubbleButton *)WinQueryWindowPtr(hwnd, QWL_USER); | |
3003 | |
3004 if(!bubble) | |
3005 return WinDefWindowProc(hwnd, msg, mp1, mp2); | |
3006 | |
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
|
3007 oldproc = bubble->pOldProc; |
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
|
3008 |
3 | 3009 switch(msg) |
3010 { | |
365
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
3011 case WM_PAINT: |
366
4ed3b13ee48c
Code to do the OS/2 style indent when the button is pressed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
365
diff
changeset
|
3012 return _button_draw(hwnd, msg, mp1, mp2, oldproc, 0); |
367
f19440c0ff71
Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
366
diff
changeset
|
3013 case BM_SETHILITE: |
f19440c0ff71
Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
366
diff
changeset
|
3014 return _button_draw(hwnd, msg, mp1, mp2, oldproc, (int)mp1); |
37
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
3015 case WM_SETFOCUS: |
39
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
3016 if(mp2) |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
3017 _run_event(hwnd, msg, mp1, mp2); |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
3018 else |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
3019 WinSendMsg(hwnd, BM_SETDEFAULT, 0, 0); |
37
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
3020 break; |
159
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
3021 case WM_BUTTON1DOWN: |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
3022 case WM_BUTTON2DOWN: |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
3023 case WM_BUTTON3DOWN: |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
3024 case WM_BUTTON1DBLCLK: |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
3025 case WM_BUTTON2DBLCLK: |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
3026 case WM_BUTTON3DBLCLK: |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
3027 if(dw_window_get_data(hwnd, "_dw_disabled")) |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
3028 return (MRESULT)FALSE; |
368
72fbd1ee8150
Ug, missed a break statement.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
367
diff
changeset
|
3029 break; |
3 | 3030 case WM_BUTTON1UP: |
3031 { | |
3032 SignalHandler *tmp = Root; | |
3033 | |
159
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
3034 if(WinIsWindowEnabled(hwnd) && !dw_window_get_data(hwnd, "_dw_disabled")) |
3 | 3035 { |
3036 /* Find any callbacks for this function */ | |
3037 while(tmp) | |
3038 { | |
3039 if(tmp->message == WM_COMMAND) | |
3040 { | |
3041 /* Make sure it's the right window, and the right ID */ | |
3042 if(tmp->window == hwnd) | |
3043 { | |
3044 /* Due to the fact that if we run the function | |
3045 * here, finishing actions on the button will occur | |
3046 * after we run the signal handler. So we post the | |
3047 * message so the button can finish what it needs to | |
3048 * do before we run our handler. | |
3049 */ | |
3050 WinPostMsg(hwnd, WM_USER, (MPARAM)tmp, 0); | |
3051 tmp = NULL; | |
3052 } | |
3053 } | |
3054 if(tmp) | |
3055 tmp= tmp->next; | |
3056 } | |
3057 } | |
3058 } | |
367
f19440c0ff71
Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
366
diff
changeset
|
3059 break; |
3 | 3060 case WM_USER: |
3061 { | |
3062 SignalHandler *tmp = (SignalHandler *)mp1; | |
175
d78d08440246
Use _System/_stdcall for callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
174
diff
changeset
|
3063 int (* API clickfunc)(HWND, void *) = NULL; |
3 | 3064 |
3065 if(tmp) | |
3066 { | |
175
d78d08440246
Use _System/_stdcall for callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
174
diff
changeset
|
3067 clickfunc = (int (* API)(HWND, void *))tmp->signalfunction; |
3 | 3068 |
3069 clickfunc(tmp->window, tmp->data); | |
3070 } | |
3071 } | |
3072 break; | |
3073 case WM_CHAR: | |
3074 { | |
3075 /* A button press should also occur for an ENTER or SPACE press | |
3076 * while the button has the active input focus. | |
3077 */ | |
3078 if(SHORT1FROMMP(mp2) == '\r' || SHORT1FROMMP(mp2) == ' ') | |
3079 { | |
3080 SignalHandler *tmp = Root; | |
3081 | |
3082 /* Find any callbacks for this function */ | |
3083 while(tmp) | |
3084 { | |
3085 if(tmp->message == WM_COMMAND) | |
3086 { | |
3087 /* Make sure it's the right window, and the right ID */ | |
3088 if(tmp->window == hwnd) | |
3089 { | |
3090 WinPostMsg(hwnd, WM_USER, (MPARAM)tmp, 0); | |
3091 tmp = NULL; | |
3092 } | |
3093 } | |
3094 if(tmp) | |
3095 tmp= tmp->next; | |
3096 } | |
3097 } | |
3098 if(SHORT1FROMMP(mp2) == '\t') | |
3099 { | |
61
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
3100 if(CHARMSG(&msg)->fs & KC_SHIFT) |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
3101 _shift_focus_back(hwnd); |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
3102 else |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
3103 _shift_focus(hwnd); |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
3104 WinSendMsg(hwnd, BM_SETDEFAULT, 0, 0); |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
3105 return FALSE; |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
3106 } |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
3107 else if(!(CHARMSG(&msg)->fs & KC_KEYUP) && (CHARMSG(&msg)->vkey == VK_LEFT || CHARMSG(&msg)->vkey == VK_UP)) |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
3108 { |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
3109 _shift_focus_back(hwnd); |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
3110 return FALSE; |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
3111 } |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
3112 else if(!(CHARMSG(&msg)->fs & KC_KEYUP) && (CHARMSG(&msg)->vkey == VK_RIGHT || CHARMSG(&msg)->vkey == VK_DOWN)) |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
3113 { |
3 | 3114 _shift_focus(hwnd); |
3115 return FALSE; | |
3116 } | |
3117 } | |
3118 break; | |
3119 case 0x041f: | |
3120 if (hwndBubble) | |
3121 { | |
3122 WinDestroyWindow(hwndBubble); | |
3123 hwndBubble = 0; | |
3124 } | |
3125 break; | |
3126 | |
3127 case 0x041e: | |
3128 | |
3129 if(!*bubble->bubbletext) | |
3130 break; | |
3131 | |
3132 if(hwndBubble) | |
3133 { | |
3134 WinDestroyWindow(hwndBubble); | |
3135 hwndBubble = 0; | |
3136 } | |
3137 | |
3138 if(!hwndBubble) | |
3139 { | |
3140 HPS hpsTemp = 0; | |
3141 LONG lHight; | |
3142 LONG lWidth; | |
3143 POINTL txtPointl[TXTBOX_COUNT]; | |
3144 POINTL ptlWork = {0,0}; | |
230
15810221d4ea
Don't use DW_CLR_* when making direct OS/2 API calls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
228
diff
changeset
|
3145 ULONG ulColor = CLR_YELLOW; |
3 | 3146 void *blah; |
3147 | |
3148 hwndBubbleLast = hwnd; | |
3149 hwndBubble = WinCreateWindow(HWND_DESKTOP, | |
3150 WC_STATIC, | |
3151 "", | |
3152 SS_TEXT | | |
3153 DT_CENTER | | |
3154 DT_VCENTER, | |
3155 0,0,0,0, | |
3156 HWND_DESKTOP, | |
3157 HWND_TOP, | |
3158 0, | |
3159 NULL, | |
3160 NULL); | |
3161 | |
3162 WinSetPresParam(hwndBubble, | |
3163 PP_FONTNAMESIZE, | |
363
eaebef97fc4f
Fixed using the default font in the bubble help.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
360
diff
changeset
|
3164 strlen(DefaultFont)+1, |
3 | 3165 DefaultFont); |
3166 | |
3167 | |
3168 WinSetPresParam(hwndBubble, | |
3169 PP_BACKGROUNDCOLORINDEX, | |
3170 sizeof(ulColor), | |
3171 &ulColor); | |
3172 | |
3173 WinSetWindowText(hwndBubble, | |
3174 bubble->bubbletext); | |
3175 | |
3176 WinMapWindowPoints(hwnd, HWND_DESKTOP, &ptlWork, 1); | |
3177 | |
3178 hpsTemp = WinGetPS(hwndBubble); | |
3179 GpiQueryTextBox(hpsTemp, | |
3180 strlen(bubble->bubbletext), | |
3181 bubble->bubbletext, | |
3182 TXTBOX_COUNT, | |
3183 txtPointl); | |
3184 WinReleasePS(hpsTemp); | |
3185 | |
3186 lWidth = txtPointl[TXTBOX_TOPRIGHT].x - | |
3187 txtPointl[TXTBOX_TOPLEFT ].x + 8; | |
3188 | |
3189 lHight = txtPointl[TXTBOX_TOPLEFT].y - | |
3190 txtPointl[TXTBOX_BOTTOMLEFT].y + 8; | |
3191 | |
3192 ptlWork.y -= lHight; | |
3193 | |
3194 blah = (void *)WinSubclassWindow(hwndBubble, _BubbleProc); | |
3195 | |
3196 if(blah) | |
3197 WinSetWindowPtr(hwndBubble, QWP_USER, blah); | |
3198 | |
3199 WinSetWindowPos(hwndBubble, | |
3200 HWND_TOP, | |
3201 ptlWork.x, | |
3202 ptlWork.y, | |
3203 lWidth, | |
3204 lHight, | |
3205 SWP_SIZE | SWP_MOVE | SWP_SHOW); | |
3206 } | |
3207 break; | |
3208 } | |
3209 | |
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
|
3210 if(!oldproc) |
3 | 3211 return WinDefWindowProc(hwnd, msg, mp1, mp2); |
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
|
3212 return oldproc(hwnd, msg, mp1, mp2); |
3 | 3213 } |
3214 | |
3215 MRESULT EXPENTRY _RendProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) | |
3216 { | |
3217 int res = 0; | |
3218 res = (int)_run_event(hwnd, msg, mp1, mp2); | |
3219 switch(msg) | |
3220 { | |
3221 case WM_BUTTON1DOWN: | |
3222 case WM_BUTTON2DOWN: | |
3223 case WM_BUTTON3DOWN: | |
267
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
3224 if(res == -1) |
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
3225 WinSetFocus(HWND_DESKTOP, hwnd); |
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
3226 else if(res) |
67
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
3227 return (MPARAM)TRUE; |
3 | 3228 } |
3229 return WinDefWindowProc(hwnd, msg, mp1, mp2); | |
3230 } | |
3231 | |
30
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
3232 MRESULT EXPENTRY _TreeProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
3233 { |
67
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
3234 WindowData *blah = (WindowData *)WinQueryWindowPtr(hwnd, QWP_USER); |
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
3235 PFNWP oldproc = 0; |
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
3236 |
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
3237 if(blah) |
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
3238 oldproc = blah->oldproc; |
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
3239 |
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
3240 switch(msg) |
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
3241 { |
128
ac616f625443
Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
127
diff
changeset
|
3242 case WM_PAINT: |
ac616f625443
Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
127
diff
changeset
|
3243 { |
ac616f625443
Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
127
diff
changeset
|
3244 HPS hps; |
ac616f625443
Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
127
diff
changeset
|
3245 RECTL rcl; |
ac616f625443
Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
127
diff
changeset
|
3246 POINTL ptl[2]; |
ac616f625443
Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
127
diff
changeset
|
3247 |
ac616f625443
Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
127
diff
changeset
|
3248 if(oldproc) |
129
e47c52b37cdd
Code cleanup and OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
128
diff
changeset
|
3249 oldproc(hwnd, msg, mp1, mp2); |
128
ac616f625443
Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
127
diff
changeset
|
3250 |
ac616f625443
Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
127
diff
changeset
|
3251 hps = WinBeginPaint(hwnd, 0, 0); |
ac616f625443
Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
127
diff
changeset
|
3252 WinQueryWindowRect(hwnd, &rcl); |
ac616f625443
Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
127
diff
changeset
|
3253 ptl[0].x = rcl.xLeft + 1; |
ac616f625443
Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
127
diff
changeset
|
3254 ptl[0].y = rcl.yBottom + 1; |
ac616f625443
Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
127
diff
changeset
|
3255 ptl[1].x = rcl.xRight - 1; |
ac616f625443
Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
127
diff
changeset
|
3256 ptl[1].y = rcl.yTop - 1; |
ac616f625443
Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
127
diff
changeset
|
3257 |
ac616f625443
Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
127
diff
changeset
|
3258 GpiSetColor(hps, CLR_BLACK); |
ac616f625443
Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
127
diff
changeset
|
3259 GpiMove(hps, &ptl[0]); |
ac616f625443
Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
127
diff
changeset
|
3260 GpiBox(hps, DRO_OUTLINE, &ptl[1], 0, 0); |
ac616f625443
Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
127
diff
changeset
|
3261 WinEndPaint(hps); |
ac616f625443
Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
127
diff
changeset
|
3262 } |
ac616f625443
Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
127
diff
changeset
|
3263 return MRFROMSHORT(FALSE); |
67
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
3264 case WM_SETFOCUS: |
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
3265 _run_event(hwnd, msg, mp1, mp2); |
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
3266 break; |
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
3267 case WM_CHAR: |
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
3268 if(SHORT1FROMMP(mp2) == '\t') |
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
3269 { |
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
3270 if(CHARMSG(&msg)->fs & KC_SHIFT) |
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
3271 _shift_focus_back(hwnd); |
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
3272 else |
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
3273 _shift_focus(hwnd); |
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
3274 return FALSE; |
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
3275 } |
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
3276 break; |
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
3277 } |
30
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
3278 |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
3279 _run_event(hwnd, msg, mp1, mp2); |
117
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
3280 |
67
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
3281 if(oldproc) |
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
3282 return oldproc(hwnd, msg, mp1, mp2); |
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
3283 |
30
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
3284 return WinDefWindowProc(hwnd, msg, mp1, mp2); |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
3285 } |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
3286 |
3 | 3287 /* |
3288 * Initializes the Dynamic Windows engine. | |
3289 * Parameters: | |
3290 * newthread: True if this is the only thread. | |
3291 * False if there is already a message loop running. | |
3292 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3293 int API dw_init(int newthread, int argc, char *argv[]) |
3 | 3294 { |
3295 APIRET rc; | |
3296 | |
475
1547e8c327d9
Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
470
diff
changeset
|
3297 argc = argc; /* keep compiler happy */ |
1547e8c327d9
Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
470
diff
changeset
|
3298 argv = argv; /* keep compiler happy */ |
3 | 3299 if(newthread) |
3300 { | |
3301 dwhab = WinInitialize(0); | |
3302 dwhmq = WinCreateMsgQueue(dwhab, 0); | |
3303 } | |
3304 | |
3305 rc = WinRegisterClass(dwhab, ClassName, _wndproc, CS_SIZEREDRAW | CS_CLIPCHILDREN, 32); | |
3306 rc = WinRegisterClass(dwhab, SplitbarClassName, _splitwndproc, 0L, 32); | |
3307 | |
20
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
3308 /* Get the OS/2 version. */ |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
3309 DosQuerySysInfo(QSV_VERSION_MAJOR, QSV_MS_COUNT,(void *)aulBuffer, 4*sizeof(ULONG)); |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
3310 |
190
f4c9fa77136a
A cleaner way of finding the toplevel window.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
185
diff
changeset
|
3311 desktop = WinQueryDesktopWindow(dwhab, NULLHANDLE); |
f4c9fa77136a
A cleaner way of finding the toplevel window.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
185
diff
changeset
|
3312 |
360
cf66410d03b4
Use 8.Helv as the default font before Warp 4.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
356
diff
changeset
|
3313 if(!IS_WARP4()) |
465
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
3314 DefaultFont = "8.Helv"; |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
3315 |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
3316 /* This is a window that hangs around as long as the |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
3317 * application does and handles menu messages. |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
3318 */ |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
3319 hwndApp = dw_window_new(HWND_OBJECT, "", 0); |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
3320 |
3 | 3321 return rc; |
3322 } | |
3323 | |
3324 /* | |
3325 * Runs a message loop for Dynamic Windows. | |
150
2a0d7b57a6da
Removed unnecessary parameters from dw_main().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
147
diff
changeset
|
3326 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3327 void API dw_main(void) |
3 | 3328 { |
3329 QMSG qmsg; | |
3330 | |
3331 _dwtid = dw_thread_id(); | |
3332 | |
199
b955228477b3
Removed the window parameter to dw_timer_connect() it was no needed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
195
diff
changeset
|
3333 while(WinGetMsg(dwhab, &qmsg, 0, 0, 0)) |
b955228477b3
Removed the window parameter to dw_timer_connect() it was no needed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
195
diff
changeset
|
3334 { |
b955228477b3
Removed the window parameter to dw_timer_connect() it was no needed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
195
diff
changeset
|
3335 if(qmsg.msg == WM_TIMER && qmsg.hwnd == NULLHANDLE) |
b955228477b3
Removed the window parameter to dw_timer_connect() it was no needed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
195
diff
changeset
|
3336 _run_event(qmsg.hwnd, qmsg.msg, qmsg.mp1, qmsg.mp2); |
150
2a0d7b57a6da
Removed unnecessary parameters from dw_main().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
147
diff
changeset
|
3337 WinDispatchMsg(dwhab, &qmsg); |
199
b955228477b3
Removed the window parameter to dw_timer_connect() it was no needed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
195
diff
changeset
|
3338 } |
3 | 3339 |
150
2a0d7b57a6da
Removed unnecessary parameters from dw_main().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
147
diff
changeset
|
3340 WinDestroyMsgQueue(dwhmq); |
2a0d7b57a6da
Removed unnecessary parameters from dw_main().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
147
diff
changeset
|
3341 WinTerminate(dwhab); |
3 | 3342 } |
3343 | |
3344 /* | |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
3345 * Runs a message loop for Dynamic Windows, for a period of milliseconds. |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
3346 * Parameters: |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
3347 * 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:
62
diff
changeset
|
3348 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3349 void API dw_main_sleep(int milliseconds) |
37
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
3350 { |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
3351 QMSG qmsg; |
475
1547e8c327d9
Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
470
diff
changeset
|
3352 #ifdef __EMX__ |
1547e8c327d9
Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
470
diff
changeset
|
3353 struct timeval tv, start; |
1547e8c327d9
Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
470
diff
changeset
|
3354 |
1547e8c327d9
Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
470
diff
changeset
|
3355 gettimeofday(&start, NULL); |
1547e8c327d9
Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
470
diff
changeset
|
3356 gettimeofday(&tv, NULL); |
1547e8c327d9
Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
470
diff
changeset
|
3357 |
1547e8c327d9
Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
470
diff
changeset
|
3358 while(((tv.tv_sec - start.tv_sec)*1000) + ((tv.tv_usec - start.tv_usec)/1000) <= milliseconds) |
1547e8c327d9
Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
470
diff
changeset
|
3359 { |
1547e8c327d9
Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
470
diff
changeset
|
3360 if(WinPeekMsg(dwhab, &qmsg, 0, 0, 0, PM_NOREMOVE)) |
1547e8c327d9
Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
470
diff
changeset
|
3361 { |
1547e8c327d9
Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
470
diff
changeset
|
3362 WinGetMsg(dwhab, &qmsg, 0, 0, 0); |
1547e8c327d9
Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
470
diff
changeset
|
3363 if(qmsg.msg == WM_TIMER && qmsg.hwnd == NULLHANDLE) |
1547e8c327d9
Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
470
diff
changeset
|
3364 _run_event(qmsg.hwnd, qmsg.msg, qmsg.mp1, qmsg.mp2); |
1547e8c327d9
Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
470
diff
changeset
|
3365 WinDispatchMsg(dwhab, &qmsg); |
1547e8c327d9
Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
470
diff
changeset
|
3366 } |
1547e8c327d9
Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
470
diff
changeset
|
3367 else |
1547e8c327d9
Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
470
diff
changeset
|
3368 DosSleep(1); |
1547e8c327d9
Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
470
diff
changeset
|
3369 gettimeofday(&tv, NULL); |
1547e8c327d9
Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
470
diff
changeset
|
3370 } |
477
923b46b0716c
Had #ifdef __EMX__ round the wrong way in dw_main_sleep(); now fixed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
476
diff
changeset
|
3371 #else |
923b46b0716c
Had #ifdef __EMX__ round the wrong way in dw_main_sleep(); now fixed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
476
diff
changeset
|
3372 double start = (double)clock(); |
923b46b0716c
Had #ifdef __EMX__ round the wrong way in dw_main_sleep(); now fixed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
476
diff
changeset
|
3373 |
923b46b0716c
Had #ifdef __EMX__ round the wrong way in dw_main_sleep(); now fixed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
476
diff
changeset
|
3374 while(((clock() - start) / (CLOCKS_PER_SEC/1000)) <= milliseconds) |
923b46b0716c
Had #ifdef __EMX__ round the wrong way in dw_main_sleep(); now fixed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
476
diff
changeset
|
3375 { |
923b46b0716c
Had #ifdef __EMX__ round the wrong way in dw_main_sleep(); now fixed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
476
diff
changeset
|
3376 if(WinPeekMsg(dwhab, &qmsg, 0, 0, 0, PM_NOREMOVE)) |
923b46b0716c
Had #ifdef __EMX__ round the wrong way in dw_main_sleep(); now fixed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
476
diff
changeset
|
3377 { |
923b46b0716c
Had #ifdef __EMX__ round the wrong way in dw_main_sleep(); now fixed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
476
diff
changeset
|
3378 WinGetMsg(dwhab, &qmsg, 0, 0, 0); |
923b46b0716c
Had #ifdef __EMX__ round the wrong way in dw_main_sleep(); now fixed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
476
diff
changeset
|
3379 if(qmsg.msg == WM_TIMER && qmsg.hwnd == NULLHANDLE) |
923b46b0716c
Had #ifdef __EMX__ round the wrong way in dw_main_sleep(); now fixed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
476
diff
changeset
|
3380 _run_event(qmsg.hwnd, qmsg.msg, qmsg.mp1, qmsg.mp2); |
923b46b0716c
Had #ifdef __EMX__ round the wrong way in dw_main_sleep(); now fixed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
476
diff
changeset
|
3381 WinDispatchMsg(dwhab, &qmsg); |
923b46b0716c
Had #ifdef __EMX__ round the wrong way in dw_main_sleep(); now fixed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
476
diff
changeset
|
3382 } |
923b46b0716c
Had #ifdef __EMX__ round the wrong way in dw_main_sleep(); now fixed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
476
diff
changeset
|
3383 else |
923b46b0716c
Had #ifdef __EMX__ round the wrong way in dw_main_sleep(); now fixed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
476
diff
changeset
|
3384 DosSleep(1); |
923b46b0716c
Had #ifdef __EMX__ round the wrong way in dw_main_sleep(); now fixed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
476
diff
changeset
|
3385 } |
475
1547e8c327d9
Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
470
diff
changeset
|
3386 #endif |
37
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
3387 } |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
3388 |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
3389 /* |
203
e0beea487e8f
Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
199
diff
changeset
|
3390 * Processes a single message iteration and returns. |
e0beea487e8f
Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
199
diff
changeset
|
3391 */ |
e0beea487e8f
Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
199
diff
changeset
|
3392 void API dw_main_iteration(void) |
e0beea487e8f
Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
199
diff
changeset
|
3393 { |
e0beea487e8f
Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
199
diff
changeset
|
3394 QMSG qmsg; |
e0beea487e8f
Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
199
diff
changeset
|
3395 |
e0beea487e8f
Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
199
diff
changeset
|
3396 _dwtid = dw_thread_id(); |
e0beea487e8f
Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
199
diff
changeset
|
3397 |
e0beea487e8f
Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
199
diff
changeset
|
3398 if(WinGetMsg(dwhab, &qmsg, 0, 0, 0)) |
e0beea487e8f
Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
199
diff
changeset
|
3399 { |
e0beea487e8f
Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
199
diff
changeset
|
3400 if(qmsg.msg == WM_TIMER && qmsg.hwnd == NULLHANDLE) |
e0beea487e8f
Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
199
diff
changeset
|
3401 _run_event(qmsg.hwnd, qmsg.msg, qmsg.mp1, qmsg.mp2); |
e0beea487e8f
Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
199
diff
changeset
|
3402 WinDispatchMsg(dwhab, &qmsg); |
e0beea487e8f
Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
199
diff
changeset
|
3403 } |
e0beea487e8f
Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
199
diff
changeset
|
3404 } |
e0beea487e8f
Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
199
diff
changeset
|
3405 |
e0beea487e8f
Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
199
diff
changeset
|
3406 /* |
3 | 3407 * Free's memory allocated by dynamic windows. |
3408 * Parameters: | |
3409 * ptr: Pointer to dynamic windows allocated | |
3410 * memory to be free()'d. | |
3411 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3412 void API dw_free(void *ptr) |
3 | 3413 { |
3414 free(ptr); | |
3415 } | |
3416 | |
3417 /* | |
3418 * Allocates and initializes a dialog struct. | |
3419 * Parameters: | |
3420 * data: User defined data to be passed to functions. | |
3421 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3422 DWDialog * API dw_dialog_new(void *data) |
3 | 3423 { |
3424 DWDialog *tmp = malloc(sizeof(DWDialog)); | |
3425 | |
3426 tmp->eve = dw_event_new(); | |
3427 dw_event_reset(tmp->eve); | |
3428 tmp->data = data; | |
3429 tmp->done = FALSE; | |
3430 tmp->result = NULL; | |
3431 | |
3432 return tmp; | |
3433 } | |
3434 | |
3435 /* | |
3436 * Accepts a dialog struct and returns the given data to the | |
3437 * initial called of dw_dialog_wait(). | |
3438 * Parameters: | |
3439 * dialog: Pointer to a dialog struct aquired by dw_dialog_new). | |
3440 * result: Data to be returned by dw_dialog_wait(). | |
3441 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3442 int API dw_dialog_dismiss(DWDialog *dialog, void *result) |
3 | 3443 { |
3444 dialog->result = result; | |
3445 dw_event_post(dialog->eve); | |
3446 dialog->done = TRUE; | |
3447 return 0; | |
3448 } | |
3449 | |
3450 /* | |
3451 * Accepts a dialog struct waits for dw_dialog_dismiss() to be | |
3452 * called by a signal handler with the given dialog struct. | |
3453 * Parameters: | |
3454 * dialog: Pointer to a dialog struct aquired by dw_dialog_new). | |
3455 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3456 void * API dw_dialog_wait(DWDialog *dialog) |
3 | 3457 { |
3458 QMSG qmsg; | |
3459 void *tmp; | |
3460 | |
3461 while (WinGetMsg(dwhab, &qmsg, 0, 0, 0)) | |
3462 { | |
199
b955228477b3
Removed the window parameter to dw_timer_connect() it was no needed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
195
diff
changeset
|
3463 if(qmsg.msg == WM_TIMER && qmsg.hwnd == NULLHANDLE) |
b955228477b3
Removed the window parameter to dw_timer_connect() it was no needed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
195
diff
changeset
|
3464 _run_event(qmsg.hwnd, qmsg.msg, qmsg.mp1, qmsg.mp2); |
3 | 3465 WinDispatchMsg(dwhab, &qmsg); |
3466 if(dialog->done) | |
3467 break; | |
3468 } | |
3469 dw_event_close(&dialog->eve); | |
3470 tmp = dialog->result; | |
3471 free(dialog); | |
3472 return tmp; | |
3473 } | |
3474 | |
3475 | |
3476 /* | |
3477 * Displays a Message Box with given text and title.. | |
3478 * Parameters: | |
3479 * 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:
377
diff
changeset
|
3480 * flags: flags to indicate buttons and icon |
3 | 3481 * format: printf style format string. |
3482 * ...: Additional variables for use in the format. | |
3483 */ | |
399
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
377
diff
changeset
|
3484 int API dw_messagebox(char *title, int flags, char *format, ...) |
3 | 3485 { |
3486 va_list args; | |
3487 char outbuf[1024]; | |
399
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
377
diff
changeset
|
3488 int rc; |
3 | 3489 |
3490 va_start(args, format); | |
3491 vsprintf(outbuf, format, args); | |
3492 va_end(args); | |
3493 | |
458
768f3546c4b5
Don't make message boxes system modal on OS/2, it is very annoying.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
457
diff
changeset
|
3494 rc = WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, outbuf, title, 0, flags | MB_MOVEABLE); |
399
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
377
diff
changeset
|
3495 if(rc == MBID_OK) |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
377
diff
changeset
|
3496 return DW_MB_RETURN_OK; |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
377
diff
changeset
|
3497 else if(rc == MBID_YES) |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
377
diff
changeset
|
3498 return DW_MB_RETURN_YES; |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
377
diff
changeset
|
3499 else if(rc == MBID_NO) |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
377
diff
changeset
|
3500 return DW_MB_RETURN_NO; |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
377
diff
changeset
|
3501 else if(rc == MBID_CANCEL) |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
377
diff
changeset
|
3502 return DW_MB_RETURN_CANCEL; |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
377
diff
changeset
|
3503 else return 0; |
3 | 3504 } |
3505 | |
3506 /* | |
40
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
3507 * Makes the window topmost. |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
3508 * Parameters: |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
3509 * 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
|
3510 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3511 int API dw_window_raise(HWND handle) |
40
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
3512 { |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
3513 return WinSetWindowPos(handle, HWND_TOP, 0, 0, 0, 0, SWP_ZORDER); |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
3514 } |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
3515 |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
3516 /* |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
3517 * Makes the window bottommost. |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
3518 * Parameters: |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
3519 * 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
|
3520 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3521 int API dw_window_lower(HWND handle) |
40
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
3522 { |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
3523 return WinSetWindowPos(handle, HWND_BOTTOM, 0, 0, 0, 0, SWP_ZORDER); |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
3524 } |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
3525 |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
3526 /* |
3 | 3527 * Makes the window visible. |
3528 * Parameters: | |
3529 * handle: The window handle to make visible. | |
3530 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3531 int API dw_window_show(HWND handle) |
3 | 3532 { |
3533 int rc = WinSetWindowPos(handle, NULLHANDLE, 0, 0, 0, 0, SWP_SHOW); | |
3534 HSWITCH hswitch; | |
3535 SWCNTRL swcntrl; | |
3536 | |
67
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
3537 _fix_button_owner(_toplevel_window(handle), 0); |
3 | 3538 WinSetFocus(HWND_DESKTOP, handle); |
3539 _initial_focus(handle); | |
3540 | |
3541 /* If this window has a switch list entry make sure it is visible */ | |
3542 hswitch = WinQuerySwitchHandle(handle, 0); | |
3543 if(hswitch) | |
3544 { | |
3545 WinQuerySwitchEntry(hswitch, &swcntrl); | |
3546 swcntrl.uchVisibility = SWL_VISIBLE; | |
3547 WinChangeSwitchEntry(hswitch, &swcntrl); | |
3548 } | |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3549 if(WinWindowFromID(handle, FID_CLIENT)) |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3550 { |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3551 WindowData *blah = WinQueryWindowPtr(handle, QWP_USER); |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3552 |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3553 if(blah && !(blah->flags & DW_OS2_NEW_WINDOW)) |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3554 { |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3555 ULONG cx = dw_screen_width(), cy = dw_screen_height(); |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3556 int newx, newy, changed = 0; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3557 SWP swp; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3558 |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3559 blah->flags |= DW_OS2_NEW_WINDOW; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3560 |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3561 WinQueryWindowPos(handle, &swp); |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3562 |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3563 newx = swp.x; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3564 newy = swp.y; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3565 |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3566 if((swp.x+swp.cx) > cx) |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3567 { |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3568 newx = (cx - swp.cx)/2; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3569 changed = 1; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3570 } |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3571 if((swp.y+swp.cy) > cy) |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3572 { |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3573 newy = (cy - swp.cy)/2; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3574 changed = 1; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3575 } |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3576 if(changed) |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3577 WinSetWindowPos(handle, NULLHANDLE, newx, newy, 0, 0, SWP_MOVE); |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3578 } |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3579 } |
3 | 3580 return rc; |
3581 } | |
3582 | |
3583 /* | |
14
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3584 * 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
|
3585 * Parameters: |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3586 * handle: The window handle to minimize. |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3587 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3588 int API dw_window_minimize(HWND handle) |
14
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3589 { |
39
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
3590 HWND hwndclient = WinWindowFromID(handle, FID_CLIENT); |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
3591 |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
3592 if(hwndclient) |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
3593 { |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
3594 Box *box = (Box *)WinQueryWindowPtr(hwndclient, QWP_USER); |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
3595 |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
3596 if(box) |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
3597 { |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
3598 if(!box->titlebar && box->hwndtitle) |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
3599 WinSetParent(box->hwndtitle, handle, FALSE); |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
3600 } |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
3601 } |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
3602 |
14
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3603 return WinSetWindowPos(handle, NULLHANDLE, 0, 0, 0, 0, SWP_MINIMIZE); |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3604 } |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3605 |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3606 /* |
3 | 3607 * Makes the window invisible. |
3608 * Parameters: | |
3609 * handle: The window handle to make visible. | |
3610 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3611 int API dw_window_hide(HWND handle) |
3 | 3612 { |
3613 HSWITCH hswitch; | |
3614 SWCNTRL swcntrl; | |
3615 | |
3616 /* If this window has a switch list entry make sure it is invisible */ | |
3617 hswitch = WinQuerySwitchHandle(handle, 0); | |
3618 if(hswitch) | |
3619 { | |
3620 WinQuerySwitchEntry(hswitch, &swcntrl); | |
3621 swcntrl.uchVisibility = SWL_INVISIBLE; | |
3622 WinChangeSwitchEntry(hswitch, &swcntrl); | |
3623 } | |
3624 return WinShowWindow(handle, FALSE); | |
3625 } | |
3626 | |
3627 /* | |
3628 * Destroys a window and all of it's children. | |
3629 * Parameters: | |
3630 * handle: The window handle to destroy. | |
3631 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3632 int API dw_window_destroy(HWND handle) |
3 | 3633 { |
468
0a2f13ba2d5c
More menu fixes, free signal handlers and memory on OS/2, and the begining
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
466
diff
changeset
|
3634 HWND frame, menu, parent = WinQueryWindow(handle, QW_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
|
3635 Box *thisbox = WinQueryWindowPtr(parent, QWP_USER); |
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
|
3636 |
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
|
3637 if(!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
|
3638 return -1; |
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
|
3639 |
405
4c084ec3e176
Ok, so that last fix has some problems, this new fix is a hybrid of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
404
diff
changeset
|
3640 frame = (HWND)dw_window_get_data(handle, "_dw_combo_box"); |
4c084ec3e176
Ok, so that last fix has some problems, this new fix is a hybrid of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
404
diff
changeset
|
3641 |
468
0a2f13ba2d5c
More menu fixes, free signal handlers and memory on OS/2, and the begining
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
466
diff
changeset
|
3642 if((menu = WinWindowFromID(handle, FID_MENU)) != NULLHANDLE) |
0a2f13ba2d5c
More menu fixes, free signal handlers and memory on OS/2, and the begining
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
466
diff
changeset
|
3643 _free_menu_data(menu); |
0a2f13ba2d5c
More menu fixes, free signal handlers and memory on OS/2, and the begining
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
466
diff
changeset
|
3644 |
210
b9c7b762c104
When comparing the desktop value, use the queried value not the constant.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
207
diff
changeset
|
3645 if(parent != desktop && thisbox && thisbox->count) |
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
|
3646 { |
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
|
3647 int z, index = -1; |
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
|
3648 Item *tmpitem, *thisitem = thisbox->items; |
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
|
3649 |
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
|
3650 for(z=0;z<thisbox->count;z++) |
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
|
3651 { |
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
|
3652 if(thisitem[z].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
|
3653 index = z; |
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
|
3654 } |
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
|
3655 |
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
|
3656 if(index == -1) |
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
|
3657 return 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
|
3658 |
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
|
3659 tmpitem = malloc(sizeof(Item)*(thisbox->count-1)); |
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
|
3660 |
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
|
3661 /* Copy all but the current entry to the new list */ |
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
|
3662 for(z=0;z<index;z++) |
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
|
3663 { |
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
|
3664 tmpitem[z] = thisitem[z]; |
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
|
3665 } |
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
|
3666 for(z=index+1;z<thisbox->count;z++) |
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
|
3667 { |
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
|
3668 tmpitem[z-1] = thisitem[z]; |
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
|
3669 } |
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
|
3670 |
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
|
3671 thisbox->items = tmpitem; |
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
|
3672 free(thisitem); |
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
|
3673 thisbox->count--; |
408
fecd529ba9d4
Use dW_box_new() instead of WinCreateWindow() to make the container window
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
406
diff
changeset
|
3674 _free_window_memory(frame ? frame : handle); |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
3675 } |
405
4c084ec3e176
Ok, so that last fix has some problems, this new fix is a hybrid of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
404
diff
changeset
|
3676 return WinDestroyWindow(frame ? frame : handle); |
3 | 3677 } |
3678 | |
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
|
3679 /* 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
|
3680 * 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
|
3681 * 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
|
3682 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3683 void API dw_window_redraw(HWND handle) |
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
|
3684 { |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
3685 HWND client = WinWindowFromID(handle, FID_CLIENT); |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
3686 HWND window = client ? client : handle; |
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
|
3687 Box *mybox = (Box *)WinQueryWindowPtr(window, QWP_USER); |
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
|
3688 |
503
f3ed8dda02f8
Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
500
diff
changeset
|
3689 _fix_button_owner(_toplevel_window(handle), 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
|
3690 if(window && mybox) |
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
|
3691 { |
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
|
3692 unsigned long width, height; |
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
|
3693 |
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
|
3694 dw_window_get_pos_size(window, NULL, NULL, &width, &height); |
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
|
3695 |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
3696 WinShowWindow(client ? mybox->items[0].hwnd : handle, 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
|
3697 _do_resize(mybox, width, height); |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
3698 WinShowWindow(client ? mybox->items[0].hwnd : handle, TRUE); |
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
|
3699 } |
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
|
3700 } |
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
|
3701 |
3 | 3702 /* |
3703 * Changes a window's parent to newparent. | |
3704 * Parameters: | |
3705 * handle: The window handle to destroy. | |
3706 * newparent: The window's new parent window. | |
3707 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3708 void API dw_window_reparent(HWND handle, HWND newparent) |
3 | 3709 { |
3710 HWND blah = WinWindowFromID(newparent, FID_CLIENT); | |
3711 WinSetParent(handle, blah ? blah : newparent, TRUE); | |
3712 } | |
3713 | |
3714 /* | |
3715 * Sets the font used by a specified window (widget) handle. | |
3716 * Parameters: | |
3717 * handle: The window (widget) handle. | |
3718 * fontname: Name and size of the font in the form "size.fontname" | |
3719 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3720 int API dw_window_set_font(HWND handle, char *fontname) |
3 | 3721 { |
3722 return WinSetPresParam(handle, PP_FONTNAMESIZE, strlen(fontname)+1, fontname); | |
3723 } | |
3724 | |
159
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
3725 /* Internal version */ |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
3726 int _dw_window_set_color(HWND handle, ULONG fore, ULONG back) |
3 | 3727 { |
3728 if((fore & DW_RGB_COLOR) == DW_RGB_COLOR) | |
3729 { | |
3730 RGB2 rgb2; | |
3731 | |
3732 rgb2.bBlue = DW_BLUE_VALUE(fore); | |
3733 rgb2.bGreen = DW_GREEN_VALUE(fore); | |
3734 rgb2.bRed = DW_RED_VALUE(fore); | |
3735 rgb2.fcOptions = 0; | |
3736 | |
3737 WinSetPresParam(handle, PP_FOREGROUNDCOLOR, sizeof(RGB2), &rgb2); | |
3738 | |
3739 } | |
155
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
154
diff
changeset
|
3740 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:
154
diff
changeset
|
3741 { |
192
d946e329670c
Added test application for OS/2, and allow dw_color_xxx_set() to use OS/2
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
190
diff
changeset
|
3742 fore = _internal_color(fore); |
155
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
154
diff
changeset
|
3743 |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
154
diff
changeset
|
3744 WinSetPresParam(handle, PP_FOREGROUNDCOLORINDEX, sizeof(ULONG), &fore); |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
154
diff
changeset
|
3745 } |
3 | 3746 if((back & DW_RGB_COLOR) == DW_RGB_COLOR) |
3747 { | |
3748 RGB2 rgb2; | |
3749 | |
3750 rgb2.bBlue = DW_BLUE_VALUE(back); | |
3751 rgb2.bGreen = DW_GREEN_VALUE(back); | |
3752 rgb2.bRed = DW_RED_VALUE(back); | |
3753 rgb2.fcOptions = 0; | |
3754 | |
3755 WinSetPresParam(handle, PP_BACKGROUNDCOLOR, sizeof(RGB2), &rgb2); | |
3756 return 0; | |
3757 } | |
155
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
154
diff
changeset
|
3758 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:
154
diff
changeset
|
3759 { |
192
d946e329670c
Added test application for OS/2, and allow dw_color_xxx_set() to use OS/2
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
190
diff
changeset
|
3760 back = _internal_color(back); |
155
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
154
diff
changeset
|
3761 |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
154
diff
changeset
|
3762 WinSetPresParam(handle, PP_BACKGROUNDCOLORINDEX, sizeof(ULONG), &back); |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
154
diff
changeset
|
3763 } |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
154
diff
changeset
|
3764 return 0; |
3 | 3765 } |
159
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
3766 /* |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
3767 * Sets the colors used by a specified window (widget) handle. |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
3768 * Parameters: |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
3769 * handle: The window (widget) handle. |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
3770 * fore: Foreground color in DW_RGB format or a default color index. |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
3771 * back: Background color in DW_RGB format or a default color index. |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
3772 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3773 int API dw_window_set_color(HWND handle, ULONG fore, ULONG back) |
159
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
3774 { |
228
326e114923cf
Deal with the enhanced window enable/disable with the new color code
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
225
diff
changeset
|
3775 dw_window_set_data(handle, "_dw_fore", (void *)(fore+1)); |
326e114923cf
Deal with the enhanced window enable/disable with the new color code
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
225
diff
changeset
|
3776 dw_window_set_data(handle, "_dw_back", (void *)(back+1)); |
159
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
3777 |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
3778 return _dw_window_set_color(handle, fore, back); |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
3779 } |
3 | 3780 |
3781 /* | |
3782 * Sets the font used by a specified window (widget) handle. | |
3783 * Parameters: | |
3784 * handle: The window (widget) handle. | |
3785 * border: Size of the window border in pixels. | |
3786 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3787 int API dw_window_set_border(HWND handle, int border) |
3 | 3788 { |
3789 WinSendMsg(handle, WM_SETBORDERSIZE, MPFROMSHORT(border), MPFROMSHORT(border)); | |
3790 return 0; | |
3791 } | |
3792 | |
3793 /* | |
3794 * Captures the mouse input to this window. | |
3795 * Parameters: | |
3796 * handle: Handle to receive mouse input. | |
3797 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3798 void API dw_window_capture(HWND handle) |
3 | 3799 { |
3800 WinSetCapture(HWND_DESKTOP, handle); | |
3801 } | |
3802 | |
3803 /* | |
3804 * Releases previous mouse capture. | |
3805 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3806 void API dw_window_release(void) |
3 | 3807 { |
3808 WinSetCapture(HWND_DESKTOP, NULLHANDLE); | |
3809 } | |
3810 | |
3811 /* | |
3812 * Tracks this window movement. | |
3813 * Parameters: | |
3814 * handle: Handle to frame to be tracked. | |
3815 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3816 void API dw_window_track(HWND handle) |
3 | 3817 { |
3818 WinSendMsg(handle, WM_TRACKFRAME, MPFROMSHORT(TF_MOVE), 0); | |
3819 } | |
3820 | |
3821 /* | |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
3822 * 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:
21
diff
changeset
|
3823 * Parameters: |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
3824 * 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:
21
diff
changeset
|
3825 * 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:
21
diff
changeset
|
3826 */ |
510
710f82598210
Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
508
diff
changeset
|
3827 void API 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:
21
diff
changeset
|
3828 { |
418
4be57ee7e006
Fix a crash in dw_window_pointer when the window handle is HWND_DESKTOP.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
416
diff
changeset
|
3829 if(handle == HWND_DESKTOP) |
4be57ee7e006
Fix a crash in dw_window_pointer when the window handle is HWND_DESKTOP.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
416
diff
changeset
|
3830 WinSetPointer(handle, WinQuerySysPointer(HWND_DESKTOP,pointertype, FALSE)); |
4be57ee7e006
Fix a crash in dw_window_pointer when the window handle is HWND_DESKTOP.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
416
diff
changeset
|
3831 else |
4be57ee7e006
Fix a crash in dw_window_pointer when the window handle is HWND_DESKTOP.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
416
diff
changeset
|
3832 dw_window_set_data(handle, "_dw_pointer", |
4be57ee7e006
Fix a crash in dw_window_pointer when the window handle is HWND_DESKTOP.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
416
diff
changeset
|
3833 pointertype < 65535 ? |
4be57ee7e006
Fix a crash in dw_window_pointer when the window handle is HWND_DESKTOP.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
416
diff
changeset
|
3834 (void *)WinQuerySysPointer(HWND_DESKTOP,pointertype, FALSE) |
4be57ee7e006
Fix a crash in dw_window_pointer when the window handle is HWND_DESKTOP.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
416
diff
changeset
|
3835 : (void *)pointertype); |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
3836 } |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
3837 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
3838 /* |
3 | 3839 * Create a new Window Frame. |
3840 * Parameters: | |
3841 * owner: The Owner's window handle or HWND_DESKTOP. | |
3842 * title: The Window title. | |
3843 * flStyle: Style flags, see the PM reference. | |
3844 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3845 HWND API dw_window_new(HWND hwndOwner, char *title, ULONG flStyle) |
3 | 3846 { |
3847 HWND hwndclient = 0, hwndframe; | |
8
e22584460709
Switched allocating the box structs with calloc instead of malloc so
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
7
diff
changeset
|
3848 Box *newbox = calloc(1, sizeof(Box)); |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3849 WindowData *blah = calloc(1, sizeof(WindowData)); |
475
1547e8c327d9
Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
470
diff
changeset
|
3850 ULONG winStyle = 0L; |
3 | 3851 |
3852 newbox->pad = 0; | |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
3853 newbox->type = DW_VERT; |
3 | 3854 newbox->count = 0; |
3855 | |
3856 flStyle |= FCF_NOBYTEALIGN; | |
3857 | |
39
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
3858 if(flStyle & DW_FCF_TITLEBAR) |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
3859 newbox->titlebar = 1; |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
3860 else |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
3861 flStyle |= FCF_TITLEBAR; |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
3862 |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3863 if(!(flStyle & FCF_SHELLPOSITION)) |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3864 blah->flags |= DW_OS2_NEW_WINDOW; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3865 |
475
1547e8c327d9
Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
470
diff
changeset
|
3866 if(flStyle & WS_MAXIMIZED) |
1547e8c327d9
Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
470
diff
changeset
|
3867 { |
1547e8c327d9
Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
470
diff
changeset
|
3868 winStyle |= WS_MAXIMIZED; |
1547e8c327d9
Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
470
diff
changeset
|
3869 flStyle &= ~WS_MAXIMIZED; |
1547e8c327d9
Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
470
diff
changeset
|
3870 } |
1547e8c327d9
Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
470
diff
changeset
|
3871 if(flStyle & WS_MINIMIZED) |
1547e8c327d9
Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
470
diff
changeset
|
3872 { |
1547e8c327d9
Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
470
diff
changeset
|
3873 winStyle |= WS_MINIMIZED; |
1547e8c327d9
Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
470
diff
changeset
|
3874 flStyle &= ~WS_MINIMIZED; |
1547e8c327d9
Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
470
diff
changeset
|
3875 } |
1547e8c327d9
Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
470
diff
changeset
|
3876 |
1547e8c327d9
Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
470
diff
changeset
|
3877 hwndframe = WinCreateStdWindow(hwndOwner, winStyle, &flStyle, ClassName, title, 0L, NULLHANDLE, 0L, &hwndclient); |
39
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
3878 newbox->hwndtitle = WinWindowFromID(hwndframe, FID_TITLEBAR); |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
3879 if(!newbox->titlebar && newbox->hwndtitle) |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
3880 WinSetParent(newbox->hwndtitle, HWND_OBJECT, FALSE); |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3881 blah->oldproc = WinSubclassWindow(hwndframe, _sizeproc); |
3 | 3882 WinSetWindowPtr(hwndframe, QWP_USER, blah); |
3883 WinSetWindowPtr(hwndclient, QWP_USER, newbox); | |
3884 | |
3885 return hwndframe; | |
3886 } | |
3887 | |
3888 /* | |
3889 * Create a new Box to be packed. | |
3890 * Parameters: | |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
3891 * type: Either DW_VERT (vertical) or DW_HORZ (horizontal). |
3 | 3892 * pad: Number of pixels to pad around the box. |
3893 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3894 HWND API dw_box_new(int type, int pad) |
3 | 3895 { |
8
e22584460709
Switched allocating the box structs with calloc instead of malloc so
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
7
diff
changeset
|
3896 Box *newbox = calloc(1, sizeof(Box)); |
3 | 3897 HWND hwndframe; |
3898 | |
3899 newbox->pad = pad; | |
3900 newbox->type = type; | |
3901 newbox->count = 0; | |
3902 newbox->grouphwnd = NULLHANDLE; | |
3903 | |
3904 hwndframe = WinCreateWindow(HWND_OBJECT, | |
3905 WC_FRAME, | |
3906 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:
40
diff
changeset
|
3907 WS_VISIBLE | WS_CLIPCHILDREN | |
997e9ed670ef
Fixes for box alignment problem on OS/2, crash in dw_bitmap_new() on unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
40
diff
changeset
|
3908 FS_NOBYTEALIGN, |
3 | 3909 0,0,2000,1000, |
3910 NULLHANDLE, | |
3911 HWND_TOP, | |
3912 0L, | |
3913 NULL, | |
3914 NULL); | |
3915 | |
3916 newbox->oldproc = WinSubclassWindow(hwndframe, _controlproc); | |
3917 WinSetWindowPtr(hwndframe, QWP_USER, newbox); | |
3918 dw_window_set_color(hwndframe, DW_CLR_PALEGRAY, DW_CLR_PALEGRAY); | |
3919 return hwndframe; | |
3920 } | |
3921 | |
3922 /* | |
3923 * Create a new Group Box to be packed. | |
3924 * Parameters: | |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
3925 * type: Either DW_VERT (vertical) or DW_HORZ (horizontal). |
3 | 3926 * pad: Number of pixels to pad around the box. |
3927 * title: Text to be displayined in the group outline. | |
3928 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3929 HWND API dw_groupbox_new(int type, int pad, char *title) |
3 | 3930 { |
8
e22584460709
Switched allocating the box structs with calloc instead of malloc so
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
7
diff
changeset
|
3931 Box *newbox = calloc(1, sizeof(Box)); |
3 | 3932 HWND hwndframe; |
3933 | |
3934 newbox->pad = pad; | |
3935 newbox->type = type; | |
3936 newbox->count = 0; | |
3937 | |
3938 hwndframe = WinCreateWindow(HWND_OBJECT, | |
3939 WC_FRAME, | |
3940 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:
40
diff
changeset
|
3941 WS_VISIBLE | |
997e9ed670ef
Fixes for box alignment problem on OS/2, crash in dw_bitmap_new() on unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
40
diff
changeset
|
3942 FS_NOBYTEALIGN, |
3 | 3943 0,0,2000,1000, |
3944 NULLHANDLE, | |
3945 HWND_TOP, | |
3946 0L, | |
3947 NULL, | |
3948 NULL); | |
3949 | |
3950 newbox->grouphwnd = WinCreateWindow(hwndframe, | |
3951 WC_STATIC, | |
3952 title, | |
3953 WS_VISIBLE | SS_GROUPBOX | | |
3954 WS_GROUP, | |
3955 0,0,2000,1000, | |
3956 NULLHANDLE, | |
3957 HWND_TOP, | |
3958 0L, | |
3959 NULL, | |
3960 NULL); | |
3961 | |
3962 WinSetWindowPtr(hwndframe, QWP_USER, newbox); | |
3963 dw_window_set_color(hwndframe, DW_CLR_PALEGRAY, DW_CLR_PALEGRAY); | |
3964 dw_window_set_color(newbox->grouphwnd, DW_CLR_BLACK, DW_CLR_PALEGRAY); | |
3965 dw_window_set_font(newbox->grouphwnd, DefaultFont); | |
3966 return hwndframe; | |
3967 } | |
3968 | |
3969 /* | |
14
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3970 * 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
|
3971 * Parameters: |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3972 * 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
|
3973 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3974 HWND API dw_mdi_new(unsigned long id) |
14
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3975 { |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3976 HWND hwndframe; |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3977 |
475
1547e8c327d9
Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
470
diff
changeset
|
3978 id = id; /* keep compiler happy */ |
14
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3979 hwndframe = WinCreateWindow(HWND_OBJECT, |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3980 WC_FRAME, |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3981 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:
40
diff
changeset
|
3982 WS_VISIBLE | WS_CLIPCHILDREN | |
997e9ed670ef
Fixes for box alignment problem on OS/2, crash in dw_bitmap_new() on unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
40
diff
changeset
|
3983 FS_NOBYTEALIGN, |
14
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3984 0,0,2000,1000, |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3985 NULLHANDLE, |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3986 HWND_TOP, |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3987 0L, |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3988 NULL, |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3989 NULL); |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3990 return hwndframe; |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3991 } |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3992 |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3993 /* |
3 | 3994 * Create a bitmap object to be packed. |
3995 * Parameters: | |
278
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
3996 * id: An ID to be used with dw_window_from_id() or 0L. |
3 | 3997 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3998 HWND API dw_bitmap_new(ULONG id) |
3 | 3999 { |
4000 return WinCreateWindow(HWND_OBJECT, | |
4001 WC_STATIC, | |
4002 NULL, | |
4003 WS_VISIBLE | SS_TEXT, | |
4004 0,0,2000,1000, | |
4005 NULLHANDLE, | |
4006 HWND_TOP, | |
4007 id, | |
4008 NULL, | |
4009 NULL); | |
4010 } | |
4011 | |
4012 /* | |
4013 * Create a notebook object to be packed. | |
4014 * Parameters: | |
4015 * id: An ID to be used for getting the resource from the | |
4016 * resource file. | |
4017 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
4018 HWND API dw_notebook_new(ULONG id, int top) |
3 | 4019 { |
4020 ULONG flags; | |
4021 HWND tmp; | |
4022 | |
4023 if(top) | |
4024 flags = BKS_MAJORTABTOP; | |
4025 else | |
4026 flags = BKS_MAJORTABBOTTOM; | |
4027 | |
4028 tmp = WinCreateWindow(HWND_OBJECT, | |
4029 WC_NOTEBOOK, | |
4030 NULL, | |
4031 WS_VISIBLE | | |
475
1547e8c327d9
Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
470
diff
changeset
|
4032 #ifdef BKS_TABBEDDIALOG |
3 | 4033 BKS_TABBEDDIALOG | |
475
1547e8c327d9
Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
470
diff
changeset
|
4034 #endif |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4035 flags, |
3 | 4036 0,0,2000,1000, |
4037 NULLHANDLE, | |
4038 HWND_TOP, | |
4039 id, | |
4040 NULL, | |
4041 NULL); | |
4042 | |
20
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
4043 /* Fix tab sizes on Warp 3 */ |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
4044 if(!IS_WARP4()) |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
4045 { |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
4046 /* best sizes to be determined by trial and error */ |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
4047 WinSendMsg(tmp, BKM_SETDIMENSIONS,MPFROM2SHORT(102, 28), MPFROMSHORT( BKA_MAJORTAB)); |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
4048 } |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
4049 |
3 | 4050 dw_window_set_font(tmp, DefaultFont); |
4051 return tmp; | |
4052 } | |
4053 | |
4054 /* | |
4055 * Create a menu object to be popped up. | |
4056 * Parameters: | |
4057 * id: An ID to be used for getting the resource from the | |
4058 * resource file. | |
4059 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
4060 HMENUI API dw_menu_new(ULONG id) |
3 | 4061 { |
185
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
4062 HMENUI tmp = WinCreateWindow(HWND_OBJECT, |
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
4063 WC_MENU, |
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
4064 NULL, |
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
4065 WS_VISIBLE, |
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
4066 0,0,2000,1000, |
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
4067 NULLHANDLE, |
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
4068 HWND_TOP, |
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
4069 id, |
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
4070 NULL, |
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
4071 NULL); |
3 | 4072 return tmp; |
4073 } | |
4074 | |
4075 /* | |
4076 * Create a menubar on a window. | |
4077 * Parameters: | |
4078 * location: Handle of a window frame to be attached to. | |
4079 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
4080 HMENUI API dw_menubar_new(HWND location) |
3 | 4081 { |
185
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
4082 HMENUI tmp = WinCreateWindow(location, |
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
4083 WC_MENU, |
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
4084 NULL, |
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
4085 WS_VISIBLE | MS_ACTIONBAR, |
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
4086 0,0,2000,1000, |
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
4087 location, |
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
4088 HWND_TOP, |
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
4089 FID_MENU, |
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
4090 NULL, |
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
4091 NULL); |
465
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
4092 dw_window_set_data(tmp, "_dw_owner", (void *)location); |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
4093 dw_window_set_data(tmp, "_dw_menubar", (void *)location); |
3 | 4094 return tmp; |
4095 } | |
4096 | |
4097 /* | |
4098 * Destroys a menu created with dw_menubar_new or dw_menu_new. | |
4099 * Parameters: | |
4100 * menu: Handle of a menu. | |
4101 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
4102 void API dw_menu_destroy(HMENUI *menu) |
3 | 4103 { |
185
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
4104 if(menu) |
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
4105 WinDestroyWindow(*menu); |
3 | 4106 } |
4107 | |
4108 /* | |
4109 * Adds a menuitem or submenu to an existing menu. | |
4110 * Parameters: | |
4111 * menu: The handle the the existing menu. | |
4112 * title: The title text on the menu item to be added. | |
4113 * id: An ID to be used for message passing. | |
4114 * flags: Extended attributes to set on the menu. | |
4115 * end: If TRUE memu is positioned at the end of the menu. | |
4116 * check: If TRUE menu is "check"able. | |
4117 * submenu: Handle to an existing menu to be a submenu or NULL. | |
4118 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
4119 HWND API dw_menu_append_item(HMENUI menux, char *title, ULONG id, ULONG flags, int end, int check, HMENUI submenu) |
3 | 4120 { |
4121 MENUITEM miSubMenu; | |
465
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
4122 char buffer[15]; |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
4123 |
475
1547e8c327d9
Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
470
diff
changeset
|
4124 check = check; /* keep compiler happy */ |
465
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
4125 if(!menux || id > 65536) |
3 | 4126 return NULLHANDLE; |
4127 | |
4128 if(end) | |
4129 miSubMenu.iPosition=MIT_END; | |
4130 else | |
4131 miSubMenu.iPosition=0; | |
4132 | |
4133 if(strlen(title) == 0) | |
4134 miSubMenu.afStyle=MIS_SEPARATOR | flags; | |
4135 else | |
4136 miSubMenu.afStyle=MIS_TEXT | flags; | |
4137 miSubMenu.afAttribute=0; | |
4138 miSubMenu.id=id; | |
185
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
4139 miSubMenu.hwndSubMenu = submenu; |
3 | 4140 miSubMenu.hItem=NULLHANDLE; |
4141 | |
185
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
4142 WinSendMsg(menux, |
3 | 4143 MM_INSERTITEM, |
4144 MPFROMP(&miSubMenu), | |
4145 MPFROMP(title)); | |
465
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
4146 |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
4147 sprintf(buffer, "_dw_id%d", id); |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
4148 dw_window_set_data(hwndApp, buffer, (void *)menux); |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
4149 |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
4150 if(submenu) |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
4151 dw_window_set_data(submenu, "_dw_owner", (void *)menux); |
3 | 4152 return (HWND)id; |
4153 } | |
4154 | |
4155 /* | |
4156 * Sets the state of a menu item check. | |
4157 * Parameters: | |
4158 * menu: The handle the the existing menu. | |
4159 * id: Menuitem id. | |
4160 * check: TRUE for checked FALSE for not checked. | |
4161 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
4162 void API dw_menu_item_set_check(HMENUI menux, unsigned long id, int check) |
3 | 4163 { |
4164 if(check) | |
185
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
4165 WinSendMsg(menux, MM_SETITEMATTR, MPFROM2SHORT(id, TRUE), |
3 | 4166 MPFROM2SHORT(MIA_CHECKED, MIA_CHECKED)); |
4167 else | |
185
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
4168 WinSendMsg(menux, MM_SETITEMATTR, MPFROM2SHORT(id, TRUE), |
3 | 4169 MPFROM2SHORT(MIA_CHECKED, 0)); |
4170 } | |
4171 | |
4172 /* | |
4173 * Pops up a context menu at given x and y coordinates. | |
4174 * Parameters: | |
4175 * menu: The handle the the existing menu. | |
4176 * parent: Handle to the window initiating the popup. | |
4177 * x: X coordinate. | |
4178 * y: Y coordinate. | |
4179 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
4180 void API dw_menu_popup(HMENUI *menu, HWND parent, int x, int y) |
3 | 4181 { |
185
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
4182 if(menu) |
3 | 4183 { |
93
98cce029a611
Changed handling of menu item click events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
90
diff
changeset
|
4184 popup = parent; |
499
b658d9628f41
Ok, so the code I just removed wasn't quite as bogus as I thought, but it
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
498
diff
changeset
|
4185 dw_window_set_data(*menu, "_dw_popup", (void *)1); |
185
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
4186 WinPopupMenu(HWND_DESKTOP, parent, *menu, x, dw_screen_height() - y, 0, PU_KEYBOARD | PU_MOUSEBUTTON1 | PU_VCONSTRAIN | PU_HCONSTRAIN); |
3 | 4187 } |
4188 } | |
4189 | |
4190 /* | |
4191 * Returns the current X and Y coordinates of the mouse pointer. | |
4192 * Parameters: | |
4193 * x: Pointer to variable to store X coordinate. | |
4194 * y: Pointer to variable to store Y coordinate. | |
4195 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
4196 void API dw_pointer_query_pos(long *x, long *y) |
3 | 4197 { |
4198 POINTL ptl; | |
4199 | |
4200 WinQueryPointerPos(HWND_DESKTOP, &ptl); | |
4201 if(x && y) | |
4202 { | |
4203 *x = ptl.x; | |
4204 *y = dw_screen_height() - ptl.y; | |
4205 } | |
4206 } | |
4207 | |
4208 /* | |
4209 * Sets the X and Y coordinates of the mouse pointer. | |
4210 * Parameters: | |
4211 * x: X coordinate. | |
4212 * y: Y coordinate. | |
4213 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
4214 void API dw_pointer_set_pos(long x, long y) |
3 | 4215 { |
4216 WinSetPointerPos(HWND_DESKTOP, x, dw_screen_height() - y); | |
4217 } | |
4218 | |
310
77105fe19c1f
Removed obsolete dw_container_set_view() function.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
307
diff
changeset
|
4219 |
3 | 4220 /* |
4221 * Create a container object to be packed. | |
4222 * Parameters: | |
4223 * id: An ID to be used for getting the resource from the | |
4224 * resource file. | |
4225 */ | |
350
2216e65ad2ae
Removed slider flags and container selection flags from the header file.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
347
diff
changeset
|
4226 HWND API dw_container_new(ULONG id, int multi) |
3 | 4227 { |
67
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
4228 WindowData *blah = calloc(1, sizeof(WindowData)); |
3 | 4229 HWND tmp = WinCreateWindow(HWND_OBJECT, |
4230 WC_CONTAINER, | |
4231 NULL, | |
4232 WS_VISIBLE | CCS_READONLY | | |
350
2216e65ad2ae
Removed slider flags and container selection flags from the header file.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
347
diff
changeset
|
4233 (multi ? CCS_EXTENDSEL : CCS_SINGLESEL) | |
2216e65ad2ae
Removed slider flags and container selection flags from the header file.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
347
diff
changeset
|
4234 CCS_AUTOPOSITION, |
3 | 4235 0,0,2000,1000, |
4236 NULLHANDLE, | |
4237 HWND_TOP, | |
500
fe12a72bfddf
Added a GlobalID which should allow code written on GTK or Windows to work
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
499
diff
changeset
|
4238 id ? id : (GlobalID++), |
3 | 4239 NULL, |
4240 NULL); | |
67
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
4241 blah->oldproc = WinSubclassWindow(tmp, _TreeProc); |
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
4242 WinSetWindowPtr(tmp, QWP_USER, blah); |
3 | 4243 dw_window_set_font(tmp, DefaultFont); |
161
c555d06b6c93
Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
160
diff
changeset
|
4244 dw_window_set_data(tmp, "_dw_container", (void *)1); |
3 | 4245 return tmp; |
4246 } | |
4247 | |
4248 /* | |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
4249 * 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:
21
diff
changeset
|
4250 * Parameters: |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
4251 * 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:
21
diff
changeset
|
4252 * resource file. |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
4253 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
4254 HWND API dw_tree_new(ULONG id) |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
4255 { |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
4256 CNRINFO cnrinfo; |
67
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
4257 WindowData *blah = calloc(1, sizeof(WindowData)); |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
4258 HWND tmp = WinCreateWindow(HWND_OBJECT, |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
4259 WC_CONTAINER, |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
4260 NULL, |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
4261 WS_VISIBLE | CCS_READONLY | |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
4262 CCS_SINGLESEL | CCS_AUTOPOSITION, |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
4263 0,0,2000,1000, |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
4264 NULLHANDLE, |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
4265 HWND_TOP, |
500
fe12a72bfddf
Added a GlobalID which should allow code written on GTK or Windows to work
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
499
diff
changeset
|
4266 id ? id : (GlobalID++), |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
4267 NULL, |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
4268 NULL); |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
4269 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
4270 cnrinfo.flWindowAttr = CV_TREE | CA_TREELINE; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
4271 cnrinfo.slBitmapOrIcon.cx = 16; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
4272 cnrinfo.slBitmapOrIcon.cy = 16; |
108
108674099806
Changed some of the default spacings for the tree control on OS/2 so it is
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
103
diff
changeset
|
4273 cnrinfo.cyLineSpacing = 0; |
108674099806
Changed some of the default spacings for the tree control on OS/2 so it is
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
103
diff
changeset
|
4274 cnrinfo.cxTreeIndent = 16; |
108674099806
Changed some of the default spacings for the tree control on OS/2 so it is
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
103
diff
changeset
|
4275 cnrinfo.cxTreeLine = 1; |
108674099806
Changed some of the default spacings for the tree control on OS/2 so it is
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
103
diff
changeset
|
4276 |
108674099806
Changed some of the default spacings for the tree control on OS/2 so it is
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
103
diff
changeset
|
4277 WinSendMsg(tmp, CM_SETCNRINFO, &cnrinfo, MPFROMLONG(CMA_FLWINDOWATTR | CMA_SLBITMAPORICON | |
108674099806
Changed some of the default spacings for the tree control on OS/2 so it is
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
103
diff
changeset
|
4278 CMA_LINESPACING | CMA_CXTREEINDENT | CMA_CXTREELINE)); |
67
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
4279 blah->oldproc = WinSubclassWindow(tmp, _TreeProc); |
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
4280 WinSetWindowPtr(tmp, QWP_USER, blah); |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
4281 dw_window_set_font(tmp, DefaultFont); |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
4282 return tmp; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
4283 } |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
4284 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
4285 /* |
3 | 4286 * Create a new static text window (widget) to be packed. |
4287 * Parameters: | |
4288 * 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:
276
diff
changeset
|
4289 * id: An ID to be used with dw_window_from_id() or 0L. |
3 | 4290 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
4291 HWND API dw_text_new(char *text, ULONG id) |
3 | 4292 { |
4293 HWND tmp = WinCreateWindow(HWND_OBJECT, | |
4294 WC_STATIC, | |
4295 text, | |
4296 WS_VISIBLE | SS_TEXT, | |
4297 0,0,2000,1000, | |
4298 NULLHANDLE, | |
4299 HWND_TOP, | |
4300 id, | |
4301 NULL, | |
4302 NULL); | |
4303 dw_window_set_font(tmp, DefaultFont); | |
4304 dw_window_set_color(tmp, DW_CLR_BLACK, DW_CLR_PALEGRAY); | |
4305 return tmp; | |
4306 } | |
4307 | |
4308 /* | |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4309 * 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
|
4310 * Parameters: |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4311 * 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:
276
diff
changeset
|
4312 * 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
|
4313 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
4314 HWND API dw_status_text_new(char *text, ULONG id) |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4315 { |
90
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
4316 WindowData *blah = calloc(sizeof(WindowData), 1); |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4317 HWND tmp = WinCreateWindow(HWND_OBJECT, |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4318 WC_STATIC, |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4319 text, |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4320 WS_VISIBLE | SS_TEXT, |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4321 0,0,2000,1000, |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4322 NULLHANDLE, |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4323 HWND_TOP, |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4324 id, |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4325 NULL, |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4326 NULL); |
180
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
4327 blah->oldproc = WinSubclassWindow(tmp, _statusproc); |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
4328 WinSetWindowPtr(tmp, QWP_USER, blah); |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4329 dw_window_set_font(tmp, DefaultFont); |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4330 dw_window_set_color(tmp, DW_CLR_BLACK, DW_CLR_PALEGRAY); |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4331 return tmp; |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4332 } |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4333 |
154
7f8fcce45bdd
Fixed EMX building.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
4334 #ifndef MLS_LIMITVSCROLL |
7f8fcce45bdd
Fixed EMX building.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
4335 #define MLS_LIMITVSCROLL 0x00000080L |
7f8fcce45bdd
Fixed EMX building.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
4336 #endif |
7f8fcce45bdd
Fixed EMX building.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
4337 |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4338 /* |
3 | 4339 * Create a new Multiline Editbox window (widget) to be packed. |
4340 * Parameters: | |
278
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4341 * id: An ID to be used with dw_window_from_id() or 0L. |
3 | 4342 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
4343 HWND API dw_mle_new(ULONG id) |
3 | 4344 { |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
4345 WindowData *blah = calloc(1, sizeof(WindowData)); |
3 | 4346 HWND tmp = WinCreateWindow(HWND_OBJECT, |
4347 WC_MLE, | |
4348 "", | |
4349 WS_VISIBLE | | |
4350 MLS_BORDER | MLS_IGNORETAB | | |
152
e78027768548
Added MLS_LIMITVSCROLL to the MLE style.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
151
diff
changeset
|
4351 MLS_READONLY | MLS_VSCROLL | |
e78027768548
Added MLS_LIMITVSCROLL to the MLE style.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
151
diff
changeset
|
4352 MLS_LIMITVSCROLL, |
3 | 4353 0,0,2000,1000, |
4354 NULLHANDLE, | |
4355 HWND_TOP, | |
4356 id, | |
4357 NULL, | |
4358 NULL); | |
153
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
4359 blah->oldproc = WinSubclassWindow(tmp, _mleproc); |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
4360 WinSetWindowPtr(tmp, QWP_USER, blah); |
180
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
4361 dw_window_set_font(tmp, DefaultFont); |
3 | 4362 return tmp; |
4363 } | |
4364 | |
4365 /* | |
4366 * Create a new Entryfield window (widget) to be packed. | |
4367 * Parameters: | |
4368 * 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:
276
diff
changeset
|
4369 * id: An ID to be used with dw_window_from_id() or 0L. |
3 | 4370 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
4371 HWND API dw_entryfield_new(char *text, ULONG id) |
3 | 4372 { |
40
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
4373 |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
4374 WindowData *blah = calloc(1, sizeof(WindowData)); |
3 | 4375 HWND tmp = WinCreateWindow(HWND_OBJECT, |
4376 WC_ENTRYFIELD, | |
4377 text, | |
4378 WS_VISIBLE | ES_MARGIN | | |
4379 ES_AUTOSCROLL | WS_TABSTOP, | |
4380 0,0,2000,1000, | |
4381 NULLHANDLE, | |
4382 HWND_TOP, | |
4383 id, | |
4384 NULL, | |
4385 NULL); | |
40
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
4386 blah->oldproc = WinSubclassWindow(tmp, _entryproc); |
3 | 4387 WinSetWindowPtr(tmp, QWP_USER, blah); |
180
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
4388 dw_window_set_font(tmp, DefaultFont); |
159
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
4389 dw_window_set_color(tmp, DW_CLR_BLACK, DW_CLR_WHITE); |
3 | 4390 return tmp; |
4391 } | |
4392 | |
4393 /* | |
4394 * Create a new Entryfield (password) window (widget) to be packed. | |
4395 * Parameters: | |
4396 * 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:
276
diff
changeset
|
4397 * id: An ID to be used with dw_window_from_id() or 0L. |
3 | 4398 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
4399 HWND API dw_entryfield_password_new(char *text, ULONG id) |
3 | 4400 { |
40
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
4401 WindowData *blah = calloc(1, sizeof(WindowData)); |
3 | 4402 HWND tmp = WinCreateWindow(HWND_OBJECT, |
4403 WC_ENTRYFIELD, | |
4404 text, | |
4405 WS_VISIBLE | ES_MARGIN | ES_UNREADABLE | | |
4406 ES_AUTOSCROLL | WS_TABSTOP, | |
4407 0,0,2000,1000, | |
4408 NULLHANDLE, | |
4409 HWND_TOP, | |
4410 id, | |
4411 NULL, | |
4412 NULL); | |
40
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
4413 blah->oldproc = WinSubclassWindow(tmp, _entryproc); |
3 | 4414 WinSetWindowPtr(tmp, QWP_USER, blah); |
180
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
4415 dw_window_set_font(tmp, DefaultFont); |
159
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
4416 dw_window_set_color(tmp, DW_CLR_BLACK, DW_CLR_WHITE); |
3 | 4417 return tmp; |
4418 } | |
4419 | |
4420 /* | |
4421 * Create a new Combobox window (widget) to be packed. | |
4422 * Parameters: | |
4423 * 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:
276
diff
changeset
|
4424 * id: An ID to be used with dw_window_from_id() or 0L. |
3 | 4425 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
4426 HWND API dw_combobox_new(char *text, ULONG id) |
3 | 4427 { |
40
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
4428 WindowData *blah = calloc(1, sizeof(WindowData)); |
408
fecd529ba9d4
Use dW_box_new() instead of WinCreateWindow() to make the container window
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
406
diff
changeset
|
4429 HWND frame = dw_box_new(DW_HORZ, 0); |
405
4c084ec3e176
Ok, so that last fix has some problems, this new fix is a hybrid of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
404
diff
changeset
|
4430 HWND tmp = WinCreateWindow(frame, |
3 | 4431 WC_COMBOBOX, |
4432 text, | |
4433 WS_VISIBLE | CBS_DROPDOWN | WS_GROUP, | |
4434 0,0,2000,1000, | |
4435 NULLHANDLE, | |
4436 HWND_TOP, | |
4437 id, | |
4438 NULL, | |
4439 NULL); | |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
4440 HENUM henum = WinBeginEnumWindows(tmp); |
377
d8176c73a081
Fixes for drawing of the combobox on OS/2. It now queries the entryfield
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
376
diff
changeset
|
4441 HWND child, last = NULLHANDLE; |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
4442 |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
4443 while((child = WinGetNextWindow(henum)) != NULLHANDLE) |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
4444 { |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
4445 WindowData *moreblah = calloc(1, sizeof(WindowData)); |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
4446 moreblah->oldproc = WinSubclassWindow(child, _comboentryproc); |
180
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
4447 WinSetWindowPtr(child, QWP_USER, moreblah); |
159
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
4448 dw_window_set_color(child, DW_CLR_BLACK, DW_CLR_WHITE); |
377
d8176c73a081
Fixes for drawing of the combobox on OS/2. It now queries the entryfield
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
376
diff
changeset
|
4449 last = child; |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
4450 } |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
4451 WinEndEnumWindows(henum); |
40
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
4452 blah->oldproc = WinSubclassWindow(tmp, _comboproc); |
3 | 4453 WinSetWindowPtr(tmp, QWP_USER, blah); |
180
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
4454 dw_window_set_font(tmp, DefaultFont); |
159
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
4455 dw_window_set_color(tmp, DW_CLR_BLACK, DW_CLR_WHITE); |
377
d8176c73a081
Fixes for drawing of the combobox on OS/2. It now queries the entryfield
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
376
diff
changeset
|
4456 dw_window_set_data(tmp, "_dw_comboentry", (void *)last); |
405
4c084ec3e176
Ok, so that last fix has some problems, this new fix is a hybrid of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
404
diff
changeset
|
4457 dw_window_set_data(tmp, "_dw_combo_box", (void *)frame); |
408
fecd529ba9d4
Use dW_box_new() instead of WinCreateWindow() to make the container window
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
406
diff
changeset
|
4458 WinSetOwner(tmp, frame); |
3 | 4459 return tmp; |
4460 } | |
4461 | |
4462 /* | |
4463 * Create a new button window (widget) to be packed. | |
4464 * Parameters: | |
4465 * 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:
276
diff
changeset
|
4466 * id: An ID to be used with dw_window_from_id() or 0L. |
3 | 4467 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
4468 HWND API dw_button_new(char *text, ULONG id) |
3 | 4469 { |
90
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
4470 BubbleButton *bubble = calloc(sizeof(BubbleButton), 1); |
3 | 4471 |
4472 HWND tmp = WinCreateWindow(HWND_OBJECT, | |
4473 WC_BUTTON, | |
4474 text, | |
4475 WS_VISIBLE, | |
4476 0,0,2000,1000, | |
4477 NULLHANDLE, | |
4478 HWND_TOP, | |
4479 id, | |
4480 NULL, | |
4481 NULL); | |
4482 | |
4483 bubble->id = id; | |
4484 bubble->bubbletext[0] = '\0'; | |
4485 bubble->pOldProc = WinSubclassWindow(tmp, _BtProc); | |
4486 | |
4487 WinSetWindowPtr(tmp, QWP_USER, bubble); | |
4488 dw_window_set_font(tmp, DefaultFont); | |
159
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
4489 dw_window_set_color(tmp, DW_CLR_BLACK, DW_CLR_PALEGRAY); |
3 | 4490 return tmp; |
4491 } | |
4492 | |
4493 /* Function: GenResIDStr | |
4494 ** Abstract: Generate string '#nnnn' for a given ID for using with Button | |
4495 ** controls | |
4496 */ | |
4497 | |
4498 void _GenResIDStr(CHAR *buff, ULONG ulID) | |
4499 { | |
4500 char *str; | |
4501 int slen = 0; | |
4502 | |
4503 *buff++ = '#'; | |
4504 | |
4505 str = buff; | |
4506 | |
4507 do | |
4508 { | |
4509 *str++ = (ulID % 10) + '0'; | |
4510 ulID /= 10; | |
4511 slen++; | |
4512 } | |
4513 while(ulID); | |
4514 | |
4515 *str-- = 0; | |
4516 | |
4517 for(; str > buff; str--, buff++) | |
4518 { | |
4519 *buff ^= *str; | |
4520 *str ^= *buff; | |
4521 *buff ^= *str; | |
4522 } | |
4523 } | |
4524 | |
4525 | |
4526 /* | |
4527 * Create a new bitmap button window (widget) to be packed. | |
4528 * Parameters: | |
4529 * text: Bubble help text to be displayed. | |
4530 * id: An ID of a bitmap in the resource file. | |
4531 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
4532 HWND API dw_bitmapbutton_new(char *text, ULONG id) |
3 | 4533 { |
4534 char idbuf[256]; | |
4535 HWND tmp; | |
90
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
4536 BubbleButton *bubble = calloc(sizeof(BubbleButton), 1); |
3 | 4537 |
4538 _GenResIDStr(idbuf, id); | |
4539 | |
4540 tmp = WinCreateWindow(HWND_OBJECT, | |
4541 WC_BUTTON, | |
4542 idbuf, | |
4543 WS_VISIBLE | BS_PUSHBUTTON | | |
4544 BS_BITMAP | BS_AUTOSIZE | | |
4545 BS_NOPOINTERFOCUS, | |
4546 0,0,2000,1000, | |
4547 NULLHANDLE, | |
4548 HWND_TOP, | |
4549 id, | |
4550 NULL, | |
4551 NULL); | |
4552 | |
4553 bubble->id = id; | |
4554 strncpy(bubble->bubbletext, text, BUBBLE_HELP_MAX - 1); | |
4555 bubble->bubbletext[BUBBLE_HELP_MAX - 1] = '\0'; | |
4556 bubble->pOldProc = WinSubclassWindow(tmp, _BtProc); | |
4557 | |
4558 WinSetWindowPtr(tmp, QWP_USER, bubble); | |
367
f19440c0ff71
Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
366
diff
changeset
|
4559 dw_window_set_data(tmp, "_dw_bitmapbutton", (void *)1); |
3 | 4560 return tmp; |
4561 } | |
4562 | |
4563 /* | |
278
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4564 * 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:
276
diff
changeset
|
4565 * Parameters: |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4566 * 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:
276
diff
changeset
|
4567 * 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:
276
diff
changeset
|
4568 * 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:
276
diff
changeset
|
4569 * 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:
276
diff
changeset
|
4570 * (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:
276
diff
changeset
|
4571 */ |
507
c607eb385e58
Added missing calling conventions. Thanks Bastian for pointing this out.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
503
diff
changeset
|
4572 HWND API 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:
276
diff
changeset
|
4573 { |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4574 BubbleButton *bubble = calloc(sizeof(BubbleButton), 1); |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4575 HWND tmp = WinCreateWindow(HWND_OBJECT, |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4576 WC_BUTTON, |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4577 "", |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4578 WS_VISIBLE | BS_PUSHBUTTON | |
365
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
4579 BS_AUTOSIZE | BS_NOPOINTERFOCUS, |
278
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4580 0,0,2000,1000, |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4581 NULLHANDLE, |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4582 HWND_TOP, |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4583 id, |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4584 NULL, |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4585 NULL); |
365
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
4586 char *file = alloca(strlen(filename) + 5); |
367
f19440c0ff71
Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
366
diff
changeset
|
4587 HPIXMAP pixmap = NULL, disabled = NULL; |
365
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
4588 |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
4589 if(file && (pixmap = calloc(1,sizeof(struct _hpixmap)))) |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
4590 { |
367
f19440c0ff71
Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
366
diff
changeset
|
4591 int z, j, lim; |
f19440c0ff71
Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
366
diff
changeset
|
4592 LONG fore; |
f19440c0ff71
Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
366
diff
changeset
|
4593 |
365
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
4594 strcpy(file, filename); |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
4595 |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
4596 /* check if we can read from this file (it exists and read permission) */ |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
4597 if(access(file, 04) != 0) |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
4598 { |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
4599 /* Try with .bmp extention */ |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
4600 strcat(file, ".bmp"); |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
4601 if(access(file, 04) != 0) |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
4602 { |
475
1547e8c327d9
Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
470
diff
changeset
|
4603 #if 0 /* don't free pixmap if bitmap doesn't exist; causes crash several lines below */ |
365
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
4604 free(pixmap); |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
4605 pixmap = NULL; |
475
1547e8c327d9
Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
470
diff
changeset
|
4606 #endif |
365
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
4607 } |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
4608 } |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
4609 |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
4610 /* Try to load the bitmap from file */ |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
4611 if(pixmap) |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
4612 _load_bitmap_file(file, tmp, &pixmap->hbm, &pixmap->hdc, &pixmap->hps, &pixmap->width, &pixmap->height); |
367
f19440c0ff71
Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
366
diff
changeset
|
4613 |
f19440c0ff71
Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
366
diff
changeset
|
4614 /* Create a disabled style pixmap */ |
514
08d770271709
More function name changes for Rexx/DW compatibility.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
513
diff
changeset
|
4615 disabled = dw_pixmap_new(tmp, pixmap->width, pixmap->height, dw_color_depth_get()); |
367
f19440c0ff71
Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
366
diff
changeset
|
4616 dw_pixmap_bitblt(0, disabled, 0, 0, pixmap->width, pixmap->height, 0, pixmap, 0, 0); |
f19440c0ff71
Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
366
diff
changeset
|
4617 |
f19440c0ff71
Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
366
diff
changeset
|
4618 fore = _foreground; |
f19440c0ff71
Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
366
diff
changeset
|
4619 dw_color_foreground_set(DW_CLR_PALEGRAY); |
f19440c0ff71
Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
366
diff
changeset
|
4620 lim = pixmap->width/2; |
f19440c0ff71
Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
366
diff
changeset
|
4621 for(j=0;j<pixmap->height;j++) |
f19440c0ff71
Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
366
diff
changeset
|
4622 { |
f19440c0ff71
Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
366
diff
changeset
|
4623 int mod = j%2; |
f19440c0ff71
Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
366
diff
changeset
|
4624 |
f19440c0ff71
Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
366
diff
changeset
|
4625 for(z=0;z<lim;z++) |
f19440c0ff71
Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
366
diff
changeset
|
4626 dw_draw_point(0, disabled, (z*2)+mod, j); |
f19440c0ff71
Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
366
diff
changeset
|
4627 } |
f19440c0ff71
Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
366
diff
changeset
|
4628 _foreground = fore; |
365
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
4629 } |
278
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4630 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4631 bubble->id = id; |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4632 strncpy(bubble->bubbletext, text, BUBBLE_HELP_MAX - 1); |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4633 bubble->bubbletext[BUBBLE_HELP_MAX - 1] = '\0'; |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4634 bubble->pOldProc = WinSubclassWindow(tmp, _BtProc); |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4635 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4636 WinSetWindowPtr(tmp, QWP_USER, bubble); |
365
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
4637 |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
4638 dw_window_set_data(tmp, "_dw_hpixmap", (void *)pixmap); |
367
f19440c0ff71
Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
366
diff
changeset
|
4639 dw_window_set_data(tmp, "_dw_hpixmap_disabled", (void *)disabled); |
f19440c0ff71
Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
366
diff
changeset
|
4640 dw_window_set_data(tmp, "_dw_bitmapbutton", (void *)1); |
278
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4641 return tmp; |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4642 } |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4643 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4644 /* |
3 | 4645 * Create a new spinbutton window (widget) to be packed. |
4646 * Parameters: | |
4647 * 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:
276
diff
changeset
|
4648 * id: An ID to be used with dw_window_from_id() or 0L. |
3 | 4649 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
4650 HWND API dw_spinbutton_new(char *text, ULONG id) |
3 | 4651 { |
90
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
4652 WindowData *blah = calloc(sizeof(WindowData), 1); |
3 | 4653 HWND tmp = WinCreateWindow(HWND_OBJECT, |
4654 WC_SPINBUTTON, | |
4655 text, | |
4656 WS_VISIBLE | SPBS_MASTER, | |
4657 0,0,2000,1000, | |
4658 NULLHANDLE, | |
4659 HWND_TOP, | |
4660 id, | |
4661 NULL, | |
4662 NULL); | |
156 | 4663 HWND entry = _find_entryfield(tmp); |
90
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
4664 blah->oldproc = WinSubclassWindow(tmp, _entryproc); |
3 | 4665 WinSetWindowPtr(tmp, QWP_USER, blah); |
156 | 4666 blah = calloc(sizeof(WindowData), 1); |
4667 blah->oldproc = WinSubclassWindow(entry, _spinentryproc); | |
4668 WinSetWindowPtr(entry, QWP_USER, blah); | |
180
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
4669 dw_window_set_font(tmp, DefaultFont); |
159
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
4670 dw_window_set_color(entry, DW_CLR_BLACK, DW_CLR_WHITE); |
3 | 4671 return tmp; |
4672 } | |
4673 | |
4674 /* | |
4675 * Create a new radiobutton window (widget) to be packed. | |
4676 * Parameters: | |
4677 * 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:
276
diff
changeset
|
4678 * id: An ID to be used with dw_window_from_id() or 0L. |
3 | 4679 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
4680 HWND API dw_radiobutton_new(char *text, ULONG id) |
3 | 4681 { |
90
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
4682 WindowData *blah = calloc(sizeof(WindowData), 1); |
3 | 4683 HWND tmp = WinCreateWindow(HWND_OBJECT, |
4684 WC_BUTTON, | |
4685 text, | |
4686 WS_VISIBLE | | |
4687 BS_AUTORADIOBUTTON, | |
4688 0,0,2000,1000, | |
4689 NULLHANDLE, | |
4690 HWND_TOP, | |
4691 id, | |
4692 NULL, | |
4693 NULL); | |
180
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
4694 blah->oldproc = WinSubclassWindow(tmp, _entryproc); |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
4695 WinSetWindowPtr(tmp, QWP_USER, blah); |
3 | 4696 dw_window_set_font(tmp, DefaultFont); |
4697 dw_window_set_color(tmp, DW_CLR_BLACK, DW_CLR_PALEGRAY); | |
4698 return tmp; | |
4699 } | |
4700 | |
94
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
4701 |
3 | 4702 /* |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
4703 * 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:
62
diff
changeset
|
4704 * Parameters: |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
4705 * 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:
62
diff
changeset
|
4706 * 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:
276
diff
changeset
|
4707 * 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:
62
diff
changeset
|
4708 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
4709 HWND API dw_slider_new(int vertical, int increments, ULONG id) |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
4710 { |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
4711 WindowData *blah = calloc(1, sizeof(WindowData)); |
172
0fc45e386376
Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
171
diff
changeset
|
4712 SLDCDATA sldcData = { 0, 0, 0, 0, 0 }; |
178
770da0fc4c0d
Fixed a small regression from the watcom changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
175
diff
changeset
|
4713 HWND tmp; |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
4714 |
172
0fc45e386376
Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
171
diff
changeset
|
4715 sldcData.cbSize = sizeof(SLDCDATA); |
0fc45e386376
Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
171
diff
changeset
|
4716 sldcData.usScale1Increments = increments; |
94
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
4717 |
178
770da0fc4c0d
Fixed a small regression from the watcom changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
175
diff
changeset
|
4718 tmp = WinCreateWindow(HWND_OBJECT, |
770da0fc4c0d
Fixed a small regression from the watcom changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
175
diff
changeset
|
4719 WC_SLIDER, |
770da0fc4c0d
Fixed a small regression from the watcom changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
175
diff
changeset
|
4720 "", |
770da0fc4c0d
Fixed a small regression from the watcom changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
175
diff
changeset
|
4721 WS_VISIBLE | SLS_SNAPTOINCREMENT | |
770da0fc4c0d
Fixed a small regression from the watcom changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
175
diff
changeset
|
4722 (vertical ? SLS_VERTICAL : SLS_HORIZONTAL), |
770da0fc4c0d
Fixed a small regression from the watcom changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
175
diff
changeset
|
4723 0,0,2000,1000, |
770da0fc4c0d
Fixed a small regression from the watcom changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
175
diff
changeset
|
4724 NULLHANDLE, |
770da0fc4c0d
Fixed a small regression from the watcom changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
175
diff
changeset
|
4725 HWND_TOP, |
770da0fc4c0d
Fixed a small regression from the watcom changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
175
diff
changeset
|
4726 id, |
770da0fc4c0d
Fixed a small regression from the watcom changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
175
diff
changeset
|
4727 &sldcData, |
770da0fc4c0d
Fixed a small regression from the watcom changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
175
diff
changeset
|
4728 NULL); |
770da0fc4c0d
Fixed a small regression from the watcom changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
175
diff
changeset
|
4729 |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
4730 blah->oldproc = WinSubclassWindow(tmp, _entryproc); |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
4731 WinSetWindowPtr(tmp, QWP_USER, blah); |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
4732 return tmp; |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
4733 } |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
4734 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
4735 /* |
195
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
4736 * 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:
192
diff
changeset
|
4737 * Parameters: |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
4738 * 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:
192
diff
changeset
|
4739 * 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:
276
diff
changeset
|
4740 * 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:
192
diff
changeset
|
4741 */ |
511
80dbd5a1f403
Removed the increments parameter from dw_scrollbar_new().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
510
diff
changeset
|
4742 HWND API dw_scrollbar_new(int vertical, ULONG id) |
80dbd5a1f403
Removed the increments parameter from dw_scrollbar_new().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
510
diff
changeset
|
4743 { |
207
767fca804cea
Fixed scrollbar value_change on OS/2... ID must be set on the scrollbar,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
203
diff
changeset
|
4744 return WinCreateWindow(HWND_OBJECT, |
767fca804cea
Fixed scrollbar value_change on OS/2... ID must be set on the scrollbar,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
203
diff
changeset
|
4745 WC_SCROLLBAR, |
767fca804cea
Fixed scrollbar value_change on OS/2... ID must be set on the scrollbar,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
203
diff
changeset
|
4746 "", |
767fca804cea
Fixed scrollbar value_change on OS/2... ID must be set on the scrollbar,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
203
diff
changeset
|
4747 WS_VISIBLE | SBS_AUTOTRACK | |
767fca804cea
Fixed scrollbar value_change on OS/2... ID must be set on the scrollbar,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
203
diff
changeset
|
4748 (vertical ? SBS_VERT : SBS_HORZ), |
767fca804cea
Fixed scrollbar value_change on OS/2... ID must be set on the scrollbar,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
203
diff
changeset
|
4749 0,0,2000,1000, |
767fca804cea
Fixed scrollbar value_change on OS/2... ID must be set on the scrollbar,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
203
diff
changeset
|
4750 NULLHANDLE, |
767fca804cea
Fixed scrollbar value_change on OS/2... ID must be set on the scrollbar,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
203
diff
changeset
|
4751 HWND_TOP, |
500
fe12a72bfddf
Added a GlobalID which should allow code written on GTK or Windows to work
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
499
diff
changeset
|
4752 id ? id : (GlobalID++), |
207
767fca804cea
Fixed scrollbar value_change on OS/2... ID must be set on the scrollbar,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
203
diff
changeset
|
4753 NULL, |
767fca804cea
Fixed scrollbar value_change on OS/2... ID must be set on the scrollbar,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
203
diff
changeset
|
4754 NULL); |
195
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
4755 } |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
4756 |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
4757 /* |
33
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
4758 * Create a new percent bar window (widget) to be packed. |
3 | 4759 * Parameters: |
278
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4760 * id: An ID to be used with dw_window_from_id() or 0L. |
3 | 4761 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
4762 HWND API dw_percent_new(ULONG id) |
33
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
4763 { |
94
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
4764 WindowData *blah = calloc(1, sizeof(WindowData)); |
33
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
4765 HWND tmp = WinCreateWindow(HWND_OBJECT, |
62
2be5174bdb5d
Sync with latest DW code. Tab and RGB fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
4766 WC_SLIDER, |
33
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
4767 "", |
62
2be5174bdb5d
Sync with latest DW code. Tab and RGB fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
4768 WS_VISIBLE | SLS_READONLY |
2be5174bdb5d
Sync with latest DW code. Tab and RGB fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
4769 | SLS_RIBBONSTRIP, |
33
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
4770 0,0,2000,1000, |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
4771 NULLHANDLE, |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
4772 HWND_TOP, |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
4773 id, |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
4774 NULL, |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
4775 NULL); |
94
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
4776 blah->oldproc = WinSubclassWindow(tmp, _percentproc); |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
4777 WinSetWindowPtr(tmp, QWP_USER, blah); |
180
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
4778 dw_window_disable(tmp); |
33
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
4779 return tmp; |
3 | 4780 } |
4781 | |
4782 /* | |
4783 * Create a new checkbox window (widget) to be packed. | |
4784 * Parameters: | |
4785 * 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:
276
diff
changeset
|
4786 * id: An ID to be used with dw_window_from_id() or 0L. |
3 | 4787 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
4788 HWND API dw_checkbox_new(char *text, ULONG id) |
3 | 4789 { |
90
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
4790 BubbleButton *bubble = calloc(sizeof(BubbleButton), 1); |
3 | 4791 HWND tmp = WinCreateWindow(HWND_OBJECT, |
4792 WC_BUTTON, | |
4793 text, | |
4794 WS_VISIBLE | BS_AUTOCHECKBOX, | |
4795 0,0,2000,1000, | |
4796 NULLHANDLE, | |
4797 HWND_TOP, | |
4798 id, | |
4799 NULL, | |
4800 NULL); | |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
4801 bubble->id = id; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
4802 bubble->bubbletext[0] = '\0'; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
4803 bubble->pOldProc = WinSubclassWindow(tmp, _BtProc); |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
4804 WinSetWindowPtr(tmp, QWP_USER, bubble); |
180
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
4805 dw_window_set_font(tmp, DefaultFont); |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
4806 dw_window_set_color(tmp, DW_CLR_BLACK, DW_CLR_PALEGRAY); |
3 | 4807 return tmp; |
4808 } | |
4809 | |
4810 /* | |
4811 * Create a new listbox window (widget) to be packed. | |
4812 * Parameters: | |
278
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4813 * id: An ID to be used with dw_window_from_id() or 0L. |
3 | 4814 * multi: Multiple select TRUE or FALSE. |
4815 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
4816 HWND API dw_listbox_new(ULONG id, int multi) |
3 | 4817 { |
90
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
4818 WindowData *blah = calloc(sizeof(WindowData), 1); |
3 | 4819 HWND tmp = WinCreateWindow(HWND_OBJECT, |
4820 WC_LISTBOX, | |
4821 NULL, | |
4822 WS_VISIBLE | LS_NOADJUSTPOS | | |
4823 (multi ? LS_MULTIPLESEL : 0), | |
4824 0,0,2000,1000, | |
4825 NULLHANDLE, | |
4826 HWND_TOP, | |
500
fe12a72bfddf
Added a GlobalID which should allow code written on GTK or Windows to work
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
499
diff
changeset
|
4827 id ? id : (GlobalID++), |
3 | 4828 NULL, |
4829 NULL); | |
180
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
4830 blah->oldproc = WinSubclassWindow(tmp, _entryproc); |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
4831 WinSetWindowPtr(tmp, QWP_USER, blah); |
3 | 4832 dw_window_set_font(tmp, DefaultFont); |
159
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
4833 dw_window_set_color(tmp, DW_CLR_BLACK, DW_CLR_WHITE); |
3 | 4834 return tmp; |
4835 } | |
4836 | |
4837 /* | |
4838 * Sets the icon used for a given window. | |
4839 * Parameters: | |
4840 * handle: Handle to the window. | |
4841 * id: An ID to be used to specify the icon. | |
4842 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
4843 void API dw_window_set_icon(HWND handle, ULONG id) |
3 | 4844 { |
336
a2f72b5d5d0a
Minor change to dw_window_set_icon() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
328
diff
changeset
|
4845 HPOINTER icon = id < 65536 ? WinLoadPointer(HWND_DESKTOP,NULLHANDLE,id) : (HPOINTER)id; |
3 | 4846 WinSendMsg(handle, WM_SETICON, (MPARAM)icon, 0); |
4847 } | |
4848 | |
278
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4849 /* Internal function to load a bitmap from a file and return handles |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4850 * to the bitmap, presentation space etc. |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4851 */ |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4852 int _load_bitmap_file(char *file, HWND handle, HBITMAP *hbm, HDC *hdc, HPS *hps, unsigned long *width, unsigned long *height) |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4853 { |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4854 HFILE BitmapFileHandle = NULLHANDLE; /* handle for the file */ |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4855 ULONG OpenAction = 0; |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4856 PBYTE BitmapFileBegin; /* pointer to the first byte of bitmap data */ |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4857 FILESTATUS BitmapStatus; |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4858 ULONG cbRead; |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4859 PBITMAPFILEHEADER2 pBitmapFileHeader; |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4860 PBITMAPINFOHEADER2 pBitmapInfoHeader; |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4861 ULONG ScanLines, ulFlags; |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4862 HPS hps1; |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4863 HDC hdc1; |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4864 SIZEL sizl = { 0, 0 }; |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4865 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4866 /* open bitmap file */ |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4867 DosOpen(file, &BitmapFileHandle, &OpenAction, 0L, |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4868 FILE_ARCHIVED | FILE_NORMAL | FILE_READONLY, |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4869 OPEN_ACTION_FAIL_IF_NEW | OPEN_ACTION_OPEN_IF_EXISTS, |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4870 OPEN_SHARE_DENYNONE | OPEN_ACCESS_READONLY | |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4871 OPEN_FLAGS_NOINHERIT, 0L); |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4872 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4873 if(!BitmapFileHandle) |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4874 return 0; |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4875 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4876 /* find out how big the file is */ |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4877 DosQueryFileInfo(BitmapFileHandle, 1, &BitmapStatus, |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4878 sizeof(BitmapStatus)); |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4879 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4880 /* allocate memory to load the bitmap */ |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4881 DosAllocMem((PPVOID)&BitmapFileBegin, (ULONG)BitmapStatus.cbFile, |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4882 PAG_READ | PAG_WRITE | PAG_COMMIT); |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4883 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4884 /* read bitmap file into memory buffer */ |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4885 DosRead(BitmapFileHandle, (PVOID)BitmapFileBegin, |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4886 BitmapStatus.cbFile, &cbRead); |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4887 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4888 /* access first bytes as bitmap header */ |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4889 pBitmapFileHeader = (PBITMAPFILEHEADER2)BitmapFileBegin; |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4890 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4891 /* check if it's a valid bitmap data file */ |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4892 if((pBitmapFileHeader->usType != BFT_BITMAPARRAY) && |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4893 (pBitmapFileHeader->usType != BFT_BMAP)) |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4894 { |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4895 /* free memory of bitmap file buffer */ |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4896 DosFreeMem(BitmapFileBegin); |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4897 /* close the bitmap file */ |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4898 DosClose(BitmapFileHandle); |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4899 return 0; |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4900 } |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4901 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4902 /* check if it's a file with multiple bitmaps */ |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4903 if(pBitmapFileHeader->usType == BFT_BITMAPARRAY) |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4904 { |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4905 /* we'll just use the first bitmap and ignore the others */ |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4906 pBitmapFileHeader = &(((PBITMAPARRAYFILEHEADER2)BitmapFileBegin)->bfh2); |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4907 } |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4908 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4909 /* set pointer to bitmap information block */ |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4910 pBitmapInfoHeader = &pBitmapFileHeader->bmp2; |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4911 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4912 /* find out if it's the new 2.0 format or the old format */ |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4913 /* and query number of lines */ |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4914 if(pBitmapInfoHeader->cbFix == sizeof(BITMAPINFOHEADER)) |
365
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
4915 { |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
4916 *height = ScanLines = (ULONG)((PBITMAPINFOHEADER)pBitmapInfoHeader)->cy; |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
4917 *width = (ULONG)((PBITMAPINFOHEADER)pBitmapInfoHeader)->cx; |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
4918 } |
278
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4919 else |
365
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
4920 { |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
4921 *height = ScanLines = pBitmapInfoHeader->cy; |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
4922 *width = pBitmapInfoHeader->cx; |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
4923 } |
278
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4924 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4925 /* now we need a presentation space, get it from static control */ |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4926 hps1 = WinGetPS(handle); |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4927 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4928 hdc1 = GpiQueryDevice(hps1); |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4929 ulFlags = GpiQueryPS(hps1, &sizl); |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4930 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4931 *hdc = DevOpenDC(dwhab, OD_MEMORY, "*", 0L, NULL, hdc1); |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4932 *hps = GpiCreatePS (dwhab, *hdc, &sizl, ulFlags | GPIA_ASSOC); |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4933 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4934 /* create bitmap now using the parameters from the info block */ |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4935 *hbm = GpiCreateBitmap(*hps, pBitmapInfoHeader, 0L, NULL, NULL); |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4936 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4937 /* select the new bitmap into presentation space */ |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4938 GpiSetBitmap(*hps, *hbm); |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4939 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4940 /* now copy the bitmap data into the bitmap */ |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4941 GpiSetBitmapBits(*hps, 0L, ScanLines, |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4942 BitmapFileBegin + pBitmapFileHeader->offBits, |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4943 (PBITMAPINFO2)pBitmapInfoHeader); |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4944 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4945 WinReleasePS(hps1); |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4946 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4947 /* free memory of bitmap file buffer */ |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4948 DosFreeMem(BitmapFileBegin); |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4949 /* close the bitmap file */ |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4950 DosClose(BitmapFileHandle); |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4951 return 1; |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4952 } |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4953 |
3 | 4954 /* |
4955 * Sets the bitmap used for a given static window. | |
4956 * Parameters: | |
4957 * 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:
276
diff
changeset
|
4958 * 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:
276
diff
changeset
|
4959 * (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:
276
diff
changeset
|
4960 * 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:
276
diff
changeset
|
4961 * 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:
276
diff
changeset
|
4962 * 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:
276
diff
changeset
|
4963 */ |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4964 void API dw_window_set_bitmap(HWND handle, unsigned long id, char *filename) |
3 | 4965 { |
4966 HBITMAP hbm; | |
278
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4967 HPS hps; |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4968 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4969 /* Destroy any old bitmap data */ |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4970 _free_bitmap(handle); |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4971 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4972 /* If id is non-zero use the resource */ |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4973 if(id) |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4974 { |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4975 hps = WinGetPS(handle); |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4976 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4977 hbm = GpiLoadBitmap(hps, NULLHANDLE, id, 0, 0); |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4978 } |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4979 else if(filename) |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4980 { |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4981 HDC hdc; |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4982 unsigned long width, height; |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4983 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:
276
diff
changeset
|
4984 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4985 if(!file) |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4986 return; |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4987 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4988 strcpy(file, filename); |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4989 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4990 /* 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:
276
diff
changeset
|
4991 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:
276
diff
changeset
|
4992 { |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4993 /* Try with .bmp extention */ |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4994 strcat(file, ".bmp"); |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4995 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:
276
diff
changeset
|
4996 return; |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4997 } |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4998 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4999 if(!_load_bitmap_file(file, handle, &hbm, &hdc, &hps, &width, &height)) |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
5000 return; |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
5001 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
5002 dw_window_set_data(handle, "_dw_hps", (void *)hps); |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
5003 dw_window_set_data(handle, "_dw_hdc", (void *)hdc); |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
5004 dw_window_set_data(handle, "_dw_width", (void *)width); |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
5005 dw_window_set_data(handle, "_dw_height", (void *)height); |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
5006 } |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
5007 else |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
5008 return; |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
5009 |
3 | 5010 WinSetWindowBits(handle,QWL_STYLE,SS_BITMAP,SS_BITMAP | 0x7f); |
5011 WinSendMsg( handle, SM_SETHANDLE, MPFROMP(hbm), NULL ); | |
278
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
5012 if(id) |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
5013 WinReleasePS(hps); |
235
69f2a59ec7d0
Delete associated bitmaps when destroying windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
230
diff
changeset
|
5014 dw_window_set_data(handle, "_dw_bitmap", (void *)hbm); |
3 | 5015 } |
5016 | |
5017 /* | |
5018 * Sets the text used for a given window. | |
5019 * Parameters: | |
5020 * handle: Handle to the window. | |
5021 * text: The text associsated with a given window. | |
5022 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5023 void API dw_window_set_text(HWND handle, char *text) |
3 | 5024 { |
5025 WinSetWindowText(handle, text); | |
5026 } | |
5027 | |
5028 /* | |
5029 * Gets the text used for a given window. | |
5030 * Parameters: | |
5031 * handle: Handle to the window. | |
5032 * Returns: | |
5033 * text: The text associsated with a given window. | |
5034 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5035 char * API dw_window_get_text(HWND handle) |
3 | 5036 { |
172
0fc45e386376
Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
171
diff
changeset
|
5037 int len = WinQueryWindowTextLength(handle); |
0fc45e386376
Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
171
diff
changeset
|
5038 char *tempbuf = calloc(1, len + 2); |
0fc45e386376
Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
171
diff
changeset
|
5039 |
0fc45e386376
Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
171
diff
changeset
|
5040 WinQueryWindowText(handle, len + 1, tempbuf); |
0fc45e386376
Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
171
diff
changeset
|
5041 |
0fc45e386376
Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
171
diff
changeset
|
5042 return tempbuf; |
3 | 5043 } |
5044 | |
5045 /* | |
5046 * Disables given window (widget). | |
5047 * Parameters: | |
5048 * handle: Handle to the window. | |
5049 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5050 void API dw_window_disable(HWND handle) |
3 | 5051 { |
159
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
5052 char tmpbuf[100]; |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
5053 |
166
fb2987817924
Optimize disabling of controls... if already disabled do nothing.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
161
diff
changeset
|
5054 if(dw_window_get_data(handle, "_dw_disabled")) |
fb2987817924
Optimize disabling of controls... if already disabled do nothing.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
161
diff
changeset
|
5055 return; |
fb2987817924
Optimize disabling of controls... if already disabled do nothing.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
161
diff
changeset
|
5056 |
159
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
5057 WinQueryClassName(handle, 99, tmpbuf); |
166
fb2987817924
Optimize disabling of controls... if already disabled do nothing.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
161
diff
changeset
|
5058 dw_window_set_data(handle, "_dw_disabled", (void *)1); |
159
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
5059 |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
5060 if(tmpbuf[0] == '#') |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
5061 { |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
5062 int val = atoi(&tmpbuf[1]); |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
5063 HWND hwnd; |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
5064 |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
5065 switch(val) |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
5066 { |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
5067 case 2: |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
5068 case 6: |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
5069 case 10: |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
5070 case 32: |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
5071 case 7: |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
5072 hwnd = _find_entryfield(handle); |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
5073 _dw_window_set_color(hwnd ? hwnd : handle, DW_CLR_BLACK, DW_CLR_PALEGRAY); |
307
324587c06cea
Use the signal #defines internally so all that is required to change
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
306
diff
changeset
|
5074 dw_signal_connect(hwnd ? hwnd : handle, DW_SIGNAL_KEY_PRESS, DW_SIGNAL_FUNC(_null_key), (void *)100); |
160
76bc6b4e8b79
Don't allow comboboxes to drop down when disabled.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
159
diff
changeset
|
5075 if(val == 2) |
307
324587c06cea
Use the signal #defines internally so all that is required to change
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
306
diff
changeset
|
5076 dw_signal_connect(handle, DW_SIGNAL_BUTTON_PRESS, DW_SIGNAL_FUNC(_null_key), (void *)100); |
159
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
5077 if(hwnd) |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
5078 dw_window_set_data(hwnd, "_dw_disabled", (void *)1); |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
5079 return; |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
5080 case 3: |
367
f19440c0ff71
Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
366
diff
changeset
|
5081 if(dw_window_get_data(handle, "_dw_bitmapbutton") && !dw_window_get_data(handle, "_dw_hpixmap")) |
f19440c0ff71
Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
366
diff
changeset
|
5082 WinEnableWindow(handle, FALSE); |
f19440c0ff71
Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
366
diff
changeset
|
5083 else if(dw_window_get_data(handle, "_dw_bitmapbutton") && dw_window_get_data(handle, "_dw_hpixmap_disabled")) |
f19440c0ff71
Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
366
diff
changeset
|
5084 WinInvalidateRect(handle, NULL, FALSE); |
f19440c0ff71
Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
366
diff
changeset
|
5085 else |
f19440c0ff71
Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
366
diff
changeset
|
5086 _dw_window_set_color(handle, DW_CLR_DARKGRAY, DW_CLR_PALEGRAY); |
307
324587c06cea
Use the signal #defines internally so all that is required to change
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
306
diff
changeset
|
5087 dw_signal_connect(handle, DW_SIGNAL_KEY_PRESS, DW_SIGNAL_FUNC(_null_key), (void *)100); |
324587c06cea
Use the signal #defines internally so all that is required to change
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
306
diff
changeset
|
5088 dw_signal_connect(handle, DW_SIGNAL_BUTTON_PRESS, DW_SIGNAL_FUNC(_null_key), (void *)100); |
159
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
5089 return; |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
5090 } |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
5091 } |
3 | 5092 WinEnableWindow(handle, FALSE); |
5093 } | |
5094 | |
5095 /* | |
5096 * Enables given window (widget). | |
5097 * Parameters: | |
5098 * handle: Handle to the window. | |
5099 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5100 void API dw_window_enable(HWND handle) |
3 | 5101 { |
159
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
5102 ULONG fore = (ULONG)dw_window_get_data(handle, "_dw_fore"); |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
5103 ULONG back = (ULONG)dw_window_get_data(handle, "_dw_back"); |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
5104 HWND hwnd = _find_entryfield(handle); |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
5105 |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
5106 dw_window_set_data(handle, "_dw_disabled", 0); |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
5107 if(hwnd) |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
5108 dw_window_set_data(hwnd, "_dw_disabled", 0); |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
5109 if(fore && back) |
228
326e114923cf
Deal with the enhanced window enable/disable with the new color code
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
225
diff
changeset
|
5110 _dw_window_set_color(hwnd ? hwnd : handle, fore-1, back-1); |
159
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
5111 dw_signal_disconnect_by_data(handle, (void *)100); |
3 | 5112 WinEnableWindow(handle, TRUE); |
367
f19440c0ff71
Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
366
diff
changeset
|
5113 if(dw_window_get_data(handle, "_dw_bitmapbutton") && dw_window_get_data(handle, "_dw_hpixmap_disabled")) |
f19440c0ff71
Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
366
diff
changeset
|
5114 WinInvalidateRect(handle, NULL, FALSE); |
3 | 5115 } |
5116 | |
5117 /* | |
5118 * Gets the child window handle with specified ID. | |
5119 * Parameters: | |
5120 * handle: Handle to the parent window. | |
5121 * id: Integer ID of the child. | |
5122 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5123 HWND API dw_window_from_id(HWND handle, int id) |
3 | 5124 { |
5125 HENUM henum; | |
5126 HWND child; | |
5127 char tmpbuf[100]; | |
5128 | |
5129 henum = WinBeginEnumWindows(handle); | |
5130 while((child = WinGetNextWindow(henum)) != NULLHANDLE) | |
5131 { | |
5132 int windowid = WinQueryWindowUShort(child, QWS_ID); | |
5133 HWND found; | |
5134 | |
5135 WinQueryClassName(child, 99, tmpbuf); | |
5136 | |
5137 /* If the child is a box (frame) then recurse into it */ | |
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
|
5138 if(strncmp(tmpbuf, "#1", 3)==0) |
3 | 5139 if((found = dw_window_from_id(child, id)) != NULLHANDLE) |
5140 return found; | |
5141 | |
5142 if(windowid && windowid == id) | |
5143 { | |
5144 WinEndEnumWindows(henum); | |
5145 return child; | |
5146 } | |
5147 } | |
5148 WinEndEnumWindows(henum); | |
5149 return NULLHANDLE; | |
5150 } | |
5151 | |
5152 /* | |
5153 * Pack windows (widgets) into a box from the end (or bottom). | |
5154 * Parameters: | |
5155 * box: Window handle of the box to be packed into. | |
5156 * item: Window handle of the item to be back. | |
5157 * width: Width in pixels of the item or -1 to be self determined. | |
5158 * height: Height in pixels of the item or -1 to be self determined. | |
5159 * hsize: TRUE if the window (widget) should expand horizontally to fill space given. | |
5160 * vsize: TRUE if the window (widget) should expand vertically to fill space given. | |
5161 * pad: Number of pixels of padding around the item. | |
5162 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5163 void API dw_box_pack_end(HWND box, HWND item, int width, int height, int hsize, int vsize, int pad) |
3 | 5164 { |
5165 Box *thisbox; | |
462
9d874ce0124a
Removed obsolete code from dw_box_pack_* and from dw_file_browse().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
458
diff
changeset
|
5166 char *funcname = "dw_box_pack_end()"; |
3 | 5167 |
447
5a0779561d0f
Add more tests for dw_pac*() functions. Throw up a messagebox if you try and
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
438
diff
changeset
|
5168 /* |
5a0779561d0f
Add more tests for dw_pac*() functions. Throw up a messagebox if you try and
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
438
diff
changeset
|
5169 * 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:
438
diff
changeset
|
5170 * 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:
438
diff
changeset
|
5171 */ |
5a0779561d0f
Add more tests for dw_pac*() functions. Throw up a messagebox if you try and
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
438
diff
changeset
|
5172 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:
438
diff
changeset
|
5173 { |
462
9d874ce0124a
Removed obsolete code from dw_box_pack_* and from dw_file_browse().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
458
diff
changeset
|
5174 dw_messagebox(funcname, DW_MB_OK|DW_MB_ERROR, "Danger! Danger! Will Robinson; box and item are the same!",box,item); |
447
5a0779561d0f
Add more tests for dw_pac*() functions. Throw up a messagebox if you try and
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
438
diff
changeset
|
5175 return; |
5a0779561d0f
Add more tests for dw_pac*() functions. Throw up a messagebox if you try and
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
438
diff
changeset
|
5176 } |
5a0779561d0f
Add more tests for dw_pac*() functions. Throw up a messagebox if you try and
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
438
diff
changeset
|
5177 |
3 | 5178 if(WinWindowFromID(box, FID_CLIENT)) |
5179 { | |
5180 box = WinWindowFromID(box, FID_CLIENT); | |
5181 thisbox = WinQueryWindowPtr(box, QWP_USER); | |
5182 hsize = TRUE; | |
5183 vsize = TRUE; | |
5184 } | |
5185 else | |
5186 thisbox = WinQueryWindowPtr(box, QWP_USER); | |
462
9d874ce0124a
Removed obsolete code from dw_box_pack_* and from dw_file_browse().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
458
diff
changeset
|
5187 if(thisbox) |
9d874ce0124a
Removed obsolete code from dw_box_pack_* and from dw_file_browse().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
458
diff
changeset
|
5188 { |
9d874ce0124a
Removed obsolete code from dw_box_pack_* and from dw_file_browse().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
458
diff
changeset
|
5189 if(thisbox->type == DW_HORZ) |
9d874ce0124a
Removed obsolete code from dw_box_pack_* and from dw_file_browse().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
458
diff
changeset
|
5190 _dw_box_pack_start(box, item, width, height, hsize, vsize, pad, funcname); |
9d874ce0124a
Removed obsolete code from dw_box_pack_* and from dw_file_browse().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
458
diff
changeset
|
5191 else |
9d874ce0124a
Removed obsolete code from dw_box_pack_* and from dw_file_browse().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
458
diff
changeset
|
5192 _dw_box_pack_end(box, item, width, height, hsize, vsize, pad, funcname); |
9d874ce0124a
Removed obsolete code from dw_box_pack_* and from dw_file_browse().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
458
diff
changeset
|
5193 } |
9d874ce0124a
Removed obsolete code from dw_box_pack_* and from dw_file_browse().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
458
diff
changeset
|
5194 } |
9d874ce0124a
Removed obsolete code from dw_box_pack_* and from dw_file_browse().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
458
diff
changeset
|
5195 |
9d874ce0124a
Removed obsolete code from dw_box_pack_* and from dw_file_browse().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
458
diff
changeset
|
5196 void _dw_box_pack_end(HWND box, HWND item, int width, int height, int hsize, int vsize, int pad, char *functionname) |
9d874ce0124a
Removed obsolete code from dw_box_pack_* and from dw_file_browse().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
458
diff
changeset
|
5197 { |
9d874ce0124a
Removed obsolete code from dw_box_pack_* and from dw_file_browse().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
458
diff
changeset
|
5198 Box *thisbox = WinQueryWindowPtr(box, QWP_USER); |
9d874ce0124a
Removed obsolete code from dw_box_pack_* and from dw_file_browse().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
458
diff
changeset
|
5199 |
3 | 5200 if(thisbox) |
5201 { | |
5202 int z; | |
5203 Item *tmpitem, *thisitem = thisbox->items; | |
5204 char tmpbuf[100]; | |
405
4c084ec3e176
Ok, so that last fix has some problems, this new fix is a hybrid of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
404
diff
changeset
|
5205 HWND frame = (HWND)dw_window_get_data(item, "_dw_combo_box"); |
3 | 5206 |
5207 tmpitem = malloc(sizeof(Item)*(thisbox->count+1)); | |
5208 | |
5209 for(z=0;z<thisbox->count;z++) | |
5210 { | |
5211 tmpitem[z] = thisitem[z]; | |
5212 } | |
5213 | |
5214 WinQueryClassName(item, 99, tmpbuf); | |
5215 | |
298
caed245ea8a1
Sanity check, if expand is set width/height can't be zero... force it to 1.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
293
diff
changeset
|
5216 if(vsize && !height) |
caed245ea8a1
Sanity check, if expand is set width/height can't be zero... force it to 1.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
293
diff
changeset
|
5217 height = 1; |
caed245ea8a1
Sanity check, if expand is set width/height can't be zero... force it to 1.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
293
diff
changeset
|
5218 if(hsize && !width) |
caed245ea8a1
Sanity check, if expand is set width/height can't be zero... force it to 1.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
293
diff
changeset
|
5219 width = 1; |
caed245ea8a1
Sanity check, if expand is set width/height can't be zero... force it to 1.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
293
diff
changeset
|
5220 |
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
|
5221 if(strncmp(tmpbuf, "#1", 3)==0) |
3 | 5222 tmpitem[thisbox->count].type = TYPEBOX; |
5223 else | |
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
|
5224 { |
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
|
5225 if ( width == 0 && hsize == FALSE ) |
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
|
5226 dw_messagebox(functionname, DW_MB_OK|DW_MB_ERROR, "Width and expand Horizonal both unset for box: %x item: %x",box,item); |
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
|
5227 if ( height == 0 && vsize == FALSE ) |
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
|
5228 dw_messagebox(functionname, DW_MB_OK|DW_MB_ERROR, "Height and expand Vertical both unset for box: %x item: %x",box,item); |
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
|
5229 |
3 | 5230 tmpitem[thisbox->count].type = TYPEITEM; |
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
|
5231 } |
3 | 5232 |
5233 tmpitem[thisbox->count].hwnd = item; | |
5234 tmpitem[thisbox->count].origwidth = tmpitem[thisbox->count].width = width; | |
5235 tmpitem[thisbox->count].origheight = tmpitem[thisbox->count].height = height; | |
5236 tmpitem[thisbox->count].pad = pad; | |
5237 if(hsize) | |
5238 tmpitem[thisbox->count].hsize = SIZEEXPAND; | |
5239 else | |
5240 tmpitem[thisbox->count].hsize = SIZESTATIC; | |
5241 | |
5242 if(vsize) | |
5243 tmpitem[thisbox->count].vsize = SIZEEXPAND; | |
5244 else | |
5245 tmpitem[thisbox->count].vsize = SIZESTATIC; | |
5246 | |
5247 thisbox->items = tmpitem; | |
5248 | |
5249 if(thisbox->count) | |
5250 free(thisitem); | |
5251 | |
5252 thisbox->count++; | |
5253 | |
37
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
5254 /* Don't set the ownership if it's an entryfield or spinbutton */ |
3 | 5255 WinQueryClassName(item, 99, tmpbuf); |
408
fecd529ba9d4
Use dW_box_new() instead of WinCreateWindow() to make the container window
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
406
diff
changeset
|
5256 if(strncmp(tmpbuf, "#6", 3)!=0 && strncmp(tmpbuf, "#32", 4)!=0 && strncmp(tmpbuf, "#2", 3)!=0) |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
5257 WinSetOwner(item, box); |
405
4c084ec3e176
Ok, so that last fix has some problems, this new fix is a hybrid of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
404
diff
changeset
|
5258 WinSetParent(frame ? frame : item, box, FALSE); |
3 | 5259 } |
5260 } | |
5261 | |
5262 /* | |
5263 * Sets the size of a given window (widget). | |
5264 * Parameters: | |
5265 * handle: Window (widget) handle. | |
5266 * width: New width in pixels. | |
5267 * height: New height in pixels. | |
5268 */ | |
510
710f82598210
Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
508
diff
changeset
|
5269 void API dw_window_set_size(HWND handle, ULONG width, ULONG height) |
3 | 5270 { |
5271 WinSetWindowPos(handle, NULLHANDLE, 0, 0, width, height, SWP_SHOW | SWP_SIZE); | |
5272 } | |
5273 | |
5274 /* | |
5275 * Returns the width of the screen. | |
5276 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5277 int API dw_screen_width(void) |
3 | 5278 { |
5279 return WinQuerySysValue(HWND_DESKTOP,SV_CXSCREEN); | |
5280 } | |
5281 | |
5282 /* | |
5283 * Returns the height of the screen. | |
5284 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5285 int API dw_screen_height(void) |
3 | 5286 { |
5287 return WinQuerySysValue(HWND_DESKTOP,SV_CYSCREEN); | |
5288 } | |
5289 | |
5290 /* 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
|
5291 unsigned long API dw_color_depth_get(void) |
3 | 5292 { |
5293 HDC hdc = WinOpenWindowDC(HWND_DESKTOP); | |
5294 long colors; | |
5295 | |
5296 DevQueryCaps(hdc, CAPS_COLOR_BITCOUNT, 1, &colors); | |
5297 DevCloseDC(hdc); | |
5298 return colors; | |
5299 } | |
5300 | |
5301 | |
5302 /* | |
5303 * Sets the position of a given window (widget). | |
5304 * Parameters: | |
5305 * handle: Window (widget) handle. | |
5306 * x: X location from the bottom left. | |
5307 * y: Y location from the bottom left. | |
5308 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5309 void API dw_window_set_pos(HWND handle, ULONG x, ULONG y) |
3 | 5310 { |
5311 int myy = _get_frame_height(handle) - (y + _get_height(handle)); | |
5312 | |
5313 WinSetWindowPos(handle, NULLHANDLE, x, myy, 0, 0, SWP_MOVE); | |
5314 } | |
5315 | |
5316 /* | |
5317 * Sets the position and size of a given window (widget). | |
5318 * Parameters: | |
5319 * handle: Window (widget) handle. | |
5320 * x: X location from the bottom left. | |
5321 * y: Y location from the bottom left. | |
5322 * width: Width of the widget. | |
5323 * height: Height of the widget. | |
5324 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5325 void API dw_window_set_pos_size(HWND handle, ULONG x, ULONG y, ULONG width, ULONG height) |
3 | 5326 { |
5327 int myy = _get_frame_height(handle) - (y + height); | |
5328 | |
5329 WinSetWindowPos(handle, NULLHANDLE, x, myy, width, height, SWP_MOVE | SWP_SIZE | SWP_SHOW); | |
5330 } | |
5331 | |
5332 /* | |
5333 * Gets the position and size of a given window (widget). | |
5334 * Parameters: | |
5335 * handle: Window (widget) handle. | |
5336 * x: X location from the bottom left. | |
5337 * y: Y location from the bottom left. | |
5338 * width: Width of the widget. | |
5339 * height: Height of the widget. | |
5340 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5341 void API dw_window_get_pos_size(HWND handle, ULONG *x, ULONG *y, ULONG *width, ULONG *height) |
3 | 5342 { |
5343 SWP swp; | |
5344 WinQueryWindowPos(handle, &swp); | |
5345 if(x) | |
5346 *x = swp.x; | |
5347 if(y) | |
5348 *y = _get_frame_height(handle) - (swp.y + swp.cy); | |
5349 if(width) | |
5350 *width = swp.cx; | |
5351 if(height) | |
5352 *height = swp.cy; | |
5353 } | |
5354 | |
5355 /* | |
5356 * Sets the style of a given window (widget). | |
5357 * Parameters: | |
5358 * handle: Window (widget) handle. | |
5359 * width: New width in pixels. | |
5360 * height: New height in pixels. | |
5361 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5362 void API dw_window_set_style(HWND handle, ULONG style, ULONG mask) |
3 | 5363 { |
5364 WinSetWindowBits(handle, QWL_STYLE, style, mask); | |
5365 } | |
5366 | |
5367 /* | |
5368 * Adds a new page to specified notebook. | |
5369 * Parameters: | |
5370 * handle: Window (widget) handle. | |
5371 * flags: Any additional page creation flags. | |
5372 * front: If TRUE page is added at the beginning. | |
5373 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5374 unsigned long API dw_notebook_page_new(HWND handle, ULONG flags, int front) |
3 | 5375 { |
5376 return (ULONG)WinSendMsg(handle, BKM_INSERTPAGE, 0L, | |
347
0137c30f485e
Simplified dw_notebook_page_new code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
346
diff
changeset
|
5377 MPFROM2SHORT((BKA_STATUSTEXTON | BKA_AUTOPAGESIZE | BKA_MAJOR | flags), front ? BKA_FIRST : BKA_LAST)); |
3 | 5378 } |
5379 | |
5380 /* | |
5381 * Remove a page from a notebook. | |
5382 * Parameters: | |
5383 * handle: Handle to the notebook widget. | |
5384 * pageid: ID of the page to be destroyed. | |
5385 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5386 void API dw_notebook_page_destroy(HWND handle, unsigned int pageid) |
3 | 5387 { |
5388 WinSendMsg(handle, BKM_DELETEPAGE, | |
5389 MPFROMLONG(pageid), (MPARAM)BKA_SINGLE); | |
5390 } | |
5391 | |
5392 /* | |
5393 * Queries the currently visible page ID. | |
5394 * Parameters: | |
5395 * handle: Handle to the notebook widget. | |
5396 */ | |
510
710f82598210
Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
508
diff
changeset
|
5397 unsigned long API dw_notebook_page_get(HWND handle) |
346
81fae15885d7
Implemented switch-page on OS/2, and changed the signal prototype to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
342
diff
changeset
|
5398 { |
81fae15885d7
Implemented switch-page on OS/2, and changed the signal prototype to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
342
diff
changeset
|
5399 return (unsigned long)WinSendMsg(handle, BKM_QUERYPAGEID,0L, MPFROM2SHORT(BKA_TOP, BKA_MAJOR)); |
3 | 5400 } |
5401 | |
5402 /* | |
5403 * Sets the currently visibale page ID. | |
5404 * Parameters: | |
5405 * handle: Handle to the notebook widget. | |
5406 * pageid: ID of the page to be made visible. | |
5407 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5408 void API dw_notebook_page_set(HWND handle, unsigned int pageid) |
3 | 5409 { |
5410 WinSendMsg(handle, BKM_TURNTOPAGE, MPFROMLONG(pageid), 0L); | |
5411 } | |
5412 | |
5413 /* | |
5414 * Sets the text on the specified notebook tab. | |
5415 * Parameters: | |
5416 * handle: Notebook handle. | |
5417 * pageid: Page ID of the tab to set. | |
5418 * text: Pointer to the text to set. | |
5419 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5420 void API dw_notebook_page_set_text(HWND handle, ULONG pageid, char *text) |
3 | 5421 { |
5422 WinSendMsg(handle, BKM_SETTABTEXT, | |
5423 MPFROMLONG(pageid), MPFROMP(text)); | |
5424 } | |
5425 | |
5426 /* | |
5427 * Sets the text on the specified notebook tab status area. | |
5428 * Parameters: | |
5429 * handle: Notebook handle. | |
5430 * pageid: Page ID of the tab to set. | |
5431 * text: Pointer to the text to set. | |
5432 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5433 void API dw_notebook_page_set_status_text(HWND handle, ULONG pageid, char *text) |
3 | 5434 { |
5435 WinSendMsg(handle, BKM_SETSTATUSLINETEXT, | |
5436 MPFROMLONG(pageid), MPFROMP(text)); | |
5437 } | |
5438 | |
5439 /* | |
5440 * Packs the specified box into the notebook page. | |
5441 * Parameters: | |
5442 * handle: Handle to the notebook to be packed. | |
5443 * pageid: Page ID in the notebook which is being packed. | |
5444 * page: Box handle to be packed. | |
5445 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5446 void API dw_notebook_pack(HWND handle, ULONG pageid, HWND page) |
3 | 5447 { |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
5448 HWND tmpbox = dw_box_new(DW_VERT, 0); |
3 | 5449 |
5450 dw_box_pack_start(tmpbox, page, 0, 0, TRUE, TRUE, 0); | |
5451 WinSubclassWindow(tmpbox, _wndproc); | |
5452 WinSendMsg(handle, BKM_SETPAGEWINDOWHWND, | |
5453 MPFROMLONG(pageid), MPFROMHWND(tmpbox)); | |
5454 } | |
5455 | |
5456 /* | |
5457 * Appends the specified text to the listbox's (or combobox) entry list. | |
5458 * Parameters: | |
5459 * handle: Handle to the listbox to be appended to. | |
5460 * text: Text to append into listbox. | |
5461 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5462 void API dw_listbox_append(HWND handle, char *text) |
3 | 5463 { |
5464 WinSendMsg(handle, | |
5465 LM_INSERTITEM, | |
5466 MPFROMSHORT(LIT_END), | |
5467 MPFROMP(text)); | |
5468 } | |
5469 | |
5470 /* | |
5471 * Clears the listbox's (or combobox) list of all entries. | |
5472 * Parameters: | |
5473 * handle: Handle to the listbox to be cleared. | |
5474 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5475 void API dw_listbox_clear(HWND handle) |
3 | 5476 { |
5477 WinSendMsg(handle, | |
5478 LM_DELETEALL, 0L, 0L); | |
5479 } | |
5480 | |
5481 /* | |
5482 * Returns the listbox's item count. | |
5483 * Parameters: | |
5484 * handle: Handle to the listbox to be cleared. | |
5485 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5486 int API dw_listbox_count(HWND handle) |
3 | 5487 { |
5488 return (int)WinSendMsg(handle, | |
5489 LM_QUERYITEMCOUNT,0L, 0L); | |
5490 } | |
5491 | |
5492 /* | |
5493 * Sets the topmost item in the viewport. | |
5494 * Parameters: | |
5495 * handle: Handle to the listbox to be cleared. | |
5496 * top: Index to the top item. | |
5497 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5498 void API dw_listbox_set_top(HWND handle, int top) |
3 | 5499 { |
5500 WinSendMsg(handle, | |
5501 LM_SETTOPINDEX, | |
5502 MPFROMSHORT(top), | |
5503 0L); | |
5504 } | |
5505 | |
5506 /* | |
5507 * Copies the given index item's text into buffer. | |
5508 * Parameters: | |
5509 * handle: Handle to the listbox to be queried. | |
5510 * index: Index into the list to be queried. | |
5511 * buffer: Buffer where text will be copied. | |
5512 * length: Length of the buffer (including NULL). | |
5513 */ | |
510
710f82598210
Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
508
diff
changeset
|
5514 void API dw_listbox_get_text(HWND handle, unsigned int index, char *buffer, unsigned int length) |
3 | 5515 { |
5516 WinSendMsg(handle, LM_QUERYITEMTEXT, MPFROM2SHORT(index, length), (MPARAM)buffer); | |
5517 } | |
5518 | |
5519 /* | |
5520 * Sets the text of a given listbox entry. | |
5521 * Parameters: | |
5522 * handle: Handle to the listbox to be queried. | |
5523 * index: Index into the list to be queried. | |
5524 * buffer: Buffer where text will be copied. | |
5525 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5526 void API dw_listbox_set_text(HWND handle, unsigned int index, char *buffer) |
3 | 5527 { |
5528 WinSendMsg(handle, LM_SETITEMTEXT, MPFROMSHORT(index), (MPARAM)buffer); | |
5529 } | |
5530 | |
5531 /* | |
5532 * Returns the index to the item in the list currently selected. | |
5533 * Parameters: | |
5534 * handle: Handle to the listbox to be queried. | |
5535 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5536 unsigned int API dw_listbox_selected(HWND handle) |
3 | 5537 { |
5538 return (unsigned int)WinSendMsg(handle, | |
18
f1002d51d959
Fixed a container problem on OS/2 with separator set to 0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
16
diff
changeset
|
5539 LM_QUERYSELECTION, |
f1002d51d959
Fixed a container problem on OS/2 with separator set to 0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
16
diff
changeset
|
5540 MPFROMSHORT(LIT_CURSOR), |
f1002d51d959
Fixed a container problem on OS/2 with separator set to 0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
16
diff
changeset
|
5541 0); |
3 | 5542 } |
5543 | |
5544 /* | |
5545 * Returns the index to the current selected item or -1 when done. | |
5546 * Parameters: | |
5547 * handle: Handle to the listbox to be queried. | |
5548 * where: Either the previous return or -1 to restart. | |
5549 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5550 int API dw_listbox_selected_multi(HWND handle, int where) |
3 | 5551 { |
5552 int place = where; | |
5553 | |
5554 if(where == -1) | |
5555 place = LIT_FIRST; | |
5556 | |
5557 place = (int)WinSendMsg(handle, | |
5558 LM_QUERYSELECTION, | |
5559 MPFROMSHORT(place),0L); | |
5560 if(place == LIT_NONE) | |
5561 return -1; | |
5562 return place; | |
5563 } | |
5564 | |
5565 /* | |
5566 * Sets the selection state of a given index. | |
5567 * Parameters: | |
5568 * handle: Handle to the listbox to be set. | |
5569 * index: Item index. | |
5570 * state: TRUE if selected FALSE if unselected. | |
5571 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5572 void API dw_listbox_select(HWND handle, int index, int state) |
3 | 5573 { |
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
|
5574 char tmpbuf[100]; |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
5575 |
3 | 5576 WinSendMsg(handle, LM_SELECTITEM, MPFROMSHORT(index), (MPARAM)state); |
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
|
5577 |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
5578 WinQueryClassName(handle, 99, tmpbuf); |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
5579 |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
5580 /* If we are setting a combobox call the event handler manually */ |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
5581 if(strncmp(tmpbuf, "#6", 3)==0) |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
5582 _run_event(handle, WM_CONTROL, MPFROM2SHORT(0, LN_SELECT), (MPARAM)handle); |
3 | 5583 } |
5584 | |
5585 /* | |
5586 * Deletes the item with given index from the list. | |
5587 * Parameters: | |
5588 * handle: Handle to the listbox to be set. | |
5589 * index: Item index. | |
5590 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5591 void API dw_listbox_delete(HWND handle, int index) |
3 | 5592 { |
5593 WinSendMsg(handle, LM_DELETEITEM, MPFROMSHORT(index), 0); | |
5594 } | |
5595 | |
5596 /* | |
5597 * Adds text to an MLE box and returns the current point. | |
5598 * Parameters: | |
5599 * handle: Handle to the MLE to be queried. | |
5600 * buffer: Text buffer to be imported. | |
5601 * startpoint: Point to start entering text. | |
5602 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5603 unsigned int API dw_mle_import(HWND handle, char *buffer, int startpoint) |
3 | 5604 { |
5605 unsigned long point = startpoint; | |
5606 PBYTE mlebuf; | |
5607 | |
5608 /* Work around 64K limit */ | |
5609 if(!DosAllocMem((PPVOID) &mlebuf, 65536, PAG_COMMIT | PAG_READ | PAG_WRITE | OBJ_TILE)) | |
5610 { | |
5611 int amount, len = strlen(buffer), written = 0; | |
5612 | |
5613 while(written < len) | |
5614 { | |
5615 if((len - written) > 65535) | |
5616 amount = 65535; | |
5617 else | |
5618 amount = len - written; | |
5619 | |
5620 memcpy(mlebuf, &buffer[written], amount); | |
5621 mlebuf[amount] = '\0'; | |
5622 | |
5623 WinSendMsg(handle, MLM_SETIMPORTEXPORT, MPFROMP(mlebuf), MPFROMLONG(amount+1)); | |
5624 WinSendMsg(handle, MLM_IMPORT, MPFROMP(&point), MPFROMLONG(amount + 1)); | |
5625 dw_mle_delete(handle, point, 1); | |
5626 | |
5627 written += amount; | |
5628 } | |
5629 DosFreeMem(mlebuf); | |
5630 } | |
5631 return point - 1; | |
5632 } | |
5633 | |
5634 /* | |
5635 * Grabs text from an MLE box. | |
5636 * Parameters: | |
5637 * handle: Handle to the MLE to be queried. | |
5638 * buffer: Text buffer to be exported. | |
5639 * startpoint: Point to start grabbing text. | |
5640 * length: Amount of text to be grabbed. | |
5641 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5642 void API dw_mle_export(HWND handle, char *buffer, int startpoint, int length) |
3 | 5643 { |
5644 PBYTE mlebuf; | |
5645 | |
5646 /* Work around 64K limit */ | |
5647 if(!DosAllocMem((PPVOID) &mlebuf, 65535, PAG_COMMIT | PAG_READ | PAG_WRITE | OBJ_TILE)) | |
5648 { | |
5649 int amount, copied, written = 0; | |
5650 | |
5651 while(written < length) | |
5652 { | |
5653 if((length - written) > 65535) | |
5654 amount = 65535; | |
5655 else | |
5656 amount = length - written; | |
5657 | |
5658 WinSendMsg(handle, MLM_SETIMPORTEXPORT, MPFROMP(mlebuf), MPFROMLONG(amount)); | |
5659 copied = (int)WinSendMsg(handle, MLM_EXPORT, MPFROMP(&startpoint), MPFROMLONG(&amount)); | |
5660 | |
5661 if(copied) | |
5662 { | |
5663 memcpy(&buffer[written], mlebuf, copied); | |
5664 | |
5665 written += copied; | |
5666 } | |
5667 else | |
5668 break; | |
5669 } | |
5670 DosFreeMem(mlebuf); | |
5671 } | |
5672 } | |
5673 | |
5674 /* | |
5675 * Obtains information about an MLE box. | |
5676 * Parameters: | |
5677 * handle: Handle to the MLE to be queried. | |
5678 * bytes: A pointer to a variable to return the total bytes. | |
5679 * lines: A pointer to a variable to return the number of lines. | |
5680 */ | |
510
710f82598210
Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
508
diff
changeset
|
5681 void API dw_mle_get_size(HWND handle, unsigned long *bytes, unsigned long *lines) |
3 | 5682 { |
5683 if(bytes) | |
5684 *bytes = (unsigned long)WinSendMsg(handle, MLM_QUERYTEXTLENGTH, 0, 0); | |
5685 if(lines) | |
5686 *lines = (unsigned long)WinSendMsg(handle, MLM_QUERYLINECOUNT, 0, 0); | |
5687 } | |
5688 | |
5689 /* | |
5690 * Deletes text from an MLE box. | |
5691 * Parameters: | |
5692 * handle: Handle to the MLE to be deleted from. | |
5693 * startpoint: Point to start deleting text. | |
5694 * length: Amount of text to be deleted. | |
5695 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5696 void API dw_mle_delete(HWND handle, int startpoint, int length) |
3 | 5697 { |
5698 char *buf = malloc(length+1); | |
5699 int z, dellen = length; | |
5700 | |
5701 dw_mle_export(handle, buf, startpoint, length); | |
5702 | |
5703 for(z=0;z<length-1;z++) | |
5704 { | |
5705 if(strncmp(&buf[z], "\r\n", 2) == 0) | |
5706 dellen--; | |
5707 } | |
5708 WinSendMsg(handle, MLM_DELETE, MPFROMLONG(startpoint), MPFROMLONG(dellen)); | |
5709 free(buf); | |
5710 } | |
5711 | |
5712 /* | |
5713 * Clears all text from an MLE box. | |
5714 * Parameters: | |
5715 * handle: Handle to the MLE to be cleared. | |
5716 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5717 void API dw_mle_clear(HWND handle) |
3 | 5718 { |
5719 unsigned long bytes; | |
5720 | |
510
710f82598210
Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
508
diff
changeset
|
5721 dw_mle_get_size(handle, &bytes, NULL); |
3 | 5722 |
5723 WinSendMsg(handle, MLM_DELETE, MPFROMLONG(0), MPFROMLONG(bytes)); | |
5724 } | |
5725 | |
5726 /* | |
5727 * Sets the visible line of an MLE box. | |
5728 * Parameters: | |
5729 * handle: Handle to the MLE to be positioned. | |
5730 * line: Line to be visible. | |
5731 */ | |
513
7755599311d4
Fixes search and replace errors.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
511
diff
changeset
|
5732 void API dw_mle_set_visible(HWND handle, int line) |
3 | 5733 { |
153
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
5734 int tmppnt = (int)WinSendMsg(handle, MLM_CHARFROMLINE, MPFROMLONG(line), 0); |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
5735 WinSendMsg(handle, MLM_SETSEL, MPFROMLONG(tmppnt), MPFROMLONG(tmppnt)); |
3 | 5736 } |
5737 | |
5738 /* | |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
5739 * Sets the editablity of an MLE box. |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
5740 * Parameters: |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
5741 * handle: Handle to the MLE. |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
5742 * 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
|
5743 */ |
513
7755599311d4
Fixes search and replace errors.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
511
diff
changeset
|
5744 void API dw_mle_set_editable(HWND handle, int state) |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
5745 { |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
5746 WinSendMsg(handle, MLM_SETREADONLY, MPFROMLONG(state ? FALSE : TRUE), 0); |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
5747 } |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
5748 |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
5749 /* |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
5750 * Sets the word wrap state of an MLE box. |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
5751 * Parameters: |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
5752 * handle: Handle to the MLE. |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
5753 * 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
|
5754 */ |
513
7755599311d4
Fixes search and replace errors.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
511
diff
changeset
|
5755 void API 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
|
5756 { |
16
ca7a8215487a
Removed structure packing option to fix a crash in dw_mle_search() when
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
15
diff
changeset
|
5757 WinSendMsg(handle, MLM_SETWRAP, MPFROMLONG(state), 0); |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
5758 } |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
5759 |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
5760 /* |
3 | 5761 * Sets the current cursor position of an MLE box. |
5762 * Parameters: | |
5763 * handle: Handle to the MLE to be positioned. | |
5764 * point: Point to position cursor. | |
5765 */ | |
510
710f82598210
Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
508
diff
changeset
|
5766 void API dw_mle_set_cursor(HWND handle, int point) |
3 | 5767 { |
5768 WinSendMsg(handle, MLM_SETSEL, MPFROMLONG(point), MPFROMLONG(point)); | |
5769 } | |
5770 | |
5771 /* | |
5772 * Finds text in an MLE box. | |
5773 * Parameters: | |
5774 * handle: Handle to the MLE to be cleared. | |
5775 * text: Text to search for. | |
5776 * point: Start point of search. | |
5777 * flags: Search specific flags. | |
5778 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5779 int API dw_mle_search(HWND handle, char *text, int point, unsigned long flags) |
3 | 5780 { |
5781 MLE_SEARCHDATA msd; | |
5782 | |
16
ca7a8215487a
Removed structure packing option to fix a crash in dw_mle_search() when
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
15
diff
changeset
|
5783 /* This code breaks with structure packing set to 1 (/Sp1 in VAC) |
ca7a8215487a
Removed structure packing option to fix a crash in dw_mle_search() when
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
15
diff
changeset
|
5784 * if this is needed we need to add a pragma here. |
ca7a8215487a
Removed structure packing option to fix a crash in dw_mle_search() when
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
15
diff
changeset
|
5785 */ |
3 | 5786 msd.cb = sizeof(msd); |
5787 msd.pchFind = text; | |
5788 msd.pchReplace = NULL; | |
5789 msd.cchFind = strlen(text); | |
5790 msd.cchReplace = 0; | |
5791 msd.iptStart = point; | |
5792 msd.iptStop = -1; | |
5793 | |
5794 if(WinSendMsg(handle, MLM_SEARCH, MPFROMLONG(MLFSEARCH_SELECTMATCH | flags), (MPARAM)&msd)) | |
5795 return (int)WinSendMsg(handle, MLM_QUERYSEL,(MPARAM)MLFQS_MAXSEL, 0); | |
5796 return 0; | |
5797 } | |
5798 | |
5799 /* | |
5800 * Stops redrawing of an MLE box. | |
5801 * Parameters: | |
5802 * handle: Handle to the MLE to freeze. | |
5803 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5804 void API dw_mle_freeze(HWND handle) |
3 | 5805 { |
5806 WinSendMsg(handle, MLM_DISABLEREFRESH, 0, 0); | |
5807 } | |
5808 | |
5809 /* | |
5810 * Resumes redrawing of an MLE box. | |
5811 * Parameters: | |
5812 * handle: Handle to the MLE to thaw. | |
5813 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5814 void API dw_mle_thaw(HWND handle) |
3 | 5815 { |
5816 WinSendMsg(handle, MLM_ENABLEREFRESH, 0, 0); | |
5817 } | |
5818 | |
5819 /* | |
33
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
5820 * Returns the range of the percent bar. |
3 | 5821 * Parameters: |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
5822 * handle: Handle to the percent bar to be queried. |
3 | 5823 */ |
510
710f82598210
Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
508
diff
changeset
|
5824 unsigned int API dw_percent_get_range(HWND handle) |
33
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
5825 { |
62
2be5174bdb5d
Sync with latest DW code. Tab and RGB fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
5826 return SHORT2FROMMP(WinSendMsg(handle, SLM_QUERYSLIDERINFO, MPFROM2SHORT(SMA_SLIDERARMPOSITION,SMA_RANGEVALUE), 0)); |
3 | 5827 } |
5828 | |
5829 /* | |
33
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
5830 * Sets the percent bar position. |
3 | 5831 * Parameters: |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
5832 * 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:
62
diff
changeset
|
5833 * position: Position of the percent bar withing the range. |
3 | 5834 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5835 void API dw_percent_set_pos(HWND handle, unsigned int position) |
33
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
5836 { |
94
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
5837 _dw_int_set(handle, position); |
62
2be5174bdb5d
Sync with latest DW code. Tab and RGB fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
5838 WinSendMsg(handle, SLM_SETSLIDERINFO, MPFROM2SHORT(SMA_SLIDERARMPOSITION,SMA_RANGEVALUE), (MPARAM)position); |
3 | 5839 } |
5840 | |
5841 /* | |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
5842 * 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:
62
diff
changeset
|
5843 * Parameters: |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
5844 * 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:
62
diff
changeset
|
5845 */ |
510
710f82598210
Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
508
diff
changeset
|
5846 unsigned int API 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:
62
diff
changeset
|
5847 { |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
5848 return (unsigned int)WinSendMsg(handle, SLM_QUERYSLIDERINFO, MPFROM2SHORT(SMA_SLIDERARMPOSITION, SMA_INCREMENTVALUE), 0); |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
5849 } |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
5850 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
5851 /* |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
5852 * Sets the slider position. |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
5853 * Parameters: |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
5854 * 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:
62
diff
changeset
|
5855 * 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:
62
diff
changeset
|
5856 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5857 void API dw_slider_set_pos(HWND handle, unsigned int position) |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
5858 { |
94
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
5859 dw_window_set_data(handle, "_dw_slider_value", (void *)position); |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
5860 WinSendMsg(handle, SLM_SETSLIDERINFO, MPFROM2SHORT(SMA_SLIDERARMPOSITION, SMA_INCREMENTVALUE), (MPARAM)position); |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
5861 } |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
5862 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
5863 /* |
195
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
5864 * Returns the position of the scrollbar. |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
5865 * Parameters: |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
5866 * 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:
192
diff
changeset
|
5867 */ |
510
710f82598210
Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
508
diff
changeset
|
5868 unsigned int API 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:
192
diff
changeset
|
5869 { |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
5870 return (unsigned int)WinSendMsg(handle, SBM_QUERYPOS, 0, 0); |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
5871 } |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
5872 |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
5873 /* |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
5874 * Sets the scrollbar position. |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
5875 * Parameters: |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
5876 * 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:
192
diff
changeset
|
5877 * 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:
192
diff
changeset
|
5878 */ |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
5879 void API 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:
192
diff
changeset
|
5880 { |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
5881 dw_window_set_data(handle, "_dw_scrollbar_value", (void *)position); |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
5882 WinSendMsg(handle, SBM_SETPOS, (MPARAM)position, 0); |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
5883 } |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
5884 |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
5885 /* |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
5886 * Sets the scrollbar range. |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
5887 * Parameters: |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
5888 * 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:
192
diff
changeset
|
5889 * range: Maximum range value. |
203
e0beea487e8f
Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
199
diff
changeset
|
5890 * visible: Visible area relative to the range. |
e0beea487e8f
Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
199
diff
changeset
|
5891 */ |
e0beea487e8f
Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
199
diff
changeset
|
5892 void API dw_scrollbar_set_range(HWND handle, unsigned int range, unsigned int visible) |
195
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
5893 { |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
5894 unsigned int pos = (unsigned int)dw_window_get_data(handle, "_dw_scrollbar_value"); |
203
e0beea487e8f
Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
199
diff
changeset
|
5895 WinSendMsg(handle, SBM_SETSCROLLBAR, (MPARAM)pos, MPFROM2SHORT(0, (unsigned short)range - visible)); |
e0beea487e8f
Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
199
diff
changeset
|
5896 WinSendMsg(handle, SBM_SETTHUMBSIZE, MPFROM2SHORT((unsigned short)visible, range), 0); |
212
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
5897 dw_window_set_data(handle, "_dw_scrollbar_visible", (void *)visible); |
195
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
5898 } |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
5899 |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
5900 /* |
3 | 5901 * Sets the spinbutton value. |
5902 * Parameters: | |
5903 * handle: Handle to the spinbutton to be set. | |
5904 * position: Current value of the spinbutton. | |
5905 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5906 void API dw_spinbutton_set_pos(HWND handle, long position) |
3 | 5907 { |
5908 WinSendMsg(handle, SPBM_SETCURRENTVALUE, MPFROMLONG((long)position), 0L); | |
5909 } | |
5910 | |
5911 /* | |
5912 * Sets the spinbutton limits. | |
5913 * Parameters: | |
5914 * handle: Handle to the spinbutton to be set. | |
5915 * upper: Upper limit. | |
5916 * lower: Lower limit. | |
5917 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5918 void API dw_spinbutton_set_limits(HWND handle, long upper, long lower) |
3 | 5919 { |
5920 WinSendMsg(handle, SPBM_SETLIMITS, MPFROMLONG(upper), MPFROMLONG(lower)); | |
5921 } | |
5922 | |
5923 /* | |
5924 * Sets the entryfield character limit. | |
5925 * Parameters: | |
5926 * handle: Handle to the spinbutton to be set. | |
5927 * limit: Number of characters the entryfield will take. | |
5928 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5929 void API dw_entryfield_set_limit(HWND handle, ULONG limit) |
3 | 5930 { |
5931 WinSendMsg(handle, EM_SETTEXTLIMIT, (MPARAM)limit, (MPARAM)0); | |
5932 } | |
5933 | |
5934 | |
5935 /* | |
5936 * Returns the current value of the spinbutton. | |
5937 * Parameters: | |
5938 * handle: Handle to the spinbutton to be queried. | |
5939 */ | |
510
710f82598210
Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
508
diff
changeset
|
5940 long API dw_spinbutton_get_pos(HWND handle) |
3 | 5941 { |
5942 long tmpval = 0L; | |
5943 | |
5944 WinSendMsg(handle, SPBM_QUERYVALUE, (MPARAM)&tmpval,0L); | |
5945 return tmpval; | |
5946 } | |
5947 | |
5948 /* | |
5949 * Returns the state of the checkbox. | |
5950 * Parameters: | |
5951 * handle: Handle to the checkbox to be queried. | |
5952 */ | |
510
710f82598210
Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
508
diff
changeset
|
5953 int API dw_checkbox_get(HWND handle) |
3 | 5954 { |
5955 return (int)WinSendMsg(handle,BM_QUERYCHECK,0,0); | |
5956 } | |
5957 | |
5958 /* | |
5959 * Sets the state of the checkbox. | |
5960 * Parameters: | |
5961 * handle: Handle to the checkbox to be queried. | |
5962 * value: TRUE for checked, FALSE for unchecked. | |
5963 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5964 void API dw_checkbox_set(HWND handle, int value) |
3 | 5965 { |
5966 WinSendMsg(handle,BM_SETCHECK,MPFROMSHORT(value),0); | |
5967 } | |
5968 | |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5969 /* |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
5970 * Inserts an item into a tree window (widget) after another item. |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5971 * Parameters: |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5972 * handle: Handle to the tree to be inserted. |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
5973 * item: Handle to the item to be positioned after. |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5974 * 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:
21
diff
changeset
|
5975 * 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:
21
diff
changeset
|
5976 * 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
|
5977 * itemdata: Item specific data. |
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
|
5978 */ |
328
e00aff2b899e
Tree item handles are now of the type HTREEITEM instead of HWND since they
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
326
diff
changeset
|
5979 HTREEITEM API dw_tree_insert_after(HWND handle, HTREEITEM item, 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:
21
diff
changeset
|
5980 { |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5981 ULONG cbExtra; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5982 PCNRITEM pci; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5983 RECORDINSERT ri; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5984 |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
5985 if(!item) |
328
e00aff2b899e
Tree item handles are now of the type HTREEITEM instead of HWND since they
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
326
diff
changeset
|
5986 item = (HTREEITEM)CMA_FIRST; |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
5987 |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5988 /* Calculate extra bytes needed for each record besides that needed for the |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5989 * MINIRECORDCORE structure |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5990 */ |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5991 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5992 cbExtra = sizeof(CNRITEM) - sizeof(MINIRECORDCORE); |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5993 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5994 /* Allocate memory for the parent record */ |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5995 |
476
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
5996 if((pci = (PCNRITEM)_dw_send_msg(handle, CM_ALLOCRECORD, MPFROMLONG(cbExtra), MPFROMSHORT(1), 0)) == 0) |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
5997 return 0; |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5998 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5999 /* Fill in the parent record data */ |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6000 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6001 pci->rc.cb = sizeof(MINIRECORDCORE); |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
6002 pci->rc.pszIcon = strdup(title); |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6003 pci->rc.hptrIcon = icon; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6004 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6005 pci->hptrIcon = 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
|
6006 pci->user = itemdata; |
478
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
6007 pci->parent = parent; |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6008 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6009 memset(&ri, 0, sizeof(RECORDINSERT)); |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6010 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6011 ri.cb = sizeof(RECORDINSERT); |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
6012 ri.pRecordOrder = (PRECORDCORE)item; |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6013 ri.zOrder = (USHORT)CMA_TOP; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6014 ri.cRecordsInsert = 1; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6015 ri.fInvalidateRecord = TRUE; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6016 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6017 /* We are about to insert the child records. Set the parent record to be |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6018 * the one we just inserted. |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6019 */ |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6020 ri.pRecordParent = (PRECORDCORE)parent; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6021 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6022 /* Insert the record */ |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6023 WinSendMsg(handle, CM_INSERTRECORD, MPFROMP(pci), MPFROMP(&ri)); |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6024 |
328
e00aff2b899e
Tree item handles are now of the type HTREEITEM instead of HWND since they
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
326
diff
changeset
|
6025 return (HTREEITEM)pci; |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6026 } |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6027 |
30
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
6028 /* |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
6029 * Inserts an item into a tree window (widget). |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
6030 * Parameters: |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
6031 * handle: Handle to the tree to be inserted. |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
6032 * title: The text title of the entry. |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
6033 * icon: Handle to coresponding icon. |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
6034 * parent: Parent handle or 0 if root. |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
6035 * itemdata: Item specific data. |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
6036 */ |
328
e00aff2b899e
Tree item handles are now of the type HTREEITEM instead of HWND since they
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
326
diff
changeset
|
6037 HTREEITEM API dw_tree_insert(HWND handle, char *title, unsigned long icon, HTREEITEM parent, void *itemdata) |
e00aff2b899e
Tree item handles are now of the type HTREEITEM instead of HWND since they
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
326
diff
changeset
|
6038 { |
e00aff2b899e
Tree item handles are now of the type HTREEITEM instead of HWND since they
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
326
diff
changeset
|
6039 return dw_tree_insert_after(handle, (HTREEITEM)CMA_END, title, icon, parent, itemdata); |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
6040 } |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
6041 |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
6042 /* |
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
|
6043 * 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
|
6044 * 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
|
6045 * 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
|
6046 * 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
|
6047 * 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
|
6048 * 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
|
6049 */ |
510
710f82598210
Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
508
diff
changeset
|
6050 void API 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
|
6051 { |
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
|
6052 PCNRITEM pci = (PCNRITEM)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
|
6053 |
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
|
6054 if(!pci) |
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
|
6055 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
|
6056 |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
6057 if(pci->rc.pszIcon) |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
6058 free(pci->rc.pszIcon); |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
6059 |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
6060 pci->rc.pszIcon = strdup(title); |
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
|
6061 pci->rc.hptrIcon = 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
|
6062 |
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
|
6063 pci->hptrIcon = 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
|
6064 |
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
|
6065 WinSendMsg(handle, CM_INVALIDATERECORD, (MPARAM)&pci, MPFROM2SHORT(1, CMA_TEXTCHANGED)); |
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
|
6066 } |
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
|
6067 |
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
|
6068 /* |
478
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
6069 * 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:
477
diff
changeset
|
6070 * Parameters: |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
6071 * 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:
477
diff
changeset
|
6072 * 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:
477
diff
changeset
|
6073 */ |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
6074 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:
477
diff
changeset
|
6075 { |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
6076 PCNRITEM pci = (PCNRITEM)item; |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
6077 |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
6078 handle = handle; /* keep compiler happy */ |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
6079 if(pci) |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
6080 return pci->rc.pszIcon; |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
6081 return NULL; |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
6082 } |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
6083 |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
6084 /* |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
6085 * 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:
477
diff
changeset
|
6086 * Parameters: |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
6087 * 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:
477
diff
changeset
|
6088 * 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:
477
diff
changeset
|
6089 */ |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
6090 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:
477
diff
changeset
|
6091 { |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
6092 PCNRITEM pci = (PCNRITEM)item; |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
6093 |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
6094 handle = handle; /* keep compiler happy */ |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
6095 if(pci) |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
6096 return pci->parent; |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
6097 return (HTREEITEM)0; |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
6098 } |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
6099 |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
6100 /* |
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
|
6101 * 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
|
6102 * 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
|
6103 * 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
|
6104 * 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
|
6105 * 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
|
6106 */ |
513
7755599311d4
Fixes search and replace errors.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
511
diff
changeset
|
6107 void API 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
|
6108 { |
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
|
6109 PCNRITEM pci = (PCNRITEM)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
|
6110 |
475
1547e8c327d9
Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
470
diff
changeset
|
6111 handle = handle; /* keep compiler happy */ |
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
|
6112 if(!pci) |
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
|
6113 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
|
6114 |
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
|
6115 pci->user = itemdata; |
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
|
6116 } |
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
|
6117 |
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
|
6118 /* |
317
83edbd751da9
Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
315
diff
changeset
|
6119 * 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:
315
diff
changeset
|
6120 * Parameters: |
83edbd751da9
Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
315
diff
changeset
|
6121 * 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:
315
diff
changeset
|
6122 * 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:
315
diff
changeset
|
6123 */ |
510
710f82598210
Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
508
diff
changeset
|
6124 void * API 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:
315
diff
changeset
|
6125 { |
83edbd751da9
Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
315
diff
changeset
|
6126 PCNRITEM pci = (PCNRITEM)item; |
83edbd751da9
Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
315
diff
changeset
|
6127 |
475
1547e8c327d9
Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
470
diff
changeset
|
6128 handle = handle; /* keep compiler happy */ |
317
83edbd751da9
Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
315
diff
changeset
|
6129 if(!pci) |
83edbd751da9
Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
315
diff
changeset
|
6130 return NULL; |
83edbd751da9
Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
315
diff
changeset
|
6131 return pci->user; |
83edbd751da9
Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
315
diff
changeset
|
6132 } |
83edbd751da9
Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
315
diff
changeset
|
6133 |
83edbd751da9
Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
315
diff
changeset
|
6134 /* |
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
|
6135 * 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
|
6136 * 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
|
6137 * 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
|
6138 * 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
|
6139 */ |
328
e00aff2b899e
Tree item handles are now of the type HTREEITEM instead of HWND since they
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
326
diff
changeset
|
6140 void API 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
|
6141 { |
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
|
6142 PRECORDCORE pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)0L, MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER)); |
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
|
6143 |
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
|
6144 while(pCore) |
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
|
6145 { |
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
|
6146 if(pCore->flRecordAttr & CRA_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
|
6147 WinSendMsg(handle, CM_SETRECORDEMPHASIS, (MPARAM)pCore, MPFROM2SHORT(FALSE, CRA_SELECTED | CRA_CURSORED)); |
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
|
6148 pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)pCore, MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER)); |
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
|
6149 } |
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
|
6150 WinSendMsg(handle, CM_SETRECORDEMPHASIS, (MPARAM)item, MPFROM2SHORT(TRUE, CRA_SELECTED | CRA_CURSORED)); |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
6151 lastitem = 0; |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
6152 lasthcnr = 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
|
6153 } |
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
|
6154 |
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
|
6155 /* |
30
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
6156 * Removes all nodes from a tree. |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
6157 * Parameters: |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
6158 * handle: Handle to the window (widget) to be cleared. |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
6159 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
6160 void API dw_tree_clear(HWND handle) |
30
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
6161 { |
290
8ea5b2c35bfe
Fixed tree memory leak on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
289
diff
changeset
|
6162 dw_container_clear(handle, TRUE); |
30
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
6163 } |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
6164 |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
6165 /* |
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
|
6166 * 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
|
6167 * 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
|
6168 * 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
|
6169 * 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
|
6170 */ |
510
710f82598210
Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
508
diff
changeset
|
6171 void API 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
|
6172 { |
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
|
6173 WinSendMsg(handle, CM_EXPANDTREE, MPFROMP(item), 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
|
6174 } |
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
|
6175 |
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
|
6176 /* |
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
|
6177 * 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
|
6178 * 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
|
6179 * 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
|
6180 * 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
|
6181 */ |
510
710f82598210
Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
508
diff
changeset
|
6182 void API 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
|
6183 { |
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
|
6184 WinSendMsg(handle, CM_COLLAPSETREE, MPFROMP(item), 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
|
6185 } |
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
|
6186 |
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
|
6187 /* |
30
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
6188 * Removes a node from a tree. |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
6189 * Parameters: |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
6190 * handle: Handle to the window (widget) to be cleared. |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
6191 * item: Handle to node to be deleted. |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
6192 */ |
510
710f82598210
Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
508
diff
changeset
|
6193 void API dw_tree_item_delete(HWND handle, HTREEITEM item) |
30
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
6194 { |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
6195 PCNRITEM pci = (PCNRITEM)item; |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
6196 |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
6197 if(!item) |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
6198 return; |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
6199 |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
6200 if(pci->rc.pszIcon) |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
6201 { |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
6202 free(pci->rc.pszIcon); |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
6203 pci->rc.pszIcon = 0; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
6204 } |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
6205 |
30
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
6206 WinSendMsg(handle, CM_REMOVERECORD, (MPARAM)&pci, MPFROM2SHORT(1, CMA_INVALIDATE | CMA_FREE)); |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
6207 } |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
6208 |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6209 /* Some OS/2 specific container structs */ |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6210 typedef struct _containerinfo { |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6211 int count; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6212 void *data; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6213 HWND handle; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6214 } ContainerInfo; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6215 |
3 | 6216 /* |
6217 * Sets up the container columns. | |
6218 * Parameters: | |
6219 * handle: Handle to the container to be configured. | |
6220 * flags: An array of unsigned longs with column flags. | |
6221 * titles: An array of strings with column text titles. | |
6222 * count: The number of columns (this should match the arrays). | |
6223 * separator: The column number that contains the main separator. | |
6224 * (this item may only be used in OS/2) | |
6225 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
6226 int API dw_container_setup(HWND handle, unsigned long *flags, char **titles, int count, int separator) |
3 | 6227 { |
6228 PFIELDINFO details, first, left = NULL; | |
6229 FIELDINFOINSERT detin; | |
6230 CNRINFO cnri; | |
6231 int z; | |
6232 ULONG size = sizeof(RECORDCORE); | |
6233 ULONG *offStruct = malloc(count * sizeof(ULONG)); | |
6234 ULONG *tempflags = malloc((count+1) * sizeof(ULONG)); | |
67
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
6235 WindowData *blah = (WindowData *)WinQueryWindowPtr(handle, QWP_USER); |
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
6236 ULONG *oldflags = blah ? blah->data : 0; |
3 | 6237 |
6238 if(!offStruct || !tempflags) | |
6239 return FALSE; | |
6240 | |
6241 memcpy(tempflags, flags, count * sizeof(ULONG)); | |
6242 tempflags[count] = 0; | |
6243 | |
67
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
6244 blah->data = tempflags; |
70
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
6245 blah->flags = separator; |
3 | 6246 |
6247 if(oldflags) | |
6248 free(oldflags); | |
6249 | |
6250 while((first = (PFIELDINFO)WinSendMsg(handle, CM_QUERYDETAILFIELDINFO, 0, MPFROMSHORT(CMA_FIRST))) != NULL) | |
6251 { | |
6252 WinSendMsg(handle, CM_REMOVEDETAILFIELDINFO, (MPARAM)&first, MPFROM2SHORT(1, CMA_FREE)); | |
6253 } | |
6254 | |
6255 /* Figure out the offsets to the items in the struct */ | |
6256 for(z=0;z<count;z++) | |
6257 { | |
6258 offStruct[z] = size; | |
6259 if(flags[z] & DW_CFA_BITMAPORICON) | |
6260 size += sizeof(HPOINTER); | |
6261 else if(flags[z] & DW_CFA_STRING) | |
6262 size += sizeof(char *); | |
6263 else if(flags[z] & DW_CFA_ULONG) | |
6264 size += sizeof(ULONG); | |
6265 else if(flags[z] & DW_CFA_DATE) | |
6266 size += sizeof(CDATE); | |
6267 else if(flags[z] & DW_CFA_TIME) | |
6268 size += sizeof(CTIME); | |
6269 } | |
6270 | |
6271 first = details = (PFIELDINFO)WinSendMsg(handle, CM_ALLOCDETAILFIELDINFO, MPFROMLONG(count), 0L); | |
6272 | |
6273 if(!first) | |
6274 { | |
6275 free(offStruct); | |
6276 return FALSE; | |
6277 } | |
6278 | |
6279 for(z=0;z<count;z++) | |
6280 { | |
6281 if(z==separator-1) | |
6282 left=details; | |
6283 details->cb = sizeof(FIELDINFO); | |
6284 details->flData = flags[z]; | |
6285 details->flTitle = CFA_FITITLEREADONLY; | |
6286 details->pTitleData = titles[z]; | |
6287 details->offStruct = offStruct[z]; | |
6288 details = details->pNextFieldInfo; | |
6289 } | |
6290 | |
6291 detin.cb = sizeof(FIELDINFOINSERT); | |
6292 detin.fInvalidateFieldInfo = FALSE; | |
6293 detin.pFieldInfoOrder = (PFIELDINFO) CMA_FIRST; | |
6294 detin.cFieldInfoInsert = (ULONG)count; | |
6295 | |
6296 WinSendMsg(handle, CM_INSERTDETAILFIELDINFO, MPFROMP(first), MPFROMP(&detin)); | |
6297 | |
18
f1002d51d959
Fixed a container problem on OS/2 with separator set to 0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
16
diff
changeset
|
6298 if(count > separator && separator > 0) |
3 | 6299 { |
6300 cnri.cb = sizeof(CNRINFO); | |
6301 cnri.pFieldInfoLast = left; | |
6302 cnri.xVertSplitbar = 150; | |
6303 | |
6304 WinSendMsg(handle, CM_SETCNRINFO, MPFROMP(&cnri), MPFROMLONG(CMA_PFIELDINFOLAST | CMA_XVERTSPLITBAR)); | |
6305 } | |
6306 | |
310
77105fe19c1f
Removed obsolete dw_container_set_view() function.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
307
diff
changeset
|
6307 cnri.flWindowAttr = CV_DETAIL | CV_MINI | CA_DETAILSVIEWTITLES; |
77105fe19c1f
Removed obsolete dw_container_set_view() function.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
307
diff
changeset
|
6308 cnri.slBitmapOrIcon.cx = 16; |
77105fe19c1f
Removed obsolete dw_container_set_view() function.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
307
diff
changeset
|
6309 cnri.slBitmapOrIcon.cy = 16; |
77105fe19c1f
Removed obsolete dw_container_set_view() function.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
307
diff
changeset
|
6310 |
77105fe19c1f
Removed obsolete dw_container_set_view() function.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
307
diff
changeset
|
6311 WinSendMsg(handle, CM_SETCNRINFO, &cnri, MPFROMLONG(CMA_FLWINDOWATTR | CMA_SLBITMAPORICON)); |
77105fe19c1f
Removed obsolete dw_container_set_view() function.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
307
diff
changeset
|
6312 |
3 | 6313 free(offStruct); |
6314 return TRUE; | |
6315 } | |
6316 | |
6317 /* | |
6318 * Sets up the filesystem columns, note: filesystem always has an icon/filename field. | |
6319 * Parameters: | |
6320 * handle: Handle to the container to be configured. | |
6321 * flags: An array of unsigned longs with column flags. | |
6322 * titles: An array of strings with column text titles. | |
6323 * count: The number of columns (this should match the arrays). | |
6324 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
6325 int API dw_filesystem_setup(HWND handle, unsigned long *flags, char **titles, int count) |
3 | 6326 { |
6327 char **newtitles = malloc(sizeof(char *) * (count + 2)); | |
6328 unsigned long *newflags = malloc(sizeof(unsigned long) * (count + 2)); | |
6329 | |
6330 newtitles[0] = "Icon"; | |
6331 newtitles[1] = "Filename"; | |
6332 | |
6333 newflags[0] = DW_CFA_BITMAPORICON | DW_CFA_CENTER | DW_CFA_HORZSEPARATOR | DW_CFA_SEPARATOR; | |
6334 newflags[1] = DW_CFA_STRING | DW_CFA_LEFT | DW_CFA_HORZSEPARATOR; | |
6335 | |
6336 memcpy(&newtitles[2], titles, sizeof(char *) * count); | |
6337 memcpy(&newflags[2], flags, sizeof(unsigned long) * count); | |
6338 | |
103
babc1ea53d79
If dw_filesystem_setup is called with 0 additional columns then don't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
97
diff
changeset
|
6339 dw_container_setup(handle, newflags, newtitles, count + 2, count ? 2 : 0); |
3 | 6340 |
6341 free(newtitles); | |
6342 free(newflags); | |
6343 return TRUE; | |
6344 } | |
6345 | |
6346 /* | |
6347 * Obtains an icon from a module (or header in GTK). | |
6348 * Parameters: | |
6349 * module: Handle to module (DLL) in OS/2 and Windows. | |
6350 * id: A unsigned long id int the resources on OS/2 and | |
6351 * Windows, on GTK this is converted to a pointer | |
6352 * to an embedded XPM. | |
6353 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
6354 unsigned long API dw_icon_load(unsigned long module, unsigned long id) |
3 | 6355 { |
6356 return WinLoadPointer(HWND_DESKTOP,module,id); | |
6357 } | |
6358 | |
6359 /* | |
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:
241
diff
changeset
|
6360 * 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:
241
diff
changeset
|
6361 * 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:
241
diff
changeset
|
6362 * 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:
241
diff
changeset
|
6363 * 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:
241
diff
changeset
|
6364 * (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:
241
diff
changeset
|
6365 */ |
9ea4ac9a097f
Added dw_icon_load_from_file() on OS/2 and Windows. Added a stub on Unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
241
diff
changeset
|
6366 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:
241
diff
changeset
|
6367 { |
9ea4ac9a097f
Added dw_icon_load_from_file() on OS/2 and Windows. Added a stub on Unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
241
diff
changeset
|
6368 char *file = alloca(strlen(filename) + 5); |
9ea4ac9a097f
Added dw_icon_load_from_file() on OS/2 and Windows. Added a stub on Unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
241
diff
changeset
|
6369 |
9ea4ac9a097f
Added dw_icon_load_from_file() on OS/2 and Windows. Added a stub on Unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
241
diff
changeset
|
6370 if(!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:
241
diff
changeset
|
6371 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:
241
diff
changeset
|
6372 |
9ea4ac9a097f
Added dw_icon_load_from_file() on OS/2 and Windows. Added a stub on Unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
241
diff
changeset
|
6373 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:
241
diff
changeset
|
6374 |
9ea4ac9a097f
Added dw_icon_load_from_file() on OS/2 and Windows. Added a stub on Unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
241
diff
changeset
|
6375 /* 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:
241
diff
changeset
|
6376 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:
241
diff
changeset
|
6377 { |
9ea4ac9a097f
Added dw_icon_load_from_file() on OS/2 and Windows. Added a stub on Unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
241
diff
changeset
|
6378 /* Try with .bmp extention */ |
9ea4ac9a097f
Added dw_icon_load_from_file() on OS/2 and Windows. Added a stub on Unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
241
diff
changeset
|
6379 strcat(file, ".ico"); |
9ea4ac9a097f
Added dw_icon_load_from_file() on OS/2 and Windows. Added a stub on Unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
241
diff
changeset
|
6380 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:
241
diff
changeset
|
6381 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:
241
diff
changeset
|
6382 } |
9ea4ac9a097f
Added dw_icon_load_from_file() on OS/2 and Windows. Added a stub on Unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
241
diff
changeset
|
6383 return WinLoadFileIcon(file, FALSE); |
9ea4ac9a097f
Added dw_icon_load_from_file() on OS/2 and Windows. Added a stub on Unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
241
diff
changeset
|
6384 } |
9ea4ac9a097f
Added dw_icon_load_from_file() on OS/2 and Windows. Added a stub on Unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
241
diff
changeset
|
6385 |
9ea4ac9a097f
Added dw_icon_load_from_file() on OS/2 and Windows. Added a stub on Unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
241
diff
changeset
|
6386 /* |
3 | 6387 * Frees a loaded resource in OS/2 and Windows. |
6388 * Parameters: | |
6389 * handle: Handle to icon returned by dw_icon_load(). | |
6390 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
6391 void API dw_icon_free(unsigned long handle) |
3 | 6392 { |
6393 WinDestroyPointer(handle); | |
6394 } | |
6395 | |
6396 /* | |
6397 * Allocates memory used to populate a container. | |
6398 * Parameters: | |
6399 * handle: Handle to the container window (widget). | |
6400 * rowcount: The number of items to be populated. | |
6401 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
6402 void * API dw_container_alloc(HWND handle, int rowcount) |
3 | 6403 { |
67
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
6404 WindowData *wd = (WindowData *)WinQueryWindowPtr(handle, QWP_USER); |
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
6405 ULONG *flags = wd ? wd->data : 0; |
3 | 6406 int z, size = 0, totalsize, count = 0; |
6407 PRECORDCORE temp; | |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6408 ContainerInfo *ci; |
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
|
6409 void *blah = NULL; |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
6410 |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
6411 if(!flags || rowcount < 1) |
3 | 6412 return NULL; |
6413 | |
6414 while(flags[count]) | |
6415 count++; | |
6416 | |
6417 /* Figure out the offsets to the items in the struct */ | |
6418 for(z=0;z<count;z++) | |
6419 { | |
6420 if(flags[z] & DW_CFA_BITMAPORICON) | |
6421 size += sizeof(HPOINTER); | |
6422 else if(flags[z] & DW_CFA_STRING) | |
6423 size += sizeof(char *); | |
6424 else if(flags[z] & DW_CFA_ULONG) | |
6425 size += sizeof(ULONG); | |
6426 else if(flags[z] & DW_CFA_DATE) | |
6427 size += sizeof(CDATE); | |
6428 else if(flags[z] & DW_CFA_TIME) | |
6429 size += sizeof(CTIME); | |
6430 } | |
6431 | |
6432 totalsize = size + sizeof(RECORDCORE); | |
6433 | |
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
|
6434 z = 0; |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
6435 |
326
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6436 if(!(blah = (void *)_dw_send_msg(handle, CM_ALLOCRECORD, MPFROMLONG(size), MPFROMLONG(rowcount), 0))) |
3 | 6437 return NULL; |
6438 | |
6439 temp = (PRECORDCORE)blah; | |
6440 | |
6441 for(z=0;z<rowcount;z++) | |
6442 { | |
6443 temp->cb = totalsize; | |
6444 temp = temp->preccNextRecord; | |
6445 } | |
6446 | |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6447 ci = malloc(sizeof(struct _containerinfo)); |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6448 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6449 ci->count = rowcount; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6450 ci->data = blah; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6451 ci->handle = handle; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6452 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6453 return (void *)ci; |
3 | 6454 } |
6455 | |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6456 /* Internal function that does the work for set_item and change_item */ |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6457 void _dw_container_set_item(HWND handle, PRECORDCORE temp, int column, int row, void *data) |
3 | 6458 { |
67
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
6459 WindowData *blah = (WindowData *)WinQueryWindowPtr(handle, QWP_USER); |
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
6460 ULONG totalsize, size = 0, *flags = blah ? blah->data : 0; |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6461 int z, currentcount; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6462 CNRINFO cnr; |
3 | 6463 void *dest; |
6464 | |
6465 if(!flags) | |
6466 return; | |
6467 | |
326
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6468 if(!_dw_send_msg(handle, CM_QUERYCNRINFO, (MPARAM)&cnr, MPFROMSHORT(sizeof(CNRINFO)), 0)) |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6469 return; |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6470 |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6471 currentcount = cnr.cRecords; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6472 |
3 | 6473 /* Figure out the offsets to the items in the struct */ |
6474 for(z=0;z<column;z++) | |
6475 { | |
6476 if(flags[z] & DW_CFA_BITMAPORICON) | |
6477 size += sizeof(HPOINTER); | |
6478 else if(flags[z] & DW_CFA_STRING) | |
6479 size += sizeof(char *); | |
6480 else if(flags[z] & DW_CFA_ULONG) | |
6481 size += sizeof(ULONG); | |
6482 else if(flags[z] & DW_CFA_DATE) | |
6483 size += sizeof(CDATE); | |
6484 else if(flags[z] & DW_CFA_TIME) | |
6485 size += sizeof(CTIME); | |
6486 } | |
6487 | |
6488 totalsize = size + sizeof(RECORDCORE); | |
6489 | |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6490 for(z=0;z<(row-currentcount);z++) |
3 | 6491 temp = temp->preccNextRecord; |
6492 | |
6493 dest = (void *)(((ULONG)temp)+((ULONG)totalsize)); | |
6494 | |
6495 if(flags[column] & DW_CFA_BITMAPORICON) | |
328
e00aff2b899e
Tree item handles are now of the type HTREEITEM instead of HWND since they
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
326
diff
changeset
|
6496 memcpy(dest, data, sizeof(HPOINTER)); |
3 | 6497 else if(flags[column] & DW_CFA_STRING) |
326
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6498 { |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6499 char **newstr = (char **)data, **str = dest; |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6500 |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6501 if(*str) |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6502 free(*str); |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6503 |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6504 if(newstr && *newstr) |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6505 *str = strdup(*newstr); |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6506 else |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6507 *str = NULL; |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6508 } |
3 | 6509 else if(flags[column] & DW_CFA_ULONG) |
328
e00aff2b899e
Tree item handles are now of the type HTREEITEM instead of HWND since they
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
326
diff
changeset
|
6510 memcpy(dest, data, sizeof(ULONG)); |
3 | 6511 else if(flags[column] & DW_CFA_DATE) |
328
e00aff2b899e
Tree item handles are now of the type HTREEITEM instead of HWND since they
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
326
diff
changeset
|
6512 memcpy(dest, data, sizeof(CDATE)); |
3 | 6513 else if(flags[column] & DW_CFA_TIME) |
328
e00aff2b899e
Tree item handles are now of the type HTREEITEM instead of HWND since they
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
326
diff
changeset
|
6514 memcpy(dest, data, sizeof(CTIME)); |
e00aff2b899e
Tree item handles are now of the type HTREEITEM instead of HWND since they
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
326
diff
changeset
|
6515 } |
e00aff2b899e
Tree item handles are now of the type HTREEITEM instead of HWND since they
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
326
diff
changeset
|
6516 |
e00aff2b899e
Tree item handles are now of the type HTREEITEM instead of HWND since they
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
326
diff
changeset
|
6517 /* Internal function that free()s any strings allocated for a container item */ |
326
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6518 void _dw_container_free_strings(HWND handle, PRECORDCORE temp) |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6519 { |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6520 WindowData *blah = (WindowData *)WinQueryWindowPtr(handle, QWP_USER); |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6521 ULONG totalsize, size = 0, *flags = blah ? blah->data : 0; |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6522 int z, count = 0; |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6523 |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6524 if(!flags) |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6525 return; |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6526 |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6527 while(flags[count]) |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6528 count++; |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6529 |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6530 /* Figure out the offsets to the items in the struct */ |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6531 for(z=0;z<count;z++) |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6532 { |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6533 if(flags[z] & DW_CFA_BITMAPORICON) |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6534 size += sizeof(HPOINTER); |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6535 else if(flags[z] & DW_CFA_STRING) |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6536 { |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6537 char **str; |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6538 |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6539 totalsize = size + sizeof(RECORDCORE); |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6540 |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6541 str = (char **)(((ULONG)temp)+((ULONG)totalsize)); |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6542 |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6543 if(*str) |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6544 { |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6545 free(*str); |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6546 *str = NULL; |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6547 } |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6548 size += sizeof(char *); |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6549 } |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6550 else if(flags[z] & DW_CFA_ULONG) |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6551 size += sizeof(ULONG); |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6552 else if(flags[z] & DW_CFA_DATE) |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6553 size += sizeof(CDATE); |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6554 else if(flags[z] & DW_CFA_TIME) |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6555 size += sizeof(CTIME); |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6556 } |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6557 } |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6558 |
3 | 6559 /* |
6560 * Sets an item in specified row and column to the given data. | |
6561 * Parameters: | |
6562 * handle: Handle to the container window (widget). | |
6563 * pointer: Pointer to the allocated memory in dw_container_alloc(). | |
6564 * column: Zero based column of data being set. | |
6565 * row: Zero based row of data being set. | |
6566 * data: Pointer to the data to be added. | |
6567 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
6568 void API dw_container_set_item(HWND handle, void *pointer, int column, int row, void *data) |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6569 { |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6570 ContainerInfo *ci = (ContainerInfo *)pointer; |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6571 |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6572 if(!ci) |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6573 return; |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6574 |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6575 _dw_container_set_item(handle, (PRECORDCORE)ci->data, column, row, data); |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6576 } |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6577 |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6578 /* |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6579 * 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:
166
diff
changeset
|
6580 * Parameters: |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6581 * handle: Handle to the container window (widget). |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6582 * column: Zero based column of data being set. |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6583 * row: Zero based row of data being set. |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6584 * data: Pointer to the data to be added. |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6585 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
6586 void API dw_container_change_item(HWND handle, int column, int row, void *data) |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6587 { |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6588 PRECORDCORE pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)0L, MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER)); |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6589 int count = 0; |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6590 |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6591 while(pCore) |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6592 { |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6593 if(count == row) |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6594 { |
326
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6595 _dw_container_set_item(handle, pCore, column, 0, data); |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6596 WinSendMsg(handle, CM_INVALIDATERECORD, (MPARAM)&pCore, MPFROM2SHORT(1, CMA_NOREPOSITION | CMA_TEXTCHANGED)); |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6597 return; |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6598 } |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6599 pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)pCore, MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER)); |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6600 count++; |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6601 } |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6602 } |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6603 |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6604 /* |
503
f3ed8dda02f8
Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
500
diff
changeset
|
6605 * 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:
500
diff
changeset
|
6606 * Parameters: |
f3ed8dda02f8
Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
500
diff
changeset
|
6607 * 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:
500
diff
changeset
|
6608 * 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:
500
diff
changeset
|
6609 * 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:
500
diff
changeset
|
6610 * 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:
500
diff
changeset
|
6611 */ |
f3ed8dda02f8
Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
500
diff
changeset
|
6612 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:
500
diff
changeset
|
6613 { |
f3ed8dda02f8
Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
500
diff
changeset
|
6614 dw_container_change_item(handle, column + 2, row, data); |
f3ed8dda02f8
Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
500
diff
changeset
|
6615 } |
f3ed8dda02f8
Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
500
diff
changeset
|
6616 |
f3ed8dda02f8
Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
500
diff
changeset
|
6617 /* |
f3ed8dda02f8
Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
500
diff
changeset
|
6618 * 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:
500
diff
changeset
|
6619 * Parameters: |
f3ed8dda02f8
Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
500
diff
changeset
|
6620 * 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:
500
diff
changeset
|
6621 * 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:
500
diff
changeset
|
6622 * 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:
500
diff
changeset
|
6623 * 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:
500
diff
changeset
|
6624 * 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:
500
diff
changeset
|
6625 */ |
f3ed8dda02f8
Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
500
diff
changeset
|
6626 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:
500
diff
changeset
|
6627 { |
f3ed8dda02f8
Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
500
diff
changeset
|
6628 dw_container_change_item(handle, 0, row, (void *)&icon); |
f3ed8dda02f8
Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
500
diff
changeset
|
6629 dw_container_change_item(handle, 1, row, (void *)&filename); |
f3ed8dda02f8
Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
500
diff
changeset
|
6630 } |
f3ed8dda02f8
Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
500
diff
changeset
|
6631 |
f3ed8dda02f8
Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
500
diff
changeset
|
6632 /* |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6633 * Sets an 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:
166
diff
changeset
|
6634 * Parameters: |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6635 * handle: Handle to the container window (widget). |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6636 * pointer: Pointer to the allocated memory in dw_container_alloc(). |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6637 * column: Zero based column of data being set. |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6638 * row: Zero based row of data being set. |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6639 * data: Pointer to the data to be added. |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6640 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
6641 void API dw_filesystem_set_file(HWND handle, void *pointer, int row, char *filename, unsigned long icon) |
3 | 6642 { |
6643 dw_container_set_item(handle, pointer, 0, row, (void *)&icon); | |
6644 dw_container_set_item(handle, pointer, 1, row, (void *)&filename); | |
6645 } | |
6646 | |
6647 /* | |
6648 * Sets an item in specified row and column to the given data. | |
6649 * Parameters: | |
6650 * handle: Handle to the container window (widget). | |
6651 * pointer: Pointer to the allocated memory in dw_container_alloc(). | |
6652 * column: Zero based column of data being set. | |
6653 * row: Zero based row of data being set. | |
6654 * data: Pointer to the data to be added. | |
6655 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
6656 void API dw_filesystem_set_item(HWND handle, void *pointer, int column, int row, void *data) |
3 | 6657 { |
6658 dw_container_set_item(handle, pointer, column + 2, row, data); | |
6659 } | |
6660 | |
6661 /* | |
508
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
507
diff
changeset
|
6662 * 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:
507
diff
changeset
|
6663 * Parameters: |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
507
diff
changeset
|
6664 * 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:
507
diff
changeset
|
6665 * column: Zero based column. |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
507
diff
changeset
|
6666 */ |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
507
diff
changeset
|
6667 int API 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:
507
diff
changeset
|
6668 { |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
507
diff
changeset
|
6669 WindowData *blah = (WindowData *)WinQueryWindowPtr(handle, QWP_USER); |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
507
diff
changeset
|
6670 ULONG *flags = blah ? blah->data : 0; |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
507
diff
changeset
|
6671 int rc; |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
507
diff
changeset
|
6672 |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
507
diff
changeset
|
6673 if(!flags) |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
507
diff
changeset
|
6674 return 0; |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
507
diff
changeset
|
6675 |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
507
diff
changeset
|
6676 if(flags[column] & DW_CFA_BITMAPORICON) |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
507
diff
changeset
|
6677 rc = DW_CFA_BITMAPORICON; |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
507
diff
changeset
|
6678 else if(flags[column] & DW_CFA_STRING) |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
507
diff
changeset
|
6679 rc = DW_CFA_STRING; |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
507
diff
changeset
|
6680 else if(flags[column] & DW_CFA_ULONG) |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
507
diff
changeset
|
6681 rc = DW_CFA_ULONG; |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
507
diff
changeset
|
6682 else if(flags[column] & DW_CFA_DATE) |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
507
diff
changeset
|
6683 rc = DW_CFA_DATE; |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
507
diff
changeset
|
6684 else if(flags[column] & DW_CFA_TIME) |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
507
diff
changeset
|
6685 rc = DW_CFA_TIME; |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
507
diff
changeset
|
6686 else |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
507
diff
changeset
|
6687 rc = 0; |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
507
diff
changeset
|
6688 return rc; |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
507
diff
changeset
|
6689 } |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
507
diff
changeset
|
6690 |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
507
diff
changeset
|
6691 /* |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
507
diff
changeset
|
6692 * 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:
507
diff
changeset
|
6693 * Parameters: |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
507
diff
changeset
|
6694 * 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:
507
diff
changeset
|
6695 * column: Zero based column. |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
507
diff
changeset
|
6696 */ |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
507
diff
changeset
|
6697 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:
507
diff
changeset
|
6698 { |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
507
diff
changeset
|
6699 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:
507
diff
changeset
|
6700 } |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
507
diff
changeset
|
6701 |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
507
diff
changeset
|
6702 /* |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6703 * 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:
21
diff
changeset
|
6704 * Parameters: |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6705 * 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:
21
diff
changeset
|
6706 * 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:
21
diff
changeset
|
6707 * 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:
21
diff
changeset
|
6708 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
6709 void API dw_container_set_column_width(HWND handle, int column, int width) |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6710 { |
475
1547e8c327d9
Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
470
diff
changeset
|
6711 handle = handle; /* keep compiler happy */ |
1547e8c327d9
Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
470
diff
changeset
|
6712 column = column; /* keep compiler happy */ |
1547e8c327d9
Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
470
diff
changeset
|
6713 width = width; /* keep compiler happy */ |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6714 } |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6715 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6716 /* |
3 | 6717 * Sets the title of a row in the container. |
6718 * Parameters: | |
6719 * pointer: Pointer to the allocated memory in dw_container_alloc(). | |
6720 * row: Zero based row of data being set. | |
6721 * title: String title of the item. | |
6722 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
6723 void API dw_container_set_row_title(void *pointer, int row, char *title) |
3 | 6724 { |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6725 ContainerInfo *ci = (ContainerInfo *)pointer; |
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
|
6726 PRECORDCORE temp; |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6727 int z, currentcount; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6728 CNRINFO cnr; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6729 |
23
2932f9d2c7d5
New OS/2 code from FX changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
22
diff
changeset
|
6730 if(!ci) |
2932f9d2c7d5
New OS/2 code from FX changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
22
diff
changeset
|
6731 return; |
2932f9d2c7d5
New OS/2 code from FX changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
22
diff
changeset
|
6732 |
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
|
6733 temp = (PRECORDCORE)ci->data; |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
6734 |
72
ab77a22a2a36
Added localization APIs as well as some miscellaneous bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
70
diff
changeset
|
6735 z = 0; |
ab77a22a2a36
Added localization APIs as well as some miscellaneous bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
70
diff
changeset
|
6736 |
326
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6737 if(!_dw_send_msg(ci->handle, CM_QUERYCNRINFO, (MPARAM)&cnr, MPFROMSHORT(sizeof(CNRINFO)), 0)) |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6738 return; |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6739 |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6740 currentcount = cnr.cRecords; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6741 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6742 for(z=0;z<(row-currentcount);z++) |
3 | 6743 temp = temp->preccNextRecord; |
6744 | |
6745 temp->pszIcon = title; | |
6746 temp->pszName = title; | |
6747 temp->pszText = title; | |
6748 } | |
6749 | |
6750 /* | |
6751 * Sets the title of a row in the container. | |
6752 * Parameters: | |
6753 * handle: Handle to the container window (widget). | |
6754 * pointer: Pointer to the allocated memory in dw_container_alloc(). | |
6755 * rowcount: The number of rows to be inserted. | |
6756 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
6757 void API dw_container_insert(HWND handle, void *pointer, int rowcount) |
3 | 6758 { |
6759 RECORDINSERT recin; | |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6760 ContainerInfo *ci = (ContainerInfo *)pointer; |
3 | 6761 |
23
2932f9d2c7d5
New OS/2 code from FX changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
22
diff
changeset
|
6762 if(!ci) |
2932f9d2c7d5
New OS/2 code from FX changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
22
diff
changeset
|
6763 return; |
2932f9d2c7d5
New OS/2 code from FX changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
22
diff
changeset
|
6764 |
3 | 6765 recin.cb = sizeof(RECORDINSERT); |
6766 recin.pRecordOrder = (PRECORDCORE)CMA_END; | |
6767 recin.pRecordParent = NULL; | |
6768 recin.zOrder = CMA_TOP; | |
6769 recin.fInvalidateRecord = TRUE; | |
6770 recin.cRecordsInsert = rowcount; | |
6771 | |
326
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6772 _dw_send_msg(handle, CM_INSERTRECORD, MPFROMP(ci->data), MPFROMP(&recin), 0); |
69
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6773 |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6774 free(ci); |
3 | 6775 } |
6776 | |
6777 /* | |
6778 * Removes all rows from a container. | |
6779 * Parameters: | |
6780 * 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:
49
diff
changeset
|
6781 * redraw: TRUE to cause the container to redraw immediately. |
0804483f6320
Added a redraw parameter to dw_container_clear().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
49
diff
changeset
|
6782 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
6783 void API dw_container_clear(HWND handle, int redraw) |
3 | 6784 { |
326
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6785 PCNRITEM pCore; |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6786 int container = (int)dw_window_get_data(handle, "_dw_container"); |
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
|
6787 |
315
89eac0990c67
Safer container code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
314
diff
changeset
|
6788 if(hwndEmph == handle) |
89eac0990c67
Safer container code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
314
diff
changeset
|
6789 _clear_emphasis(); |
326
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6790 |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6791 pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)0L, MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER)); |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6792 |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6793 while(pCore) |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6794 { |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6795 if(container) |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6796 _dw_container_free_strings(handle, (PRECORDCORE)pCore); |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6797 else |
290
8ea5b2c35bfe
Fixed tree memory leak on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
289
diff
changeset
|
6798 { |
8ea5b2c35bfe
Fixed tree memory leak on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
289
diff
changeset
|
6799 /* Free icon text */ |
8ea5b2c35bfe
Fixed tree memory leak on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
289
diff
changeset
|
6800 if(pCore->rc.pszIcon) |
8ea5b2c35bfe
Fixed tree memory leak on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
289
diff
changeset
|
6801 { |
8ea5b2c35bfe
Fixed tree memory leak on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
289
diff
changeset
|
6802 free(pCore->rc.pszIcon); |
8ea5b2c35bfe
Fixed tree memory leak on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
289
diff
changeset
|
6803 pCore->rc.pszIcon = 0; |
8ea5b2c35bfe
Fixed tree memory leak on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
289
diff
changeset
|
6804 } |
8ea5b2c35bfe
Fixed tree memory leak on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
289
diff
changeset
|
6805 } |
478
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
6806 pCore = (PCNRITEM)pCore->rc.preccNextRecord;/*WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)pCore, MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER));*/ |
326
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6807 } |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6808 _dw_send_msg(handle, CM_REMOVERECORD, (MPARAM)0L, MPFROM2SHORT(0, (redraw ? CMA_INVALIDATE : 0) | CMA_FREE), -1); |
3 | 6809 } |
6810 | |
6811 /* | |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6812 * 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:
21
diff
changeset
|
6813 * Parameters: |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6814 * 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:
21
diff
changeset
|
6815 * 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:
21
diff
changeset
|
6816 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
6817 void API dw_container_delete(HWND handle, int rowcount) |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6818 { |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6819 RECORDCORE *last, **prc = malloc(sizeof(RECORDCORE *) * rowcount); |
326
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6820 int current = 1; |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6821 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6822 prc[0] = last = (RECORDCORE *)WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)0L, MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER)); |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6823 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6824 while(last && current < rowcount) |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6825 { |
326
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6826 _dw_container_free_strings(handle, last); |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6827 prc[current] = last = (RECORDCORE *)WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)last, MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER)); |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6828 current++; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6829 } |
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
|
6830 |
326
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6831 _dw_send_msg(handle, CM_REMOVERECORD, (MPARAM)prc, MPFROM2SHORT(current, CMA_INVALIDATE | CMA_FREE), -1); |
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
|
6832 |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6833 free(prc); |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6834 } |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6835 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6836 /* |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6837 * 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:
21
diff
changeset
|
6838 * Parameters: |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6839 * 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:
21
diff
changeset
|
6840 * 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:
21
diff
changeset
|
6841 * 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:
21
diff
changeset
|
6842 * 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:
21
diff
changeset
|
6843 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
6844 void API dw_container_scroll(HWND handle, int direction, long rows) |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6845 { |
475
1547e8c327d9
Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
470
diff
changeset
|
6846 rows = rows; /* keep compiler happy */ |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6847 switch(direction) |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6848 { |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6849 case DW_SCROLL_TOP: |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6850 WinSendMsg(handle, CM_SCROLLWINDOW, MPFROMSHORT(CMA_VERTICAL), MPFROMLONG(-10000000)); |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6851 break; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6852 case DW_SCROLL_BOTTOM: |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6853 WinSendMsg(handle, CM_SCROLLWINDOW, MPFROMSHORT(CMA_VERTICAL), MPFROMLONG(10000000)); |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6854 break; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6855 } |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6856 } |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6857 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6858 /* |
3 | 6859 * Starts a new query of a container. |
6860 * Parameters: | |
6861 * handle: Handle to the window (widget) to be queried. | |
6862 * flags: If this parameter is DW_CRA_SELECTED it will only | |
6863 * return items that are currently selected. Otherwise | |
6864 * it will return all records in the container. | |
6865 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
6866 char * API dw_container_query_start(HWND handle, unsigned long flags) |
3 | 6867 { |
497
a7f478e9c20c
No longer use global variables for dw_container_query*() so it can be
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
489
diff
changeset
|
6868 PRECORDCORE pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)0L, MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER)); |
a7f478e9c20c
No longer use global variables for dw_container_query*() so it can be
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
489
diff
changeset
|
6869 |
3 | 6870 if(pCore) |
6871 { | |
6872 if(flags) | |
6873 { | |
6874 while(pCore) | |
6875 { | |
69
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6876 if(pCore->flRecordAttr & flags) |
497
a7f478e9c20c
No longer use global variables for dw_container_query*() so it can be
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
489
diff
changeset
|
6877 { |
a7f478e9c20c
No longer use global variables for dw_container_query*() so it can be
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
489
diff
changeset
|
6878 dw_window_set_data(handle, "_dw_pcore", (void *)pCore); |
3 | 6879 return pCore->pszIcon; |
497
a7f478e9c20c
No longer use global variables for dw_container_query*() so it can be
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
489
diff
changeset
|
6880 } |
3 | 6881 pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)pCore, MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER)); |
6882 } | |
6883 } | |
6884 else | |
497
a7f478e9c20c
No longer use global variables for dw_container_query*() so it can be
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
489
diff
changeset
|
6885 { |
a7f478e9c20c
No longer use global variables for dw_container_query*() so it can be
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
489
diff
changeset
|
6886 dw_window_set_data(handle, "_dw_pcore", (void *)pCore); |
3 | 6887 return pCore->pszIcon; |
497
a7f478e9c20c
No longer use global variables for dw_container_query*() so it can be
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
489
diff
changeset
|
6888 } |
3 | 6889 } |
6890 return NULL; | |
6891 } | |
6892 | |
6893 /* | |
6894 * Continues an existing query of a container. | |
6895 * Parameters: | |
6896 * handle: Handle to the window (widget) to be queried. | |
6897 * flags: If this parameter is DW_CRA_SELECTED it will only | |
6898 * return items that are currently selected. Otherwise | |
6899 * it will return all records in the container. | |
6900 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
6901 char * API dw_container_query_next(HWND handle, unsigned long flags) |
3 | 6902 { |
497
a7f478e9c20c
No longer use global variables for dw_container_query*() so it can be
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
489
diff
changeset
|
6903 PRECORDCORE pCore = (PRECORDCORE)dw_window_get_data(handle, "_dw_pcore"); |
a7f478e9c20c
No longer use global variables for dw_container_query*() so it can be
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
489
diff
changeset
|
6904 |
3 | 6905 pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)pCore, MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER)); |
497
a7f478e9c20c
No longer use global variables for dw_container_query*() so it can be
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
489
diff
changeset
|
6906 |
3 | 6907 if(pCore) |
6908 { | |
6909 if(flags) | |
6910 { | |
6911 while(pCore) | |
6912 { | |
69
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6913 if(pCore->flRecordAttr & flags) |
497
a7f478e9c20c
No longer use global variables for dw_container_query*() so it can be
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
489
diff
changeset
|
6914 { |
a7f478e9c20c
No longer use global variables for dw_container_query*() so it can be
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
489
diff
changeset
|
6915 dw_window_set_data(handle, "_dw_pcore", (void *)pCore); |
3 | 6916 return pCore->pszIcon; |
497
a7f478e9c20c
No longer use global variables for dw_container_query*() so it can be
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
489
diff
changeset
|
6917 } |
3 | 6918 |
6919 pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)pCore, MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER)); | |
6920 } | |
6921 } | |
6922 else | |
497
a7f478e9c20c
No longer use global variables for dw_container_query*() so it can be
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
489
diff
changeset
|
6923 { |
a7f478e9c20c
No longer use global variables for dw_container_query*() so it can be
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
489
diff
changeset
|
6924 dw_window_set_data(handle, "_dw_pcore", (void *)pCore); |
3 | 6925 return pCore->pszIcon; |
497
a7f478e9c20c
No longer use global variables for dw_container_query*() so it can be
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
489
diff
changeset
|
6926 } |
3 | 6927 } |
6928 return NULL; | |
6929 } | |
6930 | |
6931 /* | |
69
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6932 * 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:
68
diff
changeset
|
6933 * Parameters: |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6934 * 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:
68
diff
changeset
|
6935 * 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:
68
diff
changeset
|
6936 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
6937 void API dw_container_cursor(HWND handle, char *text) |
69
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6938 { |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6939 RECTL viewport, item; |
497
a7f478e9c20c
No longer use global variables for dw_container_query*() so it can be
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
489
diff
changeset
|
6940 PRECORDCORE pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)0L, MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER)); |
a7f478e9c20c
No longer use global variables for dw_container_query*() so it can be
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
489
diff
changeset
|
6941 |
69
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6942 while(pCore) |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6943 { |
154
7f8fcce45bdd
Fixed EMX building.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
6944 if((char *)pCore->pszIcon == text) |
69
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6945 { |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6946 QUERYRECORDRECT qrr; |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6947 int scrollpixels = 0, midway; |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6948 |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6949 qrr.cb = sizeof(QUERYRECORDRECT); |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6950 qrr.pRecord = pCore; |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6951 qrr.fRightSplitWindow = 0; |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6952 qrr.fsExtent = CMA_TEXT; |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6953 |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6954 WinSendMsg(handle, CM_SETRECORDEMPHASIS, (MPARAM)pCore, MPFROM2SHORT(TRUE, CRA_CURSORED)); |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6955 WinSendMsg(handle, CM_QUERYVIEWPORTRECT, (MPARAM)&viewport, MPFROM2SHORT(CMA_WORKSPACE, FALSE)); |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6956 WinSendMsg(handle, CM_QUERYRECORDRECT, (MPARAM)&item, (MPARAM)&qrr); |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6957 |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6958 midway = (viewport.yTop - viewport.yBottom)/2; |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6959 scrollpixels = viewport.yTop - (item.yTop + midway); |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6960 |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6961 WinSendMsg(handle, CM_SCROLLWINDOW, MPFROMSHORT(CMA_VERTICAL), MPFROMLONG(scrollpixels)); |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6962 return; |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6963 } |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6964 |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6965 pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)pCore, MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER)); |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6966 } |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6967 } |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6968 |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6969 /* |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6970 * Deletes the item with the text speficied. |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6971 * Parameters: |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6972 * handle: Handle to the window (widget). |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6973 * text: Text usually returned by dw_container_query(). |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6974 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
6975 void API dw_container_delete_row(HWND handle, char *text) |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6976 { |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6977 PRECORDCORE pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)0L, MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER)); |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6978 |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6979 while(pCore) |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6980 { |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6981 if((char *)pCore->pszIcon == text) |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6982 { |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6983 WinSendMsg(handle, CM_REMOVERECORD, (MPARAM)&pCore, MPFROM2SHORT(1, CMA_FREE | CMA_INVALIDATE)); |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6984 return; |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6985 } |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6986 pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)pCore, MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER)); |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6987 } |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6988 } |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6989 |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6990 /* |
69
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6991 * 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:
68
diff
changeset
|
6992 * Parameters: |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6993 * 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:
68
diff
changeset
|
6994 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
6995 void API dw_container_optimize(HWND handle) |
69
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6996 { |
70
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
6997 WindowData *blah = (WindowData *)WinQueryWindowPtr(handle, QWP_USER); |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
6998 RECTL item; |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
6999 PRECORDCORE pCore = NULL; |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
7000 int max = 0; |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
7001 |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
7002 if(blah && !blah->flags) |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
7003 return; |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
7004 |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
7005 pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)0L, MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER)); |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
7006 while(pCore) |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
7007 { |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
7008 QUERYRECORDRECT qrr; |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
7009 int vector; |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
7010 |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
7011 qrr.cb = sizeof(QUERYRECORDRECT); |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
7012 qrr.pRecord = pCore; |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
7013 qrr.fRightSplitWindow = 0; |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
7014 qrr.fsExtent = CMA_TEXT; |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
7015 |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
7016 WinSendMsg(handle, CM_QUERYRECORDRECT, (MPARAM)&item, (MPARAM)&qrr); |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
7017 |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
7018 vector = item.xRight - item.xLeft; |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
7019 |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
7020 if(vector > max) |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
7021 max = vector; |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
7022 |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
7023 pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)pCore, MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER)); |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
7024 } |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
7025 |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
7026 if(max) |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
7027 { |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
7028 CNRINFO cnri; |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
7029 |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
7030 cnri.cb = sizeof(CNRINFO); |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
7031 cnri.xVertSplitbar = max; |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
7032 |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
7033 WinSendMsg(handle, CM_SETCNRINFO, MPFROMP(&cnri), MPFROMLONG(CMA_XVERTSPLITBAR)); |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
7034 } |
69
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
7035 } |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
7036 |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
7037 /* |
487
d6e07d292145
Implemented taskbar icons on windows, so I can keep feature for feature
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
485
diff
changeset
|
7038 * 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:
485
diff
changeset
|
7039 * Parameters: |
d6e07d292145
Implemented taskbar icons on windows, so I can keep feature for feature
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
485
diff
changeset
|
7040 * 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:
485
diff
changeset
|
7041 * 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:
485
diff
changeset
|
7042 * 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:
485
diff
changeset
|
7043 */ |
507
c607eb385e58
Added missing calling conventions. Thanks Bastian for pointing this out.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
503
diff
changeset
|
7044 void API dw_taskbar_insert(HWND handle, unsigned long icon, char *bubbletext) |
487
d6e07d292145
Implemented taskbar icons on windows, so I can keep feature for feature
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
485
diff
changeset
|
7045 { |
489
bc156294dd16
Fix compiler complaints on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
487
diff
changeset
|
7046 handle = handle; |
bc156294dd16
Fix compiler complaints on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
487
diff
changeset
|
7047 icon = icon; |
bc156294dd16
Fix compiler complaints on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
487
diff
changeset
|
7048 bubbletext = bubbletext; |
bc156294dd16
Fix compiler complaints on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
487
diff
changeset
|
7049 /* TODO */ |
487
d6e07d292145
Implemented taskbar icons on windows, so I can keep feature for feature
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
485
diff
changeset
|
7050 } |
d6e07d292145
Implemented taskbar icons on windows, so I can keep feature for feature
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
485
diff
changeset
|
7051 |
d6e07d292145
Implemented taskbar icons on windows, so I can keep feature for feature
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
485
diff
changeset
|
7052 /* |
d6e07d292145
Implemented taskbar icons on windows, so I can keep feature for feature
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
485
diff
changeset
|
7053 * 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:
485
diff
changeset
|
7054 * Parameters: |
d6e07d292145
Implemented taskbar icons on windows, so I can keep feature for feature
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
485
diff
changeset
|
7055 * 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:
485
diff
changeset
|
7056 * 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:
485
diff
changeset
|
7057 */ |
507
c607eb385e58
Added missing calling conventions. Thanks Bastian for pointing this out.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
503
diff
changeset
|
7058 void API dw_taskbar_delete(HWND handle, unsigned long icon) |
487
d6e07d292145
Implemented taskbar icons on windows, so I can keep feature for feature
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
485
diff
changeset
|
7059 { |
489
bc156294dd16
Fix compiler complaints on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
487
diff
changeset
|
7060 handle = handle; |
bc156294dd16
Fix compiler complaints on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
487
diff
changeset
|
7061 icon = icon; |
bc156294dd16
Fix compiler complaints on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
487
diff
changeset
|
7062 /* TODO */ |
487
d6e07d292145
Implemented taskbar icons on windows, so I can keep feature for feature
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
485
diff
changeset
|
7063 } |
d6e07d292145
Implemented taskbar icons on windows, so I can keep feature for feature
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
485
diff
changeset
|
7064 |
d6e07d292145
Implemented taskbar icons on windows, so I can keep feature for feature
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
485
diff
changeset
|
7065 /* |
3 | 7066 * Creates a rendering context widget (window) to be packed. |
7067 * Parameters: | |
7068 * id: An id to be used with dw_window_from_id. | |
7069 * Returns: | |
7070 * A handle to the widget or NULL on failure. | |
7071 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7072 HWND API dw_render_new(unsigned long id) |
3 | 7073 { |
7074 HWND hwndframe = WinCreateWindow(HWND_OBJECT, | |
7075 WC_FRAME, | |
7076 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:
40
diff
changeset
|
7077 WS_VISIBLE | |
997e9ed670ef
Fixes for box alignment problem on OS/2, crash in dw_bitmap_new() on unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
40
diff
changeset
|
7078 FS_NOBYTEALIGN, |
3 | 7079 0,0,2000,1000, |
7080 NULLHANDLE, | |
7081 HWND_TOP, | |
7082 id, | |
7083 NULL, | |
7084 NULL); | |
7085 WinSubclassWindow(hwndframe, _RendProc); | |
7086 return hwndframe; | |
7087 } | |
7088 | |
7089 /* Sets the current foreground drawing color. | |
7090 * Parameters: | |
7091 * red: red value. | |
7092 * green: green value. | |
7093 * blue: blue value. | |
7094 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7095 void API dw_color_foreground_set(unsigned long value) |
3 | 7096 { |
192
d946e329670c
Added test application for OS/2, and allow dw_color_xxx_set() to use OS/2
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
190
diff
changeset
|
7097 _foreground = value; |
3 | 7098 } |
7099 | |
7100 /* Sets the current background drawing color. | |
7101 * Parameters: | |
7102 * red: red value. | |
7103 * green: green value. | |
7104 * blue: blue value. | |
7105 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7106 void API dw_color_background_set(unsigned long value) |
3 | 7107 { |
192
d946e329670c
Added test application for OS/2, and allow dw_color_xxx_set() to use OS/2
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
190
diff
changeset
|
7108 _background = value; |
3 | 7109 } |
7110 | |
7111 HPS _set_hps(HPS hps) | |
7112 { | |
225
413710a835eb
Code cleanup in the test program, and fixed the color problem on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
224
diff
changeset
|
7113 LONG alTable[2]; |
413710a835eb
Code cleanup in the test program, and fixed the color problem on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
224
diff
changeset
|
7114 |
413710a835eb
Code cleanup in the test program, and fixed the color problem on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
224
diff
changeset
|
7115 alTable[0] = DW_RED_VALUE(_foreground) << 16 | DW_GREEN_VALUE(_foreground) << 8 | DW_BLUE_VALUE(_foreground); |
413710a835eb
Code cleanup in the test program, and fixed the color problem on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
224
diff
changeset
|
7116 alTable[1] = DW_RED_VALUE(_background) << 16 | DW_GREEN_VALUE(_background) << 8 | DW_BLUE_VALUE(_background); |
3 | 7117 |
7118 GpiCreateLogColorTable(hps, | |
225
413710a835eb
Code cleanup in the test program, and fixed the color problem on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
224
diff
changeset
|
7119 LCOL_RESET, |
3 | 7120 LCOLF_CONSECRGB, |
225
413710a835eb
Code cleanup in the test program, and fixed the color problem on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
224
diff
changeset
|
7121 16, |
413710a835eb
Code cleanup in the test program, and fixed the color problem on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
224
diff
changeset
|
7122 2, |
3 | 7123 alTable); |
192
d946e329670c
Added test application for OS/2, and allow dw_color_xxx_set() to use OS/2
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
190
diff
changeset
|
7124 if(_foreground & DW_RGB_COLOR) |
d946e329670c
Added test application for OS/2, and allow dw_color_xxx_set() to use OS/2
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
190
diff
changeset
|
7125 GpiSetColor(hps, 16); |
d946e329670c
Added test application for OS/2, and allow dw_color_xxx_set() to use OS/2
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
190
diff
changeset
|
7126 else |
d946e329670c
Added test application for OS/2, and allow dw_color_xxx_set() to use OS/2
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
190
diff
changeset
|
7127 GpiSetColor(hps, _internal_color(_foreground)); |
d946e329670c
Added test application for OS/2, and allow dw_color_xxx_set() to use OS/2
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
190
diff
changeset
|
7128 if(_background & DW_RGB_COLOR) |
d946e329670c
Added test application for OS/2, and allow dw_color_xxx_set() to use OS/2
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
190
diff
changeset
|
7129 GpiSetBackColor(hps, 17); |
d946e329670c
Added test application for OS/2, and allow dw_color_xxx_set() to use OS/2
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
190
diff
changeset
|
7130 else |
d946e329670c
Added test application for OS/2, and allow dw_color_xxx_set() to use OS/2
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
190
diff
changeset
|
7131 GpiSetBackColor(hps, _internal_color(_background)); |
3 | 7132 return hps; |
7133 } | |
7134 | |
7135 HPS _set_colors(HWND handle) | |
7136 { | |
7137 HPS hps = WinGetPS(handle); | |
7138 | |
7139 _set_hps(hps); | |
7140 return hps; | |
7141 } | |
7142 | |
7143 /* Draw a point on a window (preferably a render window). | |
7144 * Parameters: | |
7145 * handle: Handle to the window. | |
7146 * pixmap: Handle to the pixmap. (choose only one of these) | |
7147 * x: X coordinate. | |
7148 * y: Y coordinate. | |
7149 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7150 void API dw_draw_point(HWND handle, HPIXMAP pixmap, int x, int y) |
3 | 7151 { |
7152 HPS hps; | |
7153 int height; | |
7154 POINTL ptl; | |
7155 | |
7156 if(handle) | |
7157 { | |
7158 hps = _set_colors(handle); | |
7159 height = _get_height(handle); | |
7160 } | |
7161 else if(pixmap) | |
7162 { | |
7163 hps = _set_hps(pixmap->hps); | |
7164 height = pixmap->height; | |
7165 } | |
7166 else | |
7167 return; | |
7168 | |
7169 ptl.x = x; | |
7170 ptl.y = height - y - 1; | |
7171 | |
7172 GpiSetPel(hps, &ptl); | |
7173 if(!pixmap) | |
7174 WinReleasePS(hps); | |
7175 } | |
7176 | |
7177 /* Draw a line on a window (preferably a render window). | |
7178 * Parameters: | |
7179 * handle: Handle to the window. | |
7180 * pixmap: Handle to the pixmap. (choose only one of these) | |
7181 * x1: First X coordinate. | |
7182 * y1: First Y coordinate. | |
7183 * x2: Second X coordinate. | |
7184 * y2: Second Y coordinate. | |
7185 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7186 void API dw_draw_line(HWND handle, HPIXMAP pixmap, int x1, int y1, int x2, int y2) |
3 | 7187 { |
7188 HPS hps; | |
7189 int height; | |
7190 POINTL ptl[2]; | |
7191 | |
7192 if(handle) | |
7193 { | |
7194 hps = _set_colors(handle); | |
7195 height = _get_height(handle); | |
7196 } | |
7197 else if(pixmap) | |
7198 { | |
7199 hps = _set_hps(pixmap->hps); | |
7200 height = pixmap->height; | |
7201 } | |
7202 else | |
7203 return; | |
7204 | |
7205 ptl[0].x = x1; | |
7206 ptl[0].y = height - y1 - 1; | |
7207 ptl[1].x = x2; | |
7208 ptl[1].y = height - y2 - 1; | |
7209 | |
7210 GpiMove(hps, &ptl[0]); | |
7211 GpiLine(hps, &ptl[1]); | |
7212 | |
7213 if(!pixmap) | |
7214 WinReleasePS(hps); | |
7215 } | |
7216 | |
7217 | |
9
3383ed751a7e
New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
8
diff
changeset
|
7218 void _CopyFontSettings(HPS hpsSrc, HPS hpsDst) |
3383ed751a7e
New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
8
diff
changeset
|
7219 { |
3383ed751a7e
New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
8
diff
changeset
|
7220 FONTMETRICS fm; |
3383ed751a7e
New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
8
diff
changeset
|
7221 FATTRS fat; |
3383ed751a7e
New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
8
diff
changeset
|
7222 SIZEF sizf; |
3383ed751a7e
New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
8
diff
changeset
|
7223 |
3383ed751a7e
New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
8
diff
changeset
|
7224 GpiQueryFontMetrics(hpsSrc, sizeof(FONTMETRICS), &fm); |
3383ed751a7e
New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
8
diff
changeset
|
7225 |
3383ed751a7e
New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
8
diff
changeset
|
7226 memset(&fat, 0, sizeof(fat)); |
3383ed751a7e
New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
8
diff
changeset
|
7227 |
3383ed751a7e
New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
8
diff
changeset
|
7228 fat.usRecordLength = sizeof(FATTRS); |
3383ed751a7e
New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
8
diff
changeset
|
7229 fat.lMatch = fm.lMatch; |
3383ed751a7e
New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
8
diff
changeset
|
7230 strcpy(fat.szFacename, fm.szFacename); |
3383ed751a7e
New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
8
diff
changeset
|
7231 |
3383ed751a7e
New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
8
diff
changeset
|
7232 GpiCreateLogFont(hpsDst, 0, 1L, &fat); |
3383ed751a7e
New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
8
diff
changeset
|
7233 GpiSetCharSet(hpsDst, 1L); |
3383ed751a7e
New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
8
diff
changeset
|
7234 |
3383ed751a7e
New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
8
diff
changeset
|
7235 sizf.cx = MAKEFIXED(fm.lEmInc,0); |
3383ed751a7e
New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
8
diff
changeset
|
7236 sizf.cy = MAKEFIXED(fm.lMaxBaselineExt,0); |
3383ed751a7e
New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
8
diff
changeset
|
7237 GpiSetCharBox(hpsDst, &sizf ); |
3383ed751a7e
New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
8
diff
changeset
|
7238 } |
3383ed751a7e
New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
8
diff
changeset
|
7239 |
3 | 7240 /* Draw text on a window (preferably a render window). |
7241 * Parameters: | |
7242 * handle: Handle to the window. | |
7243 * pixmap: Handle to the pixmap. (choose only one of these) | |
7244 * x: X coordinate. | |
7245 * y: Y coordinate. | |
7246 * text: Text to be displayed. | |
7247 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7248 void API dw_draw_text(HWND handle, HPIXMAP pixmap, int x, int y, char *text) |
3 | 7249 { |
7250 HPS hps; | |
220
d84054c1d587
Fixed a minor bug in dw_draw_text().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
212
diff
changeset
|
7251 int z, height; |
9
3383ed751a7e
New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
8
diff
changeset
|
7252 RECTL rcl; |
3 | 7253 char fontname[128]; |
220
d84054c1d587
Fixed a minor bug in dw_draw_text().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
212
diff
changeset
|
7254 POINTL aptl[TXTBOX_COUNT]; |
3 | 7255 |
7256 if(handle) | |
7257 { | |
7258 hps = _set_colors(handle); | |
7259 height = _get_height(handle); | |
7260 _GetPPFont(handle, fontname); | |
7261 } | |
7262 else if(pixmap) | |
7263 { | |
9
3383ed751a7e
New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
8
diff
changeset
|
7264 HPS pixmaphps = WinGetPS(pixmap->handle); |
3383ed751a7e
New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
8
diff
changeset
|
7265 |
3 | 7266 hps = _set_hps(pixmap->hps); |
7267 height = pixmap->height; | |
7268 _GetPPFont(pixmap->handle, fontname); | |
9
3383ed751a7e
New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
8
diff
changeset
|
7269 _CopyFontSettings(pixmaphps, hps); |
3383ed751a7e
New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
8
diff
changeset
|
7270 WinReleasePS(pixmaphps); |
3 | 7271 } |
7272 else | |
7273 return; | |
7274 | |
7275 for(z=0;z<strlen(fontname);z++) | |
7276 { | |
7277 if(fontname[z]=='.') | |
7278 break; | |
7279 } | |
220
d84054c1d587
Fixed a minor bug in dw_draw_text().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
212
diff
changeset
|
7280 |
d84054c1d587
Fixed a minor bug in dw_draw_text().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
212
diff
changeset
|
7281 GpiQueryTextBox(hps, strlen(text), text, TXTBOX_COUNT, aptl); |
3 | 7282 |
9
3383ed751a7e
New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
8
diff
changeset
|
7283 rcl.xLeft = x; |
3383ed751a7e
New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
8
diff
changeset
|
7284 rcl.yTop = height - y; |
220
d84054c1d587
Fixed a minor bug in dw_draw_text().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
212
diff
changeset
|
7285 rcl.yBottom = rcl.yTop - (aptl[TXTBOX_TOPLEFT].y - aptl[TXTBOX_BOTTOMLEFT].y); |
d84054c1d587
Fixed a minor bug in dw_draw_text().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
212
diff
changeset
|
7286 rcl.xRight = rcl.xLeft + (aptl[TXTBOX_TOPRIGHT].x - aptl[TXTBOX_TOPLEFT].x); |
9
3383ed751a7e
New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
8
diff
changeset
|
7287 |
376
b812cf360e49
dw_draw_text() now draws the background color on OS/2 as well.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
369
diff
changeset
|
7288 if(_background == DW_CLR_DEFAULT) |
b812cf360e49
dw_draw_text() now draws the background color on OS/2 as well.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
369
diff
changeset
|
7289 WinDrawText(hps, -1, text, &rcl, DT_TEXTATTRS, DT_TEXTATTRS, DT_VCENTER | DT_LEFT | DT_TEXTATTRS); |
b812cf360e49
dw_draw_text() now draws the background color on OS/2 as well.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
369
diff
changeset
|
7290 else |
b812cf360e49
dw_draw_text() now draws the background color on OS/2 as well.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
369
diff
changeset
|
7291 WinDrawText(hps, -1, text, &rcl, _internal_color(_foreground), _internal_color(_background), DT_VCENTER | DT_LEFT | DT_ERASERECT); |
3 | 7292 |
7293 if(!pixmap) | |
7294 WinReleasePS(hps); | |
7295 } | |
7296 | |
49
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
7297 /* 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:
47
diff
changeset
|
7298 * Parameters: |
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
7299 * 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:
47
diff
changeset
|
7300 * 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:
47
diff
changeset
|
7301 * 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:
47
diff
changeset
|
7302 * 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:
47
diff
changeset
|
7303 * 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:
47
diff
changeset
|
7304 */ |
514
08d770271709
More function name changes for Rexx/DW compatibility.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
513
diff
changeset
|
7305 void API 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:
47
diff
changeset
|
7306 { |
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
7307 HPS hps; |
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
7308 POINTL aptl[TXTBOX_COUNT]; |
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
7309 |
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
7310 if(handle) |
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
7311 { |
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
7312 hps = _set_colors(handle); |
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
7313 } |
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
7314 else if(pixmap) |
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
7315 { |
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
7316 HPS pixmaphps = WinGetPS(pixmap->handle); |
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
7317 |
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
7318 hps = _set_hps(pixmap->hps); |
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
7319 _CopyFontSettings(pixmaphps, hps); |
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
7320 WinReleasePS(pixmaphps); |
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
7321 } |
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
7322 else |
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
7323 return; |
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
7324 |
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
7325 GpiQueryTextBox(hps, strlen(text), text, TXTBOX_COUNT, aptl); |
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
7326 |
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
7327 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:
47
diff
changeset
|
7328 *width = aptl[TXTBOX_TOPRIGHT].x - aptl[TXTBOX_TOPLEFT].x; |
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
7329 |
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
7330 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:
47
diff
changeset
|
7331 *height = aptl[TXTBOX_TOPLEFT].y - aptl[TXTBOX_BOTTOMLEFT].y; |
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
7332 |
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
7333 if(!pixmap) |
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
7334 WinReleasePS(hps); |
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
7335 } |
3 | 7336 |
7337 /* Draw a rectangle on a window (preferably a render window). | |
7338 * Parameters: | |
7339 * handle: Handle to the window. | |
7340 * pixmap: Handle to the pixmap. (choose only one of these) | |
7341 * fill: Fill box TRUE or FALSE. | |
7342 * x: X coordinate. | |
7343 * y: Y coordinate. | |
7344 * width: Width of rectangle. | |
7345 * height: Height of rectangle. | |
7346 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7347 void API dw_draw_rect(HWND handle, HPIXMAP pixmap, int fill, int x, int y, int width, int height) |
3 | 7348 { |
7349 HPS hps; | |
7350 int thisheight; | |
7351 POINTL ptl[2]; | |
7352 | |
7353 if(handle) | |
7354 { | |
7355 hps = _set_colors(handle); | |
7356 thisheight = _get_height(handle); | |
7357 } | |
7358 else if(pixmap) | |
7359 { | |
7360 hps = _set_hps(pixmap->hps); | |
7361 thisheight = pixmap->height; | |
7362 } | |
7363 else | |
7364 return; | |
7365 | |
7366 ptl[0].x = x; | |
7367 ptl[0].y = thisheight - y - 1; | |
7368 ptl[1].x = x + width - 1; | |
7369 ptl[1].y = thisheight - y - height; | |
7370 | |
7371 GpiMove(hps, &ptl[0]); | |
7372 GpiBox(hps, fill ? DRO_OUTLINEFILL : DRO_OUTLINE, &ptl[1], 0, 0); | |
7373 | |
7374 if(!pixmap) | |
7375 WinReleasePS(hps); | |
7376 } | |
7377 | |
7378 /* Call this after drawing to the screen to make sure | |
7379 * anything you have drawn is visible. | |
7380 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7381 void API dw_flush(void) |
3 | 7382 { |
7383 } | |
7384 | |
7385 /* | |
7386 * Creates a pixmap with given parameters. | |
7387 * Parameters: | |
7388 * handle: Window handle the pixmap is associated with. | |
7389 * width: Width of the pixmap in pixels. | |
7390 * height: Height of the pixmap in pixels. | |
7391 * depth: Color depth of the pixmap. | |
7392 * Returns: | |
7393 * A handle to a pixmap or NULL on failure. | |
7394 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7395 HPIXMAP API dw_pixmap_new(HWND handle, unsigned long width, unsigned long height, int depth) |
3 | 7396 { |
7397 BITMAPINFOHEADER bmih; | |
7398 SIZEL sizl = { 0, 0 }; | |
7399 HPIXMAP pixmap; | |
7400 HDC hdc; | |
7401 HPS hps; | |
7402 ULONG ulFlags; | |
7403 LONG cPlanes, cBitCount; | |
7404 | |
7405 if (!(pixmap = calloc(1,sizeof(struct _hpixmap)))) | |
7406 return NULL; | |
7407 | |
7408 hps = WinGetPS(handle); | |
7409 | |
7410 hdc = GpiQueryDevice(hps); | |
7411 ulFlags = GpiQueryPS(hps, &sizl); | |
7412 | |
7413 pixmap->handle = handle; | |
7414 pixmap->hdc = DevOpenDC(dwhab, OD_MEMORY, "*", 0L, NULL, hdc); | |
7415 pixmap->hps = GpiCreatePS (dwhab, pixmap->hdc, &sizl, ulFlags | GPIA_ASSOC); | |
7416 | |
7417 DevQueryCaps(hdc, CAPS_COLOR_PLANES , 1L, &cPlanes); | |
7418 if (!depth) | |
7419 { | |
7420 DevQueryCaps(hdc, CAPS_COLOR_BITCOUNT, 1L, &cBitCount); | |
7421 depth = cBitCount; | |
7422 } | |
7423 | |
7424 memset(&bmih, 0, sizeof(BITMAPINFOHEADER)); | |
7425 bmih.cbFix = sizeof(BITMAPINFOHEADER); | |
7426 bmih.cx = (SHORT)width; | |
7427 bmih.cy = (SHORT)height; | |
7428 bmih.cPlanes = (SHORT)cPlanes; | |
7429 bmih.cBitCount = (SHORT)depth; | |
7430 | |
7431 pixmap->width = width; pixmap->height = height; | |
7432 | |
7433 pixmap->hbm = GpiCreateBitmap(pixmap->hps, (PBITMAPINFOHEADER2)&bmih, 0L, NULL, NULL); | |
7434 | |
7435 GpiSetBitmap(pixmap->hps, pixmap->hbm); | |
7436 | |
7437 if (depth>8) | |
7438 GpiCreateLogColorTable(pixmap->hps, LCOL_PURECOLOR, LCOLF_RGB, 0, 0, NULL ); | |
7439 | |
7440 WinReleasePS(hps); | |
7441 | |
7442 return pixmap; | |
7443 } | |
7444 | |
7445 /* | |
241
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7446 * Creates a pixmap from a file. |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7447 * Parameters: |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7448 * handle: Window handle the pixmap is associated with. |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7449 * filename: Name of the file, omit extention to have |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7450 * DW pick the appropriate file extension. |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7451 * (BMP on OS/2 or Windows, XPM on Unix) |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7452 * Returns: |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7453 * A handle to a pixmap or NULL on failure. |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7454 */ |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7455 HPIXMAP API dw_pixmap_new_from_file(HWND handle, char *filename) |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7456 { |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7457 HPIXMAP pixmap; |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7458 char *file = alloca(strlen(filename) + 5); |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7459 |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7460 if(!file || !(pixmap = calloc(1,sizeof(struct _hpixmap)))) |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7461 return NULL; |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7462 |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7463 strcpy(file, filename); |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7464 |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7465 /* 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:
236
diff
changeset
|
7466 if(access(file, 04) != 0) |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7467 { |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7468 /* Try with .bmp extention */ |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7469 strcat(file, ".bmp"); |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7470 if(access(file, 04) != 0) |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7471 { |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7472 free(pixmap); |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7473 return NULL; |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7474 } |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7475 } |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7476 |
278
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
7477 /* Try to load the bitmap from file */ |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
7478 if(!_load_bitmap_file(file, handle, &pixmap->hbm, &pixmap->hdc, &pixmap->hps, &pixmap->width, &pixmap->height)) |
241
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7479 { |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7480 free(pixmap); |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7481 return NULL; |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7482 } |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7483 |
278
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
7484 /* Success fill in other values */ |
241
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7485 pixmap->handle = handle; |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7486 |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7487 return pixmap; |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7488 } |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7489 |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7490 /* |
3 | 7491 * Creates a pixmap from internal resource graphic specified by id. |
7492 * Parameters: | |
7493 * handle: Window handle the pixmap is associated with. | |
7494 * id: Resource ID associated with requested pixmap. | |
7495 * Returns: | |
7496 * A handle to a pixmap or NULL on failure. | |
7497 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7498 HPIXMAP API dw_pixmap_grab(HWND handle, ULONG id) |
3 | 7499 { |
7500 BITMAPINFOHEADER bmih; | |
7501 SIZEL sizl = { 0, 0 }; | |
7502 HPIXMAP pixmap; | |
7503 HDC hdc; | |
7504 HPS hps; | |
7505 ULONG ulFlags; | |
7506 | |
7507 if (!(pixmap = calloc(1,sizeof(struct _hpixmap)))) | |
7508 return NULL; | |
7509 | |
7510 hps = WinGetPS(handle); | |
7511 | |
7512 hdc = GpiQueryDevice(hps); | |
7513 ulFlags = GpiQueryPS(hps, &sizl); | |
7514 | |
7515 pixmap->hdc = DevOpenDC(dwhab, OD_MEMORY, "*", 0L, NULL, hdc); | |
7516 pixmap->hps = GpiCreatePS (dwhab, pixmap->hdc, &sizl, ulFlags | GPIA_ASSOC); | |
7517 | |
7518 pixmap->hbm = GpiLoadBitmap(pixmap->hps, NULLHANDLE, id, 0, 0); | |
7519 | |
7520 GpiQueryBitmapParameters(pixmap->hbm, &bmih); | |
7521 | |
7522 GpiSetBitmap(pixmap->hps, pixmap->hbm); | |
7523 | |
7524 pixmap->width = bmih.cx; pixmap->height = bmih.cy; | |
7525 | |
7526 WinReleasePS(hps); | |
7527 | |
7528 return pixmap; | |
7529 } | |
7530 | |
7531 /* | |
7532 * Destroys an allocated pixmap. | |
7533 * Parameters: | |
7534 * pixmap: Handle to a pixmap returned by | |
7535 * dw_pixmap_new.. | |
7536 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7537 void API dw_pixmap_destroy(HPIXMAP pixmap) |
3 | 7538 { |
7539 GpiSetBitmap(pixmap->hps, NULLHANDLE); | |
7540 GpiDeleteBitmap(pixmap->hbm); | |
7541 GpiAssociate(pixmap->hps, NULLHANDLE); | |
7542 GpiDestroyPS(pixmap->hps); | |
7543 DevCloseDC(pixmap->hdc); | |
7544 free(pixmap); | |
7545 } | |
7546 | |
7547 /* | |
7548 * Copies from one item to another. | |
7549 * Parameters: | |
7550 * dest: Destination window handle. | |
7551 * destp: Destination pixmap. (choose only one). | |
7552 * xdest: X coordinate of destination. | |
7553 * ydest: Y coordinate of destination. | |
7554 * width: Width of area to copy. | |
7555 * height: Height of area to copy. | |
7556 * src: Source window handle. | |
7557 * srcp: Source pixmap. (choose only one). | |
7558 * xsrc: X coordinate of source. | |
7559 * ysrc: Y coordinate of source. | |
7560 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7561 void API dw_pixmap_bitblt(HWND dest, HPIXMAP destp, int xdest, int ydest, int width, int height, HWND src, HPIXMAP srcp, int xsrc, int ysrc) |
3 | 7562 { |
7563 HPS hpsdest; | |
7564 HPS hpssrc; | |
7565 POINTL ptl[4]; | |
7566 int destheight, srcheight; | |
7567 | |
7568 if(dest) | |
7569 { | |
7570 hpsdest = WinGetPS(dest); | |
7571 destheight = _get_height(dest); | |
7572 } | |
7573 else if(destp) | |
7574 { | |
7575 hpsdest = destp->hps; | |
7576 destheight = destp->height; | |
7577 } | |
7578 else | |
7579 return; | |
7580 | |
7581 if(src) | |
7582 { | |
7583 hpssrc = WinGetPS(src); | |
7584 srcheight = _get_height(src); | |
7585 } | |
7586 else if(srcp) | |
7587 { | |
7588 hpssrc = srcp->hps; | |
7589 srcheight = srcp->height; | |
7590 } | |
7591 else | |
7592 { | |
7593 if(!destp) | |
7594 WinReleasePS(hpsdest); | |
7595 return; | |
7596 } | |
7597 | |
7598 ptl[0].x = xdest; | |
7599 ptl[0].y = (destheight - ydest) - height; | |
7600 ptl[1].x = ptl[0].x + width; | |
7601 ptl[1].y = destheight - ydest; | |
7602 ptl[2].x = xsrc; | |
7603 ptl[2].y = srcheight - (ysrc + height); | |
7604 ptl[3].x = ptl[2].x + width; | |
7605 ptl[3].y = ptl[2].y + height; | |
7606 | |
7607 GpiBitBlt(hpsdest, hpssrc, 4, ptl, ROP_SRCCOPY, BBO_IGNORE); | |
7608 | |
7609 if(!destp) | |
7610 WinReleasePS(hpsdest); | |
7611 if(!srcp) | |
7612 WinReleasePS(hpssrc); | |
7613 } | |
7614 | |
7615 /* | |
7616 * Emits a beep. | |
7617 * Parameters: | |
7618 * freq: Frequency. | |
7619 * dur: Duration. | |
7620 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7621 void API dw_beep(int freq, int dur) |
3 | 7622 { |
7623 DosBeep(freq, dur); | |
7624 } | |
7625 | |
157
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7626 /* Open a shared library and return a handle. |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7627 * Parameters: |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7628 * name: Base name of the shared library. |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7629 * handle: Pointer to a module handle, |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7630 * will be filled in with the handle. |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7631 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7632 int API dw_module_load(char *name, HMOD *handle) |
157
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7633 { |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7634 char objnamebuf[300] = ""; |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7635 |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7636 return DosLoadModule(objnamebuf, sizeof(objnamebuf), name, handle); |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7637 } |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7638 |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7639 /* Queries the address of a symbol within open handle. |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7640 * Parameters: |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7641 * handle: Module handle returned by dw_module_load() |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7642 * name: Name of the symbol you want the address of. |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7643 * func: A pointer to a function pointer, to obtain |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7644 * the address. |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7645 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7646 int API dw_module_symbol(HMOD handle, char *name, void**func) |
157
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7647 { |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7648 return DosQueryProcAddr(handle, 0, name, (PFN*)func); |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7649 } |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7650 |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7651 /* Frees the shared library previously opened. |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7652 * Parameters: |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7653 * handle: Module handle returned by dw_module_load() |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7654 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7655 int API dw_module_close(HMOD handle) |
157
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7656 { |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7657 DosFreeModule(handle); |
159
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
7658 return 0; |
157
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7659 } |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7660 |
3 | 7661 /* |
7662 * Returns the handle to an unnamed mutex semaphore. | |
7663 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7664 HMTX API dw_mutex_new(void) |
3 | 7665 { |
7666 HMTX mutex; | |
7667 | |
7668 DosCreateMutexSem(NULL, &mutex, 0, FALSE); | |
7669 return mutex; | |
7670 } | |
7671 | |
7672 /* | |
7673 * Closes a semaphore created by dw_mutex_new(). | |
7674 * Parameters: | |
7675 * mutex: The handle to the mutex returned by dw_mutex_new(). | |
7676 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7677 void API dw_mutex_close(HMTX mutex) |
3 | 7678 { |
7679 DosCloseMutexSem(mutex); | |
7680 } | |
7681 | |
7682 /* | |
7683 * Tries to gain access to the semaphore, if it can't it blocks. | |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
7684 * If we are in a callback we must keep the message loop running |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
7685 * while blocking. |
3 | 7686 * Parameters: |
7687 * mutex: The handle to the mutex returned by dw_mutex_new(). | |
7688 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7689 void API dw_mutex_lock(HMTX mutex) |
3 | 7690 { |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
7691 if(_dwtid == dw_thread_id()) |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
7692 { |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
7693 int rc = DosRequestMutexSem(mutex, SEM_IMMEDIATE_RETURN); |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
7694 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
7695 while(rc == ERROR_TIMEOUT) |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
7696 { |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
7697 dw_main_sleep(10); |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
7698 rc = DosRequestMutexSem(mutex, SEM_IMMEDIATE_RETURN); |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
7699 } |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
7700 } |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
7701 else |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
7702 DosRequestMutexSem(mutex, SEM_INDEFINITE_WAIT); |
3 | 7703 } |
7704 | |
7705 /* | |
7706 * Reliquishes the access to the semaphore. | |
7707 * Parameters: | |
7708 * mutex: The handle to the mutex returned by dw_mutex_new(). | |
7709 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7710 void API dw_mutex_unlock(HMTX mutex) |
3 | 7711 { |
7712 DosReleaseMutexSem(mutex); | |
7713 } | |
7714 | |
7715 /* | |
7716 * Returns the handle to an unnamed event semaphore. | |
7717 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7718 HEV API dw_event_new(void) |
3 | 7719 { |
7720 HEV blah; | |
7721 | |
7722 if(DosCreateEventSem (NULL, &blah, 0L, FALSE)) | |
7723 return 0; | |
7724 | |
7725 return blah; | |
7726 } | |
7727 | |
7728 /* | |
7729 * Resets a semaphore created by dw_event_new(). | |
7730 * Parameters: | |
7731 * eve: The handle to the event returned by dw_event_new(). | |
7732 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7733 int API dw_event_reset(HEV eve) |
3 | 7734 { |
7735 ULONG count; | |
7736 | |
7737 if(DosResetEventSem(eve, &count)) | |
7738 return FALSE; | |
7739 return TRUE; | |
7740 } | |
7741 | |
7742 /* | |
7743 * Posts a semaphore created by dw_event_new(). Causing all threads | |
7744 * waiting on this event in dw_event_wait to continue. | |
7745 * Parameters: | |
7746 * eve: The handle to the event returned by dw_event_new(). | |
7747 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7748 int API dw_event_post(HEV eve) |
3 | 7749 { |
7750 if(DosPostEventSem(eve)) | |
7751 return FALSE; | |
7752 return TRUE; | |
7753 } | |
7754 | |
7755 | |
7756 /* | |
7757 * Waits on a semaphore created by dw_event_new(), until the | |
7758 * event gets posted or until the timeout expires. | |
7759 * Parameters: | |
7760 * eve: The handle to the event returned by dw_event_new(). | |
7761 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7762 int API dw_event_wait(HEV eve, unsigned long timeout) |
3 | 7763 { |
7764 int rc = DosWaitEventSem(eve, timeout); | |
7765 if(!rc) | |
7766 return 1; | |
7767 if(rc == ERROR_TIMEOUT) | |
7768 return -1; | |
7769 return 0; | |
7770 } | |
7771 | |
7772 /* | |
7773 * Closes a semaphore created by dw_event_new(). | |
7774 * Parameters: | |
7775 * eve: The handle to the event returned by dw_event_new(). | |
7776 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7777 int API dw_event_close(HEV *eve) |
3 | 7778 { |
7779 if(!eve || ~DosCloseEventSem(*eve)) | |
7780 return FALSE; | |
7781 return TRUE; | |
7782 } | |
7783 | |
7784 /* | |
7785 * Encapsulate the message queues on OS/2. | |
7786 */ | |
7787 void _dwthreadstart(void *data) | |
7788 { | |
7789 HAB thishab = WinInitialize(0); | |
7790 HMQ thishmq = WinCreateMsgQueue(dwhab, 0); | |
7791 void (*threadfunc)(void *) = NULL; | |
7792 void **tmp = (void **)data; | |
7793 | |
7794 threadfunc = (void (*)(void *))tmp[0]; | |
7795 threadfunc(tmp[1]); | |
7796 | |
7797 free(tmp); | |
7798 | |
7799 WinDestroyMsgQueue(thishmq); | |
7800 WinTerminate(thishab); | |
7801 } | |
7802 | |
7803 /* | |
7804 * Creates a new thread with a starting point of func. | |
7805 * Parameters: | |
7806 * func: Function which will be run in the new thread. | |
7807 * data: Parameter(s) passed to the function. | |
7808 * stack: Stack size of new thread (OS/2 and Windows only). | |
7809 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7810 DWTID API dw_thread_new(void *func, void *data, int stack) |
3 | 7811 { |
7812 void **tmp = malloc(sizeof(void *) * 2); | |
7813 | |
7814 tmp[0] = func; | |
7815 tmp[1] = data; | |
7816 | |
7817 return (DWTID)_beginthread((void (*)(void *))_dwthreadstart, NULL, stack, (void *)tmp); | |
7818 } | |
7819 | |
7820 /* | |
7821 * Ends execution of current thread immediately. | |
7822 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7823 void API dw_thread_end(void) |
3 | 7824 { |
7825 _endthread(); | |
7826 } | |
7827 | |
7828 /* | |
7829 * Returns the current thread's ID. | |
7830 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7831 DWTID API dw_thread_id(void) |
3 | 7832 { |
7833 return (DWTID)_threadid; | |
7834 } | |
7835 | |
7836 /* | |
7837 * Cleanly terminates a DW session, should be signal handler safe. | |
7838 * Parameters: | |
7839 * exitcode: Exit code reported to the operating system. | |
7840 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7841 void API dw_exit(int exitcode) |
3 | 7842 { |
465
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
7843 /* Destroy the menu message window */ |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
7844 dw_window_destroy(hwndApp); |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
7845 |
3 | 7846 /* In case we are in a signal handler, don't |
7847 * try to free memory that could possibly be | |
7848 * free()'d by the runtime already. | |
7849 */ | |
7850 Root = NULL; | |
117
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
7851 |
3 | 7852 exit(exitcode); |
7853 } | |
7854 | |
7855 /* | |
117
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
7856 * Creates a splitbar window (widget) with given parameters. |
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
7857 * Parameters: |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
7858 * type: Value can be DW_VERT or DW_HORZ. |
117
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
7859 * topleft: Handle to the window to be top or left. |
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
7860 * bottomright: Handle to the window to be bottom or right. |
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
7861 * Returns: |
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
7862 * A handle to a splitbar window or NULL on failure. |
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
7863 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7864 HWND API dw_splitbar_new(int type, HWND topleft, HWND bottomright, unsigned long id) |
117
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
7865 { |
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
7866 HWND tmp = WinCreateWindow(HWND_OBJECT, |
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
7867 SplitbarClassName, |
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
7868 NULL, |
137
6a18312049fd
The splitbar needs to have the WS_CLIPCHILDREN style set.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
136
diff
changeset
|
7869 WS_VISIBLE | WS_CLIPCHILDREN, |
117
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
7870 0,0,2000,1000, |
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
7871 NULLHANDLE, |
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
7872 HWND_TOP, |
119
1cad81b7cc4c
Implemented initial splitbar code on Unix. And made some fixes for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
117
diff
changeset
|
7873 id, |
117
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
7874 NULL, |
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
7875 NULL); |
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
7876 if(tmp) |
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
7877 { |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
7878 HWND tmpbox = dw_box_new(DW_VERT, 0); |
123
63f61a702b17
Updates to use floats to save the splitbar percentage.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
7879 float *percent = malloc(sizeof(float)); |
117
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
7880 |
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
7881 dw_box_pack_start(tmpbox, topleft, 1, 1, TRUE, TRUE, 0); |
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
7882 WinSetParent(tmpbox, tmp, FALSE); |
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
7883 dw_window_set_data(tmp, "_dw_topleft", (void *)tmpbox); |
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
7884 |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
7885 tmpbox = dw_box_new(DW_VERT, 0); |
117
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
7886 dw_box_pack_start(tmpbox, bottomright, 1, 1, TRUE, TRUE, 0); |
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
7887 WinSetParent(tmpbox, tmp, FALSE); |
123
63f61a702b17
Updates to use floats to save the splitbar percentage.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
7888 *percent = 50.0; |
117
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
7889 dw_window_set_data(tmp, "_dw_bottomright", (void *)tmpbox); |
123
63f61a702b17
Updates to use floats to save the splitbar percentage.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
7890 dw_window_set_data(tmp, "_dw_percent", (void *)percent); |
117
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
7891 dw_window_set_data(tmp, "_dw_type", (void *)type); |
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
7892 } |
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
7893 return tmp; |
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
7894 } |
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
7895 |
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
7896 /* |
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
7897 * Sets the position of a splitbar (pecentage). |
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
7898 * Parameters: |
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
7899 * handle: The handle to the splitbar returned by dw_splitbar_new(). |
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
7900 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7901 void API dw_splitbar_set(HWND handle, float percent) |
117
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
7902 { |
123
63f61a702b17
Updates to use floats to save the splitbar percentage.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
7903 float *mypercent = (float *)dw_window_get_data(handle, "_dw_percent"); |
125
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
7904 int type = (int)dw_window_get_data(handle, "_dw_type"); |
129
e47c52b37cdd
Code cleanup and OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
128
diff
changeset
|
7905 unsigned long width, height; |
123
63f61a702b17
Updates to use floats to save the splitbar percentage.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
7906 |
63f61a702b17
Updates to use floats to save the splitbar percentage.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
7907 if(mypercent) |
63f61a702b17
Updates to use floats to save the splitbar percentage.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
7908 *mypercent = percent; |
125
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
7909 |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
7910 dw_window_get_pos_size(handle, NULL, NULL, &width, &height); |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
7911 |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
7912 _handle_splitbar_resize(handle, percent, type, width, height); |
117
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
7913 } |
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
7914 |
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
7915 /* |
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
7916 * Gets the position of a splitbar (pecentage). |
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
7917 * Parameters: |
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
7918 * handle: The handle to the splitbar returned by dw_splitbar_new(). |
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
7919 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7920 float API dw_splitbar_get(HWND handle) |
123
63f61a702b17
Updates to use floats to save the splitbar percentage.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
7921 { |
63f61a702b17
Updates to use floats to save the splitbar percentage.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
7922 float *percent = (float *)dw_window_get_data(handle, "_dw_percent"); |
63f61a702b17
Updates to use floats to save the splitbar percentage.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
7923 |
63f61a702b17
Updates to use floats to save the splitbar percentage.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
7924 if(percent) |
63f61a702b17
Updates to use floats to save the splitbar percentage.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
7925 return *percent; |
63f61a702b17
Updates to use floats to save the splitbar percentage.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
7926 return 0.0; |
3 | 7927 } |
7928 | |
7929 /* | |
7930 * Pack windows (widgets) into a box from the start (or top). | |
7931 * Parameters: | |
7932 * box: Window handle of the box to be packed into. | |
7933 * item: Window handle of the item to be back. | |
7934 * width: Width in pixels of the item or -1 to be self determined. | |
7935 * height: Height in pixels of the item or -1 to be self determined. | |
7936 * hsize: TRUE if the window (widget) should expand horizontally to fill space given. | |
7937 * vsize: TRUE if the window (widget) should expand vertically to fill space given. | |
7938 * pad: Number of pixels of padding around the item. | |
7939 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7940 void API dw_box_pack_start(HWND box, HWND item, int width, int height, int hsize, int vsize, int pad) |
3 | 7941 { |
7942 Box *thisbox; | |
462
9d874ce0124a
Removed obsolete code from dw_box_pack_* and from dw_file_browse().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
458
diff
changeset
|
7943 char *funcname = "dw_box_pack_start()"; |
3 | 7944 |
447
5a0779561d0f
Add more tests for dw_pac*() functions. Throw up a messagebox if you try and
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
438
diff
changeset
|
7945 /* |
5a0779561d0f
Add more tests for dw_pac*() functions. Throw up a messagebox if you try and
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
438
diff
changeset
|
7946 * 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:
438
diff
changeset
|
7947 * 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:
438
diff
changeset
|
7948 */ |
5a0779561d0f
Add more tests for dw_pac*() functions. Throw up a messagebox if you try and
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
438
diff
changeset
|
7949 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:
438
diff
changeset
|
7950 { |
462
9d874ce0124a
Removed obsolete code from dw_box_pack_* and from dw_file_browse().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
458
diff
changeset
|
7951 dw_messagebox(funcname, DW_MB_OK|DW_MB_ERROR, "Danger! Danger! Will Robinson; box and item are the same!",box,item); |
447
5a0779561d0f
Add more tests for dw_pac*() functions. Throw up a messagebox if you try and
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
438
diff
changeset
|
7952 return; |
5a0779561d0f
Add more tests for dw_pac*() functions. Throw up a messagebox if you try and
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
438
diff
changeset
|
7953 } |
5a0779561d0f
Add more tests for dw_pac*() functions. Throw up a messagebox if you try and
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
438
diff
changeset
|
7954 |
3 | 7955 if(WinWindowFromID(box, FID_CLIENT)) |
7956 { | |
7957 box = WinWindowFromID(box, FID_CLIENT); | |
7958 thisbox = WinQueryWindowPtr(box, QWP_USER); | |
7959 hsize = TRUE; | |
7960 vsize = TRUE; | |
7961 } | |
7962 else | |
7963 thisbox = WinQueryWindowPtr(box, QWP_USER); | |
7964 if(thisbox) | |
7965 { | |
462
9d874ce0124a
Removed obsolete code from dw_box_pack_* and from dw_file_browse().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
458
diff
changeset
|
7966 if(thisbox->type == DW_HORZ) |
9d874ce0124a
Removed obsolete code from dw_box_pack_* and from dw_file_browse().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
458
diff
changeset
|
7967 _dw_box_pack_end(box, item, width, height, hsize, vsize, pad, funcname); |
9d874ce0124a
Removed obsolete code from dw_box_pack_* and from dw_file_browse().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
458
diff
changeset
|
7968 else |
9d874ce0124a
Removed obsolete code from dw_box_pack_* and from dw_file_browse().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
458
diff
changeset
|
7969 _dw_box_pack_start(box, item, width, height, hsize, vsize, pad, funcname); |
9d874ce0124a
Removed obsolete code from dw_box_pack_* and from dw_file_browse().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
458
diff
changeset
|
7970 } |
9d874ce0124a
Removed obsolete code from dw_box_pack_* and from dw_file_browse().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
458
diff
changeset
|
7971 } |
9d874ce0124a
Removed obsolete code from dw_box_pack_* and from dw_file_browse().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
458
diff
changeset
|
7972 |
9d874ce0124a
Removed obsolete code from dw_box_pack_* and from dw_file_browse().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
458
diff
changeset
|
7973 void _dw_box_pack_start(HWND box, HWND item, int width, int height, int hsize, int vsize, int pad, char *functionname) |
9d874ce0124a
Removed obsolete code from dw_box_pack_* and from dw_file_browse().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
458
diff
changeset
|
7974 { |
9d874ce0124a
Removed obsolete code from dw_box_pack_* and from dw_file_browse().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
458
diff
changeset
|
7975 Box *thisbox = WinQueryWindowPtr(box, QWP_USER); |
9d874ce0124a
Removed obsolete code from dw_box_pack_* and from dw_file_browse().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
458
diff
changeset
|
7976 |
9d874ce0124a
Removed obsolete code from dw_box_pack_* and from dw_file_browse().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
458
diff
changeset
|
7977 if(thisbox) |
9d874ce0124a
Removed obsolete code from dw_box_pack_* and from dw_file_browse().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
458
diff
changeset
|
7978 { |
3 | 7979 int z; |
7980 Item *tmpitem, *thisitem = thisbox->items; | |
7981 char tmpbuf[100]; | |
405
4c084ec3e176
Ok, so that last fix has some problems, this new fix is a hybrid of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
404
diff
changeset
|
7982 HWND frame = (HWND)dw_window_get_data(item, "_dw_combo_box"); |
3 | 7983 |
7984 tmpitem = malloc(sizeof(Item)*(thisbox->count+1)); | |
7985 | |
7986 for(z=0;z<thisbox->count;z++) | |
7987 { | |
7988 tmpitem[z+1] = thisitem[z]; | |
7989 } | |
7990 | |
7991 WinQueryClassName(item, 99, tmpbuf); | |
7992 | |
298
caed245ea8a1
Sanity check, if expand is set width/height can't be zero... force it to 1.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
293
diff
changeset
|
7993 if(vsize && !height) |
caed245ea8a1
Sanity check, if expand is set width/height can't be zero... force it to 1.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
293
diff
changeset
|
7994 height = 1; |
caed245ea8a1
Sanity check, if expand is set width/height can't be zero... force it to 1.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
293
diff
changeset
|
7995 if(hsize && !width) |
caed245ea8a1
Sanity check, if expand is set width/height can't be zero... force it to 1.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
293
diff
changeset
|
7996 width = 1; |
caed245ea8a1
Sanity check, if expand is set width/height can't be zero... force it to 1.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
293
diff
changeset
|
7997 |
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
|
7998 if(strncmp(tmpbuf, "#1", 3)==0) |
3 | 7999 tmpitem[0].type = TYPEBOX; |
8000 else | |
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
|
8001 { |
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
|
8002 if ( width == 0 && hsize == FALSE ) |
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
|
8003 dw_messagebox(functionname, DW_MB_OK|DW_MB_ERROR, "Width and expand Horizonal both unset for box: %x item: %x",box,item); |
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
|
8004 if ( height == 0 && vsize == FALSE ) |
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
|
8005 dw_messagebox(functionname, DW_MB_OK|DW_MB_ERROR, "Height and expand Vertical both unset for box: %x item: %x",box,item); |
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
|
8006 |
3 | 8007 tmpitem[0].type = TYPEITEM; |
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
|
8008 } |
3 | 8009 |
8010 tmpitem[0].hwnd = item; | |
8011 tmpitem[0].origwidth = tmpitem[0].width = width; | |
8012 tmpitem[0].origheight = tmpitem[0].height = height; | |
8013 tmpitem[0].pad = pad; | |
8014 if(hsize) | |
8015 tmpitem[0].hsize = SIZEEXPAND; | |
8016 else | |
8017 tmpitem[0].hsize = SIZESTATIC; | |
8018 | |
8019 if(vsize) | |
8020 tmpitem[0].vsize = SIZEEXPAND; | |
8021 else | |
8022 tmpitem[0].vsize = SIZESTATIC; | |
8023 | |
8024 thisbox->items = tmpitem; | |
8025 | |
8026 if(thisbox->count) | |
8027 free(thisitem); | |
8028 | |
8029 thisbox->count++; | |
8030 | |
8031 WinQueryClassName(item, 99, tmpbuf); | |
37
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
8032 /* Don't set the ownership if it's an entryfield or spinbutton */ |
408
fecd529ba9d4
Use dW_box_new() instead of WinCreateWindow() to make the container window
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
406
diff
changeset
|
8033 if(strncmp(tmpbuf, "#6", 3)!=0 && strncmp(tmpbuf, "#32", 4)!=0 && strncmp(tmpbuf, "#2", 3)!=0) |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
8034 WinSetOwner(item, box); |
405
4c084ec3e176
Ok, so that last fix has some problems, this new fix is a hybrid of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
404
diff
changeset
|
8035 WinSetParent(frame ? frame : item, box, FALSE); |
3 | 8036 } |
8037 } | |
8038 | |
8039 /* The following two functions graciously contributed by Peter Nielsen. */ | |
8040 static ULONG _ParseBuildLevel (char* pchBuffer, ULONG ulSize) { | |
8041 char* pchStart = pchBuffer; | |
8042 char* pchEnd = pchStart + ulSize - 2; | |
8043 | |
8044 while (pchEnd >= pchStart) | |
8045 { | |
8046 if ((pchEnd[0] == '#') && (pchEnd[1] == '@')) | |
8047 { | |
8048 *pchEnd-- = '\0'; | |
8049 while (pchEnd >= pchStart) | |
8050 { | |
8051 if ((pchEnd[0] == '@') && (pchEnd[1] == '#')) | |
8052 { | |
8053 ULONG ulMajor = 0; | |
8054 ULONG ulMinor = 0; | |
8055 | |
8056 char* pch = pchEnd + 2; | |
154
7f8fcce45bdd
Fixed EMX building.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
8057 while (!isdigit ((int)*pch) && *pch) |
3 | 8058 pch++; |
8059 | |
154
7f8fcce45bdd
Fixed EMX building.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
8060 while (isdigit ((int)*pch)) |
3 | 8061 ulMajor = ulMajor * 10 + *pch++ - '0'; |
8062 | |
8063 if (*pch == '.') | |
8064 { | |
154
7f8fcce45bdd
Fixed EMX building.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
8065 while (isdigit ((int)*++pch)) |
3 | 8066 ulMinor = ulMinor * 10 + *pch - '0'; |
8067 } | |
8068 return ((ulMajor << 16) | ulMinor); | |
8069 } | |
8070 pchEnd--; | |
8071 } | |
8072 } | |
8073 pchEnd--; | |
8074 } | |
8075 return (0); | |
8076 } | |
8077 | |
8078 ULONG _GetSystemBuildLevel(void) { | |
8079 /* The build level info is normally available in the end of the OS2KRNL file. However, this is not the case in some beta versions of OS/2. | |
8080 * We first try to find the info in the 256 last bytes of the file. If that fails, we load the entire file and search it completely. | |
8081 */ | |
8082 ULONG ulBootDrive = 0; | |
8083 ULONG ulBuild = 0; | |
8084 if (DosQuerySysInfo (QSV_BOOT_DRIVE, QSV_BOOT_DRIVE, &ulBootDrive, sizeof (ulBootDrive)) == NO_ERROR) | |
8085 { | |
172
0fc45e386376
Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
171
diff
changeset
|
8086 char achFileName[11] = "C:\\OS2KRNL"; |
3 | 8087 HFILE hfile; |
8088 ULONG ulResult; | |
172
0fc45e386376
Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
171
diff
changeset
|
8089 |
0fc45e386376
Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
171
diff
changeset
|
8090 achFileName[0] = (char)('A'+ulBootDrive-1); |
0fc45e386376
Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
171
diff
changeset
|
8091 |
3 | 8092 if (DosOpen (achFileName, &hfile, &ulResult, 0, 0, OPEN_ACTION_FAIL_IF_NEW | OPEN_ACTION_OPEN_IF_EXISTS, OPEN_FLAGS_FAIL_ON_ERROR | OPEN_FLAGS_NO_CACHE | OPEN_FLAGS_SEQUENTIAL | OPEN_SHARE_DENYNONE | OPEN_ACCESS_READONLY, NULL) == NO_ERROR) |
8093 { | |
8094 ULONG ulFileSize = 0; | |
8095 if (DosSetFilePtr (hfile, 0, FILE_END, &ulFileSize) == NO_ERROR) | |
8096 { | |
8097 const ULONG ulFirstTry = min (256, ulFileSize); | |
8098 if (DosSetFilePtr (hfile, -(LONG)ulFirstTry, FILE_END, &ulResult) == NO_ERROR) | |
8099 { | |
8100 char *pchBuffer = malloc(ulFirstTry); | |
8101 if (DosRead (hfile, pchBuffer, ulFirstTry, &ulResult) == NO_ERROR) | |
8102 { | |
8103 ulBuild = _ParseBuildLevel (pchBuffer, ulFirstTry); | |
8104 if (ulBuild == 0) | |
8105 { | |
8106 if (DosSetFilePtr (hfile, 0, FILE_BEGIN, &ulResult) == NO_ERROR) | |
8107 { | |
8108 free(pchBuffer); | |
8109 pchBuffer = malloc(ulFileSize); | |
8110 | |
8111 if (DosRead (hfile, pchBuffer, ulFileSize, &ulResult) == NO_ERROR) | |
8112 ulBuild = _ParseBuildLevel (pchBuffer, ulFileSize); | |
8113 } | |
8114 } | |
8115 } | |
8116 free(pchBuffer); | |
8117 } | |
8118 } | |
8119 DosClose (hfile); | |
8120 } | |
8121 } | |
8122 return (ulBuild); | |
8123 } | |
8124 | |
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
|
8125 /* |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
8126 * 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
|
8127 * 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
|
8128 * 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
|
8129 * 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
|
8130 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
8131 void API dw_window_default(HWND window, HWND 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
|
8132 { |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
8133 Box *thisbox = NULL; |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
8134 HWND box; |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
8135 |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
8136 box = WinWindowFromID(window, FID_CLIENT); |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
8137 if(box) |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
8138 thisbox = WinQueryWindowPtr(box, QWP_USER); |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
8139 |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
8140 if(thisbox) |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
8141 thisbox->defaultitem = 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
|
8142 } |
3 | 8143 |
8144 /* | |
40
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
8145 * 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
|
8146 * Parameters: |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
8147 * 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
|
8148 * 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
|
8149 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
8150 void API dw_window_click_default(HWND window, HWND next) |
40
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
8151 { |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
8152 WindowData *blah = (WindowData *)WinQueryWindowPtr(window, QWP_USER); |
94
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
8153 |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
8154 if(blah) |
40
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
8155 blah->clickdefault = next; |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
8156 } |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
8157 |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
8158 /* |
3 | 8159 * Returns some information about the current operating environment. |
8160 * Parameters: | |
8161 * env: Pointer to a DWEnv struct. | |
8162 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
8163 void API dw_environment_query(DWEnv *env) |
3 | 8164 { |
8165 ULONG Build; | |
8166 | |
8167 if(!env) | |
8168 return; | |
8169 | |
8170 /* The default is OS/2 2.0 */ | |
8171 strcpy(env->osName,"OS/2"); | |
8172 env->MajorVersion = 2; | |
8173 env->MinorVersion = 0; | |
8174 | |
8175 Build = _GetSystemBuildLevel(); | |
8176 env->MinorBuild = Build & 0xFFFF; | |
8177 env->MajorBuild = Build >> 16; | |
8178 | |
8179 if (aulBuffer[0] == 20) | |
8180 { | |
8181 int i = (unsigned int)aulBuffer[1]; | |
8182 if (i > 20) | |
8183 { | |
8184 strcpy(env->osName,"Warp"); | |
8185 env->MajorVersion = (int)i/10; | |
8186 env->MinorVersion = i-(((int)i/10)*10); | |
8187 } | |
8188 else if (i == 10) | |
8189 env->MinorVersion = 1; | |
8190 } | |
15
81833f25b1aa
Added new Dynamic Windows build information to the DWEnv struct.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
14
diff
changeset
|
8191 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
|
8192 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
|
8193 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
|
8194 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
|
8195 env->DWSubVersion = DW_SUB_VERSION; |
3 | 8196 } |
8197 | |
476
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8198 /* The next few functions are support functions for the OS/2 folder browser */ |
485
469ff8133ed3
Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
478
diff
changeset
|
8199 void _populate_directory(HWND tree, HTREEITEM parent, char *path) |
476
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8200 { |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8201 FILEFINDBUF3 ffbuf; |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8202 HTREEITEM item; |
478
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
8203 ULONG count = 1; |
476
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8204 HDIR hdir = HDIR_CREATE; |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8205 |
485
469ff8133ed3
Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
478
diff
changeset
|
8206 if(DosFindFirst(path, &hdir, FILE_READONLY | FILE_HIDDEN | FILE_SYSTEM | FILE_ARCHIVED | MUST_HAVE_DIRECTORY, |
469ff8133ed3
Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
478
diff
changeset
|
8207 &ffbuf, sizeof(FILEFINDBUF3), &count, FIL_STANDARD) == NO_ERROR) |
469ff8133ed3
Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
478
diff
changeset
|
8208 { |
469ff8133ed3
Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
478
diff
changeset
|
8209 while(DosFindNext(hdir, &ffbuf, sizeof(FILEFINDBUF3), &count) == NO_ERROR) |
476
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8210 { |
485
469ff8133ed3
Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
478
diff
changeset
|
8211 if(strcmp(ffbuf.achName, ".") && strcmp(ffbuf.achName, "..")) |
476
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8212 { |
485
469ff8133ed3
Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
478
diff
changeset
|
8213 int len = strlen(path); |
469ff8133ed3
Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
478
diff
changeset
|
8214 char *folder = malloc(len + ffbuf.cchName + 2); |
469ff8133ed3
Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
478
diff
changeset
|
8215 HTREEITEM tempitem; |
469ff8133ed3
Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
478
diff
changeset
|
8216 |
469ff8133ed3
Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
478
diff
changeset
|
8217 strcpy(folder, path); |
469ff8133ed3
Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
478
diff
changeset
|
8218 strcpy(&folder[len-1], ffbuf.achName); |
469ff8133ed3
Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
478
diff
changeset
|
8219 |
469ff8133ed3
Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
478
diff
changeset
|
8220 item = dw_tree_insert(tree, ffbuf.achName, WinLoadFileIcon(folder, TRUE), parent, (void *)parent); |
469ff8133ed3
Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
478
diff
changeset
|
8221 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
|
8222 dw_tree_item_set_data(tree, item, (void *)tempitem); |
476
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8223 } |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8224 } |
485
469ff8133ed3
Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
478
diff
changeset
|
8225 DosFindClose(hdir); |
469ff8133ed3
Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
478
diff
changeset
|
8226 } |
476
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8227 } |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8228 |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8229 void _populate_tree_thread(void *data) |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8230 { |
485
469ff8133ed3
Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
478
diff
changeset
|
8231 HWND window = (HWND)data, tree = (HWND)dw_window_get_data(window, "_dw_tree"); |
476
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8232 HMTX mtx = (HMTX)dw_window_get_data(window, "_dw_mutex"); |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8233 int drive; |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8234 HTREEITEM items[26]; |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8235 FSINFO volinfo; |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8236 |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8237 DosError(FERR_DISABLEHARDERR); |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8238 |
485
469ff8133ed3
Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
478
diff
changeset
|
8239 dw_mutex_lock(mtx); |
476
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8240 for(drive=0;drive<26;drive++) |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8241 { |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8242 if(DosQueryFSInfo(drive+1, FSIL_VOLSER,(PVOID)&volinfo, sizeof(FSINFO)) == NO_ERROR) |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8243 { |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8244 char folder[5] = "C:\\", name[9] = "Drive C:"; |
478
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
8245 HTREEITEM tempitem; |
476
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8246 |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8247 folder[0] = name[6] = 'A' + drive; |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8248 |
485
469ff8133ed3
Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
478
diff
changeset
|
8249 items[drive] = dw_tree_insert(tree, name, WinLoadFileIcon(folder, TRUE), NULL, 0); |
469ff8133ed3
Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
478
diff
changeset
|
8250 tempitem = dw_tree_insert(tree, "", 0, items[drive], 0); |
513
7755599311d4
Fixes search and replace errors.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
511
diff
changeset
|
8251 dw_tree_item_set_data(tree, items[drive], (void *)tempitem); |
476
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8252 } |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8253 else |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8254 items[drive] = 0; |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8255 } |
485
469ff8133ed3
Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
478
diff
changeset
|
8256 dw_mutex_unlock(mtx); |
469ff8133ed3
Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
478
diff
changeset
|
8257 |
476
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8258 DosError(FERR_ENABLEHARDERR); |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8259 } |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8260 |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8261 int DWSIGNAL _dw_ok_func(HWND window, void *data) |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8262 { |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8263 DWDialog *dwwait = (DWDialog *)data; |
485
469ff8133ed3
Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
478
diff
changeset
|
8264 HMTX mtx = (HMTX)dw_window_get_data((HWND)dwwait->data, "_dw_mutex"); |
476
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8265 void *treedata; |
485
469ff8133ed3
Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
478
diff
changeset
|
8266 |
469ff8133ed3
Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
478
diff
changeset
|
8267 window = window; |
476
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8268 if(!dwwait) |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8269 return FALSE; |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8270 |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8271 dw_mutex_lock(mtx); |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8272 treedata = dw_window_get_data((HWND)dwwait->data, "_dw_tree_selected"); |
485
469ff8133ed3
Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
478
diff
changeset
|
8273 dw_mutex_close(mtx); |
476
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8274 dw_window_destroy((HWND)dwwait->data); |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8275 dw_dialog_dismiss((DWDialog *)data, treedata); |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8276 return FALSE; |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8277 } |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8278 |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8279 int DWSIGNAL _dw_cancel_func(HWND window, void *data) |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8280 { |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8281 DWDialog *dwwait = (DWDialog *)data; |
485
469ff8133ed3
Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
478
diff
changeset
|
8282 HMTX mtx = (HMTX)dw_window_get_data((HWND)dwwait->data, "_dw_mutex"); |
469ff8133ed3
Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
478
diff
changeset
|
8283 |
469ff8133ed3
Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
478
diff
changeset
|
8284 window = window; |
476
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8285 if(!dwwait) |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8286 return FALSE; |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8287 |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8288 dw_mutex_lock(mtx); |
485
469ff8133ed3
Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
478
diff
changeset
|
8289 dw_mutex_close(mtx); |
476
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8290 dw_window_destroy((HWND)dwwait->data); |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8291 dw_dialog_dismiss((DWDialog *)data, NULL); |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8292 return FALSE; |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8293 } |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8294 |
478
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
8295 char *_tree_folder(HWND tree, HTREEITEM item) |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
8296 { |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
8297 char *folder=strdup(""); |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
8298 HTREEITEM parent = item; |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
8299 |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
8300 while(parent) |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
8301 { |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
8302 char *temp, *text = dw_tree_get_title(tree, parent); |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
8303 |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
8304 if(text) |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
8305 { |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
8306 if(strncmp(text, "Drive ", 6) == 0) |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
8307 text = &text[6]; |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
8308 |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
8309 temp = malloc(strlen(text) + strlen(folder) + 3); |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
8310 strcpy(temp, text); |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
8311 strcat(temp, "\\"); |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
8312 strcat(temp, folder); |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
8313 free(folder); |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
8314 folder = temp; |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
8315 } |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
8316 parent = dw_tree_get_parent(tree, parent); |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
8317 } |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
8318 return folder; |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
8319 } |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
8320 |
476
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8321 int DWSIGNAL _item_select(HWND window, HTREEITEM item, char *text, void *data, void *itemdata) |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8322 { |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8323 DWDialog *dwwait = (DWDialog *)data; |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8324 char *treedata = (char *)dw_window_get_data((HWND)dwwait->data, "_dw_tree_selected"); |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8325 |
478
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
8326 text = text; itemdata = itemdata; |
476
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8327 if(treedata) |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8328 free(treedata); |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8329 |
478
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
8330 treedata = _tree_folder(window, item); |
476
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8331 dw_window_set_data((HWND)dwwait->data, "_dw_tree_selected", (void *)treedata); |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8332 |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8333 return FALSE; |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8334 } |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8335 |
478
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
8336 int DWSIGNAL _tree_expand(HWND window, HTREEITEM item, void *data) |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
8337 { |
510
710f82598210
Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
508
diff
changeset
|
8338 HTREEITEM tempitem = (HTREEITEM)dw_tree_item_get_data(window, item); |
485
469ff8133ed3
Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
478
diff
changeset
|
8339 |
469ff8133ed3
Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
478
diff
changeset
|
8340 data = data; |
478
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
8341 if(tempitem) |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
8342 { |
485
469ff8133ed3
Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
478
diff
changeset
|
8343 char *folder = _tree_folder(window, item); |
469ff8133ed3
Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
478
diff
changeset
|
8344 |
513
7755599311d4
Fixes search and replace errors.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
511
diff
changeset
|
8345 dw_tree_item_set_data(window, item, 0); |
510
710f82598210
Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
508
diff
changeset
|
8346 dw_tree_item_delete(window, tempitem); |
478
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
8347 |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
8348 if(*folder) |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
8349 { |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
8350 strcat(folder, "*"); |
485
469ff8133ed3
Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
478
diff
changeset
|
8351 _populate_directory(window, item, folder); |
478
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
8352 } |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
8353 free(folder); |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
8354 } |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
8355 |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
8356 return FALSE; |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
8357 } |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
8358 |
3 | 8359 /* |
8360 * Opens a file dialog and queries user selection. | |
8361 * Parameters: | |
8362 * title: Title bar text for dialog. | |
8363 * defpath: The default path of the open dialog. | |
8364 * ext: Default file extention. | |
8365 * flags: DW_FILE_OPEN or DW_FILE_SAVE. | |
8366 * Returns: | |
8367 * NULL on error. A malloced buffer containing | |
8368 * the file path on success. | |
8369 * | |
8370 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
8371 char * API dw_file_browse(char *title, char *defpath, char *ext, int flags) |
3 | 8372 { |
476
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8373 if(flags == DW_DIRECTORY_OPEN) |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8374 { |
485
469ff8133ed3
Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
478
diff
changeset
|
8375 HWND window, hbox, vbox, tree, button; |
476
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8376 DWDialog *dwwait; |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8377 HMTX mtx = dw_mutex_new(); |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8378 |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8379 window = dw_window_new( HWND_DESKTOP, title, FCF_SHELLPOSITION | FCF_TITLEBAR | FCF_SIZEBORDER | FCF_MINMAX); |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8380 |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8381 vbox = dw_box_new(DW_VERT, 5); |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8382 |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8383 dw_box_pack_start(window, vbox, 0, 0, TRUE, TRUE, 0); |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8384 |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8385 tree = dw_tree_new(60); |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8386 |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8387 dw_box_pack_start(vbox, tree, 1, 1, TRUE, TRUE, 0); |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8388 dw_window_set_data(window, "_dw_mutex", (void *)mtx); |
485
469ff8133ed3
Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
478
diff
changeset
|
8389 dw_window_set_data(window, "_dw_tree", (void *)tree); |
476
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8390 |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8391 hbox = dw_box_new(DW_HORZ, 0); |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8392 |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8393 dw_box_pack_start(vbox, hbox, 0, 0, TRUE, FALSE, 0); |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8394 |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8395 dwwait = dw_dialog_new((void *)window); |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8396 |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8397 dw_signal_connect(tree, DW_SIGNAL_ITEM_SELECT, DW_SIGNAL_FUNC(_item_select), (void *)dwwait); |
478
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
8398 dw_signal_connect(tree, DW_SIGNAL_TREE_EXPAND, DW_SIGNAL_FUNC(_tree_expand), (void *)dwwait); |
476
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8399 |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8400 button = dw_button_new("Ok", 1001L); |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8401 dw_box_pack_start(hbox, button, 50, 30, TRUE, FALSE, 3); |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8402 dw_signal_connect(button, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(_dw_ok_func), (void *)dwwait); |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8403 |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8404 button = dw_button_new("Cancel", 1002L); |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8405 dw_box_pack_start(hbox, button, 50, 30, TRUE, FALSE, 3); |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8406 dw_signal_connect(button, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(_dw_cancel_func), (void *)dwwait); |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8407 |
510
710f82598210
Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
508
diff
changeset
|
8408 dw_window_set_size(window, 225, 300); |
476
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8409 dw_window_show(window); |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8410 |
478
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
8411 dw_thread_new((void *)_populate_tree_thread, (void *)window, 0xff); |
476
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8412 return (char *)dw_dialog_wait(dwwait); |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8413 } |
3 | 8414 else |
476
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8415 { |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8416 FILEDLG fild; |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8417 HWND hwndFile; |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8418 int len; |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8419 |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8420 if(defpath) |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8421 strcpy(fild.szFullFile, defpath); |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8422 else |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8423 strcpy(fild.szFullFile, ""); |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8424 |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8425 len = strlen(fild.szFullFile); |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8426 |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8427 if(len) |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8428 { |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8429 if(fild.szFullFile[len-1] != '\\') |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8430 strcat(fild.szFullFile, "\\"); |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8431 } |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8432 strcat(fild.szFullFile, "*"); |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8433 |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8434 if(ext) |
3 | 8435 { |
476
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8436 strcat(fild.szFullFile, "."); |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8437 strcat(fild.szFullFile, ext); |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8438 } |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8439 |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8440 memset(&fild, 0, sizeof(FILEDLG)); |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8441 fild.cbSize = sizeof(FILEDLG); |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8442 fild.fl = FDS_CENTER | FDS_OPEN_DIALOG; |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8443 fild.pszTitle = title; |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8444 fild.pszOKButton = ((flags & DW_FILE_SAVE) ? "Save" : "Open"); |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8445 fild.pfnDlgProc = (PFNWP)WinDefFileDlgProc; |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8446 |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8447 hwndFile = WinFileDlg(HWND_DESKTOP, HWND_DESKTOP, &fild); |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8448 if(hwndFile) |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8449 { |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8450 switch(fild.lReturn) |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8451 { |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8452 case DID_OK: |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8453 return strdup(fild.szFullFile); |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8454 case DID_CANCEL: |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8455 return NULL; |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8456 } |
3 | 8457 } |
8458 } | |
8459 return NULL; | |
8460 } | |
8461 | |
170
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
8462 /* Internal function to set drive and directory */ |
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
8463 int _SetPath(char *path) |
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
8464 { |
172
0fc45e386376
Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
171
diff
changeset
|
8465 #ifndef __WATCOMC__ |
170
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
8466 if(strlen(path) > 2) |
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
8467 { |
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
8468 if(path[1] == ':') |
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
8469 { |
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
8470 char drive = toupper(path[0]); |
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
8471 _chdrive((drive - 'A')+1); |
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
8472 } |
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
8473 } |
172
0fc45e386376
Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
171
diff
changeset
|
8474 #endif |
170
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
8475 return chdir(path); |
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
8476 } |
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
8477 |
3 | 8478 /* |
8479 * Execute and external program in a seperate session. | |
8480 * Parameters: | |
8481 * program: Program name with optional path. | |
8482 * type: Either DW_EXEC_CON or DW_EXEC_GUI. | |
8483 * params: An array of pointers to string arguements. | |
8484 * Returns: | |
8485 * -1 on error. | |
8486 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
8487 int API dw_exec(char *program, int type, char **params) |
3 | 8488 { |
475
1547e8c327d9
Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
470
diff
changeset
|
8489 type = type; /* keep compiler happy */ |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
8490 return spawnvp(P_NOWAIT, program, (const char **)params); |
3 | 8491 } |
8492 | |
8493 /* | |
8494 * Loads a web browser pointed at the given URL. | |
8495 * Parameters: | |
8496 * url: Uniform resource locator. | |
8497 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
8498 int API dw_browse(char *url) |
3 | 8499 { |
170
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
8500 char *execargs[3], browser[1024], *olddir, *newurl = NULL; |
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
8501 int len, ret; |
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
8502 |
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
8503 olddir = _getcwd(NULL, 1024); |
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
8504 |
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
8505 PrfQueryProfileString(HINI_USERPROFILE, "WPURLDEFAULTSETTINGS", |
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
8506 "DefaultWorkingDir", NULL, browser, 1024); |
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
8507 |
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
8508 if(browser[0]) |
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
8509 _SetPath(browser); |
3 | 8510 |
8511 PrfQueryProfileString(HINI_USERPROFILE, "WPURLDEFAULTSETTINGS", | |
8512 "DefaultBrowserExe", NULL, browser, 1024); | |
8513 | |
20
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
8514 len = strlen(browser) - strlen("explore.exe"); |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
8515 |
3 | 8516 execargs[0] = browser; |
8517 execargs[1] = url; | |
8518 execargs[2] = NULL; | |
8519 | |
20
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
8520 /* Special case for Web Explorer, it requires file:/// instead |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
8521 * of file:// so I am handling it here. |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
8522 */ |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
8523 if(len > 0) |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
8524 { |
356
fb2667339e9f
Guess I should probably make sure they are trying to load a file
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
350
diff
changeset
|
8525 if(stricmp(&browser[len], "explore.exe") == 0 && stricmp(url, "file://") == 0) |
20
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
8526 { |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
8527 int newlen, z; |
172
0fc45e386376
Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
171
diff
changeset
|
8528 newurl = malloc(strlen(url) + 2); |
20
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
8529 sprintf(newurl, "file:///%s", &url[7]); |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
8530 newlen = strlen(newurl); |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
8531 for(z=8;z<(newlen-8);z++) |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
8532 { |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
8533 if(newurl[z] == '|') |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
8534 newurl[z] = ':'; |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
8535 if(newurl[z] == '/') |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
8536 newurl[z] = '\\'; |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
8537 } |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
8538 execargs[1] = newurl; |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
8539 } |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
8540 } |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
8541 |
170
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
8542 ret = dw_exec(browser, DW_EXEC_GUI, execargs); |
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
8543 |
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
8544 if(olddir) |
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
8545 { |
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
8546 _SetPath(olddir); |
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
8547 free(olddir); |
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
8548 } |
172
0fc45e386376
Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
171
diff
changeset
|
8549 if(newurl) |
0fc45e386376
Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
171
diff
changeset
|
8550 free(newurl); |
170
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
8551 return ret; |
3 | 8552 } |
8553 | |
8554 /* | |
8555 * Returns a pointer to a static buffer which containes the | |
8556 * current user directory. Or the root directory (C:\ on | |
8557 * OS/2 and Windows). | |
8558 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
8559 char * API dw_user_dir(void) |
3 | 8560 { |
8561 static char _user_dir[1024] = ""; | |
8562 | |
8563 if(!_user_dir[0]) | |
8564 { | |
8565 char *home = getenv("HOME"); | |
8566 | |
8567 if(home) | |
8568 strcpy(_user_dir, home); | |
8569 else | |
8570 strcpy(_user_dir, "C:\\"); | |
8571 } | |
8572 return _user_dir; | |
8573 } | |
8574 | |
8575 /* | |
8576 * Call a function from the window (widget)'s context. | |
8577 * Parameters: | |
8578 * handle: Window handle of the widget. | |
8579 * function: Function pointer to be called. | |
8580 * data: Pointer to the data to be passed to the function. | |
8581 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
8582 void API dw_window_function(HWND handle, void *function, void *data) |
3 | 8583 { |
8584 WinSendMsg(handle, WM_USER, (MPARAM)function, (MPARAM)data); | |
8585 } | |
8586 | |
90
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8587 /* Functions for managing the user data lists that are associated with |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8588 * a given window handle. Used in dw_window_set_data() and |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8589 * dw_window_get_data(). |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8590 */ |
159
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
8591 UserData *_find_userdata(UserData **root, char *varname) |
90
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8592 { |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8593 UserData *tmp = *root; |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8594 |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8595 while(tmp) |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8596 { |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8597 if(stricmp(tmp->varname, varname) == 0) |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8598 return tmp; |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8599 tmp = tmp->next; |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8600 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8601 return NULL; |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8602 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8603 |
159
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
8604 int _new_userdata(UserData **root, char *varname, void *data) |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
8605 { |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
8606 UserData *new = _find_userdata(root, varname); |
90
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8607 |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8608 if(new) |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8609 { |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8610 new->data = data; |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8611 return TRUE; |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8612 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8613 else |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8614 { |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8615 new = malloc(sizeof(UserData)); |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8616 if(new) |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8617 { |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8618 new->varname = strdup(varname); |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8619 new->data = data; |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8620 |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8621 new->next = NULL; |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8622 |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8623 if (!*root) |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8624 *root = new; |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8625 else |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8626 { |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8627 UserData *prev = NULL, *tmp = *root; |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8628 while(tmp) |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8629 { |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8630 prev = tmp; |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8631 tmp = tmp->next; |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8632 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8633 if(prev) |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8634 prev->next = new; |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8635 else |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8636 *root = new; |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8637 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8638 return TRUE; |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8639 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8640 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8641 return FALSE; |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8642 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8643 |
159
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
8644 int _remove_userdata(UserData **root, char *varname, int all) |
90
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8645 { |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8646 UserData *prev = NULL, *tmp = *root; |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8647 |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8648 while(tmp) |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8649 { |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8650 if(all || stricmp(tmp->varname, varname) == 0) |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8651 { |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8652 if(!prev) |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8653 { |
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:
137
diff
changeset
|
8654 *root = tmp->next; |
90
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8655 free(tmp->varname); |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8656 free(tmp); |
180
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
8657 if(!all) |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
8658 return 0; |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
8659 tmp = *root; |
90
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8660 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8661 else |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8662 { |
180
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
8663 /* If all is true we should |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
8664 * never get here. |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
8665 */ |
90
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8666 prev->next = tmp->next; |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8667 free(tmp->varname); |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8668 free(tmp); |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8669 return 0; |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8670 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8671 } |
180
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
8672 else |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
8673 { |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
8674 prev = tmp; |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
8675 tmp = tmp->next; |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
8676 } |
90
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8677 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8678 return 0; |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8679 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8680 |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8681 /* |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8682 * 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:
72
diff
changeset
|
8683 * Parameters: |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8684 * 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:
72
diff
changeset
|
8685 * 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:
72
diff
changeset
|
8686 * 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:
72
diff
changeset
|
8687 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
8688 void API dw_window_set_data(HWND window, char *dataname, void *data) |
90
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8689 { |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8690 WindowData *blah = (WindowData *)WinQueryWindowPtr(window, QWP_USER); |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8691 |
117
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
8692 if(!blah) |
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
8693 { |
180
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
8694 if(!dataname) |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
8695 return; |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
8696 |
117
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
8697 blah = calloc(1, sizeof(WindowData)); |
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
8698 WinSetWindowPtr(window, QWP_USER, blah); |
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
8699 } |
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
8700 |
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
8701 if(data) |
159
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
8702 _new_userdata(&(blah->root), dataname, data); |
117
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
8703 else |
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
8704 { |
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
8705 if(dataname) |
159
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
8706 _remove_userdata(&(blah->root), dataname, FALSE); |
90
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8707 else |
159
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
8708 _remove_userdata(&(blah->root), NULL, TRUE); |
90
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8709 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8710 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8711 |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8712 /* |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8713 * 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:
72
diff
changeset
|
8714 * Parameters: |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8715 * 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:
72
diff
changeset
|
8716 * 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:
72
diff
changeset
|
8717 * 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:
72
diff
changeset
|
8718 */ |
507
c607eb385e58
Added missing calling conventions. Thanks Bastian for pointing this out.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
503
diff
changeset
|
8719 void * API dw_window_get_data(HWND window, char *dataname) |
90
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8720 { |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8721 WindowData *blah = (WindowData *)WinQueryWindowPtr(window, QWP_USER); |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8722 |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8723 if(blah && blah->root && dataname) |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8724 { |
159
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
8725 UserData *ud = _find_userdata(&(blah->root), dataname); |
90
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8726 if(ud) |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8727 return ud->data; |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8728 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8729 return NULL; |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8730 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8731 |
3 | 8732 /* |
195
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8733 * 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:
192
diff
changeset
|
8734 * Parameters: |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8735 * interval: Milliseconds to delay between calls. |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8736 * 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:
192
diff
changeset
|
8737 * 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:
192
diff
changeset
|
8738 * Returns: |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8739 * 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:
192
diff
changeset
|
8740 */ |
199
b955228477b3
Removed the window parameter to dw_timer_connect() it was no needed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
195
diff
changeset
|
8741 int API dw_timer_connect(int interval, void *sigfunc, void *data) |
b955228477b3
Removed the window parameter to dw_timer_connect() it was no needed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
195
diff
changeset
|
8742 { |
b955228477b3
Removed the window parameter to dw_timer_connect() it was no needed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
195
diff
changeset
|
8743 if(sigfunc) |
b955228477b3
Removed the window parameter to dw_timer_connect() it was no needed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
195
diff
changeset
|
8744 { |
289
0e6f09149eaa
Fixed some EMX warnings.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
283
diff
changeset
|
8745 int timerid = WinStartTimer(dwhab, NULLHANDLE, 0, interval); |
199
b955228477b3
Removed the window parameter to dw_timer_connect() it was no needed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
195
diff
changeset
|
8746 |
b955228477b3
Removed the window parameter to dw_timer_connect() it was no needed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
195
diff
changeset
|
8747 if(timerid) |
b955228477b3
Removed the window parameter to dw_timer_connect() it was no needed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
195
diff
changeset
|
8748 { |
b955228477b3
Removed the window parameter to dw_timer_connect() it was no needed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
195
diff
changeset
|
8749 _new_signal(WM_TIMER, NULLHANDLE, timerid, sigfunc, data); |
b955228477b3
Removed the window parameter to dw_timer_connect() it was no needed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
195
diff
changeset
|
8750 return timerid; |
b955228477b3
Removed the window parameter to dw_timer_connect() it was no needed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
195
diff
changeset
|
8751 } |
195
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8752 } |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8753 return 0; |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8754 } |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8755 |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8756 /* |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8757 * Removes timer callback. |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8758 * Parameters: |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8759 * 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:
192
diff
changeset
|
8760 */ |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8761 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:
192
diff
changeset
|
8762 { |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8763 SignalHandler *prev = NULL, *tmp = Root; |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8764 |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8765 /* 0 is an invalid timer ID */ |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8766 if(!id) |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8767 return; |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8768 |
199
b955228477b3
Removed the window parameter to dw_timer_connect() it was no needed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
195
diff
changeset
|
8769 WinStopTimer(dwhab, NULLHANDLE, id); |
b955228477b3
Removed the window parameter to dw_timer_connect() it was no needed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
195
diff
changeset
|
8770 |
195
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8771 while(tmp) |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8772 { |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8773 if(tmp->id == id) |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8774 { |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8775 if(prev) |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8776 { |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8777 prev->next = tmp->next; |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8778 free(tmp); |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8779 tmp = prev->next; |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8780 } |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8781 else |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8782 { |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8783 Root = tmp->next; |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8784 free(tmp); |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8785 tmp = Root; |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8786 } |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8787 } |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8788 else |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8789 { |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8790 prev = tmp; |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8791 tmp = tmp->next; |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8792 } |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8793 } |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8794 } |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8795 |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8796 /* |
3 | 8797 * Add a callback to a window event. |
8798 * Parameters: | |
8799 * window: Window handle of signal to be called back. | |
8800 * signame: A string pointer identifying which signal to be hooked. | |
8801 * sigfunc: The pointer to the function to be used as the callback. | |
8802 * data: User data to be passed to the handler function. | |
8803 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
8804 void API dw_signal_connect(HWND window, char *signame, void *sigfunc, void *data) |
3 | 8805 { |
465
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
8806 ULONG message = 0, id = 0; |
3 | 8807 |
8808 if(window && signame && sigfunc) | |
8809 { | |
8810 if((message = _findsigmessage(signame)) != 0) | |
465
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
8811 { |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
8812 /* Handle special case of the menu item */ |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
8813 if(message == WM_COMMAND && window < 65536) |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
8814 { |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
8815 char buffer[15]; |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
8816 HWND owner; |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
8817 |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
8818 sprintf(buffer, "_dw_id%d", (int)window); |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
8819 owner = (HWND)dw_window_get_data(hwndApp, buffer); |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
8820 |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
8821 if(owner) |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
8822 { |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
8823 id = window; |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
8824 window = owner; |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
8825 dw_window_set_data(hwndApp, buffer, 0); |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
8826 } |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
8827 else |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
8828 { |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
8829 /* If it is a popup menu clear all entries */ |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
8830 dw_signal_disconnect_by_window(window); |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
8831 } |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
8832 } |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
8833 _new_signal(message, window, id, sigfunc, data); |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
8834 } |
3 | 8835 } |
8836 } | |
8837 | |
8838 /* | |
8839 * Removes callbacks for a given window with given name. | |
8840 * Parameters: | |
8841 * window: Window handle of callback to be removed. | |
8842 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
8843 void API dw_signal_disconnect_by_name(HWND window, char *signame) |
3 | 8844 { |
8845 SignalHandler *prev = NULL, *tmp = Root; | |
8846 ULONG message; | |
8847 | |
8848 if(!window || !signame || (message = _findsigmessage(signame)) == 0) | |
8849 return; | |
8850 | |
8851 while(tmp) | |
8852 { | |
8853 if(tmp->window == window && tmp->message == message) | |
8854 { | |
8855 if(prev) | |
8856 { | |
8857 prev->next = tmp->next; | |
8858 free(tmp); | |
8859 tmp = prev->next; | |
8860 } | |
8861 else | |
8862 { | |
8863 Root = tmp->next; | |
8864 free(tmp); | |
8865 tmp = Root; | |
8866 } | |
8867 } | |
8868 else | |
8869 { | |
8870 prev = tmp; | |
8871 tmp = tmp->next; | |
8872 } | |
8873 } | |
8874 } | |
8875 | |
8876 /* | |
8877 * Removes all callbacks for a given window. | |
8878 * Parameters: | |
8879 * window: Window handle of callback to be removed. | |
8880 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
8881 void API dw_signal_disconnect_by_window(HWND window) |
3 | 8882 { |
8883 SignalHandler *prev = NULL, *tmp = Root; | |
8884 | |
8885 while(tmp) | |
8886 { | |
8887 if(tmp->window == window) | |
8888 { | |
8889 if(prev) | |
8890 { | |
8891 prev->next = tmp->next; | |
8892 free(tmp); | |
8893 tmp = prev->next; | |
8894 } | |
8895 else | |
8896 { | |
8897 Root = tmp->next; | |
8898 free(tmp); | |
8899 tmp = Root; | |
8900 } | |
8901 } | |
8902 else | |
8903 { | |
8904 prev = tmp; | |
8905 tmp = tmp->next; | |
8906 } | |
8907 } | |
8908 } | |
8909 | |
8910 /* | |
8911 * Removes all callbacks for a given window with specified data. | |
8912 * Parameters: | |
8913 * window: Window handle of callback to be removed. | |
8914 * data: Pointer to the data to be compared against. | |
8915 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
8916 void API dw_signal_disconnect_by_data(HWND window, void *data) |
3 | 8917 { |
8918 SignalHandler *prev = NULL, *tmp = Root; | |
8919 | |
8920 while(tmp) | |
8921 { | |
8922 if(tmp->window == window && tmp->data == data) | |
8923 { | |
8924 if(prev) | |
8925 { | |
8926 prev->next = tmp->next; | |
8927 free(tmp); | |
8928 tmp = prev->next; | |
8929 } | |
8930 else | |
8931 { | |
8932 Root = tmp->next; | |
8933 free(tmp); | |
8934 tmp = Root; | |
8935 } | |
8936 } | |
8937 else | |
8938 { | |
8939 prev = tmp; | |
8940 tmp = tmp->next; | |
8941 } | |
8942 } | |
8943 } | |
8944 | |
195
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8945 |