Mercurial > dwindows
annotate os2/dw.c @ 278:df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
to dw_window_set_bitmap().
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Fri, 14 Mar 2003 18:03:35 +0000 |
parents | dfbda83b7cad |
children | 030188d45a69 |
rev | line source |
---|---|
3 | 1 /* |
2 * Dynamic Windows: | |
3 * A GTK like implementation of the PM GUI | |
4 * | |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
5 * (C) 2000-2002 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 |
3 | 29 #include "dw.h" |
30 | |
31 #define QWP_USER 0 | |
32 | |
37
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
33 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
|
34 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
|
35 void _handle_splitbar_resize(HWND hwnd, float percent, int type, int x, int y); |
37
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
36 |
3 | 37 char ClassName[] = "dynamicwindows"; |
38 char SplitbarClassName[] = "dwsplitbar"; | |
39 char DefaultFont[] = "9.WarpSans"; | |
40 | |
41 HAB dwhab = 0; | |
42 HMQ dwhmq = 0; | |
43 DWTID _dwtid = 0; | |
44 LONG _foreground = 0xAAAAAA, _background = 0; | |
45 | |
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
|
46 HWND hwndBubble = NULLHANDLE, hwndBubbleLast = NULLHANDLE, hwndEmph = NULLHANDLE; |
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
|
47 PRECORDCORE pCore = NULL, pCoreEmph = NULL; |
20
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
48 ULONG aulBuffer[4]; |
190
f4c9fa77136a
A cleaner way of finding the toplevel window.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
185
diff
changeset
|
49 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
|
50 |
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
|
51 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
|
52 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
|
53 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
|
54 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
|
55 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
|
56 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
|
57 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
|
58 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
|
59 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
|
60 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
|
61 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
|
62 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
|
63 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
|
64 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
|
65 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
|
66 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
|
67 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
|
68 }; |
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 |
20
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
70 #define IS_WARP4() (aulBuffer[0] == 20 && aulBuffer[1] >= 40) |
3 | 71 |
72 #ifndef min | |
73 #define min(a, b) (((a < b) ? a : b)) | |
74 #endif | |
75 | |
76 typedef struct _sighandler | |
77 { | |
78 struct _sighandler *next; | |
79 ULONG message; | |
80 HWND window; | |
195
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
81 int id; |
3 | 82 void *signalfunction; |
83 void *data; | |
84 | |
85 } SignalHandler; | |
86 | |
87 SignalHandler *Root = NULL; | |
88 | |
89 typedef struct | |
90 { | |
91 ULONG message; | |
92 char name[30]; | |
93 | |
94 } SignalList; | |
95 | |
96 /* List of signals and their equivilent OS/2 message */ | |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
97 #define SIGNALMAX 15 |
3 | 98 |
99 SignalList SignalTranslate[SIGNALMAX] = { | |
100 { WM_SIZE, "configure_event" }, | |
101 { WM_CHAR, "key_press_event" }, | |
102 { WM_BUTTON1DOWN, "button_press_event" }, | |
103 { WM_BUTTON1UP, "button_release_event"}, | |
104 { WM_MOUSEMOVE, "motion_notify_event" }, | |
105 { WM_CLOSE, "delete_event" }, | |
106 { WM_PAINT, "expose_event" }, | |
107 { WM_COMMAND, "clicked" }, | |
108 { CN_ENTER, "container-select" }, | |
109 { CN_CONTEXTMENU, "container-context" }, | |
14
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
110 { LN_SELECT, "item-select" }, |
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
|
111 { CN_EMPHASIS, "tree-select" }, |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
112 { WM_SETFOCUS, "set-focus" }, |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
113 { WM_USER+1, "lose-focus" }, |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
114 { SLN_SLIDERTRACK, "value_changed" } |
3 | 115 }; |
116 | |
117 /* This function adds a signal handler callback into the linked list. | |
118 */ | |
195
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
119 void _new_signal(ULONG message, HWND window, int id, void *signalfunction, void *data) |
3 | 120 { |
121 SignalHandler *new = malloc(sizeof(SignalHandler)); | |
122 | |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
123 if(message == WM_COMMAND) |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
124 dw_signal_disconnect_by_window(window); |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
125 |
3 | 126 new->message = message; |
127 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
|
128 new->id = id; |
3 | 129 new->signalfunction = signalfunction; |
130 new->data = data; | |
131 new->next = NULL; | |
132 | |
133 if (!Root) | |
134 Root = new; | |
135 else | |
136 { | |
137 SignalHandler *prev = NULL, *tmp = Root; | |
138 while(tmp) | |
139 { | |
68
8d6100960adf
Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
140 if(tmp->message == message && |
8d6100960adf
Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
141 tmp->window == window && |
8d6100960adf
Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
142 tmp->signalfunction == signalfunction) |
8d6100960adf
Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
143 { |
8d6100960adf
Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
144 tmp->data = data; |
8d6100960adf
Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
145 free(new); |
8d6100960adf
Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
146 return; |
8d6100960adf
Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
147 } |
3 | 148 prev = tmp; |
149 tmp = tmp->next; | |
150 } | |
151 if(prev) | |
152 prev->next = new; | |
153 else | |
154 Root = new; | |
155 } | |
156 } | |
157 | |
158 /* Finds the message number for a given signal name */ | |
159 ULONG _findsigmessage(char *signame) | |
160 { | |
161 int z; | |
162 | |
163 for(z=0;z<SIGNALMAX;z++) | |
164 { | |
165 if(stricmp(signame, SignalTranslate[z].name) == 0) | |
166 return SignalTranslate[z].message; | |
167 } | |
168 return 0L; | |
169 } | |
170 | |
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
|
171 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
|
172 { |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
173 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
|
174 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
|
175 PVOID 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
|
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 } 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
|
178 |
c4e1139d9872
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 |
159
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
180 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
|
181 { |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
182 return TRUE; |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
183 } |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
184 |
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
|
185 /* 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
|
186 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
|
187 { |
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
188 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
|
189 |
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
190 /* Find the toplevel window */ |
190
f4c9fa77136a
A cleaner way of finding the toplevel window.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
185
diff
changeset
|
191 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
|
192 { |
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 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
|
194 } |
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 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
|
196 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
|
197 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
|
198 } |
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
199 |
156 | 200 /* Return the entryfield child of a window */ |
201 HWND _find_entryfield(HWND handle) | |
202 { | |
203 HENUM henum; | |
204 HWND child, entry = 0; | |
205 | |
206 henum = WinBeginEnumWindows(handle); | |
207 while((child = WinGetNextWindow(henum)) != NULLHANDLE) | |
208 { | |
209 char tmpbuf[100]; | |
210 | |
211 WinQueryClassName(child, 99, tmpbuf); | |
212 | |
213 if(strncmp(tmpbuf, "#6", 3)==0) /* Entryfield */ | |
214 { | |
215 entry = child; | |
216 break; | |
217 } | |
218 } | |
219 WinEndEnumWindows(henum); | |
220 return entry; | |
221 } | |
222 | |
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
|
223 /* 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
|
224 * 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
|
225 */ |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
226 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
|
227 { |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
228 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
|
229 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
|
230 |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
231 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
|
232 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
|
233 { |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
234 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
|
235 |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
236 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
|
237 |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
238 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
|
239 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
|
240 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
|
241 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
|
242 |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
243 _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
|
244 } |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
245 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
|
246 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
|
247 } |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
248 |
278
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
249 /* 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
|
250 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
|
251 { |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
252 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
|
253 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
|
254 HDC hdc = (HDC)dw_window_get_data(handle, "_dw_hdc"); |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
255 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
256 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
|
257 { |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
258 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
|
259 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
|
260 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
|
261 } |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
262 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
263 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
|
264 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
|
265 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
266 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
|
267 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
|
268 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
269 } |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
270 |
3 | 271 /* This function removes and handlers on windows and frees |
272 * the user memory allocated to it. | |
273 */ | |
274 void _free_window_memory(HWND handle) | |
275 { | |
276 HENUM henum; | |
277 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
|
278 void *ptr = (void *)WinQueryWindowPtr(handle, QWP_USER); |
3 | 279 |
280 dw_signal_disconnect_by_window(handle); | |
281 | |
180
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
282 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
|
283 { |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
284 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
|
285 |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
286 if(box) |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
287 { |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
288 if(box->count && box->items) |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
289 free(box->items); |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
290 |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
291 WinSetWindowPtr(child, QWP_USER, 0); |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
292 free(box); |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
293 } |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
294 } |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
295 |
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
|
296 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
|
297 { |
169
b2211123274e
Fixed a minor handl leak when destroying conboboxes... the listbox part
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
167
diff
changeset
|
298 WindowData *wd = (WindowData *)ptr; |
180
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
299 char tmpbuf[100]; |
235
69f2a59ec7d0
Delete associated bitmaps when destroying windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
230
diff
changeset
|
300 |
69f2a59ec7d0
Delete associated bitmaps when destroying windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
230
diff
changeset
|
301 /* 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
|
302 _free_bitmap(handle); |
180
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
303 |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
304 WinQueryClassName(handle, 99, tmpbuf); |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
305 |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
306 if(strncmp(tmpbuf, "#1", 3)==0) |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
307 { |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
308 Box *box = (Box *)ptr; |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
309 |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
310 if(box->count && box->items) |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
311 free(box->items); |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
312 } |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
313 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
|
314 { |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
315 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
|
316 |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
317 if(data) |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
318 free(data); |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
319 } |
169
b2211123274e
Fixed a minor handl leak when destroying conboboxes... the listbox part
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
167
diff
changeset
|
320 |
b2211123274e
Fixed a minor handl leak when destroying conboboxes... the listbox part
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
167
diff
changeset
|
321 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
|
322 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
|
323 |
90
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
324 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
|
325 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
|
326 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
|
327 } |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
328 |
3 | 329 henum = WinBeginEnumWindows(handle); |
330 while((child = WinGetNextWindow(henum)) != NULLHANDLE) | |
331 _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
|
332 |
3 | 333 WinEndEnumWindows(henum); |
334 return; | |
335 } | |
336 | |
337 /* This function returns 1 if the window (widget) handle | |
338 * passed to it is a valid window that can gain input focus. | |
339 */ | |
340 int _validate_focus(HWND handle) | |
341 { | |
342 char tmpbuf[100]; | |
343 | |
344 if(!handle) | |
345 return 0; | |
346 | |
159
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
347 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
|
348 return 0; |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
349 |
3 | 350 WinQueryClassName(handle, 99, tmpbuf); |
351 | |
352 /* These are the window classes which can | |
353 * obtain input focus. | |
354 */ | |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
355 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
|
356 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
|
357 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
|
358 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
|
359 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
|
360 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
|
361 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
|
362 strncmp(tmpbuf, "#38", 4)== 0) /* Slider */ |
3 | 363 return 1; |
364 return 0; | |
365 } | |
366 | |
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
|
367 int _focus_check_box(Box *box, HWND handle, int start, HWND defaultitem) |
3 | 368 { |
369 int z; | |
370 static HWND lasthwnd, firsthwnd; | |
371 static int finish_searching; | |
372 | |
373 /* Start is 2 when we have cycled completely and | |
374 * need to set the focus to the last widget we found | |
375 * that was valid. | |
376 */ | |
377 if(start == 2) | |
378 { | |
379 if(lasthwnd) | |
380 WinSetFocus(HWND_DESKTOP, lasthwnd); | |
381 return 0; | |
382 } | |
383 | |
384 /* Start is 1 when we are entering the function | |
385 * for the first time, it is zero when entering | |
386 * the function recursively. | |
387 */ | |
388 if(start == 1) | |
389 { | |
390 lasthwnd = handle; | |
391 finish_searching = 0; | |
392 firsthwnd = 0; | |
393 } | |
394 | |
395 /* Vertical boxes are inverted on OS/2 */ | |
396 if(box->type == BOXVERT) | |
397 { | |
398 for(z=0;z<box->count;z++) | |
399 { | |
400 if(box->items[z].type == TYPEBOX) | |
401 { | |
402 Box *thisbox = WinQueryWindowPtr(box->items[z].hwnd, QWP_USER); | |
403 | |
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
|
404 if(thisbox && _focus_check_box(thisbox, handle, start == 3 ? 3 : 0, defaultitem)) |
3 | 405 return 1; |
406 } | |
407 else | |
408 { | |
409 if(box->items[z].hwnd == handle) | |
410 { | |
411 if(lasthwnd == handle && firsthwnd) | |
412 WinSetFocus(HWND_DESKTOP, firsthwnd); | |
413 else if(lasthwnd == handle && !firsthwnd) | |
414 finish_searching = 1; | |
415 else | |
416 WinSetFocus(HWND_DESKTOP, lasthwnd); | |
417 | |
418 /* If we aren't looking for the last handle, | |
419 * return immediately. | |
420 */ | |
421 if(!finish_searching) | |
422 return 1; | |
423 } | |
424 if(_validate_focus(box->items[z].hwnd)) | |
425 { | |
426 /* Start is 3 when we are looking for the | |
427 * first valid item in the layout. | |
428 */ | |
429 if(start == 3) | |
430 { | |
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
|
431 if(!defaultitem || (defaultitem && defaultitem == box->items[z].hwnd)) |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
432 { |
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 WinSetFocus(HWND_DESKTOP, box->items[z].hwnd); |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
434 return 1; |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
435 } |
3 | 436 } |
437 | |
438 if(!firsthwnd) | |
439 firsthwnd = box->items[z].hwnd; | |
440 | |
441 lasthwnd = box->items[z].hwnd; | |
442 } | |
443 else | |
444 { | |
445 char tmpbuf[100] = ""; | |
446 | |
447 WinQueryClassName(box->items[z].hwnd, 99, tmpbuf); | |
153
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
448 if(strncmp(tmpbuf, SplitbarClassName, strlen(SplitbarClassName)+1)==0) |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
449 { |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
450 /* Then try the bottom or right box */ |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
451 HWND mybox = (HWND)dw_window_get_data(box->items[z].hwnd, "_dw_bottomright"); |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
452 |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
453 if(mybox) |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
454 { |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
455 Box *splitbox = (Box *)WinQueryWindowPtr(mybox, QWP_USER); |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
456 |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
457 if(splitbox && _focus_check_box(splitbox, handle, start == 3 ? 3 : 0, defaultitem)) |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
458 return 1; |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
459 } |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
460 |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
461 /* Try the top or left box */ |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
462 mybox = (HWND)dw_window_get_data(box->items[z].hwnd, "_dw_topleft"); |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
463 |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
464 if(mybox) |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
465 { |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
466 Box *splitbox = (Box *)WinQueryWindowPtr(mybox, QWP_USER); |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
467 |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
468 if(splitbox && _focus_check_box(splitbox, handle, start == 3 ? 3 : 0, defaultitem)) |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
469 return 1; |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
470 } |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
471 } |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
472 else if(strncmp(tmpbuf, "#40", 4)==0) /* Notebook */ |
3 | 473 { |
474 Box *notebox; | |
475 HWND page = (HWND)WinSendMsg(box->items[z].hwnd, BKM_QUERYPAGEWINDOWHWND, | |
476 (MPARAM)dw_notebook_page_query(box->items[z].hwnd), 0); | |
477 | |
478 if(page) | |
479 { | |
480 notebox = (Box *)WinQueryWindowPtr(page, QWP_USER); | |
481 | |
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
|
482 if(notebox && _focus_check_box(notebox, handle, start == 3 ? 3 : 0, defaultitem)) |
3 | 483 return 1; |
484 } | |
485 } | |
486 } | |
487 } | |
488 } | |
489 } | |
490 else | |
491 { | |
492 for(z=box->count-1;z>-1;z--) | |
493 { | |
494 if(box->items[z].type == TYPEBOX) | |
495 { | |
496 Box *thisbox = WinQueryWindowPtr(box->items[z].hwnd, QWP_USER); | |
497 | |
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
|
498 if(thisbox && _focus_check_box(thisbox, handle, start == 3 ? 3 : 0, defaultitem)) |
3 | 499 return 1; |
500 } | |
501 else | |
502 { | |
503 if(box->items[z].hwnd == handle) | |
504 { | |
505 if(lasthwnd == handle && firsthwnd) | |
506 WinSetFocus(HWND_DESKTOP, firsthwnd); | |
507 else if(lasthwnd == handle && !firsthwnd) | |
508 finish_searching = 1; | |
509 else | |
510 WinSetFocus(HWND_DESKTOP, lasthwnd); | |
511 | |
512 /* If we aren't looking for the last handle, | |
513 * return immediately. | |
514 */ | |
515 if(!finish_searching) | |
516 return 1; | |
517 } | |
518 if(_validate_focus(box->items[z].hwnd)) | |
519 { | |
520 /* Start is 3 when we are looking for the | |
521 * first valid item in the layout. | |
522 */ | |
523 if(start == 3) | |
524 { | |
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
|
525 if(!defaultitem || (defaultitem && defaultitem == box->items[z].hwnd)) |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
526 { |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
527 WinSetFocus(HWND_DESKTOP, box->items[z].hwnd); |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
528 return 1; |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
529 } |
3 | 530 } |
531 | |
532 if(!firsthwnd) | |
533 firsthwnd = box->items[z].hwnd; | |
534 | |
535 lasthwnd = box->items[z].hwnd; | |
536 } | |
537 else | |
538 { | |
539 char tmpbuf[100] = ""; | |
540 | |
541 WinQueryClassName(box->items[z].hwnd, 99, tmpbuf); | |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
542 if(strncmp(tmpbuf, "#40", 4)==0) /* Notebook */ |
3 | 543 { |
544 Box *notebox; | |
545 HWND page = (HWND)WinSendMsg(box->items[z].hwnd, BKM_QUERYPAGEWINDOWHWND, | |
546 (MPARAM)dw_notebook_page_query(box->items[z].hwnd), 0); | |
547 | |
548 if(page) | |
549 { | |
550 notebox = (Box *)WinQueryWindowPtr(page, QWP_USER); | |
551 | |
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 if(notebox && _focus_check_box(notebox, handle, start == 3 ? 3 : 0, defaultitem)) |
3 | 553 return 1; |
554 } | |
555 } | |
556 } | |
557 } | |
558 } | |
559 } | |
560 return 0; | |
561 } | |
562 | |
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
|
563 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
|
564 { |
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 int z; |
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 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
|
567 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
|
568 |
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 /* 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
|
570 * 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
|
571 * 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
|
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(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
|
574 { |
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 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
|
576 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
|
577 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
|
578 } |
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 |
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 /* 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
|
581 * 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
|
582 * 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
|
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 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
|
585 { |
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 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
|
587 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
|
588 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
|
589 } |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
590 |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
591 /* Vertical boxes are inverted on OS/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
|
592 if(box->type == BOXVERT) |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
593 { |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
594 for(z=box->count-1;z>-1;z--) |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
595 { |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
596 if(box->items[z].type == TYPEBOX) |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
597 { |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
598 Box *thisbox = WinQueryWindowPtr(box->items[z].hwnd, 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
|
599 |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
600 if(thisbox && _focus_check_box_back(thisbox, handle, start == 3 ? 3 : 0, 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
|
601 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
|
602 } |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
603 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
|
604 { |
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 if(box->items[z].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
|
606 { |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
607 if(lasthwnd == handle && 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
|
608 WinSetFocus(HWND_DESKTOP, 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
|
609 else if(lasthwnd == handle && !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
|
610 finish_searching = 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
|
611 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
|
612 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
|
613 |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
614 /* If we aren't looking for the last 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
|
615 * return immediately. |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
616 */ |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
617 if(!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
|
618 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
|
619 } |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
620 if(_validate_focus(box->items[z].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
|
621 { |
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 /* Start is 3 when we are looking for 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
|
623 * first valid item in the layout. |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
624 */ |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
625 if(start == 3) |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
626 { |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
627 if(!defaultitem || (defaultitem && defaultitem == box->items[z].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
|
628 { |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
629 WinSetFocus(HWND_DESKTOP, box->items[z].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
|
630 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
|
631 } |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
632 } |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
633 |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
634 if(!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
|
635 firsthwnd = box->items[z].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
|
636 |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
637 lasthwnd = box->items[z].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
|
638 } |
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 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
|
640 { |
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 char tmpbuf[100] = ""; |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
642 |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
643 WinQueryClassName(box->items[z].hwnd, 99, tmpbuf); |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
644 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
|
645 { |
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 Box *notebox; |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
647 HWND page = (HWND)WinSendMsg(box->items[z].hwnd, BKM_QUERYPAGEWINDOWHWND, |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
648 (MPARAM)dw_notebook_page_query(box->items[z].hwnd), 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
|
649 |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
650 if(page) |
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 { |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
652 notebox = (Box *)WinQueryWindowPtr(page, 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
|
653 |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
654 if(notebox && _focus_check_box_back(notebox, handle, start == 3 ? 3 : 0, 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
|
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 } |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
658 } |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
659 } |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
660 } |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
661 } |
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 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
|
663 { |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
664 for(z=0;z<box->count;z++) |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
665 { |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
666 if(box->items[z].type == TYPEBOX) |
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 Box *thisbox = WinQueryWindowPtr(box->items[z].hwnd, 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
|
669 |
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 if(thisbox && _focus_check_box_back(thisbox, handle, start == 3 ? 3 : 0, 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
|
671 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
|
672 } |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
673 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
|
674 { |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
675 if(box->items[z].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
|
676 { |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
677 if(lasthwnd == handle && 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
|
678 WinSetFocus(HWND_DESKTOP, 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
|
679 else if(lasthwnd == handle && !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
|
680 finish_searching = 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 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
|
682 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
|
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 /* If we aren't looking for the last 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
|
685 * return immediately. |
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 */ |
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 if(!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
|
688 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
|
689 } |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
690 if(_validate_focus(box->items[z].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
|
691 { |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
692 /* Start is 3 when we are looking for 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
|
693 * first valid item in the layout. |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
694 */ |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
695 if(start == 3) |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
696 { |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
697 if(!defaultitem || (defaultitem && defaultitem == box->items[z].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
|
698 { |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
699 WinSetFocus(HWND_DESKTOP, box->items[z].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
|
700 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
|
701 } |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
702 } |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
703 |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
704 if(!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
|
705 firsthwnd = box->items[z].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
|
706 |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
707 lasthwnd = box->items[z].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
|
708 } |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
709 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
|
710 { |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
711 char tmpbuf[100] = ""; |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
712 |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
713 WinQueryClassName(box->items[z].hwnd, 99, tmpbuf); |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
714 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
|
715 { |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
716 Box *notebox; |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
717 HWND page = (HWND)WinSendMsg(box->items[z].hwnd, BKM_QUERYPAGEWINDOWHWND, |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
718 (MPARAM)dw_notebook_page_query(box->items[z].hwnd), 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
|
719 |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
720 if(page) |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
721 { |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
722 notebox = (Box *)WinQueryWindowPtr(page, 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
|
723 |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
724 if(notebox && _focus_check_box_back(notebox, handle, start == 3 ? 3 : 0, 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
|
725 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
|
726 } |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
727 } |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
728 } |
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 } |
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 } |
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 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
|
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 |
3 | 735 /* This function finds the first widget in the |
736 * layout and moves the current focus to it. | |
737 */ | |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
738 int _initial_focus(HWND handle) |
3 | 739 { |
14
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
740 Box *thisbox = NULL; |
3 | 741 HWND box; |
742 | |
743 box = WinWindowFromID(handle, FID_CLIENT); | |
744 if(box) | |
745 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
|
746 else |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
747 return 1; |
3 | 748 |
749 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
|
750 _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
|
751 return 0; |
3 | 752 } |
753 | |
754 /* This function finds the current widget in the | |
755 * layout and moves the current focus to the next item. | |
756 */ | |
757 void _shift_focus(HWND handle) | |
758 { | |
759 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
|
760 HWND box, lastbox = _toplevel_window(handle); |
3 | 761 |
14
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
762 box = WinWindowFromID(lastbox, FID_CLIENT); |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
763 if(box) |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
764 thisbox = WinQueryWindowPtr(box, QWP_USER); |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
765 else |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
766 thisbox = WinQueryWindowPtr(lastbox, QWP_USER); |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
767 |
3 | 768 if(thisbox) |
769 { | |
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
|
770 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
|
771 _focus_check_box(thisbox, handle, 2, 0); |
3 | 772 } |
773 } | |
774 | |
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
|
775 /* 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
|
776 * 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
|
777 */ |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
778 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
|
779 { |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
780 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
|
781 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
|
782 |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
783 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
|
784 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
|
785 thisbox = WinQueryWindowPtr(box, 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
|
786 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
|
787 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
|
788 |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
789 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
|
790 { |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
791 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
|
792 _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
|
793 } |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
794 } |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
795 |
3 | 796 /* This function will recursively search a box and add up the total height of it */ |
797 void _count_size(HWND box, int type, int *xsize, int *xorigsize) | |
798 { | |
799 int size = 0, origsize = 0, z; | |
800 Box *tmp = WinQueryWindowPtr(box, QWP_USER); | |
801 | |
802 if(!tmp) | |
803 { | |
804 *xsize = *xorigsize = 0; | |
805 return; | |
806 } | |
807 | |
808 if(type == tmp->type) | |
809 { | |
810 /* If the box is going in the direction we want, then we | |
811 * return the entire sum of the items. | |
812 */ | |
813 for(z=0;z<tmp->count;z++) | |
814 { | |
815 if(tmp->items[z].type == TYPEBOX) | |
816 { | |
817 int s, os; | |
818 | |
819 _count_size(tmp->items[z].hwnd, type, &s, &os); | |
820 size += s; | |
821 origsize += os; | |
822 } | |
823 else | |
824 { | |
825 size += (type == BOXHORZ ? tmp->items[z].width : tmp->items[z].height); | |
826 origsize += (type == BOXHORZ ? tmp->items[z].origwidth : tmp->items[z].origheight); | |
827 } | |
828 } | |
829 } | |
830 else | |
831 { | |
832 /* If the box is not going in the direction we want, then we only | |
833 * want to return the maximum value. | |
834 */ | |
835 int tmpsize = 0, tmporigsize = 0; | |
836 | |
837 for(z=0;z<tmp->count;z++) | |
838 { | |
839 if(tmp->items[z].type == TYPEBOX) | |
840 _count_size(tmp->items[z].hwnd, type, &tmpsize, &tmporigsize); | |
841 else | |
842 { | |
843 tmpsize = (type == BOXHORZ ? tmp->items[z].width : tmp->items[z].height); | |
844 tmporigsize = (type == BOXHORZ ? tmp->items[z].origwidth : tmp->items[z].origheight); | |
845 } | |
846 | |
847 if(tmpsize > size) | |
848 size = tmpsize; | |
849 } | |
850 } | |
851 | |
852 *xsize = size; | |
853 *xorigsize = origsize; | |
854 } | |
855 | |
856 | |
857 /* Function: TrackRectangle | |
858 * Abstract: Tracks given rectangle. | |
859 * | |
860 * If rclBounds is NULL, then track rectangle on entire desktop. | |
861 * rclTrack is in window coorditates and will be mapped to | |
862 * desktop. | |
863 */ | |
864 | |
865 BOOL _TrackRectangle(HWND hwndBase, RECTL* rclTrack, RECTL* rclBounds) | |
866 { | |
867 TRACKINFO track; | |
868 APIRET rc; | |
869 | |
870 track.cxBorder = 1; | |
871 track.cyBorder = 1; | |
872 track.cxGrid = 1; | |
873 track.cyGrid = 1; | |
874 track.cxKeyboard = 8; | |
875 track.cyKeyboard = 8; | |
876 | |
877 if(!rclTrack) | |
878 return FALSE; | |
879 | |
880 if(rclBounds) | |
881 { | |
882 track.rclBoundary = *rclBounds; | |
883 } | |
884 else | |
885 { | |
886 track.rclBoundary.yTop = | |
887 track.rclBoundary.xRight = 3000; | |
888 track.rclBoundary.yBottom = | |
889 track.rclBoundary.xLeft = -3000; | |
890 } | |
891 | |
892 track.rclTrack = *rclTrack; | |
893 | |
894 WinMapWindowPoints(hwndBase, | |
895 HWND_DESKTOP, | |
896 (PPOINTL)&track.rclTrack, | |
897 2); | |
898 | |
899 track.ptlMinTrackSize.x = track.rclTrack.xRight | |
900 - track.rclTrack.xLeft; | |
901 track.ptlMinTrackSize.y = track.rclTrack.yTop | |
902 - track.rclTrack.yBottom; | |
903 track.ptlMaxTrackSize.x = track.rclTrack.xRight | |
904 - track.rclTrack.xLeft; | |
905 track.ptlMaxTrackSize.y = track.rclTrack.yTop | |
906 - track.rclTrack.yBottom; | |
907 | |
908 track.fs = TF_MOVE | TF_ALLINBOUNDARY; | |
909 | |
910 rc = WinTrackRect(HWND_DESKTOP, 0, &track); | |
911 | |
912 if(rc) | |
913 *rclTrack = track.rclTrack; | |
914 | |
915 return rc; | |
916 } | |
917 | |
94
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
918 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
|
919 { |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
920 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
|
921 |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
922 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
|
923 |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
924 /* 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
|
925 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
|
926 { |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
927 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
|
928 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
|
929 |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
930 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
|
931 { |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
932 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
|
933 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
|
934 |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
935 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
|
936 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
|
937 { |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
938 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
|
939 |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
940 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
|
941 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
|
942 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
|
943 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
|
944 |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
945 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
|
946 |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
947 _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
|
948 } |
129
e47c52b37cdd
Code cleanup and OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
128
diff
changeset
|
949 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
|
950 } |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
951 |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
952 } |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
953 } |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
954 |
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
|
955 /* 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
|
956 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
|
957 { |
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
|
958 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
|
959 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
|
960 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
|
961 } |
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
|
962 |
3 | 963 /* This function calculates how much space the widgets and boxes require |
964 * and does expansion as necessary. | |
965 */ | |
966 int _resize_box(Box *thisbox, int *depth, int x, int y, int *usedx, int *usedy, | |
967 int pass, int *usedpadx, int *usedpady) | |
968 { | |
969 int z, currentx = 0, currenty = 0; | |
970 int uymax = 0, uxmax = 0; | |
971 int upymax = 0, upxmax = 0; | |
972 /* Used for the SIZEEXPAND */ | |
973 int nux = *usedx, nuy = *usedy; | |
974 int nupx = *usedpadx, nupy = *usedpady; | |
975 | |
976 (*usedx) += (thisbox->pad * 2); | |
977 (*usedy) += (thisbox->pad * 2); | |
978 | |
979 for(z=0;z<thisbox->count;z++) | |
980 { | |
981 if(thisbox->items[z].type == TYPEBOX) | |
982 { | |
983 int initialx, initialy; | |
984 Box *tmp = WinQueryWindowPtr(thisbox->items[z].hwnd, QWP_USER); | |
985 | |
986 initialx = x - (*usedx); | |
987 initialy = y - (*usedy); | |
988 | |
989 if(tmp) | |
990 { | |
991 int newx, newy; | |
992 int nux = *usedx, nuy = *usedy; | |
993 int upx = *usedpadx + (tmp->pad*2), upy = *usedpady + (tmp->pad*2); | |
994 | |
995 /* On the second pass we know how big the box needs to be and how | |
996 * much space we have, so we can calculate a ratio for the new box. | |
997 */ | |
998 if(pass == 2) | |
999 { | |
1000 int deep = *depth + 1; | |
1001 | |
1002 _resize_box(tmp, &deep, x, y, &nux, &nuy, 1, &upx, &upy); | |
1003 | |
1004 tmp->upx = upx - *usedpadx; | |
1005 tmp->upy = upy - *usedpady; | |
1006 | |
1007 newx = x - nux; | |
1008 newy = y - nuy; | |
1009 | |
1010 tmp->width = thisbox->items[z].width = initialx - newx; | |
1011 tmp->height = thisbox->items[z].height = initialy - newy; | |
1012 | |
1013 tmp->parentxratio = thisbox->xratio; | |
1014 tmp->parentyratio = thisbox->yratio; | |
1015 | |
1016 tmp->parentpad = tmp->pad; | |
1017 | |
1018 /* Just in case */ | |
1019 tmp->xratio = thisbox->xratio; | |
1020 tmp->yratio = thisbox->yratio; | |
1021 | |
1022 if(thisbox->type == BOXVERT) | |
1023 { | |
1024 if((thisbox->items[z].width-((thisbox->items[z].pad*2)+(tmp->pad*2)))!=0) | |
1025 tmp->xratio = ((float)((thisbox->items[z].width * thisbox->xratio)-((thisbox->items[z].pad*2)+(tmp->pad*2))))/((float)(thisbox->items[z].width-((thisbox->items[z].pad*2)+(tmp->pad*2)))); | |
1026 } | |
1027 else | |
1028 { | |
1029 if((thisbox->items[z].width-tmp->upx)!=0) | |
1030 tmp->xratio = ((float)((thisbox->items[z].width * thisbox->xratio)-tmp->upx))/((float)(thisbox->items[z].width-tmp->upx)); | |
1031 } | |
1032 if(thisbox->type == BOXHORZ) | |
1033 { | |
1034 if((thisbox->items[z].height-((thisbox->items[z].pad*2)+(tmp->pad*2)))!=0) | |
1035 tmp->yratio = ((float)((thisbox->items[z].height * thisbox->yratio)-((thisbox->items[z].pad*2)+(tmp->pad*2))))/((float)(thisbox->items[z].height-((thisbox->items[z].pad*2)+(tmp->pad*2)))); | |
1036 } | |
1037 else | |
1038 { | |
1039 if((thisbox->items[z].height-tmp->upy)!=0) | |
1040 tmp->yratio = ((float)((thisbox->items[z].height * thisbox->yratio)-tmp->upy))/((float)(thisbox->items[z].height-tmp->upy)); | |
1041 } | |
1042 | |
1043 nux = *usedx; nuy = *usedy; | |
1044 upx = *usedpadx + (tmp->pad*2); upy = *usedpady + (tmp->pad*2); | |
1045 } | |
1046 | |
1047 (*depth)++; | |
1048 | |
1049 _resize_box(tmp, depth, x, y, &nux, &nuy, pass, &upx, &upy); | |
1050 | |
1051 (*depth)--; | |
1052 | |
1053 newx = x - nux; | |
1054 newy = y - nuy; | |
1055 | |
1056 tmp->minwidth = thisbox->items[z].width = initialx - newx; | |
1057 tmp->minheight = thisbox->items[z].height = initialy - newy; | |
1058 } | |
1059 } | |
1060 | |
1061 if(pass > 1 && *depth > 0) | |
1062 { | |
1063 if(thisbox->type == BOXVERT) | |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
1064 { |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
1065 if((thisbox->minwidth-((thisbox->items[z].pad*2)+(thisbox->parentpad*2))) == 0) |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
1066 thisbox->items[z].xratio = 1.0; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
1067 else |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
1068 thisbox->items[z].xratio = ((float)((thisbox->width * thisbox->parentxratio)-((thisbox->items[z].pad*2)+(thisbox->parentpad*2))))/((float)(thisbox->minwidth-((thisbox->items[z].pad*2)+(thisbox->parentpad*2)))); |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
1069 } |
3 | 1070 else |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
1071 { |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
1072 if(thisbox->minwidth-thisbox->upx == 0) |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
1073 thisbox->items[z].xratio = 1.0; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
1074 else |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
1075 thisbox->items[z].xratio = ((float)((thisbox->width * thisbox->parentxratio)-thisbox->upx))/((float)(thisbox->minwidth-thisbox->upx)); |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
1076 } |
3 | 1077 |
1078 if(thisbox->type == BOXHORZ) | |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
1079 { |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
1080 if((thisbox->minheight-((thisbox->items[z].pad*2)+(thisbox->parentpad*2))) == 0) |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
1081 thisbox->items[z].yratio = 1.0; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
1082 else |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
1083 thisbox->items[z].yratio = ((float)((thisbox->height * thisbox->parentyratio)-((thisbox->items[z].pad*2)+(thisbox->parentpad*2))))/((float)(thisbox->minheight-((thisbox->items[z].pad*2)+(thisbox->parentpad*2)))); |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
1084 } |
3 | 1085 else |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
1086 { |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
1087 if(thisbox->minheight-thisbox->upy == 0) |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
1088 thisbox->items[z].yratio = 1.0; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
1089 else |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
1090 thisbox->items[z].yratio = ((float)((thisbox->height * thisbox->parentyratio)-thisbox->upy))/((float)(thisbox->minheight-thisbox->upy)); |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
1091 } |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
1092 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
1093 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
|
1094 { |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
1095 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
|
1096 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
1097 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
|
1098 { |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
1099 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
|
1100 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
|
1101 } |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
1102 } |
3 | 1103 } |
1104 else | |
1105 { | |
1106 thisbox->items[z].xratio = thisbox->xratio; | |
1107 thisbox->items[z].yratio = thisbox->yratio; | |
1108 } | |
1109 | |
1110 if(thisbox->type == BOXVERT) | |
1111 { | |
1112 if((thisbox->items[z].width + (thisbox->items[z].pad*2)) > uxmax) | |
1113 uxmax = (thisbox->items[z].width + (thisbox->items[z].pad*2)); | |
1114 if(thisbox->items[z].hsize != SIZEEXPAND) | |
1115 { | |
1116 if(((thisbox->items[z].pad*2) + thisbox->items[z].width) > upxmax) | |
1117 upxmax = (thisbox->items[z].pad*2) + thisbox->items[z].width; | |
1118 } | |
1119 else | |
1120 { | |
1121 if(thisbox->items[z].pad*2 > upxmax) | |
1122 upxmax = thisbox->items[z].pad*2; | |
1123 } | |
1124 } | |
1125 else | |
1126 { | |
1127 if(thisbox->items[z].width == -1) | |
1128 { | |
1129 /* figure out how much space this item requires */ | |
1130 /* thisbox->items[z].width = */ | |
1131 } | |
1132 else | |
1133 { | |
1134 (*usedx) += thisbox->items[z].width + (thisbox->items[z].pad*2); | |
1135 if(thisbox->items[z].hsize != SIZEEXPAND) | |
1136 (*usedpadx) += (thisbox->items[z].pad*2) + thisbox->items[z].width; | |
1137 else | |
1138 (*usedpadx) += thisbox->items[z].pad*2; | |
1139 } | |
1140 } | |
1141 if(thisbox->type == BOXHORZ) | |
1142 { | |
1143 if((thisbox->items[z].height + (thisbox->items[z].pad*2)) > uymax) | |
1144 uymax = (thisbox->items[z].height + (thisbox->items[z].pad*2)); | |
1145 if(thisbox->items[z].vsize != SIZEEXPAND) | |
1146 { | |
1147 if(((thisbox->items[z].pad*2) + thisbox->items[z].height) > upymax) | |
1148 upymax = (thisbox->items[z].pad*2) + thisbox->items[z].height; | |
1149 } | |
1150 else | |
1151 { | |
1152 if(thisbox->items[z].pad*2 > upymax) | |
1153 upymax = thisbox->items[z].pad*2; | |
1154 } | |
1155 } | |
1156 else | |
1157 { | |
1158 if(thisbox->items[z].height == -1) | |
1159 { | |
1160 /* figure out how much space this item requires */ | |
1161 /* thisbox->items[z].height = */ | |
1162 } | |
1163 else | |
1164 { | |
1165 (*usedy) += thisbox->items[z].height + (thisbox->items[z].pad*2); | |
1166 if(thisbox->items[z].vsize != SIZEEXPAND) | |
1167 (*usedpady) += (thisbox->items[z].pad*2) + thisbox->items[z].height; | |
1168 else | |
1169 (*usedpady) += thisbox->items[z].pad*2; | |
1170 } | |
1171 } | |
1172 } | |
1173 | |
1174 (*usedx) += uxmax; | |
1175 (*usedy) += uymax; | |
1176 (*usedpadx) += upxmax; | |
1177 (*usedpady) += upymax; | |
1178 | |
1179 currentx += thisbox->pad; | |
1180 currenty += thisbox->pad; | |
1181 | |
1182 /* The second pass is for expansion and actual placement. */ | |
1183 if(pass > 1) | |
1184 { | |
1185 /* Any SIZEEXPAND items should be set to uxmax/uymax */ | |
1186 for(z=0;z<thisbox->count;z++) | |
1187 { | |
1188 if(thisbox->items[z].hsize == SIZEEXPAND && thisbox->type == BOXVERT) | |
1189 thisbox->items[z].width = uxmax-(thisbox->items[z].pad*2); | |
1190 if(thisbox->items[z].vsize == SIZEEXPAND && thisbox->type == BOXHORZ) | |
1191 thisbox->items[z].height = uymax-(thisbox->items[z].pad*2); | |
1192 /* Run this code segment again to finalize the sized after setting uxmax/uymax values. */ | |
1193 if(thisbox->items[z].type == TYPEBOX) | |
1194 { | |
1195 Box *tmp = WinQueryWindowPtr(thisbox->items[z].hwnd, QWP_USER); | |
1196 | |
1197 if(tmp) | |
1198 { | |
1199 if(*depth > 0) | |
1200 { | |
1201 if(thisbox->type == BOXVERT) | |
1202 { | |
1203 tmp->xratio = ((float)((thisbox->items[z].width * thisbox->xratio)-((thisbox->items[z].pad*2)+(thisbox->pad*2))))/((float)(tmp->minwidth-((thisbox->items[z].pad*2)+(thisbox->pad*2)))); | |
1204 tmp->width = thisbox->items[z].width; | |
1205 } | |
1206 if(thisbox->type == BOXHORZ) | |
1207 { | |
1208 tmp->yratio = ((float)((thisbox->items[z].height * thisbox->yratio)-((thisbox->items[z].pad*2)+(thisbox->pad*2))))/((float)(tmp->minheight-((thisbox->items[z].pad*2)+(thisbox->pad*2)))); | |
1209 tmp->height = thisbox->items[z].height; | |
1210 } | |
1211 } | |
1212 | |
1213 (*depth)++; | |
1214 | |
1215 _resize_box(tmp, depth, x, y, &nux, &nuy, 3, &nupx, &nupy); | |
1216 | |
1217 (*depth)--; | |
1218 | |
1219 } | |
1220 } | |
1221 } | |
1222 | |
1223 for(z=0;z<(thisbox->count);z++) | |
1224 { | |
1225 int height = thisbox->items[z].height; | |
1226 int width = thisbox->items[z].width; | |
1227 int pad = thisbox->items[z].pad; | |
1228 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
|
1229 int vectorx, vectory; |
3 | 1230 |
1231 /* When upxmax != pad*2 then ratios are incorrect. */ | |
1232 vectorx = (int)((width*thisbox->items[z].xratio)-width); | |
1233 vectory = (int)((height*thisbox->items[z].yratio)-height); | |
1234 | |
1235 if(width > 0 && height > 0) | |
1236 { | |
1237 char tmpbuf[100]; | |
1238 /* This is a hack to fix rounding of the sizing */ | |
1239 if(*depth == 0) | |
1240 { | |
1241 vectorx++; | |
1242 vectory++; | |
1243 } | |
1244 | |
1245 /* If this item isn't going to expand... reset the vectors to 0 */ | |
1246 if(thisbox->items[z].vsize != SIZEEXPAND) | |
1247 vectory = 0; | |
1248 if(thisbox->items[z].hsize != SIZEEXPAND) | |
1249 vectorx = 0; | |
1250 | |
1251 WinQueryClassName(handle, 99, tmpbuf); | |
1252 | |
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
|
1253 if(strncmp(tmpbuf, "#2", 3)==0) |
3 | 1254 { |
1255 /* Make the combobox big enough to drop down. :) */ | |
1256 WinSetWindowPos(handle, HWND_TOP, currentx + pad, (currenty + pad) - 100, | |
1257 width + vectorx, (height + vectory) + 100, SWP_MOVE | SWP_SIZE | SWP_ZORDER); | |
1258 } | |
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
|
1259 else if(strncmp(tmpbuf, "#6", 3)==0) |
3 | 1260 { |
1261 /* Entryfields on OS/2 have a thick border that isn't on Windows and GTK */ | |
1262 WinSetWindowPos(handle, HWND_TOP, (currentx + pad) + 3, (currenty + pad) + 3, | |
1263 (width + vectorx) - 6, (height + vectory) - 6, SWP_MOVE | SWP_SIZE | SWP_ZORDER); | |
1264 } | |
94
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1265 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
|
1266 { |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1267 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
|
1268 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
|
1269 _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
|
1270 } |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
1271 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
|
1272 { |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
1273 /* 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
|
1274 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
|
1275 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
|
1276 int cx = width + vectorx; |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
1277 int cy = height + vectory; |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
1278 |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
1279 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
|
1280 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
|
1281 |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
1282 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
|
1283 _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
|
1284 } |
3 | 1285 else |
1286 { | |
1287 WinSetWindowPos(handle, HWND_TOP, currentx + pad, currenty + pad, | |
1288 width + vectorx, height + vectory, SWP_MOVE | SWP_SIZE | SWP_ZORDER); | |
1289 if(thisbox->items[z].type == TYPEBOX) | |
1290 { | |
1291 Box *boxinfo = WinQueryWindowPtr(handle, QWP_USER); | |
1292 | |
1293 if(boxinfo && boxinfo->grouphwnd) | |
1294 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
|
1295 width + vectorx, height + vectory, SWP_MOVE | SWP_SIZE); |
3 | 1296 |
1297 } | |
1298 | |
1299 } | |
1300 | |
1301 if(thisbox->type == BOXHORZ) | |
1302 currentx += width + vectorx + (pad * 2); | |
1303 if(thisbox->type == BOXVERT) | |
1304 currenty += height + vectory + (pad * 2); | |
1305 } | |
1306 } | |
1307 } | |
1308 return 0; | |
1309 } | |
1310 | |
1311 void _do_resize(Box *thisbox, int x, int y) | |
1312 { | |
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
|
1313 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
|
1314 { |
3 | 1315 if(thisbox) |
1316 { | |
1317 int usedx = 0, usedy = 0, usedpadx = 0, usedpady = 0, depth = 0; | |
1318 | |
1319 _resize_box(thisbox, &depth, x, y, &usedx, &usedy, 1, &usedpadx, &usedpady); | |
1320 | |
1321 if(usedx-usedpadx == 0 || usedy-usedpady == 0) | |
1322 return; | |
1323 | |
1324 thisbox->xratio = ((float)(x-usedpadx))/((float)(usedx-usedpadx)); | |
1325 thisbox->yratio = ((float)(y-usedpady))/((float)(usedy-usedpady)); | |
1326 | |
1327 usedx = usedy = usedpadx = usedpady = depth = 0; | |
1328 | |
1329 _resize_box(thisbox, &depth, x, y, &usedx, &usedy, 2, &usedpadx, &usedpady); | |
1330 } | |
1331 } | |
1332 } | |
1333 | |
1334 /* This procedure handles WM_QUERYTRACKINFO requests from the frame */ | |
1335 MRESULT EXPENTRY _sizeproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2) | |
1336 { | |
1337 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
|
1338 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
|
1339 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
|
1340 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1341 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
|
1342 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
|
1343 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
|
1344 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1345 if(thisbox && !thisbox->titlebar) |
3 | 1346 { |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1347 switch(msg) |
3 | 1348 { |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1349 case WM_QUERYTRACKINFO: |
3 | 1350 { |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1351 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
|
1352 { |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1353 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
|
1354 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
|
1355 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
|
1356 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
|
1357 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1358 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
|
1359 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1360 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
|
1361 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
|
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 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
|
1364 } |
3 | 1365 } |
1366 } | |
1367 } | |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1368 |
3 | 1369 if(blah && *blah) |
1370 { | |
1371 PFNWP myfunc = *blah; | |
1372 return myfunc(hWnd, msg, mp1, mp2); | |
1373 } | |
1374 | |
1375 return WinDefWindowProc(hWnd, msg, mp1, mp2); | |
1376 } | |
33
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1377 |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1378 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
|
1379 { |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1380 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
|
1381 |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1382 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
|
1383 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
|
1384 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
|
1385 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
|
1386 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
|
1387 } |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1388 |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1389 /* 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
|
1390 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
|
1391 { |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1392 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
|
1393 |
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 = 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
|
1395 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
|
1396 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
|
1397 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
|
1398 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
|
1399 } |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1400 |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1401 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
|
1402 { |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1403 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
|
1404 |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1405 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
|
1406 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
|
1407 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
|
1408 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
|
1409 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
|
1410 } |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1411 |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1412 /* 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
|
1413 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
|
1414 { |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1415 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
|
1416 |
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 = 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
|
1418 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
|
1419 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
|
1420 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
|
1421 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
|
1422 } |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1423 |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1424 /* This procedure handles drawing of a status border */ |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1425 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
|
1426 { |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1427 PFNWP *blah = WinQueryWindowPtr(hWnd, QWP_USER); |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1428 |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1429 if(blah && *blah) |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1430 { |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1431 PFNWP myfunc = *blah; |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1432 |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1433 switch(msg) |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1434 { |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1435 case WM_PAINT: |
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 HPS hpsPaint; |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1438 RECTL rclPaint; |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1439 char buf[1024]; |
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 hpsPaint = WinBeginPaint(hWnd, 0, 0); |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1442 WinQueryWindowRect(hWnd, &rclPaint); |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1443 WinFillRect(hpsPaint, &rclPaint, CLR_PALEGRAY); |
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 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
|
1446 _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
|
1447 _Left(hpsPaint, rclPaint); |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1448 |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1449 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
|
1450 _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
|
1451 _Bottom(hpsPaint, rclPaint); |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1452 |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1453 WinQueryWindowText(hWnd, 1024, buf); |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1454 rclPaint.xLeft += 3; |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1455 rclPaint.xRight--; |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1456 rclPaint.yTop--; |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1457 rclPaint.yBottom++; |
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_BLACK); |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1460 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
|
1461 WinEndPaint(hpsPaint); |
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 return (MRESULT)TRUE; |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1464 } |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1465 } |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1466 return myfunc(hWnd, msg, mp1, mp2); |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1467 } |
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 return WinDefWindowProc(hWnd, msg, mp1, mp2); |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1470 } |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1471 |
40
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1472 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
|
1473 { |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1474 char tmpbuf[100]; |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1475 |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1476 WinQueryClassName(handle, 99, tmpbuf); |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1477 |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1478 /* 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
|
1479 * obtain input focus. |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1480 */ |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1481 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
|
1482 { |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1483 /* 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
|
1484 SignalHandler *tmp = Root; |
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 /* 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
|
1487 while(tmp) |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1488 { |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1489 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
|
1490 { |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1491 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
|
1492 |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1493 /* 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
|
1494 if(tmp->window == handle) |
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 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
|
1497 tmp = NULL; |
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 } |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1500 if(tmp) |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1501 tmp= tmp->next; |
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 } |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1504 else |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1505 WinSetFocus(HWND_DESKTOP, handle); |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1506 } |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1507 |
153
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1508 #define ENTRY_CUT 1001 |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1509 #define ENTRY_COPY 1002 |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1510 #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
|
1511 #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
|
1512 #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
|
1513 |
3 | 1514 /* Originally just intended for entryfields, it now serves as a generic |
1515 * procedure for handling TAB presses to change input focus on controls. | |
1516 */ | |
1517 MRESULT EXPENTRY _entryproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2) | |
1518 { | |
40
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1519 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
|
1520 PFNWP oldproc = 0; |
153
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1521 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
|
1522 |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1523 if(blah) |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1524 oldproc = blah->oldproc; |
3 | 1525 |
153
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1526 WinQueryClassName(hWnd, 99, tmpbuf); |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1527 |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1528 /* 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
|
1529 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
|
1530 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
|
1531 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
|
1532 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
|
1533 { |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1534 switch(msg) |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1535 { |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1536 case WM_CONTEXTMENU: |
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 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
|
1539 long x, y; |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1540 |
155
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
154
diff
changeset
|
1541 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
|
1542 { |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
1543 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
|
1544 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
|
1545 } |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
1546 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
|
1547 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
|
1548 { |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
1549 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
|
1550 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
|
1551 } |
155
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
154
diff
changeset
|
1552 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
|
1553 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
|
1554 |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
154
diff
changeset
|
1555 WinSetFocus(HWND_DESKTOP, hWnd); |
153
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1556 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
|
1557 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
|
1558 } |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1559 break; |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1560 case WM_COMMAND: |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1561 { |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1562 ULONG command = COMMANDMSG(&msg)->cmd; |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1563 |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1564 /* MLE */ |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1565 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
|
1566 { |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1567 switch(command) |
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 case ENTRY_CUT: |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1570 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
|
1571 case ENTRY_COPY: |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1572 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
|
1573 case ENTRY_PASTE: |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1574 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
|
1575 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
|
1576 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
|
1577 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
|
1578 { |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
154
diff
changeset
|
1579 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
|
1580 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
|
1581 } |
153
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1582 } |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1583 } |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1584 else /* Other */ |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1585 { |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1586 HWND handle = hWnd; |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1587 |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1588 /* 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
|
1589 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
|
1590 handle = WinWindowFromID(hWnd, 667); |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1591 |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1592 if(handle) |
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 switch(command) |
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 case ENTRY_CUT: |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1597 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
|
1598 case ENTRY_COPY: |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1599 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
|
1600 case ENTRY_PASTE: |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1601 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
|
1602 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
|
1603 { |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
154
diff
changeset
|
1604 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
|
1605 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
|
1606 } |
153
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1607 } |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1608 } |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1609 } |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1610 } |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1611 break; |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1612 } |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1613 } |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1614 |
3 | 1615 switch(msg) |
1616 { | |
37
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
1617 case WM_BUTTON1DOWN: |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
1618 case WM_BUTTON2DOWN: |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
1619 case WM_BUTTON3DOWN: |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
1620 { |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1621 if(strncmp(tmpbuf, "#32", 4)==0) |
38
538db2a48bac
Added typecast to MPARAM.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
37
diff
changeset
|
1622 _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
|
1623 } |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
1624 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
|
1625 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
|
1626 { |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1627 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
|
1628 _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
|
1629 } |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1630 break; |
37
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
1631 case WM_SETFOCUS: |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
1632 _run_event(hWnd, msg, mp1, mp2); |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
1633 break; |
3 | 1634 case WM_CHAR: |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
1635 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
|
1636 return (MRESULT)TRUE; |
3 | 1637 if(SHORT1FROMMP(mp2) == '\t') |
1638 { | |
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
|
1639 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
|
1640 _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
|
1641 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
|
1642 _shift_focus(hWnd); |
3 | 1643 return FALSE; |
1644 } | |
40
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1645 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
|
1646 _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
|
1647 /* 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
|
1648 * 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
|
1649 */ |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1650 else if(SHORT1FROMMP(mp2) == 283) |
129
e47c52b37cdd
Code cleanup and OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
128
diff
changeset
|
1651 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
|
1652 |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1653 break; |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1654 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
|
1655 { |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1656 /* 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
|
1657 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
|
1658 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
|
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 break; |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1661 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
|
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 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
|
1664 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
|
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 break; |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1667 } |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1668 |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1669 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
|
1670 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
|
1671 |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1672 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
|
1673 } |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1674 |
153
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1675 /* 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
|
1676 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
|
1677 { |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1678 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
|
1679 |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1680 switch(msg) |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1681 { |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1682 case WM_CONTEXTMENU: |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1683 case WM_COMMAND: |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1684 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
|
1685 case WM_SETFOCUS: |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1686 _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
|
1687 break; |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1688 case WM_CHAR: |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
1689 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
|
1690 return (MRESULT)TRUE; |
153
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1691 /* 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
|
1692 if(SHORT1FROMMP(mp2) == 283) |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1693 return (MRESULT)TRUE; |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1694 break; |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1695 } |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1696 |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1697 if(blah && blah->oldproc) |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1698 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
|
1699 |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1700 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
|
1701 } |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1702 |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1703 /* 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
|
1704 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
|
1705 { |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1706 switch(msg) |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1707 { |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1708 case WM_VSCROLL: |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1709 if(SHORT2FROMMP(mp2) == SB_SLIDERTRACK) |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1710 { |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1711 USHORT pos = SHORT1FROMMP(mp2); |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1712 |
155
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
154
diff
changeset
|
1713 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
|
1714 } |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1715 break; |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1716 } |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1717 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
|
1718 } |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1719 |
156 | 1720 /* Handle special messages for the spinbutton's entryfield */ |
1721 MRESULT EXPENTRY _spinentryproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2) | |
1722 { | |
1723 WindowData *blah = (WindowData *)WinQueryWindowPtr(hWnd, QWP_USER); | |
1724 PFNWP oldproc = 0; | |
1725 | |
1726 if(blah) | |
1727 oldproc = blah->oldproc; | |
1728 | |
1729 switch(msg) | |
1730 { | |
1731 case WM_CONTEXTMENU: | |
1732 case WM_COMMAND: | |
1733 return _entryproc(hWnd, msg, mp1, mp2); | |
1734 } | |
1735 | |
1736 if(oldproc) | |
1737 return oldproc(hWnd, msg, mp1, mp2); | |
1738 | |
1739 return WinDefWindowProc(hWnd, msg, mp1, mp2); | |
1740 } | |
1741 | |
94
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1742 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
|
1743 { |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1744 int pos = (int)dw_window_get_data(hwnd, "_dw_percent_value"); |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1745 int range = dw_percent_query_range(hwnd); |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1746 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
|
1747 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
|
1748 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
|
1749 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
|
1750 } |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1751 |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1752 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
|
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 inew, range = dw_percent_query_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
|
1755 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
|
1756 { |
bb039d7407f0
Fix for floating point crash when trying to calculate new slider/percent
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
108
diff
changeset
|
1757 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
|
1758 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
|
1759 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
|
1760 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
|
1761 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
|
1762 } |
94
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1763 } |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1764 |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1765 /* 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
|
1766 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
|
1767 { |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1768 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
|
1769 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
|
1770 |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1771 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
|
1772 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
|
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 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
|
1775 { |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1776 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
|
1777 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
|
1778 break; |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1779 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
|
1780 WinSendMsg(hWnd, SLM_SETSLIDERINFO, MPFROM2SHORT(SMA_SLIDERARMPOSITION,SMA_RANGEVALUE), (MPARAM)_dw_int_pos(hWnd)); |
3 | 1781 break; |
1782 } | |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1783 |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1784 if(oldproc) |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1785 return oldproc(hWnd, msg, mp1, mp2); |
3 | 1786 |
1787 return WinDefWindowProc(hWnd, msg, mp1, mp2); | |
1788 } | |
1789 | |
1790 /* Handle correct painting of a combobox with the WS_CLIPCHILDREN | |
1791 * flag enabled, and also handle TABs to switch input focus. | |
1792 */ | |
1793 MRESULT EXPENTRY _comboproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2) | |
1794 { | |
40
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1795 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
|
1796 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
|
1797 |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1798 if(blah) |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1799 oldproc = blah->oldproc; |
3 | 1800 |
1801 switch(msg) | |
1802 { | |
1803 case WM_CHAR: | |
1804 if(SHORT1FROMMP(mp2) == '\t') | |
1805 { | |
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
|
1806 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
|
1807 _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
|
1808 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
|
1809 _shift_focus(hWnd); |
3 | 1810 return FALSE; |
1811 } | |
40
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1812 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
|
1813 _click_default(blah->clickdefault); |
3 | 1814 break; |
160
76bc6b4e8b79
Don't allow comboboxes to drop down when disabled.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
159
diff
changeset
|
1815 case WM_BUTTON1DBLCLK: |
76bc6b4e8b79
Don't allow comboboxes to drop down when disabled.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
159
diff
changeset
|
1816 case WM_BUTTON2DBLCLK: |
76bc6b4e8b79
Don't allow comboboxes to drop down when disabled.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
159
diff
changeset
|
1817 case WM_BUTTON3DBLCLK: |
76bc6b4e8b79
Don't allow comboboxes to drop down when disabled.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
159
diff
changeset
|
1818 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
|
1819 return (MRESULT)TRUE; |
76bc6b4e8b79
Don't allow comboboxes to drop down when disabled.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
159
diff
changeset
|
1820 break; |
39
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
1821 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
|
1822 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
|
1823 case WM_BUTTON3DOWN: |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
1824 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
|
1825 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
|
1826 _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
|
1827 break; |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
1828 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
|
1829 _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
|
1830 break; |
3 | 1831 case WM_PAINT: |
1832 { | |
1833 HWND parent = WinQueryWindow(hWnd, QW_PARENT); | |
1834 ULONG bcol, av[32]; | |
1835 HPS hpsPaint; | |
1836 POINTL ptl; /* Add 6 because it has a thick border like the entryfield */ | |
1837 unsigned long width, height, thumbheight = WinQuerySysValue(HWND_DESKTOP, SV_CYVSCROLLARROW) + 6; | |
1838 | |
1839 WinQueryPresParam(parent, PP_BACKGROUNDCOLORINDEX, 0, &bcol, sizeof(ULONG), &av, QPF_ID1COLORINDEX | QPF_NOINHERIT); | |
1840 dw_window_get_pos_size(hWnd, 0, 0, &width, &height); | |
1841 | |
1842 hpsPaint = WinGetPS(hWnd); | |
1843 GpiSetColor(hpsPaint, CLR_PALEGRAY); | |
1844 | |
1845 ptl.x = 0; | |
24
d9e87e8bcf1d
Updated dynamic windows to build with EMX.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
23
diff
changeset
|
1846 ptl.y = 0; |
3 | 1847 GpiMove(hpsPaint, &ptl); |
1848 | |
1849 ptl.x = width; | |
1850 ptl.y = height - thumbheight; | |
1851 GpiBox(hpsPaint, DRO_FILL, &ptl, 0, 0); | |
1852 | |
1853 WinReleasePS(hpsPaint); | |
1854 } | |
1855 break; | |
1856 } | |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1857 if(oldproc) |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1858 return oldproc(hWnd, msg, mp1, mp2); |
3 | 1859 |
1860 return WinDefWindowProc(hWnd, msg, mp1, mp2); | |
1861 } | |
1862 | |
1863 void _GetPPFont(HWND hwnd, char *buff) | |
1864 { | |
1865 ULONG AttrFound; | |
1866 BYTE AttrValue[128]; | |
1867 ULONG cbRetLen; | |
1868 | |
1869 cbRetLen = WinQueryPresParam(hwnd, | |
1870 PP_FONTNAMESIZE, | |
1871 0, | |
1872 &AttrFound, | |
1873 sizeof(AttrValue), | |
1874 &AttrValue, | |
1875 QPF_NOINHERIT); | |
1876 | |
1877 if(PP_FONTNAMESIZE == AttrFound && cbRetLen) | |
1878 { | |
1879 memcpy(buff, AttrValue, cbRetLen); | |
1880 } | |
1881 } | |
1882 | |
1883 /* Returns height of specified window. */ | |
1884 int _get_height(HWND handle) | |
1885 { | |
1886 unsigned long height; | |
1887 dw_window_get_pos_size(handle, NULL, NULL, NULL, &height); | |
1888 return (int)height; | |
1889 } | |
1890 | |
1891 /* Find the height of the frame a desktop style window is sitting on */ | |
1892 int _get_frame_height(HWND handle) | |
1893 { | |
1894 while(handle) | |
1895 { | |
1896 HWND client; | |
1897 if((client = WinWindowFromID(handle, FID_CLIENT)) != NULLHANDLE) | |
1898 { | |
1899 return _get_height(WinQueryWindow(handle, QW_PARENT)); | |
1900 } | |
1901 handle = WinQueryWindow(handle, QW_PARENT); | |
1902 } | |
1903 return dw_screen_height(); | |
1904 } | |
1905 | |
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
|
1906 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
|
1907 { |
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
|
1908 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
|
1909 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
|
1910 |
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
|
1911 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
|
1912 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
|
1913 |
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
|
1914 pos = dw_scrollbar_query_pos(handle); |
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
|
1915 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
|
1916 |
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
|
1917 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
|
1918 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
|
1919 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
|
1920 |
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
|
1921 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
|
1922 { |
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
|
1923 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
|
1924 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
|
1925 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
|
1926 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
|
1927 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
|
1928 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
|
1929 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
|
1930 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
|
1931 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
|
1932 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
|
1933 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
|
1934 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
|
1935 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
|
1936 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
|
1937 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
|
1938 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
|
1939 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
|
1940 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
|
1941 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
|
1942 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
|
1943 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
|
1944 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
|
1945 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
|
1946 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
|
1947 } |
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 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
|
1949 } |
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 |
3 | 1951 MRESULT EXPENTRY _run_event(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2) |
1952 { | |
1953 int result = -1; | |
1954 SignalHandler *tmp = Root; | |
1955 ULONG origmsg = msg; | |
1956 | |
1957 if(msg == WM_BUTTON2DOWN || msg == WM_BUTTON3DOWN) | |
1958 msg = WM_BUTTON1DOWN; | |
1959 if(msg == WM_BUTTON2UP || msg == WM_BUTTON3UP) | |
1960 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
|
1961 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
|
1962 msg = WM_CONTROL; |
3 | 1963 |
1964 /* Find any callbacks for this function */ | |
1965 while(tmp) | |
1966 { | |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1967 if(tmp->message == msg || msg == WM_CONTROL || tmp->message == WM_USER+1) |
3 | 1968 { |
1969 switch(msg) | |
1970 { | |
14
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
1971 case WM_SETFOCUS: |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
1972 { |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1973 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
|
1974 { |
175
d78d08440246
Use _System/_stdcall for callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
174
diff
changeset
|
1975 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
|
1976 |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
1977 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
|
1978 { |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
1979 result = setfocusfunc(tmp->window, tmp->data); |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
1980 tmp = NULL; |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
1981 } |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
1982 } |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
1983 } |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
1984 break; |
195
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
1985 case WM_TIMER: |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
1986 { |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
1987 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
|
1988 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
|
1989 { |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
1990 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
|
1991 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
|
1992 tmp = NULL; |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
1993 } |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
1994 result = 0; |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
1995 } |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
1996 break; |
3 | 1997 case WM_SIZE: |
1998 { | |
175
d78d08440246
Use _System/_stdcall for callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
174
diff
changeset
|
1999 int (* API sizefunc)(HWND, int, int, void *) = (int (* API)(HWND, int, int, void *))tmp->signalfunction; |
3 | 2000 |
276
dfbda83b7cad
Eliminate configure event callbacks when either the width or height is 0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
267
diff
changeset
|
2001 if((hWnd == tmp->window || WinWindowFromID(tmp->window, FID_CLIENT) == hWnd) && SHORT1FROMMP(mp2) && SHORT2FROMMP(mp2)) |
3 | 2002 { |
2003 result = sizefunc(tmp->window, SHORT1FROMMP(mp2), SHORT2FROMMP(mp2), tmp->data); | |
2004 tmp = NULL; | |
2005 } | |
2006 } | |
2007 break; | |
2008 case WM_BUTTON1DOWN: | |
2009 { | |
2010 POINTS pts = (*((POINTS*)&mp1)); | |
175
d78d08440246
Use _System/_stdcall for callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
174
diff
changeset
|
2011 int (* API buttonfunc)(HWND, int, int, int, void *) = (int (* API)(HWND, int, int, int, void *))tmp->signalfunction; |
3 | 2012 |
2013 if(hWnd == tmp->window || WinWindowFromID(tmp->window, FID_CLIENT) == hWnd || WinQueryCapture(HWND_DESKTOP) == tmp->window) | |
2014 { | |
24
d9e87e8bcf1d
Updated dynamic windows to build with EMX.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
23
diff
changeset
|
2015 int button = 0; |
3 | 2016 |
2017 switch(origmsg) | |
2018 { | |
2019 case WM_BUTTON1DOWN: | |
2020 button = 1; | |
2021 break; | |
2022 case WM_BUTTON2DOWN: | |
2023 button = 2; | |
2024 break; | |
2025 case WM_BUTTON3DOWN: | |
2026 button = 3; | |
2027 break; | |
2028 } | |
2029 | |
2030 result = buttonfunc(tmp->window, pts.x, _get_frame_height(tmp->window) - pts.y, button, tmp->data); | |
2031 tmp = NULL; | |
2032 } | |
2033 } | |
2034 break; | |
2035 case WM_BUTTON1UP: | |
2036 { | |
2037 POINTS pts = (*((POINTS*)&mp1)); | |
175
d78d08440246
Use _System/_stdcall for callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
174
diff
changeset
|
2038 int (* API buttonfunc)(HWND, int, int, int, void *) = (int (* API)(HWND, int, int, int, void *))tmp->signalfunction; |
3 | 2039 |
2040 if(hWnd == tmp->window || WinWindowFromID(tmp->window, FID_CLIENT) == hWnd || WinQueryCapture(HWND_DESKTOP) == tmp->window) | |
2041 { | |
24
d9e87e8bcf1d
Updated dynamic windows to build with EMX.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
23
diff
changeset
|
2042 int button = 0; |
3 | 2043 |
2044 switch(origmsg) | |
2045 { | |
2046 case WM_BUTTON1UP: | |
2047 button = 1; | |
2048 break; | |
2049 case WM_BUTTON2UP: | |
2050 button = 2; | |
2051 break; | |
2052 case WM_BUTTON3UP: | |
2053 button = 3; | |
2054 break; | |
2055 } | |
2056 | |
2057 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); | |
2058 tmp = NULL; | |
2059 } | |
2060 } | |
2061 break; | |
2062 case WM_MOUSEMOVE: | |
2063 { | |
175
d78d08440246
Use _System/_stdcall for callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
174
diff
changeset
|
2064 int (* API motionfunc)(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 { | |
2068 int keys = 0; | |
2069 SHORT x = SHORT1FROMMP(mp1), y = SHORT2FROMMP(mp1); | |
2070 | |
2071 if (WinGetKeyState(HWND_DESKTOP, VK_BUTTON1) & 0x8000) | |
2072 keys = DW_BUTTON1_MASK; | |
2073 if (WinGetKeyState(HWND_DESKTOP, VK_BUTTON2) & 0x8000) | |
2074 keys |= DW_BUTTON2_MASK; | |
2075 if (WinGetKeyState(HWND_DESKTOP, VK_BUTTON3) & 0x8000) | |
2076 keys |= DW_BUTTON3_MASK; | |
2077 | |
2078 result = motionfunc(tmp->window, x, _get_frame_height(tmp->window) - y, keys, tmp->data); | |
2079 tmp = NULL; | |
2080 } | |
2081 } | |
2082 break; | |
2083 case WM_CHAR: | |
2084 { | |
267
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
2085 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
|
2086 |
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
2087 if(hWnd == tmp->window && !(SHORT1FROMMP(mp1) & KC_KEYUP)) |
3 | 2088 { |
267
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
2089 int vk; |
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
2090 char ch; |
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
2091 |
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
2092 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
|
2093 ch = (char)SHORT1FROMMP(mp2); |
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
2094 else |
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
2095 ch = (char)SHORT2FROMMP(mp2); |
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
2096 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
|
2097 vk = SHORT2FROMMP(mp2); |
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
2098 else |
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
2099 vk = SHORT1FROMMP(mp2); |
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
2100 |
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
2101 /* 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
|
2102 * up as tabs! |
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
2103 */ |
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
2104 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
|
2105 { |
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
2106 ch = 0; |
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
2107 vk = VK_SHIFT; |
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
2108 } |
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
2109 |
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
2110 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
|
2111 SHORT1FROMMP(mp1) & (KC_ALT | KC_SHIFT | KC_CTRL), tmp->data); |
3 | 2112 tmp = NULL; |
2113 } | |
2114 } | |
2115 break; | |
2116 case WM_CLOSE: | |
2117 { | |
175
d78d08440246
Use _System/_stdcall for callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
174
diff
changeset
|
2118 int (* API closefunc)(HWND, void *) = (int (* API)(HWND, void *))tmp->signalfunction; |
3 | 2119 |
2120 if(hWnd == tmp->window || hWnd == WinWindowFromID(tmp->window, FID_CLIENT)) | |
2121 { | |
2122 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
|
2123 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
|
2124 result = FALSE; |
3 | 2125 tmp = NULL; |
2126 } | |
2127 } | |
2128 break; | |
2129 case WM_PAINT: | |
2130 { | |
2131 HPS hps; | |
2132 DWExpose exp; | |
175
d78d08440246
Use _System/_stdcall for callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
174
diff
changeset
|
2133 int (* API exposefunc)(HWND, DWExpose *, void *) = (int (* API)(HWND, DWExpose *, void *))tmp->signalfunction; |
3 | 2134 RECTL rc; |
2135 | |
2136 if(hWnd == tmp->window) | |
2137 { | |
2138 int height = _get_height(hWnd); | |
2139 | |
2140 hps = WinBeginPaint(hWnd, 0L, &rc); | |
2141 exp.x = rc.xLeft; | |
2142 exp.y = height - rc.yTop - 1; | |
2143 exp.width = rc.xRight - rc. xLeft; | |
2144 exp.height = rc.yTop - rc.yBottom; | |
2145 result = exposefunc(hWnd, &exp, tmp->data); | |
2146 WinEndPaint(hps); | |
2147 } | |
2148 } | |
2149 break; | |
2150 case WM_COMMAND: | |
2151 { | |
175
d78d08440246
Use _System/_stdcall for callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
174
diff
changeset
|
2152 int (* API clickfunc)(HWND, void *) = (int (* API)(HWND, void *))tmp->signalfunction; |
3 | 2153 ULONG command = COMMANDMSG(&msg)->cmd; |
2154 | |
2155 if(tmp->window < 65536 && command == tmp->window) | |
2156 { | |
93
98cce029a611
Changed handling of menu item click events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
90
diff
changeset
|
2157 result = clickfunc(popup ? popup : tmp->window, tmp->data); |
3 | 2158 tmp = NULL; |
2159 } | |
2160 } | |
2161 break; | |
2162 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
|
2163 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
|
2164 (tmp->message == SLN_SLIDERTRACK && SHORT2FROMMP(mp1) == SLN_CHANGE)) |
3 | 2165 { |
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
|
2166 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
|
2167 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
|
2168 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
|
2169 |
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
|
2170 switch(svar) |
3 | 2171 { |
2172 case CN_ENTER: | |
2173 { | |
175
d78d08440246
Use _System/_stdcall for callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
174
diff
changeset
|
2174 int (* API containerselectfunc)(HWND, char *, void *) = (int (* API)(HWND, char *, void *))tmp->signalfunction; |
3 | 2175 int id = SHORT1FROMMP(mp1); |
2176 HWND conthwnd = dw_window_from_id(hWnd, id); | |
2177 char *text = NULL; | |
2178 | |
2179 if(mp2) | |
2180 { | |
2181 PRECORDCORE pre; | |
2182 | |
2183 pre = ((PNOTIFYRECORDENTER)mp2)->pRecord; | |
2184 if(pre) | |
2185 text = pre->pszIcon; | |
2186 } | |
2187 | |
2188 if(tmp->window == conthwnd) | |
2189 { | |
2190 result = containerselectfunc(tmp->window, text, tmp->data); | |
2191 tmp = NULL; | |
2192 } | |
2193 } | |
2194 break; | |
2195 case CN_CONTEXTMENU: | |
2196 { | |
175
d78d08440246
Use _System/_stdcall for callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
174
diff
changeset
|
2197 int (* API containercontextfunc)(HWND, char *, int, int, void *, void *) = (int (* API)(HWND, char *, int, int, void *, void *))tmp->signalfunction; |
3 | 2198 int id = SHORT1FROMMP(mp1); |
2199 HWND conthwnd = dw_window_from_id(hWnd, id); | |
2200 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
|
2201 void *user = NULL; |
3 | 2202 LONG x,y; |
2203 | |
2204 if(mp2) | |
2205 { | |
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
|
2206 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
|
2207 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
2208 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
|
2209 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
2210 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
|
2211 user = pci->user; |
3 | 2212 } |
2213 | |
2214 dw_pointer_query_pos(&x, &y); | |
2215 | |
2216 if(tmp->window == conthwnd) | |
2217 { | |
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
|
2218 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
|
2219 |
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
|
2220 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
|
2221 { |
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
|
2222 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
|
2223 { |
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
|
2224 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
|
2225 |
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
|
2226 dw_tree_item_select(tmp->window, (HWND)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
|
2227 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
|
2228 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
|
2229 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
|
2230 _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
|
2231 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
|
2232 } |
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
|
2233 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
|
2234 { |
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
|
2235 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
|
2236 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
|
2237 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
|
2238 } |
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
|
2239 } |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
2240 result = containercontextfunc(tmp->window, text, x, y, tmp->data, user); |
3 | 2241 tmp = NULL; |
2242 } | |
2243 } | |
2244 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
|
2245 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
|
2246 { |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
2247 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
|
2248 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
|
2249 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
2250 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
|
2251 { |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
2252 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
|
2253 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
2254 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
|
2255 { |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
2256 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
|
2257 { |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
2258 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
|
2259 |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
2260 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
|
2261 { |
161
c555d06b6c93
Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
160
diff
changeset
|
2262 if(dw_window_get_data(tmp->window, "_dw_container")) |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
2263 { |
175
d78d08440246
Use _System/_stdcall for callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
174
diff
changeset
|
2264 int (* API containerselectfunc)(HWND, char *, void *) = (int (* API)(HWND, char *, void *))tmp->signalfunction; |
161
c555d06b6c93
Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
160
diff
changeset
|
2265 |
c555d06b6c93
Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
160
diff
changeset
|
2266 result = containerselectfunc(tmp->window, pci->rc.pszIcon, tmp->data); |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
2267 } |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
2268 else |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
2269 { |
175
d78d08440246
Use _System/_stdcall for callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
174
diff
changeset
|
2270 int (* API treeselectfunc)(HWND, HWND, char *, void *, void *) = (int (* API)(HWND, HWND, char *, void *, void *))tmp->signalfunction; |
161
c555d06b6c93
Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
160
diff
changeset
|
2271 |
c555d06b6c93
Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
160
diff
changeset
|
2272 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
|
2273 { |
c555d06b6c93
Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
160
diff
changeset
|
2274 lasthcnr = 0; |
c555d06b6c93
Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
160
diff
changeset
|
2275 lastitem = 0; |
c555d06b6c93
Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
160
diff
changeset
|
2276 } |
c555d06b6c93
Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
160
diff
changeset
|
2277 else |
c555d06b6c93
Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
160
diff
changeset
|
2278 { |
c555d06b6c93
Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
160
diff
changeset
|
2279 lasthcnr = tmp->window; |
c555d06b6c93
Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
160
diff
changeset
|
2280 lastitem = (HWND)pci; |
c555d06b6c93
Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
160
diff
changeset
|
2281 result = treeselectfunc(tmp->window, (HWND)pci, pci->rc.pszIcon, pci->user, tmp->data); |
c555d06b6c93
Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
160
diff
changeset
|
2282 } |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
2283 } |
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
|
2284 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
|
2285 } |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
2286 } |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
2287 } |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
2288 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
|
2289 } |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
2290 } |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
2291 break; |
3 | 2292 case LN_SELECT: |
2293 { | |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2294 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
|
2295 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2296 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
|
2297 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2298 if(strncmp(classbuf, "#38", 4) == 0) |
3 | 2299 { |
175
d78d08440246
Use _System/_stdcall for callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
174
diff
changeset
|
2300 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
|
2301 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2302 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
|
2303 { |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2304 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
|
2305 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
|
2306 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
|
2307 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
|
2308 { |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2309 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
|
2310 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
|
2311 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
|
2312 } |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2313 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
|
2314 } |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2315 } |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2316 else |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2317 { |
175
d78d08440246
Use _System/_stdcall for callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
174
diff
changeset
|
2318 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
|
2319 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
|
2320 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
|
2321 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
|
2322 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2323 if(_recursing == 0 && (tmp->window == conthwnd || (!id && tmp->window == (HWND)mp2))) |
3 | 2324 { |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2325 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
|
2326 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
|
2327 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2328 dw_listbox_query_text(tmp->window, index, 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
|
2329 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2330 _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
|
2331 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2332 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
|
2333 { |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2334 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
|
2335 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2336 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
|
2337 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2338 /* 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
|
2339 * 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
|
2340 */ |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2341 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
|
2342 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
|
2343 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2344 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
|
2345 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
|
2346 } |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2347 else |
3 | 2348 result = listboxselectfunc(tmp->window, index, tmp->data); |
2349 | |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2350 _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
|
2351 tmp = NULL; |
3 | 2352 } |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2353 } |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2354 } |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2355 break; |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2356 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
|
2357 { |
175
d78d08440246
Use _System/_stdcall for callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
174
diff
changeset
|
2358 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
|
2359 |
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
|
2360 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
|
2361 { |
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
|
2362 /* 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
|
2363 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
|
2364 { |
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
|
2365 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
|
2366 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
|
2367 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
|
2368 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
|
2369 { |
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
|
2370 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
|
2371 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
|
2372 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
|
2373 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
|
2374 } |
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
|
2375 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
|
2376 } |
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
|
2377 } |
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
|
2378 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
|
2379 { |
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
|
2380 /* 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
|
2381 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
|
2382 { |
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
|
2383 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
|
2384 |
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
|
2385 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
|
2386 { |
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
|
2387 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
|
2388 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
|
2389 } |
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
|
2390 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
|
2391 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
|
2392 } |
3 | 2393 } |
2394 } | |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2395 |
3 | 2396 break; |
2397 } | |
2398 } | |
2399 break; | |
2400 } | |
2401 } | |
30
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
2402 |
3 | 2403 if(tmp) |
2404 tmp = tmp->next; | |
2405 | |
2406 } | |
2407 return (MRESULT)result; | |
2408 } | |
2409 | |
2410 /* Handles control messages sent to the box (owner). */ | |
2411 MRESULT EXPENTRY _controlproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2) | |
2412 { | |
2413 Box *blah = WinQueryWindowPtr(hWnd, QWP_USER); | |
2414 | |
2415 switch(msg) | |
2416 { | |
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
|
2417 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
|
2418 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
|
2419 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
|
2420 { |
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
|
2421 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
|
2422 _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
|
2423 } |
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
|
2424 break; |
3 | 2425 case WM_CONTROL: |
2426 _run_event(hWnd, msg, mp1, mp2); | |
2427 break; | |
2428 } | |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2429 |
3 | 2430 if(blah && blah->oldproc) |
2431 return blah->oldproc(hWnd, msg, mp1, mp2); | |
2432 | |
2433 return WinDefWindowProc(hWnd, msg, mp1, mp2); | |
2434 } | |
2435 | |
2436 /* The main window procedure for Dynamic Windows, all the resizing code is done here. */ | |
2437 MRESULT EXPENTRY _wndproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2) | |
2438 { | |
2439 int result = -1; | |
2440 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
|
2441 void (* API windowfunc)(PVOID) = 0L; |
3 | 2442 |
150
2a0d7b57a6da
Removed unnecessary parameters from dw_main().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
147
diff
changeset
|
2443 if(!command_active) |
3 | 2444 { |
2445 /* Make sure we don't end up in infinite recursion */ | |
2446 command_active = 1; | |
2447 | |
2448 result = (int)_run_event(hWnd, msg, mp1, mp2); | |
2449 | |
2450 command_active = 0; | |
2451 } | |
2452 | |
2453 /* Now that any handlers are done... do normal processing */ | |
2454 switch( msg ) | |
2455 { | |
2456 case WM_ERASEBACKGROUND: | |
2457 return 0; | |
2458 | |
2459 case WM_PAINT: | |
2460 { | |
2461 HPS hps; | |
2462 RECTL rc; | |
2463 | |
2464 hps = WinBeginPaint( hWnd, 0L, &rc ); | |
2465 WinEndPaint( hps ); | |
2466 break; | |
2467 } | |
2468 | |
2469 case WM_SIZE: | |
2470 { | |
2471 Box *mybox = (Box *)WinQueryWindowPtr(hWnd, QWP_USER); | |
2472 | |
2473 if(!SHORT1FROMMP(mp2) && !SHORT2FROMMP(mp2)) | |
2474 return (MPARAM)TRUE; | |
2475 | |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
2476 if(mybox && mybox->flags != DW_MINIMIZED) |
3 | 2477 { |
2478 /* Hide the window when recalculating to reduce | |
2479 * CPU load. | |
2480 */ | |
2481 WinShowWindow(hWnd, FALSE); | |
2482 | |
2483 _do_resize(mybox, SHORT1FROMMP(mp2), SHORT2FROMMP(mp2)); | |
2484 | |
2485 WinShowWindow(hWnd, TRUE); | |
2486 } | |
2487 } | |
2488 break; | |
2489 case WM_MINMAXFRAME: | |
2490 { | |
2491 Box *mybox = (Box *)WinQueryWindowPtr(hWnd, QWP_USER); | |
2492 SWP *swp = (SWP *)mp1; | |
2493 | |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
2494 if(mybox && (swp->fl & SWP_MINIMIZE)) |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
2495 mybox->flags = DW_MINIMIZED; |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
2496 |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
2497 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
|
2498 { |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
2499 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
|
2500 WinSetParent(mybox->hwndtitle, HWND_OBJECT, FALSE); |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
2501 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
|
2502 } |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
2503 |
3 | 2504 if(mybox && (swp->fl & SWP_MAXIMIZE)) |
2505 { | |
2506 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
|
2507 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
|
2508 |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
2509 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
|
2510 |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
2511 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
|
2512 return FALSE; |
3 | 2513 |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
2514 mybox->flags = 0; |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
2515 |
3 | 2516 /* Hide the window when recalculating to reduce |
2517 * CPU load. | |
2518 */ | |
2519 WinShowWindow(hWnd, FALSE); | |
2520 | |
2521 _do_resize(mybox, swp->cx, swp->cy); | |
2522 | |
2523 if(mybox->count == 1 && mybox->items[0].type == TYPEBOX) | |
2524 { | |
2525 mybox = (Box *)WinQueryWindowPtr(mybox->items[0].hwnd, QWP_USER); | |
2526 | |
2527 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
|
2528 _check_resize_notebook(mybox->items[z].hwnd); |
3 | 2529 |
2530 } | |
2531 | |
2532 WinShowWindow(hWnd, TRUE); | |
2533 } | |
2534 } | |
2535 break; | |
20
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2536 case WM_CONTROL: |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2537 switch(SHORT2FROMMP(mp1)) |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2538 { |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2539 case BKN_PAGESELECTEDPENDING: |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2540 { |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2541 PAGESELECTNOTIFY *psn = (PAGESELECTNOTIFY *)mp2; |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2542 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
|
2543 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
|
2544 unsigned long x, y, width, height; |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2545 RECTL rc; |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2546 |
21
c6e76b796b28
Stopped unnecessary redrawing when switching to the same page.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
20
diff
changeset
|
2547 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
|
2548 { |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2549 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
|
2550 |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2551 rc.xLeft = x; |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2552 rc.yBottom = y; |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2553 rc.xRight = x + width; |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2554 rc.yTop = y + height; |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2555 |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2556 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
|
2557 |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2558 _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
|
2559 } |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2560 } |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2561 break; |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2562 } |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2563 break; |
3 | 2564 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
|
2565 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
|
2566 { |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
2567 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
|
2568 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
|
2569 } |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
2570 break; |
3 | 2571 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
|
2572 windowfunc = (void (* API)(void *))mp1; |
3 | 2573 |
2574 if(windowfunc) | |
2575 windowfunc((void *)mp2); | |
2576 break; | |
2577 case WM_CHAR: | |
2578 if(SHORT1FROMMP(mp2) == '\t') | |
2579 { | |
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
|
2580 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
|
2581 _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
|
2582 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
|
2583 _shift_focus(hWnd); |
3 | 2584 return FALSE; |
2585 } | |
2586 break; | |
2587 case WM_DESTROY: | |
2588 /* Free memory before destroying */ | |
2589 _free_window_memory(hWnd); | |
2590 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
|
2591 case WM_MENUEND: |
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
|
2592 if(hwndEmph && pCoreEmph) |
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
|
2593 WinSendMsg(hwndEmph, CM_SETRECORDEMPHASIS, pCoreEmph, MPFROM2SHORT(FALSE, 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
|
2594 hwndEmph = NULLHANDLE; |
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
|
2595 pCoreEmph = NULL; |
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
|
2596 break; |
3 | 2597 } |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2598 |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
2599 if(result != -1) |
3 | 2600 return (MRESULT)result; |
2601 else | |
2602 return WinDefWindowProc(hWnd, msg, mp1, mp2); | |
2603 } | |
2604 | |
2605 void _changebox(Box *thisbox, int percent, int type) | |
2606 { | |
2607 int z; | |
2608 | |
2609 for(z=0;z<thisbox->count;z++) | |
2610 { | |
2611 if(thisbox->items[z].type == TYPEBOX) | |
2612 { | |
2613 Box *tmp = WinQueryWindowPtr(thisbox->items[z].hwnd, QWP_USER); | |
2614 _changebox(tmp, percent, type); | |
2615 } | |
2616 else | |
2617 { | |
2618 if(type == BOXHORZ) | |
2619 { | |
2620 if(thisbox->items[z].hsize == SIZEEXPAND) | |
2621 thisbox->items[z].width = (int)(((float)thisbox->items[z].origwidth) * (((float)percent)/((float)100.0))); | |
2622 } | |
2623 else | |
2624 { | |
2625 if(thisbox->items[z].vsize == SIZEEXPAND) | |
2626 thisbox->items[z].height = (int)(((float)thisbox->items[z].origheight) * (((float)percent)/((float)100.0))); | |
2627 } | |
2628 } | |
2629 } | |
2630 } | |
2631 | |
125
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2632 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
|
2633 { |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2634 if(type == BOXHORZ) |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2635 { |
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
|
2636 int newx = x; |
125
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2637 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
|
2638 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
|
2639 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
|
2640 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
|
2641 |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2642 WinShowWindow(handle1, FALSE); |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2643 WinShowWindow(handle2, FALSE); |
125
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2644 |
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
|
2645 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
|
2646 |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2647 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
|
2648 _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
|
2649 |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2650 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
|
2651 |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2652 tmp = WinQueryWindowPtr(handle2, QWP_USER); |
125
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2653 |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2654 newx = x - newx - SPLITBAR_WIDTH; |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2655 |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2656 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
|
2657 _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
|
2658 |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2659 WinShowWindow(handle1, TRUE); |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2660 WinShowWindow(handle2, TRUE); |
125
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2661 } |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2662 else |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2663 { |
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 int newy = y; |
125
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2665 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
|
2666 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
|
2667 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
|
2668 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
|
2669 |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2670 WinShowWindow(handle1, FALSE); |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2671 WinShowWindow(handle2, FALSE); |
125
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2672 |
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
|
2673 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
|
2674 |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2675 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
|
2676 _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
|
2677 |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2678 tmp = WinQueryWindowPtr(handle2, QWP_USER); |
125
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2679 |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2680 newy = y - newy - SPLITBAR_WIDTH; |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2681 |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2682 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
|
2683 _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
|
2684 |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2685 WinShowWindow(handle1, TRUE); |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2686 WinShowWindow(handle2, TRUE); |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2687 |
125
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2688 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
|
2689 } |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2690 } |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2691 |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2692 |
3 | 2693 /* This handles any activity on the splitbars (sizers) */ |
2694 MRESULT EXPENTRY _splitwndproc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) | |
2695 { | |
123
63f61a702b17
Updates to use floats to save the splitbar percentage.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
2696 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
|
2697 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
|
2698 int start = (int)dw_window_get_data(hwnd, "_dw_start"); |
3 | 2699 |
2700 switch (msg) | |
2701 { | |
2702 case WM_ACTIVATE: | |
2703 case WM_SETFOCUS: | |
2704 return (MRESULT)(FALSE); | |
2705 | |
2706 case WM_PAINT: | |
2707 { | |
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
|
2708 HPS hps; |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2709 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
|
2710 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
|
2711 |
ac616f625443
Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
127
diff
changeset
|
2712 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
|
2713 |
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
|
2714 WinQueryWindowRect(hwnd, &rcl); |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2715 |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2716 if(type == BOXHORZ) |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2717 { |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2718 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
|
2719 ptl[0].y = rcl.yBottom; |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2720 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
|
2721 ptl[1].y = rcl.yTop; |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2722 } |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2723 else |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2724 { |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2725 ptl[0].x = rcl.xLeft; |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2726 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
|
2727 ptl[1].x = rcl.xRight; |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2728 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
|
2729 } |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2730 |
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
|
2731 |
ac616f625443
Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
127
diff
changeset
|
2732 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
|
2733 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
|
2734 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
|
2735 WinEndPaint(hps); |
3 | 2736 } |
2737 return MRFROMSHORT(FALSE); | |
2738 | |
2739 case WM_MOUSEMOVE: | |
2740 { | |
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
|
2741 if(type == BOXHORZ) |
3 | 2742 WinSetPointer(HWND_DESKTOP, |
2743 WinQuerySysPointer(HWND_DESKTOP, | |
2744 SPTR_SIZEWE, | |
2745 FALSE)); | |
2746 else | |
2747 WinSetPointer(HWND_DESKTOP, | |
2748 WinQuerySysPointer(HWND_DESKTOP, | |
2749 SPTR_SIZENS, | |
2750 FALSE)); | |
2751 } | |
2752 return MRFROMSHORT(FALSE); | |
2753 case WM_BUTTON1DOWN: | |
2754 { | |
2755 APIRET rc; | |
2756 RECTL rclFrame; | |
2757 RECTL rclBounds; | |
2758 | |
2759 WinQueryWindowRect(hwnd, &rclFrame); | |
125
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2760 WinQueryWindowRect(hwnd, &rclBounds); |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2761 |
3 | 2762 WinMapWindowPoints(hwnd, HWND_DESKTOP, |
125
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2763 (PPOINTL)&rclBounds, 2); |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2764 |
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 if(type == BOXHORZ) |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2767 { |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2768 rclFrame.xLeft = start; |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2769 rclFrame.xRight = start + SPLITBAR_WIDTH; |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2770 } |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2771 else |
3 | 2772 { |
125
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2773 rclFrame.yBottom = start; |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2774 rclFrame.yTop = start + SPLITBAR_WIDTH; |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2775 } |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2776 |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2777 if(percent) |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2778 { |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2779 rc = _TrackRectangle(hwnd, &rclFrame, &rclBounds); |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2780 |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2781 if(rc == TRUE) |
3 | 2782 { |
125
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2783 int width = (rclBounds.xRight - rclBounds.xLeft); |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2784 int height = (rclBounds.yTop - rclBounds.yBottom); |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2785 |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2786 if(type == BOXHORZ) |
3 | 2787 { |
125
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2788 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
|
2789 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
|
2790 *percent = ((float)start / (float)(width - SPLITBAR_WIDTH)) * 100.0; |
3 | 2791 } |
2792 else | |
2793 { | |
125
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2794 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
|
2795 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
|
2796 *percent = 100.0 - (((float)start / (float)(height - SPLITBAR_WIDTH)) * 100.0); |
3 | 2797 } |
125
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2798 _handle_splitbar_resize(hwnd, *percent, type, width, height); |
3 | 2799 } |
2800 } | |
2801 } | |
2802 return MRFROMSHORT(FALSE); | |
2803 } | |
2804 return WinDefWindowProc(hwnd, msg, mp1, mp2); | |
2805 } | |
2806 | |
2807 /* Function: BubbleProc | |
2808 * Abstract: Subclass procedure for bubble help | |
2809 */ | |
2810 MRESULT EXPENTRY _BubbleProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) | |
2811 { | |
2812 MRESULT res; | |
2813 PFNWP proc = (PFNWP)WinQueryWindowPtr(hwnd, QWL_USER); | |
2814 | |
2815 if(proc) | |
2816 res = proc(hwnd, msg, mp1, mp2); | |
2817 else | |
2818 res = WinDefWindowProc(hwnd, msg, mp1, mp2); | |
2819 | |
2820 if(msg == WM_PAINT) | |
2821 { | |
2822 POINTL ptl; | |
2823 HPS hpsTemp; | |
2824 RECTL rcl; | |
2825 int height, width; | |
2826 | |
2827 WinQueryWindowRect(hwnd, &rcl); | |
2828 height = rcl.yTop - rcl.yBottom - 1; | |
2829 width = rcl.xRight - rcl.xLeft - 1; | |
2830 | |
2831 /* Draw a border around the bubble help */ | |
2832 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
|
2833 GpiSetColor(hpsTemp, CLR_BLACK); |
3 | 2834 ptl.x = ptl.y = 0; |
2835 GpiMove(hpsTemp, &ptl); | |
2836 ptl.x = 0; | |
2837 ptl.y = height; | |
2838 GpiLine(hpsTemp, &ptl); | |
2839 ptl.x = ptl.y = 0; | |
2840 GpiMove(hpsTemp, &ptl); | |
2841 ptl.y = 0; | |
2842 ptl.x = width; | |
2843 GpiLine(hpsTemp, &ptl); | |
2844 ptl.x = width; | |
2845 ptl.y = height; | |
2846 GpiMove(hpsTemp, &ptl); | |
2847 ptl.x = 0; | |
2848 ptl.y = height; | |
2849 GpiLine(hpsTemp, &ptl); | |
2850 ptl.x = width; | |
2851 ptl.y = height; | |
2852 GpiMove(hpsTemp, &ptl); | |
2853 ptl.y = 0; | |
2854 ptl.x = width; | |
2855 GpiLine(hpsTemp, &ptl); | |
2856 WinReleasePS(hpsTemp); | |
2857 } | |
2858 return res; | |
2859 } | |
2860 | |
2861 /* Function: BtProc | |
2862 * Abstract: Subclass procedure for buttons | |
2863 */ | |
2864 | |
2865 MRESULT EXPENTRY _BtProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) | |
2866 { | |
2867 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
|
2868 PFNWP oldproc; |
3 | 2869 |
2870 bubble = (BubbleButton *)WinQueryWindowPtr(hwnd, QWL_USER); | |
2871 | |
2872 if(!bubble) | |
2873 return WinDefWindowProc(hwnd, msg, mp1, mp2); | |
2874 | |
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
|
2875 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
|
2876 |
3 | 2877 switch(msg) |
2878 { | |
37
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
2879 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
|
2880 if(mp2) |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
2881 _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
|
2882 else |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
2883 WinSendMsg(hwnd, BM_SETDEFAULT, 0, 0); |
37
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
2884 break; |
159
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
2885 case WM_BUTTON1DOWN: |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
2886 case WM_BUTTON2DOWN: |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
2887 case WM_BUTTON3DOWN: |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
2888 case WM_BUTTON1DBLCLK: |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
2889 case WM_BUTTON2DBLCLK: |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
2890 case WM_BUTTON3DBLCLK: |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
2891 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
|
2892 return (MRESULT)FALSE; |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
2893 break; |
3 | 2894 case WM_BUTTON1UP: |
2895 { | |
2896 SignalHandler *tmp = Root; | |
2897 | |
159
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
2898 if(WinIsWindowEnabled(hwnd) && !dw_window_get_data(hwnd, "_dw_disabled")) |
3 | 2899 { |
2900 /* Find any callbacks for this function */ | |
2901 while(tmp) | |
2902 { | |
2903 if(tmp->message == WM_COMMAND) | |
2904 { | |
2905 /* Make sure it's the right window, and the right ID */ | |
2906 if(tmp->window == hwnd) | |
2907 { | |
2908 /* Due to the fact that if we run the function | |
2909 * here, finishing actions on the button will occur | |
2910 * after we run the signal handler. So we post the | |
2911 * message so the button can finish what it needs to | |
2912 * do before we run our handler. | |
2913 */ | |
2914 WinPostMsg(hwnd, WM_USER, (MPARAM)tmp, 0); | |
2915 tmp = NULL; | |
2916 } | |
2917 } | |
2918 if(tmp) | |
2919 tmp= tmp->next; | |
2920 } | |
2921 } | |
2922 } | |
2923 break; | |
2924 case WM_USER: | |
2925 { | |
2926 SignalHandler *tmp = (SignalHandler *)mp1; | |
175
d78d08440246
Use _System/_stdcall for callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
174
diff
changeset
|
2927 int (* API clickfunc)(HWND, void *) = NULL; |
3 | 2928 |
2929 if(tmp) | |
2930 { | |
175
d78d08440246
Use _System/_stdcall for callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
174
diff
changeset
|
2931 clickfunc = (int (* API)(HWND, void *))tmp->signalfunction; |
3 | 2932 |
2933 clickfunc(tmp->window, tmp->data); | |
2934 } | |
2935 } | |
2936 break; | |
2937 case WM_CHAR: | |
2938 { | |
2939 /* A button press should also occur for an ENTER or SPACE press | |
2940 * while the button has the active input focus. | |
2941 */ | |
2942 if(SHORT1FROMMP(mp2) == '\r' || SHORT1FROMMP(mp2) == ' ') | |
2943 { | |
2944 SignalHandler *tmp = Root; | |
2945 | |
2946 /* Find any callbacks for this function */ | |
2947 while(tmp) | |
2948 { | |
2949 if(tmp->message == WM_COMMAND) | |
2950 { | |
2951 /* Make sure it's the right window, and the right ID */ | |
2952 if(tmp->window == hwnd) | |
2953 { | |
2954 WinPostMsg(hwnd, WM_USER, (MPARAM)tmp, 0); | |
2955 tmp = NULL; | |
2956 } | |
2957 } | |
2958 if(tmp) | |
2959 tmp= tmp->next; | |
2960 } | |
2961 } | |
2962 if(SHORT1FROMMP(mp2) == '\t') | |
2963 { | |
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
|
2964 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
|
2965 _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
|
2966 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
|
2967 _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
|
2968 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
|
2969 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
|
2970 } |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
2971 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
|
2972 { |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
2973 _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
|
2974 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
|
2975 } |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
2976 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
|
2977 { |
3 | 2978 _shift_focus(hwnd); |
2979 return FALSE; | |
2980 } | |
2981 } | |
2982 break; | |
2983 case 0x041f: | |
2984 if (hwndBubble) | |
2985 { | |
2986 WinDestroyWindow(hwndBubble); | |
2987 hwndBubble = 0; | |
2988 } | |
2989 break; | |
2990 | |
2991 case 0x041e: | |
2992 | |
2993 if(!*bubble->bubbletext) | |
2994 break; | |
2995 | |
2996 if(hwndBubble) | |
2997 { | |
2998 WinDestroyWindow(hwndBubble); | |
2999 hwndBubble = 0; | |
3000 } | |
3001 | |
3002 if(!hwndBubble) | |
3003 { | |
3004 HPS hpsTemp = 0; | |
3005 LONG lHight; | |
3006 LONG lWidth; | |
3007 POINTL txtPointl[TXTBOX_COUNT]; | |
3008 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
|
3009 ULONG ulColor = CLR_YELLOW; |
3 | 3010 void *blah; |
3011 | |
3012 hwndBubbleLast = hwnd; | |
3013 hwndBubble = WinCreateWindow(HWND_DESKTOP, | |
3014 WC_STATIC, | |
3015 "", | |
3016 SS_TEXT | | |
3017 DT_CENTER | | |
3018 DT_VCENTER, | |
3019 0,0,0,0, | |
3020 HWND_DESKTOP, | |
3021 HWND_TOP, | |
3022 0, | |
3023 NULL, | |
3024 NULL); | |
3025 | |
3026 WinSetPresParam(hwndBubble, | |
3027 PP_FONTNAMESIZE, | |
3028 sizeof(DefaultFont), | |
3029 DefaultFont); | |
3030 | |
3031 | |
3032 WinSetPresParam(hwndBubble, | |
3033 PP_BACKGROUNDCOLORINDEX, | |
3034 sizeof(ulColor), | |
3035 &ulColor); | |
3036 | |
3037 WinSetWindowText(hwndBubble, | |
3038 bubble->bubbletext); | |
3039 | |
3040 WinMapWindowPoints(hwnd, HWND_DESKTOP, &ptlWork, 1); | |
3041 | |
3042 hpsTemp = WinGetPS(hwndBubble); | |
3043 GpiQueryTextBox(hpsTemp, | |
3044 strlen(bubble->bubbletext), | |
3045 bubble->bubbletext, | |
3046 TXTBOX_COUNT, | |
3047 txtPointl); | |
3048 WinReleasePS(hpsTemp); | |
3049 | |
3050 lWidth = txtPointl[TXTBOX_TOPRIGHT].x - | |
3051 txtPointl[TXTBOX_TOPLEFT ].x + 8; | |
3052 | |
3053 lHight = txtPointl[TXTBOX_TOPLEFT].y - | |
3054 txtPointl[TXTBOX_BOTTOMLEFT].y + 8; | |
3055 | |
3056 ptlWork.y -= lHight; | |
3057 | |
3058 blah = (void *)WinSubclassWindow(hwndBubble, _BubbleProc); | |
3059 | |
3060 if(blah) | |
3061 WinSetWindowPtr(hwndBubble, QWP_USER, blah); | |
3062 | |
3063 WinSetWindowPos(hwndBubble, | |
3064 HWND_TOP, | |
3065 ptlWork.x, | |
3066 ptlWork.y, | |
3067 lWidth, | |
3068 lHight, | |
3069 SWP_SIZE | SWP_MOVE | SWP_SHOW); | |
3070 } | |
3071 break; | |
3072 } | |
3073 | |
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
|
3074 if(!oldproc) |
3 | 3075 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
|
3076 return oldproc(hwnd, msg, mp1, mp2); |
3 | 3077 } |
3078 | |
3079 MRESULT EXPENTRY _RendProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) | |
3080 { | |
3081 int res = 0; | |
3082 res = (int)_run_event(hwnd, msg, mp1, mp2); | |
3083 switch(msg) | |
3084 { | |
3085 case WM_BUTTON1DOWN: | |
3086 case WM_BUTTON2DOWN: | |
3087 case WM_BUTTON3DOWN: | |
267
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
3088 if(res == -1) |
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
3089 WinSetFocus(HWND_DESKTOP, hwnd); |
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
3090 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
|
3091 return (MPARAM)TRUE; |
3 | 3092 } |
3093 return WinDefWindowProc(hwnd, msg, mp1, mp2); | |
3094 } | |
3095 | |
30
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
3096 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
|
3097 { |
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
|
3098 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
|
3099 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
|
3100 |
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
3101 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
|
3102 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
|
3103 |
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
3104 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
|
3105 { |
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
|
3106 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
|
3107 { |
ac616f625443
Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
127
diff
changeset
|
3108 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
|
3109 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
|
3110 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
|
3111 |
ac616f625443
Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
127
diff
changeset
|
3112 if(oldproc) |
129
e47c52b37cdd
Code cleanup and OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
128
diff
changeset
|
3113 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
|
3114 |
ac616f625443
Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
127
diff
changeset
|
3115 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
|
3116 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
|
3117 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
|
3118 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
|
3119 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
|
3120 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
|
3121 |
ac616f625443
Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
127
diff
changeset
|
3122 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
|
3123 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
|
3124 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
|
3125 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
|
3126 } |
ac616f625443
Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
127
diff
changeset
|
3127 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
|
3128 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
|
3129 _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
|
3130 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
|
3131 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
|
3132 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
|
3133 { |
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
3134 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
|
3135 _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
|
3136 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
|
3137 _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
|
3138 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
|
3139 } |
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
3140 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
|
3141 } |
30
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
3142 |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
3143 _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
|
3144 |
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
|
3145 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
|
3146 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
|
3147 |
30
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
3148 return WinDefWindowProc(hwnd, msg, mp1, mp2); |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
3149 } |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
3150 |
3 | 3151 /* |
3152 * Initializes the Dynamic Windows engine. | |
3153 * Parameters: | |
3154 * newthread: True if this is the only thread. | |
3155 * False if there is already a message loop running. | |
3156 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3157 int API dw_init(int newthread, int argc, char *argv[]) |
3 | 3158 { |
3159 APIRET rc; | |
3160 | |
3161 if(newthread) | |
3162 { | |
3163 dwhab = WinInitialize(0); | |
3164 dwhmq = WinCreateMsgQueue(dwhab, 0); | |
3165 } | |
3166 | |
3167 rc = WinRegisterClass(dwhab, ClassName, _wndproc, CS_SIZEREDRAW | CS_CLIPCHILDREN, 32); | |
3168 rc = WinRegisterClass(dwhab, SplitbarClassName, _splitwndproc, 0L, 32); | |
3169 | |
20
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
3170 /* Get the OS/2 version. */ |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
3171 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
|
3172 |
190
f4c9fa77136a
A cleaner way of finding the toplevel window.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
185
diff
changeset
|
3173 desktop = WinQueryDesktopWindow(dwhab, NULLHANDLE); |
f4c9fa77136a
A cleaner way of finding the toplevel window.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
185
diff
changeset
|
3174 |
3 | 3175 return rc; |
3176 } | |
3177 | |
3178 /* | |
3179 * 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
|
3180 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3181 void API dw_main(void) |
3 | 3182 { |
3183 QMSG qmsg; | |
3184 | |
3185 _dwtid = dw_thread_id(); | |
3186 | |
199
b955228477b3
Removed the window parameter to dw_timer_connect() it was no needed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
195
diff
changeset
|
3187 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
|
3188 { |
b955228477b3
Removed the window parameter to dw_timer_connect() it was no needed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
195
diff
changeset
|
3189 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
|
3190 _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
|
3191 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
|
3192 } |
3 | 3193 |
150
2a0d7b57a6da
Removed unnecessary parameters from dw_main().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
147
diff
changeset
|
3194 WinDestroyMsgQueue(dwhmq); |
2a0d7b57a6da
Removed unnecessary parameters from dw_main().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
147
diff
changeset
|
3195 WinTerminate(dwhab); |
3 | 3196 } |
3197 | |
3198 /* | |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
3199 * 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
|
3200 * Parameters: |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
3201 * 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
|
3202 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3203 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
|
3204 { |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
3205 QMSG qmsg; |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
3206 double start = (double)clock(); |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
3207 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
3208 while(((clock() - start) / (CLOCKS_PER_SEC/1000)) <= milliseconds) |
37
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
3209 { |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
3210 if(WinPeekMsg(dwhab, &qmsg, 0, 0, 0, PM_NOREMOVE)) |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
3211 { |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
3212 WinGetMsg(dwhab, &qmsg, 0, 0, 0); |
199
b955228477b3
Removed the window parameter to dw_timer_connect() it was no needed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
195
diff
changeset
|
3213 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
|
3214 _run_event(qmsg.hwnd, qmsg.msg, qmsg.mp1, qmsg.mp2); |
37
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
3215 WinDispatchMsg(dwhab, &qmsg); |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
3216 } |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
3217 else |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
3218 DosSleep(1); |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
3219 } |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
3220 } |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
3221 |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
3222 /* |
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
|
3223 * 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
|
3224 */ |
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
|
3225 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
|
3226 { |
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
|
3227 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
|
3228 |
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
|
3229 _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
|
3230 |
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
|
3231 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
|
3232 { |
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
|
3233 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
|
3234 _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
|
3235 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
|
3236 } |
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
|
3237 } |
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
|
3238 |
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
|
3239 /* |
3 | 3240 * Free's memory allocated by dynamic windows. |
3241 * Parameters: | |
3242 * ptr: Pointer to dynamic windows allocated | |
3243 * memory to be free()'d. | |
3244 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3245 void API dw_free(void *ptr) |
3 | 3246 { |
3247 free(ptr); | |
3248 } | |
3249 | |
3250 /* | |
3251 * Allocates and initializes a dialog struct. | |
3252 * Parameters: | |
3253 * data: User defined data to be passed to functions. | |
3254 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3255 DWDialog * API dw_dialog_new(void *data) |
3 | 3256 { |
3257 DWDialog *tmp = malloc(sizeof(DWDialog)); | |
3258 | |
3259 tmp->eve = dw_event_new(); | |
3260 dw_event_reset(tmp->eve); | |
3261 tmp->data = data; | |
3262 tmp->done = FALSE; | |
3263 tmp->result = NULL; | |
3264 | |
3265 return tmp; | |
3266 } | |
3267 | |
3268 /* | |
3269 * Accepts a dialog struct and returns the given data to the | |
3270 * initial called of dw_dialog_wait(). | |
3271 * Parameters: | |
3272 * dialog: Pointer to a dialog struct aquired by dw_dialog_new). | |
3273 * result: Data to be returned by dw_dialog_wait(). | |
3274 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3275 int API dw_dialog_dismiss(DWDialog *dialog, void *result) |
3 | 3276 { |
3277 dialog->result = result; | |
3278 dw_event_post(dialog->eve); | |
3279 dialog->done = TRUE; | |
3280 return 0; | |
3281 } | |
3282 | |
3283 /* | |
3284 * Accepts a dialog struct waits for dw_dialog_dismiss() to be | |
3285 * called by a signal handler with the given dialog struct. | |
3286 * Parameters: | |
3287 * dialog: Pointer to a dialog struct aquired by dw_dialog_new). | |
3288 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3289 void * API dw_dialog_wait(DWDialog *dialog) |
3 | 3290 { |
3291 QMSG qmsg; | |
3292 void *tmp; | |
3293 | |
3294 while (WinGetMsg(dwhab, &qmsg, 0, 0, 0)) | |
3295 { | |
199
b955228477b3
Removed the window parameter to dw_timer_connect() it was no needed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
195
diff
changeset
|
3296 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
|
3297 _run_event(qmsg.hwnd, qmsg.msg, qmsg.mp1, qmsg.mp2); |
3 | 3298 WinDispatchMsg(dwhab, &qmsg); |
3299 if(dialog->done) | |
3300 break; | |
3301 } | |
3302 dw_event_close(&dialog->eve); | |
3303 tmp = dialog->result; | |
3304 free(dialog); | |
3305 return tmp; | |
3306 } | |
3307 | |
3308 | |
3309 /* | |
3310 * Displays a Message Box with given text and title.. | |
3311 * Parameters: | |
3312 * title: The title of the message box. | |
3313 * format: printf style format string. | |
3314 * ...: Additional variables for use in the format. | |
3315 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3316 int API dw_messagebox(char *title, char *format, ...) |
3 | 3317 { |
3318 va_list args; | |
3319 char outbuf[1024]; | |
3320 | |
3321 va_start(args, format); | |
3322 vsprintf(outbuf, format, args); | |
3323 va_end(args); | |
3324 | |
3325 WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, outbuf, title, 0, MB_OK | MB_INFORMATION | MB_MOVEABLE); | |
3326 | |
3327 return strlen(outbuf); | |
3328 } | |
3329 | |
3330 /* | |
3331 * Displays a Message Box with given text and title.. | |
3332 * Parameters: | |
3333 * title: The title of the message box. | |
3334 * text: The text to display in the box. | |
3335 * Returns: | |
3336 * True if YES False of NO. | |
3337 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3338 int API dw_yesno(char *title, char *text) |
3 | 3339 { |
3340 if(WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, text, title, 0, MB_YESNO | MB_INFORMATION | MB_MOVEABLE | MB_SYSTEMMODAL)==MBID_YES) | |
3341 return TRUE; | |
3342 return FALSE; | |
3343 } | |
3344 | |
3345 /* | |
40
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
3346 * Makes the window topmost. |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
3347 * Parameters: |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
3348 * 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
|
3349 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3350 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
|
3351 { |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
3352 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
|
3353 } |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
3354 |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
3355 /* |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
3356 * Makes the window bottommost. |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
3357 * Parameters: |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
3358 * 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
|
3359 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3360 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
|
3361 { |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
3362 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
|
3363 } |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
3364 |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
3365 /* |
3 | 3366 * Makes the window visible. |
3367 * Parameters: | |
3368 * handle: The window handle to make visible. | |
3369 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3370 int API dw_window_show(HWND handle) |
3 | 3371 { |
3372 int rc = WinSetWindowPos(handle, NULLHANDLE, 0, 0, 0, 0, SWP_SHOW); | |
3373 HSWITCH hswitch; | |
3374 SWCNTRL swcntrl; | |
3375 | |
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
|
3376 _fix_button_owner(_toplevel_window(handle), 0); |
3 | 3377 WinSetFocus(HWND_DESKTOP, handle); |
3378 _initial_focus(handle); | |
3379 | |
3380 /* If this window has a switch list entry make sure it is visible */ | |
3381 hswitch = WinQuerySwitchHandle(handle, 0); | |
3382 if(hswitch) | |
3383 { | |
3384 WinQuerySwitchEntry(hswitch, &swcntrl); | |
3385 swcntrl.uchVisibility = SWL_VISIBLE; | |
3386 WinChangeSwitchEntry(hswitch, &swcntrl); | |
3387 } | |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3388 if(WinWindowFromID(handle, FID_CLIENT)) |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3389 { |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3390 WindowData *blah = WinQueryWindowPtr(handle, QWP_USER); |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3391 |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3392 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
|
3393 { |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3394 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
|
3395 int newx, newy, changed = 0; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3396 SWP swp; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3397 |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3398 blah->flags |= DW_OS2_NEW_WINDOW; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3399 |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3400 WinQueryWindowPos(handle, &swp); |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3401 |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3402 newx = swp.x; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3403 newy = swp.y; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3404 |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3405 if((swp.x+swp.cx) > cx) |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3406 { |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3407 newx = (cx - swp.cx)/2; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3408 changed = 1; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3409 } |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3410 if((swp.y+swp.cy) > cy) |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3411 { |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3412 newy = (cy - swp.cy)/2; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3413 changed = 1; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3414 } |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3415 if(changed) |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3416 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
|
3417 } |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3418 } |
3 | 3419 return rc; |
3420 } | |
3421 | |
3422 /* | |
14
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3423 * 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
|
3424 * Parameters: |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3425 * handle: The window handle to minimize. |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3426 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3427 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
|
3428 { |
39
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
3429 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
|
3430 |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
3431 if(hwndclient) |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
3432 { |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
3433 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
|
3434 |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
3435 if(box) |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
3436 { |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
3437 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
|
3438 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
|
3439 } |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
3440 } |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
3441 |
14
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3442 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
|
3443 } |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3444 |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3445 /* |
3 | 3446 * Makes the window invisible. |
3447 * Parameters: | |
3448 * handle: The window handle to make visible. | |
3449 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3450 int API dw_window_hide(HWND handle) |
3 | 3451 { |
3452 HSWITCH hswitch; | |
3453 SWCNTRL swcntrl; | |
3454 | |
3455 /* If this window has a switch list entry make sure it is invisible */ | |
3456 hswitch = WinQuerySwitchHandle(handle, 0); | |
3457 if(hswitch) | |
3458 { | |
3459 WinQuerySwitchEntry(hswitch, &swcntrl); | |
3460 swcntrl.uchVisibility = SWL_INVISIBLE; | |
3461 WinChangeSwitchEntry(hswitch, &swcntrl); | |
3462 } | |
3463 return WinShowWindow(handle, FALSE); | |
3464 } | |
3465 | |
3466 /* | |
3467 * Destroys a window and all of it's children. | |
3468 * Parameters: | |
3469 * handle: The window handle to destroy. | |
3470 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3471 int API dw_window_destroy(HWND handle) |
3 | 3472 { |
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
|
3473 HWND parent = WinQueryWindow(handle, QW_PARENT); |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3474 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
|
3475 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3476 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
|
3477 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
|
3478 |
210
b9c7b762c104
When comparing the desktop value, use the queried value not the constant.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
207
diff
changeset
|
3479 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
|
3480 { |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3481 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
|
3482 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
|
3483 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3484 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
|
3485 { |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3486 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
|
3487 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
|
3488 } |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3489 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3490 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
|
3491 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
|
3492 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3493 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
|
3494 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3495 /* 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
|
3496 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
|
3497 { |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3498 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
|
3499 } |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3500 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
|
3501 { |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3502 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
|
3503 } |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3504 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3505 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
|
3506 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
|
3507 thisbox->count--; |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
3508 _free_window_memory(handle); |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
3509 } |
3 | 3510 return WinDestroyWindow(handle); |
3511 } | |
3512 | |
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
|
3513 /* 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
|
3514 * 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
|
3515 * 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
|
3516 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3517 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
|
3518 { |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
3519 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
|
3520 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
|
3521 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
|
3522 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3523 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
|
3524 { |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3525 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
|
3526 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3527 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
|
3528 |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
3529 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
|
3530 _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
|
3531 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
|
3532 } |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3533 } |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3534 |
3 | 3535 /* |
3536 * Changes a window's parent to newparent. | |
3537 * Parameters: | |
3538 * handle: The window handle to destroy. | |
3539 * newparent: The window's new parent window. | |
3540 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3541 void API dw_window_reparent(HWND handle, HWND newparent) |
3 | 3542 { |
3543 HWND blah = WinWindowFromID(newparent, FID_CLIENT); | |
3544 WinSetParent(handle, blah ? blah : newparent, TRUE); | |
3545 } | |
3546 | |
3547 /* | |
3548 * Sets the font used by a specified window (widget) handle. | |
3549 * Parameters: | |
3550 * handle: The window (widget) handle. | |
3551 * fontname: Name and size of the font in the form "size.fontname" | |
3552 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3553 int API dw_window_set_font(HWND handle, char *fontname) |
3 | 3554 { |
3555 return WinSetPresParam(handle, PP_FONTNAMESIZE, strlen(fontname)+1, fontname); | |
3556 } | |
3557 | |
159
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
3558 /* Internal version */ |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
3559 int _dw_window_set_color(HWND handle, ULONG fore, ULONG back) |
3 | 3560 { |
3561 if((fore & DW_RGB_COLOR) == DW_RGB_COLOR) | |
3562 { | |
3563 RGB2 rgb2; | |
3564 | |
3565 rgb2.bBlue = DW_BLUE_VALUE(fore); | |
3566 rgb2.bGreen = DW_GREEN_VALUE(fore); | |
3567 rgb2.bRed = DW_RED_VALUE(fore); | |
3568 rgb2.fcOptions = 0; | |
3569 | |
3570 WinSetPresParam(handle, PP_FOREGROUNDCOLOR, sizeof(RGB2), &rgb2); | |
3571 | |
3572 } | |
155
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
154
diff
changeset
|
3573 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
|
3574 { |
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
|
3575 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
|
3576 |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
154
diff
changeset
|
3577 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
|
3578 } |
3 | 3579 if((back & DW_RGB_COLOR) == DW_RGB_COLOR) |
3580 { | |
3581 RGB2 rgb2; | |
3582 | |
3583 rgb2.bBlue = DW_BLUE_VALUE(back); | |
3584 rgb2.bGreen = DW_GREEN_VALUE(back); | |
3585 rgb2.bRed = DW_RED_VALUE(back); | |
3586 rgb2.fcOptions = 0; | |
3587 | |
3588 WinSetPresParam(handle, PP_BACKGROUNDCOLOR, sizeof(RGB2), &rgb2); | |
3589 return 0; | |
3590 } | |
155
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
154
diff
changeset
|
3591 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
|
3592 { |
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
|
3593 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
|
3594 |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
154
diff
changeset
|
3595 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
|
3596 } |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
154
diff
changeset
|
3597 return 0; |
3 | 3598 } |
159
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
3599 /* |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
3600 * 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
|
3601 * Parameters: |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
3602 * handle: The window (widget) handle. |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
3603 * 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
|
3604 * 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
|
3605 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3606 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
|
3607 { |
228
326e114923cf
Deal with the enhanced window enable/disable with the new color code
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
225
diff
changeset
|
3608 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
|
3609 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
|
3610 |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
3611 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
|
3612 } |
3 | 3613 |
3614 /* | |
3615 * Sets the font used by a specified window (widget) handle. | |
3616 * Parameters: | |
3617 * handle: The window (widget) handle. | |
3618 * border: Size of the window border in pixels. | |
3619 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3620 int API dw_window_set_border(HWND handle, int border) |
3 | 3621 { |
3622 WinSendMsg(handle, WM_SETBORDERSIZE, MPFROMSHORT(border), MPFROMSHORT(border)); | |
3623 return 0; | |
3624 } | |
3625 | |
3626 /* | |
3627 * Captures the mouse input to this window. | |
3628 * Parameters: | |
3629 * handle: Handle to receive mouse input. | |
3630 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3631 void API dw_window_capture(HWND handle) |
3 | 3632 { |
3633 WinSetCapture(HWND_DESKTOP, handle); | |
3634 } | |
3635 | |
3636 /* | |
3637 * Releases previous mouse capture. | |
3638 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3639 void API dw_window_release(void) |
3 | 3640 { |
3641 WinSetCapture(HWND_DESKTOP, NULLHANDLE); | |
3642 } | |
3643 | |
3644 /* | |
3645 * Tracks this window movement. | |
3646 * Parameters: | |
3647 * handle: Handle to frame to be tracked. | |
3648 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3649 void API dw_window_track(HWND handle) |
3 | 3650 { |
3651 WinSendMsg(handle, WM_TRACKFRAME, MPFROMSHORT(TF_MOVE), 0); | |
3652 } | |
3653 | |
3654 /* | |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
3655 * 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
|
3656 * Parameters: |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
3657 * 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
|
3658 * 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
|
3659 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3660 void API dw_window_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
|
3661 { |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
3662 WinSetPointer(handle, |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
3663 WinQuerySysPointer(HWND_DESKTOP, |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
3664 pointertype, |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
3665 FALSE)); |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
3666 } |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
3667 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
3668 /* |
3 | 3669 * Create a new Window Frame. |
3670 * Parameters: | |
3671 * owner: The Owner's window handle or HWND_DESKTOP. | |
3672 * title: The Window title. | |
3673 * flStyle: Style flags, see the PM reference. | |
3674 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3675 HWND API dw_window_new(HWND hwndOwner, char *title, ULONG flStyle) |
3 | 3676 { |
3677 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
|
3678 Box *newbox = calloc(1, sizeof(Box)); |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3679 WindowData *blah = calloc(1, sizeof(WindowData)); |
3 | 3680 |
3681 newbox->pad = 0; | |
3682 newbox->type = BOXVERT; | |
3683 newbox->count = 0; | |
3684 | |
3685 flStyle |= FCF_NOBYTEALIGN; | |
3686 | |
39
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
3687 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
|
3688 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
|
3689 else |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
3690 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
|
3691 |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3692 if(!(flStyle & FCF_SHELLPOSITION)) |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3693 blah->flags |= DW_OS2_NEW_WINDOW; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3694 |
3 | 3695 hwndframe = WinCreateStdWindow(hwndOwner, 0L, &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
|
3696 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
|
3697 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
|
3698 WinSetParent(newbox->hwndtitle, HWND_OBJECT, FALSE); |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3699 blah->oldproc = WinSubclassWindow(hwndframe, _sizeproc); |
3 | 3700 WinSetWindowPtr(hwndframe, QWP_USER, blah); |
3701 WinSetWindowPtr(hwndclient, QWP_USER, newbox); | |
3702 | |
3703 return hwndframe; | |
3704 } | |
3705 | |
3706 /* | |
3707 * Create a new Box to be packed. | |
3708 * Parameters: | |
3709 * type: Either BOXVERT (vertical) or BOXHORZ (horizontal). | |
3710 * pad: Number of pixels to pad around the box. | |
3711 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3712 HWND API dw_box_new(int type, int pad) |
3 | 3713 { |
8
e22584460709
Switched allocating the box structs with calloc instead of malloc so
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
7
diff
changeset
|
3714 Box *newbox = calloc(1, sizeof(Box)); |
3 | 3715 HWND hwndframe; |
3716 | |
3717 newbox->pad = pad; | |
3718 newbox->type = type; | |
3719 newbox->count = 0; | |
3720 newbox->grouphwnd = NULLHANDLE; | |
3721 | |
3722 hwndframe = WinCreateWindow(HWND_OBJECT, | |
3723 WC_FRAME, | |
3724 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
|
3725 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
|
3726 FS_NOBYTEALIGN, |
3 | 3727 0,0,2000,1000, |
3728 NULLHANDLE, | |
3729 HWND_TOP, | |
3730 0L, | |
3731 NULL, | |
3732 NULL); | |
3733 | |
3734 newbox->oldproc = WinSubclassWindow(hwndframe, _controlproc); | |
3735 WinSetWindowPtr(hwndframe, QWP_USER, newbox); | |
3736 dw_window_set_color(hwndframe, DW_CLR_PALEGRAY, DW_CLR_PALEGRAY); | |
3737 return hwndframe; | |
3738 } | |
3739 | |
3740 /* | |
3741 * Create a new Group Box to be packed. | |
3742 * Parameters: | |
3743 * type: Either BOXVERT (vertical) or BOXHORZ (horizontal). | |
3744 * pad: Number of pixels to pad around the box. | |
3745 * title: Text to be displayined in the group outline. | |
3746 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3747 HWND API dw_groupbox_new(int type, int pad, char *title) |
3 | 3748 { |
8
e22584460709
Switched allocating the box structs with calloc instead of malloc so
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
7
diff
changeset
|
3749 Box *newbox = calloc(1, sizeof(Box)); |
3 | 3750 HWND hwndframe; |
3751 | |
3752 newbox->pad = pad; | |
3753 newbox->type = type; | |
3754 newbox->count = 0; | |
3755 | |
3756 hwndframe = WinCreateWindow(HWND_OBJECT, | |
3757 WC_FRAME, | |
3758 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
|
3759 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
|
3760 FS_NOBYTEALIGN, |
3 | 3761 0,0,2000,1000, |
3762 NULLHANDLE, | |
3763 HWND_TOP, | |
3764 0L, | |
3765 NULL, | |
3766 NULL); | |
3767 | |
3768 newbox->grouphwnd = WinCreateWindow(hwndframe, | |
3769 WC_STATIC, | |
3770 title, | |
3771 WS_VISIBLE | SS_GROUPBOX | | |
3772 WS_GROUP, | |
3773 0,0,2000,1000, | |
3774 NULLHANDLE, | |
3775 HWND_TOP, | |
3776 0L, | |
3777 NULL, | |
3778 NULL); | |
3779 | |
3780 WinSetWindowPtr(hwndframe, QWP_USER, newbox); | |
3781 dw_window_set_color(hwndframe, DW_CLR_PALEGRAY, DW_CLR_PALEGRAY); | |
3782 dw_window_set_color(newbox->grouphwnd, DW_CLR_BLACK, DW_CLR_PALEGRAY); | |
3783 dw_window_set_font(newbox->grouphwnd, DefaultFont); | |
3784 return hwndframe; | |
3785 } | |
3786 | |
3787 /* | |
14
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3788 * 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
|
3789 * Parameters: |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3790 * 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
|
3791 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3792 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
|
3793 { |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3794 HWND hwndframe; |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3795 |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3796 hwndframe = WinCreateWindow(HWND_OBJECT, |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3797 WC_FRAME, |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3798 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
|
3799 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
|
3800 FS_NOBYTEALIGN, |
14
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3801 0,0,2000,1000, |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3802 NULLHANDLE, |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3803 HWND_TOP, |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3804 0L, |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3805 NULL, |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3806 NULL); |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3807 return hwndframe; |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3808 } |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3809 |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3810 /* |
3 | 3811 * Create a bitmap object to be packed. |
3812 * 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
|
3813 * id: An ID to be used with dw_window_from_id() or 0L. |
3 | 3814 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3815 HWND API dw_bitmap_new(ULONG id) |
3 | 3816 { |
3817 return WinCreateWindow(HWND_OBJECT, | |
3818 WC_STATIC, | |
3819 NULL, | |
3820 WS_VISIBLE | SS_TEXT, | |
3821 0,0,2000,1000, | |
3822 NULLHANDLE, | |
3823 HWND_TOP, | |
3824 id, | |
3825 NULL, | |
3826 NULL); | |
3827 } | |
3828 | |
3829 /* | |
3830 * Create a notebook object to be packed. | |
3831 * Parameters: | |
3832 * id: An ID to be used for getting the resource from the | |
3833 * resource file. | |
3834 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3835 HWND API dw_notebook_new(ULONG id, int top) |
3 | 3836 { |
3837 ULONG flags; | |
3838 HWND tmp; | |
3839 | |
3840 if(top) | |
3841 flags = BKS_MAJORTABTOP; | |
3842 else | |
3843 flags = BKS_MAJORTABBOTTOM; | |
3844 | |
3845 tmp = WinCreateWindow(HWND_OBJECT, | |
3846 WC_NOTEBOOK, | |
3847 NULL, | |
3848 WS_VISIBLE | | |
3849 BKS_TABBEDDIALOG | | |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
3850 flags, |
3 | 3851 0,0,2000,1000, |
3852 NULLHANDLE, | |
3853 HWND_TOP, | |
3854 id, | |
3855 NULL, | |
3856 NULL); | |
3857 | |
20
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
3858 /* Fix tab sizes on Warp 3 */ |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
3859 if(!IS_WARP4()) |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
3860 { |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
3861 /* 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
|
3862 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
|
3863 } |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
3864 |
3 | 3865 dw_window_set_font(tmp, DefaultFont); |
3866 return tmp; | |
3867 } | |
3868 | |
3869 /* | |
3870 * Create a menu object to be popped up. | |
3871 * Parameters: | |
3872 * id: An ID to be used for getting the resource from the | |
3873 * resource file. | |
3874 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3875 HMENUI API dw_menu_new(ULONG id) |
3 | 3876 { |
185
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
3877 HMENUI tmp = WinCreateWindow(HWND_OBJECT, |
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
3878 WC_MENU, |
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
3879 NULL, |
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
3880 WS_VISIBLE, |
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
3881 0,0,2000,1000, |
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
3882 NULLHANDLE, |
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
3883 HWND_TOP, |
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
3884 id, |
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
3885 NULL, |
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
3886 NULL); |
3 | 3887 return tmp; |
3888 } | |
3889 | |
3890 /* | |
3891 * Create a menubar on a window. | |
3892 * Parameters: | |
3893 * location: Handle of a window frame to be attached to. | |
3894 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3895 HMENUI API dw_menubar_new(HWND location) |
3 | 3896 { |
185
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
3897 HMENUI tmp = WinCreateWindow(location, |
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
3898 WC_MENU, |
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
3899 NULL, |
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
3900 WS_VISIBLE | MS_ACTIONBAR, |
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
3901 0,0,2000,1000, |
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
3902 location, |
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
3903 HWND_TOP, |
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
3904 FID_MENU, |
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
3905 NULL, |
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
3906 NULL); |
3 | 3907 return tmp; |
3908 } | |
3909 | |
3910 /* | |
3911 * Destroys a menu created with dw_menubar_new or dw_menu_new. | |
3912 * Parameters: | |
3913 * menu: Handle of a menu. | |
3914 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3915 void API dw_menu_destroy(HMENUI *menu) |
3 | 3916 { |
185
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
3917 if(menu) |
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
3918 WinDestroyWindow(*menu); |
3 | 3919 } |
3920 | |
3921 /* | |
3922 * Adds a menuitem or submenu to an existing menu. | |
3923 * Parameters: | |
3924 * menu: The handle the the existing menu. | |
3925 * title: The title text on the menu item to be added. | |
3926 * id: An ID to be used for message passing. | |
3927 * flags: Extended attributes to set on the menu. | |
3928 * end: If TRUE memu is positioned at the end of the menu. | |
3929 * check: If TRUE menu is "check"able. | |
3930 * submenu: Handle to an existing menu to be a submenu or NULL. | |
3931 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3932 HWND API dw_menu_append_item(HMENUI menux, char *title, ULONG id, ULONG flags, int end, int check, HMENUI submenu) |
3 | 3933 { |
3934 MENUITEM miSubMenu; | |
3935 | |
3936 if(!menux) | |
3937 return NULLHANDLE; | |
3938 | |
3939 if(end) | |
3940 miSubMenu.iPosition=MIT_END; | |
3941 else | |
3942 miSubMenu.iPosition=0; | |
3943 | |
3944 if(strlen(title) == 0) | |
3945 miSubMenu.afStyle=MIS_SEPARATOR | flags; | |
3946 else | |
3947 miSubMenu.afStyle=MIS_TEXT | flags; | |
3948 miSubMenu.afAttribute=0; | |
3949 miSubMenu.id=id; | |
185
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
3950 miSubMenu.hwndSubMenu = submenu; |
3 | 3951 miSubMenu.hItem=NULLHANDLE; |
3952 | |
185
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
3953 WinSendMsg(menux, |
3 | 3954 MM_INSERTITEM, |
3955 MPFROMP(&miSubMenu), | |
3956 MPFROMP(title)); | |
3957 return (HWND)id; | |
3958 } | |
3959 | |
3960 /* | |
3961 * Sets the state of a menu item check. | |
3962 * Parameters: | |
3963 * menu: The handle the the existing menu. | |
3964 * id: Menuitem id. | |
3965 * check: TRUE for checked FALSE for not checked. | |
3966 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3967 void API dw_menu_item_set_check(HMENUI menux, unsigned long id, int check) |
3 | 3968 { |
3969 if(check) | |
185
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
3970 WinSendMsg(menux, MM_SETITEMATTR, MPFROM2SHORT(id, TRUE), |
3 | 3971 MPFROM2SHORT(MIA_CHECKED, MIA_CHECKED)); |
3972 else | |
185
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
3973 WinSendMsg(menux, MM_SETITEMATTR, MPFROM2SHORT(id, TRUE), |
3 | 3974 MPFROM2SHORT(MIA_CHECKED, 0)); |
3975 } | |
3976 | |
3977 /* | |
3978 * Pops up a context menu at given x and y coordinates. | |
3979 * Parameters: | |
3980 * menu: The handle the the existing menu. | |
3981 * parent: Handle to the window initiating the popup. | |
3982 * x: X coordinate. | |
3983 * y: Y coordinate. | |
3984 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3985 void API dw_menu_popup(HMENUI *menu, HWND parent, int x, int y) |
3 | 3986 { |
185
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
3987 if(menu) |
3 | 3988 { |
93
98cce029a611
Changed handling of menu item click events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
90
diff
changeset
|
3989 popup = parent; |
185
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
3990 WinPopupMenu(HWND_DESKTOP, parent, *menu, x, dw_screen_height() - y, 0, PU_KEYBOARD | PU_MOUSEBUTTON1 | PU_VCONSTRAIN | PU_HCONSTRAIN); |
3 | 3991 } |
3992 } | |
3993 | |
3994 /* | |
3995 * Returns the current X and Y coordinates of the mouse pointer. | |
3996 * Parameters: | |
3997 * x: Pointer to variable to store X coordinate. | |
3998 * y: Pointer to variable to store Y coordinate. | |
3999 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
4000 void API dw_pointer_query_pos(long *x, long *y) |
3 | 4001 { |
4002 POINTL ptl; | |
4003 | |
4004 WinQueryPointerPos(HWND_DESKTOP, &ptl); | |
4005 if(x && y) | |
4006 { | |
4007 *x = ptl.x; | |
4008 *y = dw_screen_height() - ptl.y; | |
4009 } | |
4010 } | |
4011 | |
4012 /* | |
4013 * Sets the X and Y coordinates of the mouse pointer. | |
4014 * Parameters: | |
4015 * x: X coordinate. | |
4016 * y: Y coordinate. | |
4017 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
4018 void API dw_pointer_set_pos(long x, long y) |
3 | 4019 { |
4020 WinSetPointerPos(HWND_DESKTOP, x, dw_screen_height() - y); | |
4021 } | |
4022 | |
4023 /* | |
4024 * Create a container object to be packed. | |
4025 * Parameters: | |
4026 * id: An ID to be used for getting the resource from the | |
4027 * resource file. | |
4028 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
4029 HWND API dw_container_new(ULONG id) |
3 | 4030 { |
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
|
4031 WindowData *blah = calloc(1, sizeof(WindowData)); |
3 | 4032 HWND tmp = WinCreateWindow(HWND_OBJECT, |
4033 WC_CONTAINER, | |
4034 NULL, | |
4035 WS_VISIBLE | CCS_READONLY | | |
4036 CCS_SINGLESEL | CCS_AUTOPOSITION, | |
4037 0,0,2000,1000, | |
4038 NULLHANDLE, | |
4039 HWND_TOP, | |
4040 id, | |
4041 NULL, | |
4042 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
|
4043 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
|
4044 WinSetWindowPtr(tmp, QWP_USER, blah); |
3 | 4045 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
|
4046 dw_window_set_data(tmp, "_dw_container", (void *)1); |
3 | 4047 return tmp; |
4048 } | |
4049 | |
4050 /* | |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
4051 * 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
|
4052 * Parameters: |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
4053 * 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
|
4054 * 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
|
4055 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
4056 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
|
4057 { |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
4058 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
|
4059 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
|
4060 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
|
4061 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
|
4062 NULL, |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
4063 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
|
4064 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
|
4065 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
|
4066 NULLHANDLE, |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
4067 HWND_TOP, |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
4068 id, |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
4069 NULL, |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
4070 NULL); |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
4071 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
4072 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
|
4073 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
|
4074 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
|
4075 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
|
4076 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
|
4077 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
|
4078 |
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
|
4079 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
|
4080 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
|
4081 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
|
4082 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
|
4083 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
|
4084 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
|
4085 } |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
4086 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
4087 /* |
3 | 4088 * Create a new static text window (widget) to be packed. |
4089 * Parameters: | |
4090 * 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
|
4091 * id: An ID to be used with dw_window_from_id() or 0L. |
3 | 4092 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
4093 HWND API dw_text_new(char *text, ULONG id) |
3 | 4094 { |
4095 HWND tmp = WinCreateWindow(HWND_OBJECT, | |
4096 WC_STATIC, | |
4097 text, | |
4098 WS_VISIBLE | SS_TEXT, | |
4099 0,0,2000,1000, | |
4100 NULLHANDLE, | |
4101 HWND_TOP, | |
4102 id, | |
4103 NULL, | |
4104 NULL); | |
4105 dw_window_set_font(tmp, DefaultFont); | |
4106 dw_window_set_color(tmp, DW_CLR_BLACK, DW_CLR_PALEGRAY); | |
4107 return tmp; | |
4108 } | |
4109 | |
4110 /* | |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4111 * 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
|
4112 * Parameters: |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4113 * 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
|
4114 * 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
|
4115 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
4116 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
|
4117 { |
90
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
4118 WindowData *blah = calloc(sizeof(WindowData), 1); |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4119 HWND tmp = WinCreateWindow(HWND_OBJECT, |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4120 WC_STATIC, |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4121 text, |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4122 WS_VISIBLE | SS_TEXT, |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4123 0,0,2000,1000, |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4124 NULLHANDLE, |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4125 HWND_TOP, |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4126 id, |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4127 NULL, |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4128 NULL); |
180
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
4129 blah->oldproc = WinSubclassWindow(tmp, _statusproc); |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
4130 WinSetWindowPtr(tmp, QWP_USER, blah); |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4131 dw_window_set_font(tmp, DefaultFont); |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4132 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
|
4133 return tmp; |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4134 } |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4135 |
154
7f8fcce45bdd
Fixed EMX building.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
4136 #ifndef MLS_LIMITVSCROLL |
7f8fcce45bdd
Fixed EMX building.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
4137 #define MLS_LIMITVSCROLL 0x00000080L |
7f8fcce45bdd
Fixed EMX building.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
4138 #endif |
7f8fcce45bdd
Fixed EMX building.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
4139 |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4140 /* |
3 | 4141 * Create a new Multiline Editbox window (widget) to be packed. |
4142 * 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
|
4143 * id: An ID to be used with dw_window_from_id() or 0L. |
3 | 4144 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
4145 HWND API dw_mle_new(ULONG id) |
3 | 4146 { |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
4147 WindowData *blah = calloc(1, sizeof(WindowData)); |
3 | 4148 HWND tmp = WinCreateWindow(HWND_OBJECT, |
4149 WC_MLE, | |
4150 "", | |
4151 WS_VISIBLE | | |
4152 MLS_BORDER | MLS_IGNORETAB | | |
152
e78027768548
Added MLS_LIMITVSCROLL to the MLE style.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
151
diff
changeset
|
4153 MLS_READONLY | MLS_VSCROLL | |
e78027768548
Added MLS_LIMITVSCROLL to the MLE style.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
151
diff
changeset
|
4154 MLS_LIMITVSCROLL, |
3 | 4155 0,0,2000,1000, |
4156 NULLHANDLE, | |
4157 HWND_TOP, | |
4158 id, | |
4159 NULL, | |
4160 NULL); | |
153
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
4161 blah->oldproc = WinSubclassWindow(tmp, _mleproc); |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
4162 WinSetWindowPtr(tmp, QWP_USER, blah); |
180
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
4163 dw_window_set_font(tmp, DefaultFont); |
3 | 4164 return tmp; |
4165 } | |
4166 | |
4167 /* | |
4168 * Create a new Entryfield window (widget) to be packed. | |
4169 * Parameters: | |
4170 * 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
|
4171 * id: An ID to be used with dw_window_from_id() or 0L. |
3 | 4172 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
4173 HWND API dw_entryfield_new(char *text, ULONG id) |
3 | 4174 { |
40
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
4175 |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
4176 WindowData *blah = calloc(1, sizeof(WindowData)); |
3 | 4177 HWND tmp = WinCreateWindow(HWND_OBJECT, |
4178 WC_ENTRYFIELD, | |
4179 text, | |
4180 WS_VISIBLE | ES_MARGIN | | |
4181 ES_AUTOSCROLL | WS_TABSTOP, | |
4182 0,0,2000,1000, | |
4183 NULLHANDLE, | |
4184 HWND_TOP, | |
4185 id, | |
4186 NULL, | |
4187 NULL); | |
40
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
4188 blah->oldproc = WinSubclassWindow(tmp, _entryproc); |
3 | 4189 WinSetWindowPtr(tmp, QWP_USER, blah); |
180
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
4190 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
|
4191 dw_window_set_color(tmp, DW_CLR_BLACK, DW_CLR_WHITE); |
3 | 4192 return tmp; |
4193 } | |
4194 | |
4195 /* | |
4196 * Create a new Entryfield (password) window (widget) to be packed. | |
4197 * Parameters: | |
4198 * 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
|
4199 * id: An ID to be used with dw_window_from_id() or 0L. |
3 | 4200 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
4201 HWND API dw_entryfield_password_new(char *text, ULONG id) |
3 | 4202 { |
40
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
4203 WindowData *blah = calloc(1, sizeof(WindowData)); |
3 | 4204 HWND tmp = WinCreateWindow(HWND_OBJECT, |
4205 WC_ENTRYFIELD, | |
4206 text, | |
4207 WS_VISIBLE | ES_MARGIN | ES_UNREADABLE | | |
4208 ES_AUTOSCROLL | WS_TABSTOP, | |
4209 0,0,2000,1000, | |
4210 NULLHANDLE, | |
4211 HWND_TOP, | |
4212 id, | |
4213 NULL, | |
4214 NULL); | |
40
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
4215 blah->oldproc = WinSubclassWindow(tmp, _entryproc); |
3 | 4216 WinSetWindowPtr(tmp, QWP_USER, blah); |
180
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
4217 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
|
4218 dw_window_set_color(tmp, DW_CLR_BLACK, DW_CLR_WHITE); |
3 | 4219 return tmp; |
4220 } | |
4221 | |
4222 /* | |
4223 * Create a new Combobox window (widget) to be packed. | |
4224 * Parameters: | |
4225 * 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
|
4226 * id: An ID to be used with dw_window_from_id() or 0L. |
3 | 4227 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
4228 HWND API dw_combobox_new(char *text, ULONG id) |
3 | 4229 { |
40
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
4230 WindowData *blah = calloc(1, sizeof(WindowData)); |
3 | 4231 HWND tmp = WinCreateWindow(HWND_OBJECT, |
4232 WC_COMBOBOX, | |
4233 text, | |
4234 WS_VISIBLE | CBS_DROPDOWN | WS_GROUP, | |
4235 0,0,2000,1000, | |
4236 NULLHANDLE, | |
4237 HWND_TOP, | |
4238 id, | |
4239 NULL, | |
4240 NULL); | |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
4241 HENUM henum = WinBeginEnumWindows(tmp); |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
4242 HWND child; |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
4243 |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
4244 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
|
4245 { |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
4246 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
|
4247 moreblah->oldproc = WinSubclassWindow(child, _comboentryproc); |
180
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
4248 WinSetWindowPtr(child, QWP_USER, moreblah); |
159
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
4249 dw_window_set_color(child, DW_CLR_BLACK, DW_CLR_WHITE); |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
4250 } |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
4251 WinEndEnumWindows(henum); |
40
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
4252 blah->oldproc = WinSubclassWindow(tmp, _comboproc); |
3 | 4253 WinSetWindowPtr(tmp, QWP_USER, blah); |
180
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
4254 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
|
4255 dw_window_set_color(tmp, DW_CLR_BLACK, DW_CLR_WHITE); |
3 | 4256 return tmp; |
4257 } | |
4258 | |
4259 /* | |
4260 * Create a new button window (widget) to be packed. | |
4261 * Parameters: | |
4262 * 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
|
4263 * id: An ID to be used with dw_window_from_id() or 0L. |
3 | 4264 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
4265 HWND API dw_button_new(char *text, ULONG id) |
3 | 4266 { |
90
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
4267 BubbleButton *bubble = calloc(sizeof(BubbleButton), 1); |
3 | 4268 |
4269 HWND tmp = WinCreateWindow(HWND_OBJECT, | |
4270 WC_BUTTON, | |
4271 text, | |
4272 WS_VISIBLE, | |
4273 0,0,2000,1000, | |
4274 NULLHANDLE, | |
4275 HWND_TOP, | |
4276 id, | |
4277 NULL, | |
4278 NULL); | |
4279 | |
4280 bubble->id = id; | |
4281 bubble->bubbletext[0] = '\0'; | |
4282 bubble->pOldProc = WinSubclassWindow(tmp, _BtProc); | |
4283 | |
4284 WinSetWindowPtr(tmp, QWP_USER, bubble); | |
4285 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
|
4286 dw_window_set_color(tmp, DW_CLR_BLACK, DW_CLR_PALEGRAY); |
3 | 4287 return tmp; |
4288 } | |
4289 | |
4290 /* Function: GenResIDStr | |
4291 ** Abstract: Generate string '#nnnn' for a given ID for using with Button | |
4292 ** controls | |
4293 */ | |
4294 | |
4295 void _GenResIDStr(CHAR *buff, ULONG ulID) | |
4296 { | |
4297 char *str; | |
4298 int slen = 0; | |
4299 | |
4300 *buff++ = '#'; | |
4301 | |
4302 str = buff; | |
4303 | |
4304 do | |
4305 { | |
4306 *str++ = (ulID % 10) + '0'; | |
4307 ulID /= 10; | |
4308 slen++; | |
4309 } | |
4310 while(ulID); | |
4311 | |
4312 *str-- = 0; | |
4313 | |
4314 for(; str > buff; str--, buff++) | |
4315 { | |
4316 *buff ^= *str; | |
4317 *str ^= *buff; | |
4318 *buff ^= *str; | |
4319 } | |
4320 } | |
4321 | |
4322 | |
4323 /* | |
4324 * Create a new bitmap button window (widget) to be packed. | |
4325 * Parameters: | |
4326 * text: Bubble help text to be displayed. | |
4327 * id: An ID of a bitmap in the resource file. | |
4328 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
4329 HWND API dw_bitmapbutton_new(char *text, ULONG id) |
3 | 4330 { |
4331 char idbuf[256]; | |
4332 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
|
4333 BubbleButton *bubble = calloc(sizeof(BubbleButton), 1); |
3 | 4334 |
4335 _GenResIDStr(idbuf, id); | |
4336 | |
4337 tmp = WinCreateWindow(HWND_OBJECT, | |
4338 WC_BUTTON, | |
4339 idbuf, | |
4340 WS_VISIBLE | BS_PUSHBUTTON | | |
4341 BS_BITMAP | BS_AUTOSIZE | | |
4342 BS_NOPOINTERFOCUS, | |
4343 0,0,2000,1000, | |
4344 NULLHANDLE, | |
4345 HWND_TOP, | |
4346 id, | |
4347 NULL, | |
4348 NULL); | |
4349 | |
4350 bubble->id = id; | |
4351 strncpy(bubble->bubbletext, text, BUBBLE_HELP_MAX - 1); | |
4352 bubble->bubbletext[BUBBLE_HELP_MAX - 1] = '\0'; | |
4353 bubble->pOldProc = WinSubclassWindow(tmp, _BtProc); | |
4354 | |
4355 WinSetWindowPtr(tmp, QWP_USER, bubble); | |
4356 return tmp; | |
4357 } | |
4358 | |
4359 /* | |
278
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4360 * 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
|
4361 * Parameters: |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4362 * 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
|
4363 * 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
|
4364 * 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
|
4365 * 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
|
4366 * (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
|
4367 */ |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4368 HWND dw_bitmapbutton_new_from_file(char *text, unsigned long id, char filename) |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4369 { |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4370 /* TODO: Actually get it to draw 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
|
4371 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
|
4372 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
|
4373 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
|
4374 "", |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4375 WS_VISIBLE | BS_PUSHBUTTON | |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4376 BS_BITMAP | BS_AUTOSIZE | |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4377 BS_NOPOINTERFOCUS, |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4378 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
|
4379 NULLHANDLE, |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4380 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
|
4381 id, |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4382 NULL, |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4383 NULL); |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4384 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4385 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
|
4386 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
|
4387 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
|
4388 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
|
4389 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4390 WinSetWindowPtr(tmp, QWP_USER, bubble); |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4391 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
|
4392 } |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4393 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4394 /* |
3 | 4395 * Create a new spinbutton window (widget) to be packed. |
4396 * Parameters: | |
4397 * 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
|
4398 * id: An ID to be used with dw_window_from_id() or 0L. |
3 | 4399 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
4400 HWND API dw_spinbutton_new(char *text, ULONG id) |
3 | 4401 { |
90
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
4402 WindowData *blah = calloc(sizeof(WindowData), 1); |
3 | 4403 HWND tmp = WinCreateWindow(HWND_OBJECT, |
4404 WC_SPINBUTTON, | |
4405 text, | |
4406 WS_VISIBLE | SPBS_MASTER, | |
4407 0,0,2000,1000, | |
4408 NULLHANDLE, | |
4409 HWND_TOP, | |
4410 id, | |
4411 NULL, | |
4412 NULL); | |
156 | 4413 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
|
4414 blah->oldproc = WinSubclassWindow(tmp, _entryproc); |
3 | 4415 WinSetWindowPtr(tmp, QWP_USER, blah); |
156 | 4416 blah = calloc(sizeof(WindowData), 1); |
4417 blah->oldproc = WinSubclassWindow(entry, _spinentryproc); | |
4418 WinSetWindowPtr(entry, QWP_USER, blah); | |
180
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
4419 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
|
4420 dw_window_set_color(entry, DW_CLR_BLACK, DW_CLR_WHITE); |
3 | 4421 return tmp; |
4422 } | |
4423 | |
4424 /* | |
4425 * Create a new radiobutton window (widget) to be packed. | |
4426 * Parameters: | |
4427 * 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
|
4428 * id: An ID to be used with dw_window_from_id() or 0L. |
3 | 4429 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
4430 HWND API dw_radiobutton_new(char *text, ULONG id) |
3 | 4431 { |
90
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
4432 WindowData *blah = calloc(sizeof(WindowData), 1); |
3 | 4433 HWND tmp = WinCreateWindow(HWND_OBJECT, |
4434 WC_BUTTON, | |
4435 text, | |
4436 WS_VISIBLE | | |
4437 BS_AUTORADIOBUTTON, | |
4438 0,0,2000,1000, | |
4439 NULLHANDLE, | |
4440 HWND_TOP, | |
4441 id, | |
4442 NULL, | |
4443 NULL); | |
180
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
4444 blah->oldproc = WinSubclassWindow(tmp, _entryproc); |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
4445 WinSetWindowPtr(tmp, QWP_USER, blah); |
3 | 4446 dw_window_set_font(tmp, DefaultFont); |
4447 dw_window_set_color(tmp, DW_CLR_BLACK, DW_CLR_PALEGRAY); | |
4448 return tmp; | |
4449 } | |
4450 | |
94
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
4451 |
3 | 4452 /* |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
4453 * 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
|
4454 * Parameters: |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
4455 * 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
|
4456 * 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
|
4457 * 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
|
4458 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
4459 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
|
4460 { |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
4461 WindowData *blah = calloc(1, sizeof(WindowData)); |
172
0fc45e386376
Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
171
diff
changeset
|
4462 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
|
4463 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
|
4464 |
172
0fc45e386376
Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
171
diff
changeset
|
4465 sldcData.cbSize = sizeof(SLDCDATA); |
0fc45e386376
Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
171
diff
changeset
|
4466 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
|
4467 |
178
770da0fc4c0d
Fixed a small regression from the watcom changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
175
diff
changeset
|
4468 tmp = WinCreateWindow(HWND_OBJECT, |
770da0fc4c0d
Fixed a small regression from the watcom changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
175
diff
changeset
|
4469 WC_SLIDER, |
770da0fc4c0d
Fixed a small regression from the watcom changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
175
diff
changeset
|
4470 "", |
770da0fc4c0d
Fixed a small regression from the watcom changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
175
diff
changeset
|
4471 WS_VISIBLE | SLS_SNAPTOINCREMENT | |
770da0fc4c0d
Fixed a small regression from the watcom changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
175
diff
changeset
|
4472 (vertical ? SLS_VERTICAL : SLS_HORIZONTAL), |
770da0fc4c0d
Fixed a small regression from the watcom changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
175
diff
changeset
|
4473 0,0,2000,1000, |
770da0fc4c0d
Fixed a small regression from the watcom changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
175
diff
changeset
|
4474 NULLHANDLE, |
770da0fc4c0d
Fixed a small regression from the watcom changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
175
diff
changeset
|
4475 HWND_TOP, |
770da0fc4c0d
Fixed a small regression from the watcom changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
175
diff
changeset
|
4476 id, |
770da0fc4c0d
Fixed a small regression from the watcom changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
175
diff
changeset
|
4477 &sldcData, |
770da0fc4c0d
Fixed a small regression from the watcom changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
175
diff
changeset
|
4478 NULL); |
770da0fc4c0d
Fixed a small regression from the watcom changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
175
diff
changeset
|
4479 |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
4480 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
|
4481 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
|
4482 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
|
4483 } |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
4484 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
4485 /* |
195
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
4486 * 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
|
4487 * Parameters: |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
4488 * 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
|
4489 * 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
|
4490 * 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
|
4491 */ |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
4492 HWND API dw_scrollbar_new(int vertical, int increments, ULONG id) |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
4493 { |
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
|
4494 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
|
4495 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
|
4496 "", |
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
|
4497 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
|
4498 (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
|
4499 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
|
4500 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
|
4501 HWND_TOP, |
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
|
4502 id, |
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
|
4503 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
|
4504 NULL); |
195
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
4505 } |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
4506 |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
4507 /* |
33
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
4508 * Create a new percent bar window (widget) to be packed. |
3 | 4509 * 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
|
4510 * id: An ID to be used with dw_window_from_id() or 0L. |
3 | 4511 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
4512 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
|
4513 { |
94
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
4514 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
|
4515 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
|
4516 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
|
4517 "", |
62
2be5174bdb5d
Sync with latest DW code. Tab and RGB fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
4518 WS_VISIBLE | SLS_READONLY |
2be5174bdb5d
Sync with latest DW code. Tab and RGB fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
4519 | 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
|
4520 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
|
4521 NULLHANDLE, |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
4522 HWND_TOP, |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
4523 id, |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
4524 NULL, |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
4525 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
|
4526 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
|
4527 WinSetWindowPtr(tmp, QWP_USER, blah); |
180
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
4528 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
|
4529 return tmp; |
3 | 4530 } |
4531 | |
4532 /* | |
4533 * Create a new checkbox window (widget) to be packed. | |
4534 * Parameters: | |
4535 * 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
|
4536 * id: An ID to be used with dw_window_from_id() or 0L. |
3 | 4537 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
4538 HWND API dw_checkbox_new(char *text, ULONG id) |
3 | 4539 { |
90
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
4540 BubbleButton *bubble = calloc(sizeof(BubbleButton), 1); |
3 | 4541 HWND tmp = WinCreateWindow(HWND_OBJECT, |
4542 WC_BUTTON, | |
4543 text, | |
4544 WS_VISIBLE | BS_AUTOCHECKBOX, | |
4545 0,0,2000,1000, | |
4546 NULLHANDLE, | |
4547 HWND_TOP, | |
4548 id, | |
4549 NULL, | |
4550 NULL); | |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
4551 bubble->id = id; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
4552 bubble->bubbletext[0] = '\0'; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
4553 bubble->pOldProc = WinSubclassWindow(tmp, _BtProc); |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
4554 WinSetWindowPtr(tmp, QWP_USER, bubble); |
180
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
4555 dw_window_set_font(tmp, DefaultFont); |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
4556 dw_window_set_color(tmp, DW_CLR_BLACK, DW_CLR_PALEGRAY); |
3 | 4557 return tmp; |
4558 } | |
4559 | |
4560 /* | |
4561 * Create a new listbox window (widget) to be packed. | |
4562 * 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
|
4563 * id: An ID to be used with dw_window_from_id() or 0L. |
3 | 4564 * multi: Multiple select TRUE or FALSE. |
4565 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
4566 HWND API dw_listbox_new(ULONG id, int multi) |
3 | 4567 { |
90
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
4568 WindowData *blah = calloc(sizeof(WindowData), 1); |
3 | 4569 HWND tmp = WinCreateWindow(HWND_OBJECT, |
4570 WC_LISTBOX, | |
4571 NULL, | |
4572 WS_VISIBLE | LS_NOADJUSTPOS | | |
4573 (multi ? LS_MULTIPLESEL : 0), | |
4574 0,0,2000,1000, | |
4575 NULLHANDLE, | |
4576 HWND_TOP, | |
4577 id, | |
4578 NULL, | |
4579 NULL); | |
180
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
4580 blah->oldproc = WinSubclassWindow(tmp, _entryproc); |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
4581 WinSetWindowPtr(tmp, QWP_USER, blah); |
3 | 4582 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
|
4583 dw_window_set_color(tmp, DW_CLR_BLACK, DW_CLR_WHITE); |
3 | 4584 return tmp; |
4585 } | |
4586 | |
4587 /* | |
4588 * Sets the icon used for a given window. | |
4589 * Parameters: | |
4590 * handle: Handle to the window. | |
4591 * id: An ID to be used to specify the icon. | |
4592 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
4593 void API dw_window_set_icon(HWND handle, ULONG id) |
3 | 4594 { |
4595 HPOINTER icon; | |
4596 | |
4597 icon = WinLoadPointer(HWND_DESKTOP,NULLHANDLE,id); | |
4598 WinSendMsg(handle, WM_SETICON, (MPARAM)icon, 0); | |
4599 } | |
4600 | |
278
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4601 /* 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
|
4602 * 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
|
4603 */ |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4604 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
|
4605 { |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4606 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
|
4607 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
|
4608 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
|
4609 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
|
4610 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
|
4611 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
|
4612 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
|
4613 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
|
4614 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
|
4615 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
|
4616 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
|
4617 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4618 /* 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
|
4619 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
|
4620 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
|
4621 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
|
4622 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
|
4623 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
|
4624 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4625 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
|
4626 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
|
4627 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4628 /* 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
|
4629 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
|
4630 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
|
4631 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4632 /* 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
|
4633 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
|
4634 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
|
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 /* 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
|
4637 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
|
4638 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
|
4639 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4640 /* 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
|
4641 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
|
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 /* 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
|
4644 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
|
4645 (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
|
4646 { |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4647 /* 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
|
4648 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
|
4649 /* 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
|
4650 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
|
4651 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
|
4652 } |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4653 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4654 /* 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
|
4655 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
|
4656 { |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4657 /* 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
|
4658 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
|
4659 } |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4660 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4661 /* 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
|
4662 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
|
4663 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4664 /* 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
|
4665 /* 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
|
4666 if(pBitmapInfoHeader->cbFix == sizeof(BITMAPINFOHEADER)) |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4667 ScanLines = (ULONG)((PBITMAPINFOHEADER)pBitmapInfoHeader)->cy; |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4668 else |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4669 ScanLines = pBitmapInfoHeader->cy; |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4670 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4671 /* 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
|
4672 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
|
4673 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4674 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
|
4675 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
|
4676 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4677 *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
|
4678 *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
|
4679 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4680 *width = pBitmapInfoHeader->cx; *height = pBitmapInfoHeader->cy; |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4681 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4682 /* 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
|
4683 *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
|
4684 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4685 /* 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
|
4686 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
|
4687 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4688 /* 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
|
4689 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
|
4690 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
|
4691 (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
|
4692 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4693 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
|
4694 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4695 /* 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
|
4696 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
|
4697 /* 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
|
4698 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
|
4699 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
|
4700 } |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4701 |
3 | 4702 /* |
4703 * Sets the bitmap used for a given static window. | |
4704 * Parameters: | |
4705 * 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
|
4706 * 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
|
4707 * (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
|
4708 * 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
|
4709 * 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
|
4710 * 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
|
4711 */ |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4712 void API dw_window_set_bitmap(HWND handle, unsigned long id, char *filename) |
3 | 4713 { |
4714 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
|
4715 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
|
4716 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4717 /* 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
|
4718 _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
|
4719 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4720 /* 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
|
4721 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
|
4722 { |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4723 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
|
4724 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4725 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
|
4726 } |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4727 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
|
4728 { |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4729 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
|
4730 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
|
4731 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
|
4732 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4733 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
|
4734 return; |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4735 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4736 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
|
4737 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4738 /* 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
|
4739 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
|
4740 { |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4741 /* 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
|
4742 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
|
4743 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
|
4744 return; |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4745 } |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4746 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4747 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
|
4748 return; |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4749 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4750 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
|
4751 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
|
4752 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
|
4753 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
|
4754 } |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4755 else |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4756 return; |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4757 |
3 | 4758 WinSetWindowBits(handle,QWL_STYLE,SS_BITMAP,SS_BITMAP | 0x7f); |
4759 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
|
4760 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
|
4761 WinReleasePS(hps); |
235
69f2a59ec7d0
Delete associated bitmaps when destroying windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
230
diff
changeset
|
4762 dw_window_set_data(handle, "_dw_bitmap", (void *)hbm); |
3 | 4763 } |
4764 | |
4765 /* | |
4766 * Sets the text used for a given window. | |
4767 * Parameters: | |
4768 * handle: Handle to the window. | |
4769 * text: The text associsated with a given window. | |
4770 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
4771 void API dw_window_set_text(HWND handle, char *text) |
3 | 4772 { |
4773 WinSetWindowText(handle, text); | |
4774 } | |
4775 | |
4776 /* | |
4777 * Gets the text used for a given window. | |
4778 * Parameters: | |
4779 * handle: Handle to the window. | |
4780 * Returns: | |
4781 * text: The text associsated with a given window. | |
4782 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
4783 char * API dw_window_get_text(HWND handle) |
3 | 4784 { |
172
0fc45e386376
Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
171
diff
changeset
|
4785 int len = WinQueryWindowTextLength(handle); |
0fc45e386376
Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
171
diff
changeset
|
4786 char *tempbuf = calloc(1, len + 2); |
0fc45e386376
Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
171
diff
changeset
|
4787 |
0fc45e386376
Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
171
diff
changeset
|
4788 WinQueryWindowText(handle, len + 1, tempbuf); |
0fc45e386376
Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
171
diff
changeset
|
4789 |
0fc45e386376
Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
171
diff
changeset
|
4790 return tempbuf; |
3 | 4791 } |
4792 | |
4793 /* | |
4794 * Disables given window (widget). | |
4795 * Parameters: | |
4796 * handle: Handle to the window. | |
4797 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
4798 void API dw_window_disable(HWND handle) |
3 | 4799 { |
159
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
4800 char tmpbuf[100]; |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
4801 |
166
fb2987817924
Optimize disabling of controls... if already disabled do nothing.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
161
diff
changeset
|
4802 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
|
4803 return; |
fb2987817924
Optimize disabling of controls... if already disabled do nothing.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
161
diff
changeset
|
4804 |
159
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
4805 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
|
4806 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
|
4807 |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
4808 if(tmpbuf[0] == '#') |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
4809 { |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
4810 int val = atoi(&tmpbuf[1]); |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
4811 HWND hwnd; |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
4812 |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
4813 switch(val) |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
4814 { |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
4815 case 2: |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
4816 case 6: |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
4817 case 10: |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
4818 case 32: |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
4819 case 7: |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
4820 hwnd = _find_entryfield(handle); |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
4821 _dw_window_set_color(hwnd ? hwnd : handle, DW_CLR_BLACK, DW_CLR_PALEGRAY); |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
4822 dw_signal_connect(hwnd ? hwnd : handle, "key_press_event", 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
|
4823 if(val == 2) |
76bc6b4e8b79
Don't allow comboboxes to drop down when disabled.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
159
diff
changeset
|
4824 dw_signal_connect(handle, "button_press_event", 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
|
4825 if(hwnd) |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
4826 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
|
4827 return; |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
4828 case 3: |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
4829 _dw_window_set_color(handle, DW_CLR_DARKGRAY, DW_CLR_PALEGRAY); |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
4830 dw_signal_connect(handle, "key_press_event", DW_SIGNAL_FUNC(_null_key), (void *)100); |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
4831 dw_signal_connect(handle, "button_press_event", DW_SIGNAL_FUNC(_null_key), (void *)100); |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
4832 return; |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
4833 } |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
4834 } |
3 | 4835 WinEnableWindow(handle, FALSE); |
4836 } | |
4837 | |
4838 /* | |
4839 * Enables given window (widget). | |
4840 * Parameters: | |
4841 * handle: Handle to the window. | |
4842 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
4843 void API dw_window_enable(HWND handle) |
3 | 4844 { |
159
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
4845 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
|
4846 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
|
4847 HWND hwnd = _find_entryfield(handle); |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
4848 |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
4849 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
|
4850 if(hwnd) |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
4851 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
|
4852 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
|
4853 _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
|
4854 dw_signal_disconnect_by_data(handle, (void *)100); |
3 | 4855 WinEnableWindow(handle, TRUE); |
4856 } | |
4857 | |
4858 /* | |
4859 * Gets the child window handle with specified ID. | |
4860 * Parameters: | |
4861 * handle: Handle to the parent window. | |
4862 * id: Integer ID of the child. | |
4863 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
4864 HWND API dw_window_from_id(HWND handle, int id) |
3 | 4865 { |
4866 HENUM henum; | |
4867 HWND child; | |
4868 char tmpbuf[100]; | |
4869 | |
4870 henum = WinBeginEnumWindows(handle); | |
4871 while((child = WinGetNextWindow(henum)) != NULLHANDLE) | |
4872 { | |
4873 int windowid = WinQueryWindowUShort(child, QWS_ID); | |
4874 HWND found; | |
4875 | |
4876 WinQueryClassName(child, 99, tmpbuf); | |
4877 | |
4878 /* 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
|
4879 if(strncmp(tmpbuf, "#1", 3)==0) |
3 | 4880 if((found = dw_window_from_id(child, id)) != NULLHANDLE) |
4881 return found; | |
4882 | |
4883 if(windowid && windowid == id) | |
4884 { | |
4885 WinEndEnumWindows(henum); | |
4886 return child; | |
4887 } | |
4888 } | |
4889 WinEndEnumWindows(henum); | |
4890 return NULLHANDLE; | |
4891 } | |
4892 | |
4893 /* | |
4894 * Pack windows (widgets) into a box from the end (or bottom). | |
4895 * Parameters: | |
4896 * box: Window handle of the box to be packed into. | |
4897 * item: Window handle of the item to be back. | |
4898 * width: Width in pixels of the item or -1 to be self determined. | |
4899 * height: Height in pixels of the item or -1 to be self determined. | |
4900 * hsize: TRUE if the window (widget) should expand horizontally to fill space given. | |
4901 * vsize: TRUE if the window (widget) should expand vertically to fill space given. | |
4902 * pad: Number of pixels of padding around the item. | |
4903 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
4904 void API dw_box_pack_end(HWND box, HWND item, int width, int height, int hsize, int vsize, int pad) |
3 | 4905 { |
4906 Box *thisbox; | |
4907 | |
4908 if(WinWindowFromID(box, FID_CLIENT)) | |
4909 { | |
4910 box = WinWindowFromID(box, FID_CLIENT); | |
4911 thisbox = WinQueryWindowPtr(box, QWP_USER); | |
4912 } | |
4913 else | |
4914 thisbox = WinQueryWindowPtr(box, QWP_USER); | |
4915 if(thisbox) | |
4916 { | |
4917 if(thisbox->type == BOXHORZ) | |
4918 dw_box_pack_start_stub(box, item, width, height, hsize, vsize, pad); | |
4919 else | |
4920 dw_box_pack_end_stub(box, item, width, height, hsize, vsize, pad); | |
4921 } | |
4922 } | |
4923 | |
4924 void dw_box_pack_end_stub(HWND box, HWND item, int width, int height, int hsize, int vsize, int pad) | |
4925 { | |
4926 Box *thisbox; | |
4927 | |
4928 if(WinWindowFromID(box, FID_CLIENT)) | |
4929 { | |
4930 box = WinWindowFromID(box, FID_CLIENT); | |
4931 thisbox = WinQueryWindowPtr(box, QWP_USER); | |
4932 hsize = TRUE; | |
4933 vsize = TRUE; | |
4934 } | |
4935 else | |
4936 thisbox = WinQueryWindowPtr(box, QWP_USER); | |
4937 if(!thisbox) | |
4938 { | |
4939 box = WinWindowFromID(box, FID_CLIENT); | |
4940 if(box) | |
4941 { | |
4942 thisbox = WinQueryWindowPtr(box, QWP_USER); | |
4943 hsize = TRUE; | |
4944 vsize = TRUE; | |
4945 } | |
4946 } | |
4947 if(thisbox) | |
4948 { | |
4949 int z; | |
4950 Item *tmpitem, *thisitem = thisbox->items; | |
4951 char tmpbuf[100]; | |
4952 | |
4953 tmpitem = malloc(sizeof(Item)*(thisbox->count+1)); | |
4954 | |
4955 for(z=0;z<thisbox->count;z++) | |
4956 { | |
4957 tmpitem[z] = thisitem[z]; | |
4958 } | |
4959 | |
4960 WinQueryClassName(item, 99, tmpbuf); | |
4961 | |
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
|
4962 if(strncmp(tmpbuf, "#1", 3)==0) |
3 | 4963 tmpitem[thisbox->count].type = TYPEBOX; |
4964 else | |
4965 tmpitem[thisbox->count].type = TYPEITEM; | |
4966 | |
4967 tmpitem[thisbox->count].hwnd = item; | |
4968 tmpitem[thisbox->count].origwidth = tmpitem[thisbox->count].width = width; | |
4969 tmpitem[thisbox->count].origheight = tmpitem[thisbox->count].height = height; | |
4970 tmpitem[thisbox->count].pad = pad; | |
4971 if(hsize) | |
4972 tmpitem[thisbox->count].hsize = SIZEEXPAND; | |
4973 else | |
4974 tmpitem[thisbox->count].hsize = SIZESTATIC; | |
4975 | |
4976 if(vsize) | |
4977 tmpitem[thisbox->count].vsize = SIZEEXPAND; | |
4978 else | |
4979 tmpitem[thisbox->count].vsize = SIZESTATIC; | |
4980 | |
4981 thisbox->items = tmpitem; | |
4982 | |
4983 if(thisbox->count) | |
4984 free(thisitem); | |
4985 | |
4986 thisbox->count++; | |
4987 | |
37
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
4988 /* Don't set the ownership if it's an entryfield or spinbutton */ |
3 | 4989 WinQueryClassName(item, 99, tmpbuf); |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
4990 if(strncmp(tmpbuf, "#6", 3)!=0 && strncmp(tmpbuf, "#32", 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
|
4991 WinSetOwner(item, box); |
3 | 4992 WinSetParent(item, box, FALSE); |
4993 } | |
4994 } | |
4995 | |
4996 /* | |
4997 * Sets the size of a given window (widget). | |
4998 * Parameters: | |
4999 * handle: Window (widget) handle. | |
5000 * width: New width in pixels. | |
5001 * height: New height in pixels. | |
5002 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5003 void API dw_window_set_usize(HWND handle, ULONG width, ULONG height) |
3 | 5004 { |
5005 WinSetWindowPos(handle, NULLHANDLE, 0, 0, width, height, SWP_SHOW | SWP_SIZE); | |
5006 } | |
5007 | |
5008 /* | |
5009 * Returns the width of the screen. | |
5010 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5011 int API dw_screen_width(void) |
3 | 5012 { |
5013 return WinQuerySysValue(HWND_DESKTOP,SV_CXSCREEN); | |
5014 } | |
5015 | |
5016 /* | |
5017 * Returns the height of the screen. | |
5018 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5019 int API dw_screen_height(void) |
3 | 5020 { |
5021 return WinQuerySysValue(HWND_DESKTOP,SV_CYSCREEN); | |
5022 } | |
5023 | |
5024 /* This should return the current color depth */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5025 unsigned long API dw_color_depth(void) |
3 | 5026 { |
5027 HDC hdc = WinOpenWindowDC(HWND_DESKTOP); | |
5028 long colors; | |
5029 | |
5030 DevQueryCaps(hdc, CAPS_COLOR_BITCOUNT, 1, &colors); | |
5031 DevCloseDC(hdc); | |
5032 return colors; | |
5033 } | |
5034 | |
5035 | |
5036 /* | |
5037 * Sets the position of a given window (widget). | |
5038 * Parameters: | |
5039 * handle: Window (widget) handle. | |
5040 * x: X location from the bottom left. | |
5041 * y: Y location from the bottom left. | |
5042 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5043 void API dw_window_set_pos(HWND handle, ULONG x, ULONG y) |
3 | 5044 { |
5045 int myy = _get_frame_height(handle) - (y + _get_height(handle)); | |
5046 | |
5047 WinSetWindowPos(handle, NULLHANDLE, x, myy, 0, 0, SWP_MOVE); | |
5048 } | |
5049 | |
5050 /* | |
5051 * Sets the position and size of a given window (widget). | |
5052 * Parameters: | |
5053 * handle: Window (widget) handle. | |
5054 * x: X location from the bottom left. | |
5055 * y: Y location from the bottom left. | |
5056 * width: Width of the widget. | |
5057 * height: Height of the widget. | |
5058 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5059 void API dw_window_set_pos_size(HWND handle, ULONG x, ULONG y, ULONG width, ULONG height) |
3 | 5060 { |
5061 int myy = _get_frame_height(handle) - (y + height); | |
5062 | |
5063 WinSetWindowPos(handle, NULLHANDLE, x, myy, width, height, SWP_MOVE | SWP_SIZE | SWP_SHOW); | |
5064 } | |
5065 | |
5066 /* | |
5067 * Gets the position and size of a given window (widget). | |
5068 * Parameters: | |
5069 * handle: Window (widget) handle. | |
5070 * x: X location from the bottom left. | |
5071 * y: Y location from the bottom left. | |
5072 * width: Width of the widget. | |
5073 * height: Height of the widget. | |
5074 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5075 void API dw_window_get_pos_size(HWND handle, ULONG *x, ULONG *y, ULONG *width, ULONG *height) |
3 | 5076 { |
5077 SWP swp; | |
5078 WinQueryWindowPos(handle, &swp); | |
5079 if(x) | |
5080 *x = swp.x; | |
5081 if(y) | |
5082 *y = _get_frame_height(handle) - (swp.y + swp.cy); | |
5083 if(width) | |
5084 *width = swp.cx; | |
5085 if(height) | |
5086 *height = swp.cy; | |
5087 } | |
5088 | |
5089 /* | |
5090 * Sets the style of a given window (widget). | |
5091 * Parameters: | |
5092 * handle: Window (widget) handle. | |
5093 * width: New width in pixels. | |
5094 * height: New height in pixels. | |
5095 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5096 void API dw_window_set_style(HWND handle, ULONG style, ULONG mask) |
3 | 5097 { |
5098 WinSetWindowBits(handle, QWL_STYLE, style, mask); | |
5099 } | |
5100 | |
5101 /* | |
5102 * Adds a new page to specified notebook. | |
5103 * Parameters: | |
5104 * handle: Window (widget) handle. | |
5105 * flags: Any additional page creation flags. | |
5106 * front: If TRUE page is added at the beginning. | |
5107 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5108 unsigned long API dw_notebook_page_new(HWND handle, ULONG flags, int front) |
3 | 5109 { |
5110 if(front) | |
5111 return (ULONG)WinSendMsg(handle, BKM_INSERTPAGE, 0L, | |
5112 MPFROM2SHORT((BKA_STATUSTEXTON | BKA_AUTOPAGESIZE | BKA_MAJOR | flags), BKA_FIRST)); | |
5113 return (ULONG)WinSendMsg(handle, BKM_INSERTPAGE, 0L, | |
5114 MPFROM2SHORT((BKA_STATUSTEXTON | BKA_AUTOPAGESIZE | BKA_MAJOR | flags), BKA_LAST)); | |
5115 } | |
5116 | |
5117 /* | |
5118 * Remove a page from a notebook. | |
5119 * Parameters: | |
5120 * handle: Handle to the notebook widget. | |
5121 * pageid: ID of the page to be destroyed. | |
5122 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5123 void API dw_notebook_page_destroy(HWND handle, unsigned int pageid) |
3 | 5124 { |
5125 WinSendMsg(handle, BKM_DELETEPAGE, | |
5126 MPFROMLONG(pageid), (MPARAM)BKA_SINGLE); | |
5127 } | |
5128 | |
5129 /* | |
5130 * Queries the currently visible page ID. | |
5131 * Parameters: | |
5132 * handle: Handle to the notebook widget. | |
5133 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5134 unsigned int API dw_notebook_page_query(HWND handle) |
3 | 5135 { |
5136 return (int)WinSendMsg(handle, BKM_QUERYPAGEID,0L, MPFROM2SHORT(BKA_TOP, BKA_MAJOR)); | |
5137 } | |
5138 | |
5139 /* | |
5140 * Sets the currently visibale page ID. | |
5141 * Parameters: | |
5142 * handle: Handle to the notebook widget. | |
5143 * pageid: ID of the page to be made visible. | |
5144 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5145 void API dw_notebook_page_set(HWND handle, unsigned int pageid) |
3 | 5146 { |
5147 WinSendMsg(handle, BKM_TURNTOPAGE, MPFROMLONG(pageid), 0L); | |
5148 } | |
5149 | |
5150 /* | |
5151 * Sets the text on the specified notebook tab. | |
5152 * Parameters: | |
5153 * handle: Notebook handle. | |
5154 * pageid: Page ID of the tab to set. | |
5155 * text: Pointer to the text to set. | |
5156 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5157 void API dw_notebook_page_set_text(HWND handle, ULONG pageid, char *text) |
3 | 5158 { |
5159 WinSendMsg(handle, BKM_SETTABTEXT, | |
5160 MPFROMLONG(pageid), MPFROMP(text)); | |
5161 } | |
5162 | |
5163 /* | |
5164 * Sets the text on the specified notebook tab status area. | |
5165 * Parameters: | |
5166 * handle: Notebook handle. | |
5167 * pageid: Page ID of the tab to set. | |
5168 * text: Pointer to the text to set. | |
5169 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5170 void API dw_notebook_page_set_status_text(HWND handle, ULONG pageid, char *text) |
3 | 5171 { |
5172 WinSendMsg(handle, BKM_SETSTATUSLINETEXT, | |
5173 MPFROMLONG(pageid), MPFROMP(text)); | |
5174 } | |
5175 | |
5176 /* | |
5177 * Packs the specified box into the notebook page. | |
5178 * Parameters: | |
5179 * handle: Handle to the notebook to be packed. | |
5180 * pageid: Page ID in the notebook which is being packed. | |
5181 * page: Box handle to be packed. | |
5182 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5183 void API dw_notebook_pack(HWND handle, ULONG pageid, HWND page) |
3 | 5184 { |
5185 HWND tmpbox = dw_box_new(BOXVERT, 0); | |
5186 | |
5187 dw_box_pack_start(tmpbox, page, 0, 0, TRUE, TRUE, 0); | |
5188 WinSubclassWindow(tmpbox, _wndproc); | |
5189 WinSendMsg(handle, BKM_SETPAGEWINDOWHWND, | |
5190 MPFROMLONG(pageid), MPFROMHWND(tmpbox)); | |
5191 } | |
5192 | |
5193 /* | |
5194 * Appends the specified text to the listbox's (or combobox) entry list. | |
5195 * Parameters: | |
5196 * handle: Handle to the listbox to be appended to. | |
5197 * text: Text to append into listbox. | |
5198 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5199 void API dw_listbox_append(HWND handle, char *text) |
3 | 5200 { |
5201 WinSendMsg(handle, | |
5202 LM_INSERTITEM, | |
5203 MPFROMSHORT(LIT_END), | |
5204 MPFROMP(text)); | |
5205 } | |
5206 | |
5207 /* | |
5208 * Clears the listbox's (or combobox) list of all entries. | |
5209 * Parameters: | |
5210 * handle: Handle to the listbox to be cleared. | |
5211 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5212 void API dw_listbox_clear(HWND handle) |
3 | 5213 { |
5214 WinSendMsg(handle, | |
5215 LM_DELETEALL, 0L, 0L); | |
5216 } | |
5217 | |
5218 /* | |
5219 * Returns the listbox's item count. | |
5220 * Parameters: | |
5221 * handle: Handle to the listbox to be cleared. | |
5222 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5223 int API dw_listbox_count(HWND handle) |
3 | 5224 { |
5225 return (int)WinSendMsg(handle, | |
5226 LM_QUERYITEMCOUNT,0L, 0L); | |
5227 } | |
5228 | |
5229 /* | |
5230 * Sets the topmost item in the viewport. | |
5231 * Parameters: | |
5232 * handle: Handle to the listbox to be cleared. | |
5233 * top: Index to the top item. | |
5234 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5235 void API dw_listbox_set_top(HWND handle, int top) |
3 | 5236 { |
5237 WinSendMsg(handle, | |
5238 LM_SETTOPINDEX, | |
5239 MPFROMSHORT(top), | |
5240 0L); | |
5241 } | |
5242 | |
5243 /* | |
5244 * Copies the given index item's text into buffer. | |
5245 * Parameters: | |
5246 * handle: Handle to the listbox to be queried. | |
5247 * index: Index into the list to be queried. | |
5248 * buffer: Buffer where text will be copied. | |
5249 * length: Length of the buffer (including NULL). | |
5250 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5251 void API dw_listbox_query_text(HWND handle, unsigned int index, char *buffer, unsigned int length) |
3 | 5252 { |
5253 WinSendMsg(handle, LM_QUERYITEMTEXT, MPFROM2SHORT(index, length), (MPARAM)buffer); | |
5254 } | |
5255 | |
5256 /* | |
5257 * Sets the text of a given listbox entry. | |
5258 * Parameters: | |
5259 * handle: Handle to the listbox to be queried. | |
5260 * index: Index into the list to be queried. | |
5261 * buffer: Buffer where text will be copied. | |
5262 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5263 void API dw_listbox_set_text(HWND handle, unsigned int index, char *buffer) |
3 | 5264 { |
5265 WinSendMsg(handle, LM_SETITEMTEXT, MPFROMSHORT(index), (MPARAM)buffer); | |
5266 } | |
5267 | |
5268 /* | |
5269 * Returns the index to the item in the list currently selected. | |
5270 * Parameters: | |
5271 * handle: Handle to the listbox to be queried. | |
5272 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5273 unsigned int API dw_listbox_selected(HWND handle) |
3 | 5274 { |
5275 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
|
5276 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
|
5277 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
|
5278 0); |
3 | 5279 } |
5280 | |
5281 /* | |
5282 * Returns the index to the current selected item or -1 when done. | |
5283 * Parameters: | |
5284 * handle: Handle to the listbox to be queried. | |
5285 * where: Either the previous return or -1 to restart. | |
5286 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5287 int API dw_listbox_selected_multi(HWND handle, int where) |
3 | 5288 { |
5289 int place = where; | |
5290 | |
5291 if(where == -1) | |
5292 place = LIT_FIRST; | |
5293 | |
5294 place = (int)WinSendMsg(handle, | |
5295 LM_QUERYSELECTION, | |
5296 MPFROMSHORT(place),0L); | |
5297 if(place == LIT_NONE) | |
5298 return -1; | |
5299 return place; | |
5300 } | |
5301 | |
5302 /* | |
5303 * Sets the selection state of a given index. | |
5304 * Parameters: | |
5305 * handle: Handle to the listbox to be set. | |
5306 * index: Item index. | |
5307 * state: TRUE if selected FALSE if unselected. | |
5308 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5309 void API dw_listbox_select(HWND handle, int index, int state) |
3 | 5310 { |
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
|
5311 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
|
5312 |
3 | 5313 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
|
5314 |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
5315 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
|
5316 |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
5317 /* 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
|
5318 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
|
5319 _run_event(handle, WM_CONTROL, MPFROM2SHORT(0, LN_SELECT), (MPARAM)handle); |
3 | 5320 } |
5321 | |
5322 /* | |
5323 * Deletes the item with given index from the list. | |
5324 * Parameters: | |
5325 * handle: Handle to the listbox to be set. | |
5326 * index: Item index. | |
5327 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5328 void API dw_listbox_delete(HWND handle, int index) |
3 | 5329 { |
5330 WinSendMsg(handle, LM_DELETEITEM, MPFROMSHORT(index), 0); | |
5331 } | |
5332 | |
5333 /* | |
5334 * Adds text to an MLE box and returns the current point. | |
5335 * Parameters: | |
5336 * handle: Handle to the MLE to be queried. | |
5337 * buffer: Text buffer to be imported. | |
5338 * startpoint: Point to start entering text. | |
5339 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5340 unsigned int API dw_mle_import(HWND handle, char *buffer, int startpoint) |
3 | 5341 { |
5342 unsigned long point = startpoint; | |
5343 PBYTE mlebuf; | |
5344 | |
5345 /* Work around 64K limit */ | |
5346 if(!DosAllocMem((PPVOID) &mlebuf, 65536, PAG_COMMIT | PAG_READ | PAG_WRITE | OBJ_TILE)) | |
5347 { | |
5348 int amount, len = strlen(buffer), written = 0; | |
5349 | |
5350 while(written < len) | |
5351 { | |
5352 if((len - written) > 65535) | |
5353 amount = 65535; | |
5354 else | |
5355 amount = len - written; | |
5356 | |
5357 memcpy(mlebuf, &buffer[written], amount); | |
5358 mlebuf[amount] = '\0'; | |
5359 | |
5360 WinSendMsg(handle, MLM_SETIMPORTEXPORT, MPFROMP(mlebuf), MPFROMLONG(amount+1)); | |
5361 WinSendMsg(handle, MLM_IMPORT, MPFROMP(&point), MPFROMLONG(amount + 1)); | |
5362 dw_mle_delete(handle, point, 1); | |
5363 | |
5364 written += amount; | |
5365 } | |
5366 DosFreeMem(mlebuf); | |
5367 } | |
5368 return point - 1; | |
5369 } | |
5370 | |
5371 /* | |
5372 * Grabs text from an MLE box. | |
5373 * Parameters: | |
5374 * handle: Handle to the MLE to be queried. | |
5375 * buffer: Text buffer to be exported. | |
5376 * startpoint: Point to start grabbing text. | |
5377 * length: Amount of text to be grabbed. | |
5378 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5379 void API dw_mle_export(HWND handle, char *buffer, int startpoint, int length) |
3 | 5380 { |
5381 PBYTE mlebuf; | |
5382 | |
5383 /* Work around 64K limit */ | |
5384 if(!DosAllocMem((PPVOID) &mlebuf, 65535, PAG_COMMIT | PAG_READ | PAG_WRITE | OBJ_TILE)) | |
5385 { | |
5386 int amount, copied, written = 0; | |
5387 | |
5388 while(written < length) | |
5389 { | |
5390 if((length - written) > 65535) | |
5391 amount = 65535; | |
5392 else | |
5393 amount = length - written; | |
5394 | |
5395 WinSendMsg(handle, MLM_SETIMPORTEXPORT, MPFROMP(mlebuf), MPFROMLONG(amount)); | |
5396 copied = (int)WinSendMsg(handle, MLM_EXPORT, MPFROMP(&startpoint), MPFROMLONG(&amount)); | |
5397 | |
5398 if(copied) | |
5399 { | |
5400 memcpy(&buffer[written], mlebuf, copied); | |
5401 | |
5402 written += copied; | |
5403 } | |
5404 else | |
5405 break; | |
5406 } | |
5407 DosFreeMem(mlebuf); | |
5408 } | |
5409 } | |
5410 | |
5411 /* | |
5412 * Obtains information about an MLE box. | |
5413 * Parameters: | |
5414 * handle: Handle to the MLE to be queried. | |
5415 * bytes: A pointer to a variable to return the total bytes. | |
5416 * lines: A pointer to a variable to return the number of lines. | |
5417 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5418 void API dw_mle_query(HWND handle, unsigned long *bytes, unsigned long *lines) |
3 | 5419 { |
5420 if(bytes) | |
5421 *bytes = (unsigned long)WinSendMsg(handle, MLM_QUERYTEXTLENGTH, 0, 0); | |
5422 if(lines) | |
5423 *lines = (unsigned long)WinSendMsg(handle, MLM_QUERYLINECOUNT, 0, 0); | |
5424 } | |
5425 | |
5426 /* | |
5427 * Deletes text from an MLE box. | |
5428 * Parameters: | |
5429 * handle: Handle to the MLE to be deleted from. | |
5430 * startpoint: Point to start deleting text. | |
5431 * length: Amount of text to be deleted. | |
5432 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5433 void API dw_mle_delete(HWND handle, int startpoint, int length) |
3 | 5434 { |
5435 char *buf = malloc(length+1); | |
5436 int z, dellen = length; | |
5437 | |
5438 dw_mle_export(handle, buf, startpoint, length); | |
5439 | |
5440 for(z=0;z<length-1;z++) | |
5441 { | |
5442 if(strncmp(&buf[z], "\r\n", 2) == 0) | |
5443 dellen--; | |
5444 } | |
5445 WinSendMsg(handle, MLM_DELETE, MPFROMLONG(startpoint), MPFROMLONG(dellen)); | |
5446 free(buf); | |
5447 } | |
5448 | |
5449 /* | |
5450 * Clears all text from an MLE box. | |
5451 * Parameters: | |
5452 * handle: Handle to the MLE to be cleared. | |
5453 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5454 void API dw_mle_clear(HWND handle) |
3 | 5455 { |
5456 unsigned long bytes; | |
5457 | |
5458 dw_mle_query(handle, &bytes, NULL); | |
5459 | |
5460 WinSendMsg(handle, MLM_DELETE, MPFROMLONG(0), MPFROMLONG(bytes)); | |
5461 } | |
5462 | |
5463 /* | |
5464 * Sets the visible line of an MLE box. | |
5465 * Parameters: | |
5466 * handle: Handle to the MLE to be positioned. | |
5467 * line: Line to be visible. | |
5468 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5469 void API dw_mle_set_visible(HWND handle, int line) |
3 | 5470 { |
153
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
5471 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
|
5472 WinSendMsg(handle, MLM_SETSEL, MPFROMLONG(tmppnt), MPFROMLONG(tmppnt)); |
3 | 5473 } |
5474 | |
5475 /* | |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
5476 * Sets the editablity of an MLE box. |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
5477 * Parameters: |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
5478 * handle: Handle to the MLE. |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
5479 * 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
|
5480 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5481 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
|
5482 { |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
5483 WinSendMsg(handle, MLM_SETREADONLY, MPFROMLONG(state ? FALSE : TRUE), 0); |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
5484 } |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
5485 |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
5486 /* |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
5487 * Sets the word wrap state of an MLE box. |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
5488 * Parameters: |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
5489 * handle: Handle to the MLE. |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
5490 * 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
|
5491 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5492 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
|
5493 { |
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
|
5494 WinSendMsg(handle, MLM_SETWRAP, MPFROMLONG(state), 0); |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
5495 } |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
5496 |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
5497 /* |
3 | 5498 * Sets the current cursor position of an MLE box. |
5499 * Parameters: | |
5500 * handle: Handle to the MLE to be positioned. | |
5501 * point: Point to position cursor. | |
5502 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5503 void API dw_mle_set(HWND handle, int point) |
3 | 5504 { |
5505 WinSendMsg(handle, MLM_SETSEL, MPFROMLONG(point), MPFROMLONG(point)); | |
5506 } | |
5507 | |
5508 /* | |
5509 * Finds text in an MLE box. | |
5510 * Parameters: | |
5511 * handle: Handle to the MLE to be cleared. | |
5512 * text: Text to search for. | |
5513 * point: Start point of search. | |
5514 * flags: Search specific flags. | |
5515 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5516 int API dw_mle_search(HWND handle, char *text, int point, unsigned long flags) |
3 | 5517 { |
5518 MLE_SEARCHDATA msd; | |
5519 | |
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
|
5520 /* 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
|
5521 * 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
|
5522 */ |
3 | 5523 msd.cb = sizeof(msd); |
5524 msd.pchFind = text; | |
5525 msd.pchReplace = NULL; | |
5526 msd.cchFind = strlen(text); | |
5527 msd.cchReplace = 0; | |
5528 msd.iptStart = point; | |
5529 msd.iptStop = -1; | |
5530 | |
5531 if(WinSendMsg(handle, MLM_SEARCH, MPFROMLONG(MLFSEARCH_SELECTMATCH | flags), (MPARAM)&msd)) | |
5532 return (int)WinSendMsg(handle, MLM_QUERYSEL,(MPARAM)MLFQS_MAXSEL, 0); | |
5533 return 0; | |
5534 } | |
5535 | |
5536 /* | |
5537 * Stops redrawing of an MLE box. | |
5538 * Parameters: | |
5539 * handle: Handle to the MLE to freeze. | |
5540 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5541 void API dw_mle_freeze(HWND handle) |
3 | 5542 { |
5543 WinSendMsg(handle, MLM_DISABLEREFRESH, 0, 0); | |
5544 } | |
5545 | |
5546 /* | |
5547 * Resumes redrawing of an MLE box. | |
5548 * Parameters: | |
5549 * handle: Handle to the MLE to thaw. | |
5550 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5551 void API dw_mle_thaw(HWND handle) |
3 | 5552 { |
5553 WinSendMsg(handle, MLM_ENABLEREFRESH, 0, 0); | |
5554 } | |
5555 | |
5556 /* | |
33
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
5557 * Returns the range of the percent bar. |
3 | 5558 * 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
|
5559 * handle: Handle to the percent bar to be queried. |
3 | 5560 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5561 unsigned int API dw_percent_query_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
|
5562 { |
62
2be5174bdb5d
Sync with latest DW code. Tab and RGB fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
5563 return SHORT2FROMMP(WinSendMsg(handle, SLM_QUERYSLIDERINFO, MPFROM2SHORT(SMA_SLIDERARMPOSITION,SMA_RANGEVALUE), 0)); |
3 | 5564 } |
5565 | |
5566 /* | |
33
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
5567 * Sets the percent bar position. |
3 | 5568 * 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
|
5569 * 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
|
5570 * position: Position of the percent bar withing the range. |
3 | 5571 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5572 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
|
5573 { |
94
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
5574 _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
|
5575 WinSendMsg(handle, SLM_SETSLIDERINFO, MPFROM2SHORT(SMA_SLIDERARMPOSITION,SMA_RANGEVALUE), (MPARAM)position); |
3 | 5576 } |
5577 | |
5578 /* | |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
5579 * 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
|
5580 * Parameters: |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
5581 * 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
|
5582 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5583 unsigned int API dw_slider_query_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
|
5584 { |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
5585 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
|
5586 } |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
5587 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
5588 /* |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
5589 * 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
|
5590 * Parameters: |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
5591 * 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
|
5592 * 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
|
5593 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5594 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
|
5595 { |
94
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
5596 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
|
5597 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
|
5598 } |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
5599 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
5600 /* |
195
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
5601 * 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
|
5602 * Parameters: |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
5603 * 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
|
5604 */ |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
5605 unsigned int API dw_scrollbar_query_pos(HWND handle) |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
5606 { |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
5607 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
|
5608 } |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
5609 |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
5610 /* |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
5611 * 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
|
5612 * Parameters: |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
5613 * 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
|
5614 * 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
|
5615 */ |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
5616 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
|
5617 { |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
5618 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
|
5619 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
|
5620 } |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
5621 |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
5622 /* |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
5623 * 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
|
5624 * Parameters: |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
5625 * 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
|
5626 * 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
|
5627 * 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
|
5628 */ |
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
|
5629 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
|
5630 { |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
5631 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
|
5632 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
|
5633 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
|
5634 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
|
5635 } |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
5636 |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
5637 /* |
3 | 5638 * Sets the spinbutton value. |
5639 * Parameters: | |
5640 * handle: Handle to the spinbutton to be set. | |
5641 * position: Current value of the spinbutton. | |
5642 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5643 void API dw_spinbutton_set_pos(HWND handle, long position) |
3 | 5644 { |
5645 WinSendMsg(handle, SPBM_SETCURRENTVALUE, MPFROMLONG((long)position), 0L); | |
5646 } | |
5647 | |
5648 /* | |
5649 * Sets the spinbutton limits. | |
5650 * Parameters: | |
5651 * handle: Handle to the spinbutton to be set. | |
5652 * upper: Upper limit. | |
5653 * lower: Lower limit. | |
5654 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5655 void API dw_spinbutton_set_limits(HWND handle, long upper, long lower) |
3 | 5656 { |
5657 WinSendMsg(handle, SPBM_SETLIMITS, MPFROMLONG(upper), MPFROMLONG(lower)); | |
5658 } | |
5659 | |
5660 /* | |
5661 * Sets the entryfield character limit. | |
5662 * Parameters: | |
5663 * handle: Handle to the spinbutton to be set. | |
5664 * limit: Number of characters the entryfield will take. | |
5665 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5666 void API dw_entryfield_set_limit(HWND handle, ULONG limit) |
3 | 5667 { |
5668 WinSendMsg(handle, EM_SETTEXTLIMIT, (MPARAM)limit, (MPARAM)0); | |
5669 } | |
5670 | |
5671 | |
5672 /* | |
5673 * Returns the current value of the spinbutton. | |
5674 * Parameters: | |
5675 * handle: Handle to the spinbutton to be queried. | |
5676 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5677 long API dw_spinbutton_query(HWND handle) |
3 | 5678 { |
5679 long tmpval = 0L; | |
5680 | |
5681 WinSendMsg(handle, SPBM_QUERYVALUE, (MPARAM)&tmpval,0L); | |
5682 return tmpval; | |
5683 } | |
5684 | |
5685 /* | |
5686 * Returns the state of the checkbox. | |
5687 * Parameters: | |
5688 * handle: Handle to the checkbox to be queried. | |
5689 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5690 int API dw_checkbox_query(HWND handle) |
3 | 5691 { |
5692 return (int)WinSendMsg(handle,BM_QUERYCHECK,0,0); | |
5693 } | |
5694 | |
5695 /* | |
5696 * Sets the state of the checkbox. | |
5697 * Parameters: | |
5698 * handle: Handle to the checkbox to be queried. | |
5699 * value: TRUE for checked, FALSE for unchecked. | |
5700 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5701 void API dw_checkbox_set(HWND handle, int value) |
3 | 5702 { |
5703 WinSendMsg(handle,BM_SETCHECK,MPFROMSHORT(value),0); | |
5704 } | |
5705 | |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5706 /* |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
5707 * 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
|
5708 * Parameters: |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5709 * 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
|
5710 * 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
|
5711 * 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
|
5712 * 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
|
5713 * 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
|
5714 * 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
|
5715 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5716 HWND API dw_tree_insert_after(HWND handle, HWND item, char *title, unsigned long icon, HWND 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
|
5717 { |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5718 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
|
5719 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
|
5720 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
|
5721 |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
5722 if(!item) |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
5723 item = CMA_FIRST; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
5724 |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5725 /* 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
|
5726 * 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
|
5727 */ |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5728 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5729 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
|
5730 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5731 /* 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
|
5732 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5733 pci = WinSendMsg(handle, CM_ALLOCRECORD, MPFROMLONG(cbExtra), MPFROMSHORT(1)); |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5734 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5735 /* 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
|
5736 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5737 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
|
5738 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
|
5739 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
|
5740 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5741 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
|
5742 pci->user = 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
|
5743 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5744 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
|
5745 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5746 ri.cb = sizeof(RECORDINSERT); |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
5747 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
|
5748 ri.pRecordParent = (PRECORDCORE)NULL; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5749 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
|
5750 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
|
5751 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
|
5752 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5753 /* 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
|
5754 * 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
|
5755 */ |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5756 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
|
5757 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5758 /* 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
|
5759 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
|
5760 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5761 return (HWND)pci; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5762 } |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5763 |
30
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
5764 /* |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
5765 * 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
|
5766 * Parameters: |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
5767 * 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
|
5768 * title: The text title of the entry. |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
5769 * icon: Handle to coresponding icon. |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
5770 * parent: Parent handle or 0 if root. |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
5771 * itemdata: Item specific data. |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
5772 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5773 HWND API dw_tree_insert(HWND handle, char *title, unsigned long icon, HWND parent, void *itemdata) |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
5774 { |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
5775 return dw_tree_insert_after(handle, (HWND)CMA_END, title, icon, parent, itemdata); |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
5776 } |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
5777 |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
5778 /* |
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
|
5779 * 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
|
5780 * 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
|
5781 * 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
|
5782 * 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
|
5783 * 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
|
5784 * 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
|
5785 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5786 void API dw_tree_set(HWND handle, HWND 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
|
5787 { |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5788 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
|
5789 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5790 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
|
5791 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
|
5792 |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
5793 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
|
5794 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
|
5795 |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
5796 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
|
5797 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
|
5798 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5799 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
|
5800 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5801 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
|
5802 } |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5803 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5804 /* |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5805 * 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
|
5806 * 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
|
5807 * 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
|
5808 * 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
|
5809 * 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
|
5810 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5811 void API dw_tree_set_data(HWND handle, HWND 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
|
5812 { |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5813 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
|
5814 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5815 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
|
5816 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
|
5817 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5818 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
|
5819 } |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5820 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5821 /* |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5822 * 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
|
5823 * 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
|
5824 * 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
|
5825 * 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
|
5826 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5827 void API dw_tree_item_select(HWND handle, HWND 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
|
5828 { |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5829 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
|
5830 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5831 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
|
5832 { |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5833 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
|
5834 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
|
5835 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
|
5836 } |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5837 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
|
5838 lastitem = 0; |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
5839 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
|
5840 } |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5841 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5842 /* |
30
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
5843 * Removes all nodes from a tree. |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
5844 * Parameters: |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
5845 * 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
|
5846 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5847 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
|
5848 { |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
5849 WinSendMsg(handle, CM_REMOVERECORD, (MPARAM)0L, MPFROM2SHORT(0, CMA_INVALIDATE | CMA_FREE)); |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
5850 } |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
5851 |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
5852 /* |
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
|
5853 * 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
|
5854 * 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
|
5855 * 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
|
5856 * 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
|
5857 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5858 void API dw_tree_expand(HWND handle, HWND 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
|
5859 { |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5860 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
|
5861 } |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5862 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5863 /* |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5864 * 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
|
5865 * 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
|
5866 * 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
|
5867 * 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
|
5868 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5869 void API dw_tree_collapse(HWND handle, HWND 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
|
5870 { |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5871 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
|
5872 } |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5873 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5874 /* |
30
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
5875 * Removes a node from a tree. |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
5876 * Parameters: |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
5877 * 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
|
5878 * item: Handle to node to be deleted. |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
5879 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5880 void API dw_tree_delete(HWND handle, HWND item) |
30
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
5881 { |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
5882 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
|
5883 |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
5884 if(!item) |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
5885 return; |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
5886 |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
5887 if(pci->rc.pszIcon) |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
5888 { |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
5889 free(pci->rc.pszIcon); |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
5890 pci->rc.pszIcon = 0; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
5891 } |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
5892 |
30
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
5893 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
|
5894 } |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
5895 |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5896 /* 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
|
5897 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
|
5898 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
|
5899 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
|
5900 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
|
5901 } ContainerInfo; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5902 |
3 | 5903 /* |
5904 * Sets up the container columns. | |
5905 * Parameters: | |
5906 * handle: Handle to the container to be configured. | |
5907 * flags: An array of unsigned longs with column flags. | |
5908 * titles: An array of strings with column text titles. | |
5909 * count: The number of columns (this should match the arrays). | |
5910 * separator: The column number that contains the main separator. | |
5911 * (this item may only be used in OS/2) | |
5912 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5913 int API dw_container_setup(HWND handle, unsigned long *flags, char **titles, int count, int separator) |
3 | 5914 { |
5915 PFIELDINFO details, first, left = NULL; | |
5916 FIELDINFOINSERT detin; | |
5917 CNRINFO cnri; | |
5918 int z; | |
5919 ULONG size = sizeof(RECORDCORE); | |
5920 ULONG *offStruct = malloc(count * sizeof(ULONG)); | |
5921 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
|
5922 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
|
5923 ULONG *oldflags = blah ? blah->data : 0; |
3 | 5924 |
5925 if(!offStruct || !tempflags) | |
5926 return FALSE; | |
5927 | |
5928 memcpy(tempflags, flags, count * sizeof(ULONG)); | |
5929 tempflags[count] = 0; | |
5930 | |
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
|
5931 blah->data = tempflags; |
70
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
5932 blah->flags = separator; |
3 | 5933 |
5934 if(oldflags) | |
5935 free(oldflags); | |
5936 | |
5937 while((first = (PFIELDINFO)WinSendMsg(handle, CM_QUERYDETAILFIELDINFO, 0, MPFROMSHORT(CMA_FIRST))) != NULL) | |
5938 { | |
5939 WinSendMsg(handle, CM_REMOVEDETAILFIELDINFO, (MPARAM)&first, MPFROM2SHORT(1, CMA_FREE)); | |
5940 } | |
5941 | |
5942 /* Figure out the offsets to the items in the struct */ | |
5943 for(z=0;z<count;z++) | |
5944 { | |
5945 offStruct[z] = size; | |
5946 if(flags[z] & DW_CFA_BITMAPORICON) | |
5947 size += sizeof(HPOINTER); | |
5948 else if(flags[z] & DW_CFA_STRING) | |
5949 size += sizeof(char *); | |
5950 else if(flags[z] & DW_CFA_ULONG) | |
5951 size += sizeof(ULONG); | |
5952 else if(flags[z] & DW_CFA_DATE) | |
5953 size += sizeof(CDATE); | |
5954 else if(flags[z] & DW_CFA_TIME) | |
5955 size += sizeof(CTIME); | |
5956 } | |
5957 | |
5958 first = details = (PFIELDINFO)WinSendMsg(handle, CM_ALLOCDETAILFIELDINFO, MPFROMLONG(count), 0L); | |
5959 | |
5960 if(!first) | |
5961 { | |
5962 free(offStruct); | |
5963 return FALSE; | |
5964 } | |
5965 | |
5966 for(z=0;z<count;z++) | |
5967 { | |
5968 if(z==separator-1) | |
5969 left=details; | |
5970 details->cb = sizeof(FIELDINFO); | |
5971 details->flData = flags[z]; | |
5972 details->flTitle = CFA_FITITLEREADONLY; | |
5973 details->pTitleData = titles[z]; | |
5974 details->offStruct = offStruct[z]; | |
5975 details = details->pNextFieldInfo; | |
5976 } | |
5977 | |
5978 detin.cb = sizeof(FIELDINFOINSERT); | |
5979 detin.fInvalidateFieldInfo = FALSE; | |
5980 detin.pFieldInfoOrder = (PFIELDINFO) CMA_FIRST; | |
5981 detin.cFieldInfoInsert = (ULONG)count; | |
5982 | |
5983 WinSendMsg(handle, CM_INSERTDETAILFIELDINFO, MPFROMP(first), MPFROMP(&detin)); | |
5984 | |
18
f1002d51d959
Fixed a container problem on OS/2 with separator set to 0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
16
diff
changeset
|
5985 if(count > separator && separator > 0) |
3 | 5986 { |
5987 cnri.cb = sizeof(CNRINFO); | |
5988 cnri.pFieldInfoLast = left; | |
5989 cnri.xVertSplitbar = 150; | |
5990 | |
5991 WinSendMsg(handle, CM_SETCNRINFO, MPFROMP(&cnri), MPFROMLONG(CMA_PFIELDINFOLAST | CMA_XVERTSPLITBAR)); | |
5992 } | |
5993 | |
5994 free(offStruct); | |
5995 return TRUE; | |
5996 } | |
5997 | |
5998 /* | |
5999 * Sets up the filesystem columns, note: filesystem always has an icon/filename field. | |
6000 * Parameters: | |
6001 * handle: Handle to the container to be configured. | |
6002 * flags: An array of unsigned longs with column flags. | |
6003 * titles: An array of strings with column text titles. | |
6004 * count: The number of columns (this should match the arrays). | |
6005 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
6006 int API dw_filesystem_setup(HWND handle, unsigned long *flags, char **titles, int count) |
3 | 6007 { |
6008 char **newtitles = malloc(sizeof(char *) * (count + 2)); | |
6009 unsigned long *newflags = malloc(sizeof(unsigned long) * (count + 2)); | |
6010 | |
6011 newtitles[0] = "Icon"; | |
6012 newtitles[1] = "Filename"; | |
6013 | |
6014 newflags[0] = DW_CFA_BITMAPORICON | DW_CFA_CENTER | DW_CFA_HORZSEPARATOR | DW_CFA_SEPARATOR; | |
6015 newflags[1] = DW_CFA_STRING | DW_CFA_LEFT | DW_CFA_HORZSEPARATOR; | |
6016 | |
6017 memcpy(&newtitles[2], titles, sizeof(char *) * count); | |
6018 memcpy(&newflags[2], flags, sizeof(unsigned long) * count); | |
6019 | |
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
|
6020 dw_container_setup(handle, newflags, newtitles, count + 2, count ? 2 : 0); |
3 | 6021 |
6022 free(newtitles); | |
6023 free(newflags); | |
6024 return TRUE; | |
6025 } | |
6026 | |
6027 /* | |
6028 * Obtains an icon from a module (or header in GTK). | |
6029 * Parameters: | |
6030 * module: Handle to module (DLL) in OS/2 and Windows. | |
6031 * id: A unsigned long id int the resources on OS/2 and | |
6032 * Windows, on GTK this is converted to a pointer | |
6033 * to an embedded XPM. | |
6034 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
6035 unsigned long API dw_icon_load(unsigned long module, unsigned long id) |
3 | 6036 { |
6037 return WinLoadPointer(HWND_DESKTOP,module,id); | |
6038 } | |
6039 | |
6040 /* | |
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
|
6041 * 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
|
6042 * 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
|
6043 * 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
|
6044 * 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
|
6045 * (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
|
6046 */ |
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
|
6047 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
|
6048 { |
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
|
6049 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
|
6050 |
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
|
6051 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
|
6052 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
|
6053 |
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
|
6054 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
|
6055 |
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
|
6056 /* 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
|
6057 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
|
6058 { |
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
|
6059 /* 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
|
6060 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
|
6061 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
|
6062 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
|
6063 } |
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
|
6064 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
|
6065 } |
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
|
6066 |
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
|
6067 /* |
3 | 6068 * Frees a loaded resource in OS/2 and Windows. |
6069 * Parameters: | |
6070 * handle: Handle to icon returned by dw_icon_load(). | |
6071 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
6072 void API dw_icon_free(unsigned long handle) |
3 | 6073 { |
6074 WinDestroyPointer(handle); | |
6075 } | |
6076 | |
6077 /* | |
6078 * Allocates memory used to populate a container. | |
6079 * Parameters: | |
6080 * handle: Handle to the container window (widget). | |
6081 * rowcount: The number of items to be populated. | |
6082 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
6083 void * API dw_container_alloc(HWND handle, int rowcount) |
3 | 6084 { |
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
|
6085 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
|
6086 ULONG *flags = wd ? wd->data : 0; |
3 | 6087 int z, size = 0, totalsize, count = 0; |
6088 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
|
6089 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
|
6090 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
|
6091 |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
6092 if(!flags || rowcount < 1) |
3 | 6093 return NULL; |
6094 | |
6095 while(flags[count]) | |
6096 count++; | |
6097 | |
6098 /* Figure out the offsets to the items in the struct */ | |
6099 for(z=0;z<count;z++) | |
6100 { | |
6101 if(flags[z] & DW_CFA_BITMAPORICON) | |
6102 size += sizeof(HPOINTER); | |
6103 else if(flags[z] & DW_CFA_STRING) | |
6104 size += sizeof(char *); | |
6105 else if(flags[z] & DW_CFA_ULONG) | |
6106 size += sizeof(ULONG); | |
6107 else if(flags[z] & DW_CFA_DATE) | |
6108 size += sizeof(CDATE); | |
6109 else if(flags[z] & DW_CFA_TIME) | |
6110 size += sizeof(CTIME); | |
6111 } | |
6112 | |
6113 totalsize = size + sizeof(RECORDCORE); | |
6114 | |
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
|
6115 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
|
6116 |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
6117 while((blah = (void *)WinSendMsg(handle, CM_ALLOCRECORD, MPFROMLONG(size), MPFROMLONG(rowcount))) == 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
|
6118 { |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
6119 z++; |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
6120 if(z > 5000000) |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
6121 break; |
72
ab77a22a2a36
Added localization APIs as well as some miscellaneous bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
70
diff
changeset
|
6122 dw_main_sleep(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
|
6123 } |
3 | 6124 |
6125 if(!blah) | |
6126 return NULL; | |
6127 | |
6128 temp = (PRECORDCORE)blah; | |
6129 | |
6130 for(z=0;z<rowcount;z++) | |
6131 { | |
6132 temp->cb = totalsize; | |
6133 temp = temp->preccNextRecord; | |
6134 } | |
6135 | |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6136 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
|
6137 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6138 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
|
6139 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
|
6140 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
|
6141 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6142 return (void *)ci; |
3 | 6143 } |
6144 | |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6145 /* 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
|
6146 void _dw_container_set_item(HWND handle, PRECORDCORE temp, int column, int row, void *data) |
3 | 6147 { |
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
|
6148 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
|
6149 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
|
6150 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
|
6151 CNRINFO cnr; |
3 | 6152 void *dest; |
6153 | |
6154 if(!flags) | |
6155 return; | |
6156 | |
72
ab77a22a2a36
Added localization APIs as well as some miscellaneous bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
70
diff
changeset
|
6157 z = 0; |
ab77a22a2a36
Added localization APIs as well as some miscellaneous bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
70
diff
changeset
|
6158 |
ab77a22a2a36
Added localization APIs as well as some miscellaneous bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
70
diff
changeset
|
6159 while(WinSendMsg(handle, CM_QUERYCNRINFO, (MPARAM)&cnr, MPFROMSHORT(sizeof(CNRINFO))) == 0) |
ab77a22a2a36
Added localization APIs as well as some miscellaneous bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
70
diff
changeset
|
6160 { |
ab77a22a2a36
Added localization APIs as well as some miscellaneous bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
70
diff
changeset
|
6161 z++; |
ab77a22a2a36
Added localization APIs as well as some miscellaneous bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
70
diff
changeset
|
6162 if(z > 5000000) |
ab77a22a2a36
Added localization APIs as well as some miscellaneous bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
70
diff
changeset
|
6163 return; |
ab77a22a2a36
Added localization APIs as well as some miscellaneous bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
70
diff
changeset
|
6164 dw_main_sleep(1); |
ab77a22a2a36
Added localization APIs as well as some miscellaneous bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
70
diff
changeset
|
6165 } |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6166 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
|
6167 |
3 | 6168 /* Figure out the offsets to the items in the struct */ |
6169 for(z=0;z<column;z++) | |
6170 { | |
6171 if(flags[z] & DW_CFA_BITMAPORICON) | |
6172 size += sizeof(HPOINTER); | |
6173 else if(flags[z] & DW_CFA_STRING) | |
6174 size += sizeof(char *); | |
6175 else if(flags[z] & DW_CFA_ULONG) | |
6176 size += sizeof(ULONG); | |
6177 else if(flags[z] & DW_CFA_DATE) | |
6178 size += sizeof(CDATE); | |
6179 else if(flags[z] & DW_CFA_TIME) | |
6180 size += sizeof(CTIME); | |
6181 } | |
6182 | |
6183 totalsize = size + sizeof(RECORDCORE); | |
6184 | |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6185 for(z=0;z<(row-currentcount);z++) |
3 | 6186 temp = temp->preccNextRecord; |
6187 | |
6188 dest = (void *)(((ULONG)temp)+((ULONG)totalsize)); | |
6189 | |
6190 if(flags[column] & DW_CFA_BITMAPORICON) | |
6191 memcpy(dest, data, sizeof(HPOINTER)); | |
6192 else if(flags[column] & DW_CFA_STRING) | |
6193 memcpy(dest, data, sizeof(char *)); | |
6194 else if(flags[column] & DW_CFA_ULONG) | |
6195 memcpy(dest, data, sizeof(ULONG)); | |
6196 else if(flags[column] & DW_CFA_DATE) | |
6197 memcpy(dest, data, sizeof(CDATE)); | |
6198 else if(flags[column] & DW_CFA_TIME) | |
6199 memcpy(dest, data, sizeof(CTIME)); | |
6200 } | |
6201 | |
6202 /* | |
6203 * Sets an item in specified row and column to the given data. | |
6204 * Parameters: | |
6205 * handle: Handle to the container window (widget). | |
6206 * pointer: Pointer to the allocated memory in dw_container_alloc(). | |
6207 * column: Zero based column of data being set. | |
6208 * row: Zero based row of data being set. | |
6209 * data: Pointer to the data to be added. | |
6210 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
6211 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
|
6212 { |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6213 ContainerInfo *ci = (ContainerInfo *)pointer; |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6214 |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6215 if(!ci) |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6216 return; |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6217 |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6218 _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
|
6219 } |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6220 |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6221 /* |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6222 * 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
|
6223 * Parameters: |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6224 * 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
|
6225 * 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
|
6226 * 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
|
6227 * 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
|
6228 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
6229 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
|
6230 { |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6231 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
|
6232 int count = 0; |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6233 |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6234 while(pCore) |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6235 { |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6236 if(count == row) |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6237 { |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6238 _dw_container_set_item(handle, pCore, column, row, data); |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6239 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
|
6240 return; |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6241 } |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6242 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
|
6243 count++; |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6244 } |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6245 } |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6246 |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6247 /* |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6248 * 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
|
6249 * Parameters: |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6250 * 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
|
6251 * 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
|
6252 * 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
|
6253 * 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
|
6254 * 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
|
6255 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
6256 void API dw_filesystem_set_file(HWND handle, void *pointer, int row, char *filename, unsigned long icon) |
3 | 6257 { |
6258 dw_container_set_item(handle, pointer, 0, row, (void *)&icon); | |
6259 dw_container_set_item(handle, pointer, 1, row, (void *)&filename); | |
6260 } | |
6261 | |
6262 /* | |
6263 * Sets an item in specified row and column to the given data. | |
6264 * Parameters: | |
6265 * handle: Handle to the container window (widget). | |
6266 * pointer: Pointer to the allocated memory in dw_container_alloc(). | |
6267 * column: Zero based column of data being set. | |
6268 * row: Zero based row of data being set. | |
6269 * data: Pointer to the data to be added. | |
6270 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
6271 void API dw_filesystem_set_item(HWND handle, void *pointer, int column, int row, void *data) |
3 | 6272 { |
6273 dw_container_set_item(handle, pointer, column + 2, row, data); | |
6274 } | |
6275 | |
6276 /* | |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6277 * 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
|
6278 * Parameters: |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6279 * 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
|
6280 * 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
|
6281 * 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
|
6282 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
6283 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
|
6284 { |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6285 } |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6286 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6287 /* |
3 | 6288 * Sets the title of a row in the container. |
6289 * Parameters: | |
6290 * pointer: Pointer to the allocated memory in dw_container_alloc(). | |
6291 * row: Zero based row of data being set. | |
6292 * title: String title of the item. | |
6293 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
6294 void API dw_container_set_row_title(void *pointer, int row, char *title) |
3 | 6295 { |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6296 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
|
6297 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
|
6298 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
|
6299 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
|
6300 |
23
2932f9d2c7d5
New OS/2 code from FX changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
22
diff
changeset
|
6301 if(!ci) |
2932f9d2c7d5
New OS/2 code from FX changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
22
diff
changeset
|
6302 return; |
2932f9d2c7d5
New OS/2 code from FX changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
22
diff
changeset
|
6303 |
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
|
6304 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
|
6305 |
72
ab77a22a2a36
Added localization APIs as well as some miscellaneous bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
70
diff
changeset
|
6306 z = 0; |
ab77a22a2a36
Added localization APIs as well as some miscellaneous bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
70
diff
changeset
|
6307 |
ab77a22a2a36
Added localization APIs as well as some miscellaneous bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
70
diff
changeset
|
6308 while(WinSendMsg(ci->handle, CM_QUERYCNRINFO, (MPARAM)&cnr, MPFROMSHORT(sizeof(CNRINFO))) == 0) |
ab77a22a2a36
Added localization APIs as well as some miscellaneous bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
70
diff
changeset
|
6309 { |
ab77a22a2a36
Added localization APIs as well as some miscellaneous bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
70
diff
changeset
|
6310 z++; |
ab77a22a2a36
Added localization APIs as well as some miscellaneous bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
70
diff
changeset
|
6311 if(z > 5000000) |
ab77a22a2a36
Added localization APIs as well as some miscellaneous bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
70
diff
changeset
|
6312 return; |
ab77a22a2a36
Added localization APIs as well as some miscellaneous bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
70
diff
changeset
|
6313 dw_main_sleep(1); |
ab77a22a2a36
Added localization APIs as well as some miscellaneous bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
70
diff
changeset
|
6314 } |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6315 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
|
6316 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6317 for(z=0;z<(row-currentcount);z++) |
3 | 6318 temp = temp->preccNextRecord; |
6319 | |
6320 temp->pszIcon = title; | |
6321 temp->pszName = title; | |
6322 temp->pszText = title; | |
6323 } | |
6324 | |
6325 /* | |
6326 * Sets the title of a row in the container. | |
6327 * Parameters: | |
6328 * handle: Handle to the container window (widget). | |
6329 * pointer: Pointer to the allocated memory in dw_container_alloc(). | |
6330 * rowcount: The number of rows to be inserted. | |
6331 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
6332 void API dw_container_insert(HWND handle, void *pointer, int rowcount) |
3 | 6333 { |
6334 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
|
6335 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
|
6336 int z; |
3 | 6337 |
23
2932f9d2c7d5
New OS/2 code from FX changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
22
diff
changeset
|
6338 if(!ci) |
2932f9d2c7d5
New OS/2 code from FX changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
22
diff
changeset
|
6339 return; |
2932f9d2c7d5
New OS/2 code from FX changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
22
diff
changeset
|
6340 |
3 | 6341 recin.cb = sizeof(RECORDINSERT); |
6342 recin.pRecordOrder = (PRECORDCORE)CMA_END; | |
6343 recin.pRecordParent = NULL; | |
6344 recin.zOrder = CMA_TOP; | |
6345 recin.fInvalidateRecord = TRUE; | |
6346 recin.cRecordsInsert = rowcount; | |
6347 | |
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
|
6348 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
|
6349 |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
6350 while(WinSendMsg(handle, CM_INSERTRECORD, MPFROMP(ci->data), MPFROMP(&recin)) == 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
|
6351 { |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
6352 z++; |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
6353 if(z > 5000000) |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
6354 break; |
72
ab77a22a2a36
Added localization APIs as well as some miscellaneous bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
70
diff
changeset
|
6355 dw_main_sleep(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
|
6356 } |
69
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6357 |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6358 free(ci); |
3 | 6359 } |
6360 | |
6361 /* | |
6362 * Removes all rows from a container. | |
6363 * Parameters: | |
6364 * 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
|
6365 * 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
|
6366 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
6367 void API dw_container_clear(HWND handle, int redraw) |
3 | 6368 { |
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
|
6369 int 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
|
6370 |
52
0804483f6320
Added a redraw parameter to dw_container_clear().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
49
diff
changeset
|
6371 while((int)WinSendMsg(handle, CM_REMOVERECORD, (MPARAM)0L, MPFROM2SHORT(0, (redraw ? CMA_INVALIDATE : 0) | 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
|
6372 { |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
6373 z++; |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
6374 if(z > 5000000) |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
6375 break; |
72
ab77a22a2a36
Added localization APIs as well as some miscellaneous bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
70
diff
changeset
|
6376 dw_main_sleep(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
|
6377 } |
3 | 6378 } |
6379 | |
6380 /* | |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6381 * 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
|
6382 * Parameters: |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6383 * 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
|
6384 * 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
|
6385 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
6386 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
|
6387 { |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6388 RECORDCORE *last, **prc = malloc(sizeof(RECORDCORE *) * rowcount); |
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
|
6389 int current = 1, z; |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6390 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6391 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
|
6392 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6393 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
|
6394 { |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6395 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
|
6396 current++; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6397 } |
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
|
6398 |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
6399 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
|
6400 |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
6401 while((int)WinSendMsg(handle, CM_REMOVERECORD, (MPARAM)prc, MPFROM2SHORT(current, CMA_INVALIDATE | CMA_FREE)) == -1) |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
6402 { |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
6403 z++; |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
6404 if(z > 5000000) |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
6405 break; |
72
ab77a22a2a36
Added localization APIs as well as some miscellaneous bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
70
diff
changeset
|
6406 dw_main_sleep(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
|
6407 } |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
6408 |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6409 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
|
6410 } |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6411 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6412 /* |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6413 * 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
|
6414 * Parameters: |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6415 * 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
|
6416 * 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
|
6417 * 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
|
6418 * 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
|
6419 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
6420 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
|
6421 { |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6422 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
|
6423 { |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6424 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
|
6425 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
|
6426 break; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6427 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
|
6428 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
|
6429 break; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6430 } |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6431 } |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6432 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6433 /* |
3 | 6434 * Removes all rows from a container. |
6435 * Parameters: | |
6436 * handle: Handle to the window (widget) to be cleared. | |
6437 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
6438 void API dw_container_set_view(HWND handle, unsigned long flags, int iconwidth, int iconheight) |
3 | 6439 { |
6440 CNRINFO cnrinfo; | |
6441 | |
6442 cnrinfo.flWindowAttr = flags; | |
6443 cnrinfo.slBitmapOrIcon.cx = iconwidth; | |
6444 cnrinfo.slBitmapOrIcon.cy = iconheight; | |
6445 | |
6446 WinSendMsg(handle, CM_SETCNRINFO, &cnrinfo, MPFROMLONG(CMA_FLWINDOWATTR | CMA_SLBITMAPORICON)); | |
6447 } | |
6448 | |
6449 /* | |
6450 * Starts a new query of a container. | |
6451 * Parameters: | |
6452 * handle: Handle to the window (widget) to be queried. | |
6453 * flags: If this parameter is DW_CRA_SELECTED it will only | |
6454 * return items that are currently selected. Otherwise | |
6455 * it will return all records in the container. | |
6456 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
6457 char * API dw_container_query_start(HWND handle, unsigned long flags) |
3 | 6458 { |
6459 pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)0L, MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER)); | |
6460 if(pCore) | |
6461 { | |
6462 if(flags) | |
6463 { | |
6464 while(pCore) | |
6465 { | |
69
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6466 if(pCore->flRecordAttr & flags) |
3 | 6467 return pCore->pszIcon; |
6468 pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)pCore, MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER)); | |
6469 } | |
6470 } | |
6471 else | |
6472 return pCore->pszIcon; | |
6473 } | |
6474 return NULL; | |
6475 } | |
6476 | |
6477 /* | |
6478 * Continues an existing query of a container. | |
6479 * Parameters: | |
6480 * handle: Handle to the window (widget) to be queried. | |
6481 * flags: If this parameter is DW_CRA_SELECTED it will only | |
6482 * return items that are currently selected. Otherwise | |
6483 * it will return all records in the container. | |
6484 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
6485 char * API dw_container_query_next(HWND handle, unsigned long flags) |
3 | 6486 { |
6487 pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)pCore, MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER)); | |
6488 if(pCore) | |
6489 { | |
6490 if(flags) | |
6491 { | |
6492 while(pCore) | |
6493 { | |
69
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6494 if(pCore->flRecordAttr & flags) |
3 | 6495 return pCore->pszIcon; |
6496 | |
6497 pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)pCore, MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER)); | |
6498 } | |
6499 } | |
6500 else | |
6501 return pCore->pszIcon; | |
6502 } | |
6503 return NULL; | |
6504 } | |
6505 | |
6506 /* | |
69
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6507 * 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
|
6508 * Parameters: |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6509 * 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
|
6510 * 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
|
6511 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
6512 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
|
6513 { |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6514 RECTL viewport, item; |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6515 |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6516 pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)0L, MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER)); |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6517 while(pCore) |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6518 { |
154
7f8fcce45bdd
Fixed EMX building.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
6519 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
|
6520 { |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6521 QUERYRECORDRECT qrr; |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6522 int scrollpixels = 0, midway; |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6523 |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6524 qrr.cb = sizeof(QUERYRECORDRECT); |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6525 qrr.pRecord = pCore; |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6526 qrr.fRightSplitWindow = 0; |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6527 qrr.fsExtent = CMA_TEXT; |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6528 |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6529 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
|
6530 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
|
6531 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
|
6532 |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6533 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
|
6534 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
|
6535 |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6536 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
|
6537 return; |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6538 } |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6539 |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6540 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
|
6541 } |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6542 } |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6543 |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6544 /* |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6545 * 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
|
6546 * Parameters: |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6547 * 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
|
6548 * 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
|
6549 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
6550 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
|
6551 { |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6552 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
|
6553 |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6554 while(pCore) |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6555 { |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6556 if((char *)pCore->pszIcon == text) |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6557 { |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6558 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
|
6559 return; |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6560 } |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6561 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
|
6562 } |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6563 } |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6564 |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6565 /* |
69
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6566 * 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
|
6567 * Parameters: |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6568 * 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
|
6569 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
6570 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
|
6571 { |
70
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
6572 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
|
6573 RECTL item; |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
6574 PRECORDCORE pCore = NULL; |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
6575 int max = 0; |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
6576 |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
6577 if(blah && !blah->flags) |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
6578 return; |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
6579 |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
6580 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
|
6581 while(pCore) |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
6582 { |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
6583 QUERYRECORDRECT qrr; |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
6584 int vector; |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
6585 |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
6586 qrr.cb = sizeof(QUERYRECORDRECT); |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
6587 qrr.pRecord = pCore; |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
6588 qrr.fRightSplitWindow = 0; |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
6589 qrr.fsExtent = CMA_TEXT; |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
6590 |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
6591 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
|
6592 |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
6593 vector = item.xRight - item.xLeft; |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
6594 |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
6595 if(vector > max) |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
6596 max = vector; |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
6597 |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
6598 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
|
6599 } |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
6600 |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
6601 if(max) |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
6602 { |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
6603 CNRINFO cnri; |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
6604 |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
6605 cnri.cb = sizeof(CNRINFO); |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
6606 cnri.xVertSplitbar = max; |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
6607 |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
6608 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
|
6609 } |
69
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6610 } |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6611 |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6612 /* |
3 | 6613 * Creates a rendering context widget (window) to be packed. |
6614 * Parameters: | |
6615 * id: An id to be used with dw_window_from_id. | |
6616 * Returns: | |
6617 * A handle to the widget or NULL on failure. | |
6618 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
6619 HWND API dw_render_new(unsigned long id) |
3 | 6620 { |
6621 HWND hwndframe = WinCreateWindow(HWND_OBJECT, | |
6622 WC_FRAME, | |
6623 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
|
6624 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
|
6625 FS_NOBYTEALIGN, |
3 | 6626 0,0,2000,1000, |
6627 NULLHANDLE, | |
6628 HWND_TOP, | |
6629 id, | |
6630 NULL, | |
6631 NULL); | |
6632 WinSubclassWindow(hwndframe, _RendProc); | |
6633 return hwndframe; | |
6634 } | |
6635 | |
6636 /* Sets the current foreground drawing color. | |
6637 * Parameters: | |
6638 * red: red value. | |
6639 * green: green value. | |
6640 * blue: blue value. | |
6641 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
6642 void API dw_color_foreground_set(unsigned long value) |
3 | 6643 { |
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
|
6644 _foreground = value; |
3 | 6645 } |
6646 | |
6647 /* Sets the current background drawing color. | |
6648 * Parameters: | |
6649 * red: red value. | |
6650 * green: green value. | |
6651 * blue: blue value. | |
6652 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
6653 void API dw_color_background_set(unsigned long value) |
3 | 6654 { |
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
|
6655 _background = value; |
3 | 6656 } |
6657 | |
6658 HPS _set_hps(HPS hps) | |
6659 { | |
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
|
6660 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
|
6661 |
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
|
6662 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
|
6663 alTable[1] = DW_RED_VALUE(_background) << 16 | DW_GREEN_VALUE(_background) << 8 | DW_BLUE_VALUE(_background); |
3 | 6664 |
6665 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
|
6666 LCOL_RESET, |
3 | 6667 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
|
6668 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
|
6669 2, |
3 | 6670 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
|
6671 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
|
6672 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
|
6673 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
|
6674 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
|
6675 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
|
6676 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
|
6677 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
|
6678 GpiSetBackColor(hps, _internal_color(_background)); |
3 | 6679 return hps; |
6680 } | |
6681 | |
6682 HPS _set_colors(HWND handle) | |
6683 { | |
6684 HPS hps = WinGetPS(handle); | |
6685 | |
6686 _set_hps(hps); | |
6687 return hps; | |
6688 } | |
6689 | |
6690 /* Draw a point on a window (preferably a render window). | |
6691 * Parameters: | |
6692 * handle: Handle to the window. | |
6693 * pixmap: Handle to the pixmap. (choose only one of these) | |
6694 * x: X coordinate. | |
6695 * y: Y coordinate. | |
6696 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
6697 void API dw_draw_point(HWND handle, HPIXMAP pixmap, int x, int y) |
3 | 6698 { |
6699 HPS hps; | |
6700 int height; | |
6701 POINTL ptl; | |
6702 | |
6703 if(handle) | |
6704 { | |
6705 hps = _set_colors(handle); | |
6706 height = _get_height(handle); | |
6707 } | |
6708 else if(pixmap) | |
6709 { | |
6710 hps = _set_hps(pixmap->hps); | |
6711 height = pixmap->height; | |
6712 } | |
6713 else | |
6714 return; | |
6715 | |
6716 ptl.x = x; | |
6717 ptl.y = height - y - 1; | |
6718 | |
6719 GpiSetPel(hps, &ptl); | |
6720 if(!pixmap) | |
6721 WinReleasePS(hps); | |
6722 } | |
6723 | |
6724 /* Draw a line on a window (preferably a render window). | |
6725 * Parameters: | |
6726 * handle: Handle to the window. | |
6727 * pixmap: Handle to the pixmap. (choose only one of these) | |
6728 * x1: First X coordinate. | |
6729 * y1: First Y coordinate. | |
6730 * x2: Second X coordinate. | |
6731 * y2: Second Y coordinate. | |
6732 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
6733 void API dw_draw_line(HWND handle, HPIXMAP pixmap, int x1, int y1, int x2, int y2) |
3 | 6734 { |
6735 HPS hps; | |
6736 int height; | |
6737 POINTL ptl[2]; | |
6738 | |
6739 if(handle) | |
6740 { | |
6741 hps = _set_colors(handle); | |
6742 height = _get_height(handle); | |
6743 } | |
6744 else if(pixmap) | |
6745 { | |
6746 hps = _set_hps(pixmap->hps); | |
6747 height = pixmap->height; | |
6748 } | |
6749 else | |
6750 return; | |
6751 | |
6752 ptl[0].x = x1; | |
6753 ptl[0].y = height - y1 - 1; | |
6754 ptl[1].x = x2; | |
6755 ptl[1].y = height - y2 - 1; | |
6756 | |
6757 GpiMove(hps, &ptl[0]); | |
6758 GpiLine(hps, &ptl[1]); | |
6759 | |
6760 if(!pixmap) | |
6761 WinReleasePS(hps); | |
6762 } | |
6763 | |
6764 | |
9
3383ed751a7e
New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
8
diff
changeset
|
6765 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
|
6766 { |
3383ed751a7e
New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
8
diff
changeset
|
6767 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
|
6768 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
|
6769 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
|
6770 |
3383ed751a7e
New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
8
diff
changeset
|
6771 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
|
6772 |
3383ed751a7e
New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
8
diff
changeset
|
6773 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
|
6774 |
3383ed751a7e
New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
8
diff
changeset
|
6775 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
|
6776 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
|
6777 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
|
6778 |
3383ed751a7e
New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
8
diff
changeset
|
6779 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
|
6780 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
|
6781 |
3383ed751a7e
New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
8
diff
changeset
|
6782 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
|
6783 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
|
6784 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
|
6785 } |
3383ed751a7e
New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
8
diff
changeset
|
6786 |
3 | 6787 /* Draw text on a window (preferably a render window). |
6788 * Parameters: | |
6789 * handle: Handle to the window. | |
6790 * pixmap: Handle to the pixmap. (choose only one of these) | |
6791 * x: X coordinate. | |
6792 * y: Y coordinate. | |
6793 * text: Text to be displayed. | |
6794 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
6795 void API dw_draw_text(HWND handle, HPIXMAP pixmap, int x, int y, char *text) |
3 | 6796 { |
6797 HPS hps; | |
220
d84054c1d587
Fixed a minor bug in dw_draw_text().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
212
diff
changeset
|
6798 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
|
6799 RECTL rcl; |
3 | 6800 char fontname[128]; |
220
d84054c1d587
Fixed a minor bug in dw_draw_text().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
212
diff
changeset
|
6801 POINTL aptl[TXTBOX_COUNT]; |
3 | 6802 |
6803 if(handle) | |
6804 { | |
6805 hps = _set_colors(handle); | |
6806 height = _get_height(handle); | |
6807 _GetPPFont(handle, fontname); | |
6808 } | |
6809 else if(pixmap) | |
6810 { | |
9
3383ed751a7e
New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
8
diff
changeset
|
6811 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
|
6812 |
3 | 6813 hps = _set_hps(pixmap->hps); |
6814 height = pixmap->height; | |
6815 _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
|
6816 _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
|
6817 WinReleasePS(pixmaphps); |
3 | 6818 } |
6819 else | |
6820 return; | |
6821 | |
6822 for(z=0;z<strlen(fontname);z++) | |
6823 { | |
6824 if(fontname[z]=='.') | |
6825 break; | |
6826 } | |
220
d84054c1d587
Fixed a minor bug in dw_draw_text().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
212
diff
changeset
|
6827 |
d84054c1d587
Fixed a minor bug in dw_draw_text().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
212
diff
changeset
|
6828 GpiQueryTextBox(hps, strlen(text), text, TXTBOX_COUNT, aptl); |
3 | 6829 |
9
3383ed751a7e
New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
8
diff
changeset
|
6830 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
|
6831 rcl.yTop = height - y; |
220
d84054c1d587
Fixed a minor bug in dw_draw_text().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
212
diff
changeset
|
6832 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
|
6833 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
|
6834 |
3383ed751a7e
New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
8
diff
changeset
|
6835 WinDrawText(hps, -1, text, &rcl, DT_TEXTATTRS, DT_TEXTATTRS, DT_VCENTER | DT_LEFT | DT_TEXTATTRS); |
3 | 6836 |
6837 if(!pixmap) | |
6838 WinReleasePS(hps); | |
6839 } | |
6840 | |
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
|
6841 /* 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
|
6842 * 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
|
6843 * 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
|
6844 * 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
|
6845 * 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
|
6846 * 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
|
6847 * 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
|
6848 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
6849 void API dw_font_text_extents(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
|
6850 { |
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
|
6851 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
|
6852 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
|
6853 |
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
|
6854 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
|
6855 { |
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
|
6856 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
|
6857 } |
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
|
6858 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
|
6859 { |
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
|
6860 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
|
6861 |
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
|
6862 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
|
6863 _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
|
6864 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
|
6865 } |
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
|
6866 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
|
6867 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
|
6868 |
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
|
6869 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
|
6870 |
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
|
6871 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
|
6872 *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
|
6873 |
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
|
6874 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
|
6875 *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
|
6876 |
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
|
6877 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
|
6878 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
|
6879 } |
3 | 6880 |
6881 /* Draw a rectangle on a window (preferably a render window). | |
6882 * Parameters: | |
6883 * handle: Handle to the window. | |
6884 * pixmap: Handle to the pixmap. (choose only one of these) | |
6885 * fill: Fill box TRUE or FALSE. | |
6886 * x: X coordinate. | |
6887 * y: Y coordinate. | |
6888 * width: Width of rectangle. | |
6889 * height: Height of rectangle. | |
6890 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
6891 void API dw_draw_rect(HWND handle, HPIXMAP pixmap, int fill, int x, int y, int width, int height) |
3 | 6892 { |
6893 HPS hps; | |
6894 int thisheight; | |
6895 POINTL ptl[2]; | |
6896 | |
6897 if(handle) | |
6898 { | |
6899 hps = _set_colors(handle); | |
6900 thisheight = _get_height(handle); | |
6901 } | |
6902 else if(pixmap) | |
6903 { | |
6904 hps = _set_hps(pixmap->hps); | |
6905 thisheight = pixmap->height; | |
6906 } | |
6907 else | |
6908 return; | |
6909 | |
6910 ptl[0].x = x; | |
6911 ptl[0].y = thisheight - y - 1; | |
6912 ptl[1].x = x + width - 1; | |
6913 ptl[1].y = thisheight - y - height; | |
6914 | |
6915 GpiMove(hps, &ptl[0]); | |
6916 GpiBox(hps, fill ? DRO_OUTLINEFILL : DRO_OUTLINE, &ptl[1], 0, 0); | |
6917 | |
6918 if(!pixmap) | |
6919 WinReleasePS(hps); | |
6920 } | |
6921 | |
6922 /* Call this after drawing to the screen to make sure | |
6923 * anything you have drawn is visible. | |
6924 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
6925 void API dw_flush(void) |
3 | 6926 { |
6927 } | |
6928 | |
6929 /* | |
6930 * Creates a pixmap with given parameters. | |
6931 * Parameters: | |
6932 * handle: Window handle the pixmap is associated with. | |
6933 * width: Width of the pixmap in pixels. | |
6934 * height: Height of the pixmap in pixels. | |
6935 * depth: Color depth of the pixmap. | |
6936 * Returns: | |
6937 * A handle to a pixmap or NULL on failure. | |
6938 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
6939 HPIXMAP API dw_pixmap_new(HWND handle, unsigned long width, unsigned long height, int depth) |
3 | 6940 { |
6941 BITMAPINFOHEADER bmih; | |
6942 SIZEL sizl = { 0, 0 }; | |
6943 HPIXMAP pixmap; | |
6944 HDC hdc; | |
6945 HPS hps; | |
6946 ULONG ulFlags; | |
6947 LONG cPlanes, cBitCount; | |
6948 | |
6949 if (!(pixmap = calloc(1,sizeof(struct _hpixmap)))) | |
6950 return NULL; | |
6951 | |
6952 hps = WinGetPS(handle); | |
6953 | |
6954 hdc = GpiQueryDevice(hps); | |
6955 ulFlags = GpiQueryPS(hps, &sizl); | |
6956 | |
6957 pixmap->handle = handle; | |
6958 pixmap->hdc = DevOpenDC(dwhab, OD_MEMORY, "*", 0L, NULL, hdc); | |
6959 pixmap->hps = GpiCreatePS (dwhab, pixmap->hdc, &sizl, ulFlags | GPIA_ASSOC); | |
6960 | |
6961 DevQueryCaps(hdc, CAPS_COLOR_PLANES , 1L, &cPlanes); | |
6962 if (!depth) | |
6963 { | |
6964 DevQueryCaps(hdc, CAPS_COLOR_BITCOUNT, 1L, &cBitCount); | |
6965 depth = cBitCount; | |
6966 } | |
6967 | |
6968 memset(&bmih, 0, sizeof(BITMAPINFOHEADER)); | |
6969 bmih.cbFix = sizeof(BITMAPINFOHEADER); | |
6970 bmih.cx = (SHORT)width; | |
6971 bmih.cy = (SHORT)height; | |
6972 bmih.cPlanes = (SHORT)cPlanes; | |
6973 bmih.cBitCount = (SHORT)depth; | |
6974 | |
6975 pixmap->width = width; pixmap->height = height; | |
6976 | |
6977 pixmap->hbm = GpiCreateBitmap(pixmap->hps, (PBITMAPINFOHEADER2)&bmih, 0L, NULL, NULL); | |
6978 | |
6979 GpiSetBitmap(pixmap->hps, pixmap->hbm); | |
6980 | |
6981 if (depth>8) | |
6982 GpiCreateLogColorTable(pixmap->hps, LCOL_PURECOLOR, LCOLF_RGB, 0, 0, NULL ); | |
6983 | |
6984 WinReleasePS(hps); | |
6985 | |
6986 return pixmap; | |
6987 } | |
6988 | |
6989 /* | |
241
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
6990 * Creates a pixmap from a file. |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
6991 * Parameters: |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
6992 * 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
|
6993 * 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
|
6994 * DW pick the appropriate file extension. |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
6995 * (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
|
6996 * Returns: |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
6997 * 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
|
6998 */ |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
6999 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
|
7000 { |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7001 HPIXMAP pixmap; |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7002 char *file = alloca(strlen(filename) + 5); |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7003 |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7004 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
|
7005 return NULL; |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7006 |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7007 strcpy(file, filename); |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7008 |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7009 /* 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
|
7010 if(access(file, 04) != 0) |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7011 { |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7012 /* Try with .bmp extention */ |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7013 strcat(file, ".bmp"); |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7014 if(access(file, 04) != 0) |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7015 { |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7016 free(pixmap); |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7017 return NULL; |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7018 } |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7019 } |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7020 |
278
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
7021 /* 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
|
7022 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
|
7023 { |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7024 free(pixmap); |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7025 return NULL; |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7026 } |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7027 |
278
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
7028 /* Success fill in other values */ |
241
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7029 pixmap->handle = handle; |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7030 |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7031 return pixmap; |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7032 } |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7033 |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7034 /* |
3 | 7035 * Creates a pixmap from internal resource graphic specified by id. |
7036 * Parameters: | |
7037 * handle: Window handle the pixmap is associated with. | |
7038 * id: Resource ID associated with requested pixmap. | |
7039 * Returns: | |
7040 * A handle to a pixmap or NULL on failure. | |
7041 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7042 HPIXMAP API dw_pixmap_grab(HWND handle, ULONG id) |
3 | 7043 { |
7044 BITMAPINFOHEADER bmih; | |
7045 SIZEL sizl = { 0, 0 }; | |
7046 HPIXMAP pixmap; | |
7047 HDC hdc; | |
7048 HPS hps; | |
7049 ULONG ulFlags; | |
7050 | |
7051 if (!(pixmap = calloc(1,sizeof(struct _hpixmap)))) | |
7052 return NULL; | |
7053 | |
7054 hps = WinGetPS(handle); | |
7055 | |
7056 hdc = GpiQueryDevice(hps); | |
7057 ulFlags = GpiQueryPS(hps, &sizl); | |
7058 | |
7059 pixmap->hdc = DevOpenDC(dwhab, OD_MEMORY, "*", 0L, NULL, hdc); | |
7060 pixmap->hps = GpiCreatePS (dwhab, pixmap->hdc, &sizl, ulFlags | GPIA_ASSOC); | |
7061 | |
7062 pixmap->hbm = GpiLoadBitmap(pixmap->hps, NULLHANDLE, id, 0, 0); | |
7063 | |
7064 GpiQueryBitmapParameters(pixmap->hbm, &bmih); | |
7065 | |
7066 GpiSetBitmap(pixmap->hps, pixmap->hbm); | |
7067 | |
7068 pixmap->width = bmih.cx; pixmap->height = bmih.cy; | |
7069 | |
7070 WinReleasePS(hps); | |
7071 | |
7072 return pixmap; | |
7073 } | |
7074 | |
7075 /* | |
7076 * Destroys an allocated pixmap. | |
7077 * Parameters: | |
7078 * pixmap: Handle to a pixmap returned by | |
7079 * dw_pixmap_new.. | |
7080 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7081 void API dw_pixmap_destroy(HPIXMAP pixmap) |
3 | 7082 { |
7083 GpiSetBitmap(pixmap->hps, NULLHANDLE); | |
7084 GpiDeleteBitmap(pixmap->hbm); | |
7085 GpiAssociate(pixmap->hps, NULLHANDLE); | |
7086 GpiDestroyPS(pixmap->hps); | |
7087 DevCloseDC(pixmap->hdc); | |
7088 free(pixmap); | |
7089 } | |
7090 | |
7091 /* | |
7092 * Copies from one item to another. | |
7093 * Parameters: | |
7094 * dest: Destination window handle. | |
7095 * destp: Destination pixmap. (choose only one). | |
7096 * xdest: X coordinate of destination. | |
7097 * ydest: Y coordinate of destination. | |
7098 * width: Width of area to copy. | |
7099 * height: Height of area to copy. | |
7100 * src: Source window handle. | |
7101 * srcp: Source pixmap. (choose only one). | |
7102 * xsrc: X coordinate of source. | |
7103 * ysrc: Y coordinate of source. | |
7104 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7105 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 | 7106 { |
7107 HPS hpsdest; | |
7108 HPS hpssrc; | |
7109 POINTL ptl[4]; | |
7110 int destheight, srcheight; | |
7111 | |
7112 if(dest) | |
7113 { | |
7114 hpsdest = WinGetPS(dest); | |
7115 destheight = _get_height(dest); | |
7116 } | |
7117 else if(destp) | |
7118 { | |
7119 hpsdest = destp->hps; | |
7120 destheight = destp->height; | |
7121 } | |
7122 else | |
7123 return; | |
7124 | |
7125 if(src) | |
7126 { | |
7127 hpssrc = WinGetPS(src); | |
7128 srcheight = _get_height(src); | |
7129 } | |
7130 else if(srcp) | |
7131 { | |
7132 hpssrc = srcp->hps; | |
7133 srcheight = srcp->height; | |
7134 } | |
7135 else | |
7136 { | |
7137 if(!destp) | |
7138 WinReleasePS(hpsdest); | |
7139 return; | |
7140 } | |
7141 | |
7142 ptl[0].x = xdest; | |
7143 ptl[0].y = (destheight - ydest) - height; | |
7144 ptl[1].x = ptl[0].x + width; | |
7145 ptl[1].y = destheight - ydest; | |
7146 ptl[2].x = xsrc; | |
7147 ptl[2].y = srcheight - (ysrc + height); | |
7148 ptl[3].x = ptl[2].x + width; | |
7149 ptl[3].y = ptl[2].y + height; | |
7150 | |
7151 GpiBitBlt(hpsdest, hpssrc, 4, ptl, ROP_SRCCOPY, BBO_IGNORE); | |
7152 | |
7153 if(!destp) | |
7154 WinReleasePS(hpsdest); | |
7155 if(!srcp) | |
7156 WinReleasePS(hpssrc); | |
7157 } | |
7158 | |
7159 /* | |
7160 * Emits a beep. | |
7161 * Parameters: | |
7162 * freq: Frequency. | |
7163 * dur: Duration. | |
7164 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7165 void API dw_beep(int freq, int dur) |
3 | 7166 { |
7167 DosBeep(freq, dur); | |
7168 } | |
7169 | |
157
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7170 /* Open a shared library and return a handle. |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7171 * Parameters: |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7172 * name: Base name of the shared library. |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7173 * handle: Pointer to a module handle, |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7174 * will be filled in with the handle. |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7175 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7176 int API dw_module_load(char *name, HMOD *handle) |
157
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7177 { |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7178 char objnamebuf[300] = ""; |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7179 |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7180 return DosLoadModule(objnamebuf, sizeof(objnamebuf), name, handle); |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7181 } |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7182 |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7183 /* Queries the address of a symbol within open handle. |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7184 * Parameters: |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7185 * handle: Module handle returned by dw_module_load() |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7186 * name: Name of the symbol you want the address of. |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7187 * func: A pointer to a function pointer, to obtain |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7188 * the address. |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7189 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7190 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
|
7191 { |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7192 return DosQueryProcAddr(handle, 0, name, (PFN*)func); |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7193 } |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7194 |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7195 /* Frees the shared library previously opened. |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7196 * Parameters: |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7197 * handle: Module handle returned by dw_module_load() |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7198 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7199 int API dw_module_close(HMOD handle) |
157
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7200 { |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7201 DosFreeModule(handle); |
159
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
7202 return 0; |
157
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7203 } |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7204 |
3 | 7205 /* |
7206 * Returns the handle to an unnamed mutex semaphore. | |
7207 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7208 HMTX API dw_mutex_new(void) |
3 | 7209 { |
7210 HMTX mutex; | |
7211 | |
7212 DosCreateMutexSem(NULL, &mutex, 0, FALSE); | |
7213 return mutex; | |
7214 } | |
7215 | |
7216 /* | |
7217 * Closes a semaphore created by dw_mutex_new(). | |
7218 * Parameters: | |
7219 * mutex: The handle to the mutex returned by dw_mutex_new(). | |
7220 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7221 void API dw_mutex_close(HMTX mutex) |
3 | 7222 { |
7223 DosCloseMutexSem(mutex); | |
7224 } | |
7225 | |
7226 /* | |
7227 * 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
|
7228 * 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
|
7229 * while blocking. |
3 | 7230 * Parameters: |
7231 * mutex: The handle to the mutex returned by dw_mutex_new(). | |
7232 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7233 void API dw_mutex_lock(HMTX mutex) |
3 | 7234 { |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
7235 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
|
7236 { |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
7237 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
|
7238 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
7239 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
|
7240 { |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
7241 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
|
7242 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
|
7243 } |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
7244 } |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
7245 else |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
7246 DosRequestMutexSem(mutex, SEM_INDEFINITE_WAIT); |
3 | 7247 } |
7248 | |
7249 /* | |
7250 * Reliquishes the access to the semaphore. | |
7251 * Parameters: | |
7252 * mutex: The handle to the mutex returned by dw_mutex_new(). | |
7253 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7254 void API dw_mutex_unlock(HMTX mutex) |
3 | 7255 { |
7256 DosReleaseMutexSem(mutex); | |
7257 } | |
7258 | |
7259 /* | |
7260 * Returns the handle to an unnamed event semaphore. | |
7261 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7262 HEV API dw_event_new(void) |
3 | 7263 { |
7264 HEV blah; | |
7265 | |
7266 if(DosCreateEventSem (NULL, &blah, 0L, FALSE)) | |
7267 return 0; | |
7268 | |
7269 return blah; | |
7270 } | |
7271 | |
7272 /* | |
7273 * Resets a semaphore created by dw_event_new(). | |
7274 * Parameters: | |
7275 * eve: The handle to the event returned by dw_event_new(). | |
7276 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7277 int API dw_event_reset(HEV eve) |
3 | 7278 { |
7279 ULONG count; | |
7280 | |
7281 if(DosResetEventSem(eve, &count)) | |
7282 return FALSE; | |
7283 return TRUE; | |
7284 } | |
7285 | |
7286 /* | |
7287 * Posts a semaphore created by dw_event_new(). Causing all threads | |
7288 * waiting on this event in dw_event_wait to continue. | |
7289 * Parameters: | |
7290 * eve: The handle to the event returned by dw_event_new(). | |
7291 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7292 int API dw_event_post(HEV eve) |
3 | 7293 { |
7294 if(DosPostEventSem(eve)) | |
7295 return FALSE; | |
7296 return TRUE; | |
7297 } | |
7298 | |
7299 | |
7300 /* | |
7301 * Waits on a semaphore created by dw_event_new(), until the | |
7302 * event gets posted or until the timeout expires. | |
7303 * Parameters: | |
7304 * eve: The handle to the event returned by dw_event_new(). | |
7305 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7306 int API dw_event_wait(HEV eve, unsigned long timeout) |
3 | 7307 { |
7308 int rc = DosWaitEventSem(eve, timeout); | |
7309 if(!rc) | |
7310 return 1; | |
7311 if(rc == ERROR_TIMEOUT) | |
7312 return -1; | |
7313 return 0; | |
7314 } | |
7315 | |
7316 /* | |
7317 * Closes a semaphore created by dw_event_new(). | |
7318 * Parameters: | |
7319 * eve: The handle to the event returned by dw_event_new(). | |
7320 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7321 int API dw_event_close(HEV *eve) |
3 | 7322 { |
7323 if(!eve || ~DosCloseEventSem(*eve)) | |
7324 return FALSE; | |
7325 return TRUE; | |
7326 } | |
7327 | |
7328 /* | |
7329 * Encapsulate the message queues on OS/2. | |
7330 */ | |
7331 void _dwthreadstart(void *data) | |
7332 { | |
7333 HAB thishab = WinInitialize(0); | |
7334 HMQ thishmq = WinCreateMsgQueue(dwhab, 0); | |
7335 void (*threadfunc)(void *) = NULL; | |
7336 void **tmp = (void **)data; | |
7337 | |
7338 threadfunc = (void (*)(void *))tmp[0]; | |
7339 threadfunc(tmp[1]); | |
7340 | |
7341 free(tmp); | |
7342 | |
7343 WinDestroyMsgQueue(thishmq); | |
7344 WinTerminate(thishab); | |
7345 } | |
7346 | |
7347 /* | |
7348 * Creates a new thread with a starting point of func. | |
7349 * Parameters: | |
7350 * func: Function which will be run in the new thread. | |
7351 * data: Parameter(s) passed to the function. | |
7352 * stack: Stack size of new thread (OS/2 and Windows only). | |
7353 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7354 DWTID API dw_thread_new(void *func, void *data, int stack) |
3 | 7355 { |
7356 void **tmp = malloc(sizeof(void *) * 2); | |
7357 | |
7358 tmp[0] = func; | |
7359 tmp[1] = data; | |
7360 | |
7361 return (DWTID)_beginthread((void (*)(void *))_dwthreadstart, NULL, stack, (void *)tmp); | |
7362 } | |
7363 | |
7364 /* | |
7365 * Ends execution of current thread immediately. | |
7366 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7367 void API dw_thread_end(void) |
3 | 7368 { |
7369 _endthread(); | |
7370 } | |
7371 | |
7372 /* | |
7373 * Returns the current thread's ID. | |
7374 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7375 DWTID API dw_thread_id(void) |
3 | 7376 { |
7377 return (DWTID)_threadid; | |
7378 } | |
7379 | |
7380 /* | |
7381 * Cleanly terminates a DW session, should be signal handler safe. | |
7382 * Parameters: | |
7383 * exitcode: Exit code reported to the operating system. | |
7384 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7385 void API dw_exit(int exitcode) |
3 | 7386 { |
7387 /* In case we are in a signal handler, don't | |
7388 * try to free memory that could possibly be | |
7389 * free()'d by the runtime already. | |
7390 */ | |
7391 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
|
7392 |
3 | 7393 exit(exitcode); |
7394 } | |
7395 | |
7396 /* | |
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
|
7397 * 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
|
7398 * 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
|
7399 * type: Value can be BOXVERT or BOXHORZ. |
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
7400 * 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
|
7401 * 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
|
7402 * 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
|
7403 * 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
|
7404 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7405 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
|
7406 { |
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
7407 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
|
7408 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
|
7409 NULL, |
137
6a18312049fd
The splitbar needs to have the WS_CLIPCHILDREN style set.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
136
diff
changeset
|
7410 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
|
7411 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
|
7412 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
|
7413 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
|
7414 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
|
7415 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
|
7416 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
|
7417 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
|
7418 { |
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
7419 HWND tmpbox = dw_box_new(BOXVERT, 0); |
123
63f61a702b17
Updates to use floats to save the splitbar percentage.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
7420 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
|
7421 |
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
7422 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
|
7423 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
|
7424 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
|
7425 |
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
7426 tmpbox = dw_box_new(BOXVERT, 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
|
7427 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
|
7428 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
|
7429 *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
|
7430 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
|
7431 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
|
7432 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
|
7433 } |
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
7434 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
|
7435 } |
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
7436 |
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
7437 /* |
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
7438 * 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
|
7439 * 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
|
7440 * 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
|
7441 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7442 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
|
7443 { |
123
63f61a702b17
Updates to use floats to save the splitbar percentage.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
7444 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
|
7445 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
|
7446 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
|
7447 |
63f61a702b17
Updates to use floats to save the splitbar percentage.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
7448 if(mypercent) |
63f61a702b17
Updates to use floats to save the splitbar percentage.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
7449 *mypercent = percent; |
125
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
7450 |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
7451 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
|
7452 |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
7453 _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
|
7454 } |
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
7455 |
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
7456 /* |
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
7457 * 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
|
7458 * 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
|
7459 * 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
|
7460 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7461 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
|
7462 { |
63f61a702b17
Updates to use floats to save the splitbar percentage.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
7463 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
|
7464 |
63f61a702b17
Updates to use floats to save the splitbar percentage.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
7465 if(percent) |
63f61a702b17
Updates to use floats to save the splitbar percentage.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
7466 return *percent; |
63f61a702b17
Updates to use floats to save the splitbar percentage.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
7467 return 0.0; |
3 | 7468 } |
7469 | |
7470 /* | |
7471 * Pack windows (widgets) into a box from the start (or top). | |
7472 * Parameters: | |
7473 * box: Window handle of the box to be packed into. | |
7474 * item: Window handle of the item to be back. | |
7475 * width: Width in pixels of the item or -1 to be self determined. | |
7476 * height: Height in pixels of the item or -1 to be self determined. | |
7477 * hsize: TRUE if the window (widget) should expand horizontally to fill space given. | |
7478 * vsize: TRUE if the window (widget) should expand vertically to fill space given. | |
7479 * pad: Number of pixels of padding around the item. | |
7480 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7481 void API dw_box_pack_start(HWND box, HWND item, int width, int height, int hsize, int vsize, int pad) |
3 | 7482 { |
7483 Box *thisbox; | |
7484 | |
7485 if(WinWindowFromID(box, FID_CLIENT)) | |
7486 { | |
7487 box = WinWindowFromID(box, FID_CLIENT); | |
7488 thisbox = WinQueryWindowPtr(box, QWP_USER); | |
7489 } | |
7490 else | |
7491 thisbox = WinQueryWindowPtr(box, QWP_USER); | |
7492 if(thisbox) | |
7493 { | |
7494 if(thisbox->type == BOXHORZ) | |
7495 dw_box_pack_end_stub(box, item, width, height, hsize, vsize, pad); | |
7496 else | |
7497 dw_box_pack_start_stub(box, item, width, height, hsize, vsize, pad); | |
7498 } | |
7499 } | |
7500 | |
7501 void dw_box_pack_start_stub(HWND box, HWND item, int width, int height, int hsize, int vsize, int pad) | |
7502 { | |
7503 Box *thisbox; | |
7504 | |
7505 if(WinWindowFromID(box, FID_CLIENT)) | |
7506 { | |
7507 box = WinWindowFromID(box, FID_CLIENT); | |
7508 thisbox = WinQueryWindowPtr(box, QWP_USER); | |
7509 hsize = TRUE; | |
7510 vsize = TRUE; | |
7511 } | |
7512 else | |
7513 thisbox = WinQueryWindowPtr(box, QWP_USER); | |
7514 if(thisbox) | |
7515 { | |
7516 int z; | |
7517 Item *tmpitem, *thisitem = thisbox->items; | |
7518 char tmpbuf[100]; | |
7519 | |
7520 tmpitem = malloc(sizeof(Item)*(thisbox->count+1)); | |
7521 | |
7522 for(z=0;z<thisbox->count;z++) | |
7523 { | |
7524 tmpitem[z+1] = thisitem[z]; | |
7525 } | |
7526 | |
7527 WinQueryClassName(item, 99, tmpbuf); | |
7528 | |
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
|
7529 if(strncmp(tmpbuf, "#1", 3)==0) |
3 | 7530 tmpitem[0].type = TYPEBOX; |
7531 else | |
7532 tmpitem[0].type = TYPEITEM; | |
7533 | |
7534 tmpitem[0].hwnd = item; | |
7535 tmpitem[0].origwidth = tmpitem[0].width = width; | |
7536 tmpitem[0].origheight = tmpitem[0].height = height; | |
7537 tmpitem[0].pad = pad; | |
7538 if(hsize) | |
7539 tmpitem[0].hsize = SIZEEXPAND; | |
7540 else | |
7541 tmpitem[0].hsize = SIZESTATIC; | |
7542 | |
7543 if(vsize) | |
7544 tmpitem[0].vsize = SIZEEXPAND; | |
7545 else | |
7546 tmpitem[0].vsize = SIZESTATIC; | |
7547 | |
7548 thisbox->items = tmpitem; | |
7549 | |
7550 if(thisbox->count) | |
7551 free(thisitem); | |
7552 | |
7553 thisbox->count++; | |
7554 | |
7555 WinQueryClassName(item, 99, tmpbuf); | |
37
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
7556 /* Don't set the ownership if it's an entryfield or spinbutton */ |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
7557 if(strncmp(tmpbuf, "#6", 3)!=0 && strncmp(tmpbuf, "#32", 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
|
7558 WinSetOwner(item, box); |
3 | 7559 WinSetParent(item, box, FALSE); |
7560 } | |
7561 } | |
7562 | |
7563 /* The following two functions graciously contributed by Peter Nielsen. */ | |
7564 static ULONG _ParseBuildLevel (char* pchBuffer, ULONG ulSize) { | |
7565 char* pchStart = pchBuffer; | |
7566 char* pchEnd = pchStart + ulSize - 2; | |
7567 | |
7568 while (pchEnd >= pchStart) | |
7569 { | |
7570 if ((pchEnd[0] == '#') && (pchEnd[1] == '@')) | |
7571 { | |
7572 *pchEnd-- = '\0'; | |
7573 while (pchEnd >= pchStart) | |
7574 { | |
7575 if ((pchEnd[0] == '@') && (pchEnd[1] == '#')) | |
7576 { | |
7577 ULONG ulMajor = 0; | |
7578 ULONG ulMinor = 0; | |
7579 | |
7580 char* pch = pchEnd + 2; | |
154
7f8fcce45bdd
Fixed EMX building.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
7581 while (!isdigit ((int)*pch) && *pch) |
3 | 7582 pch++; |
7583 | |
154
7f8fcce45bdd
Fixed EMX building.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
7584 while (isdigit ((int)*pch)) |
3 | 7585 ulMajor = ulMajor * 10 + *pch++ - '0'; |
7586 | |
7587 if (*pch == '.') | |
7588 { | |
154
7f8fcce45bdd
Fixed EMX building.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
7589 while (isdigit ((int)*++pch)) |
3 | 7590 ulMinor = ulMinor * 10 + *pch - '0'; |
7591 } | |
7592 return ((ulMajor << 16) | ulMinor); | |
7593 } | |
7594 pchEnd--; | |
7595 } | |
7596 } | |
7597 pchEnd--; | |
7598 } | |
7599 return (0); | |
7600 } | |
7601 | |
7602 ULONG _GetSystemBuildLevel(void) { | |
7603 /* 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. | |
7604 * 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. | |
7605 */ | |
7606 ULONG ulBootDrive = 0; | |
7607 ULONG ulBuild = 0; | |
7608 if (DosQuerySysInfo (QSV_BOOT_DRIVE, QSV_BOOT_DRIVE, &ulBootDrive, sizeof (ulBootDrive)) == NO_ERROR) | |
7609 { | |
172
0fc45e386376
Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
171
diff
changeset
|
7610 char achFileName[11] = "C:\\OS2KRNL"; |
3 | 7611 HFILE hfile; |
7612 ULONG ulResult; | |
172
0fc45e386376
Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
171
diff
changeset
|
7613 |
0fc45e386376
Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
171
diff
changeset
|
7614 achFileName[0] = (char)('A'+ulBootDrive-1); |
0fc45e386376
Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
171
diff
changeset
|
7615 |
3 | 7616 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) |
7617 { | |
7618 ULONG ulFileSize = 0; | |
7619 if (DosSetFilePtr (hfile, 0, FILE_END, &ulFileSize) == NO_ERROR) | |
7620 { | |
7621 const ULONG ulFirstTry = min (256, ulFileSize); | |
7622 if (DosSetFilePtr (hfile, -(LONG)ulFirstTry, FILE_END, &ulResult) == NO_ERROR) | |
7623 { | |
7624 char *pchBuffer = malloc(ulFirstTry); | |
7625 if (DosRead (hfile, pchBuffer, ulFirstTry, &ulResult) == NO_ERROR) | |
7626 { | |
7627 ulBuild = _ParseBuildLevel (pchBuffer, ulFirstTry); | |
7628 if (ulBuild == 0) | |
7629 { | |
7630 if (DosSetFilePtr (hfile, 0, FILE_BEGIN, &ulResult) == NO_ERROR) | |
7631 { | |
7632 free(pchBuffer); | |
7633 pchBuffer = malloc(ulFileSize); | |
7634 | |
7635 if (DosRead (hfile, pchBuffer, ulFileSize, &ulResult) == NO_ERROR) | |
7636 ulBuild = _ParseBuildLevel (pchBuffer, ulFileSize); | |
7637 } | |
7638 } | |
7639 } | |
7640 free(pchBuffer); | |
7641 } | |
7642 } | |
7643 DosClose (hfile); | |
7644 } | |
7645 } | |
7646 return (ulBuild); | |
7647 } | |
7648 | |
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
|
7649 /* |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
7650 * 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
|
7651 * 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
|
7652 * 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
|
7653 * 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
|
7654 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7655 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
|
7656 { |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
7657 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
|
7658 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
|
7659 |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
7660 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
|
7661 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
|
7662 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
|
7663 |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
7664 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
|
7665 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
|
7666 } |
3 | 7667 |
7668 /* | |
40
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
7669 * 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
|
7670 * Parameters: |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
7671 * 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
|
7672 * 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
|
7673 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7674 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
|
7675 { |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
7676 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
|
7677 |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
7678 if(blah) |
40
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
7679 blah->clickdefault = next; |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
7680 } |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
7681 |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
7682 /* |
3 | 7683 * Returns some information about the current operating environment. |
7684 * Parameters: | |
7685 * env: Pointer to a DWEnv struct. | |
7686 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7687 void API dw_environment_query(DWEnv *env) |
3 | 7688 { |
7689 ULONG Build; | |
7690 | |
7691 if(!env) | |
7692 return; | |
7693 | |
7694 /* The default is OS/2 2.0 */ | |
7695 strcpy(env->osName,"OS/2"); | |
7696 env->MajorVersion = 2; | |
7697 env->MinorVersion = 0; | |
7698 | |
7699 Build = _GetSystemBuildLevel(); | |
7700 env->MinorBuild = Build & 0xFFFF; | |
7701 env->MajorBuild = Build >> 16; | |
7702 | |
7703 if (aulBuffer[0] == 20) | |
7704 { | |
7705 int i = (unsigned int)aulBuffer[1]; | |
7706 if (i > 20) | |
7707 { | |
7708 strcpy(env->osName,"Warp"); | |
7709 env->MajorVersion = (int)i/10; | |
7710 env->MinorVersion = i-(((int)i/10)*10); | |
7711 } | |
7712 else if (i == 10) | |
7713 env->MinorVersion = 1; | |
7714 } | |
15
81833f25b1aa
Added new Dynamic Windows build information to the DWEnv struct.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
14
diff
changeset
|
7715 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
|
7716 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
|
7717 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
|
7718 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
|
7719 env->DWSubVersion = DW_SUB_VERSION; |
3 | 7720 } |
7721 | |
7722 /* | |
7723 * Opens a file dialog and queries user selection. | |
7724 * Parameters: | |
7725 * title: Title bar text for dialog. | |
7726 * defpath: The default path of the open dialog. | |
7727 * ext: Default file extention. | |
7728 * flags: DW_FILE_OPEN or DW_FILE_SAVE. | |
7729 * Returns: | |
7730 * NULL on error. A malloced buffer containing | |
7731 * the file path on success. | |
7732 * | |
7733 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7734 char * API dw_file_browse(char *title, char *defpath, char *ext, int flags) |
3 | 7735 { |
7736 FILEDLG fild; | |
7737 HWND hwndFile; | |
7738 int len; | |
7739 | |
7740 if(defpath) | |
7741 strcpy(fild.szFullFile, defpath); | |
7742 else | |
7743 strcpy(fild.szFullFile, ""); | |
7744 | |
7745 len = strlen(fild.szFullFile); | |
7746 | |
7747 if(len) | |
7748 { | |
7749 if(fild.szFullFile[len-1] != '\\') | |
7750 strcat(fild.szFullFile, "\\"); | |
7751 } | |
7752 strcat(fild.szFullFile, "*"); | |
7753 | |
7754 if(ext) | |
7755 { | |
7756 strcat(fild.szFullFile, "."); | |
7757 strcat(fild.szFullFile, ext); | |
7758 } | |
7759 | |
7760 fild.cbSize = sizeof(FILEDLG); | |
7761 fild.fl = /*FDS_HELPBUTTON |*/ FDS_CENTER | FDS_OPEN_DIALOG; | |
7762 fild.pszTitle = title; | |
7763 fild.pszOKButton = ((flags & DW_FILE_SAVE) ? "Save" : "Open"); | |
7764 fild.ulUser = 0L; | |
7765 fild.pfnDlgProc = (PFNWP)WinDefFileDlgProc; | |
7766 fild.lReturn = 0L; | |
7767 fild.lSRC = 0L; | |
7768 fild.hMod = 0; | |
7769 fild.x = 0; | |
7770 fild.y = 0; | |
7771 fild.pszIType = (PSZ)NULL; | |
7772 fild.papszITypeList = (PAPSZ)NULL; | |
236
5592cdeb29cf
Make sure all platforms have the same typedefs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
235
diff
changeset
|
7773 fild.pszIDrive = (PSZ)NULL; |
3 | 7774 fild.papszIDriveList= (PAPSZ)NULL; |
7775 fild.sEAType = (SHORT)0; | |
7776 fild.papszFQFilename= (PAPSZ)NULL; | |
7777 fild.ulFQFCount = 0L; | |
7778 | |
7779 hwndFile = WinFileDlg(HWND_DESKTOP, HWND_DESKTOP, &fild); | |
7780 if(hwndFile) | |
7781 { | |
7782 switch(fild.lReturn) | |
7783 { | |
7784 case DID_OK: | |
7785 return strdup(fild.szFullFile); | |
7786 case DID_CANCEL: | |
7787 return NULL; | |
7788 } | |
7789 } | |
7790 return NULL; | |
7791 } | |
7792 | |
170
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
7793 /* 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
|
7794 int _SetPath(char *path) |
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
7795 { |
172
0fc45e386376
Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
171
diff
changeset
|
7796 #ifndef __WATCOMC__ |
170
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
7797 if(strlen(path) > 2) |
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
7798 { |
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
7799 if(path[1] == ':') |
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
7800 { |
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
7801 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
|
7802 _chdrive((drive - 'A')+1); |
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
7803 } |
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
7804 } |
172
0fc45e386376
Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
171
diff
changeset
|
7805 #endif |
170
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
7806 return chdir(path); |
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
7807 } |
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
7808 |
3 | 7809 /* |
7810 * Execute and external program in a seperate session. | |
7811 * Parameters: | |
7812 * program: Program name with optional path. | |
7813 * type: Either DW_EXEC_CON or DW_EXEC_GUI. | |
7814 * params: An array of pointers to string arguements. | |
7815 * Returns: | |
7816 * -1 on error. | |
7817 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7818 int API dw_exec(char *program, int type, char **params) |
3 | 7819 { |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
7820 return spawnvp(P_NOWAIT, program, (const char **)params); |
3 | 7821 } |
7822 | |
7823 /* | |
7824 * Loads a web browser pointed at the given URL. | |
7825 * Parameters: | |
7826 * url: Uniform resource locator. | |
7827 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7828 int API dw_browse(char *url) |
3 | 7829 { |
7830 /* Is there a way to find the webbrowser in Unix? */ | |
170
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
7831 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
|
7832 int len, ret; |
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
7833 |
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
7834 olddir = _getcwd(NULL, 1024); |
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
7835 |
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
7836 PrfQueryProfileString(HINI_USERPROFILE, "WPURLDEFAULTSETTINGS", |
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
7837 "DefaultWorkingDir", NULL, browser, 1024); |
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
7838 |
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
7839 if(browser[0]) |
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
7840 _SetPath(browser); |
3 | 7841 |
7842 PrfQueryProfileString(HINI_USERPROFILE, "WPURLDEFAULTSETTINGS", | |
7843 "DefaultBrowserExe", NULL, browser, 1024); | |
7844 | |
20
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
7845 len = strlen(browser) - strlen("explore.exe"); |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
7846 |
3 | 7847 execargs[0] = browser; |
7848 execargs[1] = url; | |
7849 execargs[2] = NULL; | |
7850 | |
20
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
7851 /* 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
|
7852 * 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
|
7853 */ |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
7854 if(len > 0) |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
7855 { |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
7856 if(stricmp(&browser[len], "explore.exe") == 0) |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
7857 { |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
7858 int newlen, z; |
172
0fc45e386376
Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
171
diff
changeset
|
7859 newurl = malloc(strlen(url) + 2); |
20
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
7860 sprintf(newurl, "file:///%s", &url[7]); |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
7861 newlen = strlen(newurl); |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
7862 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
|
7863 { |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
7864 if(newurl[z] == '|') |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
7865 newurl[z] = ':'; |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
7866 if(newurl[z] == '/') |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
7867 newurl[z] = '\\'; |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
7868 } |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
7869 execargs[1] = newurl; |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
7870 } |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
7871 } |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
7872 |
170
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
7873 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
|
7874 |
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
7875 if(olddir) |
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
7876 { |
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
7877 _SetPath(olddir); |
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
7878 free(olddir); |
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
7879 } |
172
0fc45e386376
Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
171
diff
changeset
|
7880 if(newurl) |
0fc45e386376
Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
171
diff
changeset
|
7881 free(newurl); |
170
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
7882 return ret; |
3 | 7883 } |
7884 | |
7885 /* | |
7886 * Returns a pointer to a static buffer which containes the | |
7887 * current user directory. Or the root directory (C:\ on | |
7888 * OS/2 and Windows). | |
7889 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7890 char * API dw_user_dir(void) |
3 | 7891 { |
7892 static char _user_dir[1024] = ""; | |
7893 | |
7894 if(!_user_dir[0]) | |
7895 { | |
7896 char *home = getenv("HOME"); | |
7897 | |
7898 if(home) | |
7899 strcpy(_user_dir, home); | |
7900 else | |
7901 strcpy(_user_dir, "C:\\"); | |
7902 } | |
7903 return _user_dir; | |
7904 } | |
7905 | |
7906 /* | |
7907 * Call a function from the window (widget)'s context. | |
7908 * Parameters: | |
7909 * handle: Window handle of the widget. | |
7910 * function: Function pointer to be called. | |
7911 * data: Pointer to the data to be passed to the function. | |
7912 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7913 void API dw_window_function(HWND handle, void *function, void *data) |
3 | 7914 { |
7915 WinSendMsg(handle, WM_USER, (MPARAM)function, (MPARAM)data); | |
7916 } | |
7917 | |
90
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7918 /* 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
|
7919 * 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
|
7920 * 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
|
7921 */ |
159
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
7922 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
|
7923 { |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7924 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
|
7925 |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7926 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
|
7927 { |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7928 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
|
7929 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
|
7930 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
|
7931 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7932 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
|
7933 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7934 |
159
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
7935 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
|
7936 { |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
7937 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
|
7938 |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7939 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
|
7940 { |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7941 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
|
7942 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
|
7943 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7944 else |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7945 { |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7946 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
|
7947 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
|
7948 { |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7949 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
|
7950 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
|
7951 |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7952 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
|
7953 |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7954 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
|
7955 *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
|
7956 else |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7957 { |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7958 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
|
7959 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
|
7960 { |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7961 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
|
7962 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
|
7963 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7964 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
|
7965 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
|
7966 else |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7967 *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
|
7968 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7969 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
|
7970 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7971 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7972 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
|
7973 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7974 |
159
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
7975 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
|
7976 { |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7977 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
|
7978 |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7979 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
|
7980 { |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7981 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
|
7982 { |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7983 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
|
7984 { |
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
|
7985 *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
|
7986 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
|
7987 free(tmp); |
180
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
7988 if(!all) |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
7989 return 0; |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
7990 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
|
7991 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7992 else |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7993 { |
180
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
7994 /* If all is true we should |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
7995 * never get here. |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
7996 */ |
90
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7997 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
|
7998 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
|
7999 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
|
8000 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
|
8001 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8002 } |
180
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
8003 else |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
8004 { |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
8005 prev = tmp; |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
8006 tmp = tmp->next; |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
8007 } |
90
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8008 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8009 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
|
8010 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8011 |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8012 /* |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8013 * 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
|
8014 * Parameters: |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8015 * 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
|
8016 * 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
|
8017 * 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
|
8018 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
8019 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
|
8020 { |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8021 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
|
8022 |
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
|
8023 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
|
8024 { |
180
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
8025 if(!dataname) |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
8026 return; |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
8027 |
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
|
8028 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
|
8029 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
|
8030 } |
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
8031 |
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
8032 if(data) |
159
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
8033 _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
|
8034 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
|
8035 { |
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
8036 if(dataname) |
159
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
8037 _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
|
8038 else |
159
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
8039 _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
|
8040 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8041 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8042 |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8043 /* |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8044 * 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
|
8045 * Parameters: |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8046 * 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
|
8047 * 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
|
8048 * 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
|
8049 */ |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8050 void *dw_window_get_data(HWND window, char *dataname) |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8051 { |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8052 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
|
8053 |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8054 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
|
8055 { |
159
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
8056 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
|
8057 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
|
8058 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
|
8059 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8060 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
|
8061 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8062 |
3 | 8063 /* |
195
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8064 * 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
|
8065 * Parameters: |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8066 * 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
|
8067 * 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
|
8068 * 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
|
8069 * Returns: |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8070 * 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
|
8071 */ |
199
b955228477b3
Removed the window parameter to dw_timer_connect() it was no needed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
195
diff
changeset
|
8072 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
|
8073 { |
b955228477b3
Removed the window parameter to dw_timer_connect() it was no needed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
195
diff
changeset
|
8074 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
|
8075 { |
b955228477b3
Removed the window parameter to dw_timer_connect() it was no needed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
195
diff
changeset
|
8076 int timerid = WinStartTimer(dwhab, NULLHANDLE, timerid, interval); |
b955228477b3
Removed the window parameter to dw_timer_connect() it was no needed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
195
diff
changeset
|
8077 |
b955228477b3
Removed the window parameter to dw_timer_connect() it was no needed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
195
diff
changeset
|
8078 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
|
8079 { |
b955228477b3
Removed the window parameter to dw_timer_connect() it was no needed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
195
diff
changeset
|
8080 _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
|
8081 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
|
8082 } |
195
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8083 } |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8084 return 0; |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8085 } |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8086 |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8087 /* |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8088 * Removes timer callback. |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8089 * Parameters: |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8090 * 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
|
8091 */ |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8092 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
|
8093 { |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8094 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
|
8095 |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8096 /* 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
|
8097 if(!id) |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8098 return; |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8099 |
199
b955228477b3
Removed the window parameter to dw_timer_connect() it was no needed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
195
diff
changeset
|
8100 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
|
8101 |
195
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8102 while(tmp) |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8103 { |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8104 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
|
8105 { |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8106 if(prev) |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8107 { |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8108 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
|
8109 free(tmp); |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8110 tmp = prev->next; |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8111 } |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8112 else |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8113 { |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8114 Root = tmp->next; |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8115 free(tmp); |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8116 tmp = Root; |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8117 } |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8118 } |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8119 else |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8120 { |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8121 prev = tmp; |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8122 tmp = tmp->next; |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8123 } |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8124 } |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8125 } |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8126 |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8127 /* |
3 | 8128 * Add a callback to a window event. |
8129 * Parameters: | |
8130 * window: Window handle of signal to be called back. | |
8131 * signame: A string pointer identifying which signal to be hooked. | |
8132 * sigfunc: The pointer to the function to be used as the callback. | |
8133 * data: User data to be passed to the handler function. | |
8134 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
8135 void API dw_signal_connect(HWND window, char *signame, void *sigfunc, void *data) |
3 | 8136 { |
8137 ULONG message = 0L; | |
8138 | |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
8139 if(strcmp(signame, "lose-focus") == 0) |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
8140 { |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
8141 char tmpbuf[100]; |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
8142 |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
8143 WinQueryClassName(window, 99, tmpbuf); |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
8144 |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
8145 if(strncmp(tmpbuf, "#2", 3) == 0) |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
8146 { |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
8147 HENUM henum = WinBeginEnumWindows(window); |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
8148 HWND child = WinGetNextWindow(henum); |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
8149 WinEndEnumWindows(henum); |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
8150 if(child) |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
8151 window = child; |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
8152 } |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
8153 } |
3 | 8154 if(window && signame && sigfunc) |
8155 { | |
8156 if((message = _findsigmessage(signame)) != 0) | |
195
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8157 _new_signal(message, window, 0, sigfunc, data); |
3 | 8158 } |
8159 } | |
8160 | |
8161 /* | |
8162 * Removes callbacks for a given window with given name. | |
8163 * Parameters: | |
8164 * window: Window handle of callback to be removed. | |
8165 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
8166 void API dw_signal_disconnect_by_name(HWND window, char *signame) |
3 | 8167 { |
8168 SignalHandler *prev = NULL, *tmp = Root; | |
8169 ULONG message; | |
8170 | |
8171 if(!window || !signame || (message = _findsigmessage(signame)) == 0) | |
8172 return; | |
8173 | |
8174 while(tmp) | |
8175 { | |
8176 if(tmp->window == window && tmp->message == message) | |
8177 { | |
8178 if(prev) | |
8179 { | |
8180 prev->next = tmp->next; | |
8181 free(tmp); | |
8182 tmp = prev->next; | |
8183 } | |
8184 else | |
8185 { | |
8186 Root = tmp->next; | |
8187 free(tmp); | |
8188 tmp = Root; | |
8189 } | |
8190 } | |
8191 else | |
8192 { | |
8193 prev = tmp; | |
8194 tmp = tmp->next; | |
8195 } | |
8196 } | |
8197 } | |
8198 | |
8199 /* | |
8200 * Removes all callbacks for a given window. | |
8201 * Parameters: | |
8202 * window: Window handle of callback to be removed. | |
8203 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
8204 void API dw_signal_disconnect_by_window(HWND window) |
3 | 8205 { |
8206 SignalHandler *prev = NULL, *tmp = Root; | |
8207 | |
8208 while(tmp) | |
8209 { | |
8210 if(tmp->window == window) | |
8211 { | |
8212 if(prev) | |
8213 { | |
8214 prev->next = tmp->next; | |
8215 free(tmp); | |
8216 tmp = prev->next; | |
8217 } | |
8218 else | |
8219 { | |
8220 Root = tmp->next; | |
8221 free(tmp); | |
8222 tmp = Root; | |
8223 } | |
8224 } | |
8225 else | |
8226 { | |
8227 prev = tmp; | |
8228 tmp = tmp->next; | |
8229 } | |
8230 } | |
8231 } | |
8232 | |
8233 /* | |
8234 * Removes all callbacks for a given window with specified data. | |
8235 * Parameters: | |
8236 * window: Window handle of callback to be removed. | |
8237 * data: Pointer to the data to be compared against. | |
8238 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
8239 void API dw_signal_disconnect_by_data(HWND window, void *data) |
3 | 8240 { |
8241 SignalHandler *prev = NULL, *tmp = Root; | |
8242 | |
8243 while(tmp) | |
8244 { | |
8245 if(tmp->window == window && tmp->data == data) | |
8246 { | |
8247 if(prev) | |
8248 { | |
8249 prev->next = tmp->next; | |
8250 free(tmp); | |
8251 tmp = prev->next; | |
8252 } | |
8253 else | |
8254 { | |
8255 Root = tmp->next; | |
8256 free(tmp); | |
8257 tmp = Root; | |
8258 } | |
8259 } | |
8260 else | |
8261 { | |
8262 prev = tmp; | |
8263 tmp = tmp->next; | |
8264 } | |
8265 } | |
8266 } | |
8267 | |
195
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8268 |