Mercurial > dwindows
annotate win/dw.c @ 429:f977c80a1dfa
Check for inconsistent parameters in dw_box_pack_start() and
dw_box_pack_end(). Throw up messagebox if an error.
author | mhessling@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Tue, 27 May 2003 03:41:57 +0000 |
parents | 4fe2df53ec9f |
children | 98d6c00fe11e |
rev | line source |
---|---|
3 | 1 /* |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
281
diff
changeset
|
2 /* |
3 | 3 * Dynamic Windows: |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4 * A GTK like implementation of the Win32 GUI |
3 | 5 * |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
281
diff
changeset
|
6 * (C) 2000-2003 Brian Smith <dbsoft@technologist.com> |
369
39983df2b93d
Updated the license information, and copyrights. Code to do background
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
355
diff
changeset
|
7 * (C) 2003 Mark Hessling <m.hessling@qut.edu.au> |
3 | 8 * |
9 */ | |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
10 #define _WIN32_IE 0x0500 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
11 #define WINVER 0x400 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
12 #include <windows.h> |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
13 #include <windowsx.h> |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
14 #include <commctrl.h> |
75
c629838d9805
Updated to latest DW, and updated the Makefile to install the header files
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
73
diff
changeset
|
15 #include <shlwapi.h> |
3 | 16 #include <stdlib.h> |
17 #include <string.h> | |
18 #include <stdio.h> | |
19 #include <process.h> | |
37
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
20 #include <time.h> |
3 | 21 #include "dw.h" |
22 | |
93
98cce029a611
Changed handling of menu item click events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
90
diff
changeset
|
23 HWND popup = (HWND)NULL, hwndBubble = (HWND)NULL, hwndBubbleLast, DW_HWND_OBJECT = (HWND)NULL; |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
24 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
25 HINSTANCE DWInstance = NULL; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
26 |
75
c629838d9805
Updated to latest DW, and updated the Makefile to install the header files
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
73
diff
changeset
|
27 DWORD dwVersion = 0, dwComctlVer = 0; |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
28 DWTID _dwtid = -1; |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
29 |
75
c629838d9805
Updated to latest DW, and updated the Makefile to install the header files
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
73
diff
changeset
|
30 #define PACKVERSION(major,minor) MAKELONG(minor,major) |
c629838d9805
Updated to latest DW, and updated the Makefile to install the header files
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
73
diff
changeset
|
31 |
c629838d9805
Updated to latest DW, and updated the Makefile to install the header files
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
73
diff
changeset
|
32 #define IS_IE5PLUS (dwComctlVer >= PACKVERSION(5,80)) |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
33 |
95
636c37ca7238
Avoid allocating super huge buffers when dealing with the MLEs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
34 #ifndef MIN |
636c37ca7238
Avoid allocating super huge buffers when dealing with the MLEs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
35 #define MIN(a, b) (((a) < (b)) ? (a) : (b)) |
636c37ca7238
Avoid allocating super huge buffers when dealing with the MLEs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
36 #endif |
636c37ca7238
Avoid allocating super huge buffers when dealing with the MLEs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
37 |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
38 int main(int argc, char *argv[]); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
39 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
40 #define ICON_INDEX_LIMIT 200 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
41 HICON lookup[200]; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
42 HIMAGELIST hSmall = 0, hLarge = 0; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
43 |
105
ad95fc623ff3
Some changes to the container optimization code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
104
diff
changeset
|
44 /* Special flag used for internal tracking */ |
ad95fc623ff3
Some changes to the container optimization code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
104
diff
changeset
|
45 #define DW_CFA_RESERVED (1 << 30) |
ad95fc623ff3
Some changes to the container optimization code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
104
diff
changeset
|
46 |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
47 #define THREAD_LIMIT 128 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
48 COLORREF _foreground[THREAD_LIMIT]; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
49 COLORREF _background[THREAD_LIMIT]; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
50 HPEN _hPen[THREAD_LIMIT]; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
51 HBRUSH _hBrush[THREAD_LIMIT]; |
3 | 52 |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
53 BYTE _red[] = { 0x00, 0xbb, 0x00, 0xaa, 0x00, 0xbb, 0x00, 0xaa, 0x77, |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
54 0xff, 0x00, 0xee, 0x00, 0xff, 0x00, 0xff, 0xaa, 0x00 }; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
55 BYTE _green[] = { 0x00, 0x00, 0xbb, 0xaa, 0x00, 0x00, 0xbb, 0xaa, 0x77, |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
56 0x00, 0xff, 0xee, 0x00, 0x00, 0xee, 0xff, 0xaa, 0x00 }; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
57 BYTE _blue[] = { 0x00, 0x00, 0x00, 0x00, 0xcc, 0xbb, 0xbb, 0xaa, 0x77, |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
58 0x00, 0x00, 0x00, 0xff, 0xff, 0xee, 0xff, 0xaa, 0x00}; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
59 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
60 HBRUSH _colors[18]; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
61 |
3 | 62 |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
63 void _resize_notebook_page(HWND handle, int pageid); |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
64 void _handle_splitbar_resize(HWND hwnd, float percent, int type, int x, int y); |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
65 int _lookup_icon(HWND handle, HICON hicon, int type); |
299
2a97f8d9b297
Use DrawStatusText() to make the status lines, instead of doing it ourself.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
298
diff
changeset
|
66 HFONT _acquire_font(HWND handle, char *fontname); |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
67 |
3 | 68 typedef struct _sighandler |
69 { | |
70 struct _sighandler *next; | |
71 ULONG message; | |
72 HWND window; | |
197
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
73 int id; |
3 | 74 void *signalfunction; |
75 void *data; | |
76 | |
77 } SignalHandler; | |
78 | |
79 SignalHandler *Root = NULL; | |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
80 int _index; |
3 | 81 |
82 typedef struct | |
83 { | |
84 ULONG message; | |
85 char name[30]; | |
86 | |
87 } SignalList; | |
88 | |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
59
diff
changeset
|
89 static int in_checkbox_handler = 0; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
59
diff
changeset
|
90 |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
91 /* List of signals and their equivilent Win32 message */ |
332
7b0f00729a32
Implement switch-page signal for notebooks. Bit of a bug in that it fires
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
328
diff
changeset
|
92 #define SIGNALMAX 15 |
3 | 93 |
94 SignalList SignalTranslate[SIGNALMAX] = { | |
307
324587c06cea
Use the signal #defines internally so all that is required to change
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
303
diff
changeset
|
95 { WM_SIZE, DW_SIGNAL_CONFIGURE }, |
324587c06cea
Use the signal #defines internally so all that is required to change
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
303
diff
changeset
|
96 { WM_CHAR, DW_SIGNAL_KEY_PRESS }, |
324587c06cea
Use the signal #defines internally so all that is required to change
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
303
diff
changeset
|
97 { WM_LBUTTONDOWN, DW_SIGNAL_BUTTON_PRESS }, |
324587c06cea
Use the signal #defines internally so all that is required to change
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
303
diff
changeset
|
98 { WM_LBUTTONUP, DW_SIGNAL_BUTTON_PRESS }, |
324587c06cea
Use the signal #defines internally so all that is required to change
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
303
diff
changeset
|
99 { WM_MOUSEMOVE, DW_SIGNAL_MOTION_NOTIFY }, |
324587c06cea
Use the signal #defines internally so all that is required to change
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
303
diff
changeset
|
100 { WM_CLOSE, DW_SIGNAL_DELETE }, |
324587c06cea
Use the signal #defines internally so all that is required to change
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
303
diff
changeset
|
101 { WM_PAINT, DW_SIGNAL_EXPOSE }, |
324587c06cea
Use the signal #defines internally so all that is required to change
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
303
diff
changeset
|
102 { WM_COMMAND, DW_SIGNAL_CLICKED }, |
324587c06cea
Use the signal #defines internally so all that is required to change
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
303
diff
changeset
|
103 { NM_DBLCLK, DW_SIGNAL_ITEM_ENTER }, |
324587c06cea
Use the signal #defines internally so all that is required to change
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
303
diff
changeset
|
104 { NM_RCLICK, DW_SIGNAL_ITEM_CONTEXT }, |
324587c06cea
Use the signal #defines internally so all that is required to change
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
303
diff
changeset
|
105 { LBN_SELCHANGE, DW_SIGNAL_LIST_SELECT }, |
324587c06cea
Use the signal #defines internally so all that is required to change
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
303
diff
changeset
|
106 { TVN_SELCHANGED, DW_SIGNAL_ITEM_SELECT }, |
324587c06cea
Use the signal #defines internally so all that is required to change
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
303
diff
changeset
|
107 { WM_SETFOCUS, DW_SIGNAL_SET_FOCUS }, |
332
7b0f00729a32
Implement switch-page signal for notebooks. Bit of a bug in that it fires
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
328
diff
changeset
|
108 { WM_VSCROLL, DW_SIGNAL_VALUE_CHANGED }, |
7b0f00729a32
Implement switch-page signal for notebooks. Bit of a bug in that it fires
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
328
diff
changeset
|
109 { TCN_SELCHANGE, DW_SIGNAL_SWITCH_PAGE } |
3 | 110 }; |
111 | |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
112 #ifdef BUILD_DLL |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
113 void Win32_Set_Instance(HINSTANCE hInstance) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
114 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
115 DWInstance = hInstance; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
116 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
117 #else |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
118 char **_convertargs(int *count, char *start) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
119 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
120 char *tmp, *argstart, **argv; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
121 int loc = 0, inquotes = 0; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
122 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
123 (*count) = 1; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
124 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
125 tmp = start; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
126 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
127 /* Count the number of entries */ |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
128 if(*start) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
129 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
130 (*count)++; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
131 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
132 while(*tmp) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
133 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
134 if(*tmp == '"' && inquotes) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
135 inquotes = 0; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
136 else if(*tmp == '"' && !inquotes) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
137 inquotes = 1; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
138 else if(*tmp == ' ' && !inquotes) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
139 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
140 /* Push past any white space */ |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
141 while(*(tmp+1) == ' ') |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
142 tmp++; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
143 /* If we aren't at the end of the command |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
144 * line increment the count. |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
145 */ |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
146 if(*(tmp+1)) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
147 (*count)++; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
148 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
149 tmp++; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
150 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
151 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
152 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
153 argv = (char **)malloc(sizeof(char *) * ((*count)+1)); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
154 argv[0] = malloc(260); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
155 GetModuleFileName(DWInstance, argv[0], 260); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
156 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
157 argstart = tmp = start; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
158 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
159 if(*start) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
160 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
161 loc = 1; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
162 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
163 while(*tmp) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
164 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
165 if(*tmp == '"' && inquotes) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
166 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
167 *tmp = 0; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
168 inquotes = 0; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
169 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
170 else if(*tmp == '"' && !inquotes) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
171 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
172 argstart = tmp+1; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
173 inquotes = 1; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
174 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
175 else if(*tmp == ' ' && !inquotes) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
176 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
177 *tmp = 0; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
178 argv[loc] = strdup(argstart); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
179 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
180 /* Push past any white space */ |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
181 while(*(tmp+1) == ' ') |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
182 tmp++; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
183 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
184 /* Move the start pointer */ |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
185 argstart = tmp+1; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
186 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
187 /* If we aren't at the end of the command |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
188 * line increment the count. |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
189 */ |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
190 if(*(tmp+1)) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
191 loc++; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
192 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
193 tmp++; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
194 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
195 if(*argstart) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
196 argv[loc] = strdup(argstart); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
197 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
198 argv[loc+1] = NULL; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
199 return argv; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
200 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
201 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
202 /* Ok this is a really big hack but what the hell ;) */ |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
203 int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
204 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
205 char **argv; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
206 int argc; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
207 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
208 DWInstance = hInstance; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
209 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
210 argv = _convertargs(&argc, lpCmdLine); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
211 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
212 return main(argc, argv); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
213 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
214 #endif |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
215 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
216 /* This should return true for WinNT/2K/XP and false on Win9x */ |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
217 int IsWinNT(void) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
218 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
219 static int isnt = -1; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
220 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
221 if(isnt == -1) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
222 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
223 if (GetVersion() < 0x80000000) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
224 isnt = 1; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
225 else |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
226 isnt = 0; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
227 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
228 return isnt; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
229 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
230 |
75
c629838d9805
Updated to latest DW, and updated the Makefile to install the header files
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
73
diff
changeset
|
231 DWORD GetDllVersion(LPCTSTR lpszDllName) |
c629838d9805
Updated to latest DW, and updated the Makefile to install the header files
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
73
diff
changeset
|
232 { |
c629838d9805
Updated to latest DW, and updated the Makefile to install the header files
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
73
diff
changeset
|
233 |
c629838d9805
Updated to latest DW, and updated the Makefile to install the header files
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
73
diff
changeset
|
234 HINSTANCE hinstDll; |
c629838d9805
Updated to latest DW, and updated the Makefile to install the header files
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
73
diff
changeset
|
235 DWORD dwVersion = 0; |
c629838d9805
Updated to latest DW, and updated the Makefile to install the header files
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
73
diff
changeset
|
236 |
c629838d9805
Updated to latest DW, and updated the Makefile to install the header files
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
73
diff
changeset
|
237 hinstDll = LoadLibrary(lpszDllName); |
c629838d9805
Updated to latest DW, and updated the Makefile to install the header files
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
73
diff
changeset
|
238 |
c629838d9805
Updated to latest DW, and updated the Makefile to install the header files
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
73
diff
changeset
|
239 if(hinstDll) |
c629838d9805
Updated to latest DW, and updated the Makefile to install the header files
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
73
diff
changeset
|
240 { |
c629838d9805
Updated to latest DW, and updated the Makefile to install the header files
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
73
diff
changeset
|
241 DLLGETVERSIONPROC pDllGetVersion; |
c629838d9805
Updated to latest DW, and updated the Makefile to install the header files
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
73
diff
changeset
|
242 |
c629838d9805
Updated to latest DW, and updated the Makefile to install the header files
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
73
diff
changeset
|
243 pDllGetVersion = (DLLGETVERSIONPROC) GetProcAddress(hinstDll, "DllGetVersion"); |
c629838d9805
Updated to latest DW, and updated the Makefile to install the header files
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
73
diff
changeset
|
244 |
c629838d9805
Updated to latest DW, and updated the Makefile to install the header files
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
73
diff
changeset
|
245 /* Because some DLLs might not implement this function, you |
c629838d9805
Updated to latest DW, and updated the Makefile to install the header files
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
73
diff
changeset
|
246 * must test for it explicitly. Depending on the particular |
c629838d9805
Updated to latest DW, and updated the Makefile to install the header files
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
73
diff
changeset
|
247 * DLL, the lack of a DllGetVersion function can be a useful |
c629838d9805
Updated to latest DW, and updated the Makefile to install the header files
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
73
diff
changeset
|
248 * indicator of the version. |
c629838d9805
Updated to latest DW, and updated the Makefile to install the header files
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
73
diff
changeset
|
249 */ |
c629838d9805
Updated to latest DW, and updated the Makefile to install the header files
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
73
diff
changeset
|
250 if(pDllGetVersion) |
c629838d9805
Updated to latest DW, and updated the Makefile to install the header files
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
73
diff
changeset
|
251 { |
c629838d9805
Updated to latest DW, and updated the Makefile to install the header files
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
73
diff
changeset
|
252 DLLVERSIONINFO dvi; |
c629838d9805
Updated to latest DW, and updated the Makefile to install the header files
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
73
diff
changeset
|
253 HRESULT hr; |
c629838d9805
Updated to latest DW, and updated the Makefile to install the header files
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
73
diff
changeset
|
254 |
c629838d9805
Updated to latest DW, and updated the Makefile to install the header files
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
73
diff
changeset
|
255 ZeroMemory(&dvi, sizeof(dvi)); |
c629838d9805
Updated to latest DW, and updated the Makefile to install the header files
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
73
diff
changeset
|
256 dvi.cbSize = sizeof(dvi); |
c629838d9805
Updated to latest DW, and updated the Makefile to install the header files
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
73
diff
changeset
|
257 |
c629838d9805
Updated to latest DW, and updated the Makefile to install the header files
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
73
diff
changeset
|
258 hr = (*pDllGetVersion)(&dvi); |
c629838d9805
Updated to latest DW, and updated the Makefile to install the header files
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
73
diff
changeset
|
259 |
c629838d9805
Updated to latest DW, and updated the Makefile to install the header files
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
73
diff
changeset
|
260 if(SUCCEEDED(hr)) |
c629838d9805
Updated to latest DW, and updated the Makefile to install the header files
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
73
diff
changeset
|
261 { |
c629838d9805
Updated to latest DW, and updated the Makefile to install the header files
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
73
diff
changeset
|
262 dwVersion = PACKVERSION(dvi.dwMajorVersion, dvi.dwMinorVersion); |
c629838d9805
Updated to latest DW, and updated the Makefile to install the header files
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
73
diff
changeset
|
263 } |
c629838d9805
Updated to latest DW, and updated the Makefile to install the header files
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
73
diff
changeset
|
264 } |
c629838d9805
Updated to latest DW, and updated the Makefile to install the header files
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
73
diff
changeset
|
265 |
c629838d9805
Updated to latest DW, and updated the Makefile to install the header files
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
73
diff
changeset
|
266 FreeLibrary(hinstDll); |
c629838d9805
Updated to latest DW, and updated the Makefile to install the header files
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
73
diff
changeset
|
267 } |
c629838d9805
Updated to latest DW, and updated the Makefile to install the header files
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
73
diff
changeset
|
268 return dwVersion; |
c629838d9805
Updated to latest DW, and updated the Makefile to install the header files
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
73
diff
changeset
|
269 } |
c629838d9805
Updated to latest DW, and updated the Makefile to install the header files
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
73
diff
changeset
|
270 |
3 | 271 /* This function adds a signal handler callback into the linked list. |
272 */ | |
197
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
273 void _new_signal(ULONG message, HWND window, int id, void *signalfunction, void *data) |
3 | 274 { |
275 SignalHandler *new = malloc(sizeof(SignalHandler)); | |
276 | |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
277 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
|
278 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
|
279 |
3 | 280 new->message = message; |
281 new->window = window; | |
197
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
282 new->id = id; |
3 | 283 new->signalfunction = signalfunction; |
284 new->data = data; | |
285 new->next = NULL; | |
286 | |
287 if (!Root) | |
288 Root = new; | |
289 else | |
290 { | |
291 SignalHandler *prev = NULL, *tmp = Root; | |
292 while(tmp) | |
293 { | |
68
8d6100960adf
Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
294 if(tmp->message == message && |
8d6100960adf
Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
295 tmp->window == window && |
8d6100960adf
Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
296 tmp->signalfunction == signalfunction) |
8d6100960adf
Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
297 { |
8d6100960adf
Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
298 tmp->data = data; |
8d6100960adf
Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
299 free(new); |
8d6100960adf
Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
300 return; |
8d6100960adf
Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
301 } |
3 | 302 prev = tmp; |
303 tmp = tmp->next; | |
304 } | |
305 if(prev) | |
306 prev->next = new; | |
307 else | |
308 Root = new; | |
309 } | |
310 } | |
311 | |
312 /* Finds the message number for a given signal name */ | |
313 ULONG _findsigmessage(char *signame) | |
314 { | |
315 int z; | |
316 | |
317 for(z=0;z<SIGNALMAX;z++) | |
318 { | |
319 if(stricmp(signame, SignalTranslate[z].name) == 0) | |
320 return SignalTranslate[z].message; | |
321 } | |
322 return 0L; | |
323 } | |
324 | |
325 /* This function removes and handlers on windows and frees | |
326 * the user memory allocated to it. | |
327 */ | |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
328 BOOL CALLBACK _free_window_memory(HWND handle, LPARAM lParam) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
329 { |
82
aec9a0b0b539
Fixes for a resource leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
79
diff
changeset
|
330 ColorInfo *thiscinfo = (ColorInfo *)GetWindowLong(handle, GWL_USERDATA); |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
331 HFONT oldfont = (HFONT)SendMessage(handle, WM_GETFONT, 0, 0); |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
332 HICON oldicon = (HICON)SendMessage(handle, WM_GETICON, 0, 0); |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
333 char tmpbuf[100]; |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
334 |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
335 /* Delete font, icon and bitmap GDI objects in use */ |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
336 if(oldfont) |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
337 DeleteObject(oldfont); |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
338 if(oldicon) |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
339 DeleteObject(oldicon); |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
340 |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
341 GetClassName(handle, tmpbuf, 99); |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
342 |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
343 if(strnicmp(tmpbuf, STATICCLASSNAME, strlen(STATICCLASSNAME)+1)==0) |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
344 { |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
345 HBITMAP oldbitmap = (HBITMAP)SendMessage(handle, STM_GETIMAGE, IMAGE_BITMAP, 0); |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
346 |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
347 if(oldbitmap) |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
348 DeleteObject(oldbitmap); |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
349 } |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
350 if(strnicmp(tmpbuf, BUTTONCLASSNAME, strlen(BUTTONCLASSNAME)+1)==0) |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
351 { |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
352 HBITMAP oldbitmap = (HBITMAP)SendMessage(handle, BM_GETIMAGE, IMAGE_BITMAP, 0); |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
353 |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
354 if(oldbitmap) |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
355 DeleteObject(oldbitmap); |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
356 } |
180
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
177
diff
changeset
|
357 else if(strnicmp(tmpbuf, FRAMECLASSNAME, strlen(FRAMECLASSNAME)+1)==0) |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
177
diff
changeset
|
358 { |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
177
diff
changeset
|
359 Box *box = (Box *)thiscinfo; |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
177
diff
changeset
|
360 |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
177
diff
changeset
|
361 if(box->count && box->items) |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
177
diff
changeset
|
362 free(box->items); |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
177
diff
changeset
|
363 } |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
177
diff
changeset
|
364 else if(strnicmp(tmpbuf, SplitbarClassName, strlen(SplitbarClassName)+1)==0) |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
177
diff
changeset
|
365 { |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
177
diff
changeset
|
366 void *data = dw_window_get_data(handle, "_dw_percent"); |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
177
diff
changeset
|
367 |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
177
diff
changeset
|
368 if(data) |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
177
diff
changeset
|
369 free(data); |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
177
diff
changeset
|
370 } |
291
70480069392b
Fixed memory leak in the tree control on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
284
diff
changeset
|
371 else if(strnicmp(tmpbuf, WC_TREEVIEW, strlen(WC_TREEVIEW)+1)==0) |
70480069392b
Fixed memory leak in the tree control on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
284
diff
changeset
|
372 { |
70480069392b
Fixed memory leak in the tree control on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
284
diff
changeset
|
373 dw_tree_clear(handle); |
70480069392b
Fixed memory leak in the tree control on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
284
diff
changeset
|
374 } |
180
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
177
diff
changeset
|
375 else if(strnicmp(tmpbuf, WC_TABCONTROL, strlen(WC_TABCONTROL)+1)==0) /* Notebook */ |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
376 { |
191
634625c3239d
Fixes for dw_color_xxxx_set() to accept OS/2 style colors, and fixed a
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
185
diff
changeset
|
377 NotebookPage **array = (NotebookPage **)dw_window_get_data(handle, "_dw_array"); |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
378 |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
379 if(array) |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
380 { |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
381 int z, refid = -1; |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
382 |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
383 for(z=0;z<256;z++) |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
384 { |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
385 if(array[z]) |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
386 { |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
387 _free_window_memory(array[z]->hwnd, 0); |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
388 EnumChildWindows(array[z]->hwnd, _free_window_memory, 0); |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
389 DestroyWindow(array[z]->hwnd); |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
390 free(array[z]); |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
391 } |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
392 } |
343
bab5cd8dd93f
Forgot to free the array of pointers in the notebook control.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
341
diff
changeset
|
393 free(array); |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
394 } |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
395 } |
3 | 396 |
397 dw_signal_disconnect_by_window(handle); | |
398 | |
82
aec9a0b0b539
Fixes for a resource leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
79
diff
changeset
|
399 if(thiscinfo) |
3 | 400 { |
180
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
177
diff
changeset
|
401 SubclassWindow(handle, thiscinfo->pOldProc); |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
177
diff
changeset
|
402 |
90
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
403 /* Delete the brush so as not to leak GDI objects */ |
82
aec9a0b0b539
Fixes for a resource leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
79
diff
changeset
|
404 if(thiscinfo->hbrush) |
aec9a0b0b539
Fixes for a resource leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
79
diff
changeset
|
405 DeleteObject(thiscinfo->hbrush); |
aec9a0b0b539
Fixes for a resource leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
79
diff
changeset
|
406 |
90
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
407 /* Free user data linked list memory */ |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
408 if(thiscinfo->root) |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
409 dw_window_set_data(handle, NULL, NULL); |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
410 |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
411 SetWindowLong(handle, GWL_USERDATA, 0); |
82
aec9a0b0b539
Fixes for a resource leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
79
diff
changeset
|
412 free(thiscinfo); |
3 | 413 } |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
414 return TRUE; |
3 | 415 } |
416 | |
191
634625c3239d
Fixes for dw_color_xxxx_set() to accept OS/2 style colors, and fixed a
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
185
diff
changeset
|
417 /* Convert to our internal color scheme */ |
634625c3239d
Fixes for dw_color_xxxx_set() to accept OS/2 style colors, and fixed a
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
185
diff
changeset
|
418 ULONG _internal_color(ULONG color) |
634625c3239d
Fixes for dw_color_xxxx_set() to accept OS/2 style colors, and fixed a
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
185
diff
changeset
|
419 { |
369
39983df2b93d
Updated the license information, and copyrights. Code to do background
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
355
diff
changeset
|
420 if(color == DW_CLR_DEFAULT) |
39983df2b93d
Updated the license information, and copyrights. Code to do background
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
355
diff
changeset
|
421 return DW_RGB_TRANSPARENT; |
191
634625c3239d
Fixes for dw_color_xxxx_set() to accept OS/2 style colors, and fixed a
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
185
diff
changeset
|
422 if(color < 18) |
634625c3239d
Fixes for dw_color_xxxx_set() to accept OS/2 style colors, and fixed a
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
185
diff
changeset
|
423 return DW_RGB(_red[color], _green[color], _blue[color]); |
634625c3239d
Fixes for dw_color_xxxx_set() to accept OS/2 style colors, and fixed a
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
185
diff
changeset
|
424 return color; |
634625c3239d
Fixes for dw_color_xxxx_set() to accept OS/2 style colors, and fixed a
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
185
diff
changeset
|
425 } |
634625c3239d
Fixes for dw_color_xxxx_set() to accept OS/2 style colors, and fixed a
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
185
diff
changeset
|
426 |
3 | 427 /* This function returns 1 if the window (widget) handle |
428 * passed to it is a valid window that can gain input focus. | |
429 */ | |
430 int _validate_focus(HWND handle) | |
431 { | |
432 char tmpbuf[100]; | |
433 | |
434 if(!handle) | |
435 return 0; | |
436 | |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
437 if(!IsWindowEnabled(handle)) |
39
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
37
diff
changeset
|
438 return 0; |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
37
diff
changeset
|
439 |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
440 GetClassName(handle, tmpbuf, 99); |
3 | 441 |
442 /* These are the window classes which can | |
443 * obtain input focus. | |
444 */ | |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
445 if(strnicmp(tmpbuf, EDITCLASSNAME, strlen(EDITCLASSNAME)+1)==0 || /* Entryfield */ |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
446 strnicmp(tmpbuf, BUTTONCLASSNAME, strlen(BUTTONCLASSNAME)+1)==0 || /* Button */ |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
447 strnicmp(tmpbuf, COMBOBOXCLASSNAME, strlen(COMBOBOXCLASSNAME)+1)==0 || /* Combobox */ |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
448 strnicmp(tmpbuf, LISTBOXCLASSNAME, strlen(LISTBOXCLASSNAME)+1)==0 || /* List box */ |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
449 strnicmp(tmpbuf, UPDOWN_CLASS, strlen(UPDOWN_CLASS)+1)==0 || /* Spinbutton */ |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
450 strnicmp(tmpbuf, TRACKBAR_CLASS, strlen(TRACKBAR_CLASS)+1)==0 || /* Slider */ |
68
8d6100960adf
Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
451 strnicmp(tmpbuf, WC_LISTVIEW, strlen(WC_LISTVIEW)+1)== 0 || /* Container */ |
8d6100960adf
Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
452 strnicmp(tmpbuf, WC_TREEVIEW, strlen(WC_TREEVIEW)+1)== 0) /* Tree */ |
3 | 453 return 1; |
454 return 0; | |
455 } | |
456 | |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
457 HWND _normalize_handle(HWND handle) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
458 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
459 char tmpbuf[100] = ""; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
460 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
461 GetClassName(handle, tmpbuf, 99); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
462 if(strnicmp(tmpbuf, UPDOWN_CLASS, strlen(UPDOWN_CLASS))==0) /* Spinner */ |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
463 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
464 ColorInfo *cinfo = (ColorInfo *)GetWindowLong(handle, GWL_USERDATA); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
465 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
466 if(cinfo && cinfo->buddy) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
467 return cinfo->buddy; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
468 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
469 if(strnicmp(tmpbuf, COMBOBOXCLASSNAME, strlen(COMBOBOXCLASSNAME))==0) /* Combobox */ |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
470 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
471 ColorInfo *cinfo = (ColorInfo *)GetWindowLong(handle, GWL_USERDATA); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
472 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
473 if(cinfo && cinfo->buddy) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
474 return cinfo->buddy; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
475 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
476 return handle; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
477 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
478 |
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
|
479 int _focus_check_box(Box *box, HWND handle, int start, HWND defaultitem) |
3 | 480 { |
481 int z; | |
482 static HWND lasthwnd, firsthwnd; | |
483 static int finish_searching; | |
484 | |
485 /* Start is 2 when we have cycled completely and | |
486 * need to set the focus to the last widget we found | |
487 * that was valid. | |
488 */ | |
489 if(start == 2) | |
490 { | |
491 if(lasthwnd) | |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
492 SetFocus(lasthwnd); |
3 | 493 return 0; |
494 } | |
495 | |
496 /* Start is 1 when we are entering the function | |
497 * for the first time, it is zero when entering | |
498 * the function recursively. | |
499 */ | |
500 if(start == 1) | |
501 { | |
502 lasthwnd = handle; | |
503 finish_searching = 0; | |
504 firsthwnd = 0; | |
505 } | |
506 | |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
507 for(z=box->count-1;z>-1;z--) |
3 | 508 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
509 if(box->items[z].type == TYPEBOX) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
510 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
511 Box *thisbox = (Box *)GetWindowLong(box->items[z].hwnd, GWL_USERDATA); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
512 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
513 if(thisbox && _focus_check_box(thisbox, handle, start == 3 ? 3 : 0, defaultitem)) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
514 return 1; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
515 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
516 else |
3 | 517 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
518 if(box->items[z].hwnd == handle) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
519 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
520 if(lasthwnd == handle && firsthwnd) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
521 SetFocus(firsthwnd); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
522 else if(lasthwnd == handle && !firsthwnd) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
523 finish_searching = 1; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
524 else |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
525 SetFocus(lasthwnd); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
526 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
527 /* If we aren't looking for the last handle, |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
528 * return immediately. |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
529 */ |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
530 if(!finish_searching) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
531 return 1; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
532 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
533 if(_validate_focus(box->items[z].hwnd)) |
3 | 534 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
535 /* Start is 3 when we are looking for the |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
536 * first valid item in the layout. |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
537 */ |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
538 if(start == 3) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
539 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
540 if(!defaultitem || (defaultitem && box->items[z].hwnd == defaultitem)) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
541 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
542 SetFocus(_normalize_handle(box->items[z].hwnd)); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
543 return 1; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
544 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
545 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
546 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
547 if(!firsthwnd) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
548 firsthwnd = _normalize_handle(box->items[z].hwnd); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
549 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
550 lasthwnd = _normalize_handle(box->items[z].hwnd); |
3 | 551 } |
552 else | |
553 { | |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
554 char tmpbuf[100] = ""; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
555 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
556 GetClassName(box->items[z].hwnd, tmpbuf, 99); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
557 |
153
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
151
diff
changeset
|
558 if(strncmp(tmpbuf, SplitbarClassName, strlen(SplitbarClassName)+1)==0) |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
151
diff
changeset
|
559 { |
284
3431e445d831
Woops, screwed up the splitbar tab direction on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
283
diff
changeset
|
560 /* Then try the bottom or right box */ |
3431e445d831
Woops, screwed up the splitbar tab direction on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
283
diff
changeset
|
561 HWND mybox = (HWND)dw_window_get_data(box->items[z].hwnd, "_dw_bottomright"); |
153
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
151
diff
changeset
|
562 |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
151
diff
changeset
|
563 if(mybox) |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
151
diff
changeset
|
564 { |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
151
diff
changeset
|
565 Box *splitbox = (Box *)GetWindowLong(mybox, GWL_USERDATA); |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
151
diff
changeset
|
566 |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
151
diff
changeset
|
567 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:
151
diff
changeset
|
568 return 1; |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
151
diff
changeset
|
569 } |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
151
diff
changeset
|
570 |
284
3431e445d831
Woops, screwed up the splitbar tab direction on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
283
diff
changeset
|
571 /* Try the top or left box */ |
3431e445d831
Woops, screwed up the splitbar tab direction on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
283
diff
changeset
|
572 mybox = (HWND)dw_window_get_data(box->items[z].hwnd, "_dw_topleft"); |
153
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
151
diff
changeset
|
573 |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
151
diff
changeset
|
574 if(mybox) |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
151
diff
changeset
|
575 { |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
151
diff
changeset
|
576 Box *splitbox = (Box *)GetWindowLong(mybox, GWL_USERDATA); |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
151
diff
changeset
|
577 |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
151
diff
changeset
|
578 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:
151
diff
changeset
|
579 return 1; |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
151
diff
changeset
|
580 } |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
151
diff
changeset
|
581 } |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
151
diff
changeset
|
582 else if(strnicmp(tmpbuf, WC_TABCONTROL, strlen(WC_TABCONTROL))==0) /* Notebook */ |
3 | 583 { |
191
634625c3239d
Fixes for dw_color_xxxx_set() to accept OS/2 style colors, and fixed a
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
185
diff
changeset
|
584 NotebookPage **array = (NotebookPage **)dw_window_get_data(box->items[z].hwnd, "_dw_array"); |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
585 int pageid = TabCtrl_GetCurSel(box->items[z].hwnd); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
586 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
587 if(pageid > -1 && array && array[pageid]) |
3 | 588 { |
589 Box *notebox; | |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
590 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
591 if(array[pageid]->hwnd) |
3 | 592 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
593 notebox = (Box *)GetWindowLong(array[pageid]->hwnd, GWL_USERDATA); |
3 | 594 |
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
|
595 if(notebox && _focus_check_box(notebox, handle, start == 3 ? 3 : 0, defaultitem)) |
3 | 596 return 1; |
597 } | |
598 } | |
599 } | |
600 } | |
601 } | |
602 } | |
603 return 0; | |
604 } | |
605 | |
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
|
606 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
|
607 { |
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 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
|
609 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
|
610 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
|
611 |
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 /* 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
|
613 * 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
|
614 * 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
|
615 */ |
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 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
|
617 { |
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 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
|
619 SetFocus(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
|
620 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
|
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 |
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 /* 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
|
624 * 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
|
625 * 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
|
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(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
|
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 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
|
630 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
|
631 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
|
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 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
|
635 { |
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 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
|
637 { |
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 Box *thisbox = (Box *)GetWindowLong(box->items[z].hwnd, GWL_USERDATA); |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
639 |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
640 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
|
641 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
|
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 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
|
644 { |
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 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
|
646 { |
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 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
|
648 SetFocus(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
|
649 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
|
650 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
|
651 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
|
652 SetFocus(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
|
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 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
|
655 * 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
|
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 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
|
658 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
|
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 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
|
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 /* 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
|
663 * 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
|
664 */ |
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 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
|
666 { |
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 if(!defaultitem || (defaultitem && box->items[z].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
|
668 { |
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 SetFocus(_normalize_handle(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
|
670 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
|
671 } |
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 |
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 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
|
675 firsthwnd = _normalize_handle(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
|
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 lasthwnd = _normalize_handle(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
|
678 } |
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 |
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 { |
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 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
|
682 |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
683 GetClassName(box->items[z].hwnd, tmpbuf, 99); |
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 |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
281
diff
changeset
|
685 if(strncmp(tmpbuf, SplitbarClassName, strlen(SplitbarClassName)+1)==0) |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
281
diff
changeset
|
686 { |
284
3431e445d831
Woops, screwed up the splitbar tab direction on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
283
diff
changeset
|
687 /* Try the top or left box */ |
3431e445d831
Woops, screwed up the splitbar tab direction on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
283
diff
changeset
|
688 HWND mybox = (HWND)dw_window_get_data(box->items[z].hwnd, "_dw_topleft"); |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
281
diff
changeset
|
689 |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
281
diff
changeset
|
690 if(mybox) |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
281
diff
changeset
|
691 { |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
281
diff
changeset
|
692 Box *splitbox = (Box *)GetWindowLong(mybox, GWL_USERDATA); |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
281
diff
changeset
|
693 |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
281
diff
changeset
|
694 if(splitbox && _focus_check_box_back(splitbox, handle, start == 3 ? 3 : 0, defaultitem)) |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
281
diff
changeset
|
695 return 1; |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
281
diff
changeset
|
696 } |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
281
diff
changeset
|
697 |
284
3431e445d831
Woops, screwed up the splitbar tab direction on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
283
diff
changeset
|
698 /* Then try the bottom or right box */ |
3431e445d831
Woops, screwed up the splitbar tab direction on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
283
diff
changeset
|
699 mybox = (HWND)dw_window_get_data(box->items[z].hwnd, "_dw_bottomright"); |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
281
diff
changeset
|
700 |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
281
diff
changeset
|
701 if(mybox) |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
281
diff
changeset
|
702 { |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
281
diff
changeset
|
703 Box *splitbox = (Box *)GetWindowLong(mybox, GWL_USERDATA); |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
281
diff
changeset
|
704 |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
281
diff
changeset
|
705 if(splitbox && _focus_check_box_back(splitbox, handle, start == 3 ? 3 : 0, defaultitem)) |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
281
diff
changeset
|
706 return 1; |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
281
diff
changeset
|
707 } |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
281
diff
changeset
|
708 } |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
281
diff
changeset
|
709 else if(strnicmp(tmpbuf, WC_TABCONTROL, strlen(WC_TABCONTROL))==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
|
710 { |
191
634625c3239d
Fixes for dw_color_xxxx_set() to accept OS/2 style colors, and fixed a
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
185
diff
changeset
|
711 NotebookPage **array = (NotebookPage **)dw_window_get_data(box->items[z].hwnd, "_dw_array"); |
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
|
712 int pageid = TabCtrl_GetCurSel(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
|
713 |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
714 if(pageid > -1 && array && array[pageid]) |
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 |
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 if(array[pageid]->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
|
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 notebox = (Box *)GetWindowLong(array[pageid]->hwnd, GWL_USERDATA); |
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 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
|
723 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
|
724 } |
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 } |
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 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
|
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 |
3 | 733 /* This function finds the first widget in the |
734 * layout and moves the current focus to it. | |
735 */ | |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
736 void _initial_focus(HWND handle) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
737 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
738 Box *thisbox; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
739 char tmpbuf[100]; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
740 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
741 if(!handle) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
742 return; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
743 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
744 GetClassName(handle, tmpbuf, 99); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
745 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
746 if(strnicmp(tmpbuf, ClassName, strlen(ClassName))!=0) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
747 return; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
748 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
749 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
750 if(handle) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
751 thisbox = (Box *)GetWindowLong(handle, GWL_USERDATA); |
3 | 752 |
753 if(thisbox) | |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
754 { |
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
|
755 _focus_check_box(thisbox, handle, 3, thisbox->defaultitem); |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
756 } |
3 | 757 } |
758 | |
301
887675ee5b67
More keypress fixes on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
299
diff
changeset
|
759 HWND _toplevel_window(HWND handle) |
887675ee5b67
More keypress fixes on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
299
diff
changeset
|
760 { |
887675ee5b67
More keypress fixes on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
299
diff
changeset
|
761 HWND box, lastbox = GetParent(handle); |
887675ee5b67
More keypress fixes on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
299
diff
changeset
|
762 |
887675ee5b67
More keypress fixes on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
299
diff
changeset
|
763 /* Find the toplevel window */ |
887675ee5b67
More keypress fixes on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
299
diff
changeset
|
764 while((box = GetParent(lastbox))) |
887675ee5b67
More keypress fixes on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
299
diff
changeset
|
765 { |
887675ee5b67
More keypress fixes on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
299
diff
changeset
|
766 lastbox = box; |
887675ee5b67
More keypress fixes on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
299
diff
changeset
|
767 } |
887675ee5b67
More keypress fixes on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
299
diff
changeset
|
768 if(lastbox) |
887675ee5b67
More keypress fixes on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
299
diff
changeset
|
769 return lastbox; |
887675ee5b67
More keypress fixes on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
299
diff
changeset
|
770 return handle; |
887675ee5b67
More keypress fixes on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
299
diff
changeset
|
771 } |
887675ee5b67
More keypress fixes on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
299
diff
changeset
|
772 |
3 | 773 /* This function finds the current widget in the |
774 * layout and moves the current focus to the next item. | |
775 */ | |
776 void _shift_focus(HWND handle) | |
777 { | |
778 Box *thisbox; | |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
779 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
780 HWND box, lastbox = GetParent(handle); |
3 | 781 |
782 /* Find the toplevel window */ | |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
783 while((box = GetParent(lastbox))) |
3 | 784 { |
785 lastbox = box; | |
786 } | |
787 | |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
788 thisbox = (Box *)GetWindowLong(lastbox, GWL_USERDATA); |
3 | 789 if(thisbox) |
790 { | |
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
|
791 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
|
792 _focus_check_box(thisbox, handle, 2, 0); |
3 | 793 } |
794 } | |
795 | |
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
|
796 /* 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
|
797 * 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
|
798 */ |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
799 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
|
800 { |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
801 Box *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
|
802 |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
803 HWND box, lastbox = GetParent(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
|
804 |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
805 /* Find the toplevel window */ |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
806 while((box = GetParent(lastbox))) |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
807 { |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
808 lastbox = 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
|
809 } |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
810 |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
811 thisbox = (Box *)GetWindowLong(lastbox, GWL_USERDATA); |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
812 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
|
813 { |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
814 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
|
815 _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
|
816 } |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
817 } |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
818 |
3 | 819 /* ResetWindow: |
820 * Resizes window to the exact same size to trigger | |
821 * recalculation of frame. | |
822 */ | |
823 void _ResetWindow(HWND hwndFrame) | |
824 { | |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
825 RECT rcl; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
826 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
827 GetWindowRect(hwndFrame, &rcl); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
828 SetWindowPos(hwndFrame, HWND_TOP, 0, 0, rcl.right - rcl.left, |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
829 rcl.bottom - rcl.top - 1, SWP_NOMOVE | SWP_NOZORDER); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
830 SetWindowPos(hwndFrame, HWND_TOP, 0, 0, rcl.right - rcl.left, |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
831 rcl.bottom - rcl.top, SWP_NOMOVE | SWP_NOZORDER); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
832 } |
3 | 833 |
834 /* This function calculates how much space the widgets and boxes require | |
835 * and does expansion as necessary. | |
836 */ | |
837 int _resize_box(Box *thisbox, int *depth, int x, int y, int *usedx, int *usedy, | |
838 int pass, int *usedpadx, int *usedpady) | |
839 { | |
840 int z, currentx = 0, currenty = 0; | |
841 int uymax = 0, uxmax = 0; | |
842 int upymax = 0, upxmax = 0; | |
843 /* Used for the SIZEEXPAND */ | |
844 int nux = *usedx, nuy = *usedy; | |
845 int nupx = *usedpadx, nupy = *usedpady; | |
417
4ae67c291a8a
Woops, missed a variable when copying the code from OS/2 to Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
416
diff
changeset
|
846 int textheight = 0; |
3 | 847 |
848 (*usedx) += (thisbox->pad * 2); | |
849 (*usedy) += (thisbox->pad * 2); | |
850 | |
416
a4197ddfc50d
Changes to calculate groupbox border widths and take this into account
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
414
diff
changeset
|
851 if(thisbox->grouphwnd) |
a4197ddfc50d
Changes to calculate groupbox border widths and take this into account
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
414
diff
changeset
|
852 { |
a4197ddfc50d
Changes to calculate groupbox border widths and take this into account
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
414
diff
changeset
|
853 char *text = dw_window_get_text(thisbox->grouphwnd); |
a4197ddfc50d
Changes to calculate groupbox border widths and take this into account
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
414
diff
changeset
|
854 |
a4197ddfc50d
Changes to calculate groupbox border widths and take this into account
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
414
diff
changeset
|
855 if(text) |
a4197ddfc50d
Changes to calculate groupbox border widths and take this into account
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
414
diff
changeset
|
856 { |
a4197ddfc50d
Changes to calculate groupbox border widths and take this into account
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
414
diff
changeset
|
857 dw_font_text_extents(thisbox->grouphwnd, 0, text, NULL, &textheight); |
a4197ddfc50d
Changes to calculate groupbox border widths and take this into account
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
414
diff
changeset
|
858 dw_free(text); |
a4197ddfc50d
Changes to calculate groupbox border widths and take this into account
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
414
diff
changeset
|
859 } |
a4197ddfc50d
Changes to calculate groupbox border widths and take this into account
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
414
diff
changeset
|
860 |
a4197ddfc50d
Changes to calculate groupbox border widths and take this into account
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
414
diff
changeset
|
861 (*usedx) += 6; |
a4197ddfc50d
Changes to calculate groupbox border widths and take this into account
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
414
diff
changeset
|
862 (*usedy) += textheight ? (3 + textheight) : 6; |
a4197ddfc50d
Changes to calculate groupbox border widths and take this into account
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
414
diff
changeset
|
863 } |
a4197ddfc50d
Changes to calculate groupbox border widths and take this into account
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
414
diff
changeset
|
864 |
3 | 865 for(z=0;z<thisbox->count;z++) |
866 { | |
867 if(thisbox->items[z].type == TYPEBOX) | |
868 { | |
869 int initialx, initialy; | |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
870 Box *tmp = (Box *)GetWindowLong(thisbox->items[z].hwnd, GWL_USERDATA); |
3 | 871 |
872 initialx = x - (*usedx); | |
873 initialy = y - (*usedy); | |
874 | |
875 if(tmp) | |
876 { | |
877 int newx, newy; | |
878 int nux = *usedx, nuy = *usedy; | |
879 int upx = *usedpadx + (tmp->pad*2), upy = *usedpady + (tmp->pad*2); | |
880 | |
881 /* On the second pass we know how big the box needs to be and how | |
882 * much space we have, so we can calculate a ratio for the new box. | |
883 */ | |
884 if(pass == 2) | |
885 { | |
886 int deep = *depth + 1; | |
887 | |
888 _resize_box(tmp, &deep, x, y, &nux, &nuy, 1, &upx, &upy); | |
889 | |
890 tmp->upx = upx - *usedpadx; | |
891 tmp->upy = upy - *usedpady; | |
892 | |
893 newx = x - nux; | |
894 newy = y - nuy; | |
895 | |
896 tmp->width = thisbox->items[z].width = initialx - newx; | |
897 tmp->height = thisbox->items[z].height = initialy - newy; | |
898 | |
899 tmp->parentxratio = thisbox->xratio; | |
900 tmp->parentyratio = thisbox->yratio; | |
901 | |
902 tmp->parentpad = tmp->pad; | |
903 | |
904 /* Just in case */ | |
905 tmp->xratio = thisbox->xratio; | |
906 tmp->yratio = thisbox->yratio; | |
907 | |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
281
diff
changeset
|
908 if(thisbox->type == DW_VERT) |
3 | 909 { |
910 if((thisbox->items[z].width-((thisbox->items[z].pad*2)+(tmp->pad*2)))!=0) | |
911 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)))); | |
912 } | |
913 else | |
914 { | |
915 if((thisbox->items[z].width-tmp->upx)!=0) | |
916 tmp->xratio = ((float)((thisbox->items[z].width * thisbox->xratio)-tmp->upx))/((float)(thisbox->items[z].width-tmp->upx)); | |
917 } | |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
281
diff
changeset
|
918 if(thisbox->type == DW_HORZ) |
3 | 919 { |
920 if((thisbox->items[z].height-((thisbox->items[z].pad*2)+(tmp->pad*2)))!=0) | |
921 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)))); | |
922 } | |
923 else | |
924 { | |
925 if((thisbox->items[z].height-tmp->upy)!=0) | |
926 tmp->yratio = ((float)((thisbox->items[z].height * thisbox->yratio)-tmp->upy))/((float)(thisbox->items[z].height-tmp->upy)); | |
927 } | |
928 | |
929 nux = *usedx; nuy = *usedy; | |
930 upx = *usedpadx + (tmp->pad*2); upy = *usedpady + (tmp->pad*2); | |
931 } | |
932 | |
933 (*depth)++; | |
934 | |
935 _resize_box(tmp, depth, x, y, &nux, &nuy, pass, &upx, &upy); | |
936 | |
937 (*depth)--; | |
938 | |
939 newx = x - nux; | |
940 newy = y - nuy; | |
941 | |
942 tmp->minwidth = thisbox->items[z].width = initialx - newx; | |
943 tmp->minheight = thisbox->items[z].height = initialy - newy; | |
944 } | |
945 } | |
946 | |
947 if(pass > 1 && *depth > 0) | |
948 { | |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
281
diff
changeset
|
949 if(thisbox->type == DW_VERT) |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
59
diff
changeset
|
950 { |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
59
diff
changeset
|
951 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:
59
diff
changeset
|
952 thisbox->items[z].xratio = 1.0; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
59
diff
changeset
|
953 else |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
59
diff
changeset
|
954 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:
59
diff
changeset
|
955 } |
3 | 956 else |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
59
diff
changeset
|
957 { |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
59
diff
changeset
|
958 if(thisbox->minwidth-thisbox->upx == 0) |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
59
diff
changeset
|
959 thisbox->items[z].xratio = 1.0; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
59
diff
changeset
|
960 else |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
59
diff
changeset
|
961 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:
59
diff
changeset
|
962 } |
3 | 963 |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
281
diff
changeset
|
964 if(thisbox->type == DW_HORZ) |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
59
diff
changeset
|
965 { |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
59
diff
changeset
|
966 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:
59
diff
changeset
|
967 thisbox->items[z].yratio = 1.0; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
59
diff
changeset
|
968 else |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
59
diff
changeset
|
969 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:
59
diff
changeset
|
970 } |
3 | 971 else |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
59
diff
changeset
|
972 { |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
59
diff
changeset
|
973 if(thisbox->minheight-thisbox->upy == 0) |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
59
diff
changeset
|
974 thisbox->items[z].yratio = 1.0; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
59
diff
changeset
|
975 else |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
59
diff
changeset
|
976 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:
59
diff
changeset
|
977 } |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
17
diff
changeset
|
978 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
17
diff
changeset
|
979 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:
17
diff
changeset
|
980 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
981 Box *tmp = (Box *)GetWindowLong(thisbox->items[z].hwnd, GWL_USERDATA); |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
17
diff
changeset
|
982 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
17
diff
changeset
|
983 if(tmp) |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
17
diff
changeset
|
984 { |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
17
diff
changeset
|
985 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:
17
diff
changeset
|
986 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:
17
diff
changeset
|
987 } |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
17
diff
changeset
|
988 } |
3 | 989 } |
990 else | |
991 { | |
992 thisbox->items[z].xratio = thisbox->xratio; | |
993 thisbox->items[z].yratio = thisbox->yratio; | |
994 } | |
995 | |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
281
diff
changeset
|
996 if(thisbox->type == DW_VERT) |
3 | 997 { |
998 if((thisbox->items[z].width + (thisbox->items[z].pad*2)) > uxmax) | |
999 uxmax = (thisbox->items[z].width + (thisbox->items[z].pad*2)); | |
1000 if(thisbox->items[z].hsize != SIZEEXPAND) | |
1001 { | |
1002 if(((thisbox->items[z].pad*2) + thisbox->items[z].width) > upxmax) | |
1003 upxmax = (thisbox->items[z].pad*2) + thisbox->items[z].width; | |
1004 } | |
1005 else | |
1006 { | |
1007 if(thisbox->items[z].pad*2 > upxmax) | |
1008 upxmax = thisbox->items[z].pad*2; | |
1009 } | |
1010 } | |
1011 else | |
1012 { | |
1013 if(thisbox->items[z].width == -1) | |
1014 { | |
1015 /* figure out how much space this item requires */ | |
1016 /* thisbox->items[z].width = */ | |
1017 } | |
1018 else | |
1019 { | |
1020 (*usedx) += thisbox->items[z].width + (thisbox->items[z].pad*2); | |
1021 if(thisbox->items[z].hsize != SIZEEXPAND) | |
1022 (*usedpadx) += (thisbox->items[z].pad*2) + thisbox->items[z].width; | |
1023 else | |
1024 (*usedpadx) += thisbox->items[z].pad*2; | |
1025 } | |
1026 } | |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
281
diff
changeset
|
1027 if(thisbox->type == DW_HORZ) |
3 | 1028 { |
1029 if((thisbox->items[z].height + (thisbox->items[z].pad*2)) > uymax) | |
1030 uymax = (thisbox->items[z].height + (thisbox->items[z].pad*2)); | |
1031 if(thisbox->items[z].vsize != SIZEEXPAND) | |
1032 { | |
1033 if(((thisbox->items[z].pad*2) + thisbox->items[z].height) > upymax) | |
1034 upymax = (thisbox->items[z].pad*2) + thisbox->items[z].height; | |
1035 } | |
1036 else | |
1037 { | |
1038 if(thisbox->items[z].pad*2 > upymax) | |
1039 upymax = thisbox->items[z].pad*2; | |
1040 } | |
1041 } | |
1042 else | |
1043 { | |
1044 if(thisbox->items[z].height == -1) | |
1045 { | |
1046 /* figure out how much space this item requires */ | |
1047 /* thisbox->items[z].height = */ | |
1048 } | |
1049 else | |
1050 { | |
1051 (*usedy) += thisbox->items[z].height + (thisbox->items[z].pad*2); | |
1052 if(thisbox->items[z].vsize != SIZEEXPAND) | |
1053 (*usedpady) += (thisbox->items[z].pad*2) + thisbox->items[z].height; | |
1054 else | |
1055 (*usedpady) += thisbox->items[z].pad*2; | |
1056 } | |
1057 } | |
1058 } | |
1059 | |
1060 (*usedx) += uxmax; | |
1061 (*usedy) += uymax; | |
1062 (*usedpadx) += upxmax; | |
1063 (*usedpady) += upymax; | |
1064 | |
1065 currentx += thisbox->pad; | |
1066 currenty += thisbox->pad; | |
1067 | |
416
a4197ddfc50d
Changes to calculate groupbox border widths and take this into account
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
414
diff
changeset
|
1068 if(thisbox->grouphwnd) |
a4197ddfc50d
Changes to calculate groupbox border widths and take this into account
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
414
diff
changeset
|
1069 { |
a4197ddfc50d
Changes to calculate groupbox border widths and take this into account
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
414
diff
changeset
|
1070 currentx += 3; |
a4197ddfc50d
Changes to calculate groupbox border widths and take this into account
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
414
diff
changeset
|
1071 currenty += textheight ? textheight : 3; |
a4197ddfc50d
Changes to calculate groupbox border widths and take this into account
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
414
diff
changeset
|
1072 } |
a4197ddfc50d
Changes to calculate groupbox border widths and take this into account
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
414
diff
changeset
|
1073 |
3 | 1074 /* The second pass is for expansion and actual placement. */ |
1075 if(pass > 1) | |
1076 { | |
1077 /* Any SIZEEXPAND items should be set to uxmax/uymax */ | |
1078 for(z=0;z<thisbox->count;z++) | |
1079 { | |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
281
diff
changeset
|
1080 if(thisbox->items[z].hsize == SIZEEXPAND && thisbox->type == DW_VERT) |
3 | 1081 thisbox->items[z].width = uxmax-(thisbox->items[z].pad*2); |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
281
diff
changeset
|
1082 if(thisbox->items[z].vsize == SIZEEXPAND && thisbox->type == DW_HORZ) |
3 | 1083 thisbox->items[z].height = uymax-(thisbox->items[z].pad*2); |
1084 /* Run this code segment again to finalize the sized after setting uxmax/uymax values. */ | |
1085 if(thisbox->items[z].type == TYPEBOX) | |
1086 { | |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1087 Box *tmp = (Box *)GetWindowLong(thisbox->items[z].hwnd, GWL_USERDATA); |
3 | 1088 |
1089 if(tmp) | |
1090 { | |
1091 if(*depth > 0) | |
1092 { | |
425
4fe2df53ec9f
Division by zero fix in the layout engine.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
421
diff
changeset
|
1093 float calcval; |
4fe2df53ec9f
Division by zero fix in the layout engine.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
421
diff
changeset
|
1094 |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
281
diff
changeset
|
1095 if(thisbox->type == DW_VERT) |
3 | 1096 { |
425
4fe2df53ec9f
Division by zero fix in the layout engine.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
421
diff
changeset
|
1097 calcval = (float)(tmp->minwidth-((thisbox->items[z].pad*2)+(thisbox->pad*2))); |
4fe2df53ec9f
Division by zero fix in the layout engine.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
421
diff
changeset
|
1098 if(calcval == 0.0) |
4fe2df53ec9f
Division by zero fix in the layout engine.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
421
diff
changeset
|
1099 tmp->xratio = thisbox->xratio; |
4fe2df53ec9f
Division by zero fix in the layout engine.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
421
diff
changeset
|
1100 else |
4fe2df53ec9f
Division by zero fix in the layout engine.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
421
diff
changeset
|
1101 tmp->xratio = ((float)((thisbox->items[z].width * thisbox->xratio)-((thisbox->items[z].pad*2)+(thisbox->pad*2))))/calcval; |
3 | 1102 tmp->width = thisbox->items[z].width; |
1103 } | |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
281
diff
changeset
|
1104 if(thisbox->type == DW_HORZ) |
3 | 1105 { |
425
4fe2df53ec9f
Division by zero fix in the layout engine.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
421
diff
changeset
|
1106 calcval = (float)(tmp->minheight-((thisbox->items[z].pad*2)+(thisbox->pad*2))); |
4fe2df53ec9f
Division by zero fix in the layout engine.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
421
diff
changeset
|
1107 if(calcval == 0.0) |
4fe2df53ec9f
Division by zero fix in the layout engine.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
421
diff
changeset
|
1108 tmp->yratio = thisbox->yratio; |
4fe2df53ec9f
Division by zero fix in the layout engine.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
421
diff
changeset
|
1109 else |
4fe2df53ec9f
Division by zero fix in the layout engine.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
421
diff
changeset
|
1110 tmp->yratio = ((float)((thisbox->items[z].height * thisbox->yratio)-((thisbox->items[z].pad*2)+(thisbox->pad*2))))/calcval; |
3 | 1111 tmp->height = thisbox->items[z].height; |
1112 } | |
1113 } | |
1114 | |
1115 (*depth)++; | |
1116 | |
1117 _resize_box(tmp, depth, x, y, &nux, &nuy, 3, &nupx, &nupy); | |
1118 | |
1119 (*depth)--; | |
1120 | |
1121 } | |
1122 } | |
1123 } | |
1124 | |
1125 for(z=0;z<(thisbox->count);z++) | |
1126 { | |
1127 int height = thisbox->items[z].height; | |
1128 int width = thisbox->items[z].width; | |
1129 int pad = thisbox->items[z].pad; | |
1130 HWND handle = thisbox->items[z].hwnd; | |
1131 int vectorx, vectory; | |
1132 | |
1133 /* When upxmax != pad*2 then ratios are incorrect. */ | |
1134 vectorx = (int)((width*thisbox->items[z].xratio)-width); | |
1135 vectory = (int)((height*thisbox->items[z].yratio)-height); | |
1136 | |
1137 if(width > 0 && height > 0) | |
1138 { | |
1139 char tmpbuf[100]; | |
1140 /* This is a hack to fix rounding of the sizing */ | |
1141 if(*depth == 0) | |
1142 { | |
1143 vectorx++; | |
1144 vectory++; | |
1145 } | |
1146 | |
1147 /* If this item isn't going to expand... reset the vectors to 0 */ | |
1148 if(thisbox->items[z].vsize != SIZEEXPAND) | |
1149 vectory = 0; | |
1150 if(thisbox->items[z].hsize != SIZEEXPAND) | |
1151 vectorx = 0; | |
1152 | |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1153 GetClassName(handle, tmpbuf, 99); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1154 |
88
58d8139fe0a2
Added vertical center logic for static text controls on windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
87
diff
changeset
|
1155 if(strnicmp(tmpbuf, COMBOBOXCLASSNAME, strlen(COMBOBOXCLASSNAME)+1)==0) |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1156 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1157 /* Handle special case Combobox */ |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1158 MoveWindow(handle, currentx + pad, currenty + pad, |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
1159 width + vectorx, (height + vectory) + 400, FALSE); |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1160 } |
88
58d8139fe0a2
Added vertical center logic for static text controls on windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
87
diff
changeset
|
1161 else if(strnicmp(tmpbuf, UPDOWN_CLASS, strlen(UPDOWN_CLASS)+1)==0) |
3 | 1162 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1163 /* Handle special case Spinbutton */ |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1164 ColorInfo *cinfo = (ColorInfo *)GetWindowLong(handle, GWL_USERDATA); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1165 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1166 MoveWindow(handle, currentx + pad + ((width + vectorx) - 20), currenty + pad, |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
1167 20, height + vectory, FALSE); |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1168 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1169 if(cinfo) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1170 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1171 MoveWindow(cinfo->buddy, currentx + pad, currenty + pad, |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
1172 (width + vectorx) - 20, height + vectory, FALSE); |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1173 } |
3 | 1174 } |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
1175 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:
165
diff
changeset
|
1176 { |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
1177 /* Then try the bottom or right box */ |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
1178 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:
165
diff
changeset
|
1179 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:
165
diff
changeset
|
1180 int cx = width + vectorx; |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
1181 int cy = height + vectory; |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
1182 |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
1183 MoveWindow(handle, currentx + pad, currenty + pad, |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
1184 cx, cy, FALSE); |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
1185 |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
1186 if(cx > 0 && cy > 0 && percent) |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
1187 _handle_splitbar_resize(handle, *percent, type, cx, cy); |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
1188 } |
88
58d8139fe0a2
Added vertical center logic for static text controls on windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
87
diff
changeset
|
1189 else if(strnicmp(tmpbuf, STATICCLASSNAME, strlen(STATICCLASSNAME)+1)==0) |
58d8139fe0a2
Added vertical center logic for static text controls on windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
87
diff
changeset
|
1190 { |
58d8139fe0a2
Added vertical center logic for static text controls on windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
87
diff
changeset
|
1191 /* Handle special case Vertically Center static text */ |
58d8139fe0a2
Added vertical center logic for static text controls on windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
87
diff
changeset
|
1192 ColorInfo *cinfo = (ColorInfo *)GetWindowLong(handle, GWL_USERDATA); |
58d8139fe0a2
Added vertical center logic for static text controls on windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
87
diff
changeset
|
1193 |
58d8139fe0a2
Added vertical center logic for static text controls on windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
87
diff
changeset
|
1194 if(cinfo && cinfo->vcenter) |
58d8139fe0a2
Added vertical center logic for static text controls on windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
87
diff
changeset
|
1195 { |
58d8139fe0a2
Added vertical center logic for static text controls on windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
87
diff
changeset
|
1196 /* We are centered so calculate a new position */ |
58d8139fe0a2
Added vertical center logic for static text controls on windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
87
diff
changeset
|
1197 char tmpbuf[1024]; |
58d8139fe0a2
Added vertical center logic for static text controls on windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
87
diff
changeset
|
1198 int textheight, diff, total = height + vectory; |
58d8139fe0a2
Added vertical center logic for static text controls on windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
87
diff
changeset
|
1199 |
58d8139fe0a2
Added vertical center logic for static text controls on windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
87
diff
changeset
|
1200 GetWindowText(handle, tmpbuf, 1023); |
58d8139fe0a2
Added vertical center logic for static text controls on windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
87
diff
changeset
|
1201 |
58d8139fe0a2
Added vertical center logic for static text controls on windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
87
diff
changeset
|
1202 /* Figure out how big the text is */ |
58d8139fe0a2
Added vertical center logic for static text controls on windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
87
diff
changeset
|
1203 dw_font_text_extents(handle, 0, tmpbuf, 0, &textheight); |
58d8139fe0a2
Added vertical center logic for static text controls on windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
87
diff
changeset
|
1204 |
58d8139fe0a2
Added vertical center logic for static text controls on windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
87
diff
changeset
|
1205 diff = (total - textheight) / 2; |
58d8139fe0a2
Added vertical center logic for static text controls on windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
87
diff
changeset
|
1206 |
58d8139fe0a2
Added vertical center logic for static text controls on windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
87
diff
changeset
|
1207 MoveWindow(handle, currentx + pad, currenty + pad + diff, |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
1208 width + vectorx, height + vectory - diff, FALSE); |
88
58d8139fe0a2
Added vertical center logic for static text controls on windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
87
diff
changeset
|
1209 } |
58d8139fe0a2
Added vertical center logic for static text controls on windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
87
diff
changeset
|
1210 else |
58d8139fe0a2
Added vertical center logic for static text controls on windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
87
diff
changeset
|
1211 { |
58d8139fe0a2
Added vertical center logic for static text controls on windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
87
diff
changeset
|
1212 MoveWindow(handle, currentx + pad, currenty + pad, |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
1213 width + vectorx, height + vectory, FALSE); |
88
58d8139fe0a2
Added vertical center logic for static text controls on windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
87
diff
changeset
|
1214 } |
58d8139fe0a2
Added vertical center logic for static text controls on windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
87
diff
changeset
|
1215 } |
3 | 1216 else |
1217 { | |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1218 /* Everything else */ |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1219 MoveWindow(handle, currentx + pad, currenty + pad, |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
1220 width + vectorx, height + vectory, FALSE); |
3 | 1221 if(thisbox->items[z].type == TYPEBOX) |
1222 { | |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1223 Box *boxinfo = (Box *)GetWindowLong(handle, GWL_USERDATA); |
3 | 1224 |
1225 if(boxinfo && boxinfo->grouphwnd) | |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1226 MoveWindow(boxinfo->grouphwnd, 0, 0, |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
1227 width + vectorx, height + vectory, FALSE); |
3 | 1228 |
1229 } | |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1230 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1231 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1232 /* Notebook dialog requires additional processing */ |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1233 if(strncmp(tmpbuf, WC_TABCONTROL, strlen(WC_TABCONTROL))==0) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1234 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1235 RECT rect; |
191
634625c3239d
Fixes for dw_color_xxxx_set() to accept OS/2 style colors, and fixed a
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
185
diff
changeset
|
1236 NotebookPage **array = (NotebookPage **)dw_window_get_data(handle, "_dw_array"); |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1237 int pageid = TabCtrl_GetCurSel(handle); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1238 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1239 if(pageid > -1 && array && array[pageid]) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1240 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1241 GetClientRect(handle,&rect); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1242 TabCtrl_AdjustRect(handle,FALSE,&rect); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1243 MoveWindow(array[pageid]->hwnd, rect.left, rect.top, |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
1244 rect.right - rect.left, rect.bottom-rect.top, FALSE); |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1245 } |
3 | 1246 } |
1247 | |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
281
diff
changeset
|
1248 if(thisbox->type == DW_HORZ) |
3 | 1249 currentx += width + vectorx + (pad * 2); |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
281
diff
changeset
|
1250 if(thisbox->type == DW_VERT) |
3 | 1251 currenty += height + vectory + (pad * 2); |
1252 } | |
1253 } | |
1254 } | |
1255 return 0; | |
1256 } | |
1257 | |
1258 void _do_resize(Box *thisbox, int x, int y) | |
1259 { | |
17
f26eced21a30
Some more updates.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
15
diff
changeset
|
1260 if(x != 0 && y != 0) |
f26eced21a30
Some more updates.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
15
diff
changeset
|
1261 { |
3 | 1262 if(thisbox) |
1263 { | |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1264 int usedx = 0, usedy = 0, depth = 0, usedpadx = 0, usedpady = 0; |
3 | 1265 |
1266 _resize_box(thisbox, &depth, x, y, &usedx, &usedy, 1, &usedpadx, &usedpady); | |
1267 | |
47
997e9ed670ef
Fixes for box alignment problem on OS/2, crash in dw_bitmap_new() on unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
46
diff
changeset
|
1268 if(usedx-usedpadx == 0 || usedy-usedpady == 0) |
997e9ed670ef
Fixes for box alignment problem on OS/2, crash in dw_bitmap_new() on unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
46
diff
changeset
|
1269 return; |
997e9ed670ef
Fixes for box alignment problem on OS/2, crash in dw_bitmap_new() on unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
46
diff
changeset
|
1270 |
3 | 1271 thisbox->xratio = ((float)(x-usedpadx))/((float)(usedx-usedpadx)); |
1272 thisbox->yratio = ((float)(y-usedpady))/((float)(usedy-usedpady)); | |
1273 | |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1274 usedpadx = usedpady = usedx = usedy = depth = 0; |
3 | 1275 |
1276 _resize_box(thisbox, &depth, x, y, &usedx, &usedy, 2, &usedpadx, &usedpady); | |
1277 } | |
1278 } | |
1279 } | |
1280 | |
211
e57c182cac64
Automatically scroll when getting PAGE and LINE messages, not just
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
209
diff
changeset
|
1281 int _HandleScroller(HWND handle, int pos, int which) |
e57c182cac64
Automatically scroll when getting PAGE and LINE messages, not just
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
209
diff
changeset
|
1282 { |
e57c182cac64
Automatically scroll when getting PAGE and LINE messages, not just
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
209
diff
changeset
|
1283 SCROLLINFO si; |
e57c182cac64
Automatically scroll when getting PAGE and LINE messages, not just
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
209
diff
changeset
|
1284 |
e57c182cac64
Automatically scroll when getting PAGE and LINE messages, not just
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
209
diff
changeset
|
1285 si.cbSize = sizeof(SCROLLINFO); |
e57c182cac64
Automatically scroll when getting PAGE and LINE messages, not just
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
209
diff
changeset
|
1286 si.fMask = SIF_ALL; |
e57c182cac64
Automatically scroll when getting PAGE and LINE messages, not just
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
209
diff
changeset
|
1287 |
e57c182cac64
Automatically scroll when getting PAGE and LINE messages, not just
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
209
diff
changeset
|
1288 SendMessage(handle, SBM_GETSCROLLINFO, 0, (LPARAM)&si); |
e57c182cac64
Automatically scroll when getting PAGE and LINE messages, not just
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
209
diff
changeset
|
1289 |
e57c182cac64
Automatically scroll when getting PAGE and LINE messages, not just
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
209
diff
changeset
|
1290 switch(which) |
e57c182cac64
Automatically scroll when getting PAGE and LINE messages, not just
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
209
diff
changeset
|
1291 { |
e57c182cac64
Automatically scroll when getting PAGE and LINE messages, not just
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
209
diff
changeset
|
1292 case SB_THUMBTRACK: |
e57c182cac64
Automatically scroll when getting PAGE and LINE messages, not just
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
209
diff
changeset
|
1293 return pos; |
e57c182cac64
Automatically scroll when getting PAGE and LINE messages, not just
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
209
diff
changeset
|
1294 /*case SB_PAGEDOWN:*/ |
e57c182cac64
Automatically scroll when getting PAGE and LINE messages, not just
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
209
diff
changeset
|
1295 case SB_PAGELEFT: |
e57c182cac64
Automatically scroll when getting PAGE and LINE messages, not just
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
209
diff
changeset
|
1296 pos = si.nPos - si.nPage; |
e57c182cac64
Automatically scroll when getting PAGE and LINE messages, not just
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
209
diff
changeset
|
1297 if(pos < si.nMin) |
e57c182cac64
Automatically scroll when getting PAGE and LINE messages, not just
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
209
diff
changeset
|
1298 pos = si.nMin; |
e57c182cac64
Automatically scroll when getting PAGE and LINE messages, not just
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
209
diff
changeset
|
1299 return pos; |
e57c182cac64
Automatically scroll when getting PAGE and LINE messages, not just
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
209
diff
changeset
|
1300 /*case SB_PAGEUP:*/ |
e57c182cac64
Automatically scroll when getting PAGE and LINE messages, not just
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
209
diff
changeset
|
1301 case SB_PAGERIGHT: |
e57c182cac64
Automatically scroll when getting PAGE and LINE messages, not just
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
209
diff
changeset
|
1302 pos = si.nPos + si.nPage; |
e57c182cac64
Automatically scroll when getting PAGE and LINE messages, not just
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
209
diff
changeset
|
1303 if(pos > (si.nMax - si.nPage) + 1) |
e57c182cac64
Automatically scroll when getting PAGE and LINE messages, not just
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
209
diff
changeset
|
1304 pos = (si.nMax - si.nPage) + 1; |
e57c182cac64
Automatically scroll when getting PAGE and LINE messages, not just
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
209
diff
changeset
|
1305 return pos; |
e57c182cac64
Automatically scroll when getting PAGE and LINE messages, not just
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
209
diff
changeset
|
1306 /*case SB_LINEDOWN:*/ |
e57c182cac64
Automatically scroll when getting PAGE and LINE messages, not just
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
209
diff
changeset
|
1307 case SB_LINELEFT: |
e57c182cac64
Automatically scroll when getting PAGE and LINE messages, not just
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
209
diff
changeset
|
1308 pos = si.nPos - 1; |
e57c182cac64
Automatically scroll when getting PAGE and LINE messages, not just
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
209
diff
changeset
|
1309 if(pos < si.nMin) |
e57c182cac64
Automatically scroll when getting PAGE and LINE messages, not just
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
209
diff
changeset
|
1310 pos = si.nMin; |
e57c182cac64
Automatically scroll when getting PAGE and LINE messages, not just
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
209
diff
changeset
|
1311 return pos; |
e57c182cac64
Automatically scroll when getting PAGE and LINE messages, not just
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
209
diff
changeset
|
1312 /*case SB_LINEUP:*/ |
e57c182cac64
Automatically scroll when getting PAGE and LINE messages, not just
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
209
diff
changeset
|
1313 case SB_LINERIGHT: |
e57c182cac64
Automatically scroll when getting PAGE and LINE messages, not just
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
209
diff
changeset
|
1314 pos = si.nPos + 1; |
e57c182cac64
Automatically scroll when getting PAGE and LINE messages, not just
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
209
diff
changeset
|
1315 if(pos > (si.nMax - si.nPage) + 1) |
e57c182cac64
Automatically scroll when getting PAGE and LINE messages, not just
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
209
diff
changeset
|
1316 pos = (si.nMax - si.nPage) + 1; |
e57c182cac64
Automatically scroll when getting PAGE and LINE messages, not just
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
209
diff
changeset
|
1317 return pos; |
e57c182cac64
Automatically scroll when getting PAGE and LINE messages, not just
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
209
diff
changeset
|
1318 } |
e57c182cac64
Automatically scroll when getting PAGE and LINE messages, not just
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
209
diff
changeset
|
1319 return -1; |
e57c182cac64
Automatically scroll when getting PAGE and LINE messages, not just
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
209
diff
changeset
|
1320 } |
e57c182cac64
Automatically scroll when getting PAGE and LINE messages, not just
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
209
diff
changeset
|
1321 |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1322 /* The main window procedure for Dynamic Windows, all the resizing code is done here. */ |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1323 BOOL CALLBACK _wndproc(HWND hWnd, UINT msg, WPARAM mp1, LPARAM mp2) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1324 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1325 int result = -1; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1326 static int command_active = 0; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1327 SignalHandler *tmp = Root; |
182
b8caec82a4d2
Minor splitbar fixes on OS/2 and Windows. The splitbar width is now 4
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
181
diff
changeset
|
1328 void (*windowfunc)(PVOID); |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1329 ULONG origmsg = msg; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1330 |
295
aac3ab26d636
More key_press cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
294
diff
changeset
|
1331 /* Deal with translating some messages */ |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1332 if(msg == WM_RBUTTONDOWN || msg == WM_MBUTTONDOWN) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1333 msg = WM_LBUTTONDOWN; |
295
aac3ab26d636
More key_press cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
294
diff
changeset
|
1334 else if(msg == WM_RBUTTONUP || msg == WM_MBUTTONUP) |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1335 msg = WM_LBUTTONUP; |
295
aac3ab26d636
More key_press cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
294
diff
changeset
|
1336 else if(msg == WM_HSCROLL) |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
1337 msg = WM_VSCROLL; |
295
aac3ab26d636
More key_press cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
294
diff
changeset
|
1338 else if(msg == WM_KEYDOWN && mp1 >= VK_F1 && mp1 <= VK_F24) |
aac3ab26d636
More key_press cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
294
diff
changeset
|
1339 msg = WM_CHAR; |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1340 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1341 if(result == -1) |
3 | 1342 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1343 /* Avoid infinite recursion */ |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1344 command_active = 1; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1345 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1346 /* Find any callbacks for this function */ |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1347 while(tmp) |
3 | 1348 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1349 if(tmp->message == msg || msg == WM_COMMAND || msg == WM_NOTIFY || tmp->message == WM_USER+1) |
3 | 1350 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1351 switch(msg) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1352 { |
197
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
1353 case WM_TIMER: |
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
1354 { |
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
1355 int (*timerfunc)(void *) = tmp->signalfunction; |
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
1356 if(tmp->id == (int)mp1) |
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
1357 { |
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
1358 if(!timerfunc(tmp->data)) |
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
1359 dw_timer_disconnect(tmp->id); |
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
1360 tmp = NULL; |
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
1361 } |
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
1362 result = 0; |
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
1363 } |
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
1364 break; |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1365 case WM_SETFOCUS: |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1366 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1367 int (*setfocusfunc)(HWND, void *) = (int (*)(HWND, void *))tmp->signalfunction; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1368 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1369 if(hWnd == tmp->window) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1370 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1371 result = setfocusfunc(tmp->window, tmp->data); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1372 tmp = NULL; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1373 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1374 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1375 break; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1376 case WM_SIZE: |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1377 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1378 int (*sizefunc)(HWND, int, int, void *) = tmp->signalfunction; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1379 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1380 if(hWnd == tmp->window) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1381 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1382 result = sizefunc(tmp->window, LOWORD(mp2), HIWORD(mp2), tmp->data); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1383 tmp = NULL; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1384 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1385 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1386 break; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1387 case WM_LBUTTONDOWN: |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1388 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1389 POINTS pts = MAKEPOINTS(mp2); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1390 int (*buttonfunc)(HWND, int, int, int, void *) = (int (*)(HWND, int, int, int, void *))tmp->signalfunction; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1391 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1392 if(hWnd == tmp->window) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1393 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1394 int button; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1395 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1396 switch(origmsg) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1397 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1398 case WM_LBUTTONDOWN: |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1399 button = 1; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1400 break; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1401 case WM_RBUTTONDOWN: |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1402 button = 2; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1403 break; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1404 case WM_MBUTTONDOWN: |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1405 button = 3; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1406 break; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1407 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1408 result = buttonfunc(tmp->window, pts.x, pts.y, button, tmp->data); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1409 tmp = NULL; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1410 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1411 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1412 break; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1413 case WM_LBUTTONUP: |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1414 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1415 POINTS pts = MAKEPOINTS(mp2); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1416 int (*buttonfunc)(HWND, int, int, int, void *) = (int (*)(HWND, int, int, int, void *))tmp->signalfunction; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1417 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1418 if(hWnd == tmp->window) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1419 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1420 int button; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1421 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1422 switch(origmsg) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1423 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1424 case WM_LBUTTONUP: |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1425 button = 1; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1426 break; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1427 case WM_RBUTTONUP: |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1428 button = 2; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1429 break; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1430 case WM_MBUTTONUP: |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1431 button = 3; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1432 break; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1433 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1434 result = buttonfunc(tmp->window, pts.x, pts.y, button, tmp->data); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1435 tmp = NULL; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1436 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1437 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1438 break; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1439 case WM_MOUSEMOVE: |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1440 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1441 POINTS pts = MAKEPOINTS(mp2); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1442 int (*motionfunc)(HWND, int, int, int, void *) = (int (*)(HWND, int, int, int, void *))tmp->signalfunction; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1443 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1444 if(hWnd == tmp->window) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1445 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1446 int keys = 0; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1447 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1448 if (mp1 & MK_LBUTTON) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1449 keys = DW_BUTTON1_MASK; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1450 if (mp1 & MK_RBUTTON) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1451 keys |= DW_BUTTON2_MASK; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1452 if (mp1 & MK_MBUTTON) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1453 keys |= DW_BUTTON3_MASK; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1454 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1455 result = motionfunc(tmp->window, pts.x, pts.y, keys, tmp->data); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1456 tmp = NULL; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1457 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1458 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1459 break; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1460 case WM_CHAR: |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1461 { |
267
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
1462 int (*keypressfunc)(HWND, char, int, int, void *) = tmp->signalfunction; |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1463 |
301
887675ee5b67
More keypress fixes on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
299
diff
changeset
|
1464 if(hWnd == tmp->window || _toplevel_window(hWnd) == tmp->window) |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1465 { |
267
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
1466 int special = 0; |
295
aac3ab26d636
More key_press cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
294
diff
changeset
|
1467 char ch = 0; |
267
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
1468 |
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
1469 if(GetAsyncKeyState(VK_SHIFT) & 0x8000) |
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
1470 special |= KC_SHIFT; |
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
1471 if(GetAsyncKeyState(VK_CONTROL) & 0x8000) |
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
1472 special |= KC_CTRL; |
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
1473 if(mp2 & (1 << 29)) |
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
1474 special |= KC_ALT; |
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
1475 |
295
aac3ab26d636
More key_press cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
294
diff
changeset
|
1476 if(origmsg == WM_CHAR && mp1 < 128) |
aac3ab26d636
More key_press cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
294
diff
changeset
|
1477 ch = (char)mp1; |
aac3ab26d636
More key_press cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
294
diff
changeset
|
1478 |
aac3ab26d636
More key_press cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
294
diff
changeset
|
1479 result = keypressfunc(tmp->window, ch, mp1, special, tmp->data); |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1480 tmp = NULL; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1481 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1482 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1483 break; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1484 case WM_CLOSE: |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1485 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1486 int (*closefunc)(HWND, void *) = tmp->signalfunction; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1487 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1488 if(hWnd == tmp->window) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1489 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1490 result = closefunc(tmp->window, tmp->data); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1491 tmp = NULL; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1492 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1493 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1494 break; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1495 case WM_PAINT: |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1496 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1497 PAINTSTRUCT ps; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1498 DWExpose exp; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1499 int (*exposefunc)(HWND, DWExpose *, void *) = tmp->signalfunction; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1500 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1501 if(hWnd == tmp->window) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1502 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1503 BeginPaint(hWnd, &ps); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1504 exp.x = ps.rcPaint.left; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1505 exp.y = ps.rcPaint.top; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1506 exp.width = ps.rcPaint.right - ps.rcPaint.left; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1507 exp.height = ps.rcPaint.bottom - ps.rcPaint.top; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1508 result = exposefunc(hWnd, &exp, tmp->data); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1509 EndPaint(hWnd, &ps); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1510 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1511 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1512 break; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1513 case WM_NOTIFY: |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1514 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1515 if(tmp->message == TVN_SELCHANGED || tmp->message == NM_RCLICK) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1516 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1517 NMTREEVIEW FAR *tem=(NMTREEVIEW FAR *)mp2; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1518 char tmpbuf[100]; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1519 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1520 GetClassName(tem->hdr.hwndFrom, tmpbuf, 99); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1521 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1522 if(strnicmp(tmpbuf, WC_TREEVIEW, strlen(WC_TREEVIEW))==0) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1523 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1524 if(tem->hdr.code == TVN_SELCHANGED && tmp->message == TVN_SELCHANGED) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1525 { |
321
be76b984620a
Make sure dw_tree_item_select() does not cause a DW_SIGNAL_ITEM_SELECT.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
318
diff
changeset
|
1526 if(tmp->window == tem->hdr.hwndFrom && !dw_window_get_data(tmp->window, "_dw_select_item")) |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1527 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1528 int (*treeselectfunc)(HWND, HWND, char *, void *, void *) = tmp->signalfunction; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1529 TVITEM tvi; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1530 void **ptrs; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1531 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1532 tvi.mask = TVIF_HANDLE; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1533 tvi.hItem = tem->itemNew.hItem; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1534 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1535 TreeView_GetItem(tmp->window, &tvi); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1536 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1537 ptrs = (void **)tvi.lParam; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1538 if(ptrs) |
311
24c1dfffe97e
Unified the callback functions for tree and container widgets.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
310
diff
changeset
|
1539 result = treeselectfunc(tmp->window, (HWND)tem->itemNew.hItem, (char *)ptrs[0], tmp->data, (void *)ptrs[1]); |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1540 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1541 tmp = NULL; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1542 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1543 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1544 else if(tem->hdr.code == NM_RCLICK && tmp->message == NM_RCLICK) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1545 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1546 if(tmp->window == tem->hdr.hwndFrom) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1547 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1548 int (*containercontextfunc)(HWND, char *, int, int, void *, void *) = tmp->signalfunction; |
341
503d1ac958bb
Call TreeView_SelectItem() instead of dw_tree_item_select() so we get the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
339
diff
changeset
|
1549 HTREEITEM hti, last; |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1550 TVITEM tvi; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1551 TVHITTESTINFO thi; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1552 void **ptrs = NULL; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1553 LONG x, y; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1554 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1555 dw_pointer_query_pos(&x, &y); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1556 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1557 thi.pt.x = x; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1558 thi.pt.y = y; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1559 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1560 MapWindowPoints(HWND_DESKTOP, tmp->window, &thi.pt, 1); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1561 |
341
503d1ac958bb
Call TreeView_SelectItem() instead of dw_tree_item_select() so we get the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
339
diff
changeset
|
1562 last = TreeView_GetSelection(tmp->window); |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1563 hti = TreeView_HitTest(tmp->window, &thi); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1564 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1565 if(hti) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1566 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1567 tvi.mask = TVIF_HANDLE; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1568 tvi.hItem = hti; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1569 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1570 TreeView_GetItem(tmp->window, &tvi); |
341
503d1ac958bb
Call TreeView_SelectItem() instead of dw_tree_item_select() so we get the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
339
diff
changeset
|
1571 TreeView_SelectItem(tmp->window, hti); |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1572 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1573 ptrs = (void **)tvi.lParam; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1574 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1575 containercontextfunc(tmp->window, ptrs ? (char *)ptrs[0] : NULL, x, y, tmp->data, ptrs ? ptrs[1] : NULL); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1576 tmp = NULL; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1577 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1578 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1579 } |
161
c555d06b6c93
Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
1580 else if(strnicmp(tmpbuf, WC_LISTVIEW, strlen(WC_LISTVIEW)+1)==0) |
c555d06b6c93
Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
1581 { |
c555d06b6c93
Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
1582 if(tem->hdr.code == LVN_ITEMCHANGED && tmp->message == TVN_SELCHANGED) |
c555d06b6c93
Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
1583 { |
c555d06b6c93
Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
1584 if(tmp->window == tem->hdr.hwndFrom) |
c555d06b6c93
Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
1585 { |
c555d06b6c93
Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
1586 LV_ITEM lvi; |
c555d06b6c93
Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
1587 int iItem; |
c555d06b6c93
Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
1588 |
350
2216e65ad2ae
Removed slider flags and container selection flags from the header file.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
346
diff
changeset
|
1589 iItem = ListView_GetNextItem(tmp->window, -1, LVNI_SELECTED); |
161
c555d06b6c93
Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
1590 |
c555d06b6c93
Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
1591 memset(&lvi, 0, sizeof(LV_ITEM)); |
c555d06b6c93
Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
1592 |
c555d06b6c93
Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
1593 if(iItem > -1) |
c555d06b6c93
Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
1594 { |
311
24c1dfffe97e
Unified the callback functions for tree and container widgets.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
310
diff
changeset
|
1595 int (*treeselectfunc)(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:
157
diff
changeset
|
1596 |
c555d06b6c93
Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
1597 lvi.iItem = iItem; |
c555d06b6c93
Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
1598 lvi.mask = LVIF_PARAM; |
c555d06b6c93
Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
1599 |
c555d06b6c93
Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
1600 ListView_GetItem(tmp->window, &lvi); |
c555d06b6c93
Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
1601 |
c555d06b6c93
Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
1602 /* Seems to be having lParam as 1 which really sucks */ |
c555d06b6c93
Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
1603 if(lvi.lParam < 100) |
c555d06b6c93
Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
1604 lvi.lParam = 0; |
c555d06b6c93
Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
1605 |
311
24c1dfffe97e
Unified the callback functions for tree and container widgets.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
310
diff
changeset
|
1606 treeselectfunc(tmp->window, 0, (char *)lvi.lParam, tmp->data, 0); |
161
c555d06b6c93
Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
1607 tmp = NULL; |
c555d06b6c93
Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
1608 } |
c555d06b6c93
Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
1609 } |
c555d06b6c93
Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
1610 } |
c555d06b6c93
Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
1611 } |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1612 } |
332
7b0f00729a32
Implement switch-page signal for notebooks. Bit of a bug in that it fires
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
328
diff
changeset
|
1613 else if(tmp->message == TCN_SELCHANGE) |
7b0f00729a32
Implement switch-page signal for notebooks. Bit of a bug in that it fires
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
328
diff
changeset
|
1614 { |
7b0f00729a32
Implement switch-page signal for notebooks. Bit of a bug in that it fires
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
328
diff
changeset
|
1615 NMHDR FAR *tem=(NMHDR FAR *)mp2; |
334
0a15a1f3fbed
Check that the notification message is actually TCN_SELCHANGE.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
332
diff
changeset
|
1616 if(tmp->window == tem->hwndFrom && tem->code == tmp->message) |
332
7b0f00729a32
Implement switch-page signal for notebooks. Bit of a bug in that it fires
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
328
diff
changeset
|
1617 { |
346
81fae15885d7
Implemented switch-page on OS/2, and changed the signal prototype to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
344
diff
changeset
|
1618 int (*switchpagefunc)(HWND, unsigned long, void *) = tmp->signalfunction; |
81fae15885d7
Implemented switch-page on OS/2, and changed the signal prototype to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
344
diff
changeset
|
1619 unsigned long num=dw_notebook_page_query(tem->hwndFrom); |
332
7b0f00729a32
Implement switch-page signal for notebooks. Bit of a bug in that it fires
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
328
diff
changeset
|
1620 result = switchpagefunc(tem->hwndFrom, num, tmp->data); |
346
81fae15885d7
Implemented switch-page on OS/2, and changed the signal prototype to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
344
diff
changeset
|
1621 tmp = NULL; |
332
7b0f00729a32
Implement switch-page signal for notebooks. Bit of a bug in that it fires
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
328
diff
changeset
|
1622 } |
7b0f00729a32
Implement switch-page signal for notebooks. Bit of a bug in that it fires
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
328
diff
changeset
|
1623 } |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1624 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1625 break; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1626 case WM_COMMAND: |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1627 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1628 int (*clickfunc)(HWND, void *) = tmp->signalfunction; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1629 HWND command; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1630 ULONG passthru = (ULONG)LOWORD(mp1); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1631 ULONG message = HIWORD(mp1); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1632 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1633 command = (HWND)passthru; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1634 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1635 if(message == LBN_SELCHANGE || message == CBN_SELCHANGE) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1636 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1637 int (*listboxselectfunc)(HWND, int, void *) = tmp->signalfunction; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1638 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1639 if(tmp->message == LBN_SELCHANGE && tmp->window == (HWND)mp2) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1640 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1641 result = listboxselectfunc(tmp->window, dw_listbox_selected(tmp->window), tmp->data); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1642 tmp = NULL; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1643 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1644 } /* Make sure it's the right window, and the right ID */ |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1645 else if(tmp->window < (HWND)65536 && command == tmp->window) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1646 { |
93
98cce029a611
Changed handling of menu item click events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
90
diff
changeset
|
1647 result = clickfunc(popup ? popup : tmp->window, tmp->data); |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1648 tmp = NULL; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1649 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1650 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1651 break; |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
1652 case WM_HSCROLL: |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
1653 case WM_VSCROLL: |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
1654 { |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
1655 char tmpbuf[100]; |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
1656 HWND handle = (HWND)mp2; |
204
098ed34d41fb
The basics of the new scrollbar code on Windows, and dw_main_iteration().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
201
diff
changeset
|
1657 int (*valuechangefunc)(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:
61
diff
changeset
|
1658 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
1659 GetClassName(handle, tmpbuf, 99); |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
1660 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
1661 if(strnicmp(tmpbuf, TRACKBAR_CLASS, strlen(TRACKBAR_CLASS)+1)==0) |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
1662 { |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
1663 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
1664 if(handle == tmp->window) |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
1665 { |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
1666 int value = (int)SendMessage(handle, TBM_GETPOS, 0, 0); |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
1667 int max = (int)SendMessage(handle, TBM_GETRANGEMAX, 0, 0); |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
1668 ULONG currentstyle = GetWindowLong(handle, GWL_STYLE); |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
1669 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
1670 if(currentstyle & TBS_VERT) |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
1671 result = valuechangefunc(tmp->window, max - value, tmp->data); |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
1672 else |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
1673 result = valuechangefunc(tmp->window, value, tmp->data); |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
1674 tmp = NULL; |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
1675 } |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
1676 } |
204
098ed34d41fb
The basics of the new scrollbar code on Windows, and dw_main_iteration().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
201
diff
changeset
|
1677 else if(strnicmp(tmpbuf, SCROLLBARCLASSNAME, strlen(SCROLLBARCLASSNAME)+1)==0) |
098ed34d41fb
The basics of the new scrollbar code on Windows, and dw_main_iteration().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
201
diff
changeset
|
1678 { |
211
e57c182cac64
Automatically scroll when getting PAGE and LINE messages, not just
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
209
diff
changeset
|
1679 if(handle == tmp->window) |
204
098ed34d41fb
The basics of the new scrollbar code on Windows, and dw_main_iteration().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
201
diff
changeset
|
1680 { |
211
e57c182cac64
Automatically scroll when getting PAGE and LINE messages, not just
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
209
diff
changeset
|
1681 int value = _HandleScroller(handle, (int)HIWORD(mp1), (int)LOWORD(mp1)); |
e57c182cac64
Automatically scroll when getting PAGE and LINE messages, not just
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
209
diff
changeset
|
1682 |
e57c182cac64
Automatically scroll when getting PAGE and LINE messages, not just
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
209
diff
changeset
|
1683 if(value > -1) |
e57c182cac64
Automatically scroll when getting PAGE and LINE messages, not just
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
209
diff
changeset
|
1684 { |
e57c182cac64
Automatically scroll when getting PAGE and LINE messages, not just
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
209
diff
changeset
|
1685 dw_scrollbar_set_pos(tmp->window, value); |
e57c182cac64
Automatically scroll when getting PAGE and LINE messages, not just
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
209
diff
changeset
|
1686 result = valuechangefunc(tmp->window, value, tmp->data); |
e57c182cac64
Automatically scroll when getting PAGE and LINE messages, not just
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
209
diff
changeset
|
1687 } |
204
098ed34d41fb
The basics of the new scrollbar code on Windows, and dw_main_iteration().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
201
diff
changeset
|
1688 tmp = NULL; |
211
e57c182cac64
Automatically scroll when getting PAGE and LINE messages, not just
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
209
diff
changeset
|
1689 msg = 0; |
204
098ed34d41fb
The basics of the new scrollbar code on Windows, and dw_main_iteration().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
201
diff
changeset
|
1690 } |
098ed34d41fb
The basics of the new scrollbar code on Windows, and dw_main_iteration().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
201
diff
changeset
|
1691 } |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
1692 } |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
1693 break; |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1694 } |
3 | 1695 } |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1696 if(tmp) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1697 tmp = tmp->next; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1698 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1699 command_active = 0; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1700 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1701 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1702 /* Now that any handlers are done... do normal processing */ |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1703 switch( msg ) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1704 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1705 case WM_PAINT: |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1706 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1707 PAINTSTRUCT ps; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1708 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1709 BeginPaint(hWnd, &ps); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1710 EndPaint(hWnd, &ps); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1711 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1712 break; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1713 case WM_SIZE: |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1714 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1715 static int lastx = -1, lasty = -1; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1716 static HWND lasthwnd = 0; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1717 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1718 if(lastx != LOWORD(mp2) || lasty != HIWORD(mp2) || lasthwnd != hWnd) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1719 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1720 Box *mybox = (Box *)GetWindowLong(hWnd, GWL_USERDATA); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1721 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1722 if(mybox && mybox->count) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1723 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1724 lastx = LOWORD(mp2); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1725 lasty = HIWORD(mp2); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1726 lasthwnd = hWnd; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1727 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1728 ShowWindow(mybox->items[0].hwnd, SW_HIDE); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1729 _do_resize(mybox,LOWORD(mp2),HIWORD(mp2)); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1730 ShowWindow(mybox->items[0].hwnd, SW_SHOW); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1731 return 0; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1732 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1733 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1734 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1735 break; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1736 case WM_CHAR: |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1737 if(LOWORD(mp1) == '\t') |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1738 { |
82
aec9a0b0b539
Fixes for a resource leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
79
diff
changeset
|
1739 if(GetAsyncKeyState(VK_SHIFT) & 0x8000) |
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
|
1740 _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
|
1741 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
|
1742 _shift_focus(hWnd); |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1743 return TRUE; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1744 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1745 break; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1746 case WM_USER: |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1747 windowfunc = (void *)mp1; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1748 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1749 if(windowfunc) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1750 windowfunc((void *)mp2); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1751 break; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1752 case WM_NOTIFY: |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1753 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1754 NMHDR FAR *tem=(NMHDR FAR *)mp2; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1755 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1756 if(tem->code == TCN_SELCHANGING) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1757 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1758 int num=TabCtrl_GetCurSel(tem->hwndFrom); |
191
634625c3239d
Fixes for dw_color_xxxx_set() to accept OS/2 style colors, and fixed a
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
185
diff
changeset
|
1759 NotebookPage **array = (NotebookPage **)dw_window_get_data(tem->hwndFrom, "_dw_array"); |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1760 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1761 if(num > -1 && array && array[num]) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1762 SetParent(array[num]->hwnd, DW_HWND_OBJECT); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1763 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1764 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1765 else if(tem->code == TCN_SELCHANGE) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1766 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1767 int num=TabCtrl_GetCurSel(tem->hwndFrom); |
191
634625c3239d
Fixes for dw_color_xxxx_set() to accept OS/2 style colors, and fixed a
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
185
diff
changeset
|
1768 NotebookPage **array = (NotebookPage **)dw_window_get_data(tem->hwndFrom, "_dw_array"); |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1769 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1770 if(num > -1 && array && array[num]) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1771 SetParent(array[num]->hwnd, tem->hwndFrom); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1772 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1773 _resize_notebook_page(tem->hwndFrom, num); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1774 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1775 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1776 break; |
204
098ed34d41fb
The basics of the new scrollbar code on Windows, and dw_main_iteration().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
201
diff
changeset
|
1777 case WM_HSCROLL: |
098ed34d41fb
The basics of the new scrollbar code on Windows, and dw_main_iteration().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
201
diff
changeset
|
1778 case WM_VSCROLL: |
098ed34d41fb
The basics of the new scrollbar code on Windows, and dw_main_iteration().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
201
diff
changeset
|
1779 { |
098ed34d41fb
The basics of the new scrollbar code on Windows, and dw_main_iteration().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
201
diff
changeset
|
1780 HWND handle = (HWND)mp2; |
098ed34d41fb
The basics of the new scrollbar code on Windows, and dw_main_iteration().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
201
diff
changeset
|
1781 |
211
e57c182cac64
Automatically scroll when getting PAGE and LINE messages, not just
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
209
diff
changeset
|
1782 if(dw_window_get_data(handle, "_dw_scrollbar")) |
204
098ed34d41fb
The basics of the new scrollbar code on Windows, and dw_main_iteration().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
201
diff
changeset
|
1783 { |
211
e57c182cac64
Automatically scroll when getting PAGE and LINE messages, not just
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
209
diff
changeset
|
1784 int value = _HandleScroller(handle, (int)HIWORD(mp1), (int)LOWORD(mp1)); |
e57c182cac64
Automatically scroll when getting PAGE and LINE messages, not just
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
209
diff
changeset
|
1785 |
e57c182cac64
Automatically scroll when getting PAGE and LINE messages, not just
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
209
diff
changeset
|
1786 if(value > -1) |
e57c182cac64
Automatically scroll when getting PAGE and LINE messages, not just
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
209
diff
changeset
|
1787 dw_scrollbar_set_pos(handle, value); |
204
098ed34d41fb
The basics of the new scrollbar code on Windows, and dw_main_iteration().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
201
diff
changeset
|
1788 } |
098ed34d41fb
The basics of the new scrollbar code on Windows, and dw_main_iteration().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
201
diff
changeset
|
1789 } |
098ed34d41fb
The basics of the new scrollbar code on Windows, and dw_main_iteration().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
201
diff
changeset
|
1790 break; |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1791 case WM_GETMINMAXINFO: |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1792 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1793 MINMAXINFO *info = (MINMAXINFO *)mp2; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1794 info->ptMinTrackSize.x = 8; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1795 info->ptMinTrackSize.y = 8; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1796 return 0; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1797 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1798 break; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1799 case WM_DESTROY: |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1800 /* Free memory before destroying */ |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1801 _free_window_memory(hWnd, 0); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1802 EnumChildWindows(hWnd, _free_window_memory, 0); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1803 break; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1804 case WM_CTLCOLORSTATIC: |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1805 case WM_CTLCOLORLISTBOX: |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1806 case WM_CTLCOLORBTN: |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1807 case WM_CTLCOLOREDIT: |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1808 case WM_CTLCOLORMSGBOX: |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1809 case WM_CTLCOLORSCROLLBAR: |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1810 case WM_CTLCOLORDLG: |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1811 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1812 ColorInfo *thiscinfo = (ColorInfo *)GetWindowLong((HWND)mp2, GWL_USERDATA); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1813 if(thiscinfo && thiscinfo->fore != -1 && thiscinfo->back != -1) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1814 { |
155
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
1815 /* Handle foreground */ |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
1816 if(thiscinfo->fore > -1 && thiscinfo->fore < 18) |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1817 { |
155
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
1818 if(thiscinfo->fore != DW_CLR_DEFAULT) |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
1819 { |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
1820 SetTextColor((HDC)mp1, RGB(_red[thiscinfo->fore], |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
1821 _green[thiscinfo->fore], |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
1822 _blue[thiscinfo->fore])); |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
1823 } |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1824 } |
155
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
1825 else if((thiscinfo->fore & DW_RGB_COLOR) == DW_RGB_COLOR) |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1826 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1827 SetTextColor((HDC)mp1, RGB(DW_RED_VALUE(thiscinfo->fore), |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1828 DW_GREEN_VALUE(thiscinfo->fore), |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1829 DW_BLUE_VALUE(thiscinfo->fore))); |
155
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
1830 } |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
1831 /* Handle background */ |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
1832 if(thiscinfo->back > -1 && thiscinfo->back < 18) |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
1833 { |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
1834 if(thiscinfo->back == DW_CLR_DEFAULT) |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
1835 { |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
1836 HBRUSH hbr = GetSysColorBrush(COLOR_3DFACE); |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
1837 |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
1838 SelectObject((HDC)mp1, hbr); |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
1839 return (LONG)hbr; |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
1840 } |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
1841 else |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
1842 { |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
1843 SetBkColor((HDC)mp1, RGB(_red[thiscinfo->back], |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
1844 _green[thiscinfo->back], |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
1845 _blue[thiscinfo->back])); |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
1846 if(thiscinfo->hbrush) |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
1847 DeleteObject(thiscinfo->hbrush); |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
1848 thiscinfo->hbrush = CreateSolidBrush(RGB(_red[thiscinfo->back], |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
1849 _green[thiscinfo->back], |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
1850 _blue[thiscinfo->back])); |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
1851 SelectObject((HDC)mp1, thiscinfo->hbrush); |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
1852 } |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
1853 return (LONG)thiscinfo->hbrush; |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
1854 } |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
1855 else if((thiscinfo->back & DW_RGB_COLOR) == DW_RGB_COLOR) |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
1856 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1857 SetBkColor((HDC)mp1, RGB(DW_RED_VALUE(thiscinfo->back), |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1858 DW_GREEN_VALUE(thiscinfo->back), |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1859 DW_BLUE_VALUE(thiscinfo->back))); |
82
aec9a0b0b539
Fixes for a resource leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
79
diff
changeset
|
1860 if(thiscinfo->hbrush) |
aec9a0b0b539
Fixes for a resource leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
79
diff
changeset
|
1861 DeleteObject(thiscinfo->hbrush); |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1862 thiscinfo->hbrush = CreateSolidBrush(RGB(DW_RED_VALUE(thiscinfo->back), |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1863 DW_GREEN_VALUE(thiscinfo->back), |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1864 DW_BLUE_VALUE(thiscinfo->back))); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1865 SelectObject((HDC)mp1, thiscinfo->hbrush); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1866 return (LONG)thiscinfo->hbrush; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1867 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1868 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1869 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1870 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1871 break; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1872 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1873 if(result != -1) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1874 return result; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1875 else |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1876 return DefWindowProc(hWnd, msg, mp1, mp2); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1877 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1878 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1879 BOOL CALLBACK _framewndproc(HWND hWnd, UINT msg, WPARAM mp1, LPARAM mp2) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1880 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1881 switch( msg ) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1882 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1883 case WM_LBUTTONDOWN: |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1884 case WM_MBUTTONDOWN: |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1885 case WM_RBUTTONDOWN: |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1886 SetActiveWindow(hWnd); |
106
4b6799f3dbbc
Give the frame window focus if it is clicked on.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
105
diff
changeset
|
1887 SetFocus(hWnd); |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1888 break; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1889 case WM_COMMAND: |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1890 case WM_NOTIFY: |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1891 _wndproc(hWnd, msg, mp1, mp2); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1892 break; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1893 #if 0 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1894 case WM_ERASEBKGND: |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1895 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1896 ColorInfo *thiscinfo = (ColorInfo *)GetWindowLong(hWnd, GWL_USERDATA); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1897 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1898 if(thiscinfo && thiscinfo->fore != -1 && thiscinfo->back != -1) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1899 return FALSE; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1900 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1901 break; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1902 #endif |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1903 case WM_PAINT: |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1904 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1905 ColorInfo *thiscinfo = (ColorInfo *)GetWindowLong(hWnd, GWL_USERDATA); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1906 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1907 if(thiscinfo && thiscinfo->fore != -1 && thiscinfo->back != -1) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1908 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1909 PAINTSTRUCT ps; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1910 HDC hdcPaint = BeginPaint(hWnd, &ps); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1911 int success = FALSE; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1912 |
155
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
1913 if(thiscinfo && thiscinfo->fore != -1 && thiscinfo->back != -1) |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1914 { |
155
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
1915 /* Handle foreground */ |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
1916 if(thiscinfo->fore > -1 && thiscinfo->fore < 18) |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
1917 { |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
1918 if(thiscinfo->fore != DW_CLR_DEFAULT) |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
1919 { |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
1920 SetTextColor((HDC)mp1, RGB(_red[thiscinfo->fore], |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
1921 _green[thiscinfo->fore], |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
1922 _blue[thiscinfo->fore])); |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
1923 } |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
1924 } |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
1925 else if((thiscinfo->fore & DW_RGB_COLOR) == DW_RGB_COLOR) |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
1926 { |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
1927 SetTextColor((HDC)mp1, RGB(DW_RED_VALUE(thiscinfo->fore), |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
1928 DW_GREEN_VALUE(thiscinfo->fore), |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
1929 DW_BLUE_VALUE(thiscinfo->fore))); |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
1930 } |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
1931 /* Handle background */ |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
1932 if(thiscinfo->back > -1 && thiscinfo->back < 18) |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
1933 { |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
1934 if(thiscinfo->back != DW_CLR_DEFAULT) |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
1935 { |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
1936 SetBkColor((HDC)mp1, RGB(_red[thiscinfo->back], |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
1937 _green[thiscinfo->back], |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
1938 _blue[thiscinfo->back])); |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
1939 if(thiscinfo->hbrush) |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
1940 DeleteObject(thiscinfo->hbrush); |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
1941 thiscinfo->hbrush = CreateSolidBrush(RGB(_red[thiscinfo->back], |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
1942 _green[thiscinfo->back], |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
1943 _blue[thiscinfo->back])); |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
1944 SelectObject(hdcPaint, thiscinfo->hbrush); |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
1945 Rectangle(hdcPaint, ps.rcPaint.left - 1, ps.rcPaint.top - 1, ps.rcPaint.right + 1, ps.rcPaint.bottom + 1); |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
1946 success = TRUE; |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
1947 } |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
1948 } |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
1949 else if((thiscinfo->back & DW_RGB_COLOR) == DW_RGB_COLOR) |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
1950 { |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
1951 SetBkColor((HDC)mp1, RGB(DW_RED_VALUE(thiscinfo->back), |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
1952 DW_GREEN_VALUE(thiscinfo->back), |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
1953 DW_BLUE_VALUE(thiscinfo->back))); |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
1954 if(thiscinfo->hbrush) |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
1955 DeleteObject(thiscinfo->hbrush); |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
1956 thiscinfo->hbrush = CreateSolidBrush(RGB(DW_RED_VALUE(thiscinfo->back), |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
1957 DW_GREEN_VALUE(thiscinfo->back), |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
1958 DW_BLUE_VALUE(thiscinfo->back))); |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
1959 SelectObject(hdcPaint, thiscinfo->hbrush); |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
1960 Rectangle(hdcPaint, ps.rcPaint.left - 1, ps.rcPaint.top - 1, ps.rcPaint.right + 1, ps.rcPaint.bottom + 1); |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
1961 success = TRUE; |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
1962 } |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1963 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1964 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1965 EndPaint(hWnd, &ps); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1966 if(success) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1967 return FALSE; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1968 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1969 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1970 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1971 break; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1972 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1973 return DefWindowProc(hWnd, msg, mp1, mp2); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1974 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1975 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1976 BOOL CALLBACK _rendwndproc(HWND hWnd, UINT msg, WPARAM mp1, LPARAM mp2) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1977 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1978 switch( msg ) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1979 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1980 case WM_LBUTTONDOWN: |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1981 case WM_MBUTTONDOWN: |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1982 case WM_RBUTTONDOWN: |
267
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
1983 SetFocus(hWnd); |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1984 _wndproc(hWnd, msg, mp1, mp2); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1985 break; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1986 case WM_LBUTTONUP: |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1987 case WM_MBUTTONUP: |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1988 case WM_RBUTTONUP: |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1989 case WM_MOUSEMOVE: |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1990 case WM_PAINT: |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1991 case WM_SIZE: |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1992 case WM_COMMAND: |
267
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
1993 case WM_CHAR: |
295
aac3ab26d636
More key_press cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
294
diff
changeset
|
1994 case WM_KEYDOWN: |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1995 _wndproc(hWnd, msg, mp1, mp2); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1996 break; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1997 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1998 return DefWindowProc(hWnd, msg, mp1, mp2); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
1999 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2000 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2001 BOOL CALLBACK _spinnerwndproc(HWND hWnd, UINT msg, WPARAM mp1, LPARAM mp2) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2002 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2003 ColorInfo *cinfo; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2004 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2005 cinfo = (ColorInfo *)GetWindowLong(hWnd, GWL_USERDATA); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2006 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2007 if(cinfo) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2008 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2009 switch( msg ) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2010 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2011 case WM_LBUTTONDOWN: |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2012 case WM_MBUTTONDOWN: |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2013 case WM_RBUTTONDOWN: |
109
94d273843a41
Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
107
diff
changeset
|
2014 case WM_KEYDOWN: |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2015 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2016 BOOL ret; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2017 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2018 if(!cinfo || !cinfo->pOldProc) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2019 ret = DefWindowProc(hWnd, msg, mp1, mp2); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2020 ret = CallWindowProc(cinfo->pOldProc, hWnd, msg, mp1, mp2); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2021 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2022 /* Tell the edit control that a buttonpress has |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2023 * occured and to update it's window title. |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2024 */ |
109
94d273843a41
Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
107
diff
changeset
|
2025 if(cinfo && cinfo->buddy) |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2026 SendMessage(cinfo->buddy, WM_USER+10, 0, 0); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2027 |
109
94d273843a41
Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
107
diff
changeset
|
2028 SetTimer(hWnd, 100, 100, (TIMERPROC)NULL); |
94d273843a41
Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
107
diff
changeset
|
2029 |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2030 return ret; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2031 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2032 break; |
109
94d273843a41
Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
107
diff
changeset
|
2033 case WM_LBUTTONUP: |
94d273843a41
Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
107
diff
changeset
|
2034 case WM_MBUTTONUP: |
94d273843a41
Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
107
diff
changeset
|
2035 case WM_RBUTTONUP: |
94d273843a41
Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
107
diff
changeset
|
2036 case WM_KEYUP: |
94d273843a41
Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
107
diff
changeset
|
2037 { |
94d273843a41
Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
107
diff
changeset
|
2038 BOOL ret; |
94d273843a41
Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
107
diff
changeset
|
2039 |
94d273843a41
Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
107
diff
changeset
|
2040 if(!cinfo || !cinfo->pOldProc) |
94d273843a41
Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
107
diff
changeset
|
2041 ret = DefWindowProc(hWnd, msg, mp1, mp2); |
94d273843a41
Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
107
diff
changeset
|
2042 ret = CallWindowProc(cinfo->pOldProc, hWnd, msg, mp1, mp2); |
94d273843a41
Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
107
diff
changeset
|
2043 |
94d273843a41
Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
107
diff
changeset
|
2044 /* Tell the edit control that a buttonpress has |
94d273843a41
Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
107
diff
changeset
|
2045 * occured and to update it's window title. |
94d273843a41
Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
107
diff
changeset
|
2046 */ |
94d273843a41
Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
107
diff
changeset
|
2047 if(cinfo && cinfo->buddy) |
94d273843a41
Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
107
diff
changeset
|
2048 SendMessage(cinfo->buddy, WM_USER+10, 0, 0); |
94d273843a41
Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
107
diff
changeset
|
2049 |
94d273843a41
Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
107
diff
changeset
|
2050 KillTimer(hWnd, 100); |
94d273843a41
Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
107
diff
changeset
|
2051 |
94d273843a41
Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
107
diff
changeset
|
2052 return ret; |
94d273843a41
Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
107
diff
changeset
|
2053 } |
94d273843a41
Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
107
diff
changeset
|
2054 break; |
94d273843a41
Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
107
diff
changeset
|
2055 case WM_TIMER: |
94d273843a41
Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
107
diff
changeset
|
2056 { |
94d273843a41
Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
107
diff
changeset
|
2057 if(mp1 == 100) |
94d273843a41
Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
107
diff
changeset
|
2058 { |
94d273843a41
Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
107
diff
changeset
|
2059 BOOL ret; |
94d273843a41
Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
107
diff
changeset
|
2060 |
94d273843a41
Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
107
diff
changeset
|
2061 if(cinfo && cinfo->buddy) |
94d273843a41
Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
107
diff
changeset
|
2062 SendMessage(cinfo->buddy, WM_USER+10, 0, 0); |
94d273843a41
Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
107
diff
changeset
|
2063 |
94d273843a41
Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
107
diff
changeset
|
2064 if(!cinfo || !cinfo->pOldProc) |
94d273843a41
Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
107
diff
changeset
|
2065 ret = DefWindowProc(hWnd, msg, mp1, mp2); |
94d273843a41
Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
107
diff
changeset
|
2066 ret = CallWindowProc(cinfo->pOldProc, hWnd, msg, mp1, mp2); |
94d273843a41
Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
107
diff
changeset
|
2067 |
94d273843a41
Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
107
diff
changeset
|
2068 /* Tell the edit control that a buttonpress has |
94d273843a41
Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
107
diff
changeset
|
2069 * occured and to update it's window title. |
94d273843a41
Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
107
diff
changeset
|
2070 */ |
94d273843a41
Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
107
diff
changeset
|
2071 if(cinfo && cinfo->buddy) |
94d273843a41
Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
107
diff
changeset
|
2072 SendMessage(cinfo->buddy, WM_USER+10, 0, 0); |
94d273843a41
Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
107
diff
changeset
|
2073 |
94d273843a41
Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
107
diff
changeset
|
2074 return ret; |
94d273843a41
Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
107
diff
changeset
|
2075 } |
94d273843a41
Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
107
diff
changeset
|
2076 } |
94d273843a41
Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
107
diff
changeset
|
2077 break; |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2078 case WM_USER+10: |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2079 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2080 if(cinfo->buddy) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2081 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2082 char tempbuf[100] = ""; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2083 long position; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2084 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2085 GetWindowText(cinfo->buddy, tempbuf, 99); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2086 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2087 position = atol(tempbuf); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2088 |
75
c629838d9805
Updated to latest DW, and updated the Makefile to install the header files
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
73
diff
changeset
|
2089 if(IS_IE5PLUS) |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2090 SendMessage(hWnd, UDM_SETPOS32, 0, (LPARAM)position); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2091 else |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2092 SendMessage(hWnd, UDM_SETPOS, 0, (LPARAM)MAKELONG((short)position, 0)); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2093 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2094 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2095 break; |
3 | 2096 } |
57
1ed95c8ec2ff
Added a mutex lock and unlock in the pointer calls. And fixed a warning
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
55
diff
changeset
|
2097 } |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2098 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2099 if(!cinfo || !cinfo->pOldProc) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2100 return DefWindowProc(hWnd, msg, mp1, mp2); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2101 return CallWindowProc(cinfo->pOldProc, hWnd, msg, mp1, mp2); |
3 | 2102 } |
2103 | |
40
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
2104 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
|
2105 { |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
2106 char tmpbuf[100]; |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
2107 |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2108 GetClassName(handle, tmpbuf, 99); |
40
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
2109 |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
2110 /* 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
|
2111 * obtain input focus. |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
2112 */ |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2113 if(strnicmp(tmpbuf, BUTTONCLASSNAME, strlen(BUTTONCLASSNAME))==0) |
40
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
2114 { |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
2115 /* 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
|
2116 SignalHandler *tmp = Root; |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
2117 |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
2118 /* 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
|
2119 while(tmp) |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
2120 { |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
2121 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
|
2122 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2123 int (*clickfunc)(HWND, void *) = tmp->signalfunction; |
40
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
2124 |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
2125 /* 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
|
2126 if(tmp->window == handle) |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
2127 { |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
2128 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
|
2129 tmp = NULL; |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
2130 } |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
2131 } |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
2132 if(tmp) |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
2133 tmp= tmp->next; |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
2134 } |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
2135 } |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
2136 else |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2137 SetFocus(handle); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2138 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2139 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2140 BOOL CALLBACK _colorwndproc(HWND hWnd, UINT msg, WPARAM mp1, LPARAM mp2) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2141 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2142 ColorInfo *cinfo; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2143 char tmpbuf[100]; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2144 WNDPROC pOldProc = 0; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2145 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2146 cinfo = (ColorInfo *)GetWindowLong(hWnd, GWL_USERDATA); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2147 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2148 GetClassName(hWnd, tmpbuf, 99); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2149 if(strcmp(tmpbuf, FRAMECLASSNAME) == 0) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2150 cinfo = &(((Box *)cinfo)->cinfo); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2151 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2152 if(cinfo) |
57
1ed95c8ec2ff
Added a mutex lock and unlock in the pointer calls. And fixed a warning
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
55
diff
changeset
|
2153 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2154 pOldProc = cinfo->pOldProc; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2155 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2156 switch( msg ) |
3 | 2157 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2158 case WM_SETFOCUS: |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2159 if(cinfo->combo) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2160 _wndproc(cinfo->combo, msg, mp1, mp2); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2161 else |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2162 _wndproc(hWnd, msg, mp1, mp2); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2163 break; |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
2164 case WM_VSCROLL: |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
2165 case WM_HSCROLL: |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
2166 _wndproc(hWnd, msg, mp1, mp2); |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
2167 break; |
110
d4c1a9ebc72f
Spinbutton behaviour cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
109
diff
changeset
|
2168 case WM_KEYDOWN: |
d4c1a9ebc72f
Spinbutton behaviour cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
109
diff
changeset
|
2169 case WM_KEYUP: |
d4c1a9ebc72f
Spinbutton behaviour cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
109
diff
changeset
|
2170 { |
d4c1a9ebc72f
Spinbutton behaviour cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
109
diff
changeset
|
2171 if(mp1 == VK_UP || mp1 == VK_DOWN) |
d4c1a9ebc72f
Spinbutton behaviour cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
109
diff
changeset
|
2172 { |
d4c1a9ebc72f
Spinbutton behaviour cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
109
diff
changeset
|
2173 BOOL ret; |
d4c1a9ebc72f
Spinbutton behaviour cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
109
diff
changeset
|
2174 |
d4c1a9ebc72f
Spinbutton behaviour cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
109
diff
changeset
|
2175 if(!cinfo || !cinfo->pOldProc) |
d4c1a9ebc72f
Spinbutton behaviour cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
109
diff
changeset
|
2176 ret = DefWindowProc(hWnd, msg, mp1, mp2); |
d4c1a9ebc72f
Spinbutton behaviour cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
109
diff
changeset
|
2177 ret = CallWindowProc(cinfo->pOldProc, hWnd, msg, mp1, mp2); |
d4c1a9ebc72f
Spinbutton behaviour cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
109
diff
changeset
|
2178 |
d4c1a9ebc72f
Spinbutton behaviour cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
109
diff
changeset
|
2179 /* Tell the spinner control that a keypress has |
d4c1a9ebc72f
Spinbutton behaviour cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
109
diff
changeset
|
2180 * occured and to update it's internal value. |
d4c1a9ebc72f
Spinbutton behaviour cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
109
diff
changeset
|
2181 */ |
d4c1a9ebc72f
Spinbutton behaviour cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
109
diff
changeset
|
2182 if(cinfo && cinfo->buddy && !cinfo->combo) |
d4c1a9ebc72f
Spinbutton behaviour cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
109
diff
changeset
|
2183 PostMessage(hWnd, WM_USER+10, 0, 0); |
d4c1a9ebc72f
Spinbutton behaviour cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
109
diff
changeset
|
2184 |
d4c1a9ebc72f
Spinbutton behaviour cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
109
diff
changeset
|
2185 if(msg == WM_KEYDOWN) |
d4c1a9ebc72f
Spinbutton behaviour cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
109
diff
changeset
|
2186 SetTimer(hWnd, 101, 100, (TIMERPROC)NULL); |
d4c1a9ebc72f
Spinbutton behaviour cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
109
diff
changeset
|
2187 else |
d4c1a9ebc72f
Spinbutton behaviour cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
109
diff
changeset
|
2188 KillTimer(hWnd, 101); |
d4c1a9ebc72f
Spinbutton behaviour cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
109
diff
changeset
|
2189 |
d4c1a9ebc72f
Spinbutton behaviour cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
109
diff
changeset
|
2190 return ret; |
d4c1a9ebc72f
Spinbutton behaviour cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
109
diff
changeset
|
2191 } |
d4c1a9ebc72f
Spinbutton behaviour cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
109
diff
changeset
|
2192 } |
d4c1a9ebc72f
Spinbutton behaviour cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
109
diff
changeset
|
2193 break; |
d4c1a9ebc72f
Spinbutton behaviour cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
109
diff
changeset
|
2194 case WM_TIMER: |
d4c1a9ebc72f
Spinbutton behaviour cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
109
diff
changeset
|
2195 { |
d4c1a9ebc72f
Spinbutton behaviour cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
109
diff
changeset
|
2196 if(mp1 == 101) |
d4c1a9ebc72f
Spinbutton behaviour cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
109
diff
changeset
|
2197 { |
d4c1a9ebc72f
Spinbutton behaviour cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
109
diff
changeset
|
2198 BOOL ret; |
d4c1a9ebc72f
Spinbutton behaviour cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
109
diff
changeset
|
2199 |
d4c1a9ebc72f
Spinbutton behaviour cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
109
diff
changeset
|
2200 if(!cinfo || !cinfo->pOldProc) |
d4c1a9ebc72f
Spinbutton behaviour cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
109
diff
changeset
|
2201 ret = DefWindowProc(hWnd, msg, mp1, mp2); |
d4c1a9ebc72f
Spinbutton behaviour cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
109
diff
changeset
|
2202 ret = CallWindowProc(cinfo->pOldProc, hWnd, msg, mp1, mp2); |
d4c1a9ebc72f
Spinbutton behaviour cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
109
diff
changeset
|
2203 |
d4c1a9ebc72f
Spinbutton behaviour cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
109
diff
changeset
|
2204 /* Tell the spinner control that a keypress has |
d4c1a9ebc72f
Spinbutton behaviour cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
109
diff
changeset
|
2205 * occured and to update it's internal value. |
d4c1a9ebc72f
Spinbutton behaviour cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
109
diff
changeset
|
2206 */ |
d4c1a9ebc72f
Spinbutton behaviour cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
109
diff
changeset
|
2207 if(cinfo && cinfo->buddy && !cinfo->combo) |
d4c1a9ebc72f
Spinbutton behaviour cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
109
diff
changeset
|
2208 PostMessage(hWnd, WM_USER+10, 0, 0); |
d4c1a9ebc72f
Spinbutton behaviour cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
109
diff
changeset
|
2209 |
d4c1a9ebc72f
Spinbutton behaviour cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
109
diff
changeset
|
2210 return ret; |
d4c1a9ebc72f
Spinbutton behaviour cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
109
diff
changeset
|
2211 } |
d4c1a9ebc72f
Spinbutton behaviour cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
109
diff
changeset
|
2212 } |
d4c1a9ebc72f
Spinbutton behaviour cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
109
diff
changeset
|
2213 break; |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2214 case WM_CHAR: |
277
d706e0dbb0cb
Pass WM_CHAR messages to the signal handler proc for boxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
267
diff
changeset
|
2215 _wndproc(hWnd, msg, mp1, mp2); |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2216 if(LOWORD(mp1) == '\t') |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2217 { |
82
aec9a0b0b539
Fixes for a resource leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
79
diff
changeset
|
2218 if(GetAsyncKeyState(VK_SHIFT) & 0x8000) |
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
|
2219 { |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
2220 if(cinfo->combo) |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
2221 _shift_focus_back(cinfo->combo); |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
2222 else if(cinfo->buddy) |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
2223 _shift_focus_back(cinfo->buddy); |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
2224 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
|
2225 _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
|
2226 } |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2227 else |
61
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
2228 { |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
2229 if(cinfo->combo) |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
2230 _shift_focus(cinfo->combo); |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
2231 else if(cinfo->buddy) |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
2232 _shift_focus(cinfo->buddy); |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
2233 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
|
2234 _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
|
2235 } |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2236 return FALSE; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2237 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2238 else if(LOWORD(mp1) == '\r') |
3 | 2239 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2240 if(cinfo->clickdefault) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2241 _click_default(cinfo->clickdefault); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2242 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2243 } |
111
1e406d67b178
Readded a piece of code I accidentally removed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
110
diff
changeset
|
2244 |
1e406d67b178
Readded a piece of code I accidentally removed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
110
diff
changeset
|
2245 /* Tell the spinner control that a keypress has |
1e406d67b178
Readded a piece of code I accidentally removed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
110
diff
changeset
|
2246 * occured and to update it's internal value. |
1e406d67b178
Readded a piece of code I accidentally removed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
110
diff
changeset
|
2247 */ |
1e406d67b178
Readded a piece of code I accidentally removed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
110
diff
changeset
|
2248 if(cinfo->buddy && !cinfo->combo) |
1e406d67b178
Readded a piece of code I accidentally removed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
110
diff
changeset
|
2249 { |
1e406d67b178
Readded a piece of code I accidentally removed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
110
diff
changeset
|
2250 if(IsWinNT()) |
1e406d67b178
Readded a piece of code I accidentally removed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
110
diff
changeset
|
2251 PostMessage(cinfo->buddy, WM_USER+10, 0, 0); |
1e406d67b178
Readded a piece of code I accidentally removed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
110
diff
changeset
|
2252 else |
1e406d67b178
Readded a piece of code I accidentally removed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
110
diff
changeset
|
2253 SendMessage(cinfo->buddy, WM_USER+10, 0, 0); |
1e406d67b178
Readded a piece of code I accidentally removed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
110
diff
changeset
|
2254 } |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2255 break; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2256 case WM_USER+10: |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2257 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2258 if(cinfo->buddy) |
57
1ed95c8ec2ff
Added a mutex lock and unlock in the pointer calls. And fixed a warning
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
55
diff
changeset
|
2259 { |
79
8082cb0e7c2e
Updated to the latest DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
75
diff
changeset
|
2260 long val; |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2261 |
75
c629838d9805
Updated to latest DW, and updated the Makefile to install the header files
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
73
diff
changeset
|
2262 if(IS_IE5PLUS) |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2263 val = (long)SendMessage(cinfo->buddy, UDM_GETPOS32, 0, 0); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2264 else |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2265 val = (long)SendMessage(cinfo->buddy, UDM_GETPOS, 0, 0); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2266 |
79
8082cb0e7c2e
Updated to the latest DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
75
diff
changeset
|
2267 sprintf(tmpbuf, "%d", val); |
8082cb0e7c2e
Updated to the latest DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
75
diff
changeset
|
2268 SetWindowText(hWnd, tmpbuf); |
57
1ed95c8ec2ff
Added a mutex lock and unlock in the pointer calls. And fixed a warning
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
55
diff
changeset
|
2269 } |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2270 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2271 break; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2272 case WM_CTLCOLORSTATIC: |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2273 case WM_CTLCOLORLISTBOX: |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2274 case WM_CTLCOLORBTN: |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2275 case WM_CTLCOLOREDIT: |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2276 case WM_CTLCOLORMSGBOX: |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2277 case WM_CTLCOLORSCROLLBAR: |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2278 case WM_CTLCOLORDLG: |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2279 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2280 ColorInfo *thiscinfo = (ColorInfo *)GetWindowLong((HWND)mp2, GWL_USERDATA); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2281 if(thiscinfo && thiscinfo->fore != -1 && thiscinfo->back != -1) |
57
1ed95c8ec2ff
Added a mutex lock and unlock in the pointer calls. And fixed a warning
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
55
diff
changeset
|
2282 { |
155
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
2283 /* Handle foreground */ |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
2284 if(thiscinfo->fore > -1 && thiscinfo->fore < 18) |
57
1ed95c8ec2ff
Added a mutex lock and unlock in the pointer calls. And fixed a warning
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
55
diff
changeset
|
2285 { |
155
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
2286 if(thiscinfo->fore != DW_CLR_DEFAULT) |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
2287 { |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
2288 SetTextColor((HDC)mp1, RGB(_red[thiscinfo->fore], |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
2289 _green[thiscinfo->fore], |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
2290 _blue[thiscinfo->fore])); |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
2291 } |
3 | 2292 } |
155
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
2293 else if((thiscinfo->fore & DW_RGB_COLOR) == DW_RGB_COLOR) |
57
1ed95c8ec2ff
Added a mutex lock and unlock in the pointer calls. And fixed a warning
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
55
diff
changeset
|
2294 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2295 SetTextColor((HDC)mp1, RGB(DW_RED_VALUE(thiscinfo->fore), |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2296 DW_GREEN_VALUE(thiscinfo->fore), |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2297 DW_BLUE_VALUE(thiscinfo->fore))); |
155
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
2298 } |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
2299 /* Handle background */ |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
2300 if(thiscinfo->back > -1 && thiscinfo->back < 18) |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
2301 { |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
2302 if(thiscinfo->back == DW_CLR_DEFAULT) |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
2303 { |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
2304 HBRUSH hbr = GetSysColorBrush(COLOR_3DFACE); |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
2305 |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
2306 SetBkColor((HDC)mp1, GetSysColor(COLOR_3DFACE)); |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
2307 |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
2308 |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
2309 SelectObject((HDC)mp1, hbr); |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
2310 return (LONG)hbr; |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
2311 } |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
2312 else |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
2313 { |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
2314 SetBkColor((HDC)mp1, RGB(_red[thiscinfo->back], |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
2315 _green[thiscinfo->back], |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
2316 _blue[thiscinfo->back])); |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
2317 if(thiscinfo->hbrush) |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
2318 DeleteObject(thiscinfo->hbrush); |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
2319 thiscinfo->hbrush = CreateSolidBrush(RGB(_red[thiscinfo->back], |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
2320 _green[thiscinfo->back], |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
2321 _blue[thiscinfo->back])); |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
2322 SelectObject((HDC)mp1, thiscinfo->hbrush); |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
2323 } |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
2324 return (LONG)thiscinfo->hbrush; |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
2325 } |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
2326 else if((thiscinfo->back & DW_RGB_COLOR) == DW_RGB_COLOR) |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
2327 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2328 SetBkColor((HDC)mp1, RGB(DW_RED_VALUE(thiscinfo->back), |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2329 DW_GREEN_VALUE(thiscinfo->back), |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2330 DW_BLUE_VALUE(thiscinfo->back))); |
82
aec9a0b0b539
Fixes for a resource leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
79
diff
changeset
|
2331 if(thiscinfo->hbrush) |
aec9a0b0b539
Fixes for a resource leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
79
diff
changeset
|
2332 DeleteObject(thiscinfo->hbrush); |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2333 thiscinfo->hbrush = CreateSolidBrush(RGB(DW_RED_VALUE(thiscinfo->back), |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2334 DW_GREEN_VALUE(thiscinfo->back), |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2335 DW_BLUE_VALUE(thiscinfo->back))); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2336 SelectObject((HDC)mp1, thiscinfo->hbrush); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2337 return (LONG)thiscinfo->hbrush; |
57
1ed95c8ec2ff
Added a mutex lock and unlock in the pointer calls. And fixed a warning
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
55
diff
changeset
|
2338 } |
1ed95c8ec2ff
Added a mutex lock and unlock in the pointer calls. And fixed a warning
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
55
diff
changeset
|
2339 } |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2340 |
3 | 2341 } |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2342 break; |
57
1ed95c8ec2ff
Added a mutex lock and unlock in the pointer calls. And fixed a warning
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
55
diff
changeset
|
2343 } |
1ed95c8ec2ff
Added a mutex lock and unlock in the pointer calls. And fixed a warning
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
55
diff
changeset
|
2344 } |
1ed95c8ec2ff
Added a mutex lock and unlock in the pointer calls. And fixed a warning
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
55
diff
changeset
|
2345 |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2346 if(!pOldProc) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2347 return DefWindowProc(hWnd, msg, mp1, mp2); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2348 return CallWindowProc(pOldProc, hWnd, msg, mp1, mp2); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2349 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2350 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2351 BOOL CALLBACK _containerwndproc(HWND hWnd, UINT msg, WPARAM mp1, LPARAM mp2) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2352 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2353 ContainerInfo *cinfo; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2354 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2355 cinfo = (ContainerInfo *)GetWindowLong(hWnd, GWL_USERDATA); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2356 |
57
1ed95c8ec2ff
Added a mutex lock and unlock in the pointer calls. And fixed a warning
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
55
diff
changeset
|
2357 switch( msg ) |
1ed95c8ec2ff
Added a mutex lock and unlock in the pointer calls. And fixed a warning
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
55
diff
changeset
|
2358 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2359 case WM_COMMAND: |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2360 case WM_NOTIFY: |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2361 _wndproc(hWnd, msg, mp1, mp2); |
57
1ed95c8ec2ff
Added a mutex lock and unlock in the pointer calls. And fixed a warning
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
55
diff
changeset
|
2362 break; |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2363 case WM_LBUTTONDBLCLK: |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2364 case WM_CHAR: |
57
1ed95c8ec2ff
Added a mutex lock and unlock in the pointer calls. And fixed a warning
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
55
diff
changeset
|
2365 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2366 LV_ITEM lvi; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2367 int iItem; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2368 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2369 if(LOWORD(mp1) == '\t') |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2370 { |
82
aec9a0b0b539
Fixes for a resource leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
79
diff
changeset
|
2371 if(GetAsyncKeyState(VK_SHIFT) & 0x8000) |
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
|
2372 _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
|
2373 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
|
2374 _shift_focus(hWnd); |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2375 return FALSE; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2376 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2377 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2378 if(msg == WM_CHAR && (char)mp1 != '\r') |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2379 break; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2380 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2381 iItem = ListView_GetNextItem(hWnd, -1, LVNI_FOCUSED); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2382 |
69
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
2383 memset(&lvi, 0, sizeof(LV_ITEM)); |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
2384 |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2385 if(iItem > -1) |
3 | 2386 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2387 lvi.iItem = iItem; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2388 lvi.mask = LVIF_PARAM; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2389 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2390 ListView_GetItem(hWnd, &lvi); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2391 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2392 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2393 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2394 SignalHandler *tmp = Root; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2395 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2396 while(tmp) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2397 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2398 if(tmp->message == NM_DBLCLK && tmp->window == hWnd) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2399 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2400 int (*containerselectfunc)(HWND, char *, void *) = tmp->signalfunction; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2401 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2402 /* Seems to be having lParam as 1 which really sucks */ |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2403 if(lvi.lParam < 100) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2404 lvi.lParam = 0; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2405 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2406 containerselectfunc(tmp->window, (char *)lvi.lParam, tmp->data); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2407 tmp = NULL; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2408 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2409 if(tmp) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2410 tmp = tmp->next; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2411 } |
57
1ed95c8ec2ff
Added a mutex lock and unlock in the pointer calls. And fixed a warning
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
55
diff
changeset
|
2412 } |
1ed95c8ec2ff
Added a mutex lock and unlock in the pointer calls. And fixed a warning
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
55
diff
changeset
|
2413 } |
1ed95c8ec2ff
Added a mutex lock and unlock in the pointer calls. And fixed a warning
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
55
diff
changeset
|
2414 break; |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2415 case WM_CONTEXTMENU: |
57
1ed95c8ec2ff
Added a mutex lock and unlock in the pointer calls. And fixed a warning
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
55
diff
changeset
|
2416 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2417 SignalHandler *tmp = Root; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2418 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2419 while(tmp) |
57
1ed95c8ec2ff
Added a mutex lock and unlock in the pointer calls. And fixed a warning
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
55
diff
changeset
|
2420 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2421 if(tmp->message == NM_RCLICK && tmp->window == hWnd) |
3 | 2422 { |
312
ff8f23594b15
Make sure itemdata is NULL for container callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
311
diff
changeset
|
2423 int (*containercontextfunc)(HWND, char *, int, int, void *, void *) = tmp->signalfunction; |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2424 LONG x,y; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2425 LV_ITEM lvi; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2426 int iItem; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2427 LVHITTESTINFO lhi; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2428 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2429 dw_pointer_query_pos(&x, &y); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2430 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2431 lhi.pt.x = x; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2432 lhi.pt.y = y; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2433 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2434 MapWindowPoints(HWND_DESKTOP, tmp->window, &lhi.pt, 1); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2435 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2436 iItem = ListView_HitTest(tmp->window, &lhi); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2437 |
69
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
2438 memset(&lvi, 0, sizeof(LV_ITEM)); |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
2439 |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2440 if(iItem > -1) |
57
1ed95c8ec2ff
Added a mutex lock and unlock in the pointer calls. And fixed a warning
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
55
diff
changeset
|
2441 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2442 lvi.iItem = iItem; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2443 lvi.mask = LVIF_PARAM; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2444 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2445 ListView_GetItem(tmp->window, &lvi); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2446 ListView_SetSelectionMark(tmp->window, iItem); |
57
1ed95c8ec2ff
Added a mutex lock and unlock in the pointer calls. And fixed a warning
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
55
diff
changeset
|
2447 } |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2448 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2449 /* Seems to be having lParam as 1 which really sucks */ |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2450 if(lvi.lParam < 100) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2451 lvi.lParam = 0; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2452 |
312
ff8f23594b15
Make sure itemdata is NULL for container callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
311
diff
changeset
|
2453 containercontextfunc(tmp->window, (char *)lvi.lParam, x, y, tmp->data, NULL); |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2454 tmp = NULL; |
57
1ed95c8ec2ff
Added a mutex lock and unlock in the pointer calls. And fixed a warning
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
55
diff
changeset
|
2455 } |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2456 if(tmp) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2457 tmp = tmp->next; |
57
1ed95c8ec2ff
Added a mutex lock and unlock in the pointer calls. And fixed a warning
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
55
diff
changeset
|
2458 } |
1ed95c8ec2ff
Added a mutex lock and unlock in the pointer calls. And fixed a warning
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
55
diff
changeset
|
2459 } |
1ed95c8ec2ff
Added a mutex lock and unlock in the pointer calls. And fixed a warning
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
55
diff
changeset
|
2460 break; |
3 | 2461 } |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2462 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2463 if(!cinfo || !cinfo->pOldProc) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2464 return DefWindowProc(hWnd, msg, mp1, mp2); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2465 return CallWindowProc(cinfo->pOldProc, hWnd, msg, mp1, mp2); |
3 | 2466 } |
2467 | |
68
8d6100960adf
Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
2468 BOOL CALLBACK _treewndproc(HWND hWnd, UINT msg, WPARAM mp1, LPARAM mp2) |
8d6100960adf
Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
2469 { |
8d6100960adf
Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
2470 ContainerInfo *cinfo; |
8d6100960adf
Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
2471 |
8d6100960adf
Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
2472 cinfo = (ContainerInfo *)GetWindowLong(hWnd, GWL_USERDATA); |
8d6100960adf
Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
2473 |
8d6100960adf
Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
2474 switch( msg ) |
8d6100960adf
Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
2475 { |
8d6100960adf
Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
2476 case WM_CHAR: |
8d6100960adf
Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
2477 if(LOWORD(mp1) == '\t') |
8d6100960adf
Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
2478 { |
82
aec9a0b0b539
Fixes for a resource leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
79
diff
changeset
|
2479 if(GetAsyncKeyState(VK_SHIFT) & 0x8000) |
68
8d6100960adf
Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
2480 _shift_focus_back(hWnd); |
8d6100960adf
Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
2481 else |
8d6100960adf
Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
2482 _shift_focus(hWnd); |
8d6100960adf
Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
2483 return FALSE; |
8d6100960adf
Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
2484 } |
8d6100960adf
Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
2485 break; |
8d6100960adf
Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
2486 } |
8d6100960adf
Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
2487 |
8d6100960adf
Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
2488 if(!cinfo || !cinfo->pOldProc) |
8d6100960adf
Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
2489 return DefWindowProc(hWnd, msg, mp1, mp2); |
8d6100960adf
Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
2490 return CallWindowProc(cinfo->pOldProc, hWnd, msg, mp1, mp2); |
8d6100960adf
Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
2491 } |
8d6100960adf
Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
2492 |
3 | 2493 void _changebox(Box *thisbox, int percent, int type) |
2494 { | |
2495 int z; | |
2496 | |
2497 for(z=0;z<thisbox->count;z++) | |
2498 { | |
2499 if(thisbox->items[z].type == TYPEBOX) | |
2500 { | |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2501 Box *tmp = (Box*)GetWindowLong(thisbox->items[z].hwnd, GWL_USERDATA); |
3 | 2502 _changebox(tmp, percent, type); |
2503 } | |
2504 else | |
2505 { | |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
281
diff
changeset
|
2506 if(type == DW_HORZ) |
3 | 2507 { |
2508 if(thisbox->items[z].hsize == SIZEEXPAND) | |
2509 thisbox->items[z].width = (int)(((float)thisbox->items[z].origwidth) * (((float)percent)/((float)100.0))); | |
2510 } | |
2511 else | |
2512 { | |
2513 if(thisbox->items[z].vsize == SIZEEXPAND) | |
2514 thisbox->items[z].height = (int)(((float)thisbox->items[z].origheight) * (((float)percent)/((float)100.0))); | |
2515 } | |
2516 } | |
2517 } | |
2518 } | |
2519 | |
126
72cb88af4490
Finalized splitbar support on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2520 void _handle_splitbar_resize(HWND hwnd, float percent, int type, int x, int y) |
72cb88af4490
Finalized splitbar support on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2521 { |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
281
diff
changeset
|
2522 if(type == DW_HORZ) |
126
72cb88af4490
Finalized splitbar support on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2523 { |
182
b8caec82a4d2
Minor splitbar fixes on OS/2 and Windows. The splitbar width is now 4
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
181
diff
changeset
|
2524 int newx = x; |
126
72cb88af4490
Finalized splitbar support on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2525 float ratio = (float)percent/(float)100.0; |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
2526 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:
165
diff
changeset
|
2527 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:
165
diff
changeset
|
2528 Box *tmp = (Box *)GetWindowLong(handle1, GWL_USERDATA); |
126
72cb88af4490
Finalized splitbar support on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2529 |
182
b8caec82a4d2
Minor splitbar fixes on OS/2 and Windows. The splitbar width is now 4
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
181
diff
changeset
|
2530 newx = (int)((float)newx * ratio) - (SPLITBAR_WIDTH/2); |
126
72cb88af4490
Finalized splitbar support on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2531 |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
2532 ShowWindow(handle1, SW_HIDE); |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
2533 ShowWindow(handle2, SW_HIDE); |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
2534 |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
2535 MoveWindow(handle1, 0, 0, newx, y, FALSE); |
182
b8caec82a4d2
Minor splitbar fixes on OS/2 and Windows. The splitbar width is now 4
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
181
diff
changeset
|
2536 _do_resize(tmp, newx - 1, y - 1); |
126
72cb88af4490
Finalized splitbar support on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2537 |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
2538 tmp = (Box *)GetWindowLong(handle2, GWL_USERDATA); |
126
72cb88af4490
Finalized splitbar support on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2539 |
72cb88af4490
Finalized splitbar support on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2540 newx = x - newx - SPLITBAR_WIDTH; |
72cb88af4490
Finalized splitbar support on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2541 |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
2542 MoveWindow(handle2, x - newx, 0, newx, y, FALSE); |
182
b8caec82a4d2
Minor splitbar fixes on OS/2 and Windows. The splitbar width is now 4
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
181
diff
changeset
|
2543 _do_resize(tmp, newx - 1, y - 1); |
126
72cb88af4490
Finalized splitbar support on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2544 |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
2545 ShowWindow(handle1, SW_SHOW); |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
2546 ShowWindow(handle2, SW_SHOW); |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
2547 |
126
72cb88af4490
Finalized splitbar support on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2548 dw_window_set_data(hwnd, "_dw_start", (void *)newx); |
72cb88af4490
Finalized splitbar support on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2549 } |
72cb88af4490
Finalized splitbar support on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2550 else |
72cb88af4490
Finalized splitbar support on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2551 { |
182
b8caec82a4d2
Minor splitbar fixes on OS/2 and Windows. The splitbar width is now 4
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
181
diff
changeset
|
2552 int newy = y; |
126
72cb88af4490
Finalized splitbar support on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2553 float ratio = (float)(100.0-percent)/(float)100.0; |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
2554 HWND handle1 = (HWND)dw_window_get_data(hwnd, "_dw_bottomright"); |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
2555 HWND handle2 = (HWND)dw_window_get_data(hwnd, "_dw_topleft"); |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
2556 Box *tmp = (Box *)GetWindowLong(handle1, GWL_USERDATA); |
126
72cb88af4490
Finalized splitbar support on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2557 |
182
b8caec82a4d2
Minor splitbar fixes on OS/2 and Windows. The splitbar width is now 4
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
181
diff
changeset
|
2558 newy = (int)((float)newy * ratio) - (SPLITBAR_WIDTH/2); |
126
72cb88af4490
Finalized splitbar support on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2559 |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
2560 ShowWindow(handle1, SW_HIDE); |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
2561 ShowWindow(handle2, SW_HIDE); |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
2562 |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
2563 MoveWindow(handle1, 0, y - newy, x, newy, FALSE); |
182
b8caec82a4d2
Minor splitbar fixes on OS/2 and Windows. The splitbar width is now 4
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
181
diff
changeset
|
2564 _do_resize(tmp, x - 1, newy - 1); |
126
72cb88af4490
Finalized splitbar support on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2565 |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
2566 tmp = (Box *)GetWindowLong(handle2, GWL_USERDATA); |
126
72cb88af4490
Finalized splitbar support on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2567 |
72cb88af4490
Finalized splitbar support on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2568 newy = y - newy - SPLITBAR_WIDTH; |
72cb88af4490
Finalized splitbar support on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2569 |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
2570 MoveWindow(handle2, 0, 0, x, newy, FALSE); |
182
b8caec82a4d2
Minor splitbar fixes on OS/2 and Windows. The splitbar width is now 4
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
181
diff
changeset
|
2571 _do_resize(tmp, x - 1, newy - 1); |
126
72cb88af4490
Finalized splitbar support on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2572 |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
2573 ShowWindow(handle1, SW_SHOW); |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
2574 ShowWindow(handle2, SW_SHOW); |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
2575 |
126
72cb88af4490
Finalized splitbar support on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2576 dw_window_set_data(hwnd, "_dw_start", (void *)newy); |
72cb88af4490
Finalized splitbar support on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2577 } |
72cb88af4490
Finalized splitbar support on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2578 } |
72cb88af4490
Finalized splitbar support on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2579 |
3 | 2580 /* This handles any activity on the splitbars (sizers) */ |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2581 BOOL CALLBACK _splitwndproc(HWND hwnd, UINT msg, WPARAM mp1, LPARAM mp2) |
3 | 2582 { |
124
edf615d8266e
Use float instead of int for percent on Windows. And a minor safety check
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
2583 float *percent = (float *)dw_window_get_data(hwnd, "_dw_percent"); |
118
c170181668b7
Initial new splitbar code on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
111
diff
changeset
|
2584 int type = (int)dw_window_get_data(hwnd, "_dw_type"); |
126
72cb88af4490
Finalized splitbar support on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2585 int start = (int)dw_window_get_data(hwnd, "_dw_start"); |
3 | 2586 |
2587 switch (msg) | |
2588 { | |
2589 case WM_ACTIVATE: | |
2590 case WM_SETFOCUS: | |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2591 return FALSE; |
3 | 2592 |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
2593 case WM_PAINT: |
118
c170181668b7
Initial new splitbar code on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
111
diff
changeset
|
2594 { |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
2595 PAINTSTRUCT ps; |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
2596 HDC hdcPaint; |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
2597 |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
2598 BeginPaint(hwnd, &ps); |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
2599 |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
2600 if((hdcPaint = GetDC(hwnd)) != NULL) |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
2601 { |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
2602 int cx, cy; |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
2603 HBRUSH oldBrush = SelectObject(hdcPaint, GetSysColorBrush(COLOR_3DFACE)); |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
2604 HPEN oldPen = SelectObject(hdcPaint, CreatePen(PS_SOLID, 1, GetSysColor(COLOR_3DFACE))); |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
2605 |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
2606 dw_window_get_pos_size(hwnd, NULL, NULL, &cx, &cy); |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
2607 |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
281
diff
changeset
|
2608 if(type == DW_HORZ) |
182
b8caec82a4d2
Minor splitbar fixes on OS/2 and Windows. The splitbar width is now 4
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
181
diff
changeset
|
2609 Rectangle(hdcPaint, cx - start - SPLITBAR_WIDTH, 0, cx - start, cy); |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
2610 else |
182
b8caec82a4d2
Minor splitbar fixes on OS/2 and Windows. The splitbar width is now 4
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
181
diff
changeset
|
2611 Rectangle(hdcPaint, 0, start, cx, start + SPLITBAR_WIDTH); |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
2612 |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
2613 SelectObject(hdcPaint, oldBrush); |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
2614 DeleteObject(SelectObject(hdcPaint, oldPen)); |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
2615 ReleaseDC(hwnd, hdcPaint); |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
2616 } |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
2617 EndPaint(hwnd, &ps); |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
2618 } |
126
72cb88af4490
Finalized splitbar support on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2619 break; |
72cb88af4490
Finalized splitbar support on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2620 case WM_LBUTTONDOWN: |
72cb88af4490
Finalized splitbar support on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2621 { |
72cb88af4490
Finalized splitbar support on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2622 SetCapture(hwnd); |
72cb88af4490
Finalized splitbar support on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2623 break; |
72cb88af4490
Finalized splitbar support on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2624 } |
72cb88af4490
Finalized splitbar support on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2625 case WM_LBUTTONUP: |
72cb88af4490
Finalized splitbar support on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2626 { |
72cb88af4490
Finalized splitbar support on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2627 if(GetCapture() == hwnd) |
72cb88af4490
Finalized splitbar support on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2628 ReleaseCapture(); |
118
c170181668b7
Initial new splitbar code on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
111
diff
changeset
|
2629 } |
c170181668b7
Initial new splitbar code on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
111
diff
changeset
|
2630 break; |
3 | 2631 case WM_MOUSEMOVE: |
2632 { | |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
281
diff
changeset
|
2633 if(type == DW_HORZ) |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2634 SetCursor(LoadCursor(NULL, IDC_SIZEWE)); |
3 | 2635 else |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2636 SetCursor(LoadCursor(NULL, IDC_SIZENS)); |
126
72cb88af4490
Finalized splitbar support on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2637 |
127
c5c3ccb84ac7
Safety checks in the splitbar calculations on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
126
diff
changeset
|
2638 if(GetCapture() == hwnd && percent) |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2639 { |
126
72cb88af4490
Finalized splitbar support on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2640 POINT point; |
72cb88af4490
Finalized splitbar support on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2641 RECT rect; |
157
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
2642 static POINT lastpoint; |
126
72cb88af4490
Finalized splitbar support on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2643 |
72cb88af4490
Finalized splitbar support on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2644 GetCursorPos(&point); |
72cb88af4490
Finalized splitbar support on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2645 GetWindowRect(hwnd, &rect); |
72cb88af4490
Finalized splitbar support on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2646 |
157
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
2647 if(memcmp(&point, &lastpoint, sizeof(POINT))) |
3 | 2648 { |
157
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
2649 if(PtInRect(&rect, point)) |
3 | 2650 { |
157
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
2651 int width = (rect.right - rect.left); |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
2652 int height = (rect.bottom - rect.top); |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
2653 |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
281
diff
changeset
|
2654 if(type == DW_HORZ) |
157
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
2655 { |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
2656 start = point.x - rect.left; |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
2657 if(width - SPLITBAR_WIDTH > 1 && start < width - SPLITBAR_WIDTH) |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
2658 *percent = ((float)start / (float)(width - SPLITBAR_WIDTH)) * 100.0; |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
2659 } |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
2660 else |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
2661 { |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
2662 start = point.y - rect.top; |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
2663 if(height - SPLITBAR_WIDTH > 1 && start < height - SPLITBAR_WIDTH) |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
2664 *percent = ((float)start / (float)(height - SPLITBAR_WIDTH)) * 100.0; |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
2665 } |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
2666 _handle_splitbar_resize(hwnd, *percent, type, width, height); |
3 | 2667 } |
157
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
2668 memcpy(&lastpoint, &point, sizeof(POINT)); |
3 | 2669 } |
2670 } | |
126
72cb88af4490
Finalized splitbar support on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2671 break; |
3 | 2672 } |
2673 } | |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2674 return DefWindowProc(hwnd, msg, mp1, mp2); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2675 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2676 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2677 /* This handles drawing the status text areas */ |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2678 BOOL CALLBACK _statuswndproc(HWND hwnd, UINT msg, WPARAM mp1, LPARAM mp2) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2679 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2680 switch (msg) |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
2681 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2682 case WM_SETTEXT: |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2683 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2684 /* Make sure the control redraws when there is a text change */ |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2685 int ret = (int)DefWindowProc(hwnd, msg, mp1, mp2); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2686 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2687 InvalidateRgn(hwnd, NULL, TRUE); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2688 return ret; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2689 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2690 case WM_PAINT: |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2691 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2692 HDC hdcPaint; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2693 PAINTSTRUCT ps; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2694 RECT rc; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2695 unsigned long cx, cy; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2696 int threadid = dw_thread_id(); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2697 char tempbuf[1024] = ""; |
299
2a97f8d9b297
Use DrawStatusText() to make the status lines, instead of doing it ourself.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
298
diff
changeset
|
2698 ColorInfo *cinfo = (ColorInfo *)GetWindowLong(hwnd, GWL_USERDATA); |
2a97f8d9b297
Use DrawStatusText() to make the status lines, instead of doing it ourself.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
298
diff
changeset
|
2699 HFONT hfont = _acquire_font(hwnd, cinfo ? cinfo->fontname : NULL); |
2a97f8d9b297
Use DrawStatusText() to make the status lines, instead of doing it ourself.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
298
diff
changeset
|
2700 HFONT oldfont = (HFONT)SendMessage(hwnd, WM_GETFONT, 0, 0); |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2701 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2702 dw_window_get_pos_size(hwnd, NULL, NULL, &cx, &cy); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2703 GetWindowText(hwnd, tempbuf, 1024); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2704 |
299
2a97f8d9b297
Use DrawStatusText() to make the status lines, instead of doing it ourself.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
298
diff
changeset
|
2705 hdcPaint = BeginPaint(hwnd, &ps); |
2a97f8d9b297
Use DrawStatusText() to make the status lines, instead of doing it ourself.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
298
diff
changeset
|
2706 if(hfont) |
2a97f8d9b297
Use DrawStatusText() to make the status lines, instead of doing it ourself.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
298
diff
changeset
|
2707 oldfont = (HFONT)SelectObject(hdcPaint, hfont); |
2a97f8d9b297
Use DrawStatusText() to make the status lines, instead of doing it ourself.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
298
diff
changeset
|
2708 rc.top = rc.left = 0; |
2a97f8d9b297
Use DrawStatusText() to make the status lines, instead of doing it ourself.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
298
diff
changeset
|
2709 rc.right = cx; |
2a97f8d9b297
Use DrawStatusText() to make the status lines, instead of doing it ourself.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
298
diff
changeset
|
2710 rc.bottom = cy; |
2a97f8d9b297
Use DrawStatusText() to make the status lines, instead of doing it ourself.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
298
diff
changeset
|
2711 DrawStatusText(hdcPaint, &rc, tempbuf, 0); |
2a97f8d9b297
Use DrawStatusText() to make the status lines, instead of doing it ourself.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
298
diff
changeset
|
2712 if(hfont && oldfont) |
2a97f8d9b297
Use DrawStatusText() to make the status lines, instead of doing it ourself.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
298
diff
changeset
|
2713 SelectObject(hdcPaint, oldfont); |
2a97f8d9b297
Use DrawStatusText() to make the status lines, instead of doing it ourself.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
298
diff
changeset
|
2714 if(hfont) |
2a97f8d9b297
Use DrawStatusText() to make the status lines, instead of doing it ourself.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
298
diff
changeset
|
2715 DeleteObject(hfont); |
2a97f8d9b297
Use DrawStatusText() to make the status lines, instead of doing it ourself.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
298
diff
changeset
|
2716 EndPaint(hwnd, &ps); |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2717 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2718 return FALSE; |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
2719 } |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2720 return DefWindowProc(hwnd, msg, mp1, mp2); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2721 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2722 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2723 /* Function: _BtProc |
3 | 2724 * Abstract: Subclass procedure for buttons |
2725 */ | |
2726 | |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2727 BOOL CALLBACK _BtProc(HWND hwnd, ULONG msg, WPARAM mp1, LPARAM mp2) |
3 | 2728 { |
2729 BubbleButton *bubble; | |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2730 static int bMouseOver = 0; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2731 POINT point; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2732 RECT rect; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2733 WNDPROC pOldProc; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2734 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2735 bubble = (BubbleButton *)GetWindowLong(hwnd, GWL_USERDATA); |
3 | 2736 |
2737 if(!bubble) | |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2738 return DefWindowProc(hwnd, msg, mp1, mp2); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2739 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2740 /* We must save a pointer to the old |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2741 * window procedure because if a signal |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2742 * handler attached here destroys this |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2743 * window it will then be invalid. |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2744 */ |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2745 pOldProc = bubble->pOldProc; |
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
|
2746 |
3 | 2747 switch(msg) |
2748 { | |
341
503d1ac958bb
Call TreeView_SelectItem() instead of dw_tree_item_select() so we get the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
339
diff
changeset
|
2749 case WM_CTLCOLORSTATIC: |
503d1ac958bb
Call TreeView_SelectItem() instead of dw_tree_item_select() so we get the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
339
diff
changeset
|
2750 case WM_CTLCOLORLISTBOX: |
503d1ac958bb
Call TreeView_SelectItem() instead of dw_tree_item_select() so we get the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
339
diff
changeset
|
2751 case WM_CTLCOLORBTN: |
503d1ac958bb
Call TreeView_SelectItem() instead of dw_tree_item_select() so we get the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
339
diff
changeset
|
2752 case WM_CTLCOLOREDIT: |
503d1ac958bb
Call TreeView_SelectItem() instead of dw_tree_item_select() so we get the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
339
diff
changeset
|
2753 case WM_CTLCOLORMSGBOX: |
503d1ac958bb
Call TreeView_SelectItem() instead of dw_tree_item_select() so we get the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
339
diff
changeset
|
2754 case WM_CTLCOLORSCROLLBAR: |
503d1ac958bb
Call TreeView_SelectItem() instead of dw_tree_item_select() so we get the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
339
diff
changeset
|
2755 case WM_CTLCOLORDLG: |
503d1ac958bb
Call TreeView_SelectItem() instead of dw_tree_item_select() so we get the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
339
diff
changeset
|
2756 _wndproc(hwnd, msg, mp1, mp2); |
503d1ac958bb
Call TreeView_SelectItem() instead of dw_tree_item_select() so we get the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
339
diff
changeset
|
2757 break; |
37
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
2758 case WM_SETFOCUS: |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2759 _wndproc(hwnd, msg, mp1, mp2); |
37
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
2760 break; |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2761 case WM_LBUTTONUP: |
3 | 2762 { |
2763 SignalHandler *tmp = Root; | |
2764 | |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2765 /* Find any callbacks for this function */ |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2766 while(tmp) |
3 | 2767 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2768 if(tmp->message == WM_COMMAND) |
3 | 2769 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2770 int (*clickfunc)(HWND, void *) = tmp->signalfunction; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2771 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2772 /* Make sure it's the right window, and the right ID */ |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2773 if(tmp->window == hwnd) |
3 | 2774 { |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
59
diff
changeset
|
2775 if(bubble->checkbox) |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
59
diff
changeset
|
2776 in_checkbox_handler = 1; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
59
diff
changeset
|
2777 |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2778 clickfunc(tmp->window, tmp->data); |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
59
diff
changeset
|
2779 |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
59
diff
changeset
|
2780 if(bubble->checkbox) |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
59
diff
changeset
|
2781 in_checkbox_handler = 0; |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2782 tmp = NULL; |
3 | 2783 } |
2784 } | |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2785 if(tmp) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2786 tmp= tmp->next; |
3 | 2787 } |
2788 } | |
2789 break; | |
2790 case WM_CHAR: | |
2791 { | |
2792 /* A button press should also occur for an ENTER or SPACE press | |
2793 * while the button has the active input focus. | |
2794 */ | |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2795 if(LOWORD(mp1) == '\r' || LOWORD(mp1) == ' ') |
3 | 2796 { |
2797 SignalHandler *tmp = Root; | |
2798 | |
2799 /* Find any callbacks for this function */ | |
2800 while(tmp) | |
2801 { | |
2802 if(tmp->message == WM_COMMAND) | |
2803 { | |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2804 int (*clickfunc)(HWND, void *) = tmp->signalfunction; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2805 |
3 | 2806 /* Make sure it's the right window, and the right ID */ |
2807 if(tmp->window == hwnd) | |
2808 { | |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2809 clickfunc(tmp->window, tmp->data); |
3 | 2810 tmp = NULL; |
2811 } | |
2812 } | |
2813 if(tmp) | |
2814 tmp= tmp->next; | |
2815 } | |
2816 } | |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2817 if(LOWORD(mp1) == '\t') |
3 | 2818 { |
82
aec9a0b0b539
Fixes for a resource leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
79
diff
changeset
|
2819 if(GetAsyncKeyState(VK_SHIFT) & 0x8000) |
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
|
2820 _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
|
2821 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
|
2822 _shift_focus(hwnd); |
3 | 2823 return FALSE; |
2824 } | |
2825 } | |
2826 break; | |
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
|
2827 case WM_KEYDOWN: |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
2828 if(mp1 == VK_LEFT || mp1 == 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
|
2829 _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
|
2830 if(mp1 == VK_RIGHT || mp1 == 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
|
2831 _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
|
2832 break; |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2833 case WM_TIMER: |
3 | 2834 if (hwndBubble) |
2835 { | |
82
aec9a0b0b539
Fixes for a resource leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
79
diff
changeset
|
2836 _free_window_memory(hwndBubble, 0); |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2837 DestroyWindow(hwndBubble); |
3 | 2838 hwndBubble = 0; |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2839 KillTimer(hwnd, 1); |
3 | 2840 } |
2841 break; | |
2842 | |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2843 case WM_MOUSEMOVE: |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2844 GetCursorPos(&point); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2845 GetWindowRect(hwnd, &rect); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2846 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2847 if(PtInRect(&rect, point)) |
17
f26eced21a30
Some more updates.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
15
diff
changeset
|
2848 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2849 if(hwnd != GetCapture()) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2850 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2851 SetCapture(hwnd); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2852 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2853 if(!bMouseOver) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2854 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2855 bMouseOver = 1; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2856 if(!*bubble->bubbletext) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2857 break; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2858 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2859 if(hwndBubble) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2860 { |
82
aec9a0b0b539
Fixes for a resource leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
79
diff
changeset
|
2861 _free_window_memory(hwndBubble, 0); |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2862 DestroyWindow(hwndBubble); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2863 hwndBubble = 0; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2864 KillTimer(hwndBubbleLast, 1); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2865 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2866 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2867 if(!hwndBubble) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2868 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2869 POINTL ptlWork = {0,0}; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2870 ULONG ulColor = DW_CLR_YELLOW; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2871 SIZE size; |
82
aec9a0b0b539
Fixes for a resource leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
79
diff
changeset
|
2872 HFONT hFont, oldFont = (HFONT)0; |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2873 HDC hdc; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2874 RECT rect; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2875 void *oldproc; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2876 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2877 /* Use the WS_EX_TOOLWINDOW extended style |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2878 * so the window doesn't get listed in the |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2879 * taskbar. |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2880 */ |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2881 hwndBubble = CreateWindowEx(WS_EX_TOOLWINDOW, |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2882 STATICCLASSNAME, |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2883 bubble->bubbletext, |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2884 BS_TEXT | WS_POPUP | |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2885 WS_BORDER | |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2886 SS_CENTER, |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2887 0,0,50,20, |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2888 HWND_DESKTOP, |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2889 NULL, |
109
94d273843a41
Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
107
diff
changeset
|
2890 DWInstance, |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2891 NULL); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2892 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2893 dw_window_set_font(hwndBubble, DefaultFont); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2894 dw_window_set_color(hwndBubble, DW_CLR_BLACK, DW_CLR_YELLOW); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2895 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2896 hwndBubbleLast = hwnd; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2897 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2898 SetTimer(hwnd, 1, 3000, NULL); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2899 |
82
aec9a0b0b539
Fixes for a resource leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
79
diff
changeset
|
2900 hFont = (HFONT)SendMessage(hwndBubble, WM_GETFONT, 0, 0); |
aec9a0b0b539
Fixes for a resource leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
79
diff
changeset
|
2901 |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2902 hdc = GetDC(hwndBubble); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2903 |
82
aec9a0b0b539
Fixes for a resource leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
79
diff
changeset
|
2904 if(hFont) |
aec9a0b0b539
Fixes for a resource leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
79
diff
changeset
|
2905 oldFont = (HFONT)SelectObject(hdc, hFont); |
aec9a0b0b539
Fixes for a resource leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
79
diff
changeset
|
2906 |
aec9a0b0b539
Fixes for a resource leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
79
diff
changeset
|
2907 GetTextExtentPoint32(hdc, bubble->bubbletext, strlen(bubble->bubbletext), &size); |
aec9a0b0b539
Fixes for a resource leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
79
diff
changeset
|
2908 |
aec9a0b0b539
Fixes for a resource leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
79
diff
changeset
|
2909 if(hFont) |
aec9a0b0b539
Fixes for a resource leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
79
diff
changeset
|
2910 SelectObject(hdc, oldFont); |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2911 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2912 MapWindowPoints(hwnd, HWND_DESKTOP, (LPPOINT)&ptlWork, 1); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2913 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2914 GetWindowRect(hwnd, &rect); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2915 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2916 SetWindowPos(hwndBubble, |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2917 HWND_TOP, |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2918 ptlWork.x, |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2919 ptlWork.y + (rect.bottom-rect.top) + 1, |
82
aec9a0b0b539
Fixes for a resource leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
79
diff
changeset
|
2920 size.cx + 8, |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2921 size.cy + 2, |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2922 SWP_NOACTIVATE | SWP_SHOWWINDOW); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2923 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2924 ReleaseDC(hwndBubble, hdc); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2925 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2926 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2927 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2928 else{ |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2929 /* Calling ReleaseCapture in Win95 also causes WM_CAPTURECHANGED |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2930 * to be sent. Be sure to account for that. |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2931 */ |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2932 ReleaseCapture(); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2933 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2934 if(bMouseOver) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2935 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2936 bMouseOver = 0; |
82
aec9a0b0b539
Fixes for a resource leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
79
diff
changeset
|
2937 _free_window_memory(hwndBubble, 0); |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2938 DestroyWindow(hwndBubble); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2939 hwndBubble = 0; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2940 KillTimer(hwndBubbleLast, 1); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2941 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2942 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2943 break; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2944 case WM_CAPTURECHANGED: |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2945 /* This message means we are losing the capture for some reason |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2946 * Either because we intentionally lost it or another window |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2947 * stole it |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2948 */ |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2949 if(bMouseOver) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2950 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2951 bMouseOver = 0; |
82
aec9a0b0b539
Fixes for a resource leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
79
diff
changeset
|
2952 _free_window_memory(hwndBubble, 0); |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2953 DestroyWindow(hwndBubble); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2954 hwndBubble = 0; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2955 KillTimer(hwndBubbleLast, 1); |
3 | 2956 } |
2957 break; | |
2958 } | |
2959 | |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2960 if(!pOldProc) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2961 return DefWindowProc(hwnd, msg, mp1, mp2); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2962 return CallWindowProc(pOldProc, hwnd, msg, mp1, mp2); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2963 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2964 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2965 /* This function recalculates a notebook page for example |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2966 * during switching of notebook pages. |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2967 */ |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2968 void _resize_notebook_page(HWND handle, int pageid) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2969 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2970 RECT rect; |
191
634625c3239d
Fixes for dw_color_xxxx_set() to accept OS/2 style colors, and fixed a
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
185
diff
changeset
|
2971 NotebookPage **array = (NotebookPage **)dw_window_get_data(handle, "_dw_array"); |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2972 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2973 if(array && array[pageid]) |
3 | 2974 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2975 Box *box = (Box *)GetWindowLong(array[pageid]->hwnd, GWL_USERDATA); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2976 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2977 GetClientRect(handle,&rect); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2978 TabCtrl_AdjustRect(handle,FALSE,&rect); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2979 MoveWindow(array[pageid]->hwnd, rect.left, rect.top, |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2980 rect.right - rect.left, rect.bottom-rect.top, TRUE); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2981 if(box && box->count) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2982 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2983 ShowWindow(box->items[0].hwnd, SW_HIDE); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2984 _do_resize(box, rect.right - rect.left, rect.bottom - rect.top); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2985 ShowWindow(box->items[0].hwnd, SW_SHOW); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2986 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2987 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
2988 ShowWindow(array[pageid]->hwnd, SW_SHOWNORMAL); |
3 | 2989 } |
2990 } | |
2991 | |
2992 /* | |
2993 * Initializes the Dynamic Windows engine. | |
2994 * Parameters: | |
2995 * newthread: True if this is the only thread. | |
2996 * False if there is already a message loop running. | |
2997 */ | |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
2998 int API dw_init(int newthread, int argc, char *argv[]) |
3 | 2999 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3000 WNDCLASS wc; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3001 int z; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3002 INITCOMMONCONTROLSEX icc; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3003 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3004 icc.dwSize = sizeof(INITCOMMONCONTROLSEX); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3005 icc.dwICC = ICC_WIN95_CLASSES; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3006 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3007 InitCommonControlsEx(&icc); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3008 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3009 memset(lookup, 0, sizeof(HICON) * ICON_INDEX_LIMIT); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3010 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3011 /* Register the generic Dynamic Windows class */ |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3012 memset(&wc, 0, sizeof(WNDCLASS)); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3013 wc.style = CS_DBLCLKS; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3014 wc.lpfnWndProc = (WNDPROC)_wndproc; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3015 wc.cbClsExtra = 0; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3016 wc.cbWndExtra = 32; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3017 wc.hbrBackground = NULL; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3018 wc.lpszMenuName = NULL; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3019 wc.lpszClassName = ClassName; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3020 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3021 RegisterClass(&wc); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3022 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3023 /* Register the splitbar control */ |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3024 memset(&wc, 0, sizeof(WNDCLASS)); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3025 wc.style = CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3026 wc.lpfnWndProc = (WNDPROC)_splitwndproc; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3027 wc.cbClsExtra = 0; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3028 wc.cbWndExtra = 0; |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
3029 wc.hbrBackground = NULL; |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3030 wc.lpszMenuName = NULL; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3031 wc.lpszClassName = SplitbarClassName; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3032 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3033 RegisterClass(&wc); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3034 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3035 /* Register a frame control like on OS/2 */ |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3036 memset(&wc, 0, sizeof(WNDCLASS)); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3037 wc.style = CS_DBLCLKS; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3038 wc.lpfnWndProc = (WNDPROC)_framewndproc; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3039 wc.cbClsExtra = 0; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3040 wc.cbWndExtra = 32; |
73
2f339dd13496
Added C/C++ style escape sequence processing. And fixed a couple OS/2 and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
3041 wc.hbrBackground = (HBRUSH)GetSysColorBrush(COLOR_3DFACE); |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3042 wc.hCursor = LoadCursor(NULL, IDC_ARROW); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3043 wc.lpszMenuName = NULL; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3044 wc.lpszClassName = FRAMECLASSNAME; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3045 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3046 RegisterClass(&wc); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3047 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3048 /* Create a set of brushes using the default OS/2 and DOS colors */ |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3049 for(z=0;z<18;z++) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3050 _colors[z] = CreateSolidBrush(RGB(_red[z],_green[z],_blue[z])); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3051 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3052 /* Register an Object Windows class like OS/2 and Win2k+ |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3053 * so similar functionality can be used on earlier releases |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3054 * of Windows. |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3055 */ |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3056 memset(&wc, 0, sizeof(WNDCLASS)); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3057 wc.style = 0; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3058 wc.lpfnWndProc = (WNDPROC)_wndproc; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3059 wc.cbClsExtra = 0; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3060 wc.cbWndExtra = 0; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3061 wc.hbrBackground = NULL; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3062 wc.hCursor = LoadCursor(NULL, IDC_ARROW); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3063 wc.lpszMenuName = NULL; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3064 wc.lpszClassName = ObjectClassName; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3065 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3066 RegisterClass(&wc); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3067 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3068 /* Since Windows 95/98/NT don't have a HWND_OBJECT class |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3069 * also known as a input only window, I will create a |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3070 * temporary window that isn't visible and really does nothing |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3071 * except temporarily hold the child windows before they are |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3072 * packed into their correct parent. |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3073 */ |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3074 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3075 DW_HWND_OBJECT = CreateWindow(ObjectClassName, "", 0, 0, 0, |
109
94d273843a41
Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
107
diff
changeset
|
3076 0, 0, HWND_DESKTOP, NULL, DWInstance, NULL); |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3077 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3078 if(!DW_HWND_OBJECT) |
3 | 3079 { |
399
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
389
diff
changeset
|
3080 dw_messagebox("Dynamic Windows", DW_MB_OK|DW_MB_ERROR, "Could not initialize the object window. error code %d", GetLastError()); |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3081 exit(1); |
3 | 3082 } |
3083 | |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3084 /* We need the version to check capability like up-down controls */ |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3085 dwVersion = GetVersion(); |
75
c629838d9805
Updated to latest DW, and updated the Makefile to install the header files
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
73
diff
changeset
|
3086 dwComctlVer = GetDllVersion(TEXT("comctl32.dll")); |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3087 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3088 for(z=0;z<THREAD_LIMIT;z++) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3089 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3090 _foreground[z] = RGB(128,128,128); |
369
39983df2b93d
Updated the license information, and copyrights. Code to do background
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
355
diff
changeset
|
3091 _background[z] = DW_RGB_TRANSPARENT; |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3092 _hPen[z] = CreatePen(PS_SOLID, 1, _foreground[z]); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3093 _hBrush[z] = CreateSolidBrush(_foreground[z]); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3094 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3095 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3096 return 0; |
3 | 3097 } |
3098 | |
3099 /* | |
3100 * 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
|
3101 */ |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
3102 void API dw_main(void) |
3 | 3103 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3104 MSG msg; |
3 | 3105 |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
3106 _dwtid = dw_thread_id(); |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
3107 |
204
098ed34d41fb
The basics of the new scrollbar code on Windows, and dw_main_iteration().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
201
diff
changeset
|
3108 while(GetMessage(&msg, NULL, 0, 0)) |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3109 { |
200
446dd8cea477
Removed window parameter on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
197
diff
changeset
|
3110 if(msg.hwnd == NULL && msg.message == WM_TIMER) |
446dd8cea477
Removed window parameter on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
197
diff
changeset
|
3111 _wndproc(msg.hwnd, msg.message, msg.wParam, msg.lParam); |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3112 TranslateMessage(&msg); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3113 DispatchMessage(&msg); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3114 } |
3 | 3115 } |
3116 | |
3117 /* | |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
3118 * 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:
61
diff
changeset
|
3119 * Parameters: |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
3120 * 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:
61
diff
changeset
|
3121 */ |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
3122 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
|
3123 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3124 MSG msg; |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
3125 double start = (double)clock(); |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
3126 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
3127 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
|
3128 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3129 if(PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE)) |
37
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
3130 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3131 GetMessage(&msg, NULL, 0, 0); |
200
446dd8cea477
Removed window parameter on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
197
diff
changeset
|
3132 if(msg.hwnd == NULL && msg.message == WM_TIMER) |
446dd8cea477
Removed window parameter on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
197
diff
changeset
|
3133 _wndproc(msg.hwnd, msg.message, msg.wParam, msg.lParam); |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3134 TranslateMessage(&msg); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3135 DispatchMessage(&msg); |
37
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
3136 } |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
3137 else |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3138 Sleep(1); |
37
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
3139 } |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
3140 } |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
3141 |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
3142 /* |
204
098ed34d41fb
The basics of the new scrollbar code on Windows, and dw_main_iteration().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
201
diff
changeset
|
3143 * Processes a single message iteration and returns. |
098ed34d41fb
The basics of the new scrollbar code on Windows, and dw_main_iteration().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
201
diff
changeset
|
3144 */ |
098ed34d41fb
The basics of the new scrollbar code on Windows, and dw_main_iteration().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
201
diff
changeset
|
3145 void API dw_main_iteration(void) |
098ed34d41fb
The basics of the new scrollbar code on Windows, and dw_main_iteration().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
201
diff
changeset
|
3146 { |
098ed34d41fb
The basics of the new scrollbar code on Windows, and dw_main_iteration().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
201
diff
changeset
|
3147 MSG msg; |
098ed34d41fb
The basics of the new scrollbar code on Windows, and dw_main_iteration().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
201
diff
changeset
|
3148 |
098ed34d41fb
The basics of the new scrollbar code on Windows, and dw_main_iteration().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
201
diff
changeset
|
3149 _dwtid = dw_thread_id(); |
098ed34d41fb
The basics of the new scrollbar code on Windows, and dw_main_iteration().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
201
diff
changeset
|
3150 |
098ed34d41fb
The basics of the new scrollbar code on Windows, and dw_main_iteration().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
201
diff
changeset
|
3151 if(GetMessage(&msg, NULL, 0, 0)) |
098ed34d41fb
The basics of the new scrollbar code on Windows, and dw_main_iteration().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
201
diff
changeset
|
3152 { |
098ed34d41fb
The basics of the new scrollbar code on Windows, and dw_main_iteration().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
201
diff
changeset
|
3153 if(msg.hwnd == NULL && msg.message == WM_TIMER) |
098ed34d41fb
The basics of the new scrollbar code on Windows, and dw_main_iteration().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
201
diff
changeset
|
3154 _wndproc(msg.hwnd, msg.message, msg.wParam, msg.lParam); |
098ed34d41fb
The basics of the new scrollbar code on Windows, and dw_main_iteration().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
201
diff
changeset
|
3155 TranslateMessage(&msg); |
098ed34d41fb
The basics of the new scrollbar code on Windows, and dw_main_iteration().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
201
diff
changeset
|
3156 DispatchMessage(&msg); |
098ed34d41fb
The basics of the new scrollbar code on Windows, and dw_main_iteration().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
201
diff
changeset
|
3157 } |
098ed34d41fb
The basics of the new scrollbar code on Windows, and dw_main_iteration().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
201
diff
changeset
|
3158 } |
098ed34d41fb
The basics of the new scrollbar code on Windows, and dw_main_iteration().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
201
diff
changeset
|
3159 |
098ed34d41fb
The basics of the new scrollbar code on Windows, and dw_main_iteration().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
201
diff
changeset
|
3160 /* |
3 | 3161 * Free's memory allocated by dynamic windows. |
3162 * Parameters: | |
3163 * ptr: Pointer to dynamic windows allocated | |
3164 * memory to be free()'d. | |
3165 */ | |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
3166 void API dw_free(void *ptr) |
3 | 3167 { |
3168 free(ptr); | |
3169 } | |
3170 | |
3171 /* | |
3172 * Allocates and initializes a dialog struct. | |
3173 * Parameters: | |
3174 * data: User defined data to be passed to functions. | |
3175 */ | |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
3176 DWDialog * API dw_dialog_new(void *data) |
3 | 3177 { |
3178 DWDialog *tmp = malloc(sizeof(DWDialog)); | |
3179 | |
3180 tmp->eve = dw_event_new(); | |
3181 dw_event_reset(tmp->eve); | |
3182 tmp->data = data; | |
3183 tmp->done = FALSE; | |
3184 tmp->result = NULL; | |
3185 | |
3186 return tmp; | |
3187 } | |
3188 | |
3189 /* | |
3190 * Accepts a dialog struct and returns the given data to the | |
3191 * initial called of dw_dialog_wait(). | |
3192 * Parameters: | |
3193 * dialog: Pointer to a dialog struct aquired by dw_dialog_new). | |
3194 * result: Data to be returned by dw_dialog_wait(). | |
3195 */ | |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
3196 int API dw_dialog_dismiss(DWDialog *dialog, void *result) |
3 | 3197 { |
3198 dialog->result = result; | |
3199 dw_event_post(dialog->eve); | |
3200 dialog->done = TRUE; | |
3201 return 0; | |
3202 } | |
3203 | |
3204 /* | |
3205 * Accepts a dialog struct waits for dw_dialog_dismiss() to be | |
3206 * called by a signal handler with the given dialog struct. | |
3207 * Parameters: | |
3208 * dialog: Pointer to a dialog struct aquired by dw_dialog_new). | |
3209 */ | |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
3210 void * API dw_dialog_wait(DWDialog *dialog) |
3 | 3211 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3212 MSG msg; |
3 | 3213 void *tmp; |
3214 | |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3215 while (GetMessage(&msg,NULL,0,0)) |
3 | 3216 { |
200
446dd8cea477
Removed window parameter on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
197
diff
changeset
|
3217 if(msg.hwnd == NULL && msg.message == WM_TIMER) |
446dd8cea477
Removed window parameter on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
197
diff
changeset
|
3218 _wndproc(msg.hwnd, msg.message, msg.wParam, msg.lParam); |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3219 TranslateMessage(&msg); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3220 DispatchMessage(&msg); |
3 | 3221 if(dialog->done) |
3222 break; | |
3223 } | |
3224 dw_event_close(&dialog->eve); | |
3225 tmp = dialog->result; | |
3226 free(dialog); | |
3227 return tmp; | |
3228 } | |
3229 | |
3230 /* | |
3231 * Displays a Message Box with given text and title.. | |
3232 * Parameters: | |
3233 * title: The title of the message box. | |
3234 * format: printf style format string. | |
3235 * ...: Additional variables for use in the format. | |
3236 */ | |
399
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
389
diff
changeset
|
3237 int API dw_messagebox(char *title, int flags, char *format, ...) |
3 | 3238 { |
3239 va_list args; | |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3240 char outbuf[256]; |
399
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
389
diff
changeset
|
3241 int rc; |
3 | 3242 |
3243 va_start(args, format); | |
3244 vsprintf(outbuf, format, args); | |
3245 va_end(args); | |
3246 | |
399
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
389
diff
changeset
|
3247 rc = MessageBox(HWND_DESKTOP, outbuf, title, flags); |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
389
diff
changeset
|
3248 if(rc == IDOK) |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
389
diff
changeset
|
3249 return DW_MB_RETURN_OK; |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
389
diff
changeset
|
3250 else if(rc == IDYES) |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
389
diff
changeset
|
3251 return DW_MB_RETURN_YES; |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
389
diff
changeset
|
3252 else if(rc == IDNO) |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
389
diff
changeset
|
3253 return DW_MB_RETURN_NO; |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
389
diff
changeset
|
3254 else if(rc == IDCANCEL) |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
389
diff
changeset
|
3255 return DW_MB_RETURN_CANCEL; |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
389
diff
changeset
|
3256 else return 0; |
3 | 3257 } |
3258 | |
3259 /* | |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3260 * Minimizes or Iconifies a top-level window. |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3261 * Parameters: |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3262 * handle: The window handle to minimize. |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3263 */ |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
3264 int API dw_window_minimize(HWND handle) |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3265 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3266 return ShowWindow(handle, SW_MINIMIZE); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3267 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3268 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3269 /* |
40
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
3270 * Makes the window topmost. |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
3271 * Parameters: |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
3272 * 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
|
3273 */ |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
3274 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
|
3275 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3276 return SetWindowPos(handle, HWND_TOP, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE); |
40
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
3277 } |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
3278 |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
3279 /* |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
3280 * Makes the window bottommost. |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
3281 * Parameters: |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
3282 * 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
|
3283 */ |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
3284 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
|
3285 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3286 return SetWindowPos(handle, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE); |
40
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
3287 } |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
3288 |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
3289 /* |
3 | 3290 * Makes the window visible. |
3291 * Parameters: | |
3292 * handle: The window handle to make visible. | |
3293 */ | |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
3294 int API dw_window_show(HWND handle) |
3 | 3295 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3296 int rc = ShowWindow(handle, SW_SHOW); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3297 SetFocus(handle); |
3 | 3298 _initial_focus(handle); |
3299 return rc; | |
3300 } | |
3301 | |
3302 /* | |
3303 * Makes the window invisible. | |
3304 * Parameters: | |
3305 * handle: The window handle to make visible. | |
3306 */ | |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
3307 int API dw_window_hide(HWND handle) |
3 | 3308 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3309 return ShowWindow(handle, SW_HIDE); |
3 | 3310 } |
3311 | |
3312 /* | |
3313 * Destroys a window and all of it's children. | |
3314 * Parameters: | |
3315 * handle: The window handle to destroy. | |
3316 */ | |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
3317 int API dw_window_destroy(HWND handle) |
3 | 3318 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3319 HWND parent = GetParent(handle); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3320 Box *thisbox = (Box *)GetWindowLong(parent, GWL_USERDATA); |
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
|
3321 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3322 if(parent != HWND_DESKTOP && thisbox && thisbox->count) |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3323 { |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3324 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
|
3325 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
|
3326 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3327 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
|
3328 { |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3329 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
|
3330 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
|
3331 } |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3332 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3333 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
|
3334 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
|
3335 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3336 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
|
3337 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3338 /* 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
|
3339 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
|
3340 { |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3341 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
|
3342 } |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3343 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
|
3344 { |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3345 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
|
3346 } |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3347 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3348 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
|
3349 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
|
3350 thisbox->count--; |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
3351 _free_window_memory(handle, 0); |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
3352 EnumChildWindows(handle, _free_window_memory, 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
|
3353 } |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3354 return DestroyWindow(handle); |
3 | 3355 } |
3356 | |
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
|
3357 /* 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
|
3358 * 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
|
3359 * 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
|
3360 */ |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
3361 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
|
3362 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3363 Box *mybox = (Box *)GetWindowLong(handle, GWL_USERDATA); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3364 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3365 if(mybox) |
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
|
3366 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3367 RECT rect; |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
3368 int istoplevel = (GetParent(handle) == HWND_DESKTOP); |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3369 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3370 GetClientRect(handle, &rect); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3371 |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
3372 ShowWindow(istoplevel ? mybox->items[0].hwnd : handle, SW_HIDE); |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3373 _do_resize(mybox, rect.right - rect.left, rect.bottom - rect.top); |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
3374 ShowWindow(istoplevel ? mybox->items[0].hwnd : handle, SW_SHOW); |
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
|
3375 } |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3376 } |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3377 |
411
a3a299455c67
Added parsing for " Bold" and " Italic" in the font name so it behaves
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
399
diff
changeset
|
3378 int instring(char *text, char *buffer) |
a3a299455c67
Added parsing for " Bold" and " Italic" in the font name so it behaves
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
399
diff
changeset
|
3379 { |
a3a299455c67
Added parsing for " Bold" and " Italic" in the font name so it behaves
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
399
diff
changeset
|
3380 int z, len = strlen(text), buflen = strlen(buffer); |
a3a299455c67
Added parsing for " Bold" and " Italic" in the font name so it behaves
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
399
diff
changeset
|
3381 |
a3a299455c67
Added parsing for " Bold" and " Italic" in the font name so it behaves
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
399
diff
changeset
|
3382 if(buflen > len) |
a3a299455c67
Added parsing for " Bold" and " Italic" in the font name so it behaves
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
399
diff
changeset
|
3383 { |
414
2a55f61714fd
Off by 1 test in _acquire_font(). "10.Terminal Bold" now works.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
411
diff
changeset
|
3384 for(z=0;z<=(buflen-len);z++) |
411
a3a299455c67
Added parsing for " Bold" and " Italic" in the font name so it behaves
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
399
diff
changeset
|
3385 { |
a3a299455c67
Added parsing for " Bold" and " Italic" in the font name so it behaves
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
399
diff
changeset
|
3386 if(memcmp(text, &buffer[z], len) == 0) |
a3a299455c67
Added parsing for " Bold" and " Italic" in the font name so it behaves
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
399
diff
changeset
|
3387 return 1; |
a3a299455c67
Added parsing for " Bold" and " Italic" in the font name so it behaves
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
399
diff
changeset
|
3388 } |
a3a299455c67
Added parsing for " Bold" and " Italic" in the font name so it behaves
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
399
diff
changeset
|
3389 } |
a3a299455c67
Added parsing for " Bold" and " Italic" in the font name so it behaves
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
399
diff
changeset
|
3390 return 0; |
a3a299455c67
Added parsing for " Bold" and " Italic" in the font name so it behaves
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
399
diff
changeset
|
3391 } |
a3a299455c67
Added parsing for " Bold" and " Italic" in the font name so it behaves
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
399
diff
changeset
|
3392 |
3 | 3393 /* |
3394 * Changes a window's parent to newparent. | |
3395 * Parameters: | |
3396 * handle: The window handle to destroy. | |
3397 * newparent: The window's new parent window. | |
3398 */ | |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
3399 void API dw_window_reparent(HWND handle, HWND newparent) |
3 | 3400 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3401 SetParent(handle, newparent); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3402 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3403 |
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
|
3404 HFONT _acquire_font(HWND handle, char *fontname) |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3405 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3406 HFONT hfont; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3407 int z, size = 9; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3408 LOGFONT lf; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3409 |
88
58d8139fe0a2
Added vertical center logic for static text controls on windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
87
diff
changeset
|
3410 if(fontname == DefaultFont || !fontname[0]) |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3411 hfont = GetStockObject(DEFAULT_GUI_FONT); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3412 else |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3413 { |
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
|
3414 #if 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
|
3415 HDC hDC = GetDC(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
|
3416 #endif |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3417 for(z=0;z<strlen(fontname);z++) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3418 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3419 if(fontname[z]=='.') |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3420 break; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3421 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3422 size = atoi(fontname) + 5; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3423 |
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
|
3424 #if 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
|
3425 lf.lfHeight = -MulDiv(size, GetDeviceCaps(hDC, LOGPIXELSY), 72); |
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
3426 #endif |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3427 lf.lfHeight = size; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3428 lf.lfWidth = 0; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3429 lf.lfEscapement = 0; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3430 lf.lfOrientation = 0; |
411
a3a299455c67
Added parsing for " Bold" and " Italic" in the font name so it behaves
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
399
diff
changeset
|
3431 lf.lfItalic = instring(" Italic", &fontname[z+1]); |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3432 lf.lfUnderline = 0; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3433 lf.lfStrikeOut = 0; |
411
a3a299455c67
Added parsing for " Bold" and " Italic" in the font name so it behaves
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
399
diff
changeset
|
3434 lf.lfWeight = instring(" Bold", &fontname[z+1]) ? FW_BOLD : FW_NORMAL; |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3435 lf.lfCharSet = DEFAULT_CHARSET; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3436 lf.lfOutPrecision = 0; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3437 lf.lfClipPrecision = 0; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3438 lf.lfQuality = DEFAULT_QUALITY; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3439 lf.lfPitchAndFamily = DEFAULT_PITCH | FW_DONTCARE; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3440 strcpy(lf.lfFaceName, &fontname[z+1]); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3441 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3442 hfont = CreateFontIndirect(&lf); |
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
|
3443 #if 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
|
3444 ReleaseDC(handle, hDC); |
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
3445 #endif |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3446 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3447 return hfont; |
3 | 3448 } |
3449 | |
3450 /* | |
3451 * Sets the font used by a specified window (widget) handle. | |
3452 * Parameters: | |
3453 * handle: The window (widget) handle. | |
3454 * fontname: Name and size of the font in the form "size.fontname" | |
3455 */ | |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
3456 int API dw_window_set_font(HWND handle, char *fontname) |
3 | 3457 { |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
3458 HFONT oldfont = (HFONT)SendMessage(handle, WM_GETFONT, 0, 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
|
3459 HFONT hfont = _acquire_font(handle, fontname); |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3460 ColorInfo *cinfo; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3461 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3462 cinfo = (ColorInfo *)GetWindowLong(handle, GWL_USERDATA); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3463 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3464 if(fontname) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3465 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3466 if(cinfo) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3467 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3468 strcpy(cinfo->fontname, fontname); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3469 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3470 else |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3471 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3472 cinfo = calloc(1, sizeof(ColorInfo)); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3473 cinfo->fore = cinfo->back = -1; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3474 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3475 strcpy(cinfo->fontname, fontname); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3476 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3477 cinfo->pOldProc = SubclassWindow(handle, _colorwndproc); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3478 SetWindowLong(handle, GWL_USERDATA, (ULONG)cinfo); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3479 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3480 } |
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
|
3481 SendMessage(handle, WM_SETFONT, (WPARAM)hfont, (LPARAM)TRUE); |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
3482 if(oldfont) |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
3483 DeleteObject(oldfont); |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3484 return 0; |
3 | 3485 } |
3486 | |
3487 /* | |
3488 * Sets the colors used by a specified window (widget) handle. | |
3489 * Parameters: | |
3490 * handle: The window (widget) handle. | |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3491 * fore: Foreground color in RGB format. |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3492 * back: Background color in RGB format. |
3 | 3493 */ |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
3494 int API dw_window_set_color(HWND handle, ULONG fore, ULONG back) |
3 | 3495 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3496 ColorInfo *cinfo; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3497 char tmpbuf[100]; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3498 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3499 cinfo = (ColorInfo *)GetWindowLong(handle, GWL_USERDATA); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3500 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3501 GetClassName(handle, tmpbuf, 99); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3502 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3503 if(strnicmp(tmpbuf, WC_LISTVIEW, strlen(WC_LISTVIEW))==0) |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
3504 { |
191
634625c3239d
Fixes for dw_color_xxxx_set() to accept OS/2 style colors, and fixed a
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
185
diff
changeset
|
3505 fore = _internal_color(fore); |
634625c3239d
Fixes for dw_color_xxxx_set() to accept OS/2 style colors, and fixed a
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
185
diff
changeset
|
3506 back = _internal_color(back); |
634625c3239d
Fixes for dw_color_xxxx_set() to accept OS/2 style colors, and fixed a
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
185
diff
changeset
|
3507 |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3508 ListView_SetTextColor(handle, RGB(DW_RED_VALUE(fore), |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3509 DW_GREEN_VALUE(fore), |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3510 DW_BLUE_VALUE(fore))); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3511 ListView_SetTextBkColor(handle, RGB(DW_RED_VALUE(back), |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3512 DW_GREEN_VALUE(back), |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3513 DW_BLUE_VALUE(back))); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3514 ListView_SetBkColor(handle, RGB(DW_RED_VALUE(back), |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3515 DW_GREEN_VALUE(back), |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3516 DW_BLUE_VALUE(back))); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3517 InvalidateRgn(handle, NULL, TRUE); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3518 return TRUE; |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
3519 } |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3520 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3521 if(cinfo) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3522 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3523 cinfo->fore = fore; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3524 cinfo->back = back; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3525 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3526 else |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3527 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3528 cinfo = calloc(1, sizeof(ColorInfo)); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3529 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3530 cinfo->fore = fore; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3531 cinfo->back = back; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3532 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3533 cinfo->pOldProc = SubclassWindow(handle, _colorwndproc); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3534 SetWindowLong(handle, GWL_USERDATA, (ULONG)cinfo); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3535 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3536 InvalidateRgn(handle, NULL, TRUE); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3537 return TRUE; |
3 | 3538 } |
3539 | |
3540 /* | |
3541 * Sets the font used by a specified window (widget) handle. | |
3542 * Parameters: | |
3543 * handle: The window (widget) handle. | |
3544 * border: Size of the window border in pixels. | |
3545 */ | |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
3546 int API dw_window_set_border(HWND handle, int border) |
3 | 3547 { |
3548 return 0; | |
3549 } | |
3550 | |
3551 /* | |
3552 * Captures the mouse input to this window. | |
3553 * Parameters: | |
3554 * handle: Handle to receive mouse input. | |
3555 */ | |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
3556 void API dw_window_capture(HWND handle) |
3 | 3557 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3558 SetCapture(handle); |
3 | 3559 } |
3560 | |
3561 /* | |
3562 * Releases previous mouse capture. | |
3563 */ | |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
3564 void API dw_window_release(void) |
3 | 3565 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3566 ReleaseCapture(); |
3 | 3567 } |
3568 | |
3569 /* | |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
17
diff
changeset
|
3570 * 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:
17
diff
changeset
|
3571 * Parameters: |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
17
diff
changeset
|
3572 * 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:
17
diff
changeset
|
3573 * 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:
17
diff
changeset
|
3574 */ |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
3575 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:
17
diff
changeset
|
3576 { |
399
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
389
diff
changeset
|
3577 /* |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
389
diff
changeset
|
3578 if(pointertype == DW_POINTER_ARROW) |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
389
diff
changeset
|
3579 SetClassLong( handle, GCL_HCURSOR, LoadCursor( NULL, IDC_ARROW)); |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
389
diff
changeset
|
3580 else if(pointertype == DW_POINTER_CLOCK) |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
389
diff
changeset
|
3581 SetClassLong( handle, GCL_HCURSOR, LoadCursor( NULL, IDC_WAIT)); |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
389
diff
changeset
|
3582 else |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
389
diff
changeset
|
3583 */ |
339 | 3584 SetCursor(pointertype < 65536 ? LoadCursor(NULL, MAKEINTRESOURCE(pointertype)) : (HCURSOR)pointertype); |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
17
diff
changeset
|
3585 } |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
17
diff
changeset
|
3586 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
17
diff
changeset
|
3587 /* |
3 | 3588 * Create a new Window Frame. |
3589 * Parameters: | |
3590 * owner: The Owner's window handle or HWND_DESKTOP. | |
3591 * title: The Window title. | |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3592 * flStyle: Style flags, see the DW reference. |
3 | 3593 */ |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
3594 HWND API dw_window_new(HWND hwndOwner, char *title, ULONG flStyle) |
3 | 3595 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3596 HWND hwndframe; |
90
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
3597 Box *newbox = calloc(sizeof(Box), 1); |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3598 ULONG flStyleEx = 0; |
3 | 3599 |
3600 newbox->pad = 0; | |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
281
diff
changeset
|
3601 newbox->type = DW_VERT; |
3 | 3602 newbox->count = 0; |
90
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
3603 newbox->cinfo.fore = newbox->cinfo.back = -1; |
3 | 3604 |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3605 if(hwndOwner) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3606 flStyleEx |= WS_EX_MDICHILD; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3607 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3608 if(!(flStyle & WS_CAPTION)) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3609 flStyle |= WS_POPUPWINDOW; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3610 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3611 if(flStyle & DW_FCF_TASKLIST) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3612 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3613 ULONG newflags = (flStyle | WS_CLIPCHILDREN) & ~DW_FCF_TASKLIST; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3614 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3615 hwndframe = CreateWindowEx(flStyleEx, ClassName, title, newflags, CW_USEDEFAULT, CW_USEDEFAULT, |
109
94d273843a41
Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
107
diff
changeset
|
3616 CW_USEDEFAULT, CW_USEDEFAULT, hwndOwner, NULL, DWInstance, NULL); |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3617 } |
3 | 3618 else |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3619 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3620 flStyleEx |= WS_EX_TOOLWINDOW; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3621 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3622 hwndframe = CreateWindowEx(flStyleEx, ClassName, title, flStyle | WS_CLIPCHILDREN, CW_USEDEFAULT, CW_USEDEFAULT, |
109
94d273843a41
Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
107
diff
changeset
|
3623 CW_USEDEFAULT, CW_USEDEFAULT, hwndOwner, NULL, DWInstance, NULL); |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3624 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3625 SetWindowLong(hwndframe, GWL_USERDATA, (ULONG)newbox); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3626 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3627 #if 0 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3628 if(hwndOwner) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3629 SetParent(hwndframe, hwndOwner); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3630 #endif |
12
26e2130135b9
Many Win32 and GTK fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
7
diff
changeset
|
3631 |
3 | 3632 return hwndframe; |
3633 } | |
3634 | |
3635 /* | |
3636 * Create a new Box to be packed. | |
3637 * Parameters: | |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
281
diff
changeset
|
3638 * type: Either DW_VERT (vertical) or DW_HORZ (horizontal). |
3 | 3639 * pad: Number of pixels to pad around the box. |
3640 */ | |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
3641 HWND API dw_box_new(int type, int pad) |
3 | 3642 { |
90
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
3643 Box *newbox = calloc(sizeof(Box), 1); |
3 | 3644 HWND hwndframe; |
3645 | |
3646 newbox->pad = pad; | |
3647 newbox->type = type; | |
3648 newbox->count = 0; | |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3649 newbox->grouphwnd = (HWND)NULL; |
90
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
3650 newbox->cinfo.fore = newbox->cinfo.back = -1; |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3651 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3652 hwndframe = CreateWindow(FRAMECLASSNAME, |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3653 "", |
107
cd0e5cf92f6a
Rewrote the Windows packing code so it is more like OS/2 to improve window
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
106
diff
changeset
|
3654 WS_VISIBLE | WS_CHILD | WS_CLIPCHILDREN, |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3655 0,0,2000,1000, |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3656 DW_HWND_OBJECT, |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3657 NULL, |
109
94d273843a41
Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
107
diff
changeset
|
3658 DWInstance, |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3659 NULL); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3660 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3661 newbox->cinfo.pOldProc = SubclassWindow(hwndframe, _colorwndproc); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3662 newbox->cinfo.fore = newbox->cinfo.back = -1; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3663 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3664 SetWindowLong(hwndframe, GWL_USERDATA, (ULONG)newbox); |
3 | 3665 return hwndframe; |
3666 } | |
3667 | |
3668 /* | |
3669 * Create a new Group Box to be packed. | |
3670 * Parameters: | |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
281
diff
changeset
|
3671 * type: Either DW_VERT (vertical) or DW_HORZ (horizontal). |
3 | 3672 * pad: Number of pixels to pad around the box. |
3673 * title: Text to be displayined in the group outline. | |
3674 */ | |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
3675 HWND API dw_groupbox_new(int type, int pad, char *title) |
3 | 3676 { |
90
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
3677 Box *newbox = calloc(sizeof(Box), 1); |
3 | 3678 HWND hwndframe; |
3679 | |
3680 newbox->pad = pad; | |
3681 newbox->type = type; | |
3682 newbox->count = 0; | |
90
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
3683 newbox->cinfo.fore = newbox->cinfo.back = -1; |
3 | 3684 |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3685 hwndframe = CreateWindow(FRAMECLASSNAME, |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3686 "", |
107
cd0e5cf92f6a
Rewrote the Windows packing code so it is more like OS/2 to improve window
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
106
diff
changeset
|
3687 WS_VISIBLE | WS_CHILD, |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3688 0,0,2000,1000, |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3689 DW_HWND_OBJECT, |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3690 NULL, |
109
94d273843a41
Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
107
diff
changeset
|
3691 DWInstance, |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3692 NULL); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3693 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3694 newbox->grouphwnd = CreateWindow(BUTTONCLASSNAME, |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3695 title, |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3696 WS_CHILD | BS_GROUPBOX | |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3697 WS_VISIBLE | WS_CLIPCHILDREN, |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3698 0,0,2000,1000, |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3699 hwndframe, |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3700 NULL, |
109
94d273843a41
Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
107
diff
changeset
|
3701 DWInstance, |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3702 NULL); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3703 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3704 SetWindowLong(hwndframe, GWL_USERDATA, (ULONG)newbox); |
3 | 3705 dw_window_set_font(newbox->grouphwnd, DefaultFont); |
3706 return hwndframe; | |
3707 } | |
3708 | |
3709 /* | |
14
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3710 * 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
|
3711 * Parameters: |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3712 * 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
|
3713 */ |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
3714 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
|
3715 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3716 CLIENTCREATESTRUCT ccs; |
14
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3717 HWND hwndframe; |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3718 |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3719 ccs.hWindowMenu = NULL; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3720 ccs.idFirstChild = 0; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3721 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3722 hwndframe = CreateWindow("MDICLIENT", |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3723 "", |
107
cd0e5cf92f6a
Rewrote the Windows packing code so it is more like OS/2 to improve window
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
106
diff
changeset
|
3724 WS_VISIBLE | WS_CHILD | WS_CLIPSIBLINGS, |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3725 0,0,2000,1000, |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3726 DW_HWND_OBJECT, |
119
1cad81b7cc4c
Implemented initial splitbar code on Unix. And made some fixes for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
118
diff
changeset
|
3727 (HMENU)id, |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3728 DWInstance, |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3729 &ccs); |
14
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3730 return hwndframe; |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3731 } |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3732 |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3733 /* |
3 | 3734 * Create a bitmap object to be packed. |
3735 * Parameters: | |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3736 * id: An ID to be used with dw_window_from_id or 0L. |
3 | 3737 */ |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
3738 HWND API dw_bitmap_new(ULONG id) |
3 | 3739 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3740 return CreateWindow(STATICCLASSNAME, |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3741 "", |
107
cd0e5cf92f6a
Rewrote the Windows packing code so it is more like OS/2 to improve window
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
106
diff
changeset
|
3742 SS_BITMAP | WS_VISIBLE | |
cd0e5cf92f6a
Rewrote the Windows packing code so it is more like OS/2 to improve window
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
106
diff
changeset
|
3743 WS_CHILD | WS_CLIPCHILDREN, |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3744 0,0,2000,1000, |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3745 DW_HWND_OBJECT, |
119
1cad81b7cc4c
Implemented initial splitbar code on Unix. And made some fixes for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
118
diff
changeset
|
3746 (HMENU)id, |
109
94d273843a41
Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
107
diff
changeset
|
3747 DWInstance, |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3748 NULL); |
3 | 3749 } |
3750 | |
3751 /* | |
3752 * Create a notebook object to be packed. | |
3753 * Parameters: | |
3754 * id: An ID to be used for getting the resource from the | |
3755 * resource file. | |
3756 */ | |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
3757 HWND API dw_notebook_new(ULONG id, int top) |
3 | 3758 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3759 ULONG flags = 0; |
3 | 3760 HWND tmp; |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3761 NotebookPage **array = calloc(256, sizeof(NotebookPage *)); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3762 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3763 if(!top) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3764 flags = TCS_BOTTOM; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3765 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3766 tmp = CreateWindow(WC_TABCONTROL, |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3767 "", |
107
cd0e5cf92f6a
Rewrote the Windows packing code so it is more like OS/2 to improve window
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
106
diff
changeset
|
3768 WS_VISIBLE | WS_CHILD | WS_CLIPCHILDREN, |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3769 0,0,2000,1000, |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3770 DW_HWND_OBJECT, |
119
1cad81b7cc4c
Implemented initial splitbar code on Unix. And made some fixes for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
118
diff
changeset
|
3771 (HMENU)id, |
109
94d273843a41
Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
107
diff
changeset
|
3772 DWInstance, |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3773 NULL); |
191
634625c3239d
Fixes for dw_color_xxxx_set() to accept OS/2 style colors, and fixed a
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
185
diff
changeset
|
3774 dw_window_set_data(tmp, "_dw_array", (void *)array); |
3 | 3775 dw_window_set_font(tmp, DefaultFont); |
3776 return tmp; | |
3777 } | |
3778 | |
3779 /* | |
3780 * Create a menu object to be popped up. | |
3781 * Parameters: | |
3782 * id: An ID to be used for getting the resource from the | |
3783 * resource file. | |
3784 */ | |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
3785 HMENUI API dw_menu_new(ULONG id) |
3 | 3786 { |
238
13d3de3f1e83
Rewrote the menu code to not return structs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
211
diff
changeset
|
3787 return (HMENUI)CreatePopupMenu(); |
3 | 3788 } |
3789 | |
3790 /* | |
3791 * Create a menubar on a window. | |
3792 * Parameters: | |
3793 * location: Handle of a window frame to be attached to. | |
3794 */ | |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
3795 HMENUI API dw_menubar_new(HWND location) |
3 | 3796 { |
185
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
182
diff
changeset
|
3797 HMENUI tmp; |
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
182
diff
changeset
|
3798 |
238
13d3de3f1e83
Rewrote the menu code to not return structs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
211
diff
changeset
|
3799 tmp = (HMENUI)CreateMenu(); |
13d3de3f1e83
Rewrote the menu code to not return structs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
211
diff
changeset
|
3800 |
13d3de3f1e83
Rewrote the menu code to not return structs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
211
diff
changeset
|
3801 dw_window_set_data(location, "_dw_menu", (void *)tmp); |
13d3de3f1e83
Rewrote the menu code to not return structs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
211
diff
changeset
|
3802 |
13d3de3f1e83
Rewrote the menu code to not return structs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
211
diff
changeset
|
3803 SetMenu(location, (HMENU)tmp); |
13d3de3f1e83
Rewrote the menu code to not return structs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
211
diff
changeset
|
3804 return location; |
3 | 3805 } |
3806 | |
3807 /* | |
3808 * Destroys a menu created with dw_menubar_new or dw_menu_new. | |
3809 * Parameters: | |
3810 * menu: Handle of a menu. | |
3811 */ | |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
3812 void API dw_menu_destroy(HMENUI *menu) |
3 | 3813 { |
185
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
182
diff
changeset
|
3814 if(menu) |
238
13d3de3f1e83
Rewrote the menu code to not return structs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
211
diff
changeset
|
3815 { |
13d3de3f1e83
Rewrote the menu code to not return structs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
211
diff
changeset
|
3816 HMENU mymenu = (HMENU)*menu; |
13d3de3f1e83
Rewrote the menu code to not return structs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
211
diff
changeset
|
3817 |
13d3de3f1e83
Rewrote the menu code to not return structs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
211
diff
changeset
|
3818 if(IsWindow((HWND)mymenu) && !IsMenu(mymenu)) |
13d3de3f1e83
Rewrote the menu code to not return structs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
211
diff
changeset
|
3819 mymenu = (HMENU)dw_window_get_data((HWND)mymenu, "_dw_menu"); |
13d3de3f1e83
Rewrote the menu code to not return structs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
211
diff
changeset
|
3820 if(IsMenu(mymenu)) |
13d3de3f1e83
Rewrote the menu code to not return structs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
211
diff
changeset
|
3821 DestroyMenu(mymenu); |
13d3de3f1e83
Rewrote the menu code to not return structs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
211
diff
changeset
|
3822 } |
3 | 3823 } |
3824 | |
3825 /* | |
3826 * Adds a menuitem or submenu to an existing menu. | |
3827 * Parameters: | |
3828 * menu: The handle the the existing menu. | |
3829 * title: The title text on the menu item to be added. | |
3830 * id: An ID to be used for message passing. | |
3831 * end: If TRUE memu is positioned at the end of the menu. | |
3832 * check: If TRUE menu is "check"able. | |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3833 * flags: Extended attributes to set on the menu. |
3 | 3834 * submenu: Handle to an existing menu to be a submenu or NULL. |
3835 */ | |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
3836 HWND API dw_menu_append_item(HMENUI menux, char *title, ULONG id, ULONG flags, int end, int check, HMENUI submenu) |
3 | 3837 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3838 MENUITEMINFO mii; |
238
13d3de3f1e83
Rewrote the menu code to not return structs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
211
diff
changeset
|
3839 HMENU mymenu = (HMENU)menux; |
13d3de3f1e83
Rewrote the menu code to not return structs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
211
diff
changeset
|
3840 |
13d3de3f1e83
Rewrote the menu code to not return structs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
211
diff
changeset
|
3841 if(IsWindow(menux) && !IsMenu(mymenu)) |
13d3de3f1e83
Rewrote the menu code to not return structs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
211
diff
changeset
|
3842 mymenu = (HMENU)dw_window_get_data(menux, "_dw_menu"); |
3 | 3843 |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3844 mii.cbSize = sizeof(MENUITEMINFO); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3845 mii.fMask = MIIM_ID | MIIM_SUBMENU | MIIM_TYPE; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3846 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3847 /* Convert from OS/2 style accellerators to Win32 style */ |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3848 if(title) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3849 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3850 char *tmp = title; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3851 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3852 while(*tmp) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3853 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3854 if(*tmp == '~') |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3855 *tmp = '&'; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3856 tmp++; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3857 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3858 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3859 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3860 if(title && *title) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3861 mii.fType = MFT_STRING; |
3 | 3862 else |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3863 mii.fType = MFT_SEPARATOR; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3864 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3865 mii.wID = id; |
238
13d3de3f1e83
Rewrote the menu code to not return structs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
211
diff
changeset
|
3866 if(IsMenu((HMENU)submenu)) |
13d3de3f1e83
Rewrote the menu code to not return structs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
211
diff
changeset
|
3867 mii.hSubMenu = (HMENU)submenu; |
13d3de3f1e83
Rewrote the menu code to not return structs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
211
diff
changeset
|
3868 else |
13d3de3f1e83
Rewrote the menu code to not return structs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
211
diff
changeset
|
3869 mii.hSubMenu = 0; |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3870 mii.dwTypeData = title; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3871 mii.cch = strlen(title); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3872 |
238
13d3de3f1e83
Rewrote the menu code to not return structs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
211
diff
changeset
|
3873 InsertMenuItem(mymenu, 65535, TRUE, &mii); |
13d3de3f1e83
Rewrote the menu code to not return structs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
211
diff
changeset
|
3874 if(IsWindow(menux) && !IsMenu((HMENU)menux)) |
13d3de3f1e83
Rewrote the menu code to not return structs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
211
diff
changeset
|
3875 DrawMenuBar(menux); |
3 | 3876 return (HWND)id; |
3877 } | |
3878 | |
3879 /* | |
3880 * Sets the state of a menu item check. | |
3881 * Parameters: | |
3882 * menu: The handle the the existing menu. | |
3883 * id: Menuitem id. | |
3884 * check: TRUE for checked FALSE for not checked. | |
3885 */ | |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
3886 void API dw_menu_item_set_check(HMENUI menux, unsigned long id, int check) |
3 | 3887 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3888 MENUITEMINFO mii; |
238
13d3de3f1e83
Rewrote the menu code to not return structs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
211
diff
changeset
|
3889 HMENU mymenu = (HMENU)menux; |
13d3de3f1e83
Rewrote the menu code to not return structs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
211
diff
changeset
|
3890 |
13d3de3f1e83
Rewrote the menu code to not return structs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
211
diff
changeset
|
3891 if(IsWindow(menux) && !IsMenu(mymenu)) |
13d3de3f1e83
Rewrote the menu code to not return structs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
211
diff
changeset
|
3892 mymenu = (HMENU)dw_window_get_data(menux, "_dw_menu"); |
3 | 3893 |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3894 mii.cbSize = sizeof(MENUITEMINFO); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3895 mii.fMask = MIIM_STATE; |
3 | 3896 if(check) |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3897 mii.fState = MFS_CHECKED; |
3 | 3898 else |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3899 mii.fState = MFS_UNCHECKED; |
238
13d3de3f1e83
Rewrote the menu code to not return structs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
211
diff
changeset
|
3900 SetMenuItemInfo(mymenu, id, FALSE, &mii); |
3 | 3901 } |
3902 | |
3903 /* | |
3904 * Pops up a context menu at given x and y coordinates. | |
3905 * Parameters: | |
3906 * menu: The handle the the existing menu. | |
3907 * parent: Handle to the window initiating the popup. | |
3908 * x: X coordinate. | |
3909 * y: Y coordinate. | |
3910 */ | |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
3911 void API dw_menu_popup(HMENUI *menu, HWND parent, int x, int y) |
3 | 3912 { |
185
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
182
diff
changeset
|
3913 if(menu) |
3 | 3914 { |
238
13d3de3f1e83
Rewrote the menu code to not return structs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
211
diff
changeset
|
3915 HMENU mymenu = (HMENU)*menu; |
13d3de3f1e83
Rewrote the menu code to not return structs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
211
diff
changeset
|
3916 |
13d3de3f1e83
Rewrote the menu code to not return structs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
211
diff
changeset
|
3917 if(IsWindow(*menu) && !IsMenu(mymenu)) |
13d3de3f1e83
Rewrote the menu code to not return structs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
211
diff
changeset
|
3918 mymenu = (HMENU)dw_window_get_data(*menu, "_dw_menu"); |
13d3de3f1e83
Rewrote the menu code to not return structs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
211
diff
changeset
|
3919 |
93
98cce029a611
Changed handling of menu item click events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
90
diff
changeset
|
3920 popup = parent; |
238
13d3de3f1e83
Rewrote the menu code to not return structs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
211
diff
changeset
|
3921 TrackPopupMenu(mymenu, 0, x, y, 0, parent, NULL); |
13d3de3f1e83
Rewrote the menu code to not return structs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
211
diff
changeset
|
3922 DestroyMenu(mymenu); |
3 | 3923 } |
3924 } | |
3925 | |
3926 | |
3927 /* | |
3928 * Create a container object to be packed. | |
3929 * Parameters: | |
3930 * id: An ID to be used for getting the resource from the | |
3931 * resource file. | |
3932 */ | |
350
2216e65ad2ae
Removed slider flags and container selection flags from the header file.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
346
diff
changeset
|
3933 HWND API dw_container_new(ULONG id, int multi) |
3 | 3934 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3935 HWND tmp = CreateWindow(WC_LISTVIEW, |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3936 "", |
107
cd0e5cf92f6a
Rewrote the Windows packing code so it is more like OS/2 to improve window
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
106
diff
changeset
|
3937 WS_VISIBLE | WS_CHILD | |
350
2216e65ad2ae
Removed slider flags and container selection flags from the header file.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
346
diff
changeset
|
3938 (multi ? 0 : LVS_SINGLESEL) | |
107
cd0e5cf92f6a
Rewrote the Windows packing code so it is more like OS/2 to improve window
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
106
diff
changeset
|
3939 LVS_REPORT | LVS_SHOWSELALWAYS | |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3940 LVS_SHAREIMAGELISTS | WS_BORDER | |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3941 WS_CLIPCHILDREN, |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3942 0,0,2000,1000, |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3943 DW_HWND_OBJECT, |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3944 (HMENU)id, |
109
94d273843a41
Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
107
diff
changeset
|
3945 DWInstance, |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3946 NULL); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3947 ContainerInfo *cinfo = (ContainerInfo *)calloc(1, sizeof(ContainerInfo)); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3948 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3949 if(!cinfo) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3950 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3951 DestroyWindow(tmp); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3952 return NULL; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3953 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3954 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3955 cinfo->pOldProc = (WNDPROC)SubclassWindow(tmp, _containerwndproc); |
68
8d6100960adf
Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
3956 cinfo->cinfo.fore = cinfo->cinfo.back = -1; |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3957 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3958 SetWindowLong(tmp, GWL_USERDATA, (ULONG)cinfo); |
3 | 3959 dw_window_set_font(tmp, DefaultFont); |
3960 return tmp; | |
3961 } | |
3962 | |
3963 /* | |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
17
diff
changeset
|
3964 * 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:
17
diff
changeset
|
3965 * Parameters: |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
17
diff
changeset
|
3966 * 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:
17
diff
changeset
|
3967 * resource file. |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
17
diff
changeset
|
3968 */ |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
3969 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:
17
diff
changeset
|
3970 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3971 HWND tmp = CreateWindow(WC_TREEVIEW, |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3972 "", |
107
cd0e5cf92f6a
Rewrote the Windows packing code so it is more like OS/2 to improve window
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
106
diff
changeset
|
3973 WS_VISIBLE | WS_CHILD | |
cd0e5cf92f6a
Rewrote the Windows packing code so it is more like OS/2 to improve window
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
106
diff
changeset
|
3974 TVS_HASLINES | TVS_SHOWSELALWAYS | |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3975 TVS_HASBUTTONS | TVS_LINESATROOT | |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3976 WS_BORDER | WS_CLIPCHILDREN, |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3977 0,0,2000,1000, |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3978 DW_HWND_OBJECT, |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3979 (HMENU)id, |
109
94d273843a41
Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
107
diff
changeset
|
3980 DWInstance, |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3981 NULL); |
68
8d6100960adf
Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
3982 ContainerInfo *cinfo = (ContainerInfo *)calloc(1, sizeof(ContainerInfo)); |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
3983 TreeView_SetItemHeight(tmp, 16); |
68
8d6100960adf
Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
3984 |
8d6100960adf
Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
3985 if(!cinfo) |
8d6100960adf
Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
3986 { |
8d6100960adf
Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
3987 DestroyWindow(tmp); |
8d6100960adf
Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
3988 return NULL; |
8d6100960adf
Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
3989 } |
8d6100960adf
Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
3990 |
8d6100960adf
Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
3991 cinfo->pOldProc = (WNDPROC)SubclassWindow(tmp, _treewndproc); |
8d6100960adf
Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
3992 cinfo->cinfo.fore = cinfo->cinfo.back = -1; |
8d6100960adf
Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
3993 |
8d6100960adf
Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
3994 SetWindowLong(tmp, GWL_USERDATA, (ULONG)cinfo); |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
17
diff
changeset
|
3995 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:
17
diff
changeset
|
3996 return tmp; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
17
diff
changeset
|
3997 } |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
17
diff
changeset
|
3998 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
17
diff
changeset
|
3999 /* |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4000 * Returns the current X and Y coordinates of the mouse pointer. |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4001 * Parameters: |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4002 * x: Pointer to variable to store X coordinate. |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4003 * y: Pointer to variable to store Y coordinate. |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4004 */ |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
4005 void API dw_pointer_query_pos(long *x, long *y) |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4006 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4007 POINT ptl; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4008 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4009 GetCursorPos(&ptl); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4010 if(x && y) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4011 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4012 *x = ptl.x; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4013 *y = ptl.y; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4014 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4015 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4016 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4017 /* |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4018 * Sets the X and Y coordinates of the mouse pointer. |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4019 * Parameters: |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4020 * x: X coordinate. |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4021 * y: Y coordinate. |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4022 */ |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
4023 void API dw_pointer_set_pos(long x, long y) |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4024 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4025 SetCursorPos(x, y); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4026 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4027 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4028 /* |
3 | 4029 * Create a new static text window (widget) to be packed. |
4030 * Parameters: | |
4031 * 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:
277
diff
changeset
|
4032 * id: An ID to be used with dw_window_from_id() or 0L. |
3 | 4033 */ |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
4034 HWND API dw_text_new(char *text, ULONG id) |
3 | 4035 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4036 HWND tmp = CreateWindow(STATICCLASSNAME, |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4037 text, |
107
cd0e5cf92f6a
Rewrote the Windows packing code so it is more like OS/2 to improve window
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
106
diff
changeset
|
4038 BS_TEXT | WS_VISIBLE | |
cd0e5cf92f6a
Rewrote the Windows packing code so it is more like OS/2 to improve window
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
106
diff
changeset
|
4039 WS_CHILD | WS_CLIPCHILDREN, |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4040 0,0,2000,1000, |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4041 DW_HWND_OBJECT, |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4042 (HMENU)id, |
109
94d273843a41
Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
107
diff
changeset
|
4043 DWInstance, |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4044 NULL); |
3 | 4045 dw_window_set_font(tmp, DefaultFont); |
4046 return tmp; | |
4047 } | |
4048 | |
4049 /* | |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4050 * 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
|
4051 * Parameters: |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4052 * 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:
277
diff
changeset
|
4053 * 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
|
4054 */ |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
4055 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
|
4056 { |
299
2a97f8d9b297
Use DrawStatusText() to make the status lines, instead of doing it ourself.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
298
diff
changeset
|
4057 HWND tmp = CreateWindow(ObjectClassName, |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4058 text, |
107
cd0e5cf92f6a
Rewrote the Windows packing code so it is more like OS/2 to improve window
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
106
diff
changeset
|
4059 BS_TEXT | WS_VISIBLE | |
cd0e5cf92f6a
Rewrote the Windows packing code so it is more like OS/2 to improve window
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
106
diff
changeset
|
4060 WS_CHILD | WS_CLIPCHILDREN, |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4061 0,0,2000,1000, |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4062 DW_HWND_OBJECT, |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4063 (HMENU)id, |
109
94d273843a41
Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
107
diff
changeset
|
4064 DWInstance, |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4065 NULL); |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4066 dw_window_set_font(tmp, DefaultFont); |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4067 SubclassWindow(tmp, _statuswndproc); |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4068 return tmp; |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4069 } |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4070 |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4071 /* |
3 | 4072 * Create a new Multiline Editbox window (widget) to be packed. |
4073 * Parameters: | |
278
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
277
diff
changeset
|
4074 * id: An ID to be used with dw_window_from_id() or 0L. |
3 | 4075 */ |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
4076 HWND API dw_mle_new(ULONG id) |
3 | 4077 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4078 |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
4079 HWND tmp = CreateWindowEx(WS_EX_CLIENTEDGE, |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
4080 EDITCLASSNAME, |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
4081 "", |
107
cd0e5cf92f6a
Rewrote the Windows packing code so it is more like OS/2 to improve window
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
106
diff
changeset
|
4082 WS_VISIBLE | WS_BORDER | |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
4083 WS_VSCROLL | ES_MULTILINE | |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
4084 ES_WANTRETURN | WS_CHILD | |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
4085 WS_CLIPCHILDREN, |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
4086 0,0,2000,1000, |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
4087 DW_HWND_OBJECT, |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
4088 (HMENU)id, |
109
94d273843a41
Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
107
diff
changeset
|
4089 DWInstance, |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
4090 NULL); |
68
8d6100960adf
Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
4091 ContainerInfo *cinfo = (ContainerInfo *)calloc(1, sizeof(ContainerInfo)); |
8d6100960adf
Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
4092 |
8d6100960adf
Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
4093 if(!cinfo) |
8d6100960adf
Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
4094 { |
8d6100960adf
Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
4095 DestroyWindow(tmp); |
8d6100960adf
Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
4096 return NULL; |
8d6100960adf
Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
4097 } |
8d6100960adf
Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
4098 |
8d6100960adf
Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
4099 cinfo->pOldProc = (WNDPROC)SubclassWindow(tmp, _treewndproc); |
8d6100960adf
Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
4100 cinfo->cinfo.fore = cinfo->cinfo.back = -1; |
8d6100960adf
Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
4101 |
8d6100960adf
Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
4102 SetWindowLong(tmp, GWL_USERDATA, (ULONG)cinfo); |
3 | 4103 dw_window_set_font(tmp, DefaultFont); |
4104 return tmp; | |
4105 } | |
4106 | |
4107 /* | |
4108 * Create a new Entryfield window (widget) to be packed. | |
4109 * Parameters: | |
4110 * 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:
277
diff
changeset
|
4111 * id: An ID to be used with dw_window_from_id() or 0L. |
3 | 4112 */ |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
4113 HWND API dw_entryfield_new(char *text, ULONG id) |
3 | 4114 { |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
4115 HWND tmp = CreateWindowEx(WS_EX_CLIENTEDGE, |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
4116 EDITCLASSNAME, |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
4117 text, |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
4118 ES_WANTRETURN | WS_CHILD | |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
4119 WS_BORDER | ES_AUTOHSCROLL | |
107
cd0e5cf92f6a
Rewrote the Windows packing code so it is more like OS/2 to improve window
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
106
diff
changeset
|
4120 WS_VISIBLE | WS_CLIPCHILDREN, |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
4121 0,0,2000,1000, |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
4122 DW_HWND_OBJECT, |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
4123 (HMENU)id, |
109
94d273843a41
Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
107
diff
changeset
|
4124 DWInstance, |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
4125 NULL); |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4126 ColorInfo *cinfo = calloc(1, sizeof(ColorInfo)); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4127 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4128 cinfo->back = cinfo->fore = -1; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4129 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4130 cinfo->pOldProc = SubclassWindow(tmp, _colorwndproc); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4131 SetWindowLong(tmp, GWL_USERDATA, (ULONG)cinfo); |
3 | 4132 dw_window_set_font(tmp, DefaultFont); |
4133 return tmp; | |
4134 } | |
4135 | |
4136 /* | |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4137 * Create a new Entryfield passwird window (widget) to be packed. |
3 | 4138 * Parameters: |
4139 * 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:
277
diff
changeset
|
4140 * id: An ID to be used with dw_window_from_id() or 0L. |
3 | 4141 */ |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
4142 HWND API dw_entryfield_password_new(char *text, ULONG id) |
3 | 4143 { |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
4144 HWND tmp = CreateWindowEx(WS_EX_CLIENTEDGE, |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
4145 EDITCLASSNAME, |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
4146 text, |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
4147 ES_WANTRETURN | WS_CHILD | |
107
cd0e5cf92f6a
Rewrote the Windows packing code so it is more like OS/2 to improve window
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
106
diff
changeset
|
4148 ES_PASSWORD | WS_BORDER | WS_VISIBLE | |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
4149 ES_AUTOHSCROLL | WS_CLIPCHILDREN, |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
4150 0,0,2000,1000, |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
4151 DW_HWND_OBJECT, |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
4152 (HMENU)id, |
109
94d273843a41
Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
107
diff
changeset
|
4153 DWInstance, |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
4154 NULL); |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4155 ColorInfo *cinfo = calloc(1, sizeof(ColorInfo)); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4156 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4157 cinfo->back = cinfo->fore = -1; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4158 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4159 cinfo->pOldProc = SubclassWindow(tmp, _colorwndproc); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4160 SetWindowLong(tmp, GWL_USERDATA, (ULONG)cinfo); |
3 | 4161 dw_window_set_font(tmp, DefaultFont); |
4162 return tmp; | |
4163 } | |
4164 | |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4165 BOOL CALLBACK _subclass_child(HWND handle, LPARAM lp) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4166 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4167 ColorInfo *cinfo = (ColorInfo *)lp; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4168 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4169 if(cinfo) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4170 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4171 cinfo->buddy = handle; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4172 cinfo->pOldProc = (WNDPROC)SubclassWindow(handle, _colorwndproc); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4173 SetWindowLong(handle, GWL_USERDATA, (ULONG)cinfo); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4174 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4175 return FALSE; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4176 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4177 |
3 | 4178 /* |
4179 * Create a new Combobox window (widget) to be packed. | |
4180 * Parameters: | |
4181 * 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:
277
diff
changeset
|
4182 * id: An ID to be used with dw_window_from_id() or 0L. |
3 | 4183 */ |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
4184 HWND API dw_combobox_new(char *text, ULONG id) |
3 | 4185 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4186 HWND tmp = CreateWindow(COMBOBOXCLASSNAME, |
89
ec311fe773da
Include a vertical scrollbar on comboboxes when there are too many items.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
88
diff
changeset
|
4187 text, |
ec311fe773da
Include a vertical scrollbar on comboboxes when there are too many items.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
88
diff
changeset
|
4188 WS_CHILD | CBS_DROPDOWN | WS_VSCROLL | |
194
37bee5b50bcb
Comboboxes need the CBS_AUTOHSCROLL style on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
191
diff
changeset
|
4189 WS_CLIPCHILDREN | CBS_AUTOHSCROLL | WS_VISIBLE, |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4190 0,0,2000,1000, |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4191 DW_HWND_OBJECT, |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4192 (HMENU)id, |
109
94d273843a41
Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
107
diff
changeset
|
4193 DWInstance, |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4194 NULL); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4195 ColorInfo *cinfo = (ColorInfo *)calloc(1, sizeof(ColorInfo)); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4196 ColorInfo *cinfo2 = (ColorInfo *)calloc(1, sizeof(ColorInfo)); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4197 |
90
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
4198 if(!cinfo || !cinfo2) |
3 | 4199 { |
90
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
4200 if(cinfo) |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
4201 free(cinfo); |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
4202 if(cinfo2) |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
4203 free(cinfo2); |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4204 DestroyWindow(tmp); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4205 return NULL; |
3 | 4206 } |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4207 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4208 cinfo2->fore = cinfo->fore = -1; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4209 cinfo2->back = cinfo->back = -1; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4210 cinfo2->combo = cinfo->combo = tmp; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4211 EnumChildWindows(tmp, _subclass_child, (LPARAM)cinfo2); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4212 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4213 SetWindowLong(tmp, GWL_USERDATA, (ULONG)cinfo); |
3 | 4214 dw_window_set_font(tmp, DefaultFont); |
4215 return tmp; | |
4216 } | |
4217 | |
4218 /* | |
4219 * Create a new button window (widget) to be packed. | |
4220 * Parameters: | |
4221 * 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:
277
diff
changeset
|
4222 * id: An ID to be used with dw_window_from_id() or 0L. |
3 | 4223 */ |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
4224 HWND API dw_button_new(char *text, ULONG id) |
3 | 4225 { |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
59
diff
changeset
|
4226 BubbleButton *bubble = calloc(1, sizeof(BubbleButton)); |
3 | 4227 |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4228 HWND tmp = CreateWindow(BUTTONCLASSNAME, |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4229 text, |
107
cd0e5cf92f6a
Rewrote the Windows packing code so it is more like OS/2 to improve window
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
106
diff
changeset
|
4230 WS_CHILD | BS_PUSHBUTTON | |
cd0e5cf92f6a
Rewrote the Windows packing code so it is more like OS/2 to improve window
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
106
diff
changeset
|
4231 WS_VISIBLE | WS_CLIPCHILDREN, |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4232 0,0,2000,1000, |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4233 DW_HWND_OBJECT, |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4234 (HMENU)id, |
109
94d273843a41
Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
107
diff
changeset
|
4235 DWInstance, |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4236 NULL); |
3 | 4237 |
4238 bubble->id = id; | |
4239 bubble->bubbletext[0] = '\0'; | |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4240 bubble->pOldProc = (WNDPROC)SubclassWindow(tmp, _BtProc); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4241 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4242 SetWindowLong(tmp, GWL_USERDATA, (ULONG)bubble); |
3 | 4243 dw_window_set_font(tmp, DefaultFont); |
4244 return tmp; | |
4245 } | |
4246 | |
4247 /* | |
4248 * Create a new bitmap button window (widget) to be packed. | |
4249 * Parameters: | |
4250 * text: Bubble help text to be displayed. | |
4251 * id: An ID of a bitmap in the resource file. | |
4252 */ | |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
4253 HWND API dw_bitmapbutton_new(char *text, ULONG id) |
3 | 4254 { |
4255 HWND tmp; | |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
59
diff
changeset
|
4256 BubbleButton *bubble = calloc(1, sizeof(BubbleButton)); |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4257 HBITMAP hbitmap = LoadBitmap(DWInstance, MAKEINTRESOURCE(id)); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4258 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4259 tmp = CreateWindow(BUTTONCLASSNAME, |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4260 "", |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4261 WS_CHILD | BS_PUSHBUTTON | |
107
cd0e5cf92f6a
Rewrote the Windows packing code so it is more like OS/2 to improve window
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
106
diff
changeset
|
4262 BS_BITMAP | WS_CLIPCHILDREN | |
cd0e5cf92f6a
Rewrote the Windows packing code so it is more like OS/2 to improve window
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
106
diff
changeset
|
4263 WS_VISIBLE, |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4264 0,0,2000,1000, |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4265 DW_HWND_OBJECT, |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4266 (HMENU)id, |
109
94d273843a41
Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
107
diff
changeset
|
4267 DWInstance, |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4268 NULL); |
3 | 4269 |
4270 bubble->id = id; | |
4271 strncpy(bubble->bubbletext, text, BUBBLE_HELP_MAX - 1); | |
4272 bubble->bubbletext[BUBBLE_HELP_MAX - 1] = '\0'; | |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4273 bubble->pOldProc = (WNDPROC)SubclassWindow(tmp, _BtProc); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4274 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4275 SetWindowLong(tmp, GWL_USERDATA, (ULONG)bubble); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4276 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4277 SendMessage(tmp, BM_SETIMAGE, |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4278 (WPARAM) IMAGE_BITMAP, |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4279 (LPARAM) hbitmap); |
3 | 4280 return tmp; |
4281 } | |
4282 | |
4283 /* | |
281
2f038ef90a36
Implemented dw_bitmapbutton_new_from_file() on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
278
diff
changeset
|
4284 * Create a new bitmap button window (widget) to be packed from a file. |
2f038ef90a36
Implemented dw_bitmapbutton_new_from_file() on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
278
diff
changeset
|
4285 * Parameters: |
2f038ef90a36
Implemented dw_bitmapbutton_new_from_file() on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
278
diff
changeset
|
4286 * text: Bubble help text to be displayed. |
2f038ef90a36
Implemented dw_bitmapbutton_new_from_file() on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
278
diff
changeset
|
4287 * id: An ID to be used with dw_window_from_id() or 0L. |
2f038ef90a36
Implemented dw_bitmapbutton_new_from_file() on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
278
diff
changeset
|
4288 * filename: Name of the file, omit extention to have |
2f038ef90a36
Implemented dw_bitmapbutton_new_from_file() on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
278
diff
changeset
|
4289 * DW pick the appropriate file extension. |
2f038ef90a36
Implemented dw_bitmapbutton_new_from_file() on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
278
diff
changeset
|
4290 * (BMP on OS/2 or Windows, XPM on Unix) |
2f038ef90a36
Implemented dw_bitmapbutton_new_from_file() on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
278
diff
changeset
|
4291 */ |
2f038ef90a36
Implemented dw_bitmapbutton_new_from_file() on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
278
diff
changeset
|
4292 HWND dw_bitmapbutton_new_from_file(char *text, unsigned long id, char *filename) |
2f038ef90a36
Implemented dw_bitmapbutton_new_from_file() on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
278
diff
changeset
|
4293 { |
2f038ef90a36
Implemented dw_bitmapbutton_new_from_file() on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
278
diff
changeset
|
4294 HWND tmp; |
2f038ef90a36
Implemented dw_bitmapbutton_new_from_file() on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
278
diff
changeset
|
4295 BubbleButton *bubble; |
303
464b5e46b313
Create the bitmap button even if the bitmap file does not exist.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
301
diff
changeset
|
4296 HBITMAP hbitmap = 0; |
281
2f038ef90a36
Implemented dw_bitmapbutton_new_from_file() on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
278
diff
changeset
|
4297 char *file = malloc(strlen(filename) + 5); |
2f038ef90a36
Implemented dw_bitmapbutton_new_from_file() on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
278
diff
changeset
|
4298 |
2f038ef90a36
Implemented dw_bitmapbutton_new_from_file() on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
278
diff
changeset
|
4299 if(!file || !(bubble = calloc(1, sizeof(BubbleButton)))) |
2f038ef90a36
Implemented dw_bitmapbutton_new_from_file() on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
278
diff
changeset
|
4300 { |
2f038ef90a36
Implemented dw_bitmapbutton_new_from_file() on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
278
diff
changeset
|
4301 if(file) |
2f038ef90a36
Implemented dw_bitmapbutton_new_from_file() on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
278
diff
changeset
|
4302 free(file); |
2f038ef90a36
Implemented dw_bitmapbutton_new_from_file() on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
278
diff
changeset
|
4303 return 0; |
2f038ef90a36
Implemented dw_bitmapbutton_new_from_file() on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
278
diff
changeset
|
4304 } |
2f038ef90a36
Implemented dw_bitmapbutton_new_from_file() on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
278
diff
changeset
|
4305 |
2f038ef90a36
Implemented dw_bitmapbutton_new_from_file() on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
278
diff
changeset
|
4306 tmp = CreateWindow(BUTTONCLASSNAME, |
2f038ef90a36
Implemented dw_bitmapbutton_new_from_file() on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
278
diff
changeset
|
4307 "", |
2f038ef90a36
Implemented dw_bitmapbutton_new_from_file() on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
278
diff
changeset
|
4308 WS_CHILD | BS_PUSHBUTTON | |
2f038ef90a36
Implemented dw_bitmapbutton_new_from_file() on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
278
diff
changeset
|
4309 BS_BITMAP | WS_CLIPCHILDREN | |
2f038ef90a36
Implemented dw_bitmapbutton_new_from_file() on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
278
diff
changeset
|
4310 WS_VISIBLE, |
2f038ef90a36
Implemented dw_bitmapbutton_new_from_file() on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
278
diff
changeset
|
4311 0,0,2000,1000, |
2f038ef90a36
Implemented dw_bitmapbutton_new_from_file() on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
278
diff
changeset
|
4312 DW_HWND_OBJECT, |
2f038ef90a36
Implemented dw_bitmapbutton_new_from_file() on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
278
diff
changeset
|
4313 (HMENU)id, |
2f038ef90a36
Implemented dw_bitmapbutton_new_from_file() on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
278
diff
changeset
|
4314 DWInstance, |
2f038ef90a36
Implemented dw_bitmapbutton_new_from_file() on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
278
diff
changeset
|
4315 NULL); |
2f038ef90a36
Implemented dw_bitmapbutton_new_from_file() on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
278
diff
changeset
|
4316 |
2f038ef90a36
Implemented dw_bitmapbutton_new_from_file() on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
278
diff
changeset
|
4317 bubble->id = id; |
2f038ef90a36
Implemented dw_bitmapbutton_new_from_file() on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
278
diff
changeset
|
4318 strncpy(bubble->bubbletext, text, BUBBLE_HELP_MAX - 1); |
2f038ef90a36
Implemented dw_bitmapbutton_new_from_file() on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
278
diff
changeset
|
4319 bubble->bubbletext[BUBBLE_HELP_MAX - 1] = '\0'; |
2f038ef90a36
Implemented dw_bitmapbutton_new_from_file() on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
278
diff
changeset
|
4320 bubble->pOldProc = (WNDPROC)SubclassWindow(tmp, _BtProc); |
2f038ef90a36
Implemented dw_bitmapbutton_new_from_file() on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
278
diff
changeset
|
4321 |
2f038ef90a36
Implemented dw_bitmapbutton_new_from_file() on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
278
diff
changeset
|
4322 SetWindowLong(tmp, GWL_USERDATA, (ULONG)bubble); |
2f038ef90a36
Implemented dw_bitmapbutton_new_from_file() on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
278
diff
changeset
|
4323 |
303
464b5e46b313
Create the bitmap button even if the bitmap file does not exist.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
301
diff
changeset
|
4324 strcpy(file, filename); |
464b5e46b313
Create the bitmap button even if the bitmap file does not exist.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
301
diff
changeset
|
4325 |
464b5e46b313
Create the bitmap button even if the bitmap file does not exist.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
301
diff
changeset
|
4326 /* check if we can read from this file (it exists and read permission) */ |
464b5e46b313
Create the bitmap button even if the bitmap file does not exist.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
301
diff
changeset
|
4327 if(access(file, 04) == 0) |
464b5e46b313
Create the bitmap button even if the bitmap file does not exist.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
301
diff
changeset
|
4328 hbitmap = (HBITMAP)LoadImage(NULL, file, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE); |
464b5e46b313
Create the bitmap button even if the bitmap file does not exist.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
301
diff
changeset
|
4329 else |
464b5e46b313
Create the bitmap button even if the bitmap file does not exist.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
301
diff
changeset
|
4330 { |
464b5e46b313
Create the bitmap button even if the bitmap file does not exist.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
301
diff
changeset
|
4331 /* Try with .bmp extention */ |
464b5e46b313
Create the bitmap button even if the bitmap file does not exist.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
301
diff
changeset
|
4332 strcat(file, ".bmp"); |
464b5e46b313
Create the bitmap button even if the bitmap file does not exist.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
301
diff
changeset
|
4333 if(access(file, 04) == 0) |
464b5e46b313
Create the bitmap button even if the bitmap file does not exist.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
301
diff
changeset
|
4334 hbitmap = (HBITMAP)LoadImage(NULL, file, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE); |
464b5e46b313
Create the bitmap button even if the bitmap file does not exist.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
301
diff
changeset
|
4335 } |
464b5e46b313
Create the bitmap button even if the bitmap file does not exist.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
301
diff
changeset
|
4336 |
464b5e46b313
Create the bitmap button even if the bitmap file does not exist.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
301
diff
changeset
|
4337 |
464b5e46b313
Create the bitmap button even if the bitmap file does not exist.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
301
diff
changeset
|
4338 if(hbitmap) |
464b5e46b313
Create the bitmap button even if the bitmap file does not exist.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
301
diff
changeset
|
4339 SendMessage(tmp, BM_SETIMAGE, |
464b5e46b313
Create the bitmap button even if the bitmap file does not exist.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
301
diff
changeset
|
4340 (WPARAM) IMAGE_BITMAP, |
464b5e46b313
Create the bitmap button even if the bitmap file does not exist.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
301
diff
changeset
|
4341 (LPARAM) hbitmap); |
281
2f038ef90a36
Implemented dw_bitmapbutton_new_from_file() on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
278
diff
changeset
|
4342 free(file); |
2f038ef90a36
Implemented dw_bitmapbutton_new_from_file() on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
278
diff
changeset
|
4343 return tmp; |
2f038ef90a36
Implemented dw_bitmapbutton_new_from_file() on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
278
diff
changeset
|
4344 } |
2f038ef90a36
Implemented dw_bitmapbutton_new_from_file() on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
278
diff
changeset
|
4345 |
2f038ef90a36
Implemented dw_bitmapbutton_new_from_file() on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
278
diff
changeset
|
4346 /* |
3 | 4347 * Create a new spinbutton window (widget) to be packed. |
4348 * Parameters: | |
4349 * 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:
277
diff
changeset
|
4350 * id: An ID to be used with dw_window_from_id() or 0L. |
3 | 4351 */ |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
4352 HWND API dw_spinbutton_new(char *text, ULONG id) |
3 | 4353 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4354 ULONG *data = malloc(sizeof(ULONG)); |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
4355 HWND buddy = CreateWindowEx(WS_EX_CLIENTEDGE, |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
4356 EDITCLASSNAME, |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
4357 text, |
107
cd0e5cf92f6a
Rewrote the Windows packing code so it is more like OS/2 to improve window
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
106
diff
changeset
|
4358 WS_CHILD | WS_BORDER | WS_VISIBLE | |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
4359 ES_NUMBER | WS_CLIPCHILDREN, |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
4360 0,0,2000,1000, |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
4361 DW_HWND_OBJECT, |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
4362 NULL, |
109
94d273843a41
Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
107
diff
changeset
|
4363 DWInstance, |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
4364 NULL); |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
4365 HWND tmp = CreateWindowEx(WS_EX_CLIENTEDGE, |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
4366 UPDOWN_CLASS, |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
4367 NULL, |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
4368 WS_CHILD | UDS_ALIGNRIGHT | WS_BORDER | |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
4369 UDS_ARROWKEYS | UDS_SETBUDDYINT | |
107
cd0e5cf92f6a
Rewrote the Windows packing code so it is more like OS/2 to improve window
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
106
diff
changeset
|
4370 UDS_WRAP | UDS_NOTHOUSANDS | WS_VISIBLE, |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4371 0,0,2000,1000, |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4372 DW_HWND_OBJECT, |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
4373 (HMENU)id, |
109
94d273843a41
Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
107
diff
changeset
|
4374 DWInstance, |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4375 NULL); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4376 ColorInfo *cinfo = calloc(1, sizeof(ColorInfo)); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4377 |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
4378 SendMessage(tmp, UDM_SETBUDDY, (WPARAM)buddy, 0); |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4379 cinfo->back = cinfo->fore = -1; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4380 cinfo->buddy = tmp; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4381 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4382 cinfo->pOldProc = SubclassWindow(buddy, _colorwndproc); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4383 SetWindowLong(buddy, GWL_USERDATA, (ULONG)cinfo); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4384 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4385 cinfo = calloc(1, sizeof(ColorInfo)); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4386 cinfo->buddy = buddy; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4387 cinfo->pOldProc = SubclassWindow(tmp, _spinnerwndproc); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4388 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4389 SetWindowLong(tmp, GWL_USERDATA, (ULONG)cinfo); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4390 dw_window_set_font(buddy, DefaultFont); |
3 | 4391 return tmp; |
4392 } | |
4393 | |
4394 /* | |
4395 * Create a new radiobutton 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:
277
diff
changeset
|
4398 * id: An ID to be used with dw_window_from_id() or 0L. |
3 | 4399 */ |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
4400 HWND API dw_radiobutton_new(char *text, ULONG id) |
3 | 4401 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4402 HWND tmp = CreateWindow(BUTTONCLASSNAME, |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4403 text, |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4404 WS_CHILD | BS_AUTORADIOBUTTON | |
107
cd0e5cf92f6a
Rewrote the Windows packing code so it is more like OS/2 to improve window
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
106
diff
changeset
|
4405 WS_CLIPCHILDREN | WS_VISIBLE, |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4406 0,0,2000,1000, |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4407 DW_HWND_OBJECT, |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4408 (HMENU)id, |
109
94d273843a41
Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
107
diff
changeset
|
4409 DWInstance, |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4410 NULL); |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
4411 BubbleButton *bubble = calloc(1, sizeof(BubbleButton)); |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
4412 bubble->id = id; |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
4413 bubble->pOldProc = (WNDPROC)SubclassWindow(tmp, _BtProc); |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
4414 bubble->cinfo.fore = -1; |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
4415 bubble->cinfo.back = -1; |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
4416 SetWindowLong(tmp, GWL_USERDATA, (ULONG)bubble); |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
4417 dw_window_set_font(tmp, DefaultFont); |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
4418 return tmp; |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
4419 } |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
4420 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
4421 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
4422 /* |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
4423 * 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:
61
diff
changeset
|
4424 * Parameters: |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
4425 * 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:
61
diff
changeset
|
4426 * 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:
277
diff
changeset
|
4427 * 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:
61
diff
changeset
|
4428 */ |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
4429 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:
61
diff
changeset
|
4430 { |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
4431 HWND tmp = CreateWindow(TRACKBAR_CLASS, |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
4432 "", |
107
cd0e5cf92f6a
Rewrote the Windows packing code so it is more like OS/2 to improve window
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
106
diff
changeset
|
4433 WS_CHILD | WS_CLIPCHILDREN | WS_VISIBLE | |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
4434 (vertical ? TBS_VERT : TBS_HORZ), |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
4435 0,0,2000,1000, |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
4436 DW_HWND_OBJECT, |
119
1cad81b7cc4c
Implemented initial splitbar code on Unix. And made some fixes for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
118
diff
changeset
|
4437 (HMENU)id, |
109
94d273843a41
Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
107
diff
changeset
|
4438 DWInstance, |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
4439 NULL); |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4440 ColorInfo *cinfo = calloc(1, sizeof(ColorInfo)); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4441 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4442 cinfo->back = cinfo->fore = -1; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4443 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4444 cinfo->pOldProc = SubclassWindow(tmp, _colorwndproc); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4445 SetWindowLong(tmp, GWL_USERDATA, (ULONG)cinfo); |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
4446 SendMessage(tmp, TBM_SETRANGE, (WPARAM)FALSE, (LPARAM)MAKELONG(0, increments-1)); |
3 | 4447 return tmp; |
4448 } | |
4449 | |
4450 /* | |
197
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
4451 * Create a new scrollbar window (widget) to be packed. |
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
4452 * Parameters: |
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
4453 * vertical: TRUE or FALSE if scrollbar is vertical. |
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
4454 * 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:
277
diff
changeset
|
4455 * id: An ID to be used with dw_window_from_id() or 0L. |
197
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
4456 */ |
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
4457 HWND API dw_scrollbar_new(int vertical, int increments, ULONG id) |
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
4458 { |
204
098ed34d41fb
The basics of the new scrollbar code on Windows, and dw_main_iteration().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
201
diff
changeset
|
4459 HWND tmp = CreateWindow(SCROLLBARCLASSNAME, |
197
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
4460 "", |
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
4461 WS_CHILD | WS_CLIPCHILDREN | WS_VISIBLE | |
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
4462 (vertical ? SBS_VERT : SBS_HORZ), |
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
4463 0,0,2000,1000, |
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
4464 DW_HWND_OBJECT, |
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
4465 (HMENU)id, |
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
4466 DWInstance, |
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
4467 NULL); |
204
098ed34d41fb
The basics of the new scrollbar code on Windows, and dw_main_iteration().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
201
diff
changeset
|
4468 ColorInfo *cinfo = calloc(1, sizeof(ColorInfo)); |
098ed34d41fb
The basics of the new scrollbar code on Windows, and dw_main_iteration().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
201
diff
changeset
|
4469 |
098ed34d41fb
The basics of the new scrollbar code on Windows, and dw_main_iteration().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
201
diff
changeset
|
4470 cinfo->back = cinfo->fore = -1; |
098ed34d41fb
The basics of the new scrollbar code on Windows, and dw_main_iteration().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
201
diff
changeset
|
4471 |
098ed34d41fb
The basics of the new scrollbar code on Windows, and dw_main_iteration().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
201
diff
changeset
|
4472 cinfo->pOldProc = SubclassWindow(tmp, _colorwndproc); |
098ed34d41fb
The basics of the new scrollbar code on Windows, and dw_main_iteration().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
201
diff
changeset
|
4473 SetWindowLong(tmp, GWL_USERDATA, (ULONG)cinfo); |
098ed34d41fb
The basics of the new scrollbar code on Windows, and dw_main_iteration().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
201
diff
changeset
|
4474 dw_window_set_data(tmp, "_dw_scrollbar", (void *)1); |
197
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
4475 return tmp; |
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
4476 } |
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
4477 |
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
4478 /* |
33
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
32
diff
changeset
|
4479 * Create a new percent bar window (widget) to be packed. |
3 | 4480 * Parameters: |
278
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
277
diff
changeset
|
4481 * id: An ID to be used with dw_window_from_id() or 0L. |
3 | 4482 */ |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
4483 HWND API dw_percent_new(ULONG id) |
3 | 4484 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4485 return CreateWindow(PROGRESS_CLASS, |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4486 "", |
107
cd0e5cf92f6a
Rewrote the Windows packing code so it is more like OS/2 to improve window
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
106
diff
changeset
|
4487 WS_VISIBLE | WS_CHILD | WS_CLIPCHILDREN, |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4488 0,0,2000,1000, |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4489 DW_HWND_OBJECT, |
119
1cad81b7cc4c
Implemented initial splitbar code on Unix. And made some fixes for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
118
diff
changeset
|
4490 (HMENU)id, |
109
94d273843a41
Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
107
diff
changeset
|
4491 DWInstance, |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4492 NULL); |
3 | 4493 } |
4494 | |
4495 /* | |
4496 * Create a new checkbox window (widget) to be packed. | |
4497 * Parameters: | |
4498 * 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:
277
diff
changeset
|
4499 * id: An ID to be used with dw_window_from_id() or 0L. |
3 | 4500 */ |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
4501 HWND API dw_checkbox_new(char *text, ULONG id) |
3 | 4502 { |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
59
diff
changeset
|
4503 BubbleButton *bubble = calloc(1, sizeof(BubbleButton)); |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4504 HWND tmp = CreateWindow(BUTTONCLASSNAME, |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4505 text, |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4506 WS_CHILD | BS_AUTOCHECKBOX | |
107
cd0e5cf92f6a
Rewrote the Windows packing code so it is more like OS/2 to improve window
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
106
diff
changeset
|
4507 BS_TEXT | WS_CLIPCHILDREN | WS_VISIBLE, |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4508 0,0,2000,1000, |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4509 DW_HWND_OBJECT, |
119
1cad81b7cc4c
Implemented initial splitbar code on Unix. And made some fixes for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
118
diff
changeset
|
4510 (HMENU)id, |
109
94d273843a41
Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
107
diff
changeset
|
4511 DWInstance, |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4512 NULL); |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
59
diff
changeset
|
4513 bubble->id = id; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
59
diff
changeset
|
4514 bubble->checkbox = 1; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
59
diff
changeset
|
4515 bubble->pOldProc = (WNDPROC)SubclassWindow(tmp, _BtProc); |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
59
diff
changeset
|
4516 bubble->cinfo.fore = -1; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
59
diff
changeset
|
4517 bubble->cinfo.back = -1; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
59
diff
changeset
|
4518 SetWindowLong(tmp, GWL_USERDATA, (ULONG)bubble); |
3 | 4519 dw_window_set_font(tmp, DefaultFont); |
4520 return tmp; | |
4521 } | |
4522 | |
4523 /* | |
4524 * Create a new listbox window (widget) to be packed. | |
4525 * Parameters: | |
278
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
277
diff
changeset
|
4526 * id: An ID to be used with dw_window_from_id() or 0L. |
3 | 4527 * multi: Multiple select TRUE or FALSE. |
4528 */ | |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
4529 HWND API dw_listbox_new(ULONG id, int multi) |
3 | 4530 { |
155
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
4531 HWND tmp = CreateWindowEx(WS_EX_CLIENTEDGE, |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
4532 LISTBOXCLASSNAME, |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
4533 "", |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
4534 WS_VISIBLE | LBS_NOINTEGRALHEIGHT | |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
4535 WS_CHILD | LBS_HASSTRINGS | |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
4536 LBS_NOTIFY | WS_BORDER | WS_CLIPCHILDREN | |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
4537 WS_VSCROLL | (multi ? LBS_MULTIPLESEL : 0) , |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
4538 0,0,2000,1000, |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
4539 DW_HWND_OBJECT, |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
4540 (HMENU)id, |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
4541 DWInstance, |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
4542 NULL); |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4543 ContainerInfo *cinfo = (ContainerInfo *)calloc(1, sizeof(ContainerInfo)); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4544 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4545 if(!cinfo) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4546 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4547 DestroyWindow(tmp); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4548 return NULL; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4549 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4550 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4551 cinfo->cinfo.fore = -1; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4552 cinfo->cinfo.back = -1; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4553 cinfo->pOldProc = (WNDPROC)SubclassWindow(tmp, _containerwndproc); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4554 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4555 SetWindowLong(tmp, GWL_USERDATA, (ULONG)cinfo); |
3 | 4556 dw_window_set_font(tmp, DefaultFont); |
4557 return tmp; | |
4558 } | |
4559 | |
4560 /* | |
4561 * Sets the icon used for a given window. | |
4562 * Parameters: | |
4563 * handle: Handle to the window. | |
4564 * id: An ID to be used to specify the icon. | |
4565 */ | |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
4566 void API dw_window_set_icon(HWND handle, ULONG id) |
3 | 4567 { |
336
a2f72b5d5d0a
Minor change to dw_window_set_icon() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
334
diff
changeset
|
4568 HICON hicon = id < 65536 ? LoadIcon(DWInstance, MAKEINTRESOURCE(id)) : (HICON)id; |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4569 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4570 SendMessage(handle, WM_SETICON, |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4571 (WPARAM) IMAGE_ICON, |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4572 (LPARAM) hicon); |
3 | 4573 } |
4574 | |
4575 /* | |
4576 * Sets the bitmap used for a given static window. | |
4577 * Parameters: | |
4578 * 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:
277
diff
changeset
|
4579 * 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:
277
diff
changeset
|
4580 * (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:
277
diff
changeset
|
4581 * 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:
277
diff
changeset
|
4582 * 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:
277
diff
changeset
|
4583 * 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:
277
diff
changeset
|
4584 */ |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
277
diff
changeset
|
4585 void API dw_window_set_bitmap(HWND handle, 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:
277
diff
changeset
|
4586 { |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
277
diff
changeset
|
4587 HBITMAP hbitmap; |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
4588 HBITMAP oldbitmap = (HBITMAP)SendMessage(handle, STM_GETIMAGE, IMAGE_BITMAP, 0); |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4589 |
278
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
277
diff
changeset
|
4590 if(id) |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
277
diff
changeset
|
4591 hbitmap = LoadBitmap(DWInstance, MAKEINTRESOURCE(id)); |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
277
diff
changeset
|
4592 else if(filename) |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
277
diff
changeset
|
4593 { |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
277
diff
changeset
|
4594 char *file = malloc(strlen(filename) + 5); |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
277
diff
changeset
|
4595 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
277
diff
changeset
|
4596 if (!file) |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
277
diff
changeset
|
4597 return; |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
277
diff
changeset
|
4598 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
277
diff
changeset
|
4599 strcpy(file, filename); |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
277
diff
changeset
|
4600 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
277
diff
changeset
|
4601 /* 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:
277
diff
changeset
|
4602 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:
277
diff
changeset
|
4603 { |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
277
diff
changeset
|
4604 /* Try with .bmp extention */ |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
277
diff
changeset
|
4605 strcat(file, ".bmp"); |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
277
diff
changeset
|
4606 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:
277
diff
changeset
|
4607 { |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
277
diff
changeset
|
4608 free(file); |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
277
diff
changeset
|
4609 return; |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
277
diff
changeset
|
4610 } |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
277
diff
changeset
|
4611 } |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
277
diff
changeset
|
4612 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
277
diff
changeset
|
4613 hbitmap = (HBITMAP)LoadImage(NULL, file, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE); |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
277
diff
changeset
|
4614 free(file); |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
277
diff
changeset
|
4615 } |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
277
diff
changeset
|
4616 else |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
277
diff
changeset
|
4617 return; |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
277
diff
changeset
|
4618 |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4619 SendMessage(handle, STM_SETIMAGE, |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4620 (WPARAM) IMAGE_BITMAP, |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4621 (LPARAM) hbitmap); |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
4622 |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
4623 if(oldbitmap) |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
4624 DeleteObject(oldbitmap); |
3 | 4625 } |
4626 | |
4627 /* | |
4628 * Sets the text used for a given window. | |
4629 * Parameters: | |
4630 * handle: Handle to the window. | |
4631 * text: The text associsated with a given window. | |
4632 */ | |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
4633 void API dw_window_set_text(HWND handle, char *text) |
3 | 4634 { |
75
c629838d9805
Updated to latest DW, and updated the Makefile to install the header files
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
73
diff
changeset
|
4635 char tmpbuf[100]; |
c629838d9805
Updated to latest DW, and updated the Makefile to install the header files
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
73
diff
changeset
|
4636 |
c629838d9805
Updated to latest DW, and updated the Makefile to install the header files
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
73
diff
changeset
|
4637 GetClassName(handle, tmpbuf, 99); |
c629838d9805
Updated to latest DW, and updated the Makefile to install the header files
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
73
diff
changeset
|
4638 |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4639 SetWindowText(handle, text); |
75
c629838d9805
Updated to latest DW, and updated the Makefile to install the header files
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
73
diff
changeset
|
4640 |
c629838d9805
Updated to latest DW, and updated the Makefile to install the header files
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
73
diff
changeset
|
4641 /* Combobox */ |
c629838d9805
Updated to latest DW, and updated the Makefile to install the header files
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
73
diff
changeset
|
4642 if(strnicmp(tmpbuf, COMBOBOXCLASSNAME, strlen(COMBOBOXCLASSNAME)+1)==0) |
c629838d9805
Updated to latest DW, and updated the Makefile to install the header files
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
73
diff
changeset
|
4643 SendMessage(handle, CB_SETEDITSEL, 0, MAKELPARAM(-1, 0)); |
3 | 4644 } |
4645 | |
4646 /* | |
4647 * Gets the text used for a given window. | |
4648 * Parameters: | |
4649 * handle: Handle to the window. | |
4650 * Returns: | |
4651 * text: The text associsated with a given window. | |
4652 */ | |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
4653 char * API dw_window_get_text(HWND handle) |
3 | 4654 { |
173
c2b5d0019ec3
Updated dw_window_get_text() on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
168
diff
changeset
|
4655 int len = GetWindowTextLength(handle); |
c2b5d0019ec3
Updated dw_window_get_text() on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
168
diff
changeset
|
4656 char *tempbuf = calloc(1, len + 2); |
c2b5d0019ec3
Updated dw_window_get_text() on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
168
diff
changeset
|
4657 |
c2b5d0019ec3
Updated dw_window_get_text() on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
168
diff
changeset
|
4658 GetWindowText(handle, tempbuf, len + 1); |
c2b5d0019ec3
Updated dw_window_get_text() on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
168
diff
changeset
|
4659 |
c2b5d0019ec3
Updated dw_window_get_text() on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
168
diff
changeset
|
4660 return tempbuf; |
3 | 4661 } |
4662 | |
4663 /* | |
4664 * Disables given window (widget). | |
4665 * Parameters: | |
4666 * handle: Handle to the window. | |
4667 */ | |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
4668 void API dw_window_disable(HWND handle) |
3 | 4669 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4670 EnableWindow(handle, FALSE); |
3 | 4671 } |
4672 | |
4673 /* | |
4674 * Enables given window (widget). | |
4675 * Parameters: | |
4676 * handle: Handle to the window. | |
4677 */ | |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
4678 void API dw_window_enable(HWND handle) |
3 | 4679 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4680 EnableWindow(handle, TRUE); |
3 | 4681 } |
4682 | |
247
c097ffe6cfeb
Implemented dw_window_from_id() on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
243
diff
changeset
|
4683 static HWND _dw_wfid_hwnd = NULL; |
c097ffe6cfeb
Implemented dw_window_from_id() on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
243
diff
changeset
|
4684 |
c097ffe6cfeb
Implemented dw_window_from_id() on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
243
diff
changeset
|
4685 BOOL CALLBACK _wfid(HWND handle, LPARAM lParam) |
c097ffe6cfeb
Implemented dw_window_from_id() on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
243
diff
changeset
|
4686 { |
c097ffe6cfeb
Implemented dw_window_from_id() on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
243
diff
changeset
|
4687 if(GetWindowLong(handle, GWL_ID) == lParam) |
c097ffe6cfeb
Implemented dw_window_from_id() on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
243
diff
changeset
|
4688 { |
c097ffe6cfeb
Implemented dw_window_from_id() on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
243
diff
changeset
|
4689 _dw_wfid_hwnd = handle; |
c097ffe6cfeb
Implemented dw_window_from_id() on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
243
diff
changeset
|
4690 return FALSE; |
c097ffe6cfeb
Implemented dw_window_from_id() on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
243
diff
changeset
|
4691 } |
c097ffe6cfeb
Implemented dw_window_from_id() on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
243
diff
changeset
|
4692 return TRUE; |
c097ffe6cfeb
Implemented dw_window_from_id() on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
243
diff
changeset
|
4693 } |
c097ffe6cfeb
Implemented dw_window_from_id() on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
243
diff
changeset
|
4694 |
3 | 4695 /* |
4696 * Gets the child window handle with specified ID. | |
4697 * Parameters: | |
4698 * handle: Handle to the parent window. | |
4699 * id: Integer ID of the child. | |
4700 */ | |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
4701 HWND API dw_window_from_id(HWND handle, int id) |
3 | 4702 { |
247
c097ffe6cfeb
Implemented dw_window_from_id() on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
243
diff
changeset
|
4703 _dw_wfid_hwnd = NULL; |
c097ffe6cfeb
Implemented dw_window_from_id() on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
243
diff
changeset
|
4704 EnumChildWindows(handle, _wfid, (LPARAM)id); |
c097ffe6cfeb
Implemented dw_window_from_id() on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
243
diff
changeset
|
4705 return _dw_wfid_hwnd; |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4706 } |
248 | 4707 |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4708 /* |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4709 * Pack windows (widgets) into a box from the start (or top). |
3 | 4710 * Parameters: |
4711 * box: Window handle of the box to be packed into. | |
4712 * item: Window handle of the item to be back. | |
4713 * width: Width in pixels of the item or -1 to be self determined. | |
4714 * height: Height in pixels of the item or -1 to be self determined. | |
4715 * hsize: TRUE if the window (widget) should expand horizontally to fill space given. | |
4716 * vsize: TRUE if the window (widget) should expand vertically to fill space given. | |
4717 * pad: Number of pixels of padding around the item. | |
4718 */ | |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
4719 void API dw_box_pack_start(HWND box, HWND item, int width, int height, int hsize, int vsize, int pad) |
3 | 4720 { |
4721 Box *thisbox; | |
4722 | |
429
f977c80a1dfa
Check for inconsistent parameters in dw_box_pack_start() and
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
425
diff
changeset
|
4723 if ( width == 0 && hsize == FALSE ) |
f977c80a1dfa
Check for inconsistent parameters in dw_box_pack_start() and
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
425
diff
changeset
|
4724 dw_messagebox("dw_box_pack_start()", DW_MB_OK|DW_MB_ERROR, "Width and expand Horizonal both unset for box: %x item: %x",box,item); |
f977c80a1dfa
Check for inconsistent parameters in dw_box_pack_start() and
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
425
diff
changeset
|
4725 if ( height == 0 && vsize == FALSE ) |
f977c80a1dfa
Check for inconsistent parameters in dw_box_pack_start() and
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
425
diff
changeset
|
4726 dw_messagebox("dw_box_pack_start()", DW_MB_OK|DW_MB_ERROR, "Height and expand Vertical both unset for box: %x item: %x",box,item); |
f977c80a1dfa
Check for inconsistent parameters in dw_box_pack_start() and
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
425
diff
changeset
|
4727 |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4728 thisbox = (Box *)GetWindowLong(box, GWL_USERDATA); |
3 | 4729 if(thisbox) |
4730 { | |
4731 int z; | |
4732 Item *tmpitem, *thisitem = thisbox->items; | |
4733 char tmpbuf[100]; | |
4734 | |
14
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
4735 tmpitem = malloc(sizeof(Item)*(thisbox->count+1)); |
3 | 4736 |
4737 for(z=0;z<thisbox->count;z++) | |
4738 { | |
4739 tmpitem[z] = thisitem[z]; | |
4740 } | |
4741 | |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4742 GetClassName(item, tmpbuf, 99); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4743 |
298
caed245ea8a1
Sanity check, if expand is set width/height can't be zero... force it to 1.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
295
diff
changeset
|
4744 if(vsize && !height) |
caed245ea8a1
Sanity check, if expand is set width/height can't be zero... force it to 1.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
295
diff
changeset
|
4745 height = 1; |
caed245ea8a1
Sanity check, if expand is set width/height can't be zero... force it to 1.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
295
diff
changeset
|
4746 if(hsize && !width) |
caed245ea8a1
Sanity check, if expand is set width/height can't be zero... force it to 1.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
295
diff
changeset
|
4747 width = 1; |
caed245ea8a1
Sanity check, if expand is set width/height can't be zero... force it to 1.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
295
diff
changeset
|
4748 |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4749 if(strnicmp(tmpbuf, FRAMECLASSNAME, 2)==0) |
3 | 4750 tmpitem[thisbox->count].type = TYPEBOX; |
4751 else | |
4752 tmpitem[thisbox->count].type = TYPEITEM; | |
4753 | |
4754 tmpitem[thisbox->count].hwnd = item; | |
4755 tmpitem[thisbox->count].origwidth = tmpitem[thisbox->count].width = width; | |
4756 tmpitem[thisbox->count].origheight = tmpitem[thisbox->count].height = height; | |
4757 tmpitem[thisbox->count].pad = pad; | |
4758 if(hsize) | |
4759 tmpitem[thisbox->count].hsize = SIZEEXPAND; | |
4760 else | |
4761 tmpitem[thisbox->count].hsize = SIZESTATIC; | |
4762 | |
4763 if(vsize) | |
4764 tmpitem[thisbox->count].vsize = SIZEEXPAND; | |
4765 else | |
4766 tmpitem[thisbox->count].vsize = SIZESTATIC; | |
4767 | |
4768 thisbox->items = tmpitem; | |
4769 | |
4770 if(thisbox->count) | |
4771 free(thisitem); | |
4772 | |
4773 thisbox->count++; | |
4774 | |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4775 SetParent(item, box); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4776 if(strncmp(tmpbuf, UPDOWN_CLASS, strlen(UPDOWN_CLASS))==0) |
3 | 4777 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4778 ColorInfo *cinfo = (ColorInfo *)GetWindowLong(item, GWL_USERDATA); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4779 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4780 if(cinfo) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4781 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4782 SetParent(cinfo->buddy, box); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4783 ShowWindow(cinfo->buddy, SW_SHOW); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4784 SendMessage(item, UDM_SETBUDDY, (WPARAM)cinfo->buddy, 0); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4785 } |
3 | 4786 } |
4787 } | |
4788 } | |
4789 | |
4790 /* | |
4791 * Sets the size of a given window (widget). | |
4792 * Parameters: | |
4793 * handle: Window (widget) handle. | |
4794 * width: New width in pixels. | |
4795 * height: New height in pixels. | |
4796 */ | |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
4797 void API dw_window_set_usize(HWND handle, ULONG width, ULONG height) |
3 | 4798 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4799 SetWindowPos(handle, (HWND)NULL, 0, 0, width, height, SWP_SHOWWINDOW | SWP_NOZORDER | SWP_NOMOVE); |
3 | 4800 } |
4801 | |
4802 /* | |
4803 * Returns the width of the screen. | |
4804 */ | |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
4805 int API dw_screen_width(void) |
3 | 4806 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4807 return GetSystemMetrics(SM_CXSCREEN); |
3 | 4808 } |
4809 | |
4810 /* | |
4811 * Returns the height of the screen. | |
4812 */ | |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
4813 int API dw_screen_height(void) |
3 | 4814 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4815 return GetSystemMetrics(SM_CYSCREEN); |
3 | 4816 } |
4817 | |
4818 /* This should return the current color depth */ | |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
4819 unsigned long API dw_color_depth(void) |
3 | 4820 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4821 int bpp; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4822 HDC hdc = GetDC(HWND_DESKTOP); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4823 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4824 bpp = GetDeviceCaps(hdc, BITSPIXEL); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4825 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4826 ReleaseDC(HWND_DESKTOP, hdc); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4827 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4828 return bpp; |
3 | 4829 } |
4830 | |
4831 | |
4832 /* | |
4833 * Sets the position of a given window (widget). | |
4834 * Parameters: | |
4835 * handle: Window (widget) handle. | |
4836 * x: X location from the bottom left. | |
4837 * y: Y location from the bottom left. | |
4838 */ | |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
4839 void API dw_window_set_pos(HWND handle, ULONG x, ULONG y) |
3 | 4840 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4841 SetWindowPos(handle, (HWND)NULL, x, y, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE); |
3 | 4842 } |
4843 | |
4844 /* | |
4845 * Sets the position and size of a given window (widget). | |
4846 * Parameters: | |
4847 * handle: Window (widget) handle. | |
4848 * x: X location from the bottom left. | |
4849 * y: Y location from the bottom left. | |
4850 * width: Width of the widget. | |
4851 * height: Height of the widget. | |
4852 */ | |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
4853 void API dw_window_set_pos_size(HWND handle, ULONG x, ULONG y, ULONG width, ULONG height) |
3 | 4854 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4855 SetWindowPos(handle, (HWND)NULL, x, y, width, height, SWP_NOZORDER | SWP_SHOWWINDOW | SWP_NOACTIVATE); |
3 | 4856 } |
4857 | |
4858 /* | |
4859 * Gets the position and size of a given window (widget). | |
4860 * Parameters: | |
4861 * handle: Window (widget) handle. | |
4862 * x: X location from the bottom left. | |
4863 * y: Y location from the bottom left. | |
4864 * width: Width of the widget. | |
4865 * height: Height of the widget. | |
4866 */ | |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
4867 void API dw_window_get_pos_size(HWND handle, ULONG *x, ULONG *y, ULONG *width, ULONG *height) |
3 | 4868 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4869 WINDOWPLACEMENT wp; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4870 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4871 wp.length = sizeof(WINDOWPLACEMENT); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4872 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4873 GetWindowPlacement(handle, &wp); |
3 | 4874 if(x) |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4875 *x = wp.rcNormalPosition.left; |
3 | 4876 if(y) |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4877 *y = wp.rcNormalPosition.top; |
3 | 4878 if(width) |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4879 *width = wp.rcNormalPosition.right - wp.rcNormalPosition.left; |
3 | 4880 if(height) |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4881 *height = wp.rcNormalPosition.bottom - wp.rcNormalPosition.top; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4882 |
3 | 4883 } |
4884 | |
4885 /* | |
4886 * Sets the style of a given window (widget). | |
4887 * Parameters: | |
4888 * handle: Window (widget) handle. | |
4889 * width: New width in pixels. | |
4890 * height: New height in pixels. | |
4891 */ | |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
4892 void API dw_window_set_style(HWND handle, ULONG style, ULONG mask) |
3 | 4893 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4894 ULONG tmp, currentstyle = GetWindowLong(handle, GWL_STYLE); |
88
58d8139fe0a2
Added vertical center logic for static text controls on windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
87
diff
changeset
|
4895 ColorInfo *cinfo = (ColorInfo *)GetWindowLong(handle, GWL_USERDATA); |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4896 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4897 tmp = currentstyle | mask; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4898 tmp ^= mask; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4899 tmp |= style; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4900 |
88
58d8139fe0a2
Added vertical center logic for static text controls on windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
87
diff
changeset
|
4901 |
58d8139fe0a2
Added vertical center logic for static text controls on windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
87
diff
changeset
|
4902 /* We are using SS_NOPREFIX as a VCENTER flag */ |
58d8139fe0a2
Added vertical center logic for static text controls on windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
87
diff
changeset
|
4903 if(tmp & SS_NOPREFIX) |
58d8139fe0a2
Added vertical center logic for static text controls on windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
87
diff
changeset
|
4904 { |
58d8139fe0a2
Added vertical center logic for static text controls on windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
87
diff
changeset
|
4905 |
58d8139fe0a2
Added vertical center logic for static text controls on windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
87
diff
changeset
|
4906 if(cinfo) |
58d8139fe0a2
Added vertical center logic for static text controls on windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
87
diff
changeset
|
4907 cinfo->vcenter = 1; |
58d8139fe0a2
Added vertical center logic for static text controls on windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
87
diff
changeset
|
4908 else |
58d8139fe0a2
Added vertical center logic for static text controls on windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
87
diff
changeset
|
4909 { |
58d8139fe0a2
Added vertical center logic for static text controls on windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
87
diff
changeset
|
4910 cinfo = calloc(1, sizeof(ColorInfo)); |
58d8139fe0a2
Added vertical center logic for static text controls on windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
87
diff
changeset
|
4911 cinfo->fore = cinfo->back = -1; |
58d8139fe0a2
Added vertical center logic for static text controls on windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
87
diff
changeset
|
4912 cinfo->vcenter = 1; |
58d8139fe0a2
Added vertical center logic for static text controls on windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
87
diff
changeset
|
4913 |
58d8139fe0a2
Added vertical center logic for static text controls on windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
87
diff
changeset
|
4914 cinfo->pOldProc = SubclassWindow(handle, _colorwndproc); |
58d8139fe0a2
Added vertical center logic for static text controls on windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
87
diff
changeset
|
4915 SetWindowLong(handle, GWL_USERDATA, (ULONG)cinfo); |
58d8139fe0a2
Added vertical center logic for static text controls on windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
87
diff
changeset
|
4916 } |
58d8139fe0a2
Added vertical center logic for static text controls on windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
87
diff
changeset
|
4917 } |
58d8139fe0a2
Added vertical center logic for static text controls on windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
87
diff
changeset
|
4918 else if(cinfo) |
58d8139fe0a2
Added vertical center logic for static text controls on windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
87
diff
changeset
|
4919 cinfo->vcenter = 0; |
58d8139fe0a2
Added vertical center logic for static text controls on windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
87
diff
changeset
|
4920 |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4921 SetWindowLong(handle, GWL_STYLE, tmp); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4922 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4923 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4924 /* Finds the physical ID from the reference ID */ |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4925 int _findnotebookid(NotebookPage **array, int pageid) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4926 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4927 int z; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4928 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4929 for(z=0;z<256;z++) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4930 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4931 if(array[z] && array[z]->realid == pageid) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4932 return z; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4933 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4934 return -1; |
3 | 4935 } |
4936 | |
4937 /* | |
4938 * Adds a new page to specified notebook. | |
4939 * Parameters: | |
4940 * handle: Window (widget) handle. | |
4941 * flags: Any additional page creation flags. | |
4942 * front: If TRUE page is added at the beginning. | |
4943 */ | |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
4944 unsigned long API dw_notebook_page_new(HWND handle, ULONG flags, int front) |
3 | 4945 { |
191
634625c3239d
Fixes for dw_color_xxxx_set() to accept OS/2 style colors, and fixed a
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
185
diff
changeset
|
4946 NotebookPage **array = (NotebookPage **)dw_window_get_data(handle, "_dw_array"); |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4947 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4948 if(array) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4949 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4950 int z, refid = -1; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4951 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4952 for(z=0;z<256;z++) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4953 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4954 if(_findnotebookid(array, z) == -1) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4955 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4956 refid = z; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4957 break; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4958 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4959 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4960 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4961 if(refid == -1) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4962 return -1; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4963 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4964 for(z=0;z<256;z++) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4965 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4966 if(!array[z]) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4967 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4968 int oldpage = TabCtrl_GetCurSel(handle); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4969 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4970 array[z] = calloc(1, sizeof(NotebookPage)); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4971 array[z]->realid = refid; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4972 array[z]->item.mask = TCIF_TEXT; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4973 array[z]->item.iImage = -1; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4974 array[z]->item.pszText = ""; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4975 TabCtrl_InsertItem(handle, z, &(array[z]->item)); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4976 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4977 if(oldpage > -1 && array[oldpage]) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4978 SetParent(array[oldpage]->hwnd, DW_HWND_OBJECT); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4979 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4980 TabCtrl_SetCurSel(handle, z); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4981 return refid; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4982 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4983 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4984 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4985 return -1; |
3 | 4986 } |
4987 | |
4988 /* | |
4989 * Sets the text on the specified notebook tab. | |
4990 * Parameters: | |
4991 * handle: Notebook handle. | |
4992 * pageid: Page ID of the tab to set. | |
4993 * text: Pointer to the text to set. | |
4994 */ | |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
4995 void API dw_notebook_page_set_text(HWND handle, ULONG pageidx, char *text) |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4996 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4997 |
191
634625c3239d
Fixes for dw_color_xxxx_set() to accept OS/2 style colors, and fixed a
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
185
diff
changeset
|
4998 NotebookPage **array = (NotebookPage **)dw_window_get_data(handle, "_dw_array"); |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
4999 int pageid; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5000 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5001 if(!array) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5002 return; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5003 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5004 pageid = _findnotebookid(array, pageidx); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5005 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5006 if(pageid > -1 && array[pageid]) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5007 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5008 array[pageid]->item.mask = TCIF_TEXT; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5009 array[pageid]->item.pszText = text; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5010 TabCtrl_SetItem(handle, pageid, &(array[pageid]->item)); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5011 _resize_notebook_page(handle, pageid); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5012 } |
3 | 5013 } |
5014 | |
5015 /* | |
5016 * Sets the text on the specified notebook tab status area. | |
5017 * Parameters: | |
5018 * handle: Notebook handle. | |
5019 * pageid: Page ID of the tab to set. | |
5020 * text: Pointer to the text to set. | |
5021 */ | |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
5022 void API dw_notebook_page_set_status_text(HWND handle, ULONG pageid, char *text) |
3 | 5023 { |
5024 } | |
5025 | |
5026 /* | |
5027 * Packs the specified box into the notebook page. | |
5028 * Parameters: | |
5029 * handle: Handle to the notebook to be packed. | |
5030 * pageid: Page ID in the notebook which is being packed. | |
5031 * page: Box handle to be packed. | |
5032 */ | |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
5033 void API dw_notebook_pack(HWND handle, ULONG pageidx, HWND page) |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5034 { |
191
634625c3239d
Fixes for dw_color_xxxx_set() to accept OS/2 style colors, and fixed a
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
185
diff
changeset
|
5035 NotebookPage **array = (NotebookPage **)dw_window_get_data(handle, "_dw_array"); |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5036 int pageid; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5037 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5038 if(!array) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5039 return; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5040 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5041 pageid = _findnotebookid(array, pageidx); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5042 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5043 if(pageid > -1 && array[pageid]) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5044 { |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
281
diff
changeset
|
5045 HWND tmpbox = dw_box_new(DW_VERT, 0); |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5046 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5047 dw_box_pack_start(tmpbox, page, 0, 0, TRUE, TRUE, 0); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5048 SubclassWindow(tmpbox, _wndproc); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5049 if(array[pageid]->hwnd) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5050 dw_window_destroy(array[pageid]->hwnd); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5051 array[pageid]->hwnd = tmpbox; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5052 if(pageidx == dw_notebook_page_query(handle)) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5053 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5054 SetParent(tmpbox, handle); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5055 _resize_notebook_page(handle, pageid); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5056 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5057 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5058 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5059 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5060 /* |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5061 * Remove a page from a notebook. |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5062 * Parameters: |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5063 * handle: Handle to the notebook widget. |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5064 * pageid: ID of the page to be destroyed. |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5065 */ |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
5066 void API dw_notebook_page_destroy(HWND handle, unsigned int pageidx) |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5067 { |
191
634625c3239d
Fixes for dw_color_xxxx_set() to accept OS/2 style colors, and fixed a
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
185
diff
changeset
|
5068 NotebookPage **array = (NotebookPage **)dw_window_get_data(handle, "_dw_array"); |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5069 int newid = -1, z, pageid; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5070 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5071 if(!array) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5072 return; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5073 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5074 pageid = _findnotebookid(array, pageidx); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5075 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5076 if(pageid < 0) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5077 return; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5078 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5079 if(array[pageid]) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5080 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5081 SetParent(array[pageid]->hwnd, DW_HWND_OBJECT); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5082 free(array[pageid]); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5083 array[pageid] = NULL; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5084 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5085 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5086 TabCtrl_DeleteItem(handle, pageid); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5087 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5088 /* Shift the pages over 1 */ |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5089 for(z=pageid;z<255;z++) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5090 array[z] = array[z+1]; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5091 array[255] = NULL; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5092 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5093 for(z=0;z<256;z++) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5094 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5095 if(array[z]) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5096 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5097 newid = z; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5098 break; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5099 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5100 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5101 if(newid > -1) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5102 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5103 SetParent(array[newid]->hwnd, handle); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5104 _resize_notebook_page(handle, newid); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5105 dw_notebook_page_set(handle, array[newid]->realid); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5106 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5107 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5108 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5109 /* |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5110 * Queries the currently visible page ID. |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5111 * Parameters: |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5112 * handle: Handle to the notebook widget. |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5113 */ |
346
81fae15885d7
Implemented switch-page on OS/2, and changed the signal prototype to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
344
diff
changeset
|
5114 unsigned long API dw_notebook_page_query(HWND handle) |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5115 { |
191
634625c3239d
Fixes for dw_color_xxxx_set() to accept OS/2 style colors, and fixed a
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
185
diff
changeset
|
5116 NotebookPage **array = (NotebookPage **)dw_window_get_data(handle, "_dw_array"); |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5117 int physid = TabCtrl_GetCurSel(handle); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5118 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5119 if(physid > -1 && physid < 256 && array && array[physid]) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5120 return array[physid]->realid; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5121 return -1; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5122 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5123 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5124 /* |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5125 * Sets the currently visible page ID. |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5126 * Parameters: |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5127 * handle: Handle to the notebook widget. |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5128 * pageid: ID of the page to be made visible. |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5129 */ |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
5130 void API dw_notebook_page_set(HWND handle, unsigned int pageidx) |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5131 { |
191
634625c3239d
Fixes for dw_color_xxxx_set() to accept OS/2 style colors, and fixed a
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
185
diff
changeset
|
5132 NotebookPage **array = (NotebookPage **)dw_window_get_data(handle, "_dw_array"); |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5133 int pageid; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5134 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5135 if(!array) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5136 return; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5137 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5138 pageid = _findnotebookid(array, pageidx); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5139 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5140 if(pageid > -1 && pageid < 256) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5141 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5142 int oldpage = TabCtrl_GetCurSel(handle); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5143 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5144 if(oldpage > -1 && array && array[oldpage]) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5145 SetParent(array[oldpage]->hwnd, DW_HWND_OBJECT); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5146 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5147 TabCtrl_SetCurSel(handle, pageid); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5148 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5149 SetParent(array[pageid]->hwnd, handle); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5150 _resize_notebook_page(handle, pageid); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5151 } |
3 | 5152 } |
5153 | |
5154 /* | |
5155 * Appends the specified text to the listbox's (or combobox) entry list. | |
5156 * Parameters: | |
5157 * handle: Handle to the listbox to be appended to. | |
5158 * text: Text to append into listbox. | |
5159 */ | |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
5160 void API dw_listbox_append(HWND handle, char *text) |
3 | 5161 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5162 char tmpbuf[100]; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5163 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5164 GetClassName(handle, tmpbuf, 99); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5165 |
371
e856f80e0520
Check for comboboxes in listbox functions, and handle missing events,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
370
diff
changeset
|
5166 if(strnicmp(tmpbuf, COMBOBOXCLASSNAME, strlen(COMBOBOXCLASSNAME)+1)==0) |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5167 SendMessage(handle, |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5168 CB_ADDSTRING, |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5169 0, (LPARAM)text); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5170 else |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5171 SendMessage(handle, |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5172 LB_ADDSTRING, |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5173 0, (LPARAM)text); |
3 | 5174 } |
5175 | |
5176 /* | |
5177 * Clears the listbox's (or combobox) list of all entries. | |
5178 * Parameters: | |
5179 * handle: Handle to the listbox to be cleared. | |
5180 */ | |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
5181 void API dw_listbox_clear(HWND handle) |
3 | 5182 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5183 char tmpbuf[100]; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5184 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5185 GetClassName(handle, tmpbuf, 99); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5186 |
371
e856f80e0520
Check for comboboxes in listbox functions, and handle missing events,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
370
diff
changeset
|
5187 if(strnicmp(tmpbuf, COMBOBOXCLASSNAME, strlen(COMBOBOXCLASSNAME)+1)==0) |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5188 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5189 char *buf = dw_window_get_text(handle); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5190 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5191 SendMessage(handle, |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5192 CB_RESETCONTENT, 0L, 0L); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5193 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5194 if(buf) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5195 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5196 dw_window_set_text(handle, buf); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5197 free(buf); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5198 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5199 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5200 else |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5201 SendMessage(handle, |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5202 LB_RESETCONTENT, 0L, 0L); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5203 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5204 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5205 /* |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5206 * Sets the text of a given listbox entry. |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5207 * Parameters: |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5208 * handle: Handle to the listbox to be queried. |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5209 * index: Index into the list to be queried. |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5210 * buffer: Buffer where text will be copied. |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5211 */ |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
5212 void API dw_listbox_set_text(HWND handle, unsigned int index, char *buffer) |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5213 { |
371
e856f80e0520
Check for comboboxes in listbox functions, and handle missing events,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
370
diff
changeset
|
5214 char tmpbuf[100]; |
e856f80e0520
Check for comboboxes in listbox functions, and handle missing events,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
370
diff
changeset
|
5215 |
e856f80e0520
Check for comboboxes in listbox functions, and handle missing events,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
370
diff
changeset
|
5216 GetClassName(handle, tmpbuf, 99); |
e856f80e0520
Check for comboboxes in listbox functions, and handle missing events,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
370
diff
changeset
|
5217 |
e856f80e0520
Check for comboboxes in listbox functions, and handle missing events,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
370
diff
changeset
|
5218 if(strnicmp(tmpbuf, COMBOBOXCLASSNAME, strlen(COMBOBOXCLASSNAME)+1)==0) |
e856f80e0520
Check for comboboxes in listbox functions, and handle missing events,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
370
diff
changeset
|
5219 { |
e856f80e0520
Check for comboboxes in listbox functions, and handle missing events,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
370
diff
changeset
|
5220 SendMessage(handle, CB_DELETESTRING, (WPARAM)index, 0); |
e856f80e0520
Check for comboboxes in listbox functions, and handle missing events,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
370
diff
changeset
|
5221 SendMessage(handle, CB_INSERTSTRING, (WPARAM)index, (LPARAM)buffer); |
e856f80e0520
Check for comboboxes in listbox functions, and handle missing events,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
370
diff
changeset
|
5222 } |
e856f80e0520
Check for comboboxes in listbox functions, and handle missing events,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
370
diff
changeset
|
5223 else |
e856f80e0520
Check for comboboxes in listbox functions, and handle missing events,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
370
diff
changeset
|
5224 { |
e856f80e0520
Check for comboboxes in listbox functions, and handle missing events,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
370
diff
changeset
|
5225 unsigned int sel = (unsigned int)SendMessage(handle, LB_GETCURSEL, 0, 0); |
e856f80e0520
Check for comboboxes in listbox functions, and handle missing events,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
370
diff
changeset
|
5226 SendMessage(handle, LB_DELETESTRING, (WPARAM)index, 0); |
e856f80e0520
Check for comboboxes in listbox functions, and handle missing events,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
370
diff
changeset
|
5227 SendMessage(handle, LB_INSERTSTRING, (WPARAM)index, (LPARAM)buffer); |
e856f80e0520
Check for comboboxes in listbox functions, and handle missing events,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
370
diff
changeset
|
5228 SendMessage(handle, LB_SETCURSEL, (WPARAM)sel, 0); |
e856f80e0520
Check for comboboxes in listbox functions, and handle missing events,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
370
diff
changeset
|
5229 SendMessage(handle, LB_SETSEL, (WPARAM)TRUE, (LPARAM)sel); |
e856f80e0520
Check for comboboxes in listbox functions, and handle missing events,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
370
diff
changeset
|
5230 } |
3 | 5231 } |
5232 | |
5233 /* | |
5234 * Copies the given index item's text into buffer. | |
5235 * Parameters: | |
5236 * handle: Handle to the listbox to be queried. | |
5237 * index: Index into the list to be queried. | |
5238 * buffer: Buffer where text will be copied. | |
5239 * length: Length of the buffer (including NULL). | |
5240 */ | |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
5241 void API dw_listbox_query_text(HWND handle, unsigned int index, char *buffer, unsigned int length) |
3 | 5242 { |
351
84a24d739d12
Make dw_listbox_query_text() work on comboboxes on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
350
diff
changeset
|
5243 char tmpbuf[100]; |
84a24d739d12
Make dw_listbox_query_text() work on comboboxes on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
350
diff
changeset
|
5244 int len; |
84a24d739d12
Make dw_listbox_query_text() work on comboboxes on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
350
diff
changeset
|
5245 |
84a24d739d12
Make dw_listbox_query_text() work on comboboxes on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
350
diff
changeset
|
5246 if(!buffer || !length) |
84a24d739d12
Make dw_listbox_query_text() work on comboboxes on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
350
diff
changeset
|
5247 return; |
84a24d739d12
Make dw_listbox_query_text() work on comboboxes on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
350
diff
changeset
|
5248 |
84a24d739d12
Make dw_listbox_query_text() work on comboboxes on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
350
diff
changeset
|
5249 buffer[0] = 0; |
84a24d739d12
Make dw_listbox_query_text() work on comboboxes on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
350
diff
changeset
|
5250 |
84a24d739d12
Make dw_listbox_query_text() work on comboboxes on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
350
diff
changeset
|
5251 GetClassName(handle, tmpbuf, 99); |
84a24d739d12
Make dw_listbox_query_text() work on comboboxes on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
350
diff
changeset
|
5252 |
371
e856f80e0520
Check for comboboxes in listbox functions, and handle missing events,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
370
diff
changeset
|
5253 if(strnicmp(tmpbuf, COMBOBOXCLASSNAME, strlen(COMBOBOXCLASSNAME)+1)==0) |
351
84a24d739d12
Make dw_listbox_query_text() work on comboboxes on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
350
diff
changeset
|
5254 { |
84a24d739d12
Make dw_listbox_query_text() work on comboboxes on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
350
diff
changeset
|
5255 len = (int)SendMessage(handle, CB_GETLBTEXTLEN, (WPARAM)index, 0); |
84a24d739d12
Make dw_listbox_query_text() work on comboboxes on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
350
diff
changeset
|
5256 |
84a24d739d12
Make dw_listbox_query_text() work on comboboxes on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
350
diff
changeset
|
5257 if(len < length && len != CB_ERR) |
84a24d739d12
Make dw_listbox_query_text() work on comboboxes on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
350
diff
changeset
|
5258 SendMessage(handle, |
84a24d739d12
Make dw_listbox_query_text() work on comboboxes on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
350
diff
changeset
|
5259 CB_GETLBTEXT, (WPARAM)index, (LPARAM)buffer); |
84a24d739d12
Make dw_listbox_query_text() work on comboboxes on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
350
diff
changeset
|
5260 } |
84a24d739d12
Make dw_listbox_query_text() work on comboboxes on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
350
diff
changeset
|
5261 else |
84a24d739d12
Make dw_listbox_query_text() work on comboboxes on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
350
diff
changeset
|
5262 { |
84a24d739d12
Make dw_listbox_query_text() work on comboboxes on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
350
diff
changeset
|
5263 len = (int)SendMessage(handle, LB_GETTEXTLEN, (WPARAM)index, 0); |
84a24d739d12
Make dw_listbox_query_text() work on comboboxes on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
350
diff
changeset
|
5264 |
84a24d739d12
Make dw_listbox_query_text() work on comboboxes on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
350
diff
changeset
|
5265 if(len < length && len != LB_ERR) |
84a24d739d12
Make dw_listbox_query_text() work on comboboxes on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
350
diff
changeset
|
5266 SendMessage(handle, |
84a24d739d12
Make dw_listbox_query_text() work on comboboxes on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
350
diff
changeset
|
5267 LB_GETTEXT, (WPARAM)index, (LPARAM)buffer); |
84a24d739d12
Make dw_listbox_query_text() work on comboboxes on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
350
diff
changeset
|
5268 } |
3 | 5269 } |
5270 | |
5271 /* | |
5272 * Returns the index to the item in the list currently selected. | |
5273 * Parameters: | |
5274 * handle: Handle to the listbox to be queried. | |
5275 */ | |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
5276 unsigned int API dw_listbox_selected(HWND handle) |
3 | 5277 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5278 char tmpbuf[100]; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5279 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5280 GetClassName(handle, tmpbuf, 99); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5281 |
371
e856f80e0520
Check for comboboxes in listbox functions, and handle missing events,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
370
diff
changeset
|
5282 if(strnicmp(tmpbuf, COMBOBOXCLASSNAME, strlen(COMBOBOXCLASSNAME)+1)==0) |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5283 return (unsigned int)SendMessage(handle, |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5284 CB_GETCURSEL, |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5285 0, 0); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5286 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5287 return (unsigned int)SendMessage(handle, |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5288 LB_GETCURSEL, |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5289 0, 0); |
3 | 5290 } |
5291 | |
5292 /* | |
5293 * Returns the index to the current selected item or -1 when done. | |
5294 * Parameters: | |
5295 * handle: Handle to the listbox to be queried. | |
5296 * where: Either the previous return or -1 to restart. | |
5297 */ | |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
5298 int API dw_listbox_selected_multi(HWND handle, int where) |
3 | 5299 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5300 int *array, count, z; |
371
e856f80e0520
Check for comboboxes in listbox functions, and handle missing events,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
370
diff
changeset
|
5301 char tmpbuf[100]; |
e856f80e0520
Check for comboboxes in listbox functions, and handle missing events,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
370
diff
changeset
|
5302 |
e856f80e0520
Check for comboboxes in listbox functions, and handle missing events,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
370
diff
changeset
|
5303 GetClassName(handle, tmpbuf, 99); |
e856f80e0520
Check for comboboxes in listbox functions, and handle missing events,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
370
diff
changeset
|
5304 |
e856f80e0520
Check for comboboxes in listbox functions, and handle missing events,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
370
diff
changeset
|
5305 /* This doesn't work on comboboxes */ |
e856f80e0520
Check for comboboxes in listbox functions, and handle missing events,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
370
diff
changeset
|
5306 if(strnicmp(tmpbuf, COMBOBOXCLASSNAME, strlen(COMBOBOXCLASSNAME)+1)==0) |
e856f80e0520
Check for comboboxes in listbox functions, and handle missing events,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
370
diff
changeset
|
5307 return -1; |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5308 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5309 count = (int)SendMessage(handle, LB_GETSELCOUNT, 0, 0); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5310 if(count > 0) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5311 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5312 array = malloc(sizeof(int)*count); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5313 SendMessage(handle, LB_GETSELITEMS, (WPARAM)count, (LPARAM)array); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5314 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5315 if(where == -1) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5316 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5317 int ret = array[0]; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5318 free(array); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5319 return ret; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5320 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5321 for(z=0;z<count;z++) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5322 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5323 if(array[z] == where && (z+1) < count) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5324 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5325 int ret = array[z+1]; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5326 free(array); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5327 return ret; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5328 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5329 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5330 free(array); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5331 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5332 return -1; |
3 | 5333 } |
5334 | |
5335 /* | |
5336 * Sets the selection state of a given index. | |
5337 * Parameters: | |
5338 * handle: Handle to the listbox to be set. | |
5339 * index: Item index. | |
5340 * state: TRUE if selected FALSE if unselected. | |
5341 */ | |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
5342 void API dw_listbox_select(HWND handle, int index, int state) |
3 | 5343 { |
5344 char tmpbuf[100]; | |
5345 | |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5346 GetClassName(handle, tmpbuf, 99); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5347 |
371
e856f80e0520
Check for comboboxes in listbox functions, and handle missing events,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
370
diff
changeset
|
5348 if(strnicmp(tmpbuf, COMBOBOXCLASSNAME, strlen(COMBOBOXCLASSNAME)+1)==0) |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5349 SendMessage(handle, CB_SETCURSEL, (WPARAM)index, 0); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5350 else |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5351 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5352 SendMessage(handle, LB_SETCURSEL, (WPARAM)index, 0); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5353 SendMessage(handle, LB_SETSEL, (WPARAM)state, (LPARAM)index); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5354 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5355 _wndproc(handle, WM_COMMAND, (WPARAM)(LBN_SELCHANGE << 16), (LPARAM)handle); |
3 | 5356 } |
5357 | |
5358 /* | |
5359 * Deletes the item with given index from the list. | |
5360 * Parameters: | |
5361 * handle: Handle to the listbox to be set. | |
5362 * index: Item index. | |
5363 */ | |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
5364 void API dw_listbox_delete(HWND handle, int index) |
3 | 5365 { |
371
e856f80e0520
Check for comboboxes in listbox functions, and handle missing events,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
370
diff
changeset
|
5366 char tmpbuf[100]; |
e856f80e0520
Check for comboboxes in listbox functions, and handle missing events,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
370
diff
changeset
|
5367 |
e856f80e0520
Check for comboboxes in listbox functions, and handle missing events,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
370
diff
changeset
|
5368 GetClassName(handle, tmpbuf, 99); |
e856f80e0520
Check for comboboxes in listbox functions, and handle missing events,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
370
diff
changeset
|
5369 |
e856f80e0520
Check for comboboxes in listbox functions, and handle missing events,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
370
diff
changeset
|
5370 if(strnicmp(tmpbuf, COMBOBOXCLASSNAME, strlen(COMBOBOXCLASSNAME)+1)==0) |
e856f80e0520
Check for comboboxes in listbox functions, and handle missing events,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
370
diff
changeset
|
5371 SendMessage(handle, CB_DELETESTRING, (WPARAM)index, 0); |
e856f80e0520
Check for comboboxes in listbox functions, and handle missing events,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
370
diff
changeset
|
5372 else |
e856f80e0520
Check for comboboxes in listbox functions, and handle missing events,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
370
diff
changeset
|
5373 SendMessage(handle, LB_DELETESTRING, (WPARAM)index, 0); |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5374 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5375 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5376 /* |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5377 * Returns the listbox's item count. |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5378 * Parameters: |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5379 * handle: Handle to the listbox to be cleared. |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5380 */ |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
5381 int API dw_listbox_count(HWND handle) |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5382 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5383 char tmpbuf[100]; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5384 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5385 GetClassName(handle, tmpbuf, 99); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5386 |
371
e856f80e0520
Check for comboboxes in listbox functions, and handle missing events,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
370
diff
changeset
|
5387 if(strnicmp(tmpbuf, COMBOBOXCLASSNAME, strlen(COMBOBOXCLASSNAME)+1)==0) |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5388 return (int)SendMessage(handle, |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5389 CB_GETCOUNT,0L, 0L); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5390 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5391 return (int)SendMessage(handle, |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5392 LB_GETCOUNT,0L, 0L); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5393 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5394 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5395 /* |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5396 * Sets the topmost item in the viewport. |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5397 * Parameters: |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5398 * handle: Handle to the listbox to be cleared. |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5399 * top: Index to the top item. |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5400 */ |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
5401 void API dw_listbox_set_top(HWND handle, int top) |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5402 { |
371
e856f80e0520
Check for comboboxes in listbox functions, and handle missing events,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
370
diff
changeset
|
5403 char tmpbuf[100]; |
e856f80e0520
Check for comboboxes in listbox functions, and handle missing events,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
370
diff
changeset
|
5404 |
e856f80e0520
Check for comboboxes in listbox functions, and handle missing events,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
370
diff
changeset
|
5405 GetClassName(handle, tmpbuf, 99); |
e856f80e0520
Check for comboboxes in listbox functions, and handle missing events,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
370
diff
changeset
|
5406 |
e856f80e0520
Check for comboboxes in listbox functions, and handle missing events,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
370
diff
changeset
|
5407 /* This doesn't work on comboboxes */ |
e856f80e0520
Check for comboboxes in listbox functions, and handle missing events,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
370
diff
changeset
|
5408 if(strnicmp(tmpbuf, COMBOBOXCLASSNAME, strlen(COMBOBOXCLASSNAME)+1)==0) |
e856f80e0520
Check for comboboxes in listbox functions, and handle missing events,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
370
diff
changeset
|
5409 return; |
e856f80e0520
Check for comboboxes in listbox functions, and handle missing events,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
370
diff
changeset
|
5410 |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5411 SendMessage(handle, LB_SETTOPINDEX, (WPARAM)top, 0); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5412 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5413 |
3 | 5414 /* |
5415 * Adds text to an MLE box and returns the current point. | |
5416 * Parameters: | |
5417 * handle: Handle to the MLE to be queried. | |
5418 * buffer: Text buffer to be imported. | |
5419 * startpoint: Point to start entering text. | |
5420 */ | |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
5421 unsigned int API dw_mle_import(HWND handle, char *buffer, int startpoint) |
3 | 5422 { |
95
636c37ca7238
Avoid allocating super huge buffers when dealing with the MLEs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
5423 int textlen, len = GetWindowTextLength(handle); |
636c37ca7238
Avoid allocating super huge buffers when dealing with the MLEs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
5424 char *tmpbuf; |
636c37ca7238
Avoid allocating super huge buffers when dealing with the MLEs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
5425 |
636c37ca7238
Avoid allocating super huge buffers when dealing with the MLEs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
5426 if((textlen = strlen(buffer)) < 1) |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5427 return startpoint; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5428 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5429 startpoint++; |
95
636c37ca7238
Avoid allocating super huge buffers when dealing with the MLEs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
5430 tmpbuf = calloc(1, len + textlen + startpoint + 2); |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5431 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5432 if(startpoint < 0) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5433 startpoint = 0; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5434 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5435 if(len) |
37
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
5436 { |
95
636c37ca7238
Avoid allocating super huge buffers when dealing with the MLEs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
5437 char *dest, *start; |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5438 int copylen = len - startpoint; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5439 |
95
636c37ca7238
Avoid allocating super huge buffers when dealing with the MLEs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
5440 GetWindowText(handle, tmpbuf, len+1); |
636c37ca7238
Avoid allocating super huge buffers when dealing with the MLEs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
5441 |
636c37ca7238
Avoid allocating super huge buffers when dealing with the MLEs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
5442 dest = &tmpbuf[startpoint+textlen-1]; |
636c37ca7238
Avoid allocating super huge buffers when dealing with the MLEs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
5443 start = &tmpbuf[startpoint]; |
636c37ca7238
Avoid allocating super huge buffers when dealing with the MLEs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
5444 |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5445 if(copylen > 0) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5446 memcpy(dest, start, copylen); |
37
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
5447 } |
95
636c37ca7238
Avoid allocating super huge buffers when dealing with the MLEs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
5448 memcpy(&tmpbuf[startpoint], buffer, textlen); |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5449 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5450 SetWindowText(handle, tmpbuf); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5451 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5452 free(tmpbuf); |
95
636c37ca7238
Avoid allocating super huge buffers when dealing with the MLEs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
5453 return (startpoint + textlen - 1); |
3 | 5454 } |
5455 | |
5456 /* | |
5457 * Grabs text from an MLE box. | |
5458 * Parameters: | |
5459 * handle: Handle to the MLE to be queried. | |
5460 * buffer: Text buffer to be exported. | |
5461 * startpoint: Point to start grabbing text. | |
5462 * length: Amount of text to be grabbed. | |
5463 */ | |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
5464 void API dw_mle_export(HWND handle, char *buffer, int startpoint, int length) |
3 | 5465 { |
95
636c37ca7238
Avoid allocating super huge buffers when dealing with the MLEs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
5466 int max, len = GetWindowTextLength(handle); |
636c37ca7238
Avoid allocating super huge buffers when dealing with the MLEs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
5467 char *tmpbuf = calloc(1, len+2); |
636c37ca7238
Avoid allocating super huge buffers when dealing with the MLEs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
5468 |
636c37ca7238
Avoid allocating super huge buffers when dealing with the MLEs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
5469 if(len) |
636c37ca7238
Avoid allocating super huge buffers when dealing with the MLEs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
5470 GetWindowText(handle, tmpbuf, len+1); |
636c37ca7238
Avoid allocating super huge buffers when dealing with the MLEs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
5471 |
636c37ca7238
Avoid allocating super huge buffers when dealing with the MLEs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
5472 buffer[0] = 0; |
636c37ca7238
Avoid allocating super huge buffers when dealing with the MLEs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
5473 |
636c37ca7238
Avoid allocating super huge buffers when dealing with the MLEs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
5474 if(startpoint < len) |
636c37ca7238
Avoid allocating super huge buffers when dealing with the MLEs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
5475 { |
636c37ca7238
Avoid allocating super huge buffers when dealing with the MLEs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
5476 max = MIN(length, len - startpoint); |
636c37ca7238
Avoid allocating super huge buffers when dealing with the MLEs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
5477 |
636c37ca7238
Avoid allocating super huge buffers when dealing with the MLEs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
5478 memcpy(buffer, &tmpbuf[startpoint], max); |
636c37ca7238
Avoid allocating super huge buffers when dealing with the MLEs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
5479 } |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5480 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5481 free(tmpbuf); |
3 | 5482 } |
5483 | |
5484 /* | |
5485 * Obtains information about an MLE box. | |
5486 * Parameters: | |
5487 * handle: Handle to the MLE to be queried. | |
5488 * bytes: A pointer to a variable to return the total bytes. | |
5489 * lines: A pointer to a variable to return the number of lines. | |
5490 */ | |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
5491 void API dw_mle_query(HWND handle, unsigned long *bytes, unsigned long *lines) |
3 | 5492 { |
5493 if(bytes) | |
95
636c37ca7238
Avoid allocating super huge buffers when dealing with the MLEs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
5494 *bytes = GetWindowTextLength(handle); |
3 | 5495 if(lines) |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5496 *lines = (unsigned long)SendMessage(handle, EM_GETLINECOUNT, 0, 0); |
3 | 5497 } |
5498 | |
5499 /* | |
5500 * Deletes text from an MLE box. | |
5501 * Parameters: | |
5502 * handle: Handle to the MLE to be deleted from. | |
5503 * startpoint: Point to start deleting text. | |
5504 * length: Amount of text to be deleted. | |
5505 */ | |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
5506 void API dw_mle_delete(HWND handle, int startpoint, int length) |
3 | 5507 { |
95
636c37ca7238
Avoid allocating super huge buffers when dealing with the MLEs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
5508 int len = GetWindowTextLength(handle); |
636c37ca7238
Avoid allocating super huge buffers when dealing with the MLEs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
5509 char *tmpbuf = calloc(1, len+2); |
636c37ca7238
Avoid allocating super huge buffers when dealing with the MLEs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
5510 |
636c37ca7238
Avoid allocating super huge buffers when dealing with the MLEs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
5511 GetWindowText(handle, tmpbuf, len+1); |
636c37ca7238
Avoid allocating super huge buffers when dealing with the MLEs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
5512 |
636c37ca7238
Avoid allocating super huge buffers when dealing with the MLEs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
5513 if(startpoint + length < len) |
636c37ca7238
Avoid allocating super huge buffers when dealing with the MLEs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
5514 { |
636c37ca7238
Avoid allocating super huge buffers when dealing with the MLEs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
5515 strcpy(&tmpbuf[startpoint], &tmpbuf[startpoint+length]); |
636c37ca7238
Avoid allocating super huge buffers when dealing with the MLEs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
5516 |
636c37ca7238
Avoid allocating super huge buffers when dealing with the MLEs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
5517 SetWindowText(handle, tmpbuf); |
636c37ca7238
Avoid allocating super huge buffers when dealing with the MLEs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
5518 } |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5519 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5520 free(tmpbuf); |
3 | 5521 } |
5522 | |
5523 /* | |
5524 * Clears all text from an MLE box. | |
5525 * Parameters: | |
5526 * handle: Handle to the MLE to be cleared. | |
5527 */ | |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
5528 void API dw_mle_clear(HWND handle) |
3 | 5529 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5530 SetWindowText(handle, ""); |
3 | 5531 } |
5532 | |
5533 /* | |
5534 * Sets the visible line of an MLE box. | |
5535 * Parameters: | |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5536 * handle: Handle to the MLE. |
3 | 5537 * line: Line to be visible. |
5538 */ | |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
5539 void API dw_mle_set_visible(HWND handle, int line) |
3 | 5540 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5541 int point = (int)SendMessage(handle, EM_LINEINDEX, (WPARAM)line, 0); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5542 dw_mle_set(handle, point); |
3 | 5543 } |
5544 | |
5545 /* | |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
5546 * Sets the editablity of an MLE box. |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
5547 * Parameters: |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
5548 * handle: Handle to the MLE. |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
5549 * 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
|
5550 */ |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
5551 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
|
5552 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5553 SendMessage(handle, EM_SETREADONLY, (WPARAM)(state ? FALSE : TRUE), 0); |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
5554 } |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
5555 |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
5556 /* |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
5557 * Sets the word wrap state of an MLE box. |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
5558 * Parameters: |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
5559 * handle: Handle to the MLE. |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
5560 * 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
|
5561 */ |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
5562 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
|
5563 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5564 /* If ES_AUTOHSCROLL is not set and there is not |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5565 * horizontal scrollbar it word wraps. |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5566 */ |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5567 if(state) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5568 dw_window_set_style(handle, 0, ES_AUTOHSCROLL); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5569 else |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5570 dw_window_set_style(handle, ES_AUTOHSCROLL, ES_AUTOHSCROLL); |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
5571 } |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
5572 |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
5573 /* |
3 | 5574 * Sets the current cursor position of an MLE box. |
5575 * Parameters: | |
5576 * handle: Handle to the MLE to be positioned. | |
5577 * point: Point to position cursor. | |
5578 */ | |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
5579 void API dw_mle_set(HWND handle, int point) |
3 | 5580 { |
389
23a603b136bd
Change call to SendMessage() to make dw_mle_set() actually work.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
388
diff
changeset
|
5581 SendMessage(handle, EM_SETSEL, 0, MAKELONG(point,point)); |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5582 SendMessage(handle, EM_SCROLLCARET, 0, 0); |
3 | 5583 } |
5584 | |
5585 /* | |
5586 * Finds text in an MLE box. | |
5587 * Parameters: | |
5588 * handle: Handle to the MLE to be cleared. | |
5589 * text: Text to search for. | |
5590 * point: Start point of search. | |
5591 * flags: Search specific flags. | |
5592 */ | |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
5593 int API dw_mle_search(HWND handle, char *text, int point, unsigned long flags) |
3 | 5594 { |
95
636c37ca7238
Avoid allocating super huge buffers when dealing with the MLEs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
5595 int len = GetWindowTextLength(handle); |
636c37ca7238
Avoid allocating super huge buffers when dealing with the MLEs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
5596 char *tmpbuf = calloc(1, len+2); |
636c37ca7238
Avoid allocating super huge buffers when dealing with the MLEs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
5597 int z, textlen, retval = 0; |
636c37ca7238
Avoid allocating super huge buffers when dealing with the MLEs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
5598 |
636c37ca7238
Avoid allocating super huge buffers when dealing with the MLEs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
5599 GetWindowText(handle, tmpbuf, len+1); |
636c37ca7238
Avoid allocating super huge buffers when dealing with the MLEs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
5600 |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5601 textlen = strlen(text); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5602 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5603 if(flags & DW_MLE_CASESENSITIVE) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5604 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5605 for(z=point;z<(len-textlen) && !retval;z++) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5606 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5607 if(strncmp(&tmpbuf[z], text, textlen) == 0) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5608 retval = z + textlen; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5609 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5610 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5611 else |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5612 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5613 for(z=point;z<(len-textlen) && !retval;z++) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5614 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5615 if(strnicmp(&tmpbuf[z], text, textlen) == 0) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5616 retval = z + textlen; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5617 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5618 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5619 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5620 if(retval) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5621 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5622 SendMessage(handle, EM_SETSEL, (WPARAM)retval - textlen, (LPARAM)retval); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5623 SendMessage(handle, EM_SCROLLCARET, 0, 0); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5624 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5625 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5626 free(tmpbuf); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5627 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5628 return retval; |
3 | 5629 } |
5630 | |
5631 /* | |
5632 * Stops redrawing of an MLE box. | |
5633 * Parameters: | |
5634 * handle: Handle to the MLE to freeze. | |
5635 */ | |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
5636 void API dw_mle_freeze(HWND handle) |
3 | 5637 { |
5638 } | |
5639 | |
5640 /* | |
5641 * Resumes redrawing of an MLE box. | |
5642 * Parameters: | |
5643 * handle: Handle to the MLE to thaw. | |
5644 */ | |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
5645 void API dw_mle_thaw(HWND handle) |
3 | 5646 { |
5647 } | |
5648 | |
5649 /* | |
33
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
32
diff
changeset
|
5650 * Returns the range of the percent bar. |
3 | 5651 * Parameters: |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
5652 * handle: Handle to the percent bar to be queried. |
3 | 5653 */ |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
5654 unsigned int API dw_percent_query_range(HWND handle) |
3 | 5655 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5656 return (unsigned int)SendMessage(handle, PBM_GETRANGE, (WPARAM)FALSE, 0); |
3 | 5657 } |
5658 | |
5659 /* | |
33
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
32
diff
changeset
|
5660 * Sets the percent bar position. |
3 | 5661 * Parameters: |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
5662 * 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:
61
diff
changeset
|
5663 * position: Position of the percent bar withing the range. |
3 | 5664 */ |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
5665 void API dw_percent_set_pos(HWND handle, unsigned int position) |
3 | 5666 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5667 SendMessage(handle, PBM_SETPOS, (WPARAM)position, 0); |
3 | 5668 } |
5669 | |
5670 /* | |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
5671 * 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:
61
diff
changeset
|
5672 * Parameters: |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
5673 * 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:
61
diff
changeset
|
5674 */ |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
5675 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:
61
diff
changeset
|
5676 { |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
5677 int max = (int)SendMessage(handle, TBM_GETRANGEMAX, 0, 0); |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
5678 ULONG currentstyle = GetWindowLong(handle, GWL_STYLE); |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
5679 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
5680 if(currentstyle & TBS_VERT) |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
5681 return max - (unsigned int)SendMessage(handle, TBM_GETPOS, 0, 0); |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
5682 return (unsigned int)SendMessage(handle, TBM_GETPOS, 0, 0); |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
5683 } |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
5684 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
5685 /* |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
5686 * Sets the slider position. |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
5687 * Parameters: |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
5688 * 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:
61
diff
changeset
|
5689 * 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:
61
diff
changeset
|
5690 */ |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
5691 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:
61
diff
changeset
|
5692 { |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
5693 int max = (int)SendMessage(handle, TBM_GETRANGEMAX, 0, 0); |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
5694 ULONG currentstyle = GetWindowLong(handle, GWL_STYLE); |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
5695 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
5696 if(currentstyle & TBS_VERT) |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
5697 SendMessage(handle, TBM_SETPOS, (WPARAM)TRUE, (LPARAM)max - position); |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
5698 else |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
5699 SendMessage(handle, TBM_SETPOS, (WPARAM)TRUE, (LPARAM)position); |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
5700 } |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
5701 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
5702 /* |
197
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
5703 * Returns the position of the scrollbar. |
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
5704 * Parameters: |
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
5705 * handle: Handle to the scrollbar to be queried. |
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
5706 */ |
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
5707 unsigned int API dw_scrollbar_query_pos(HWND handle) |
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
5708 { |
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
5709 return (unsigned int)SendMessage(handle, SBM_GETPOS, 0, 0); |
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
5710 } |
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
5711 |
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
5712 /* |
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
5713 * Sets the scrollbar position. |
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
5714 * Parameters: |
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
5715 * handle: Handle to the scrollbar to be set. |
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
5716 * position: Position of the scrollbar withing the range. |
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
5717 */ |
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
5718 void API dw_scrollbar_set_pos(HWND handle, unsigned int position) |
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
5719 { |
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
5720 dw_window_set_data(handle, "_dw_scrollbar_value", (void *)position); |
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
5721 SendMessage(handle, SBM_SETPOS, (WPARAM)position, (LPARAM)TRUE); |
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
5722 } |
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
5723 |
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
5724 /* |
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
5725 * Sets the scrollbar range. |
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
5726 * Parameters: |
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
5727 * handle: Handle to the scrollbar to be set. |
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
5728 * range: Maximum range value. |
204
098ed34d41fb
The basics of the new scrollbar code on Windows, and dw_main_iteration().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
201
diff
changeset
|
5729 * visible: Visible area relative to the range. |
098ed34d41fb
The basics of the new scrollbar code on Windows, and dw_main_iteration().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
201
diff
changeset
|
5730 */ |
098ed34d41fb
The basics of the new scrollbar code on Windows, and dw_main_iteration().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
201
diff
changeset
|
5731 void API dw_scrollbar_set_range(HWND handle, unsigned int range, unsigned int visible) |
098ed34d41fb
The basics of the new scrollbar code on Windows, and dw_main_iteration().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
201
diff
changeset
|
5732 { |
098ed34d41fb
The basics of the new scrollbar code on Windows, and dw_main_iteration().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
201
diff
changeset
|
5733 SCROLLINFO si; |
098ed34d41fb
The basics of the new scrollbar code on Windows, and dw_main_iteration().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
201
diff
changeset
|
5734 |
098ed34d41fb
The basics of the new scrollbar code on Windows, and dw_main_iteration().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
201
diff
changeset
|
5735 si.cbSize = sizeof(SCROLLINFO); |
098ed34d41fb
The basics of the new scrollbar code on Windows, and dw_main_iteration().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
201
diff
changeset
|
5736 si.fMask = SIF_RANGE | SIF_PAGE; |
098ed34d41fb
The basics of the new scrollbar code on Windows, and dw_main_iteration().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
201
diff
changeset
|
5737 si.nMin = 0; |
209
85f25e8c1b1e
nMax is inclusive or exclusive?
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
204
diff
changeset
|
5738 si.nMax = range - 1; |
204
098ed34d41fb
The basics of the new scrollbar code on Windows, and dw_main_iteration().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
201
diff
changeset
|
5739 si.nPage = visible; |
098ed34d41fb
The basics of the new scrollbar code on Windows, and dw_main_iteration().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
201
diff
changeset
|
5740 SendMessage(handle, SBM_SETSCROLLINFO, (WPARAM)TRUE, (LPARAM)&si); |
197
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
5741 } |
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
5742 |
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
5743 /* |
3 | 5744 * Sets the spinbutton value. |
5745 * Parameters: | |
5746 * handle: Handle to the spinbutton to be set. | |
5747 * position: Current value of the spinbutton. | |
5748 */ | |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
5749 void API dw_spinbutton_set_pos(HWND handle, long position) |
3 | 5750 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5751 char tmpbuf[100]; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5752 ColorInfo *cinfo = (ColorInfo *)GetWindowLong(handle, GWL_USERDATA); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5753 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5754 sprintf(tmpbuf, "%d", position); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5755 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5756 if(cinfo && cinfo->buddy) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5757 SetWindowText(cinfo->buddy, tmpbuf); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5758 |
75
c629838d9805
Updated to latest DW, and updated the Makefile to install the header files
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
73
diff
changeset
|
5759 if(IS_IE5PLUS) |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5760 SendMessage(handle, UDM_SETPOS32, 0, (LPARAM)position); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5761 else |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5762 SendMessage(handle, UDM_SETPOS, 0, (LPARAM)MAKELONG((short)position, 0)); |
3 | 5763 } |
5764 | |
5765 /* | |
5766 * Sets the spinbutton limits. | |
5767 * Parameters: | |
5768 * handle: Handle to the spinbutton to be set. | |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5769 * position: Current value of the spinbutton. |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5770 * position: Current value of the spinbutton. |
3 | 5771 */ |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
5772 void API dw_spinbutton_set_limits(HWND handle, long upper, long lower) |
3 | 5773 { |
75
c629838d9805
Updated to latest DW, and updated the Makefile to install the header files
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
73
diff
changeset
|
5774 if(IS_IE5PLUS) |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5775 SendMessage(handle, UDM_SETRANGE32, (WPARAM)lower,(LPARAM)upper); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5776 else |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5777 SendMessage(handle, UDM_SETRANGE32, (WPARAM)((short)lower), |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5778 (LPARAM)((short)upper)); |
3 | 5779 } |
5780 | |
5781 /* | |
5782 * Sets the entryfield character limit. | |
5783 * Parameters: | |
5784 * handle: Handle to the spinbutton to be set. | |
5785 * limit: Number of characters the entryfield will take. | |
5786 */ | |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
5787 void API dw_entryfield_set_limit(HWND handle, ULONG limit) |
3 | 5788 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5789 SendMessage(handle, EM_SETLIMITTEXT, (WPARAM)limit, 0); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5790 } |
3 | 5791 |
5792 /* | |
5793 * Returns the current value of the spinbutton. | |
5794 * Parameters: | |
5795 * handle: Handle to the spinbutton to be queried. | |
5796 */ | |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
5797 long API dw_spinbutton_query(HWND handle) |
3 | 5798 { |
75
c629838d9805
Updated to latest DW, and updated the Makefile to install the header files
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
73
diff
changeset
|
5799 if(IS_IE5PLUS) |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5800 return (long)SendMessage(handle, UDM_GETPOS32, 0, 0); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5801 else |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5802 return (long)SendMessage(handle, UDM_GETPOS, 0, 0); |
3 | 5803 } |
5804 | |
5805 /* | |
5806 * Returns the state of the checkbox. | |
5807 * Parameters: | |
5808 * handle: Handle to the checkbox to be queried. | |
5809 */ | |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
5810 int API dw_checkbox_query(HWND handle) |
3 | 5811 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5812 if(SendMessage(handle, BM_GETCHECK, 0, 0) == BST_CHECKED) |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
59
diff
changeset
|
5813 return (in_checkbox_handler ? FALSE : TRUE); |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
59
diff
changeset
|
5814 return (in_checkbox_handler ? TRUE : FALSE); |
3 | 5815 } |
5816 | |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
5817 /* This function unchecks all radiobuttons on a box */ |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
5818 BOOL CALLBACK _uncheck_radios(HWND handle, LPARAM lParam) |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
5819 { |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
5820 char tmpbuf[100]; |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
5821 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
5822 GetClassName(handle, tmpbuf, 99); |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
5823 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
5824 if(strnicmp(tmpbuf, BUTTONCLASSNAME, strlen(BUTTONCLASSNAME)+1)==0) |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
5825 { |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
5826 BubbleButton *bubble= (BubbleButton *)GetWindowLong(handle, GWL_USERDATA); |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
5827 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
5828 if(bubble && !bubble->checkbox) |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
5829 SendMessage(handle, BM_SETCHECK, 0, 0); |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
5830 } |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
5831 return TRUE; |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
5832 } |
3 | 5833 /* |
5834 * Sets the state of the checkbox. | |
5835 * Parameters: | |
5836 * handle: Handle to the checkbox to be queried. | |
5837 * value: TRUE for checked, FALSE for unchecked. | |
5838 */ | |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
5839 void API dw_checkbox_set(HWND handle, int value) |
3 | 5840 { |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
5841 BubbleButton *bubble= (BubbleButton *)GetWindowLong(handle, GWL_USERDATA); |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
5842 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
5843 if(bubble && !bubble->checkbox) |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
5844 { |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
5845 HWND parent = GetParent(handle); |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
5846 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
5847 if(parent) |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
5848 EnumChildWindows(parent, _uncheck_radios, 0); |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
5849 } |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5850 SendMessage(handle, BM_SETCHECK, (WPARAM)value, 0); |
3 | 5851 } |
5852 | |
5853 /* | |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
59
diff
changeset
|
5854 * Inserts an item into a tree window (widget) after another item. |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
59
diff
changeset
|
5855 * Parameters: |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
59
diff
changeset
|
5856 * handle: Handle to the tree to be inserted. |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
59
diff
changeset
|
5857 * item: Handle to the item to be positioned after. |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
59
diff
changeset
|
5858 * title: The text title of the entry. |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
59
diff
changeset
|
5859 * icon: Handle to coresponding icon. |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
59
diff
changeset
|
5860 * parent: Parent handle or 0 if root. |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
59
diff
changeset
|
5861 * itemdata: Item specific data. |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
59
diff
changeset
|
5862 */ |
328
e00aff2b899e
Tree item handles are now of the type HTREEITEM instead of HWND since they
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
321
diff
changeset
|
5863 HTREEITEM API dw_tree_insert_after(HWND handle, HTREEITEM item, char *title, unsigned long icon, HTREEITEM parent, void *itemdata) |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
59
diff
changeset
|
5864 { |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
59
diff
changeset
|
5865 TVITEM tvi; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
59
diff
changeset
|
5866 TVINSERTSTRUCT tvins; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
59
diff
changeset
|
5867 HTREEITEM hti; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
59
diff
changeset
|
5868 void **ptrs= malloc(sizeof(void *) * 2); |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
59
diff
changeset
|
5869 |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
59
diff
changeset
|
5870 ptrs[0] = title; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
59
diff
changeset
|
5871 ptrs[1] = itemdata; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
59
diff
changeset
|
5872 |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
59
diff
changeset
|
5873 tvi.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
59
diff
changeset
|
5874 tvi.pszText = title; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
59
diff
changeset
|
5875 tvi.lParam = (LONG)ptrs; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
59
diff
changeset
|
5876 tvi.cchTextMax = strlen(title); |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
59
diff
changeset
|
5877 tvi.iSelectedImage = tvi.iImage = _lookup_icon(handle, (HICON)icon, 1); |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
59
diff
changeset
|
5878 |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
59
diff
changeset
|
5879 tvins.item = tvi; |
328
e00aff2b899e
Tree item handles are now of the type HTREEITEM instead of HWND since they
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
321
diff
changeset
|
5880 tvins.hParent = parent; |
e00aff2b899e
Tree item handles are now of the type HTREEITEM instead of HWND since they
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
321
diff
changeset
|
5881 tvins.hInsertAfter = item ? item : TVI_FIRST; |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
59
diff
changeset
|
5882 |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
59
diff
changeset
|
5883 hti = TreeView_InsertItem(handle, &tvins); |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
59
diff
changeset
|
5884 |
328
e00aff2b899e
Tree item handles are now of the type HTREEITEM instead of HWND since they
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
321
diff
changeset
|
5885 return hti; |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
59
diff
changeset
|
5886 } |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
59
diff
changeset
|
5887 |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
59
diff
changeset
|
5888 /* |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
17
diff
changeset
|
5889 * Inserts an item into a tree window (widget). |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
17
diff
changeset
|
5890 * Parameters: |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
17
diff
changeset
|
5891 * handle: Handle to the tree to be inserted. |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
17
diff
changeset
|
5892 * 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:
17
diff
changeset
|
5893 * 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:
17
diff
changeset
|
5894 * 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
|
5895 * 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
|
5896 */ |
328
e00aff2b899e
Tree item handles are now of the type HTREEITEM instead of HWND since they
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
321
diff
changeset
|
5897 HTREEITEM API dw_tree_insert(HWND handle, char *title, unsigned long icon, HTREEITEM parent, void *itemdata) |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
17
diff
changeset
|
5898 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5899 TVITEM tvi; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5900 TVINSERTSTRUCT tvins; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5901 HTREEITEM hti; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5902 void **ptrs= malloc(sizeof(void *) * 2); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5903 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5904 ptrs[0] = title; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5905 ptrs[1] = itemdata; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5906 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5907 tvi.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5908 tvi.pszText = title; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5909 tvi.lParam = (LONG)ptrs; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5910 tvi.cchTextMax = strlen(title); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5911 tvi.iSelectedImage = tvi.iImage = _lookup_icon(handle, (HICON)icon, 1); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5912 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5913 tvins.item = tvi; |
328
e00aff2b899e
Tree item handles are now of the type HTREEITEM instead of HWND since they
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
321
diff
changeset
|
5914 tvins.hParent = parent; |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5915 tvins.hInsertAfter = TVI_LAST; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5916 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5917 hti = TreeView_InsertItem(handle, &tvins); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5918 |
328
e00aff2b899e
Tree item handles are now of the type HTREEITEM instead of HWND since they
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
321
diff
changeset
|
5919 return hti; |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
17
diff
changeset
|
5920 } |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
17
diff
changeset
|
5921 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
17
diff
changeset
|
5922 /* |
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
|
5923 * 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
|
5924 * 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
|
5925 * 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
|
5926 * 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
|
5927 * 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
|
5928 * 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
|
5929 */ |
328
e00aff2b899e
Tree item handles are now of the type HTREEITEM instead of HWND since they
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
321
diff
changeset
|
5930 void API dw_tree_set(HWND handle, HTREEITEM item, char *title, unsigned long icon) |
54
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5931 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5932 TVITEM tvi; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5933 void **ptrs; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5934 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5935 tvi.mask = TVIF_HANDLE; |
328
e00aff2b899e
Tree item handles are now of the type HTREEITEM instead of HWND since they
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
321
diff
changeset
|
5936 tvi.hItem = item; |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5937 |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
59
diff
changeset
|
5938 if(TreeView_GetItem(handle, &tvi)) |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
59
diff
changeset
|
5939 { |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
59
diff
changeset
|
5940 |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
59
diff
changeset
|
5941 ptrs = (void **)tvi.lParam; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
59
diff
changeset
|
5942 ptrs[0] = title; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
59
diff
changeset
|
5943 |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
59
diff
changeset
|
5944 tvi.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
59
diff
changeset
|
5945 tvi.pszText = title; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
59
diff
changeset
|
5946 tvi.cchTextMax = strlen(title); |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
59
diff
changeset
|
5947 tvi.iSelectedImage = tvi.iImage = _lookup_icon(handle, (HICON)icon, 1); |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
59
diff
changeset
|
5948 tvi.hItem = (HTREEITEM)item; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
59
diff
changeset
|
5949 |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
59
diff
changeset
|
5950 TreeView_SetItem(handle, &tvi); |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
59
diff
changeset
|
5951 } |
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
|
5952 } |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5953 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5954 /* |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5955 * 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
|
5956 * 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
|
5957 * 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
|
5958 * 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
|
5959 * 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
|
5960 */ |
328
e00aff2b899e
Tree item handles are now of the type HTREEITEM instead of HWND since they
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
321
diff
changeset
|
5961 void API dw_tree_set_data(HWND handle, HTREEITEM item, void *itemdata) |
54
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5962 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5963 TVITEM tvi; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5964 void **ptrs; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5965 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5966 tvi.mask = TVIF_HANDLE; |
328
e00aff2b899e
Tree item handles are now of the type HTREEITEM instead of HWND since they
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
321
diff
changeset
|
5967 tvi.hItem = item; |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
5968 |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
59
diff
changeset
|
5969 if(TreeView_GetItem(handle, &tvi)) |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
59
diff
changeset
|
5970 { |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
59
diff
changeset
|
5971 ptrs = (void **)tvi.lParam; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
59
diff
changeset
|
5972 ptrs[1] = itemdata; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
59
diff
changeset
|
5973 } |
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
|
5974 } |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5975 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5976 /* |
317
83edbd751da9
Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
312
diff
changeset
|
5977 * Gets the item data of a tree item. |
83edbd751da9
Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
312
diff
changeset
|
5978 * Parameters: |
83edbd751da9
Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
312
diff
changeset
|
5979 * handle: Handle to the tree containing the item. |
83edbd751da9
Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
312
diff
changeset
|
5980 * item: Handle of the item to be modified. |
83edbd751da9
Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
312
diff
changeset
|
5981 */ |
328
e00aff2b899e
Tree item handles are now of the type HTREEITEM instead of HWND since they
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
321
diff
changeset
|
5982 void * API dw_tree_get_data(HWND handle, HTREEITEM item) |
317
83edbd751da9
Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
312
diff
changeset
|
5983 { |
83edbd751da9
Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
312
diff
changeset
|
5984 TVITEM tvi; |
83edbd751da9
Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
312
diff
changeset
|
5985 void **ptrs; |
83edbd751da9
Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
312
diff
changeset
|
5986 |
83edbd751da9
Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
312
diff
changeset
|
5987 tvi.mask = TVIF_HANDLE; |
328
e00aff2b899e
Tree item handles are now of the type HTREEITEM instead of HWND since they
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
321
diff
changeset
|
5988 tvi.hItem = item; |
317
83edbd751da9
Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
312
diff
changeset
|
5989 |
83edbd751da9
Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
312
diff
changeset
|
5990 if(TreeView_GetItem(handle, &tvi)) |
83edbd751da9
Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
312
diff
changeset
|
5991 { |
83edbd751da9
Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
312
diff
changeset
|
5992 ptrs = (void **)tvi.lParam; |
83edbd751da9
Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
312
diff
changeset
|
5993 return ptrs[1]; |
83edbd751da9
Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
312
diff
changeset
|
5994 } |
83edbd751da9
Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
312
diff
changeset
|
5995 return NULL; |
83edbd751da9
Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
312
diff
changeset
|
5996 } |
83edbd751da9
Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
312
diff
changeset
|
5997 |
83edbd751da9
Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
312
diff
changeset
|
5998 /* |
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
|
5999 * 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
|
6000 * 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
|
6001 * 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
|
6002 * 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
|
6003 */ |
328
e00aff2b899e
Tree item handles are now of the type HTREEITEM instead of HWND since they
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
321
diff
changeset
|
6004 void API dw_tree_item_select(HWND handle, HTREEITEM item) |
54
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
6005 { |
321
be76b984620a
Make sure dw_tree_item_select() does not cause a DW_SIGNAL_ITEM_SELECT.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
318
diff
changeset
|
6006 dw_window_set_data(handle, "_dw_select_item", (void *)1); |
328
e00aff2b899e
Tree item handles are now of the type HTREEITEM instead of HWND since they
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
321
diff
changeset
|
6007 TreeView_SelectItem(handle, item); |
321
be76b984620a
Make sure dw_tree_item_select() does not cause a DW_SIGNAL_ITEM_SELECT.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
318
diff
changeset
|
6008 dw_window_set_data(handle, "_dw_select_item", (void *)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
|
6009 } |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
6010 |
291
70480069392b
Fixed memory leak in the tree control on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
284
diff
changeset
|
6011 /* Delete all tree subitems */ |
70480069392b
Fixed memory leak in the tree control on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
284
diff
changeset
|
6012 void _dw_tree_delete_recursive(HWND handle, HTREEITEM node) |
70480069392b
Fixed memory leak in the tree control on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
284
diff
changeset
|
6013 { |
70480069392b
Fixed memory leak in the tree control on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
284
diff
changeset
|
6014 HTREEITEM hti; |
70480069392b
Fixed memory leak in the tree control on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
284
diff
changeset
|
6015 |
70480069392b
Fixed memory leak in the tree control on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
284
diff
changeset
|
6016 hti = TreeView_GetChild(handle, node); |
70480069392b
Fixed memory leak in the tree control on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
284
diff
changeset
|
6017 |
70480069392b
Fixed memory leak in the tree control on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
284
diff
changeset
|
6018 while(hti) |
70480069392b
Fixed memory leak in the tree control on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
284
diff
changeset
|
6019 { |
70480069392b
Fixed memory leak in the tree control on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
284
diff
changeset
|
6020 HTREEITEM lastitem = hti; |
70480069392b
Fixed memory leak in the tree control on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
284
diff
changeset
|
6021 |
70480069392b
Fixed memory leak in the tree control on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
284
diff
changeset
|
6022 hti = TreeView_GetNextSibling(handle, hti); |
328
e00aff2b899e
Tree item handles are now of the type HTREEITEM instead of HWND since they
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
321
diff
changeset
|
6023 dw_tree_delete(handle, lastitem); |
291
70480069392b
Fixed memory leak in the tree control on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
284
diff
changeset
|
6024 } |
70480069392b
Fixed memory leak in the tree control on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
284
diff
changeset
|
6025 } |
70480069392b
Fixed memory leak in the tree control on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
284
diff
changeset
|
6026 |
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
|
6027 /* |
30
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
22
diff
changeset
|
6028 * Removes all nodes from a tree. |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
22
diff
changeset
|
6029 * Parameters: |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
22
diff
changeset
|
6030 * handle: Handle to the window (widget) to be cleared. |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
22
diff
changeset
|
6031 */ |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
6032 void API dw_tree_clear(HWND handle) |
30
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
22
diff
changeset
|
6033 { |
291
70480069392b
Fixed memory leak in the tree control on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
284
diff
changeset
|
6034 HTREEITEM hti = TreeView_GetRoot(handle); |
70480069392b
Fixed memory leak in the tree control on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
284
diff
changeset
|
6035 |
388
6b573770f446
Stop select events during dw_tree_clear().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
371
diff
changeset
|
6036 dw_window_set_data(handle, "_dw_select_item", (void *)1); |
291
70480069392b
Fixed memory leak in the tree control on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
284
diff
changeset
|
6037 while(hti) |
70480069392b
Fixed memory leak in the tree control on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
284
diff
changeset
|
6038 { |
70480069392b
Fixed memory leak in the tree control on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
284
diff
changeset
|
6039 HTREEITEM lastitem = hti; |
70480069392b
Fixed memory leak in the tree control on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
284
diff
changeset
|
6040 |
70480069392b
Fixed memory leak in the tree control on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
284
diff
changeset
|
6041 _dw_tree_delete_recursive(handle, hti); |
70480069392b
Fixed memory leak in the tree control on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
284
diff
changeset
|
6042 hti = TreeView_GetNextSibling(handle, hti); |
328
e00aff2b899e
Tree item handles are now of the type HTREEITEM instead of HWND since they
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
321
diff
changeset
|
6043 dw_tree_delete(handle, lastitem); |
291
70480069392b
Fixed memory leak in the tree control on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
284
diff
changeset
|
6044 } |
388
6b573770f446
Stop select events during dw_tree_clear().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
371
diff
changeset
|
6045 dw_window_set_data(handle, "_dw_select_item", (void *)0); |
30
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
22
diff
changeset
|
6046 } |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
22
diff
changeset
|
6047 |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
22
diff
changeset
|
6048 /* |
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
|
6049 * 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
|
6050 * 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
|
6051 * 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
|
6052 * 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
|
6053 */ |
328
e00aff2b899e
Tree item handles are now of the type HTREEITEM instead of HWND since they
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
321
diff
changeset
|
6054 void API dw_tree_expand(HWND handle, HTREEITEM item) |
e00aff2b899e
Tree item handles are now of the type HTREEITEM instead of HWND since they
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
321
diff
changeset
|
6055 { |
e00aff2b899e
Tree item handles are now of the type HTREEITEM instead of HWND since they
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
321
diff
changeset
|
6056 TreeView_Expand(handle, item, TVE_EXPAND); |
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
|
6057 } |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
6058 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
6059 /* |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
6060 * 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
|
6061 * 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
|
6062 * 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
|
6063 * 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
|
6064 */ |
328
e00aff2b899e
Tree item handles are now of the type HTREEITEM instead of HWND since they
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
321
diff
changeset
|
6065 void API dw_tree_collapse(HWND handle, HTREEITEM item) |
e00aff2b899e
Tree item handles are now of the type HTREEITEM instead of HWND since they
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
321
diff
changeset
|
6066 { |
e00aff2b899e
Tree item handles are now of the type HTREEITEM instead of HWND since they
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
321
diff
changeset
|
6067 TreeView_Expand(handle, item, TVE_COLLAPSE); |
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
|
6068 } |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
6069 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
6070 /* |
30
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
22
diff
changeset
|
6071 * Removes a node from a tree. |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
22
diff
changeset
|
6072 * Parameters: |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
22
diff
changeset
|
6073 * handle: Handle to the window (widget) to be cleared. |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
22
diff
changeset
|
6074 * item: Handle to node to be deleted. |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
22
diff
changeset
|
6075 */ |
328
e00aff2b899e
Tree item handles are now of the type HTREEITEM instead of HWND since they
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
321
diff
changeset
|
6076 void API dw_tree_delete(HWND handle, HTREEITEM item) |
30
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
22
diff
changeset
|
6077 { |
291
70480069392b
Fixed memory leak in the tree control on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
284
diff
changeset
|
6078 TVITEM tvi; |
70480069392b
Fixed memory leak in the tree control on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
284
diff
changeset
|
6079 void **ptrs; |
70480069392b
Fixed memory leak in the tree control on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
284
diff
changeset
|
6080 |
328
e00aff2b899e
Tree item handles are now of the type HTREEITEM instead of HWND since they
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
321
diff
changeset
|
6081 if(item == TVI_ROOT || !item) |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
59
diff
changeset
|
6082 return; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
59
diff
changeset
|
6083 |
291
70480069392b
Fixed memory leak in the tree control on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
284
diff
changeset
|
6084 tvi.mask = TVIF_HANDLE; |
328
e00aff2b899e
Tree item handles are now of the type HTREEITEM instead of HWND since they
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
321
diff
changeset
|
6085 tvi.hItem = item; |
291
70480069392b
Fixed memory leak in the tree control on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
284
diff
changeset
|
6086 |
70480069392b
Fixed memory leak in the tree control on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
284
diff
changeset
|
6087 if(TreeView_GetItem(handle, &tvi)) |
70480069392b
Fixed memory leak in the tree control on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
284
diff
changeset
|
6088 ptrs = (void **)tvi.lParam; |
70480069392b
Fixed memory leak in the tree control on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
284
diff
changeset
|
6089 |
328
e00aff2b899e
Tree item handles are now of the type HTREEITEM instead of HWND since they
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
321
diff
changeset
|
6090 _dw_tree_delete_recursive(handle, item); |
e00aff2b899e
Tree item handles are now of the type HTREEITEM instead of HWND since they
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
321
diff
changeset
|
6091 TreeView_DeleteItem(handle, item); |
291
70480069392b
Fixed memory leak in the tree control on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
284
diff
changeset
|
6092 if(ptrs) |
70480069392b
Fixed memory leak in the tree control on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
284
diff
changeset
|
6093 free(ptrs); |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6094 } |
30
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
22
diff
changeset
|
6095 |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
22
diff
changeset
|
6096 /* |
3 | 6097 * Sets up the container columns. |
6098 * Parameters: | |
6099 * handle: Handle to the container to be configured. | |
6100 * flags: An array of unsigned longs with column flags. | |
6101 * titles: An array of strings with column text titles. | |
6102 * count: The number of columns (this should match the arrays). | |
6103 * separator: The column number that contains the main separator. | |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6104 * (only used on OS/2 but must be >= 0 on all) |
3 | 6105 */ |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
6106 int API dw_container_setup(HWND handle, unsigned long *flags, char **titles, int count, int separator) |
3 | 6107 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6108 ContainerInfo *cinfo = (ContainerInfo *)GetWindowLong(handle, GWL_USERDATA); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6109 int z, l = 0; |
105
ad95fc623ff3
Some changes to the container optimization code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
104
diff
changeset
|
6110 unsigned long *tempflags = calloc(sizeof(unsigned long), count + 2); |
355
3a71623fc219
Changes to implement justification on container columns.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
351
diff
changeset
|
6111 LVCOLUMN lvc; |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6112 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6113 if(separator == -1) |
105
ad95fc623ff3
Some changes to the container optimization code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
104
diff
changeset
|
6114 { |
ad95fc623ff3
Some changes to the container optimization code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
104
diff
changeset
|
6115 tempflags[0] = DW_CFA_RESERVED; |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6116 l = 1; |
105
ad95fc623ff3
Some changes to the container optimization code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
104
diff
changeset
|
6117 } |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6118 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6119 memcpy(&tempflags[l], flags, sizeof(unsigned long) * count); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6120 tempflags[count + l] = 0; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6121 cinfo->flags = tempflags; |
71
291c30a92b9b
Fixed a bug where if dw_filesystem_* was used then the last column
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
6122 cinfo->columns = count + l; |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6123 |
3 | 6124 |
6125 for(z=0;z<count;z++) | |
6126 { | |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6127 if(titles[z]) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6128 { |
355
3a71623fc219
Changes to implement justification on container columns.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
351
diff
changeset
|
6129 lvc.mask = LVCF_TEXT | LVCF_WIDTH | LVCF_SUBITEM | LVCF_FMT; |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6130 lvc.pszText = titles[z]; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6131 lvc.cchTextMax = strlen(titles[z]); |
355
3a71623fc219
Changes to implement justification on container columns.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
351
diff
changeset
|
6132 if(flags[z] & DW_CFA_RIGHT) |
3a71623fc219
Changes to implement justification on container columns.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
351
diff
changeset
|
6133 lvc.fmt = LVCFMT_RIGHT; |
3a71623fc219
Changes to implement justification on container columns.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
351
diff
changeset
|
6134 else if(flags[z] & DW_CFA_CENTER) |
3a71623fc219
Changes to implement justification on container columns.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
351
diff
changeset
|
6135 lvc.fmt = LVCFMT_CENTER; |
3a71623fc219
Changes to implement justification on container columns.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
351
diff
changeset
|
6136 else |
3a71623fc219
Changes to implement justification on container columns.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
351
diff
changeset
|
6137 lvc.fmt = LVCFMT_LEFT; |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6138 lvc.cx = 75; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6139 lvc.iSubItem = count; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6140 SendMessage(handle, LVM_INSERTCOLUMN, (WPARAM)z + l, (LPARAM)&lvc); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6141 } |
3 | 6142 } |
168
627e531ca530
Allow subitems to have icons so the container controls will be the same
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
167
diff
changeset
|
6143 ListView_SetExtendedListViewStyle(handle, LVS_EX_FULLROWSELECT | LVS_EX_SUBITEMIMAGES); |
3 | 6144 return TRUE; |
6145 } | |
6146 | |
6147 /* | |
6148 * Sets up the filesystem columns, note: filesystem always has an icon/filename field. | |
6149 * Parameters: | |
6150 * handle: Handle to the container to be configured. | |
6151 * flags: An array of unsigned longs with column flags. | |
6152 * titles: An array of strings with column text titles. | |
6153 * count: The number of columns (this should match the arrays). | |
6154 */ | |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
6155 int API dw_filesystem_setup(HWND handle, unsigned long *flags, char **titles, int count) |
3 | 6156 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6157 LV_COLUMN lvc; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6158 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6159 lvc.mask = LVCF_TEXT | LVCF_WIDTH | LVCF_SUBITEM; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6160 lvc.pszText = "Filename"; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6161 lvc.cchTextMax = 8; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6162 lvc.fmt = 0; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6163 if(!count) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6164 lvc.cx = 300; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6165 else |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6166 lvc.cx = 150; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6167 lvc.iSubItem = count; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6168 SendMessage(handle, LVM_INSERTCOLUMN, (WPARAM)0, (LPARAM)&lvc); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6169 dw_container_setup(handle, flags, titles, count, -1); |
3 | 6170 return TRUE; |
6171 } | |
6172 | |
6173 /* | |
6174 * Obtains an icon from a module (or header in GTK). | |
6175 * Parameters: | |
6176 * module: Handle to module (DLL) in OS/2 and Windows. | |
6177 * id: A unsigned long id int the resources on OS/2 and | |
6178 * Windows, on GTK this is converted to a pointer | |
6179 * to an embedded XPM. | |
6180 */ | |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
6181 unsigned long API dw_icon_load(unsigned long module, unsigned long id) |
3 | 6182 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6183 return (unsigned long)LoadIcon(DWInstance, MAKEINTRESOURCE(id)); |
3 | 6184 } |
6185 | |
6186 /* | |
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:
248
diff
changeset
|
6187 * 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:
248
diff
changeset
|
6188 * 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:
248
diff
changeset
|
6189 * 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:
248
diff
changeset
|
6190 * 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:
248
diff
changeset
|
6191 * (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:
248
diff
changeset
|
6192 */ |
9ea4ac9a097f
Added dw_icon_load_from_file() on OS/2 and Windows. Added a stub on Unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
248
diff
changeset
|
6193 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:
248
diff
changeset
|
6194 { |
9ea4ac9a097f
Added dw_icon_load_from_file() on OS/2 and Windows. Added a stub on Unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
248
diff
changeset
|
6195 char *file = malloc(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:
248
diff
changeset
|
6196 HANDLE icon; |
9ea4ac9a097f
Added dw_icon_load_from_file() on OS/2 and Windows. Added a stub on Unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
248
diff
changeset
|
6197 |
9ea4ac9a097f
Added dw_icon_load_from_file() on OS/2 and Windows. Added a stub on Unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
248
diff
changeset
|
6198 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:
248
diff
changeset
|
6199 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:
248
diff
changeset
|
6200 |
9ea4ac9a097f
Added dw_icon_load_from_file() on OS/2 and Windows. Added a stub on Unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
248
diff
changeset
|
6201 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:
248
diff
changeset
|
6202 |
9ea4ac9a097f
Added dw_icon_load_from_file() on OS/2 and Windows. Added a stub on Unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
248
diff
changeset
|
6203 /* 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:
248
diff
changeset
|
6204 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:
248
diff
changeset
|
6205 { |
9ea4ac9a097f
Added dw_icon_load_from_file() on OS/2 and Windows. Added a stub on Unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
248
diff
changeset
|
6206 /* 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:
248
diff
changeset
|
6207 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:
248
diff
changeset
|
6208 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:
248
diff
changeset
|
6209 { |
9ea4ac9a097f
Added dw_icon_load_from_file() on OS/2 and Windows. Added a stub on Unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
248
diff
changeset
|
6210 free(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:
248
diff
changeset
|
6211 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:
248
diff
changeset
|
6212 } |
9ea4ac9a097f
Added dw_icon_load_from_file() on OS/2 and Windows. Added a stub on Unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
248
diff
changeset
|
6213 } |
9ea4ac9a097f
Added dw_icon_load_from_file() on OS/2 and Windows. Added a stub on Unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
248
diff
changeset
|
6214 icon = LoadImage(NULL, file, IMAGE_ICON, 0, 0, LR_LOADFROMFILE); |
9ea4ac9a097f
Added dw_icon_load_from_file() on OS/2 and Windows. Added a stub on Unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
248
diff
changeset
|
6215 free(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:
248
diff
changeset
|
6216 return (unsigned long)icon; |
9ea4ac9a097f
Added dw_icon_load_from_file() on OS/2 and Windows. Added a stub on Unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
248
diff
changeset
|
6217 } |
9ea4ac9a097f
Added dw_icon_load_from_file() on OS/2 and Windows. Added a stub on Unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
248
diff
changeset
|
6218 |
9ea4ac9a097f
Added dw_icon_load_from_file() on OS/2 and Windows. Added a stub on Unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
248
diff
changeset
|
6219 /* |
3 | 6220 * Frees a loaded resource in OS/2 and Windows. |
6221 * Parameters: | |
6222 * handle: Handle to icon returned by dw_icon_load(). | |
6223 */ | |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
6224 void API dw_icon_free(unsigned long handle) |
3 | 6225 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6226 DestroyIcon((HICON)handle); |
3 | 6227 } |
6228 | |
6229 /* | |
6230 * Allocates memory used to populate a container. | |
6231 * Parameters: | |
6232 * handle: Handle to the container window (widget). | |
6233 * rowcount: The number of items to be populated. | |
6234 */ | |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
6235 void * API dw_container_alloc(HWND handle, int rowcount) |
3 | 6236 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6237 LV_ITEM lvi; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6238 int z; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6239 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6240 lvi.mask = LVIF_DI_SETITEM | LVIF_TEXT | LVIF_IMAGE; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6241 lvi.iSubItem = 0; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6242 /* Insert at the end */ |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6243 lvi.iItem = 1000000; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6244 lvi.pszText = ""; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6245 lvi.cchTextMax = 1; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6246 lvi.iImage = -1; |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
6247 |
79
8082cb0e7c2e
Updated to the latest DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
75
diff
changeset
|
6248 ShowWindow(handle, SW_HIDE); |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
6249 for(z=0;z<rowcount;z++) |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6250 ListView_InsertItem(handle, &lvi); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6251 return (void *)handle; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6252 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6253 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6254 /* Finds a icon in the table, otherwise it adds it to the table |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6255 * and returns the index in the table. |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6256 */ |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6257 int _lookup_icon(HWND handle, HICON hicon, int type) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6258 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6259 int z; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6260 static HWND lasthwnd = NULL; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6261 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6262 if(!hSmall || !hLarge) |
3 | 6263 { |
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
|
6264 hSmall = ImageList_Create(16, 16, ILC_COLOR16 | ILC_MASK, ICON_INDEX_LIMIT, 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
|
6265 hLarge = ImageList_Create(32, 32, ILC_COLOR16 | ILC_MASK, ICON_INDEX_LIMIT, 0); |
3 | 6266 } |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6267 for(z=0;z<ICON_INDEX_LIMIT;z++) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6268 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6269 if(!lookup[z]) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6270 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6271 lookup[z] = hicon; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6272 ImageList_AddIcon(hSmall, hicon); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6273 ImageList_AddIcon(hLarge, hicon); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6274 if(type) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6275 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6276 TreeView_SetImageList(handle, hSmall, TVSIL_NORMAL); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6277 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6278 else |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6279 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6280 ListView_SetImageList(handle, hSmall, LVSIL_SMALL); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6281 ListView_SetImageList(handle, hLarge, LVSIL_NORMAL); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6282 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6283 lasthwnd = handle; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6284 return z; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6285 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6286 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6287 if(hicon == lookup[z]) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6288 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6289 if(lasthwnd != handle) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6290 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6291 if(type) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6292 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6293 TreeView_SetImageList(handle, hSmall, TVSIL_NORMAL); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6294 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6295 else |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6296 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6297 ListView_SetImageList(handle, hSmall, LVSIL_SMALL); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6298 ListView_SetImageList(handle, hLarge, LVSIL_NORMAL); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6299 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6300 lasthwnd = handle; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6301 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6302 return z; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6303 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6304 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6305 return -1; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6306 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6307 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6308 /* |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6309 * Sets an item in specified row and column to the given data. |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6310 * Parameters: |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6311 * handle: Handle to the container window (widget). |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6312 * pointer: Pointer to the allocated memory in dw_container_alloc(). |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6313 * column: Zero based column of data being set. |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6314 * row: Zero based row of data being set. |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6315 * data: Pointer to the data to be added. |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6316 */ |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
6317 void API dw_filesystem_set_file(HWND handle, void *pointer, int row, char *filename, unsigned long icon) |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6318 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6319 LV_ITEM lvi; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6320 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6321 lvi.iItem = row; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6322 lvi.iSubItem = 0; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6323 lvi.mask = LVIF_DI_SETITEM | LVIF_IMAGE | LVIF_TEXT; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6324 lvi.pszText = filename; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6325 lvi.cchTextMax = strlen(filename); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6326 lvi.iImage = _lookup_icon(handle, (HICON)icon, 0); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6327 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6328 ListView_SetItem(handle, &lvi); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6329 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6330 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6331 /* |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6332 * Sets an item in specified row and column to the given data. |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6333 * Parameters: |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6334 * handle: Handle to the container window (widget). |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6335 * pointer: Pointer to the allocated memory in dw_container_alloc(). |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6336 * column: Zero based column of data being set. |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6337 * row: Zero based row of data being set. |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6338 * data: Pointer to the data to be added. |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6339 */ |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
6340 void API dw_filesystem_set_item(HWND handle, void *pointer, int column, int row, void *data) |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6341 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6342 dw_container_set_item(handle, pointer, column + 1, row, data); |
3 | 6343 } |
6344 | |
6345 /* | |
6346 * Sets an item in specified row and column to the given data. | |
6347 * Parameters: | |
6348 * handle: Handle to the container window (widget). | |
6349 * pointer: Pointer to the allocated memory in dw_container_alloc(). | |
6350 * column: Zero based column of data being set. | |
6351 * row: Zero based row of data being set. | |
6352 * data: Pointer to the data to be added. | |
6353 */ | |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
6354 void API dw_container_set_item(HWND handle, void *pointer, int column, int row, void *data) |
3 | 6355 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6356 ContainerInfo *cinfo = (ContainerInfo *)GetWindowLong(handle, GWL_USERDATA); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6357 ULONG *flags; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6358 LV_ITEM lvi; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6359 char textbuffer[100], *destptr = textbuffer; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6360 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6361 if(!cinfo || !cinfo->flags || !data) |
3 | 6362 return; |
6363 | |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6364 flags = cinfo->flags; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6365 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6366 lvi.mask = LVIF_DI_SETITEM | LVIF_TEXT; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6367 lvi.iItem = row; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6368 lvi.iSubItem = column; |
3 | 6369 |
6370 if(flags[column] & DW_CFA_BITMAPORICON) | |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6371 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6372 HICON hicon = *((HICON *)data); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6373 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6374 lvi.mask = LVIF_DI_SETITEM | LVIF_IMAGE; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6375 lvi.pszText = NULL; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6376 lvi.cchTextMax = 0; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6377 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6378 lvi.iImage = _lookup_icon(handle, hicon, 0); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6379 } |
3 | 6380 else if(flags[column] & DW_CFA_STRING) |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6381 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6382 char *tmp = *((char **)data); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6383 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6384 if(!tmp) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6385 tmp = ""; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6386 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6387 lvi.pszText = tmp; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6388 lvi.cchTextMax = strlen(tmp); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6389 destptr = tmp; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6390 } |
3 | 6391 else if(flags[column] & DW_CFA_ULONG) |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6392 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6393 ULONG tmp = *((ULONG *)data); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6394 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6395 sprintf(textbuffer, "%lu", tmp); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6396 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6397 lvi.pszText = textbuffer; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6398 lvi.cchTextMax = strlen(textbuffer); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6399 } |
3 | 6400 else if(flags[column] & DW_CFA_DATE) |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6401 { |
165
d03716228b7f
Use strftime to display time and date on Windows and unix.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
161
diff
changeset
|
6402 struct tm curtm; |
d03716228b7f
Use strftime to display time and date on Windows and unix.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
161
diff
changeset
|
6403 CDATE cdate = *((CDATE *)data); |
d03716228b7f
Use strftime to display time and date on Windows and unix.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
161
diff
changeset
|
6404 |
d03716228b7f
Use strftime to display time and date on Windows and unix.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
161
diff
changeset
|
6405 curtm.tm_mday = cdate.day; |
d03716228b7f
Use strftime to display time and date on Windows and unix.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
161
diff
changeset
|
6406 curtm.tm_mon = cdate.month - 1; |
d03716228b7f
Use strftime to display time and date on Windows and unix.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
161
diff
changeset
|
6407 curtm.tm_year = cdate.year - 1900; |
d03716228b7f
Use strftime to display time and date on Windows and unix.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
161
diff
changeset
|
6408 |
d03716228b7f
Use strftime to display time and date on Windows and unix.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
161
diff
changeset
|
6409 strftime(textbuffer, 100, "%x", &curtm); |
d03716228b7f
Use strftime to display time and date on Windows and unix.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
161
diff
changeset
|
6410 |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6411 lvi.pszText = textbuffer; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6412 lvi.cchTextMax = strlen(textbuffer); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6413 } |
3 | 6414 else if(flags[column] & DW_CFA_TIME) |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6415 { |
165
d03716228b7f
Use strftime to display time and date on Windows and unix.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
161
diff
changeset
|
6416 struct tm curtm; |
d03716228b7f
Use strftime to display time and date on Windows and unix.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
161
diff
changeset
|
6417 CTIME ctime = *((CTIME *)data); |
d03716228b7f
Use strftime to display time and date on Windows and unix.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
161
diff
changeset
|
6418 |
d03716228b7f
Use strftime to display time and date on Windows and unix.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
161
diff
changeset
|
6419 curtm.tm_hour = ctime.hours; |
d03716228b7f
Use strftime to display time and date on Windows and unix.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
161
diff
changeset
|
6420 curtm.tm_min = ctime.minutes; |
d03716228b7f
Use strftime to display time and date on Windows and unix.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
161
diff
changeset
|
6421 curtm.tm_sec = ctime.seconds; |
d03716228b7f
Use strftime to display time and date on Windows and unix.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
161
diff
changeset
|
6422 |
d03716228b7f
Use strftime to display time and date on Windows and unix.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
161
diff
changeset
|
6423 strftime(textbuffer, 100, "%X", &curtm); |
d03716228b7f
Use strftime to display time and date on Windows and unix.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
161
diff
changeset
|
6424 |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6425 lvi.pszText = textbuffer; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6426 lvi.cchTextMax = strlen(textbuffer); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6427 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6428 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6429 ListView_SetItem(handle, &lvi); |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
17
diff
changeset
|
6430 } |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
17
diff
changeset
|
6431 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
17
diff
changeset
|
6432 /* |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
6433 * Changes an existing item in specified row and column to the given data. |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
6434 * Parameters: |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
6435 * handle: Handle to the container window (widget). |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
6436 * column: Zero based column of data being set. |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
6437 * row: Zero based row of data being set. |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
6438 * data: Pointer to the data to be added. |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
6439 */ |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
6440 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:
165
diff
changeset
|
6441 { |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
6442 dw_container_set_item(handle, NULL, column, row, data); |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
6443 } |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
6444 |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
6445 /* |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
17
diff
changeset
|
6446 * 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:
17
diff
changeset
|
6447 * Parameters: |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
17
diff
changeset
|
6448 * 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:
17
diff
changeset
|
6449 * 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:
17
diff
changeset
|
6450 * 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:
17
diff
changeset
|
6451 */ |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
6452 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:
17
diff
changeset
|
6453 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6454 ListView_SetColumnWidth(handle, column, width); |
3 | 6455 } |
6456 | |
6457 /* | |
6458 * Sets the title of a row in the container. | |
6459 * Parameters: | |
6460 * pointer: Pointer to the allocated memory in dw_container_alloc(). | |
6461 * row: Zero based row of data being set. | |
6462 * title: String title of the item. | |
6463 */ | |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
6464 void API dw_container_set_row_title(void *pointer, int row, char *title) |
3 | 6465 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6466 LV_ITEM lvi; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6467 HWND container = (HWND)pointer; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6468 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6469 lvi.iItem = row; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6470 lvi.iSubItem = 0; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6471 lvi.mask = LVIF_PARAM; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6472 lvi.lParam = (LPARAM)title; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6473 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6474 if(!ListView_SetItem(container, &lvi) && lvi.lParam) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6475 lvi.lParam = 0; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6476 |
3 | 6477 } |
6478 | |
6479 /* | |
6480 * Sets the title of a row in the container. | |
6481 * Parameters: | |
6482 * handle: Handle to the container window (widget). | |
6483 * pointer: Pointer to the allocated memory in dw_container_alloc(). | |
6484 * rowcount: The number of rows to be inserted. | |
6485 */ | |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
6486 void API dw_container_insert(HWND handle, void *pointer, int rowcount) |
3 | 6487 { |
79
8082cb0e7c2e
Updated to the latest DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
75
diff
changeset
|
6488 ShowWindow(handle, SW_SHOW); |
3 | 6489 } |
6490 | |
6491 /* | |
6492 * Removes all rows from a container. | |
6493 * Parameters: | |
6494 * 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
|
6495 * 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
|
6496 */ |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
6497 void API dw_container_clear(HWND handle, int redraw) |
3 | 6498 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6499 ListView_DeleteAllItems(handle); |
3 | 6500 } |
6501 | |
6502 /* | |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
17
diff
changeset
|
6503 * 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:
17
diff
changeset
|
6504 * Parameters: |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
17
diff
changeset
|
6505 * 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:
17
diff
changeset
|
6506 * 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:
17
diff
changeset
|
6507 */ |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
6508 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:
17
diff
changeset
|
6509 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6510 int z; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6511 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6512 for(z=0;z<rowcount;z++) |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
17
diff
changeset
|
6513 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6514 ListView_DeleteItem(handle, 0); |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
17
diff
changeset
|
6515 } |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
17
diff
changeset
|
6516 } |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
17
diff
changeset
|
6517 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
17
diff
changeset
|
6518 /* |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
17
diff
changeset
|
6519 * 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:
17
diff
changeset
|
6520 * Parameters: |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
17
diff
changeset
|
6521 * 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:
17
diff
changeset
|
6522 * 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:
17
diff
changeset
|
6523 * 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:
17
diff
changeset
|
6524 * 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:
17
diff
changeset
|
6525 */ |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
6526 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:
17
diff
changeset
|
6527 { |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
17
diff
changeset
|
6528 switch(direction) |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
17
diff
changeset
|
6529 { |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
17
diff
changeset
|
6530 case DW_SCROLL_TOP: |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6531 ListView_Scroll(handle, 0, -10000000); |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
17
diff
changeset
|
6532 break; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
17
diff
changeset
|
6533 case DW_SCROLL_BOTTOM: |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6534 ListView_Scroll(handle, 0, 10000000); |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
17
diff
changeset
|
6535 break; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
17
diff
changeset
|
6536 } |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
17
diff
changeset
|
6537 } |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
17
diff
changeset
|
6538 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
17
diff
changeset
|
6539 /* |
3 | 6540 * Starts a new query of a container. |
6541 * Parameters: | |
6542 * handle: Handle to the window (widget) to be queried. | |
6543 * flags: If this parameter is DW_CRA_SELECTED it will only | |
6544 * return items that are currently selected. Otherwise | |
6545 * it will return all records in the container. | |
6546 */ | |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
6547 char * API dw_container_query_start(HWND handle, unsigned long flags) |
3 | 6548 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6549 LV_ITEM lvi; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6550 |
69
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6551 _index = ListView_GetNextItem(handle, -1, flags); |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6552 |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6553 if(_index == -1) |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6554 return NULL; |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6555 |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6556 memset(&lvi, 0, sizeof(LV_ITEM)); |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6557 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6558 lvi.iItem = _index; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6559 lvi.mask = LVIF_PARAM; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6560 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6561 ListView_GetItem(handle, &lvi); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6562 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6563 return (char *)lvi.lParam; |
3 | 6564 } |
6565 | |
6566 /* | |
6567 * Continues an existing query of a container. | |
6568 * Parameters: | |
6569 * handle: Handle to the window (widget) to be queried. | |
6570 * flags: If this parameter is DW_CRA_SELECTED it will only | |
6571 * return items that are currently selected. Otherwise | |
6572 * it will return all records in the container. | |
6573 */ | |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
6574 char * API dw_container_query_next(HWND handle, unsigned long flags) |
3 | 6575 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6576 LV_ITEM lvi; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6577 |
69
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6578 _index = ListView_GetNextItem(handle, _index, flags); |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6579 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6580 if(_index == -1) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6581 return NULL; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6582 |
69
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6583 memset(&lvi, 0, sizeof(LV_ITEM)); |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6584 |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6585 lvi.iItem = _index; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6586 lvi.mask = LVIF_PARAM; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6587 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6588 ListView_GetItem(handle, &lvi); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6589 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6590 return (char *)lvi.lParam; |
3 | 6591 } |
6592 | |
6593 /* | |
69
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6594 * 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
|
6595 * Parameters: |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6596 * 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
|
6597 * 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
|
6598 */ |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
6599 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
|
6600 { |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6601 int index = ListView_GetNextItem(handle, -1, LVNI_ALL); |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6602 |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6603 while(index != -1) |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6604 { |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6605 LV_ITEM lvi; |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6606 |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6607 memset(&lvi, 0, sizeof(LV_ITEM)); |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6608 |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6609 lvi.iItem = index; |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6610 lvi.mask = LVIF_PARAM; |
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 ListView_GetItem(handle, &lvi); |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6613 |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6614 if((char *)lvi.lParam == text) |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6615 { |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6616 RECT viewport, item; |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6617 |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6618 ListView_SetItemState(handle, index, LVIS_FOCUSED | LVIS_SELECTED, LVIS_FOCUSED | LVIS_SELECTED); |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6619 ListView_EnsureVisible(handle, index, TRUE); |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6620 return; |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6621 } |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6622 |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6623 index = ListView_GetNextItem(handle, index, LVNI_ALL); |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6624 } |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6625 } |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6626 |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6627 /* |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
6628 * Deletes the item with the text speficied. |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
6629 * Parameters: |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
6630 * handle: Handle to the window (widget). |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
6631 * text: Text usually returned by dw_container_query(). |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
6632 */ |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
6633 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:
165
diff
changeset
|
6634 { |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
6635 int index = ListView_GetNextItem(handle, -1, LVNI_ALL); |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
6636 |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
6637 while(index != -1) |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
6638 { |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
6639 LV_ITEM lvi; |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
6640 |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
6641 memset(&lvi, 0, sizeof(LV_ITEM)); |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
6642 |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
6643 lvi.iItem = index; |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
6644 lvi.mask = LVIF_PARAM; |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
6645 |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
6646 ListView_GetItem(handle, &lvi); |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
6647 |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
6648 if((char *)lvi.lParam == text) |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
6649 { |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
6650 ListView_DeleteItem(handle, index); |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
6651 return; |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
6652 } |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
6653 |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
6654 index = ListView_GetNextItem(handle, index, LVNI_ALL); |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
6655 } |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
6656 } |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
6657 |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
165
diff
changeset
|
6658 /* |
69
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6659 * 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
|
6660 * Parameters: |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6661 * 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
|
6662 */ |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
6663 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
|
6664 { |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6665 ContainerInfo *cinfo = (ContainerInfo *)GetWindowLong(handle, GWL_USERDATA); |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6666 ULONG *flags; |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6667 LV_ITEM lvi; |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6668 |
102
372a7581b312
Minor changes to the container code on windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
95
diff
changeset
|
6669 if(cinfo && cinfo->columns == 1) |
372a7581b312
Minor changes to the container code on windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
95
diff
changeset
|
6670 { |
372a7581b312
Minor changes to the container code on windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
95
diff
changeset
|
6671 ListView_SetColumnWidth(handle, 0, LVSCW_AUTOSIZE); |
372a7581b312
Minor changes to the container code on windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
95
diff
changeset
|
6672 } |
372a7581b312
Minor changes to the container code on windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
95
diff
changeset
|
6673 else if(cinfo && cinfo->columns > 1) |
69
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6674 { |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6675 int z, index; |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6676 ULONG *flags = cinfo->flags, *columns = calloc(sizeof(ULONG), cinfo->columns); |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6677 char *text = malloc(1024); |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6678 |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6679 /* Initialize with sizes of column labels */ |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6680 for(z=0;z<cinfo->columns;z++) |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6681 { |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6682 if(flags[z] & DW_CFA_BITMAPORICON) |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6683 columns[z] = 5; |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6684 else |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6685 { |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6686 LVCOLUMN lvc; |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6687 |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6688 lvc.mask = LVCF_TEXT; |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6689 lvc.cchTextMax = 1023; |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6690 lvc.pszText = text; |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6691 |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6692 if(ListView_GetColumn(handle, z, &lvc)) |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6693 columns[z] = ListView_GetStringWidth(handle, lvc.pszText); |
105
ad95fc623ff3
Some changes to the container optimization code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
104
diff
changeset
|
6694 |
ad95fc623ff3
Some changes to the container optimization code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
104
diff
changeset
|
6695 if(flags[z] & DW_CFA_RESERVED) |
ad95fc623ff3
Some changes to the container optimization code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
104
diff
changeset
|
6696 columns[z] += 20; |
69
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6697 } |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6698 } |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6699 |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6700 index = ListView_GetNextItem(handle, -1, LVNI_ALL); |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6701 |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6702 /* Query all the item texts */ |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6703 while(index != -1) |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6704 { |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6705 for(z=0;z<cinfo->columns;z++) |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6706 { |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6707 LV_ITEM lvi; |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6708 |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6709 memset(&lvi, 0, sizeof(LV_ITEM)); |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6710 |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6711 lvi.iItem = index; |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6712 lvi.iSubItem = z; |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6713 lvi.mask = LVIF_TEXT; |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6714 lvi.cchTextMax = 1023; |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6715 lvi.pszText = text; |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6716 |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6717 if(ListView_GetItem(handle, &lvi)) |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6718 { |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6719 int width = ListView_GetStringWidth(handle, lvi.pszText); |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6720 if(width > columns[z]) |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6721 { |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6722 if(z == 0) |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6723 columns[z] = width + 20; |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6724 else |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6725 columns[z] = width; |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6726 } |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6727 } |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6728 } |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6729 |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6730 index = ListView_GetNextItem(handle, index, LVNI_ALL); |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6731 } |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6732 |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6733 /* Set the new sizes */ |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6734 for(z=0;z<cinfo->columns;z++) |
71
291c30a92b9b
Fixed a bug where if dw_filesystem_* was used then the last column
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
6735 ListView_SetColumnWidth(handle, z, columns[z] + 16); |
69
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6736 |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6737 free(columns); |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6738 free(text); |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6739 } |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6740 } |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6741 |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6742 /* |
3 | 6743 * Creates a rendering context widget (window) to be packed. |
6744 * Parameters: | |
6745 * id: An id to be used with dw_window_from_id. | |
6746 * Returns: | |
6747 * A handle to the widget or NULL on failure. | |
6748 */ | |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
6749 HWND API dw_render_new(unsigned long id) |
3 | 6750 { |
90
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
6751 Box *newbox = calloc(sizeof(Box), 1); |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6752 HWND tmp = CreateWindow(ObjectClassName, |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6753 "", |
107
cd0e5cf92f6a
Rewrote the Windows packing code so it is more like OS/2 to improve window
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
106
diff
changeset
|
6754 WS_VISIBLE | WS_CHILD | WS_CLIPCHILDREN, |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6755 0,0,2000,1000, |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6756 DW_HWND_OBJECT, |
119
1cad81b7cc4c
Implemented initial splitbar code on Unix. And made some fixes for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
118
diff
changeset
|
6757 (HMENU)id, |
109
94d273843a41
Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
107
diff
changeset
|
6758 DWInstance, |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6759 NULL); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6760 newbox->pad = 0; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6761 newbox->type = 0; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6762 newbox->count = 0; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6763 newbox->grouphwnd = (HWND)NULL; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6764 newbox->cinfo.pOldProc = SubclassWindow(tmp, _rendwndproc); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6765 newbox->cinfo.fore = newbox->cinfo.back = -1; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6766 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6767 SetWindowLong(tmp, GWL_USERDATA, (ULONG)newbox); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6768 return tmp; |
3 | 6769 } |
6770 | |
6771 /* Sets the current foreground drawing color. | |
6772 * Parameters: | |
6773 * red: red value. | |
6774 * green: green value. | |
6775 * blue: blue value. | |
6776 */ | |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
6777 void API dw_color_foreground_set(unsigned long value) |
3 | 6778 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6779 int threadid = dw_thread_id(); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6780 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6781 if(threadid < 0 || threadid >= THREAD_LIMIT) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6782 threadid = 0; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6783 |
191
634625c3239d
Fixes for dw_color_xxxx_set() to accept OS/2 style colors, and fixed a
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
185
diff
changeset
|
6784 value = _internal_color(value); |
634625c3239d
Fixes for dw_color_xxxx_set() to accept OS/2 style colors, and fixed a
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
185
diff
changeset
|
6785 |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6786 DeleteObject(_hPen[threadid]); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6787 DeleteObject(_hBrush[threadid]); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6788 _foreground[threadid] = RGB(DW_RED_VALUE(value), DW_GREEN_VALUE(value), DW_BLUE_VALUE(value)); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6789 _hPen[threadid] = CreatePen(PS_SOLID, 1, _foreground[threadid]); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6790 _hBrush[threadid] = CreateSolidBrush(_foreground[threadid]); |
3 | 6791 } |
6792 | |
6793 /* Sets the current background drawing color. | |
6794 * Parameters: | |
6795 * red: red value. | |
6796 * green: green value. | |
6797 * blue: blue value. | |
6798 */ | |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
6799 void API dw_color_background_set(unsigned long value) |
3 | 6800 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6801 int threadid = dw_thread_id(); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6802 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6803 if(threadid < 0 || threadid >= THREAD_LIMIT) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6804 threadid = 0; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6805 |
191
634625c3239d
Fixes for dw_color_xxxx_set() to accept OS/2 style colors, and fixed a
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
185
diff
changeset
|
6806 value = _internal_color(value); |
634625c3239d
Fixes for dw_color_xxxx_set() to accept OS/2 style colors, and fixed a
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
185
diff
changeset
|
6807 |
370
e5156e7e5f19
Fixes for background set to DW_CLR_DEFAULT.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
369
diff
changeset
|
6808 if(value == DW_RGB_TRANSPARENT) |
e5156e7e5f19
Fixes for background set to DW_CLR_DEFAULT.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
369
diff
changeset
|
6809 _background[threadid] = DW_RGB_TRANSPARENT; |
e5156e7e5f19
Fixes for background set to DW_CLR_DEFAULT.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
369
diff
changeset
|
6810 else |
e5156e7e5f19
Fixes for background set to DW_CLR_DEFAULT.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
369
diff
changeset
|
6811 _background[threadid] = RGB(DW_RED_VALUE(value), DW_GREEN_VALUE(value), DW_BLUE_VALUE(value)); |
3 | 6812 } |
6813 | |
6814 /* Draw a point on a window (preferably a render window). | |
6815 * Parameters: | |
6816 * handle: Handle to the window. | |
6817 * pixmap: Handle to the pixmap. (choose only one of these) | |
6818 * x: X coordinate. | |
6819 * y: Y coordinate. | |
6820 */ | |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
6821 void API dw_draw_point(HWND handle, HPIXMAP pixmap, int x, int y) |
3 | 6822 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6823 HDC hdcPaint; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6824 int threadid = dw_thread_id(); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6825 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6826 if(threadid < 0 || threadid >= THREAD_LIMIT) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6827 threadid = 0; |
3 | 6828 |
6829 if(handle) | |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6830 hdcPaint = GetDC(handle); |
3 | 6831 else if(pixmap) |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6832 hdcPaint = pixmap->hdc; |
3 | 6833 else |
6834 return; | |
6835 | |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6836 SetPixel(hdcPaint, x, y, _foreground[threadid]); |
3 | 6837 if(!pixmap) |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6838 ReleaseDC(handle, hdcPaint); |
3 | 6839 } |
6840 | |
6841 /* Draw a line on a window (preferably a render window). | |
6842 * Parameters: | |
6843 * handle: Handle to the window. | |
6844 * pixmap: Handle to the pixmap. (choose only one of these) | |
6845 * x1: First X coordinate. | |
6846 * y1: First Y coordinate. | |
6847 * x2: Second X coordinate. | |
6848 * y2: Second Y coordinate. | |
6849 */ | |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
6850 void API dw_draw_line(HWND handle, HPIXMAP pixmap, int x1, int y1, int x2, int y2) |
3 | 6851 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6852 HDC hdcPaint; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6853 HPEN oldPen; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6854 int threadid = dw_thread_id(); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6855 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6856 if(threadid < 0 || threadid >= THREAD_LIMIT) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6857 threadid = 0; |
3 | 6858 |
6859 if(handle) | |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6860 hdcPaint = GetDC(handle); |
3 | 6861 else if(pixmap) |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6862 hdcPaint = pixmap->hdc; |
3 | 6863 else |
6864 return; | |
6865 | |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6866 oldPen = SelectObject(hdcPaint, _hPen[threadid]); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6867 MoveToEx(hdcPaint, x1, y1, NULL); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6868 LineTo(hdcPaint, x2, y2); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6869 SelectObject(hdcPaint, oldPen); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6870 /* For some reason Win98 (at least) fails |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6871 * to draw the last pixel. So I do it myself. |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6872 */ |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6873 SetPixel(hdcPaint, x2, y2, _foreground[threadid]); |
3 | 6874 if(!pixmap) |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6875 ReleaseDC(handle, hdcPaint); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6876 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6877 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6878 /* Draw a rectangle on a window (preferably a render window). |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6879 * Parameters: |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6880 * handle: Handle to the window. |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6881 * pixmap: Handle to the pixmap. (choose only one of these) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6882 * x: X coordinate. |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6883 * y: Y coordinate. |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6884 * width: Width of rectangle. |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6885 * height: Height of rectangle. |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6886 */ |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
6887 void API dw_draw_rect(HWND handle, HPIXMAP pixmap, int fill, int x, int y, int width, int height) |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6888 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6889 HDC hdcPaint; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6890 HPEN oldPen; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6891 HBRUSH oldBrush; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6892 int threadid = dw_thread_id(); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6893 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6894 if(threadid < 0 || threadid >= THREAD_LIMIT) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6895 threadid = 0; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6896 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6897 if(handle) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6898 hdcPaint = GetDC(handle); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6899 else if(pixmap) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6900 hdcPaint = pixmap->hdc; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6901 else |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6902 return; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6903 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6904 oldPen = SelectObject(hdcPaint, _hPen[threadid]); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6905 oldBrush = SelectObject(hdcPaint, _hBrush[threadid]); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6906 Rectangle(hdcPaint, x, y, x + width, y + height); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6907 SelectObject(hdcPaint, oldPen); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6908 SelectObject(hdcPaint, oldBrush); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6909 if(!pixmap) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6910 ReleaseDC(handle, hdcPaint); |
3 | 6911 } |
6912 | |
6913 /* Draw text on a window (preferably a render window). | |
6914 * Parameters: | |
6915 * handle: Handle to the window. | |
6916 * pixmap: Handle to the pixmap. (choose only one of these) | |
6917 * x: X coordinate. | |
6918 * y: Y coordinate. | |
6919 * text: Text to be displayed. | |
6920 */ | |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
6921 void API dw_draw_text(HWND handle, HPIXMAP pixmap, int x, int y, char *text) |
3 | 6922 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6923 HDC hdc; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6924 int size = 9, z, mustdelete = 0; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6925 HFONT hFont, oldFont; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6926 int threadid = dw_thread_id(); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6927 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6928 if(threadid < 0 || threadid >= THREAD_LIMIT) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6929 threadid = 0; |
3 | 6930 |
6931 if(handle) | |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6932 hdc = GetDC(handle); |
3 | 6933 else if(pixmap) |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6934 hdc = pixmap->hdc; |
3 | 6935 else |
6936 return; | |
6937 | |
6938 { | |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6939 ColorInfo *cinfo; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6940 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6941 if(handle) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6942 cinfo = (ColorInfo *)GetWindowLong(handle, GWL_USERDATA); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6943 else |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6944 cinfo = (ColorInfo *)GetWindowLong(pixmap->handle, GWL_USERDATA); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6945 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6946 if(cinfo) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6947 { |
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
|
6948 hFont = _acquire_font(handle, cinfo->fontname); |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6949 mustdelete = 1; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6950 } |
3 | 6951 } |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6952 oldFont = SelectObject(hdc, hFont); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6953 SetTextColor(hdc, _foreground[threadid]); |
369
39983df2b93d
Updated the license information, and copyrights. Code to do background
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
355
diff
changeset
|
6954 if(_background[threadid] == DW_RGB_TRANSPARENT) |
39983df2b93d
Updated the license information, and copyrights. Code to do background
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
355
diff
changeset
|
6955 SetBkMode(hdc, TRANSPARENT); |
39983df2b93d
Updated the license information, and copyrights. Code to do background
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
355
diff
changeset
|
6956 else |
39983df2b93d
Updated the license information, and copyrights. Code to do background
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
355
diff
changeset
|
6957 { |
39983df2b93d
Updated the license information, and copyrights. Code to do background
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
355
diff
changeset
|
6958 SetBkMode(hdc, OPAQUE); |
39983df2b93d
Updated the license information, and copyrights. Code to do background
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
355
diff
changeset
|
6959 SetBkColor(hdc, _background[threadid]); |
39983df2b93d
Updated the license information, and copyrights. Code to do background
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
355
diff
changeset
|
6960 } |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6961 TextOut(hdc, x, y, text, strlen(text)); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6962 SelectObject(hdc, oldFont); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6963 if(mustdelete) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6964 DeleteObject(hFont); |
3 | 6965 if(!pixmap) |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6966 ReleaseDC(handle, hdc); |
3 | 6967 } |
6968 | |
49
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
48
diff
changeset
|
6969 /* Query the width and height of a text string. |
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
48
diff
changeset
|
6970 * Parameters: |
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
48
diff
changeset
|
6971 * handle: Handle to the window. |
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
48
diff
changeset
|
6972 * pixmap: Handle to the pixmap. (choose only one of these) |
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
48
diff
changeset
|
6973 * text: Text to be queried. |
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
48
diff
changeset
|
6974 * width: Pointer to a variable to be filled in with the width. |
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
48
diff
changeset
|
6975 * height Pointer to a variable to be filled in with the height. |
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
48
diff
changeset
|
6976 */ |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
6977 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:
48
diff
changeset
|
6978 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6979 HDC hdc; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6980 int mustdelete = 0; |
88
58d8139fe0a2
Added vertical center logic for static text controls on windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
87
diff
changeset
|
6981 HFONT hFont = NULL, oldFont; |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6982 SIZE sz; |
49
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
48
diff
changeset
|
6983 |
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
48
diff
changeset
|
6984 if(handle) |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6985 hdc = GetDC(handle); |
49
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
48
diff
changeset
|
6986 else if(pixmap) |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6987 hdc = pixmap->hdc; |
49
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
48
diff
changeset
|
6988 else |
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
48
diff
changeset
|
6989 return; |
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
48
diff
changeset
|
6990 |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6991 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6992 ColorInfo *cinfo; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6993 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6994 if(handle) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6995 cinfo = (ColorInfo *)GetWindowLong(handle, GWL_USERDATA); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6996 else |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6997 cinfo = (ColorInfo *)GetWindowLong(pixmap->handle, GWL_USERDATA); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6998 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
6999 if(cinfo) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7000 { |
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
|
7001 hFont = _acquire_font(handle, cinfo->fontname); |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7002 mustdelete = 1; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7003 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7004 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7005 oldFont = SelectObject(hdc, hFont); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7006 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7007 GetTextExtentPoint32(hdc, text, strlen(text), &sz); |
49
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
48
diff
changeset
|
7008 |
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
48
diff
changeset
|
7009 if(width) |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7010 *width = sz.cx; |
49
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
48
diff
changeset
|
7011 |
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
48
diff
changeset
|
7012 if(height) |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7013 *height = sz.cy; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7014 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7015 SelectObject(hdc, oldFont); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7016 if(mustdelete) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7017 DeleteObject(hFont); |
49
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
48
diff
changeset
|
7018 if(!pixmap) |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7019 ReleaseDC(handle, hdc); |
49
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
48
diff
changeset
|
7020 } |
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
48
diff
changeset
|
7021 |
3 | 7022 /* Call this after drawing to the screen to make sure |
7023 * anything you have drawn is visible. | |
7024 */ | |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
7025 void API dw_flush(void) |
3 | 7026 { |
7027 } | |
7028 | |
7029 /* | |
7030 * Creates a pixmap with given parameters. | |
7031 * Parameters: | |
7032 * handle: Window handle the pixmap is associated with. | |
7033 * width: Width of the pixmap in pixels. | |
7034 * height: Height of the pixmap in pixels. | |
7035 * depth: Color depth of the pixmap. | |
7036 * Returns: | |
7037 * A handle to a pixmap or NULL on failure. | |
7038 */ | |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
7039 HPIXMAP API dw_pixmap_new(HWND handle, unsigned long width, unsigned long height, int depth) |
3 | 7040 { |
7041 HPIXMAP pixmap; | |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7042 BITMAP bm; |
3 | 7043 HDC hdc; |
7044 | |
7045 if (!(pixmap = calloc(1,sizeof(struct _hpixmap)))) | |
7046 return NULL; | |
7047 | |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7048 hdc = GetDC(handle); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7049 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7050 pixmap->width = width; pixmap->height = height; |
3 | 7051 |
7052 pixmap->handle = handle; | |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7053 pixmap->hbm = CreateCompatibleBitmap(hdc, width, height); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7054 pixmap->hdc = CreateCompatibleDC(hdc); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7055 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7056 SelectObject(pixmap->hdc, pixmap->hbm); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7057 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7058 ReleaseDC(handle, hdc); |
3 | 7059 |
7060 return pixmap; | |
7061 } | |
7062 | |
7063 /* | |
241
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
238
diff
changeset
|
7064 * Creates a pixmap from a file. |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
238
diff
changeset
|
7065 * Parameters: |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
238
diff
changeset
|
7066 * handle: Window handle the pixmap is associated with. |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
238
diff
changeset
|
7067 * filename: Name of the file, omit extention to have |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
238
diff
changeset
|
7068 * DW pick the appropriate file extension. |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
238
diff
changeset
|
7069 * (BMP on OS/2 or Windows, XPM on Unix) |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
238
diff
changeset
|
7070 * Returns: |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
238
diff
changeset
|
7071 * A handle to a pixmap or NULL on failure. |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
238
diff
changeset
|
7072 */ |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
238
diff
changeset
|
7073 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:
238
diff
changeset
|
7074 { |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
238
diff
changeset
|
7075 HPIXMAP pixmap; |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
238
diff
changeset
|
7076 BITMAP bm; |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
238
diff
changeset
|
7077 HDC hdc; |
242
36013ddd3f5b
Fixes for Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
241
diff
changeset
|
7078 char *file = malloc(strlen(filename) + 5); |
241
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
238
diff
changeset
|
7079 |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
238
diff
changeset
|
7080 if (!file || !(pixmap = calloc(1,sizeof(struct _hpixmap)))) |
242
36013ddd3f5b
Fixes for Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
241
diff
changeset
|
7081 { |
36013ddd3f5b
Fixes for Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
241
diff
changeset
|
7082 if(file) |
36013ddd3f5b
Fixes for Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
241
diff
changeset
|
7083 free(file); |
241
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
238
diff
changeset
|
7084 return NULL; |
242
36013ddd3f5b
Fixes for Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
241
diff
changeset
|
7085 } |
241
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
238
diff
changeset
|
7086 |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
238
diff
changeset
|
7087 strcpy(file, filename); |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
238
diff
changeset
|
7088 |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
238
diff
changeset
|
7089 /* 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:
238
diff
changeset
|
7090 if(access(file, 04) != 0) |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
238
diff
changeset
|
7091 { |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
238
diff
changeset
|
7092 /* Try with .bmp extention */ |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
238
diff
changeset
|
7093 strcat(file, ".bmp"); |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
238
diff
changeset
|
7094 if(access(file, 04) != 0) |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
238
diff
changeset
|
7095 { |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
238
diff
changeset
|
7096 free(pixmap); |
242
36013ddd3f5b
Fixes for Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
241
diff
changeset
|
7097 free(file); |
241
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
238
diff
changeset
|
7098 return NULL; |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
238
diff
changeset
|
7099 } |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
238
diff
changeset
|
7100 } |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
238
diff
changeset
|
7101 |
242
36013ddd3f5b
Fixes for Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
241
diff
changeset
|
7102 hdc = GetDC(handle); |
241
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
238
diff
changeset
|
7103 |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
238
diff
changeset
|
7104 pixmap->handle = handle; |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
238
diff
changeset
|
7105 pixmap->hbm = (HBITMAP)LoadImage(NULL, file, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE); |
242
36013ddd3f5b
Fixes for Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
241
diff
changeset
|
7106 |
36013ddd3f5b
Fixes for Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
241
diff
changeset
|
7107 if(!pixmap->hbm) |
36013ddd3f5b
Fixes for Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
241
diff
changeset
|
7108 { |
36013ddd3f5b
Fixes for Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
241
diff
changeset
|
7109 free(file); |
36013ddd3f5b
Fixes for Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
241
diff
changeset
|
7110 free(pixmap); |
36013ddd3f5b
Fixes for Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
241
diff
changeset
|
7111 ReleaseDC(handle, hdc); |
36013ddd3f5b
Fixes for Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
241
diff
changeset
|
7112 return NULL; |
36013ddd3f5b
Fixes for Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
241
diff
changeset
|
7113 } |
36013ddd3f5b
Fixes for Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
241
diff
changeset
|
7114 |
241
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
238
diff
changeset
|
7115 pixmap->hdc = CreateCompatibleDC(hdc); |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
238
diff
changeset
|
7116 |
243
3c1e39905f2f
Use GetObject() instead of GetBitmapDimensionEx() to get the loaded bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
242
diff
changeset
|
7117 GetObject(pixmap->hbm, sizeof(bm), &bm); |
3c1e39905f2f
Use GetObject() instead of GetBitmapDimensionEx() to get the loaded bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
242
diff
changeset
|
7118 |
3c1e39905f2f
Use GetObject() instead of GetBitmapDimensionEx() to get the loaded bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
242
diff
changeset
|
7119 pixmap->width = bm.bmWidth; pixmap->height = bm.bmHeight; |
242
36013ddd3f5b
Fixes for Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
241
diff
changeset
|
7120 |
241
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
238
diff
changeset
|
7121 SelectObject(pixmap->hdc, pixmap->hbm); |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
238
diff
changeset
|
7122 |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
238
diff
changeset
|
7123 ReleaseDC(handle, hdc); |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
238
diff
changeset
|
7124 |
242
36013ddd3f5b
Fixes for Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
241
diff
changeset
|
7125 free(file); |
36013ddd3f5b
Fixes for Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
241
diff
changeset
|
7126 |
241
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
238
diff
changeset
|
7127 return pixmap; |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
238
diff
changeset
|
7128 } |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
238
diff
changeset
|
7129 |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
238
diff
changeset
|
7130 /* |
3 | 7131 * Creates a pixmap from internal resource graphic specified by id. |
7132 * Parameters: | |
7133 * handle: Window handle the pixmap is associated with. | |
7134 * id: Resource ID associated with requested pixmap. | |
7135 * Returns: | |
7136 * A handle to a pixmap or NULL on failure. | |
7137 */ | |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
7138 HPIXMAP API dw_pixmap_grab(HWND handle, ULONG id) |
3 | 7139 { |
7140 HPIXMAP pixmap; | |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7141 BITMAP bm; |
3 | 7142 HDC hdc; |
7143 | |
7144 if (!(pixmap = calloc(1,sizeof(struct _hpixmap)))) | |
7145 return NULL; | |
7146 | |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7147 hdc = GetDC(handle); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7148 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7149 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7150 pixmap->hbm = LoadBitmap(DWInstance, MAKEINTRESOURCE(id)); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7151 pixmap->hdc = CreateCompatibleDC(hdc); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7152 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7153 GetObject(pixmap->hbm, sizeof(BITMAP), (void *)&bm); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7154 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7155 pixmap->width = bm.bmWidth; pixmap->height = bm.bmHeight; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7156 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7157 SelectObject(pixmap->hdc, pixmap->hbm); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7158 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7159 ReleaseDC(handle, hdc); |
3 | 7160 |
7161 return pixmap; | |
7162 } | |
7163 | |
7164 /* | |
7165 * Destroys an allocated pixmap. | |
7166 * Parameters: | |
7167 * pixmap: Handle to a pixmap returned by | |
7168 * dw_pixmap_new.. | |
7169 */ | |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
7170 void API dw_pixmap_destroy(HPIXMAP pixmap) |
3 | 7171 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7172 if(pixmap) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7173 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7174 DeleteDC(pixmap->hdc); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7175 DeleteObject(pixmap->hbm); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7176 free(pixmap); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7177 } |
3 | 7178 } |
7179 | |
7180 /* | |
7181 * Copies from one item to another. | |
7182 * Parameters: | |
7183 * dest: Destination window handle. | |
7184 * destp: Destination pixmap. (choose only one). | |
7185 * xdest: X coordinate of destination. | |
7186 * ydest: Y coordinate of destination. | |
7187 * width: Width of area to copy. | |
7188 * height: Height of area to copy. | |
7189 * src: Source window handle. | |
7190 * srcp: Source pixmap. (choose only one). | |
7191 * xsrc: X coordinate of source. | |
7192 * ysrc: Y coordinate of source. | |
7193 */ | |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
7194 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 | 7195 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7196 HDC hdcdest; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7197 HDC hdcsrc; |
3 | 7198 |
7199 if(dest) | |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7200 hdcdest = GetDC(dest); |
3 | 7201 else if(destp) |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7202 hdcdest = destp->hdc; |
3 | 7203 else |
7204 return; | |
7205 | |
7206 if(src) | |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7207 hdcsrc = GetDC(src); |
3 | 7208 else if(srcp) |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7209 hdcsrc = srcp->hdc; |
3 | 7210 else |
7211 return; | |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7212 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7213 BitBlt(hdcdest, xdest, ydest, width, height, hdcsrc, xsrc, ysrc, SRCCOPY); |
3 | 7214 |
7215 if(!destp) | |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7216 ReleaseDC(dest, hdcdest); |
3 | 7217 if(!srcp) |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7218 ReleaseDC(src, hdcsrc); |
3 | 7219 } |
7220 | |
7221 /* | |
7222 * Emits a beep. | |
7223 * Parameters: | |
7224 * freq: Frequency. | |
7225 * dur: Duration. | |
7226 */ | |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
7227 void API dw_beep(int freq, int dur) |
3 | 7228 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7229 Beep(freq, dur); |
3 | 7230 } |
7231 | |
157
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7232 /* Open a shared library and return a handle. |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7233 * Parameters: |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7234 * name: Base name of the shared library. |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7235 * handle: Pointer to a module handle, |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7236 * will be filled in with the handle. |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7237 */ |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
7238 int API dw_module_load(char *name, HMOD *handle) |
157
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7239 { |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7240 if(!handle) |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7241 return -1; |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7242 |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7243 *handle = LoadLibrary(name); |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7244 return (NULL == *handle); |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7245 } |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7246 |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7247 /* Queries the address of a symbol within open handle. |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7248 * Parameters: |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7249 * handle: Module handle returned by dw_module_load() |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7250 * name: Name of the symbol you want the address of. |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7251 * func: A pointer to a function pointer, to obtain |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7252 * the address. |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7253 */ |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
7254 int API dw_module_symbol(HMOD handle, char *name, void**func) |
157
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7255 { |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7256 if(!func || !name) |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7257 return -1; |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7258 |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7259 if(0 == strlen(name)) |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7260 return -1; |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7261 |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7262 *func = (void*)GetProcAddress(handle, name); |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7263 return (NULL == *func); |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7264 } |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7265 |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7266 /* Frees the shared library previously opened. |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7267 * Parameters: |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7268 * handle: Module handle returned by dw_module_load() |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7269 */ |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
7270 int API dw_module_close(HMOD handle) |
157
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7271 { |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7272 return FreeLibrary(handle); |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7273 } |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
155
diff
changeset
|
7274 |
3 | 7275 /* |
7276 * Returns the handle to an unnamed mutex semaphore. | |
7277 */ | |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
7278 HMTX API dw_mutex_new(void) |
3 | 7279 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7280 return (HMTX)CreateMutex(NULL, FALSE, NULL); |
3 | 7281 } |
7282 | |
7283 /* | |
7284 * Closes a semaphore created by dw_mutex_new(). | |
7285 * Parameters: | |
7286 * mutex: The handle to the mutex returned by dw_mutex_new(). | |
7287 */ | |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
7288 void API dw_mutex_close(HMTX mutex) |
3 | 7289 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7290 CloseHandle((HANDLE)mutex); |
3 | 7291 } |
7292 | |
7293 /* | |
7294 * Tries to gain access to the semaphore, if it can't it blocks. | |
7295 * Parameters: | |
7296 * mutex: The handle to the mutex returned by dw_mutex_new(). | |
7297 */ | |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
7298 void API dw_mutex_lock(HMTX mutex) |
3 | 7299 { |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
7300 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:
61
diff
changeset
|
7301 { |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
7302 int rc = WaitForSingleObject((HANDLE)mutex, 0); |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
7303 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
7304 while(rc == WAIT_TIMEOUT) |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
7305 { |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
7306 dw_main_sleep(1); |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
7307 rc = WaitForSingleObject((HANDLE)mutex, 0); |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
7308 } |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
7309 } |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
7310 else |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
7311 WaitForSingleObject((HANDLE)mutex, INFINITE); |
3 | 7312 } |
7313 | |
7314 /* | |
7315 * Reliquishes the access to the semaphore. | |
7316 * Parameters: | |
7317 * mutex: The handle to the mutex returned by dw_mutex_new(). | |
7318 */ | |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
7319 void API dw_mutex_unlock(HMTX mutex) |
3 | 7320 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7321 ReleaseMutex((HANDLE)mutex); |
3 | 7322 } |
7323 | |
7324 /* | |
7325 * Returns the handle to an unnamed event semaphore. | |
7326 */ | |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
7327 HEV API dw_event_new(void) |
3 | 7328 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7329 return CreateEvent(NULL, TRUE, FALSE, NULL); |
3 | 7330 } |
7331 | |
7332 /* | |
7333 * Resets a semaphore created by dw_event_new(). | |
7334 * Parameters: | |
7335 * eve: The handle to the event returned by dw_event_new(). | |
7336 */ | |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
7337 int API dw_event_reset(HEV eve) |
3 | 7338 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7339 return ResetEvent(eve); |
3 | 7340 } |
7341 | |
7342 /* | |
7343 * Posts a semaphore created by dw_event_new(). Causing all threads | |
7344 * waiting on this event in dw_event_wait to continue. | |
7345 * Parameters: | |
7346 * eve: The handle to the event returned by dw_event_new(). | |
7347 */ | |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
7348 int API dw_event_post(HEV eve) |
3 | 7349 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7350 return SetEvent(eve); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7351 } |
3 | 7352 |
7353 /* | |
7354 * Waits on a semaphore created by dw_event_new(), until the | |
7355 * event gets posted or until the timeout expires. | |
7356 * Parameters: | |
7357 * eve: The handle to the event returned by dw_event_new(). | |
7358 */ | |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
7359 int API dw_event_wait(HEV eve, unsigned long timeout) |
3 | 7360 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7361 int rc; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7362 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7363 rc = WaitForSingleObject(eve, timeout); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7364 if(rc == WAIT_OBJECT_0) |
3 | 7365 return 1; |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7366 if(rc == WAIT_ABANDONED) |
3 | 7367 return -1; |
7368 return 0; | |
7369 } | |
7370 | |
7371 /* | |
7372 * Closes a semaphore created by dw_event_new(). | |
7373 * Parameters: | |
7374 * eve: The handle to the event returned by dw_event_new(). | |
7375 */ | |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
7376 int API dw_event_close(HEV *eve) |
3 | 7377 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7378 if(eve) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7379 return CloseHandle(*eve); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7380 return FALSE; |
3 | 7381 } |
7382 | |
7383 /* | |
7384 * Creates a new thread with a starting point of func. | |
7385 * Parameters: | |
7386 * func: Function which will be run in the new thread. | |
7387 * data: Parameter(s) passed to the function. | |
7388 * stack: Stack size of new thread (OS/2 and Windows only). | |
7389 */ | |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
7390 DWTID API dw_thread_new(void *func, void *data, int stack) |
3 | 7391 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7392 #if defined(__CYGWIN__) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7393 return 0; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7394 #else |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7395 return (DWTID)_beginthread((void(*)(void *))func, stack, data); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7396 #endif |
3 | 7397 } |
7398 | |
7399 /* | |
7400 * Ends execution of current thread immediately. | |
7401 */ | |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
7402 void API dw_thread_end(void) |
3 | 7403 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7404 #if !defined(__CYGWIN__) |
3 | 7405 _endthread(); |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7406 #endif |
3 | 7407 } |
7408 | |
7409 /* | |
7410 * Returns the current thread's ID. | |
7411 */ | |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
7412 DWTID API dw_thread_id(void) |
3 | 7413 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7414 #if defined(__CYGWIN__) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7415 return 0; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7416 #else |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7417 return (DWTID)GetCurrentThreadId(); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7418 #endif |
3 | 7419 } |
7420 | |
7421 /* | |
7422 * Cleanly terminates a DW session, should be signal handler safe. | |
7423 * Parameters: | |
7424 * exitcode: Exit code reported to the operating system. | |
7425 */ | |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
7426 void API dw_exit(int exitcode) |
3 | 7427 { |
7428 exit(exitcode); | |
7429 } | |
7430 | |
7431 /* | |
118
c170181668b7
Initial new splitbar code on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
111
diff
changeset
|
7432 * Creates a splitbar window (widget) with given parameters. |
c170181668b7
Initial new splitbar code on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
111
diff
changeset
|
7433 * Parameters: |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
281
diff
changeset
|
7434 * type: Value can be DW_VERT or DW_HORZ. |
118
c170181668b7
Initial new splitbar code on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
111
diff
changeset
|
7435 * topleft: Handle to the window to be top or left. |
c170181668b7
Initial new splitbar code on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
111
diff
changeset
|
7436 * bottomright: Handle to the window to be bottom or right. |
c170181668b7
Initial new splitbar code on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
111
diff
changeset
|
7437 * Returns: |
c170181668b7
Initial new splitbar code on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
111
diff
changeset
|
7438 * A handle to a splitbar window or NULL on failure. |
c170181668b7
Initial new splitbar code on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
111
diff
changeset
|
7439 */ |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
7440 HWND API dw_splitbar_new(int type, HWND topleft, HWND bottomright, unsigned long id) |
118
c170181668b7
Initial new splitbar code on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
111
diff
changeset
|
7441 { |
c170181668b7
Initial new splitbar code on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
111
diff
changeset
|
7442 HWND tmp = CreateWindow(SplitbarClassName, |
c170181668b7
Initial new splitbar code on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
111
diff
changeset
|
7443 "", |
c170181668b7
Initial new splitbar code on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
111
diff
changeset
|
7444 WS_VISIBLE | WS_CHILD | WS_CLIPCHILDREN, |
c170181668b7
Initial new splitbar code on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
111
diff
changeset
|
7445 0,0,2000,1000, |
c170181668b7
Initial new splitbar code on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
111
diff
changeset
|
7446 DW_HWND_OBJECT, |
119
1cad81b7cc4c
Implemented initial splitbar code on Unix. And made some fixes for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
118
diff
changeset
|
7447 (HMENU)id, |
118
c170181668b7
Initial new splitbar code on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
111
diff
changeset
|
7448 DWInstance, |
c170181668b7
Initial new splitbar code on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
111
diff
changeset
|
7449 NULL); |
c170181668b7
Initial new splitbar code on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
111
diff
changeset
|
7450 |
c170181668b7
Initial new splitbar code on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
111
diff
changeset
|
7451 if(tmp) |
c170181668b7
Initial new splitbar code on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
111
diff
changeset
|
7452 { |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
281
diff
changeset
|
7453 HWND tmpbox = dw_box_new(DW_VERT, 0); |
124
edf615d8266e
Use float instead of int for percent on Windows. And a minor safety check
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
7454 float *percent = (float *)malloc(sizeof(float)); |
118
c170181668b7
Initial new splitbar code on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
111
diff
changeset
|
7455 |
c170181668b7
Initial new splitbar code on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
111
diff
changeset
|
7456 dw_box_pack_start(tmpbox, topleft, 1, 1, TRUE, TRUE, 0); |
c170181668b7
Initial new splitbar code on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
111
diff
changeset
|
7457 SetParent(tmpbox, tmp); |
c170181668b7
Initial new splitbar code on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
111
diff
changeset
|
7458 dw_window_set_data(tmp, "_dw_topleft", (void *)tmpbox); |
c170181668b7
Initial new splitbar code on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
111
diff
changeset
|
7459 |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
281
diff
changeset
|
7460 tmpbox = dw_box_new(DW_VERT, 0); |
118
c170181668b7
Initial new splitbar code on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
111
diff
changeset
|
7461 dw_box_pack_start(tmpbox, bottomright, 1, 1, TRUE, TRUE, 0); |
c170181668b7
Initial new splitbar code on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
111
diff
changeset
|
7462 SetParent(tmpbox, tmp); |
c170181668b7
Initial new splitbar code on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
111
diff
changeset
|
7463 dw_window_set_data(tmp, "_dw_bottomright", (void *)tmpbox); |
124
edf615d8266e
Use float instead of int for percent on Windows. And a minor safety check
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
7464 *percent = 50.0; |
edf615d8266e
Use float instead of int for percent on Windows. And a minor safety check
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
7465 dw_window_set_data(tmp, "_dw_percent", (void *)percent); |
118
c170181668b7
Initial new splitbar code on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
111
diff
changeset
|
7466 dw_window_set_data(tmp, "_dw_type", (void *)type); |
c170181668b7
Initial new splitbar code on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
111
diff
changeset
|
7467 } |
c170181668b7
Initial new splitbar code on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
111
diff
changeset
|
7468 return tmp; |
c170181668b7
Initial new splitbar code on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
111
diff
changeset
|
7469 } |
c170181668b7
Initial new splitbar code on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
111
diff
changeset
|
7470 |
c170181668b7
Initial new splitbar code on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
111
diff
changeset
|
7471 /* |
c170181668b7
Initial new splitbar code on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
111
diff
changeset
|
7472 * Sets the position of a splitbar (pecentage). |
c170181668b7
Initial new splitbar code on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
111
diff
changeset
|
7473 * Parameters: |
c170181668b7
Initial new splitbar code on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
111
diff
changeset
|
7474 * handle: The handle to the splitbar returned by dw_splitbar_new(). |
c170181668b7
Initial new splitbar code on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
111
diff
changeset
|
7475 */ |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
7476 void API dw_splitbar_set(HWND handle, float percent) |
118
c170181668b7
Initial new splitbar code on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
111
diff
changeset
|
7477 { |
124
edf615d8266e
Use float instead of int for percent on Windows. And a minor safety check
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
7478 float *mypercent = (float *)dw_window_get_data(handle, "_dw_percent"); |
129
e47c52b37cdd
Code cleanup and OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
127
diff
changeset
|
7479 int type = (int)dw_window_get_data(handle, "_dw_type"); |
e47c52b37cdd
Code cleanup and OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
127
diff
changeset
|
7480 unsigned long width, height; |
124
edf615d8266e
Use float instead of int for percent on Windows. And a minor safety check
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
7481 |
edf615d8266e
Use float instead of int for percent on Windows. And a minor safety check
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
7482 if(mypercent) |
edf615d8266e
Use float instead of int for percent on Windows. And a minor safety check
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
7483 *mypercent = percent; |
129
e47c52b37cdd
Code cleanup and OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
127
diff
changeset
|
7484 |
e47c52b37cdd
Code cleanup and OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
127
diff
changeset
|
7485 dw_window_get_pos_size(handle, NULL, NULL, &width, &height); |
e47c52b37cdd
Code cleanup and OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
127
diff
changeset
|
7486 |
e47c52b37cdd
Code cleanup and OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
127
diff
changeset
|
7487 _handle_splitbar_resize(handle, percent, type, width, height); |
118
c170181668b7
Initial new splitbar code on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
111
diff
changeset
|
7488 } |
c170181668b7
Initial new splitbar code on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
111
diff
changeset
|
7489 |
c170181668b7
Initial new splitbar code on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
111
diff
changeset
|
7490 /* |
c170181668b7
Initial new splitbar code on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
111
diff
changeset
|
7491 * Gets the position of a splitbar (pecentage). |
c170181668b7
Initial new splitbar code on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
111
diff
changeset
|
7492 * Parameters: |
c170181668b7
Initial new splitbar code on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
111
diff
changeset
|
7493 * handle: The handle to the splitbar returned by dw_splitbar_new(). |
c170181668b7
Initial new splitbar code on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
111
diff
changeset
|
7494 */ |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
7495 float API dw_splitbar_get(HWND handle) |
124
edf615d8266e
Use float instead of int for percent on Windows. And a minor safety check
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
7496 { |
edf615d8266e
Use float instead of int for percent on Windows. And a minor safety check
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
7497 float *percent = (float *)dw_window_get_data(handle, "_dw_percent"); |
edf615d8266e
Use float instead of int for percent on Windows. And a minor safety check
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
7498 |
edf615d8266e
Use float instead of int for percent on Windows. And a minor safety check
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
7499 if(percent) |
edf615d8266e
Use float instead of int for percent on Windows. And a minor safety check
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
7500 return *percent; |
edf615d8266e
Use float instead of int for percent on Windows. And a minor safety check
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
7501 return 0.0; |
3 | 7502 } |
7503 | |
7504 /* | |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7505 * Pack windows (widgets) into a box from the end (or bottom). |
3 | 7506 * Parameters: |
7507 * box: Window handle of the box to be packed into. | |
7508 * item: Window handle of the item to be back. | |
7509 * width: Width in pixels of the item or -1 to be self determined. | |
7510 * height: Height in pixels of the item or -1 to be self determined. | |
7511 * hsize: TRUE if the window (widget) should expand horizontally to fill space given. | |
7512 * vsize: TRUE if the window (widget) should expand vertically to fill space given. | |
7513 * pad: Number of pixels of padding around the item. | |
7514 */ | |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
7515 void API dw_box_pack_end(HWND box, HWND item, int width, int height, int hsize, int vsize, int pad) |
3 | 7516 { |
7517 Box *thisbox; | |
7518 | |
429
f977c80a1dfa
Check for inconsistent parameters in dw_box_pack_start() and
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
425
diff
changeset
|
7519 if ( width == 0 && hsize == FALSE ) |
f977c80a1dfa
Check for inconsistent parameters in dw_box_pack_start() and
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
425
diff
changeset
|
7520 dw_messagebox("dw_box_pack_end()", DW_MB_OK|DW_MB_ERROR, "Width and expand Horizonal both unset for box: %x item: %x",box,item); |
f977c80a1dfa
Check for inconsistent parameters in dw_box_pack_start() and
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
425
diff
changeset
|
7521 if ( height == 0 && vsize == FALSE ) |
f977c80a1dfa
Check for inconsistent parameters in dw_box_pack_start() and
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
425
diff
changeset
|
7522 dw_messagebox("dw_box_pack_end()", DW_MB_OK|DW_MB_ERROR, "Height and expand Vertical both unset for box: %x item: %x",box,item); |
f977c80a1dfa
Check for inconsistent parameters in dw_box_pack_start() and
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
425
diff
changeset
|
7523 |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7524 thisbox = (Box *)GetWindowLong(box, GWL_USERDATA); |
3 | 7525 if(thisbox) |
7526 { | |
7527 int z; | |
7528 Item *tmpitem, *thisitem = thisbox->items; | |
7529 char tmpbuf[100]; | |
7530 | |
7531 tmpitem = malloc(sizeof(Item)*(thisbox->count+1)); | |
7532 | |
7533 for(z=0;z<thisbox->count;z++) | |
7534 { | |
7535 tmpitem[z+1] = thisitem[z]; | |
7536 } | |
7537 | |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7538 GetClassName(item, tmpbuf, 99); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7539 |
298
caed245ea8a1
Sanity check, if expand is set width/height can't be zero... force it to 1.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
295
diff
changeset
|
7540 if(vsize && !height) |
caed245ea8a1
Sanity check, if expand is set width/height can't be zero... force it to 1.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
295
diff
changeset
|
7541 height = 1; |
caed245ea8a1
Sanity check, if expand is set width/height can't be zero... force it to 1.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
295
diff
changeset
|
7542 if(hsize && !width) |
caed245ea8a1
Sanity check, if expand is set width/height can't be zero... force it to 1.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
295
diff
changeset
|
7543 width = 1; |
caed245ea8a1
Sanity check, if expand is set width/height can't be zero... force it to 1.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
295
diff
changeset
|
7544 |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7545 if(strnicmp(tmpbuf, FRAMECLASSNAME, 2)==0) |
3 | 7546 tmpitem[0].type = TYPEBOX; |
7547 else | |
7548 tmpitem[0].type = TYPEITEM; | |
7549 | |
7550 tmpitem[0].hwnd = item; | |
7551 tmpitem[0].origwidth = tmpitem[0].width = width; | |
7552 tmpitem[0].origheight = tmpitem[0].height = height; | |
7553 tmpitem[0].pad = pad; | |
7554 if(hsize) | |
7555 tmpitem[0].hsize = SIZEEXPAND; | |
7556 else | |
7557 tmpitem[0].hsize = SIZESTATIC; | |
7558 | |
7559 if(vsize) | |
7560 tmpitem[0].vsize = SIZEEXPAND; | |
7561 else | |
7562 tmpitem[0].vsize = SIZESTATIC; | |
7563 | |
7564 thisbox->items = tmpitem; | |
7565 | |
7566 if(thisbox->count) | |
7567 free(thisitem); | |
7568 | |
7569 thisbox->count++; | |
7570 | |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7571 SetParent(item, box); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7572 if(strncmp(tmpbuf, UPDOWN_CLASS, strlen(UPDOWN_CLASS))==0) |
3 | 7573 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7574 ColorInfo *cinfo = (ColorInfo *)GetWindowLong(item, GWL_USERDATA); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7575 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7576 if(cinfo) |
3 | 7577 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7578 SetParent(cinfo->buddy, box); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7579 ShowWindow(cinfo->buddy, SW_SHOW); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7580 SendMessage(item, UDM_SETBUDDY, (WPARAM)cinfo->buddy, 0); |
3 | 7581 } |
7582 } | |
7583 } | |
7584 } | |
7585 | |
7586 /* | |
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
|
7587 * 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
|
7588 * 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
|
7589 * 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
|
7590 * 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
|
7591 */ |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
7592 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
|
7593 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7594 Box *thisbox = (Box *)GetWindowLong(window, GWL_USERDATA); |
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
|
7595 |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
7596 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
|
7597 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
|
7598 } |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
7599 |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
7600 /* |
40
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
7601 * 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
|
7602 * Parameters: |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
7603 * 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
|
7604 * 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
|
7605 */ |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
7606 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
|
7607 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7608 ColorInfo *cinfo = (ColorInfo *)GetWindowLong(window, GWL_USERDATA); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7609 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7610 if(cinfo) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7611 cinfo->clickdefault = next; |
40
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
7612 } |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
7613 |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
7614 /* |
3 | 7615 * Returns some information about the current operating environment. |
7616 * Parameters: | |
7617 * env: Pointer to a DWEnv struct. | |
7618 */ | |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
7619 void API dw_environment_query(DWEnv *env) |
3 | 7620 { |
7621 if(!env) | |
7622 return; | |
7623 | |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7624 /* Get the Windows version. */ |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7625 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7626 env->MajorVersion = (DWORD)(LOBYTE(LOWORD(dwVersion))); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7627 env->MinorVersion = (DWORD)(HIBYTE(LOWORD(dwVersion))); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7628 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7629 /* Get the build number for Windows NT/Windows 2000. */ |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7630 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7631 env->MinorBuild = 0; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7632 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7633 if (dwVersion < 0x80000000) |
3 | 7634 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7635 if(env->MajorVersion == 5 && env->MinorVersion == 1) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7636 strcpy(env->osName, "Windows XP"); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7637 else if(env->MajorVersion == 5 && env->MinorVersion == 0) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7638 strcpy(env->osName, "Windows 2000"); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7639 else |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7640 strcpy(env->osName, "Windows NT"); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7641 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7642 env->MajorBuild = (DWORD)(HIWORD(dwVersion)); |
3 | 7643 } |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7644 else |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7645 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7646 strcpy(env->osName, "Windows 95/98/ME"); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7647 env->MajorBuild = 0; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7648 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7649 |
15
81833f25b1aa
Added new Dynamic Windows build information to the DWEnv struct.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
14
diff
changeset
|
7650 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
|
7651 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
|
7652 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
|
7653 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
|
7654 env->DWSubVersion = DW_SUB_VERSION; |
3 | 7655 } |
7656 | |
7657 /* | |
7658 * Opens a file dialog and queries user selection. | |
7659 * Parameters: | |
7660 * title: Title bar text for dialog. | |
7661 * defpath: The default path of the open dialog. | |
7662 * ext: Default file extention. | |
7663 * flags: DW_FILE_OPEN or DW_FILE_SAVE. | |
7664 * Returns: | |
7665 * NULL on error. A malloced buffer containing | |
7666 * the file path on success. | |
7667 * | |
7668 */ | |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
7669 char * API dw_file_browse(char *title, char *defpath, char *ext, int flags) |
3 | 7670 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7671 OPENFILENAME of; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7672 char filenamebuf[1001] = ""; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7673 int rc; |
3 | 7674 |
7675 if(ext) | |
7676 { | |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7677 strcpy(filenamebuf, "*."); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7678 strcat(filenamebuf, ext); |
3 | 7679 } |
7680 | |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7681 memset(&of, 0, sizeof(OPENFILENAME)); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7682 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7683 of.lStructSize = sizeof(OPENFILENAME); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7684 of.hwndOwner = HWND_DESKTOP; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7685 of.hInstance = DWInstance; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7686 of.lpstrInitialDir = defpath; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7687 of.lpstrTitle = title; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7688 of.lpstrFile = filenamebuf; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7689 of.nMaxFile = 1000; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7690 of.lpstrDefExt = ext; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7691 of.Flags = 0; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7692 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7693 if(flags & DW_FILE_SAVE) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7694 rc = GetSaveFileName(&of); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7695 else |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7696 rc = GetOpenFileName(&of); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7697 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7698 if(rc) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7699 return strdup(of.lpstrFile); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7700 |
3 | 7701 return NULL; |
7702 } | |
7703 | |
7704 /* | |
7705 * Execute and external program in a seperate session. | |
7706 * Parameters: | |
7707 * program: Program name with optional path. | |
7708 * type: Either DW_EXEC_CON or DW_EXEC_GUI. | |
7709 * params: An array of pointers to string arguements. | |
7710 * Returns: | |
7711 * -1 on error. | |
7712 */ | |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
7713 int API dw_exec(char *program, int type, char **params) |
3 | 7714 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7715 char **newparams; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7716 int retcode, count = 0, z; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7717 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7718 while(params[count]) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7719 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7720 count++; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7721 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7722 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7723 newparams = (char **)malloc(sizeof(char *) * (count+1)); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7724 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7725 for(z=0;z<count;z++) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7726 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7727 newparams[z] = malloc(strlen(params[z])+3); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7728 strcpy(newparams[z], "\""); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7729 strcat(newparams[z], params[z]); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7730 strcat(newparams[z], "\""); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7731 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7732 newparams[count] = NULL; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7733 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7734 retcode = spawnvp(P_NOWAIT, program, newparams); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7735 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7736 for(z=0;z<count;z++) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7737 { |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7738 free(newparams[z]); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7739 } |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7740 free(newparams); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7741 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7742 return retcode; |
3 | 7743 } |
7744 | |
7745 /* | |
7746 * Loads a web browser pointed at the given URL. | |
7747 * Parameters: | |
7748 * url: Uniform resource locator. | |
7749 */ | |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
7750 int API dw_browse(char *url) |
3 | 7751 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7752 char *browseurl = url; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7753 int retcode; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7754 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7755 if(strlen(url) > 7 && strncmp(url, "file://", 7) == 0) |
3 | 7756 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7757 int len, z; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7758 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7759 browseurl = &url[7]; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7760 len = strlen(browseurl); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7761 |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7762 for(z=0;z<len;z++) |
3 | 7763 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7764 if(browseurl[z] == '|') |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7765 browseurl[z] = ':'; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7766 if(browseurl[z] == '/') |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7767 browseurl[z] = '\\'; |
3 | 7768 } |
7769 } | |
7770 | |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7771 retcode = (int)ShellExecute(NULL, "open", browseurl, NULL, NULL, SW_SHOWNORMAL); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7772 if(retcode<33 && retcode != 2) |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7773 return -1; |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7774 return 1; |
3 | 7775 } |
7776 | |
7777 /* | |
7778 * Returns a pointer to a static buffer which containes the | |
7779 * current user directory. Or the root directory (C:\ on | |
7780 * OS/2 and Windows). | |
7781 */ | |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
7782 char * API dw_user_dir(void) |
3 | 7783 { |
7784 static char _user_dir[1024] = ""; | |
7785 | |
7786 if(!_user_dir[0]) | |
7787 { | |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7788 /* Figure out how to do this the "Windows way" */ |
3 | 7789 char *home = getenv("HOME"); |
7790 | |
7791 if(home) | |
7792 strcpy(_user_dir, home); | |
7793 else | |
7794 strcpy(_user_dir, "C:\\"); | |
7795 } | |
7796 return _user_dir; | |
7797 } | |
7798 | |
7799 /* | |
7800 * Call a function from the window (widget)'s context. | |
7801 * Parameters: | |
7802 * handle: Window handle of the widget. | |
7803 * function: Function pointer to be called. | |
7804 * data: Pointer to the data to be passed to the function. | |
7805 */ | |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
7806 void API dw_window_function(HWND handle, void *function, void *data) |
3 | 7807 { |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
7808 SendMessage(handle, WM_USER, (WPARAM)function, (LPARAM)data); |
3 | 7809 } |
7810 | |
90
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
7811 /* 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:
89
diff
changeset
|
7812 * 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:
89
diff
changeset
|
7813 * dw_window_get_data(). |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
7814 */ |
180
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
177
diff
changeset
|
7815 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:
89
diff
changeset
|
7816 { |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
7817 UserData *tmp = *root; |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
7818 |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
7819 while(tmp) |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
7820 { |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
7821 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:
89
diff
changeset
|
7822 return tmp; |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
7823 tmp = tmp->next; |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
7824 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
7825 return NULL; |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
7826 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
7827 |
180
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
177
diff
changeset
|
7828 int _new_userdata(UserData **root, char *varname, void *data) |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
177
diff
changeset
|
7829 { |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
177
diff
changeset
|
7830 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:
89
diff
changeset
|
7831 |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
7832 if(new) |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
7833 { |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
7834 new->data = data; |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
7835 return TRUE; |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
7836 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
7837 else |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
7838 { |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
7839 new = malloc(sizeof(UserData)); |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
7840 if(new) |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
7841 { |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
7842 new->varname = strdup(varname); |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
7843 new->data = data; |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
7844 |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
7845 new->next = NULL; |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
7846 |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
7847 if (!*root) |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
7848 *root = new; |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
7849 else |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
7850 { |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
7851 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:
89
diff
changeset
|
7852 while(tmp) |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
7853 { |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
7854 prev = tmp; |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
7855 tmp = tmp->next; |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
7856 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
7857 if(prev) |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
7858 prev->next = new; |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
7859 else |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
7860 *root = new; |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
7861 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
7862 return TRUE; |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
7863 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
7864 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
7865 return FALSE; |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
7866 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
7867 |
180
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
177
diff
changeset
|
7868 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:
89
diff
changeset
|
7869 { |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
7870 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:
89
diff
changeset
|
7871 |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
7872 while(tmp) |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
7873 { |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
7874 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:
89
diff
changeset
|
7875 { |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
7876 if(!prev) |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
7877 { |
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:
136
diff
changeset
|
7878 *root = tmp->next; |
90
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
7879 free(tmp->varname); |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
7880 free(tmp); |
180
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
177
diff
changeset
|
7881 if(!all) |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
177
diff
changeset
|
7882 return 0; |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
177
diff
changeset
|
7883 tmp = *root; |
90
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
7884 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
7885 else |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
7886 { |
180
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
177
diff
changeset
|
7887 /* If all is true we should |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
177
diff
changeset
|
7888 * never get here. |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
177
diff
changeset
|
7889 */ |
90
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
7890 prev->next = tmp->next; |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
7891 free(tmp->varname); |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
7892 free(tmp); |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
7893 return 0; |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
7894 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
7895 } |
180
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
177
diff
changeset
|
7896 else |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
177
diff
changeset
|
7897 { |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
177
diff
changeset
|
7898 prev = tmp; |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
177
diff
changeset
|
7899 tmp = tmp->next; |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
177
diff
changeset
|
7900 } |
90
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
7901 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
7902 return 0; |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
7903 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
7904 |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
7905 /* |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
7906 * 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:
89
diff
changeset
|
7907 * Parameters: |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
7908 * 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:
89
diff
changeset
|
7909 * 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:
89
diff
changeset
|
7910 * 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:
89
diff
changeset
|
7911 */ |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
7912 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:
89
diff
changeset
|
7913 { |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
7914 ColorInfo *cinfo = (ColorInfo *)GetWindowLong(window, GWL_USERDATA); |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
7915 |
118
c170181668b7
Initial new splitbar code on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
111
diff
changeset
|
7916 if(!cinfo) |
c170181668b7
Initial new splitbar code on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
111
diff
changeset
|
7917 { |
180
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
177
diff
changeset
|
7918 if(!dataname) |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
177
diff
changeset
|
7919 return; |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
177
diff
changeset
|
7920 |
118
c170181668b7
Initial new splitbar code on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
111
diff
changeset
|
7921 cinfo = calloc(1, sizeof(ColorInfo)); |
204
098ed34d41fb
The basics of the new scrollbar code on Windows, and dw_main_iteration().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
201
diff
changeset
|
7922 cinfo->fore = cinfo->back = -1; |
118
c170181668b7
Initial new splitbar code on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
111
diff
changeset
|
7923 SetWindowLong(window, GWL_USERDATA, (LONG)cinfo); |
c170181668b7
Initial new splitbar code on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
111
diff
changeset
|
7924 } |
c170181668b7
Initial new splitbar code on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
111
diff
changeset
|
7925 |
90
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
7926 if(cinfo) |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
7927 { |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
7928 if(data) |
180
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
177
diff
changeset
|
7929 _new_userdata(&(cinfo->root), dataname, data); |
90
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
7930 else |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
7931 { |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
7932 if(dataname) |
180
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
177
diff
changeset
|
7933 _remove_userdata(&(cinfo->root), dataname, FALSE); |
90
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
7934 else |
180
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
177
diff
changeset
|
7935 _remove_userdata(&(cinfo->root), NULL, TRUE); |
90
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
7936 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
7937 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
7938 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
7939 |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
7940 /* |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
7941 * 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:
89
diff
changeset
|
7942 * Parameters: |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
7943 * 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:
89
diff
changeset
|
7944 * 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:
89
diff
changeset
|
7945 * 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:
89
diff
changeset
|
7946 */ |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
7947 void * API dw_window_get_data(HWND window, char *dataname) |
90
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
7948 { |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
7949 ColorInfo *cinfo = (ColorInfo *)GetWindowLong(window, GWL_USERDATA); |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
7950 |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
7951 if(cinfo && cinfo->root && dataname) |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
7952 { |
180
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
177
diff
changeset
|
7953 UserData *ud = _find_userdata(&(cinfo->root), dataname); |
90
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
7954 if(ud) |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
7955 return ud->data; |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
7956 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
7957 return NULL; |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
7958 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
89
diff
changeset
|
7959 |
3 | 7960 /* |
197
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
7961 * Add a callback to a timer event. |
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
7962 * Parameters: |
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
7963 * interval: Milliseconds to delay between calls. |
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
7964 * sigfunc: The pointer to the function to be used as the callback. |
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
7965 * data: User data to be passed to the handler function. |
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
7966 * Returns: |
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
7967 * Timer ID for use with dw_timer_disconnect(), 0 on error. |
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
7968 */ |
200
446dd8cea477
Removed window parameter on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
197
diff
changeset
|
7969 int API dw_timer_connect(int interval, void *sigfunc, void *data) |
446dd8cea477
Removed window parameter on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
197
diff
changeset
|
7970 { |
446dd8cea477
Removed window parameter on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
197
diff
changeset
|
7971 if(sigfunc) |
446dd8cea477
Removed window parameter on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
197
diff
changeset
|
7972 { |
446dd8cea477
Removed window parameter on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
197
diff
changeset
|
7973 int timerid = SetTimer(NULL, 0, interval, NULL); |
446dd8cea477
Removed window parameter on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
197
diff
changeset
|
7974 |
446dd8cea477
Removed window parameter on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
197
diff
changeset
|
7975 if(timerid) |
446dd8cea477
Removed window parameter on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
197
diff
changeset
|
7976 { |
446dd8cea477
Removed window parameter on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
197
diff
changeset
|
7977 _new_signal(WM_TIMER, NULL, timerid, sigfunc, data); |
446dd8cea477
Removed window parameter on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
197
diff
changeset
|
7978 return timerid; |
446dd8cea477
Removed window parameter on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
197
diff
changeset
|
7979 } |
197
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
7980 } |
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
7981 return 0; |
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
7982 } |
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
7983 |
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
7984 /* |
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
7985 * Removes timer callback. |
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
7986 * Parameters: |
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
7987 * id: Timer ID returned by dw_timer_connect(). |
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
7988 */ |
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
7989 void API dw_timer_disconnect(int id) |
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
7990 { |
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
7991 SignalHandler *prev = NULL, *tmp = Root; |
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
7992 |
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
7993 /* 0 is an invalid timer ID */ |
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
7994 if(!id) |
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
7995 return; |
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
7996 |
200
446dd8cea477
Removed window parameter on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
197
diff
changeset
|
7997 KillTimer(NULL, id); |
446dd8cea477
Removed window parameter on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
197
diff
changeset
|
7998 |
197
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
7999 while(tmp) |
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
8000 { |
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
8001 if(tmp->id == id) |
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
8002 { |
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
8003 if(prev) |
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
8004 { |
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
8005 prev->next = tmp->next; |
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
8006 free(tmp); |
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
8007 tmp = prev->next; |
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
8008 } |
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
8009 else |
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
8010 { |
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
8011 Root = tmp->next; |
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
8012 free(tmp); |
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
8013 tmp = Root; |
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
8014 } |
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
8015 } |
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
8016 else |
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
8017 { |
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
8018 prev = tmp; |
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
8019 tmp = tmp->next; |
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
8020 } |
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
8021 } |
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
8022 } |
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
8023 |
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
8024 /* |
3 | 8025 * Add a callback to a window event. |
8026 * Parameters: | |
8027 * window: Window handle of signal to be called back. | |
8028 * signame: A string pointer identifying which signal to be hooked. | |
8029 * sigfunc: The pointer to the function to be used as the callback. | |
8030 * data: User data to be passed to the handler function. | |
8031 */ | |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
8032 void API dw_signal_connect(HWND window, char *signame, void *sigfunc, void *data) |
3 | 8033 { |
8034 ULONG message = 0L; | |
8035 | |
8036 if(window && signame && sigfunc) | |
8037 { | |
307
324587c06cea
Use the signal #defines internally so all that is required to change
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
303
diff
changeset
|
8038 if(stricmp(signame, DW_SIGNAL_SET_FOCUS) == 0) |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
8039 window = _normalize_handle(window); |
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
57
diff
changeset
|
8040 |
3 | 8041 if((message = _findsigmessage(signame)) != 0) |
197
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
194
diff
changeset
|
8042 _new_signal(message, window, 0, sigfunc, data); |
3 | 8043 } |
8044 } | |
8045 | |
8046 /* | |
8047 * Removes callbacks for a given window with given name. | |
8048 * Parameters: | |
8049 * window: Window handle of callback to be removed. | |
8050 */ | |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
8051 void API dw_signal_disconnect_by_name(HWND window, char *signame) |
3 | 8052 { |
8053 SignalHandler *prev = NULL, *tmp = Root; | |
8054 ULONG message; | |
8055 | |
8056 if(!window || !signame || (message = _findsigmessage(signame)) == 0) | |
8057 return; | |
8058 | |
8059 while(tmp) | |
8060 { | |
8061 if(tmp->window == window && tmp->message == message) | |
8062 { | |
8063 if(prev) | |
8064 { | |
8065 prev->next = tmp->next; | |
8066 free(tmp); | |
8067 tmp = prev->next; | |
8068 } | |
8069 else | |
8070 { | |
8071 Root = tmp->next; | |
8072 free(tmp); | |
8073 tmp = Root; | |
8074 } | |
8075 } | |
8076 else | |
8077 { | |
8078 prev = tmp; | |
8079 tmp = tmp->next; | |
8080 } | |
8081 } | |
8082 } | |
8083 | |
8084 /* | |
8085 * Removes all callbacks for a given window. | |
8086 * Parameters: | |
8087 * window: Window handle of callback to be removed. | |
8088 */ | |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
8089 void API dw_signal_disconnect_by_window(HWND window) |
3 | 8090 { |
8091 SignalHandler *prev = NULL, *tmp = Root; | |
8092 | |
8093 while(tmp) | |
8094 { | |
8095 if(tmp->window == window) | |
8096 { | |
8097 if(prev) | |
8098 { | |
8099 prev->next = tmp->next; | |
8100 free(tmp); | |
8101 tmp = prev->next; | |
8102 } | |
8103 else | |
8104 { | |
8105 Root = tmp->next; | |
8106 free(tmp); | |
8107 tmp = Root; | |
8108 } | |
8109 } | |
8110 else | |
8111 { | |
8112 prev = tmp; | |
8113 tmp = tmp->next; | |
8114 } | |
8115 } | |
8116 } | |
8117 | |
8118 /* | |
8119 * Removes all callbacks for a given window with specified data. | |
8120 * Parameters: | |
8121 * window: Window handle of callback to be removed. | |
8122 * data: Pointer to the data to be compared against. | |
8123 */ | |
177
e3dd5c765775
Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
173
diff
changeset
|
8124 void API dw_signal_disconnect_by_data(HWND window, void *data) |
3 | 8125 { |
8126 SignalHandler *prev = NULL, *tmp = Root; | |
8127 | |
8128 while(tmp) | |
8129 { | |
8130 if(tmp->window == window && tmp->data == data) | |
8131 { | |
8132 if(prev) | |
8133 { | |
8134 prev->next = tmp->next; | |
8135 free(tmp); | |
8136 tmp = prev->next; | |
8137 } | |
8138 else | |
8139 { | |
8140 Root = tmp->next; | |
8141 free(tmp); | |
8142 tmp = Root; | |
8143 } | |
8144 } | |
8145 else | |
8146 { | |
8147 prev = tmp; | |
8148 tmp = tmp->next; | |
8149 } | |
8150 } | |
8151 } | |
8152 |