annotate win/dw.c @ 177:e3dd5c765775

Fixes for Windows.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Sun, 01 Dec 2002 14:33:43 +0000
parents c2b5d0019ec3
children 4207e64d4689
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2 * 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
3 * A GTK like implementation of the Win32 GUI
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4 *
63
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 61
diff changeset
5 * (C) 2000-2002 Brian Smith <dbsoft@technologist.com>
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6 *
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7 */
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
8 #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
9 #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
10 #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
11 #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
12 #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
13 #include <shlwapi.h>
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
14 #include <stdlib.h>
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
15 #include <string.h>
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
16 #include <stdio.h>
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
17 #include <process.h>
37
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
18 #include <time.h>
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
19 #include "dw.h"
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
20
93
98cce029a611 Changed handling of menu item click events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 90
diff changeset
21 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
22
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
23 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
24
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
25 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
26 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
27
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
28 #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
29
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 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
31
95
636c37ca7238 Avoid allocating super huge buffers when dealing with the MLEs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
32 #ifndef MIN
636c37ca7238 Avoid allocating super huge buffers when dealing with the MLEs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
33 #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
34 #endif
636c37ca7238 Avoid allocating super huge buffers when dealing with the MLEs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
35
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
36 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
37
5c66a108aa47 Fixed 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 #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
39 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
40 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
41
105
ad95fc623ff3 Some changes to the container optimization code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 104
diff changeset
42 /* Special flag used for internal tracking */
ad95fc623ff3 Some changes to the container optimization code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 104
diff changeset
43 #define DW_CFA_RESERVED (1 << 30)
ad95fc623ff3 Some changes to the container optimization code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 104
diff changeset
44
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
45 #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
46 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
47 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
48 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
49 HBRUSH _hBrush[THREAD_LIMIT];
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
50
58
5c66a108aa47 Fixed 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 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
52 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
53 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
54 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
55 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
56 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
57
5c66a108aa47 Fixed 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 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
59
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
60
58
5c66a108aa47 Fixed 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 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
62 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
63 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
64
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
65 typedef struct _sighandler
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
66 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
67 struct _sighandler *next;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
68 ULONG message;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
69 HWND window;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
70 void *signalfunction;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
71 void *data;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
72
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
73 } SignalHandler;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
74
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
75 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
76 int _index;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
77
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
78 typedef struct
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
79 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
80 ULONG message;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
81 char name[30];
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
82
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
83 } SignalList;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
84
60
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 59
diff changeset
85 static int in_checkbox_handler = 0;
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 59
diff changeset
86
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
87 /* List of signals and their equivilent Win32 message */
63
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 61
diff changeset
88 #define SIGNALMAX 15
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
89
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
90 SignalList SignalTranslate[SIGNALMAX] = {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
91 { WM_SIZE, "configure_event" },
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
92 { WM_CHAR, "key_press_event" },
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
93 { WM_LBUTTONDOWN, "button_press_event" },
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
94 { WM_LBUTTONUP, "button_release_event" },
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
95 { WM_MOUSEMOVE, "motion_notify_event" },
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
96 { WM_CLOSE, "delete_event" },
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
97 { WM_PAINT, "expose_event" },
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
98 { WM_COMMAND, "clicked" },
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
99 { NM_DBLCLK, "container-select" },
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
100 { NM_RCLICK, "container-context" },
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
101 { LBN_SELCHANGE, "item-select" },
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
102 { TVN_SELCHANGED, "tree-select" },
55
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
103 { WM_SETFOCUS, "set-focus" },
63
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 61
diff changeset
104 { WM_USER+1, "lose-focus" },
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 61
diff changeset
105 { WM_VSCROLL, "value_changed" }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
106 };
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
107
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
108 #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
109 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
110 {
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
111 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
112 }
5c66a108aa47 Fixed 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 #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
114 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
115 {
5c66a108aa47 Fixed 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 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
117 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
118
5c66a108aa47 Fixed 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 (*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
120
5c66a108aa47 Fixed 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 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
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 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
124 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
125 {
5c66a108aa47 Fixed 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 (*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
127
5c66a108aa47 Fixed 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 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
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 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
131 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
132 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
133 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
134 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
135 {
5c66a108aa47 Fixed 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 /* 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
137 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
138 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
139 /* 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
140 * 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
141 */
5c66a108aa47 Fixed 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 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
143 (*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
144 }
5c66a108aa47 Fixed 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 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
146 }
5c66a108aa47 Fixed 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 }
5c66a108aa47 Fixed 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 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
150 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
151 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
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 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
154
5c66a108aa47 Fixed 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 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
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 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
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 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
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 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
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 *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
164 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
165 }
5c66a108aa47 Fixed 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 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
167 {
5c66a108aa47 Fixed 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 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
169 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
170 }
5c66a108aa47 Fixed 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 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
172 {
5c66a108aa47 Fixed 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 *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
174 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
175
5c66a108aa47 Fixed 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 /* 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
177 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
178 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
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 /* 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
181 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
182
5c66a108aa47 Fixed 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 /* 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
184 * 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
185 */
5c66a108aa47 Fixed 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 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
187 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
188 }
5c66a108aa47 Fixed 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 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
190 }
5c66a108aa47 Fixed 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 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
192 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
193 }
5c66a108aa47 Fixed 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 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
195 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
196 }
5c66a108aa47 Fixed 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 /* 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
199 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
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 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
202 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
203
5c66a108aa47 Fixed 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 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
205
5c66a108aa47 Fixed 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 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
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 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
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 #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
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 /* 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
213 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
214 {
5c66a108aa47 Fixed 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 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
216
5c66a108aa47 Fixed 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 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
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 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
220 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
221 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
222 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
223 }
5c66a108aa47 Fixed 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 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
225 }
5c66a108aa47 Fixed 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
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
227 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
228 {
c629838d9805 Updated to latest DW, and updated the Makefile to install the header files
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 73
diff changeset
229
c629838d9805 Updated to latest DW, and updated the Makefile to install the header files
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 73
diff changeset
230 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
231 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
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 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
234
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 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
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 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
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 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
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 /* 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
242 * 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
243 * 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
244 * 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
245 */
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 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
247 {
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 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
249 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
250
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 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
252 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
253
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 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
255
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 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
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 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
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 }
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 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
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 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
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
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
267 /* This function adds a signal handler callback into the linked list.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
268 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
269 void _new_signal(ULONG message, HWND window, void *signalfunction, void *data)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
270 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
271 SignalHandler *new = malloc(sizeof(SignalHandler));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
272
55
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
273 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
274 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
275
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
276 new->message = message;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
277 new->window = window;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
278 new->signalfunction = signalfunction;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
279 new->data = data;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
280 new->next = NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
281
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
282 if (!Root)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
283 Root = new;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
284 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
285 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
286 SignalHandler *prev = NULL, *tmp = Root;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
287 while(tmp)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
288 {
68
8d6100960adf Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 67
diff changeset
289 if(tmp->message == message &&
8d6100960adf Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 67
diff changeset
290 tmp->window == window &&
8d6100960adf Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 67
diff changeset
291 tmp->signalfunction == signalfunction)
8d6100960adf Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 67
diff changeset
292 {
8d6100960adf Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 67
diff changeset
293 tmp->data = data;
8d6100960adf Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 67
diff changeset
294 free(new);
8d6100960adf Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 67
diff changeset
295 return;
8d6100960adf Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 67
diff changeset
296 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
297 prev = tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
298 tmp = tmp->next;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
299 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
300 if(prev)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
301 prev->next = new;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
302 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
303 Root = new;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
304 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
305 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
306
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
307 /* Finds the message number for a given signal name */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
308 ULONG _findsigmessage(char *signame)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
309 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
310 int z;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
311
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
312 for(z=0;z<SIGNALMAX;z++)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
313 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
314 if(stricmp(signame, SignalTranslate[z].name) == 0)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
315 return SignalTranslate[z].message;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
316 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
317 return 0L;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
318 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
319
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
320 /* This function removes and handlers on windows and frees
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
321 * the user memory allocated to it.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
322 */
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
323 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
324 {
82
aec9a0b0b539 Fixes for a resource leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 79
diff changeset
325 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
326 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
327 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
328 char tmpbuf[100];
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
329
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
330 /* 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
331 if(oldfont)
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
332 DeleteObject(oldfont);
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
333 if(oldicon)
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
334 DeleteObject(oldicon);
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
335
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
336 GetClassName(handle, tmpbuf, 99);
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
337
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
338 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
339 {
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
340 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
341
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
342 if(oldbitmap)
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
343 DeleteObject(oldbitmap);
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 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
346 {
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
347 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
348
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
349 if(oldbitmap)
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
350 DeleteObject(oldbitmap);
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 else if(strnicmp(tmpbuf, WC_TABCONTROL, strlen(WC_TABCONTROL))==0) /* Notebook */
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 NotebookPage **array = (NotebookPage **)GetWindowLong(handle, GWL_USERDATA);
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
355
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
356 if(array)
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
357 {
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
358 int z, refid = -1;
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
359
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
360 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
361 {
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
362 if(array[z])
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
363 {
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
364 _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
365 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
366 DestroyWindow(array[z]->hwnd);
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
367 free(array[z]);
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
368 }
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
369 }
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
370 }
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
371 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
372
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
373 dw_signal_disconnect_by_window(handle);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
374
82
aec9a0b0b539 Fixes for a resource leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 79
diff changeset
375 if(thiscinfo)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
376 {
90
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 89
diff changeset
377 /* 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
378 if(thiscinfo->hbrush)
aec9a0b0b539 Fixes for a resource leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 79
diff changeset
379 DeleteObject(thiscinfo->hbrush);
aec9a0b0b539 Fixes for a resource leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 79
diff changeset
380
90
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 89
diff changeset
381 /* 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
382 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
383 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
384
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
385 SetWindowLong(handle, GWL_USERDATA, 0);
82
aec9a0b0b539 Fixes for a resource leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 79
diff changeset
386 free(thiscinfo);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
387 }
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
388 return TRUE;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
389 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
390
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
391 /* This function returns 1 if the window (widget) handle
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
392 * passed to it is a valid window that can gain input focus.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
393 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
394 int _validate_focus(HWND handle)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
395 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
396 char tmpbuf[100];
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
397
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
398 if(!handle)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
399 return 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
400
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
401 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
402 return 0;
3aa9ef0b3996 Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 37
diff changeset
403
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
404 GetClassName(handle, tmpbuf, 99);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
405
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
406 /* These are the window classes which can
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
407 * obtain input focus.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
408 */
63
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 61
diff changeset
409 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
410 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
411 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
412 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
413 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
414 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
415 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
416 strnicmp(tmpbuf, WC_TREEVIEW, strlen(WC_TREEVIEW)+1)== 0) /* Tree */
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
417 return 1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
418 return 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
419 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
420
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
421 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
422 {
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
423 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
424
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
425 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
426 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
427 {
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
428 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
429
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
430 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
431 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
432 }
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
433 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
434 {
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
435 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
436
5c66a108aa47 Fixed 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(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
438 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
439 }
5c66a108aa47 Fixed 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 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
441 }
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
442
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
443 int _focus_check_box(Box *box, HWND handle, int start, HWND defaultitem)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
444 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
445 int z;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
446 static HWND lasthwnd, firsthwnd;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
447 static int finish_searching;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
448
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
449 /* Start is 2 when we have cycled completely and
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
450 * need to set the focus to the last widget we found
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
451 * that was valid.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
452 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
453 if(start == 2)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
454 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
455 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
456 SetFocus(lasthwnd);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
457 return 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
458 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
459
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
460 /* Start is 1 when we are entering the function
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
461 * for the first time, it is zero when entering
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
462 * the function recursively.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
463 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
464 if(start == 1)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
465 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
466 lasthwnd = handle;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
467 finish_searching = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
468 firsthwnd = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
469 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
470
58
5c66a108aa47 Fixed 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 for(z=box->count-1;z>-1;z--)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
472 {
58
5c66a108aa47 Fixed 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(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
474 {
5c66a108aa47 Fixed 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 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
476
5c66a108aa47 Fixed 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 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
478 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
479 }
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
480 else
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
481 {
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
482 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
483 {
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
484 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
485 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
486 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
487 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
488 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
489 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
490
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
491 /* 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
492 * 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
493 */
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
494 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
495 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
496 }
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
497 if(_validate_focus(box->items[z].hwnd))
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
498 {
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
499 /* 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
500 * 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
501 */
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
502 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
503 {
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
504 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
505 {
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
506 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
507 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
508 }
5c66a108aa47 Fixed 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 }
5c66a108aa47 Fixed 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 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
512 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
513
5c66a108aa47 Fixed 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 lasthwnd = _normalize_handle(box->items[z].hwnd);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
515 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
516 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
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 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
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 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
521
153
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 151
diff changeset
522 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
523 {
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 151
diff changeset
524 /* Then try the bottom or right box */
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 151
diff changeset
525 HWND mybox = (HWND)dw_window_get_data(box->items[z].hwnd, "_dw_bottomright");
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 151
diff changeset
526
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 151
diff changeset
527 if(mybox)
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 151
diff changeset
528 {
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 151
diff changeset
529 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
530
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 151
diff changeset
531 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
532 return 1;
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 151
diff changeset
533 }
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 151
diff changeset
534
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 151
diff changeset
535 /* Try the top or left box */
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 151
diff changeset
536 mybox = (HWND)dw_window_get_data(box->items[z].hwnd, "_dw_topleft");
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 151
diff changeset
537
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 151
diff changeset
538 if(mybox)
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 151
diff changeset
539 {
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 151
diff changeset
540 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
541
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 151
diff changeset
542 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
543 return 1;
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 151
diff changeset
544 }
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 151
diff changeset
545 }
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 151
diff changeset
546 else if(strnicmp(tmpbuf, WC_TABCONTROL, strlen(WC_TABCONTROL))==0) /* Notebook */
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
547 {
58
5c66a108aa47 Fixed 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 NotebookPage **array = (NotebookPage **)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
549 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
550
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
551 if(pageid > -1 && array && array[pageid])
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
552 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
553 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
554
5c66a108aa47 Fixed 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 if(array[pageid]->hwnd)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
556 {
58
5c66a108aa47 Fixed 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 notebox = (Box *)GetWindowLong(array[pageid]->hwnd, GWL_USERDATA);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
558
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
559 if(notebox && _focus_check_box(notebox, handle, start == 3 ? 3 : 0, defaultitem))
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
560 return 1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
561 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
562 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
563 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
564 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
565 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
566 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
567 return 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
568 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
569
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
570 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
571 {
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
572 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
573 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
574 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
575
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
576 /* 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
577 * 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
578 * 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
579 */
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
580 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
581 {
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
582 if(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
583 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
584 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
585 }
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
586
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
587 /* 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
588 * 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
589 * 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
590 */
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
591 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
592 {
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
593 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
594 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
595 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
596 }
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
597
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
598 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
599 {
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
600 if(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
601 {
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
602 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
603
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
604 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
605 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
606 }
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
607 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
608 {
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 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
610 {
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 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
612 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
613 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
614 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
615 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
616 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
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 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
619 * 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
620 */
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 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
622 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
623 }
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 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
625 {
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 /* 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
627 * 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
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 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
630 {
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 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
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 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
634 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
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 }
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 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
639 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
640
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
641 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
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 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
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 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
648
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 if(strnicmp(tmpbuf, WC_TABCONTROL, strlen(WC_TABCONTROL))==0) /* Notebook */
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 {
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 NotebookPage **array = (NotebookPage **)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
652 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
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(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
655 {
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 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
657
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
658 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
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 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
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 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
663 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
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 }
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 }
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 }
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 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
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
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
673 /* This function finds the first widget in the
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
674 * layout and moves the current focus to it.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
675 */
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
676 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
677 {
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
678 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
679 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
680
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
681 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
682 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
683
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
684 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
685
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
686 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
687 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
688
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
689
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
690 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
691 thisbox = (Box *)GetWindowLong(handle, GWL_USERDATA);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
692
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
693 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
694 {
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
695 _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
696 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
697 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
698
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
699 /* This function finds the current widget in the
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
700 * layout and moves the current focus to the next item.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
701 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
702 void _shift_focus(HWND handle)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
703 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
704 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
705
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
706 HWND box, lastbox = GetParent(handle);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
707
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
708 /* 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
709 while((box = GetParent(lastbox)))
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
710 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
711 lastbox = box;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
712 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
713
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
714 thisbox = (Box *)GetWindowLong(lastbox, GWL_USERDATA);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
715 if(thisbox)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
716 {
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
717 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
718 _focus_check_box(thisbox, handle, 2, 0);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
719 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
720 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
721
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
722 /* 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
723 * 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
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 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
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 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
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 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
730
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
731 /* 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
732 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
733 {
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
734 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
735 }
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
736
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
737 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
738 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
739 {
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
740 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
741 _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
742 }
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
743 }
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
744
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
745 /* ResetWindow:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
746 * Resizes window to the exact same size to trigger
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
747 * recalculation of frame.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
748 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
749 void _ResetWindow(HWND hwndFrame)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
750 {
58
5c66a108aa47 Fixed 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 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
752
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
753 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
754 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
755 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
756 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
757 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
758 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
759
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
760 /* This function calculates how much space the widgets and boxes require
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
761 * and does expansion as necessary.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
762 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
763 int _resize_box(Box *thisbox, int *depth, int x, int y, int *usedx, int *usedy,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
764 int pass, int *usedpadx, int *usedpady)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
765 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
766 int z, currentx = 0, currenty = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
767 int uymax = 0, uxmax = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
768 int upymax = 0, upxmax = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
769 /* Used for the SIZEEXPAND */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
770 int nux = *usedx, nuy = *usedy;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
771 int nupx = *usedpadx, nupy = *usedpady;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
772
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
773 (*usedx) += (thisbox->pad * 2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
774 (*usedy) += (thisbox->pad * 2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
775
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
776 for(z=0;z<thisbox->count;z++)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
777 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
778 if(thisbox->items[z].type == TYPEBOX)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
779 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
780 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
781 Box *tmp = (Box *)GetWindowLong(thisbox->items[z].hwnd, GWL_USERDATA);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
782
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
783 initialx = x - (*usedx);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
784 initialy = y - (*usedy);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
785
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
786 if(tmp)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
787 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
788 int newx, newy;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
789 int nux = *usedx, nuy = *usedy;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
790 int upx = *usedpadx + (tmp->pad*2), upy = *usedpady + (tmp->pad*2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
791
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
792 /* On the second pass we know how big the box needs to be and how
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
793 * much space we have, so we can calculate a ratio for the new box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
794 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
795 if(pass == 2)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
796 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
797 int deep = *depth + 1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
798
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
799 _resize_box(tmp, &deep, x, y, &nux, &nuy, 1, &upx, &upy);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
800
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
801 tmp->upx = upx - *usedpadx;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
802 tmp->upy = upy - *usedpady;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
803
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
804 newx = x - nux;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
805 newy = y - nuy;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
806
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
807 tmp->width = thisbox->items[z].width = initialx - newx;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
808 tmp->height = thisbox->items[z].height = initialy - newy;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
809
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
810 tmp->parentxratio = thisbox->xratio;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
811 tmp->parentyratio = thisbox->yratio;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
812
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
813 tmp->parentpad = tmp->pad;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
814
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
815 /* Just in case */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
816 tmp->xratio = thisbox->xratio;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
817 tmp->yratio = thisbox->yratio;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
818
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
819 if(thisbox->type == BOXVERT)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
820 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
821 if((thisbox->items[z].width-((thisbox->items[z].pad*2)+(tmp->pad*2)))!=0)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
822 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))));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
823 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
824 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
825 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
826 if((thisbox->items[z].width-tmp->upx)!=0)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
827 tmp->xratio = ((float)((thisbox->items[z].width * thisbox->xratio)-tmp->upx))/((float)(thisbox->items[z].width-tmp->upx));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
828 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
829 if(thisbox->type == BOXHORZ)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
830 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
831 if((thisbox->items[z].height-((thisbox->items[z].pad*2)+(tmp->pad*2)))!=0)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
832 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))));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
833 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
834 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
835 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
836 if((thisbox->items[z].height-tmp->upy)!=0)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
837 tmp->yratio = ((float)((thisbox->items[z].height * thisbox->yratio)-tmp->upy))/((float)(thisbox->items[z].height-tmp->upy));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
838 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
839
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
840 nux = *usedx; nuy = *usedy;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
841 upx = *usedpadx + (tmp->pad*2); upy = *usedpady + (tmp->pad*2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
842 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
843
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
844 (*depth)++;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
845
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
846 _resize_box(tmp, depth, x, y, &nux, &nuy, pass, &upx, &upy);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
847
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
848 (*depth)--;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
849
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
850 newx = x - nux;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
851 newy = y - nuy;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
852
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
853 tmp->minwidth = thisbox->items[z].width = initialx - newx;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
854 tmp->minheight = thisbox->items[z].height = initialy - newy;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
855 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
856 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
857
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
858 if(pass > 1 && *depth > 0)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
859 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
860 if(thisbox->type == BOXVERT)
60
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 59
diff changeset
861 {
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 59
diff changeset
862 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
863 thisbox->items[z].xratio = 1.0;
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 59
diff changeset
864 else
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 59
diff changeset
865 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
866 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
867 else
60
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 59
diff changeset
868 {
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 59
diff changeset
869 if(thisbox->minwidth-thisbox->upx == 0)
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 59
diff changeset
870 thisbox->items[z].xratio = 1.0;
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 59
diff changeset
871 else
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 59
diff changeset
872 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
873 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
874
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
875 if(thisbox->type == BOXHORZ)
60
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 59
diff changeset
876 {
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 59
diff changeset
877 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
878 thisbox->items[z].yratio = 1.0;
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 59
diff changeset
879 else
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 59
diff changeset
880 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
881 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
882 else
60
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 59
diff changeset
883 {
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 59
diff changeset
884 if(thisbox->minheight-thisbox->upy == 0)
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 59
diff changeset
885 thisbox->items[z].yratio = 1.0;
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 59
diff changeset
886 else
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 59
diff changeset
887 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
888 }
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 17
diff changeset
889
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 17
diff changeset
890 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
891 {
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
892 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
893
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 17
diff changeset
894 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
895 {
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 17
diff changeset
896 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
897 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
898 }
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 17
diff changeset
899 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
900 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
901 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
902 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
903 thisbox->items[z].xratio = thisbox->xratio;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
904 thisbox->items[z].yratio = thisbox->yratio;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
905 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
906
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
907 if(thisbox->type == BOXVERT)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
908 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
909 if((thisbox->items[z].width + (thisbox->items[z].pad*2)) > uxmax)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
910 uxmax = (thisbox->items[z].width + (thisbox->items[z].pad*2));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
911 if(thisbox->items[z].hsize != SIZEEXPAND)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
912 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
913 if(((thisbox->items[z].pad*2) + thisbox->items[z].width) > upxmax)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
914 upxmax = (thisbox->items[z].pad*2) + thisbox->items[z].width;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
915 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
916 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
917 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
918 if(thisbox->items[z].pad*2 > upxmax)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
919 upxmax = thisbox->items[z].pad*2;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
920 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
921 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
922 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
923 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
924 if(thisbox->items[z].width == -1)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
925 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
926 /* figure out how much space this item requires */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
927 /* thisbox->items[z].width = */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
928 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
929 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
930 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
931 (*usedx) += thisbox->items[z].width + (thisbox->items[z].pad*2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
932 if(thisbox->items[z].hsize != SIZEEXPAND)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
933 (*usedpadx) += (thisbox->items[z].pad*2) + thisbox->items[z].width;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
934 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
935 (*usedpadx) += thisbox->items[z].pad*2;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
936 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
937 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
938 if(thisbox->type == BOXHORZ)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
939 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
940 if((thisbox->items[z].height + (thisbox->items[z].pad*2)) > uymax)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
941 uymax = (thisbox->items[z].height + (thisbox->items[z].pad*2));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
942 if(thisbox->items[z].vsize != SIZEEXPAND)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
943 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
944 if(((thisbox->items[z].pad*2) + thisbox->items[z].height) > upymax)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
945 upymax = (thisbox->items[z].pad*2) + thisbox->items[z].height;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
946 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
947 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
948 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
949 if(thisbox->items[z].pad*2 > upymax)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
950 upymax = thisbox->items[z].pad*2;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
951 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
952 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
953 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
954 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
955 if(thisbox->items[z].height == -1)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
956 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
957 /* figure out how much space this item requires */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
958 /* thisbox->items[z].height = */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
959 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
960 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
961 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
962 (*usedy) += thisbox->items[z].height + (thisbox->items[z].pad*2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
963 if(thisbox->items[z].vsize != SIZEEXPAND)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
964 (*usedpady) += (thisbox->items[z].pad*2) + thisbox->items[z].height;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
965 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
966 (*usedpady) += thisbox->items[z].pad*2;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
967 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
968 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
969 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
970
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
971 (*usedx) += uxmax;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
972 (*usedy) += uymax;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
973 (*usedpadx) += upxmax;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
974 (*usedpady) += upymax;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
975
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
976 currentx += thisbox->pad;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
977 currenty += thisbox->pad;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
978
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
979 /* The second pass is for expansion and actual placement. */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
980 if(pass > 1)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
981 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
982 /* Any SIZEEXPAND items should be set to uxmax/uymax */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
983 for(z=0;z<thisbox->count;z++)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
984 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
985 if(thisbox->items[z].hsize == SIZEEXPAND && thisbox->type == BOXVERT)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
986 thisbox->items[z].width = uxmax-(thisbox->items[z].pad*2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
987 if(thisbox->items[z].vsize == SIZEEXPAND && thisbox->type == BOXHORZ)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
988 thisbox->items[z].height = uymax-(thisbox->items[z].pad*2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
989 /* Run this code segment again to finalize the sized after setting uxmax/uymax values. */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
990 if(thisbox->items[z].type == TYPEBOX)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
991 {
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
992 Box *tmp = (Box *)GetWindowLong(thisbox->items[z].hwnd, GWL_USERDATA);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
993
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
994 if(tmp)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
995 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
996 if(*depth > 0)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
997 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
998 if(thisbox->type == BOXVERT)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
999 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1000 tmp->xratio = ((float)((thisbox->items[z].width * thisbox->xratio)-((thisbox->items[z].pad*2)+(thisbox->pad*2))))/((float)(tmp->minwidth-((thisbox->items[z].pad*2)+(thisbox->pad*2))));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1001 tmp->width = thisbox->items[z].width;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1002 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1003 if(thisbox->type == BOXHORZ)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1004 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1005 tmp->yratio = ((float)((thisbox->items[z].height * thisbox->yratio)-((thisbox->items[z].pad*2)+(thisbox->pad*2))))/((float)(tmp->minheight-((thisbox->items[z].pad*2)+(thisbox->pad*2))));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1006 tmp->height = thisbox->items[z].height;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1007 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1008 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1009
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1010 (*depth)++;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1011
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1012 _resize_box(tmp, depth, x, y, &nux, &nuy, 3, &nupx, &nupy);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1013
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1014 (*depth)--;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1015
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1016 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1017 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1018 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1019
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1020 for(z=0;z<(thisbox->count);z++)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1021 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1022 int height = thisbox->items[z].height;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1023 int width = thisbox->items[z].width;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1024 int pad = thisbox->items[z].pad;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1025 HWND handle = thisbox->items[z].hwnd;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1026 int vectorx, vectory;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1027
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1028 /* When upxmax != pad*2 then ratios are incorrect. */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1029 vectorx = (int)((width*thisbox->items[z].xratio)-width);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1030 vectory = (int)((height*thisbox->items[z].yratio)-height);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1031
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1032 if(width > 0 && height > 0)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1033 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1034 char tmpbuf[100];
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1035 /* This is a hack to fix rounding of the sizing */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1036 if(*depth == 0)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1037 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1038 vectorx++;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1039 vectory++;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1040 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1041
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1042 /* If this item isn't going to expand... reset the vectors to 0 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1043 if(thisbox->items[z].vsize != SIZEEXPAND)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1044 vectory = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1045 if(thisbox->items[z].hsize != SIZEEXPAND)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1046 vectorx = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1047
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
1048 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
1049
88
58d8139fe0a2 Added vertical center logic for static text controls on windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 87
diff changeset
1050 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
1051 {
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
1052 /* 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
1053 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
1054 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
1055 }
88
58d8139fe0a2 Added vertical center logic for static text controls on windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 87
diff changeset
1056 else if(strnicmp(tmpbuf, UPDOWN_CLASS, strlen(UPDOWN_CLASS)+1)==0)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1057 {
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
1058 /* 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
1059 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
1060
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
1061 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
1062 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
1063
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
1064 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
1065 {
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
1066 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
1067 (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
1068 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1069 }
167
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
1070 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
1071 {
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
1072 /* 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
1073 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
1074 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
1075 int cx = width + vectorx;
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
1076 int cy = height + vectory;
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
1077
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
1078 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
1079 cx, cy, FALSE);
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
1080
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
1081 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
1082 _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
1083 }
88
58d8139fe0a2 Added vertical center logic for static text controls on windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 87
diff changeset
1084 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
1085 {
58d8139fe0a2 Added vertical center logic for static text controls on windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 87
diff changeset
1086 /* 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
1087 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
1088
58d8139fe0a2 Added vertical center logic for static text controls on windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 87
diff changeset
1089 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
1090 {
58d8139fe0a2 Added vertical center logic for static text controls on windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 87
diff changeset
1091 /* 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
1092 char tmpbuf[1024];
58d8139fe0a2 Added vertical center logic for static text controls on windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 87
diff changeset
1093 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
1094
58d8139fe0a2 Added vertical center logic for static text controls on windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 87
diff changeset
1095 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
1096
58d8139fe0a2 Added vertical center logic for static text controls on windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 87
diff changeset
1097 /* 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
1098 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
1099
58d8139fe0a2 Added vertical center logic for static text controls on windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 87
diff changeset
1100 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
1101
58d8139fe0a2 Added vertical center logic for static text controls on windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 87
diff changeset
1102 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
1103 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
1104 }
58d8139fe0a2 Added vertical center logic for static text controls on windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 87
diff changeset
1105 else
58d8139fe0a2 Added vertical center logic for static text controls on windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 87
diff changeset
1106 {
58d8139fe0a2 Added vertical center logic for static text controls on windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 87
diff changeset
1107 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
1108 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
1109 }
58d8139fe0a2 Added vertical center logic for static text controls on windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 87
diff changeset
1110 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1111 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1112 {
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
1113 /* 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
1114 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
1115 width + vectorx, height + vectory, FALSE);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1116 if(thisbox->items[z].type == TYPEBOX)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1117 {
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
1118 Box *boxinfo = (Box *)GetWindowLong(handle, GWL_USERDATA);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1119
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1120 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
1121 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
1122 width + vectorx, height + vectory, FALSE);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1123
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1124 }
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
1125 }
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
1126
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
1127 /* 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
1128 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
1129 {
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
1130 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
1131 NotebookPage **array = (NotebookPage **)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
1132 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
1133
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
1134 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
1135 {
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
1136 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
1137 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
1138 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
1139 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
1140 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1141 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1142
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1143 if(thisbox->type == BOXHORZ)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1144 currentx += width + vectorx + (pad * 2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1145 if(thisbox->type == BOXVERT)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1146 currenty += height + vectory + (pad * 2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1147 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1148 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1149 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1150 return 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1151 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1152
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1153 void _do_resize(Box *thisbox, int x, int y)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1154 {
17
f26eced21a30 Some more updates.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 15
diff changeset
1155 if(x != 0 && y != 0)
f26eced21a30 Some more updates.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 15
diff changeset
1156 {
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1157 if(thisbox)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1158 {
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
1159 int usedx = 0, usedy = 0, depth = 0, usedpadx = 0, usedpady = 0;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1160
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1161 _resize_box(thisbox, &depth, x, y, &usedx, &usedy, 1, &usedpadx, &usedpady);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1162
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
1163 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
1164 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
1165
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1166 thisbox->xratio = ((float)(x-usedpadx))/((float)(usedx-usedpadx));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1167 thisbox->yratio = ((float)(y-usedpady))/((float)(usedy-usedpady));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1168
58
5c66a108aa47 Fixed 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 usedpadx = usedpady = usedx = usedy = depth = 0;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1170
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1171 _resize_box(thisbox, &depth, x, y, &usedx, &usedy, 2, &usedpadx, &usedpady);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1172 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1173 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1174 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1175
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
1176 /* 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
1177 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
1178 {
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
1179 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
1180 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
1181 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
1182 void (* windowfunc)(PVOID);
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
1183 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
1184
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
1185 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
1186 msg = 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
1187 if(msg == WM_RBUTTONUP || msg == 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
1188 msg = WM_LBUTTONUP;
63
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 61
diff changeset
1189 if(msg == 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
1190 msg = WM_VSCROLL;
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
1191
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
1192 if(result == -1)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1193 {
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
1194 /* 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
1195 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
1196
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
1197 /* 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
1198 while(tmp)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1199 {
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
1200 if(tmp->message == msg || msg == WM_COMMAND || msg == WM_NOTIFY || tmp->message == WM_USER+1)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1201 {
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
1202 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
1203 {
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
1204 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
1205 {
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
1206 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
1207
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
1208 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
1209 {
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
1210 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
1211 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
1212 }
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
1213 }
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
1214 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
1215 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
1216 {
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
1217 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
1218
5c66a108aa47 Fixed 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 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
1220 {
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
1221 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
1222 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
1223 }
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
1224 }
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
1225 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
1226 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
1227 {
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
1228 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
1229 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
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 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
1232 {
5c66a108aa47 Fixed 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 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
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 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
1236 {
5c66a108aa47 Fixed 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 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
1238 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
1239 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
1240 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
1241 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
1242 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
1243 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
1244 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
1245 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
1246 }
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
1247 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
1248 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
1249 }
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
1250 }
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
1251 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
1252 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
1253 {
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
1254 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
1255 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
1256
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
1257 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
1258 {
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
1259 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
1260
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
1261 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
1262 {
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
1263 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
1264 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
1265 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
1266 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
1267 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
1268 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
1269 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
1270 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
1271 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
1272 }
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
1273 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
1274 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
1275 }
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
1276 }
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
1277 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
1278 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
1279 {
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
1280 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
1281 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
1282
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
1283 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
1284 {
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
1285 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
1286
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
1287 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
1288 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
1289 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
1290 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
1291 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
1292 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
1293
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
1294 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
1295 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
1296 }
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
1297 }
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
1298 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
1299 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
1300 {
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
1301 int (*keypressfunc)(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
1302
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
1303 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
1304 {
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
1305 result = keypressfunc(tmp->window, LOWORD(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
1306 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
1307 }
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
1308 }
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
1309 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
1310 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
1311 {
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
1312 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
1313
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
1314 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
1315 {
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
1316 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
1317 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
1318 }
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
1319 }
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
1320 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
1321 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
1322 {
5c66a108aa47 Fixed 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 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
1324 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
1325 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
1326
5c66a108aa47 Fixed 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 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
1328 {
5c66a108aa47 Fixed 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 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
1330 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
1331 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
1332 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
1333 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
1334 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
1335 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
1336 }
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
1337 }
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
1338 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
1339 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
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(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
1342 {
5c66a108aa47 Fixed 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 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
1344 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
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 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
1347
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
1348 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
1349 {
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
1350 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
1351 {
5c66a108aa47 Fixed 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 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
1353 {
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
1354 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
1355 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
1356 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
1357
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
1358 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
1359 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
1360
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
1361 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
1362
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
1363 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
1364 if(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
1365 result = treeselectfunc(tmp->window, (HWND)tem->itemNew.hItem, (char *)ptrs[0], (void *)ptrs[1], 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
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 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
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 }
5c66a108aa47 Fixed 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 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
1371 {
5c66a108aa47 Fixed 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 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
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 int (*containercontextfunc)(HWND, char *, int, int, 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
1375 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
1376 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
1377 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
1378 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
1379 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
1380
5c66a108aa47 Fixed 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 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
1382
5c66a108aa47 Fixed 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 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
1384 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
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 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
1387
5c66a108aa47 Fixed 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 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
1389
5c66a108aa47 Fixed 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 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
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 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
1393 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
1394
5c66a108aa47 Fixed 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 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
1396 dw_tree_item_select(tmp->window, (HWND)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
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 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
1399
5c66a108aa47 Fixed 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 }
5c66a108aa47 Fixed 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 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
1402 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
1403 }
5c66a108aa47 Fixed 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 }
5c66a108aa47 Fixed 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 }
161
c555d06b6c93 Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
1406 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
1407 {
c555d06b6c93 Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
1408 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
1409 {
c555d06b6c93 Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
1410 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
1411 {
c555d06b6c93 Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
1412 LV_ITEM lvi;
c555d06b6c93 Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
1413 int iItem;
c555d06b6c93 Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
1414
c555d06b6c93 Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
1415 iItem = ListView_GetNextItem(tmp->window, -1, LVNI_FOCUSED);
c555d06b6c93 Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
1416
c555d06b6c93 Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
1417 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
1418
c555d06b6c93 Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
1419 if(iItem > -1)
c555d06b6c93 Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
1420 {
c555d06b6c93 Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
1421 int (*containerselectfunc)(HWND, char *, void *) = tmp->signalfunction;
c555d06b6c93 Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
1422
c555d06b6c93 Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
1423 lvi.iItem = iItem;
c555d06b6c93 Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
1424 lvi.mask = LVIF_PARAM;
c555d06b6c93 Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
1425
c555d06b6c93 Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
1426 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
1427
c555d06b6c93 Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
1428 /* 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
1429 if(lvi.lParam < 100)
c555d06b6c93 Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
1430 lvi.lParam = 0;
c555d06b6c93 Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
1431
c555d06b6c93 Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
1432 containerselectfunc(tmp->window, (char *)lvi.lParam, tmp->data);
c555d06b6c93 Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
1433 tmp = NULL;
c555d06b6c93 Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
1434 }
c555d06b6c93 Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
1435 }
c555d06b6c93 Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
1436 }
c555d06b6c93 Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
1437 }
58
5c66a108aa47 Fixed 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 }
5c66a108aa47 Fixed 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 }
5c66a108aa47 Fixed 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 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
1441 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
1442 {
5c66a108aa47 Fixed 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 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
1444 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
1445 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
1446 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
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 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
1449
5c66a108aa47 Fixed 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(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
1451 {
5c66a108aa47 Fixed 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 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
1453
5c66a108aa47 Fixed 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 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
1455 {
5c66a108aa47 Fixed 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 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
1457 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
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 } /* 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
1460 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
1461 {
93
98cce029a611 Changed handling of menu item click events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 90
diff changeset
1462 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
1463 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
1464 }
5c66a108aa47 Fixed 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 }
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
1466 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
1467 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
1468 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
1469 {
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 61
diff changeset
1470 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
1471 HWND handle = (HWND)mp2;
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 61
diff changeset
1472
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 61
diff changeset
1473 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
1474
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 61
diff changeset
1475 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
1476 {
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 61
diff changeset
1477 int (*valuechangefunc)(HWND, int, void *) = tmp->signalfunction;
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 61
diff changeset
1478
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 61
diff changeset
1479 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
1480 {
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 61
diff changeset
1481 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
1482 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
1483 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
1484
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 61
diff changeset
1485 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
1486 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
1487 else
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 61
diff changeset
1488 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
1489 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
1490 }
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 61
diff changeset
1491 }
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 61
diff changeset
1492 }
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 61
diff changeset
1493 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
1494 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1495 }
58
5c66a108aa47 Fixed 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 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
1497 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
1498 }
5c66a108aa47 Fixed 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 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
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
5c66a108aa47 Fixed 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 /* 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
1503 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
1504 {
5c66a108aa47 Fixed 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 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
1506 {
5c66a108aa47 Fixed 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 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
1508
5c66a108aa47 Fixed 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 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
1510 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
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_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
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 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
1516 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
1517
5c66a108aa47 Fixed 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 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
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 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
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(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
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 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
1525 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
1526 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
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 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
1529 _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
1530 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
1531 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
1532 }
5c66a108aa47 Fixed 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 }
5c66a108aa47 Fixed 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 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
1536 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
1537 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
1538 {
82
aec9a0b0b539 Fixes for a resource leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 79
diff changeset
1539 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
1540 _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
1541 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
1542 _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
1543 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
1544 }
5c66a108aa47 Fixed 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 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
1546 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
1547 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
1548
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
1549 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
1550 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
1551 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
1552 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
1553 {
5c66a108aa47 Fixed 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 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
1555
5c66a108aa47 Fixed 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 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
1557 {
5c66a108aa47 Fixed 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 int num=TabCtrl_GetCurSel(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
1559 NotebookPage **array = (NotebookPage **)GetWindowLong(tem->hwndFrom, 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
1560
5c66a108aa47 Fixed 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 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
1562 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
1563
5c66a108aa47 Fixed 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 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
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 int num=TabCtrl_GetCurSel(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
1568 NotebookPage **array = (NotebookPage **)GetWindowLong(tem->hwndFrom, 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
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 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
1571 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
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 _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
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 }
5c66a108aa47 Fixed 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 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
1577 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
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 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
1580 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
1581 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
1582 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
1583 }
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
1584 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
1585 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
1586 /* 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
1587 _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
1588 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
1589 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
1590 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
1591 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
1592 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
1593 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
1594 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
1595 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
1596 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
1597 {
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
1598 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
1599 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
1600 {
155
840c54766306 Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 153
diff changeset
1601 /* Handle foreground */
840c54766306 Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 153
diff changeset
1602 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
1603 {
155
840c54766306 Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 153
diff changeset
1604 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
1605 {
840c54766306 Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 153
diff changeset
1606 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
1607 _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
1608 _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
1609 }
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
1610 }
155
840c54766306 Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 153
diff changeset
1611 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
1612 {
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
1613 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
1614 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
1615 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
1616 }
840c54766306 Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 153
diff changeset
1617 /* Handle background */
840c54766306 Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 153
diff changeset
1618 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
1619 {
840c54766306 Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 153
diff changeset
1620 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
1621 {
840c54766306 Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 153
diff changeset
1622 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
1623
840c54766306 Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 153
diff changeset
1624 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
1625 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
1626 }
840c54766306 Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 153
diff changeset
1627 else
840c54766306 Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 153
diff changeset
1628 {
840c54766306 Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 153
diff changeset
1629 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
1630 _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
1631 _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
1632 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
1633 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
1634 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
1635 _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
1636 _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
1637 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
1638 }
840c54766306 Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 153
diff changeset
1639 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
1640 }
840c54766306 Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 153
diff changeset
1641 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
1642 {
58
5c66a108aa47 Fixed 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 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
1644 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
1645 DW_BLUE_VALUE(thiscinfo->back)));
82
aec9a0b0b539 Fixes for a resource leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 79
diff changeset
1646 if(thiscinfo->hbrush)
aec9a0b0b539 Fixes for a resource leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 79
diff changeset
1647 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
1648 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
1649 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
1650 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
1651 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
1652 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
1653 }
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
1654 }
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
1655
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
1656 }
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
1657 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
1658 }
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
1659 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
1660 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
1661 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
1662 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
1663 }
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
1664
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
1665 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
1666 {
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
1667 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
1668 {
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
1669 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
1670 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
1671 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
1672 SetActiveWindow(hWnd);
106
4b6799f3dbbc Give the frame window focus if it is clicked on.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 105
diff changeset
1673 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
1674 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
1675 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
1676 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
1677 _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
1678 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
1679 #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
1680 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
1681 {
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
1682 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
1683
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
1684 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
1685 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
1686 }
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
1687 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
1688 #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
1689 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
1690 {
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
1691 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
1692
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
1693 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
1694 {
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
1695 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
1696 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
1697 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
1698
155
840c54766306 Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 153
diff changeset
1699 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
1700 {
155
840c54766306 Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 153
diff changeset
1701 /* Handle foreground */
840c54766306 Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 153
diff changeset
1702 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
1703 {
840c54766306 Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 153
diff changeset
1704 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
1705 {
840c54766306 Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 153
diff changeset
1706 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
1707 _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
1708 _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
1709 }
840c54766306 Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 153
diff changeset
1710 }
840c54766306 Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 153
diff changeset
1711 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
1712 {
840c54766306 Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 153
diff changeset
1713 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
1714 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
1715 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
1716 }
840c54766306 Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 153
diff changeset
1717 /* Handle background */
840c54766306 Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 153
diff changeset
1718 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
1719 {
840c54766306 Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 153
diff changeset
1720 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
1721 {
840c54766306 Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 153
diff changeset
1722 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
1723 _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
1724 _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
1725 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
1726 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
1727 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
1728 _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
1729 _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
1730 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
1731 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
1732 success = TRUE;
840c54766306 Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 153
diff changeset
1733 }
840c54766306 Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 153
diff changeset
1734 }
840c54766306 Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 153
diff changeset
1735 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
1736 {
840c54766306 Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 153
diff changeset
1737 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
1738 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
1739 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
1740 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
1741 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
1742 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
1743 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
1744 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
1745 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
1746 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
1747 success = TRUE;
840c54766306 Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 153
diff changeset
1748 }
58
5c66a108aa47 Fixed 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 }
5c66a108aa47 Fixed 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
5c66a108aa47 Fixed 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 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
1752 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
1753 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
1754 }
5c66a108aa47 Fixed 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 }
5c66a108aa47 Fixed 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 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
1758 }
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
1759 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
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
5c66a108aa47 Fixed 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 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
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 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
1765 {
5c66a108aa47 Fixed 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 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
1767 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
1768 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
1769 SetActiveWindow(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
1770 _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
1771 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
1772 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
1773 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
1774 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
1775 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
1776 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
1777 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
1778 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
1779 _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
1780 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
1781 }
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
1782 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
1783 }
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
1784
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
1785 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
1786 {
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
1787 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
1788
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
1789 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
1790
5c66a108aa47 Fixed 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 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
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 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
1794 {
5c66a108aa47 Fixed 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 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
1796 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
1797 case WM_RBUTTONDOWN:
109
94d273843a41 Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 107
diff changeset
1798 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
1799 {
5c66a108aa47 Fixed 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 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
1801
5c66a108aa47 Fixed 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 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
1803 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
1804 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
1805
5c66a108aa47 Fixed 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 /* 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
1807 * 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
1808 */
109
94d273843a41 Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 107
diff changeset
1809 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
1810 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
1811
109
94d273843a41 Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 107
diff changeset
1812 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
1813
58
5c66a108aa47 Fixed 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 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
1815 }
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
1816 break;
109
94d273843a41 Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 107
diff changeset
1817 case WM_LBUTTONUP:
94d273843a41 Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 107
diff changeset
1818 case WM_MBUTTONUP:
94d273843a41 Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 107
diff changeset
1819 case WM_RBUTTONUP:
94d273843a41 Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 107
diff changeset
1820 case WM_KEYUP:
94d273843a41 Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 107
diff changeset
1821 {
94d273843a41 Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 107
diff changeset
1822 BOOL ret;
94d273843a41 Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 107
diff changeset
1823
94d273843a41 Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 107
diff changeset
1824 if(!cinfo || !cinfo->pOldProc)
94d273843a41 Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 107
diff changeset
1825 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
1826 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
1827
94d273843a41 Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 107
diff changeset
1828 /* 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
1829 * 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
1830 */
94d273843a41 Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 107
diff changeset
1831 if(cinfo && cinfo->buddy)
94d273843a41 Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 107
diff changeset
1832 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
1833
94d273843a41 Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 107
diff changeset
1834 KillTimer(hWnd, 100);
94d273843a41 Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 107
diff changeset
1835
94d273843a41 Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 107
diff changeset
1836 return ret;
94d273843a41 Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 107
diff changeset
1837 }
94d273843a41 Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 107
diff changeset
1838 break;
94d273843a41 Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 107
diff changeset
1839 case WM_TIMER:
94d273843a41 Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 107
diff changeset
1840 {
94d273843a41 Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 107
diff changeset
1841 if(mp1 == 100)
94d273843a41 Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 107
diff changeset
1842 {
94d273843a41 Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 107
diff changeset
1843 BOOL ret;
94d273843a41 Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 107
diff changeset
1844
94d273843a41 Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 107
diff changeset
1845 if(cinfo && cinfo->buddy)
94d273843a41 Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 107
diff changeset
1846 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
1847
94d273843a41 Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 107
diff changeset
1848 if(!cinfo || !cinfo->pOldProc)
94d273843a41 Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 107
diff changeset
1849 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
1850 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
1851
94d273843a41 Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 107
diff changeset
1852 /* 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
1853 * 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
1854 */
94d273843a41 Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 107
diff changeset
1855 if(cinfo && cinfo->buddy)
94d273843a41 Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 107
diff changeset
1856 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
1857
94d273843a41 Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 107
diff changeset
1858 return ret;
94d273843a41 Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 107
diff changeset
1859 }
94d273843a41 Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 107
diff changeset
1860 }
94d273843a41 Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 107
diff changeset
1861 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
1862 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
1863 {
5c66a108aa47 Fixed 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 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
1865 {
5c66a108aa47 Fixed 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 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
1867 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
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 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
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 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
1872
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
1873 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
1874 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
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 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
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 break;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1880 }
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
1881 }
58
5c66a108aa47 Fixed 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 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
1884 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
1885 return CallWindowProc(cinfo->pOldProc, hWnd, msg, mp1, mp2);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1886 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1887
40
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1888 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
1889 {
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1890 char tmpbuf[100];
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1891
58
5c66a108aa47 Fixed 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 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
1893
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1894 /* 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
1895 * obtain input focus.
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1896 */
58
5c66a108aa47 Fixed 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 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
1898 {
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1899 /* 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
1900 SignalHandler *tmp = Root;
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1901
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1902 /* 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
1903 while(tmp)
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1904 {
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1905 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
1906 {
58
5c66a108aa47 Fixed 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 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
1908
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1909 /* 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
1910 if(tmp->window == handle)
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1911 {
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1912 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
1913 tmp = NULL;
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1914 }
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1915 }
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1916 if(tmp)
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1917 tmp= tmp->next;
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1918 }
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1919 }
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1920 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
1921 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
1922 }
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
1923
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
1924 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
1925 {
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
1926 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
1927 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
1928 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
1929
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
1930 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
1931
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
1932 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
1933 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
1934 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
1935
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
1936 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
1937 {
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
1938 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
1939
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
1940 switch( msg )
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1941 {
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
1942 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
1943 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
1944 _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
1945 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
1946 _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
1947 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
1948 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
1949 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
1950 _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
1951 break;
110
d4c1a9ebc72f Spinbutton behaviour cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 109
diff changeset
1952 case WM_KEYDOWN:
d4c1a9ebc72f Spinbutton behaviour cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 109
diff changeset
1953 case WM_KEYUP:
d4c1a9ebc72f Spinbutton behaviour cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 109
diff changeset
1954 {
d4c1a9ebc72f Spinbutton behaviour cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 109
diff changeset
1955 if(mp1 == VK_UP || mp1 == VK_DOWN)
d4c1a9ebc72f Spinbutton behaviour cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 109
diff changeset
1956 {
d4c1a9ebc72f Spinbutton behaviour cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 109
diff changeset
1957 BOOL ret;
d4c1a9ebc72f Spinbutton behaviour cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 109
diff changeset
1958
d4c1a9ebc72f Spinbutton behaviour cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 109
diff changeset
1959 if(!cinfo || !cinfo->pOldProc)
d4c1a9ebc72f Spinbutton behaviour cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 109
diff changeset
1960 ret = DefWindowProc(hWnd, msg, mp1, mp2);
d4c1a9ebc72f Spinbutton behaviour cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 109
diff changeset
1961 ret = CallWindowProc(cinfo->pOldProc, hWnd, msg, mp1, mp2);
d4c1a9ebc72f Spinbutton behaviour cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 109
diff changeset
1962
d4c1a9ebc72f Spinbutton behaviour cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 109
diff changeset
1963 /* Tell the spinner control that a keypress has
d4c1a9ebc72f Spinbutton behaviour cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 109
diff changeset
1964 * occured and to update it's internal value.
d4c1a9ebc72f Spinbutton behaviour cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 109
diff changeset
1965 */
d4c1a9ebc72f Spinbutton behaviour cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 109
diff changeset
1966 if(cinfo && cinfo->buddy && !cinfo->combo)
d4c1a9ebc72f Spinbutton behaviour cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 109
diff changeset
1967 PostMessage(hWnd, WM_USER+10, 0, 0);
d4c1a9ebc72f Spinbutton behaviour cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 109
diff changeset
1968
d4c1a9ebc72f Spinbutton behaviour cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 109
diff changeset
1969 if(msg == WM_KEYDOWN)
d4c1a9ebc72f Spinbutton behaviour cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 109
diff changeset
1970 SetTimer(hWnd, 101, 100, (TIMERPROC)NULL);
d4c1a9ebc72f Spinbutton behaviour cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 109
diff changeset
1971 else
d4c1a9ebc72f Spinbutton behaviour cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 109
diff changeset
1972 KillTimer(hWnd, 101);
d4c1a9ebc72f Spinbutton behaviour cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 109
diff changeset
1973
d4c1a9ebc72f Spinbutton behaviour cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 109
diff changeset
1974 return ret;
d4c1a9ebc72f Spinbutton behaviour cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 109
diff changeset
1975 }
d4c1a9ebc72f Spinbutton behaviour cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 109
diff changeset
1976 }
d4c1a9ebc72f Spinbutton behaviour cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 109
diff changeset
1977 break;
d4c1a9ebc72f Spinbutton behaviour cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 109
diff changeset
1978 case WM_TIMER:
d4c1a9ebc72f Spinbutton behaviour cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 109
diff changeset
1979 {
d4c1a9ebc72f Spinbutton behaviour cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 109
diff changeset
1980 if(mp1 == 101)
d4c1a9ebc72f Spinbutton behaviour cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 109
diff changeset
1981 {
d4c1a9ebc72f Spinbutton behaviour cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 109
diff changeset
1982 BOOL ret;
d4c1a9ebc72f Spinbutton behaviour cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 109
diff changeset
1983
d4c1a9ebc72f Spinbutton behaviour cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 109
diff changeset
1984 if(!cinfo || !cinfo->pOldProc)
d4c1a9ebc72f Spinbutton behaviour cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 109
diff changeset
1985 ret = DefWindowProc(hWnd, msg, mp1, mp2);
d4c1a9ebc72f Spinbutton behaviour cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 109
diff changeset
1986 ret = CallWindowProc(cinfo->pOldProc, hWnd, msg, mp1, mp2);
d4c1a9ebc72f Spinbutton behaviour cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 109
diff changeset
1987
d4c1a9ebc72f Spinbutton behaviour cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 109
diff changeset
1988 /* Tell the spinner control that a keypress has
d4c1a9ebc72f Spinbutton behaviour cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 109
diff changeset
1989 * occured and to update it's internal value.
d4c1a9ebc72f Spinbutton behaviour cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 109
diff changeset
1990 */
d4c1a9ebc72f Spinbutton behaviour cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 109
diff changeset
1991 if(cinfo && cinfo->buddy && !cinfo->combo)
d4c1a9ebc72f Spinbutton behaviour cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 109
diff changeset
1992 PostMessage(hWnd, WM_USER+10, 0, 0);
d4c1a9ebc72f Spinbutton behaviour cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 109
diff changeset
1993
d4c1a9ebc72f Spinbutton behaviour cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 109
diff changeset
1994 return ret;
d4c1a9ebc72f Spinbutton behaviour cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 109
diff changeset
1995 }
d4c1a9ebc72f Spinbutton behaviour cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 109
diff changeset
1996 }
d4c1a9ebc72f Spinbutton behaviour cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 109
diff changeset
1997 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
1998 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
1999 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
2000 {
82
aec9a0b0b539 Fixes for a resource leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 79
diff changeset
2001 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
2002 {
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
2003 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
2004 _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
2005 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
2006 _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
2007 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
2008 _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
2009 }
58
5c66a108aa47 Fixed 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 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
2011 {
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
2012 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
2013 _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
2014 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
2015 _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
2016 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
2017 _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
2018 }
58
5c66a108aa47 Fixed 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 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
2020 }
5c66a108aa47 Fixed 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 else if(LOWORD(mp1) == '\r')
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2022 {
58
5c66a108aa47 Fixed 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 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
2024 _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
2025
5c66a108aa47 Fixed 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 }
111
1e406d67b178 Readded a piece of code I accidentally removed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 110
diff changeset
2027
1e406d67b178 Readded a piece of code I accidentally removed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 110
diff changeset
2028 /* 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
2029 * 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
2030 */
1e406d67b178 Readded a piece of code I accidentally removed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 110
diff changeset
2031 if(cinfo->buddy && !cinfo->combo)
1e406d67b178 Readded a piece of code I accidentally removed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 110
diff changeset
2032 {
1e406d67b178 Readded a piece of code I accidentally removed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 110
diff changeset
2033 if(IsWinNT())
1e406d67b178 Readded a piece of code I accidentally removed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 110
diff changeset
2034 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
2035 else
1e406d67b178 Readded a piece of code I accidentally removed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 110
diff changeset
2036 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
2037 }
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2038 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
2039 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
2040 {
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2041 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
2042 {
79
8082cb0e7c2e Updated to the latest DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 75
diff changeset
2043 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
2044
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
2045 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
2046 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
2047 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
2048 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
2049
79
8082cb0e7c2e Updated to the latest DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 75
diff changeset
2050 sprintf(tmpbuf, "%d", val);
8082cb0e7c2e Updated to the latest DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 75
diff changeset
2051 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
2052 }
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2053 }
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2054 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
2055 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
2056 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
2057 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
2058 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
2059 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
2060 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
2061 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
2062 {
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2063 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
2064 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
2065 {
155
840c54766306 Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 153
diff changeset
2066 /* Handle foreground */
840c54766306 Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 153
diff changeset
2067 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
2068 {
155
840c54766306 Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 153
diff changeset
2069 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
2070 {
840c54766306 Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 153
diff changeset
2071 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
2072 _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
2073 _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
2074 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2075 }
155
840c54766306 Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 153
diff changeset
2076 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
2077 {
58
5c66a108aa47 Fixed 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 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
2079 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
2080 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
2081 }
840c54766306 Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 153
diff changeset
2082 /* Handle background */
840c54766306 Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 153
diff changeset
2083 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
2084 {
840c54766306 Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 153
diff changeset
2085 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
2086 {
840c54766306 Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 153
diff changeset
2087 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
2088
840c54766306 Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 153
diff changeset
2089 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
2090
840c54766306 Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 153
diff changeset
2091
840c54766306 Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 153
diff changeset
2092 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
2093 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
2094 }
840c54766306 Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 153
diff changeset
2095 else
840c54766306 Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 153
diff changeset
2096 {
840c54766306 Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 153
diff changeset
2097 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
2098 _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
2099 _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
2100 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
2101 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
2102 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
2103 _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
2104 _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
2105 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
2106 }
840c54766306 Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 153
diff changeset
2107 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
2108 }
840c54766306 Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 153
diff changeset
2109 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
2110 {
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2111 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
2112 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
2113 DW_BLUE_VALUE(thiscinfo->back)));
82
aec9a0b0b539 Fixes for a resource leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 79
diff changeset
2114 if(thiscinfo->hbrush)
aec9a0b0b539 Fixes for a resource leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 79
diff changeset
2115 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
2116 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
2117 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
2118 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
2119 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
2120 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
2121 }
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
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
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2124 }
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2125 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
2126 }
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
2127 }
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
2128
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2129 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
2130 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
2131 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
2132 }
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2133
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2134 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
2135 {
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2136 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
2137
5c66a108aa47 Fixed 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 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
2139
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
2140 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
2141 {
58
5c66a108aa47 Fixed 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 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
2143 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
2144 _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
2145 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
2146 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
2147 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
2148 {
58
5c66a108aa47 Fixed 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 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
2150 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
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(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
2153 {
82
aec9a0b0b539 Fixes for a resource leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 79
diff changeset
2154 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
2155 _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
2156 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
2157 _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
2158 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
2159 }
5c66a108aa47 Fixed 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
5c66a108aa47 Fixed 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 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
2162 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
2163
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2164 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
2165
69
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
2166 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
2167
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2168 if(iItem > -1)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2169 {
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2170 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
2171 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
2172
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2173 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
2174 }
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2175
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2176 {
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2177 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
2178
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2179 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
2180 {
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2181 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
2182 {
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2183 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
2184
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2185 /* 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
2186 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
2187 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
2188
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2189 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
2190 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
2191 }
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2192 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
2193 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
2194 }
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
2195 }
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
2196 }
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
2197 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
2198 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
2199 {
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2200 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
2201
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2202 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
2203 {
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2204 if(tmp->message == NM_RCLICK && tmp->window == hWnd)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2205 {
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2206 int (*containercontextfunc)(HWND, char *, 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
2207 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
2208 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
2209 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
2210 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
2211
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2212 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
2213
5c66a108aa47 Fixed 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 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
2215 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
2216
5c66a108aa47 Fixed 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 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
2218
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2219 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
2220
69
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
2221 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
2222
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2223 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
2224 {
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2225 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
2226 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
2227
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2228 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
2229 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
2230 }
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2231
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2232 /* 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
2233 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
2234 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
2235
5c66a108aa47 Fixed 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 containercontextfunc(tmp->window, (char *)lvi.lParam, x, y, 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
2237 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
2238 }
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2239 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
2240 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
2241 }
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
2242 }
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
2243 break;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2244 }
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2245
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2246 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
2247 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
2248 return CallWindowProc(cinfo->pOldProc, hWnd, msg, mp1, mp2);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2249 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2250
68
8d6100960adf Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 67
diff changeset
2251 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
2252 {
8d6100960adf Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 67
diff changeset
2253 ContainerInfo *cinfo;
8d6100960adf Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 67
diff changeset
2254
8d6100960adf Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 67
diff changeset
2255 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
2256
8d6100960adf Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 67
diff changeset
2257 switch( msg )
8d6100960adf Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 67
diff changeset
2258 {
8d6100960adf Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 67
diff changeset
2259 case WM_CHAR:
8d6100960adf Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 67
diff changeset
2260 if(LOWORD(mp1) == '\t')
8d6100960adf Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 67
diff changeset
2261 {
82
aec9a0b0b539 Fixes for a resource leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 79
diff changeset
2262 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
2263 _shift_focus_back(hWnd);
8d6100960adf Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 67
diff changeset
2264 else
8d6100960adf Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 67
diff changeset
2265 _shift_focus(hWnd);
8d6100960adf Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 67
diff changeset
2266 return FALSE;
8d6100960adf Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 67
diff changeset
2267 }
8d6100960adf Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 67
diff changeset
2268 break;
8d6100960adf Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 67
diff changeset
2269 }
8d6100960adf Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 67
diff changeset
2270
8d6100960adf Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 67
diff changeset
2271 if(!cinfo || !cinfo->pOldProc)
8d6100960adf Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 67
diff changeset
2272 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
2273 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
2274 }
8d6100960adf Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 67
diff changeset
2275
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2276 void _changebox(Box *thisbox, int percent, int type)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2277 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2278 int z;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2279
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2280 for(z=0;z<thisbox->count;z++)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2281 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2282 if(thisbox->items[z].type == TYPEBOX)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2283 {
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2284 Box *tmp = (Box*)GetWindowLong(thisbox->items[z].hwnd, GWL_USERDATA);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2285 _changebox(tmp, percent, type);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2286 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2287 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2288 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2289 if(type == BOXHORZ)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2290 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2291 if(thisbox->items[z].hsize == SIZEEXPAND)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2292 thisbox->items[z].width = (int)(((float)thisbox->items[z].origwidth) * (((float)percent)/((float)100.0)));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2293 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2294 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2295 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2296 if(thisbox->items[z].vsize == SIZEEXPAND)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2297 thisbox->items[z].height = (int)(((float)thisbox->items[z].origheight) * (((float)percent)/((float)100.0)));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2298 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2299 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2300 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2301 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2302
126
72cb88af4490 Finalized splitbar support on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2303 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
2304 {
72cb88af4490 Finalized splitbar support on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2305 if(type == BOXHORZ)
72cb88af4490 Finalized splitbar support on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2306 {
72cb88af4490 Finalized splitbar support on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2307 int newx = x - SPLITBAR_WIDTH, newy = y;
72cb88af4490 Finalized splitbar support on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2308 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
2309 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
2310 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
2311 Box *tmp = (Box *)GetWindowLong(handle1, GWL_USERDATA);
126
72cb88af4490 Finalized splitbar support on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2312
72cb88af4490 Finalized splitbar support on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2313 newx = (int)((float)newx * ratio);
72cb88af4490 Finalized splitbar support on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2314
167
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
2315 ShowWindow(handle1, SW_HIDE);
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
2316 ShowWindow(handle2, SW_HIDE);
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
2317
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
2318 MoveWindow(handle1, 0, 0, newx, y, FALSE);
126
72cb88af4490 Finalized splitbar support on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2319 _do_resize(tmp, newx, y);
72cb88af4490 Finalized splitbar support on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2320
167
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
2321 tmp = (Box *)GetWindowLong(handle2, GWL_USERDATA);
126
72cb88af4490 Finalized splitbar support on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2322
72cb88af4490 Finalized splitbar support on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2323 newx = x - newx - SPLITBAR_WIDTH;
72cb88af4490 Finalized splitbar support on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2324
167
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
2325 MoveWindow(handle2, x - newx, 0, newx, y, FALSE);
126
72cb88af4490 Finalized splitbar support on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2326 _do_resize(tmp, newx, y);
72cb88af4490 Finalized splitbar support on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2327
167
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
2328 ShowWindow(handle1, SW_SHOW);
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
2329 ShowWindow(handle2, SW_SHOW);
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
2330
126
72cb88af4490 Finalized splitbar support on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2331 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
2332 }
72cb88af4490 Finalized splitbar support on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2333 else
72cb88af4490 Finalized splitbar support on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2334 {
72cb88af4490 Finalized splitbar support on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2335 int newx = x, newy = y - SPLITBAR_WIDTH;
72cb88af4490 Finalized splitbar support on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2336 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
2337 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
2338 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
2339 Box *tmp = (Box *)GetWindowLong(handle1, GWL_USERDATA);
126
72cb88af4490 Finalized splitbar support on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2340
72cb88af4490 Finalized splitbar support on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2341 newy = (int)((float)newy * ratio);
72cb88af4490 Finalized splitbar support on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2342
167
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
2343 ShowWindow(handle1, SW_HIDE);
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
2344 ShowWindow(handle2, SW_HIDE);
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
2345
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
2346 MoveWindow(handle1, 0, y - newy, x, newy, FALSE);
126
72cb88af4490 Finalized splitbar support on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2347 _do_resize(tmp, x, newy);
72cb88af4490 Finalized splitbar support on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2348
167
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
2349 tmp = (Box *)GetWindowLong(handle2, GWL_USERDATA);
126
72cb88af4490 Finalized splitbar support on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2350
72cb88af4490 Finalized splitbar support on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2351 newy = y - newy - SPLITBAR_WIDTH;
72cb88af4490 Finalized splitbar support on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2352
167
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
2353 MoveWindow(handle2, 0, 0, x, newy, FALSE);
126
72cb88af4490 Finalized splitbar support on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2354 _do_resize(tmp, x, newy);
72cb88af4490 Finalized splitbar support on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2355
167
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
2356 ShowWindow(handle1, SW_SHOW);
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
2357 ShowWindow(handle2, SW_SHOW);
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
2358
126
72cb88af4490 Finalized splitbar support on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2359 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
2360 }
72cb88af4490 Finalized splitbar support on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2361 }
72cb88af4490 Finalized splitbar support on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2362
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2363 /* 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
2364 BOOL CALLBACK _splitwndproc(HWND hwnd, UINT msg, WPARAM mp1, LPARAM mp2)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2365 {
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
2366 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
2367 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
2368 int start = (int)dw_window_get_data(hwnd, "_dw_start");
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2369
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2370 switch (msg)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2371 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2372 case WM_ACTIVATE:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2373 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
2374 return FALSE;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2375
167
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
2376 case WM_PAINT:
118
c170181668b7 Initial new splitbar code on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 111
diff changeset
2377 {
167
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
2378 PAINTSTRUCT ps;
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
2379 HDC hdcPaint;
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
2380
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
2381 BeginPaint(hwnd, &ps);
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
2382
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
2383 if((hdcPaint = GetDC(hwnd)) != NULL)
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
2384 {
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
2385 int cx, cy;
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
2386 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
2387 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
2388
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
2389 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
2390
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
2391 if(type == BOXHORZ)
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
2392 Rectangle(hdcPaint, cx - start - 3, 0, cx - start, cy);
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
2393 else
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
2394 Rectangle(hdcPaint, 0, start, cx, start + 3);
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
2395
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
2396 SelectObject(hdcPaint, oldBrush);
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
2397 DeleteObject(SelectObject(hdcPaint, oldPen));
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
2398 ReleaseDC(hwnd, hdcPaint);
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
2399 }
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
2400 EndPaint(hwnd, &ps);
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
2401 }
126
72cb88af4490 Finalized splitbar support on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2402 break;
72cb88af4490 Finalized splitbar support on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2403 case WM_LBUTTONDOWN:
72cb88af4490 Finalized splitbar support on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2404 {
72cb88af4490 Finalized splitbar support on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2405 SetCapture(hwnd);
72cb88af4490 Finalized splitbar support on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2406 break;
72cb88af4490 Finalized splitbar support on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2407 }
72cb88af4490 Finalized splitbar support on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2408 case WM_LBUTTONUP:
72cb88af4490 Finalized splitbar support on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2409 {
72cb88af4490 Finalized splitbar support on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2410 if(GetCapture() == hwnd)
72cb88af4490 Finalized splitbar support on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2411 ReleaseCapture();
118
c170181668b7 Initial new splitbar code on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 111
diff changeset
2412 }
c170181668b7 Initial new splitbar code on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 111
diff changeset
2413 break;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2414 case WM_MOUSEMOVE:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2415 {
118
c170181668b7 Initial new splitbar code on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 111
diff changeset
2416 if(type == BOXHORZ)
58
5c66a108aa47 Fixed 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 SetCursor(LoadCursor(NULL, IDC_SIZEWE));
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2418 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
2419 SetCursor(LoadCursor(NULL, IDC_SIZENS));
126
72cb88af4490 Finalized splitbar support on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2420
127
c5c3ccb84ac7 Safety checks in the splitbar calculations on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 126
diff changeset
2421 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
2422 {
126
72cb88af4490 Finalized splitbar support on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2423 POINT point;
72cb88af4490 Finalized splitbar support on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2424 RECT rect;
157
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
2425 static POINT lastpoint;
126
72cb88af4490 Finalized splitbar support on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2426
72cb88af4490 Finalized splitbar support on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2427 GetCursorPos(&point);
72cb88af4490 Finalized splitbar support on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2428 GetWindowRect(hwnd, &rect);
72cb88af4490 Finalized splitbar support on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2429
157
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
2430 if(memcmp(&point, &lastpoint, sizeof(POINT)))
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2431 {
157
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
2432 if(PtInRect(&rect, point))
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2433 {
157
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
2434 int width = (rect.right - rect.left);
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
2435 int height = (rect.bottom - rect.top);
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
2436
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
2437 if(type == BOXHORZ)
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
2438 {
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
2439 start = point.x - rect.left;
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
2440 if(width - SPLITBAR_WIDTH > 1 && start < width - SPLITBAR_WIDTH)
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
2441 *percent = ((float)start / (float)(width - SPLITBAR_WIDTH)) * 100.0;
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
2442 }
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
2443 else
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
2444 {
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
2445 start = point.y - rect.top;
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
2446 if(height - SPLITBAR_WIDTH > 1 && start < height - SPLITBAR_WIDTH)
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
2447 *percent = ((float)start / (float)(height - SPLITBAR_WIDTH)) * 100.0;
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
2448 }
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
2449 _handle_splitbar_resize(hwnd, *percent, type, width, height);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2450 }
157
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
2451 memcpy(&lastpoint, &point, sizeof(POINT));
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2452 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2453 }
126
72cb88af4490 Finalized splitbar support on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2454 break;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2455 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2456 }
58
5c66a108aa47 Fixed 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 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
2458 }
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2459
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2460 /* 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
2461 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
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 switch (msg)
7
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
2464 {
58
5c66a108aa47 Fixed 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 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
2466 {
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2467 /* 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
2468 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
2469
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2470 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
2471 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
2472 }
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2473 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
2474 {
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2475 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
2476 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
2477 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
2478 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
2479 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
2480 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
2481 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
2482 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
2483 char 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
2484
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2485 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
2486 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
2487
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2488 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
2489 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
2490
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2491 hdcPaint = GetDC(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
2492
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2493 oldBrush = _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
2494 oldPen = _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
2495
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2496 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
2497
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2498
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2499 _hBrush[threadid] = CreateSolidBrush(GetSysColor(COLOR_3DFACE));
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2500
5c66a108aa47 Fixed 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 dw_draw_rect(hwnd, 0, TRUE, 0, 0, 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
2502
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2503 _hPen[threadid] = CreatePen(PS_SOLID, 1, RGB(_red[DW_CLR_DARKGRAY],
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2504 _green[DW_CLR_DARKGRAY],
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2505 _blue[DW_CLR_DARKGRAY]));
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2506
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2507 dw_draw_line(hwnd, 0, 0, 0, cx, 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
2508 dw_draw_line(hwnd, 0, 0, 0, 0, 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
2509
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2510 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
2511
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2512 _hPen[threadid] = GetStockObject(WHITE_PEN);
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2513
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2514 dw_draw_line(hwnd, 0, cx - 1, cy - 1, cx - 1, 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
2515 dw_draw_line(hwnd, 0, cx - 1, cy - 1, 0, cy - 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
2516
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2517 rc.left = 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
2518 rc.top = 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
2519 rc.bottom = cy - 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
2520 rc.right = cx - 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
2521
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2522 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
2523
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2524 hFont = (HFONT)SelectObject(hdcPaint, 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
2525
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2526 SetTextColor(hdcPaint, RGB(0,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
2527 SetBkMode(hdcPaint, TRANSPARENT);
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2528
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2529 ExtTextOut(hdcPaint, 3, 1, ETO_CLIPPED, &rc, tempbuf, strlen(tempbuf), 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
2530
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2531 SelectObject(hdcPaint, 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
2532
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2533 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
2534 _hBrush[threadid] = 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
2535 _hPen[threadid] = 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
2536 ReleaseDC(hwnd, 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
2537 }
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2538 return FALSE;
7
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
2539 }
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2540 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
2541 }
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2542
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2543 /* Function: _BtProc
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2544 * Abstract: Subclass procedure for buttons
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2545 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2546
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2547 BOOL CALLBACK _BtProc(HWND hwnd, ULONG msg, WPARAM mp1, LPARAM mp2)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2548 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2549 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
2550 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
2551 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
2552 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
2553 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
2554
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2555 bubble = (BubbleButton *)GetWindowLong(hwnd, GWL_USERDATA);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2556
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2557 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
2558 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
2559
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2560 /* 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
2561 * 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
2562 * 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
2563 * 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
2564 */
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2565 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
2566
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2567 switch(msg)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2568 {
37
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
2569 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
2570 _wndproc(hwnd, msg, mp1, mp2);
37
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
2571 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
2572 case WM_LBUTTONUP:
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2573 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2574 SignalHandler *tmp = Root;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2575
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2576 /* 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
2577 while(tmp)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2578 {
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2579 if(tmp->message == WM_COMMAND)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2580 {
58
5c66a108aa47 Fixed 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 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
2582
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2583 /* 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
2584 if(tmp->window == hwnd)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2585 {
60
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 59
diff changeset
2586 if(bubble->checkbox)
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 59
diff changeset
2587 in_checkbox_handler = 1;
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 59
diff changeset
2588
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2589 clickfunc(tmp->window, tmp->data);
60
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 59
diff changeset
2590
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 59
diff changeset
2591 if(bubble->checkbox)
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 59
diff changeset
2592 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
2593 tmp = NULL;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2594 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2595 }
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2596 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
2597 tmp= tmp->next;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2598 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2599 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2600 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2601 case WM_CHAR:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2602 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2603 /* A button press should also occur for an ENTER or SPACE press
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2604 * while the button has the active input focus.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2605 */
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2606 if(LOWORD(mp1) == '\r' || LOWORD(mp1) == ' ')
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2607 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2608 SignalHandler *tmp = Root;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2609
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2610 /* Find any callbacks for this function */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2611 while(tmp)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2612 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2613 if(tmp->message == WM_COMMAND)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2614 {
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2615 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
2616
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2617 /* Make sure it's the right window, and the right ID */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2618 if(tmp->window == hwnd)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2619 {
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2620 clickfunc(tmp->window, tmp->data);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2621 tmp = NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2622 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2623 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2624 if(tmp)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2625 tmp= tmp->next;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2626 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2627 }
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2628 if(LOWORD(mp1) == '\t')
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2629 {
82
aec9a0b0b539 Fixes for a resource leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 79
diff changeset
2630 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
2631 _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
2632 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
2633 _shift_focus(hwnd);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2634 return FALSE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2635 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2636 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2637 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
2638 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
2639 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
2640 _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
2641 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
2642 _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
2643 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
2644 case WM_TIMER:
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2645 if (hwndBubble)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2646 {
82
aec9a0b0b539 Fixes for a resource leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 79
diff changeset
2647 _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
2648 DestroyWindow(hwndBubble);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2649 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
2650 KillTimer(hwnd, 1);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2651 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2652 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2653
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2654 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
2655 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
2656 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
2657
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2658 if(PtInRect(&rect, point))
17
f26eced21a30 Some more updates.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 15
diff changeset
2659 {
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2660 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
2661 {
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2662 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
2663 }
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2664 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
2665 {
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2666 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
2667 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
2668 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
2669
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2670 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
2671 {
82
aec9a0b0b539 Fixes for a resource leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 79
diff changeset
2672 _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
2673 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
2674 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
2675 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
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
5c66a108aa47 Fixed 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 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
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 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
2681 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
2682 SIZE size;
82
aec9a0b0b539 Fixes for a resource leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 79
diff changeset
2683 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
2684 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
2685 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
2686 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
2687
5c66a108aa47 Fixed 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 /* 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
2689 * 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
2690 * 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
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 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
2693 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
2694 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
2695 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
2696 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
2697 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
2698 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
2699 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
2700 NULL,
109
94d273843a41 Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 107
diff changeset
2701 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
2702 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
2703
5c66a108aa47 Fixed 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 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
2705 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
2706
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2707 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
2708
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2709 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
2710
82
aec9a0b0b539 Fixes for a resource leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 79
diff changeset
2711 hFont = (HFONT)SendMessage(hwndBubble, WM_GETFONT, 0, 0);
aec9a0b0b539 Fixes for a resource leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 79
diff changeset
2712
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2713 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
2714
82
aec9a0b0b539 Fixes for a resource leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 79
diff changeset
2715 if(hFont)
aec9a0b0b539 Fixes for a resource leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 79
diff changeset
2716 oldFont = (HFONT)SelectObject(hdc, hFont);
aec9a0b0b539 Fixes for a resource leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 79
diff changeset
2717
aec9a0b0b539 Fixes for a resource leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 79
diff changeset
2718 GetTextExtentPoint32(hdc, bubble->bubbletext, strlen(bubble->bubbletext), &size);
aec9a0b0b539 Fixes for a resource leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 79
diff changeset
2719
aec9a0b0b539 Fixes for a resource leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 79
diff changeset
2720 if(hFont)
aec9a0b0b539 Fixes for a resource leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 79
diff changeset
2721 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
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 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
2724
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2725 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
2726
5c66a108aa47 Fixed 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 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
2728 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
2729 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
2730 ptlWork.y + (rect.bottom-rect.top) + 1,
82
aec9a0b0b539 Fixes for a resource leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 79
diff changeset
2731 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
2732 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
2733 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
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 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
2736 }
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2737 }
5c66a108aa47 Fixed 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 }
5c66a108aa47 Fixed 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 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
2740 /* 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
2741 * 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
2742 */
5c66a108aa47 Fixed 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 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
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 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
2746 {
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2747 bMouseOver = 0;
82
aec9a0b0b539 Fixes for a resource leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 79
diff changeset
2748 _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
2749 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
2750 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
2751 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
2752 }
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2753 }
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2754 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
2755 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
2756 /* 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
2757 * 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
2758 * 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
2759 */
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2760 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
2761 {
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2762 bMouseOver = 0;
82
aec9a0b0b539 Fixes for a resource leak.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 79
diff changeset
2763 _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
2764 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
2765 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
2766 KillTimer(hwndBubbleLast, 1);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2767 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2768 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2769 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2770
58
5c66a108aa47 Fixed 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 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
2772 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
2773 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
2774 }
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2775
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2776 /* 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
2777 * 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
2778 */
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2779 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
2780 {
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2781 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
2782 NotebookPage **array = (NotebookPage **)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
2783
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2784 if(array && array[pageid])
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2785 {
58
5c66a108aa47 Fixed 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 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
2787
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2788 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
2789 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
2790 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
2791 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
2792 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
2793 {
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2794 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
2795 _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
2796 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
2797 }
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2798
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2799 ShowWindow(array[pageid]->hwnd, SW_SHOWNORMAL);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2800 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2801 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2802
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2803 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2804 * Initializes the Dynamic Windows engine.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2805 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2806 * newthread: True if this is the only thread.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2807 * False if there is already a message loop running.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2808 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
2809 int API dw_init(int newthread, int argc, char *argv[])
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2810 {
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2811 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
2812 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
2813 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
2814
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2815 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
2816 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
2817
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2818 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
2819
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2820 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
2821
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2822 /* 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
2823 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
2824 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
2825 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
2826 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
2827 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
2828 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
2829 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
2830 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
2831
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2832 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
2833
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2834 /* 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
2835 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
2836 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
2837 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
2838 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
2839 wc.cbWndExtra = 0;
167
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
2840 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
2841 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
2842 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
2843
5c66a108aa47 Fixed 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 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
2845
5c66a108aa47 Fixed 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 /* 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
2847 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
2848 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
2849 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
2850 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
2851 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
2852 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
2853 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
2854 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
2855 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
2856
5c66a108aa47 Fixed 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 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
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 /* 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
2860 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
2861 _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
2862
5c66a108aa47 Fixed 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 /* 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
2864 * 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
2865 * 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
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 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
2868 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
2869 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
2870 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
2871 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
2872 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
2873 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
2874 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
2875 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
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 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
2878
5c66a108aa47 Fixed 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 /* 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
2880 * 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
2881 * 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
2882 * 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
2883 * 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
2884 */
5c66a108aa47 Fixed 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
5c66a108aa47 Fixed 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 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
2887 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
2888
5c66a108aa47 Fixed 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 if(!DW_HWND_OBJECT)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2890 {
58
5c66a108aa47 Fixed 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 dw_messagebox("Dynamic Windows", "Could not initialize the object window. error code %d", GetLastError());
5c66a108aa47 Fixed 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 exit(1);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2893 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2894
58
5c66a108aa47 Fixed 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 /* 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
2896 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
2897 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
2898
5c66a108aa47 Fixed 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 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
2900 {
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2901 _foreground[z] = RGB(128,128,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
2902 _background[z] = 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
2903 _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
2904 _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
2905 }
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2906
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
2907 return 0;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2908 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2909
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2910 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2911 * 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
2912 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
2913 void API dw_main(void)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2914 {
58
5c66a108aa47 Fixed 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 MSG msg;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2916
63
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 61
diff changeset
2917 _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
2918
58
5c66a108aa47 Fixed 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 while (GetMessage(&msg, NULL, 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
2920 {
5c66a108aa47 Fixed 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 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
2922 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
2923 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2924 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2925
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2926 /*
63
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 61
diff changeset
2927 * 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
2928 * Parameters:
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 61
diff changeset
2929 * 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
2930 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
2931 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
2932 {
58
5c66a108aa47 Fixed 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 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
2934 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
2935
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 61
diff changeset
2936 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
2937 {
58
5c66a108aa47 Fixed 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 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
2939 {
58
5c66a108aa47 Fixed 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 GetMessage(&msg, NULL, 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
2941 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
2942 DispatchMessage(&msg);
37
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
2943 }
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
2944 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
2945 Sleep(1);
37
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
2946 }
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
2947 }
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
2948
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
2949 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2950 * Free's memory allocated by dynamic windows.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2951 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2952 * ptr: Pointer to dynamic windows allocated
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2953 * memory to be free()'d.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2954 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
2955 void API dw_free(void *ptr)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2956 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2957 free(ptr);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2958 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2959
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2960 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2961 * Allocates and initializes a dialog struct.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2962 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2963 * data: User defined data to be passed to functions.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2964 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
2965 DWDialog * API dw_dialog_new(void *data)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2966 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2967 DWDialog *tmp = malloc(sizeof(DWDialog));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2968
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2969 tmp->eve = dw_event_new();
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2970 dw_event_reset(tmp->eve);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2971 tmp->data = data;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2972 tmp->done = FALSE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2973 tmp->result = NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2974
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2975 return tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2976 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2977
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2978 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2979 * Accepts a dialog struct and returns the given data to the
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2980 * initial called of dw_dialog_wait().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2981 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2982 * dialog: Pointer to a dialog struct aquired by dw_dialog_new).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2983 * result: Data to be returned by dw_dialog_wait().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2984 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
2985 int API dw_dialog_dismiss(DWDialog *dialog, void *result)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2986 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2987 dialog->result = result;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2988 dw_event_post(dialog->eve);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2989 dialog->done = TRUE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2990 return 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2991 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2992
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2993 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2994 * Accepts a dialog struct waits for dw_dialog_dismiss() to be
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2995 * called by a signal handler with the given dialog struct.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2996 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2997 * dialog: Pointer to a dialog struct aquired by dw_dialog_new).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2998 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
2999 void * API dw_dialog_wait(DWDialog *dialog)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3000 {
58
5c66a108aa47 Fixed 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 MSG msg;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3002 void *tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3003
58
5c66a108aa47 Fixed 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 while (GetMessage(&msg,NULL,0,0))
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3005 {
58
5c66a108aa47 Fixed 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 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
3007 DispatchMessage(&msg);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3008 if(dialog->done)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3009 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3010 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3011 dw_event_close(&dialog->eve);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3012 tmp = dialog->result;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3013 free(dialog);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3014 return tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3015 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3016
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3017 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3018 * Displays a Message Box with given text and title..
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3019 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3020 * title: The title of the message box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3021 * format: printf style format string.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3022 * ...: Additional variables for use in the format.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3023 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
3024 int API dw_messagebox(char *title, char *format, ...)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3025 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3026 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
3027 char outbuf[256];
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3028
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3029 va_start(args, format);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3030 vsprintf(outbuf, format, args);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3031 va_end(args);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3032
58
5c66a108aa47 Fixed 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 MessageBox(HWND_DESKTOP, outbuf, title, MB_OK);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3034
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3035 return strlen(outbuf);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3036 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3037
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3038 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3039 * Displays a Message Box with given text and title..
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3040 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3041 * title: The title of the message box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3042 * text: The text to display in the box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3043 * Returns:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3044 * True if YES False of NO.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3045 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
3046 int API dw_yesno(char *title, char *text)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3047 {
58
5c66a108aa47 Fixed 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 if(MessageBox(HWND_DESKTOP, text, title, MB_YESNO) == IDYES)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3049 return TRUE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3050 return FALSE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3051 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3052
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3053 /*
58
5c66a108aa47 Fixed 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 * 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
3055 * 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
3056 * 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
3057 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
3058 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
3059 {
5c66a108aa47 Fixed 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 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
3061 }
5c66a108aa47 Fixed 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
5c66a108aa47 Fixed 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 /*
40
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
3064 * Makes the window topmost.
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
3065 * Parameters:
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
3066 * 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
3067 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
3068 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
3069 {
58
5c66a108aa47 Fixed 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 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
3071 }
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
3072
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
3073 /*
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
3074 * Makes the window bottommost.
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
3075 * Parameters:
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
3076 * 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
3077 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
3078 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
3079 {
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
3080 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
3081 }
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
3082
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
3083 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3084 * Makes the window visible.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3085 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3086 * handle: The window handle to make visible.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3087 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
3088 int API dw_window_show(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3089 {
58
5c66a108aa47 Fixed 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 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
3091 SetFocus(handle);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3092 _initial_focus(handle);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3093 return rc;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3094 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3095
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3096 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3097 * Makes the window invisible.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3098 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3099 * handle: The window handle to make visible.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3100 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
3101 int API dw_window_hide(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3102 {
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
3103 return ShowWindow(handle, SW_HIDE);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3104 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3105
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3106 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3107 * Destroys a window and all of it's children.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3108 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3109 * handle: The window handle to destroy.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3110 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
3111 int API dw_window_destroy(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3112 {
58
5c66a108aa47 Fixed 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 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
3114 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
3115
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
3116 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
3117 {
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
3118 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
3119 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
3120
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
3121 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
3122 {
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
3123 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
3124 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
3125 }
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
3126
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
3127 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
3128 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
3129
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
3130 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
3131
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
3132 /* 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
3133 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
3134 {
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
3135 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
3136 }
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
3137 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
3138 {
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
3139 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
3140 }
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
3141
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
3142 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
3143 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
3144 thisbox->count--;
167
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
3145 _free_window_memory(handle, 0);
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
3146 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
3147 }
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
3148 return DestroyWindow(handle);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3149 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3150
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
3151 /* 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
3152 * 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
3153 * 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
3154 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
3155 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
3156 {
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
3157 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
3158
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
3159 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
3160 {
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
3161 RECT rect;
167
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
3162 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
3163
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
3164 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
3165
167
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
3166 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
3167 _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
3168 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
3169 }
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
3170 }
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
3171
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3172 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3173 * Changes a window's parent to newparent.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3174 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3175 * handle: The window handle to destroy.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3176 * newparent: The window's new parent window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3177 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
3178 void API dw_window_reparent(HWND handle, HWND newparent)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3179 {
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
3180 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
3181 }
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
3182
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
3183 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
3184 {
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
3185 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
3186 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
3187 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
3188
88
58d8139fe0a2 Added vertical center logic for static text controls on windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 87
diff changeset
3189 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
3190 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
3191 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
3192 {
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
3193 #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
3194 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
3195 #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
3196 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
3197 {
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
3198 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
3199 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
3200 }
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
3201 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
3202
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
3203 #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
3204 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
3205 #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
3206 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
3207 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
3208 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
3209 lf.lfOrientation = 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
3210 lf.lfItalic = 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
3211 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
3212 lf.lfStrikeOut = 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
3213 lf.lfWeight = FW_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
3214 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
3215 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
3216 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
3217 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
3218 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
3219 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
3220
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
3221 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
3222 #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
3223 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
3224 #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
3225 }
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
3226 return hfont;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3227 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3228
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3229 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3230 * Sets the font used by a specified window (widget) handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3231 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3232 * handle: The window (widget) handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3233 * fontname: Name and size of the font in the form "size.fontname"
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3234 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
3235 int API dw_window_set_font(HWND handle, char *fontname)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3236 {
167
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
3237 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
3238 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
3239 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
3240
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
3241 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
3242
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
3243 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
3244 {
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
3245 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
3246 {
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
3247 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
3248 }
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
3249 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
3250 {
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
3251 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
3252 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
3253 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
3254
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
3255 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
3256
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
3257 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
3258 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
3259 }
5c66a108aa47 Fixed 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 }
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
3261 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
3262 if(oldfont)
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
3263 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
3264 return 0;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3265 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3266
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3267 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3268 * Sets the colors used by a specified window (widget) handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3269 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3270 * 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
3271 * 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
3272 * back: Background color in RGB format.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3273 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
3274 int API dw_window_set_color(HWND handle, ULONG fore, ULONG back)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
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 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
3277 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
3278
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
3279 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
3280
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
3281 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
3282
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
3283 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
3284 {
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
3285 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
3286 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
3287 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
3288 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
3289 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
3290 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
3291 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
3292 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
3293 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
3294 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
3295 return TRUE;
7
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
3296 }
58
5c66a108aa47 Fixed 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
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
3298 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
3299 {
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
3300 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
3301 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
3302 }
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
3303 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
3304 {
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
3305 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
3306
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
3307 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
3308 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
3309 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
3310
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
3311 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
3312 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
3313 }
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
3314 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
3315 return TRUE;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3316 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3317
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3318 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3319 * Sets the font used by a specified window (widget) handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3320 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3321 * handle: The window (widget) handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3322 * border: Size of the window border in pixels.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3323 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
3324 int API dw_window_set_border(HWND handle, int border)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3325 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3326 return 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3327 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3328
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3329 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3330 * Captures the mouse input to this window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3331 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3332 * handle: Handle to receive mouse input.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3333 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
3334 void API dw_window_capture(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3335 {
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
3336 SetCapture(handle);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3337 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3338
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3339 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3340 * Releases previous mouse capture.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3341 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
3342 void API dw_window_release(void)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3343 {
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
3344 ReleaseCapture();
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3345 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3346
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3347 /*
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 17
diff changeset
3348 * 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
3349 * Parameters:
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 17
diff changeset
3350 * 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
3351 * 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
3352 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
3353 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
3354 {
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
3355 SetCursor(LoadCursor(NULL, MAKEINTRESOURCE(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
3356 }
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 17
diff changeset
3357
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 17
diff changeset
3358 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3359 * Create a new Window Frame.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3360 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3361 * owner: The Owner's window handle or HWND_DESKTOP.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3362 * 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
3363 * flStyle: Style flags, see the DW reference.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3364 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
3365 HWND API dw_window_new(HWND hwndOwner, char *title, ULONG flStyle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
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 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
3368 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
3369 ULONG flStyleEx = 0;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3370
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3371 newbox->pad = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3372 newbox->type = BOXVERT;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3373 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
3374 newbox->cinfo.fore = newbox->cinfo.back = -1;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3375
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
3376 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
3377 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
3378
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
3379 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
3380 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
3381
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
3382 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
3383 {
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
3384 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
3385
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
3386 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
3387 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
3388 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3389 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
3390 {
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
3391 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
3392
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
3393 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
3394 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
3395 }
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
3396 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
3397
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
3398 #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
3399 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
3400 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
3401 #endif
12
26e2130135b9 Many Win32 and GTK fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 7
diff changeset
3402
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3403 return hwndframe;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3404 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3405
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3406 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3407 * Create a new Box to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3408 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3409 * type: Either BOXVERT (vertical) or BOXHORZ (horizontal).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3410 * pad: Number of pixels to pad around the box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3411 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
3412 HWND API dw_box_new(int type, int pad)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3413 {
90
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 89
diff changeset
3414 Box *newbox = calloc(sizeof(Box), 1);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3415 HWND hwndframe;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3416
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3417 newbox->pad = pad;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3418 newbox->type = type;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3419 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
3420 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
3421 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
3422
5c66a108aa47 Fixed 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 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
3424 "",
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
3425 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
3426 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
3427 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
3428 NULL,
109
94d273843a41 Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 107
diff changeset
3429 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
3430 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
3431
5c66a108aa47 Fixed 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 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
3433 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
3434
5c66a108aa47 Fixed 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 SetWindowLong(hwndframe, GWL_USERDATA, (ULONG)newbox);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3436 return hwndframe;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3437 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3438
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3439 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3440 * Create a new Group Box to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3441 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3442 * type: Either BOXVERT (vertical) or BOXHORZ (horizontal).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3443 * pad: Number of pixels to pad around the box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3444 * title: Text to be displayined in the group outline.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3445 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
3446 HWND API dw_groupbox_new(int type, int pad, char *title)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3447 {
90
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 89
diff changeset
3448 Box *newbox = calloc(sizeof(Box), 1);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3449 HWND hwndframe;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3450
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3451 newbox->pad = pad;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3452 newbox->type = type;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3453 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
3454 newbox->cinfo.fore = newbox->cinfo.back = -1;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3455
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
3456 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
3457 "",
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
3458 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
3459 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
3460 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
3461 NULL,
109
94d273843a41 Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 107
diff changeset
3462 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
3463 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
3464
5c66a108aa47 Fixed 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 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
3466 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
3467 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
3468 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
3469 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
3470 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
3471 NULL,
109
94d273843a41 Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 107
diff changeset
3472 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
3473 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
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 SetWindowLong(hwndframe, GWL_USERDATA, (ULONG)newbox);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3476 dw_window_set_font(newbox->grouphwnd, DefaultFont);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3477 return hwndframe;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3478 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3479
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3480 /*
14
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
3481 * 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
3482 * Parameters:
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
3483 * 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
3484 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
3485 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
3486 {
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
3487 CLIENTCREATESTRUCT ccs;
14
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
3488 HWND hwndframe;
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
3489
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
3490 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
3491 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
3492
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
3493 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
3494 "",
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
3495 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
3496 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
3497 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
3498 (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
3499 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
3500 &ccs);
14
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
3501 return hwndframe;
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
3502 }
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
3503
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
3504 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3505 * Create a bitmap object to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3506 * 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
3507 * id: An ID to be used with dw_window_from_id or 0L.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3508 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
3509 HWND API dw_bitmap_new(ULONG id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3510 {
58
5c66a108aa47 Fixed 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 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
3512 "",
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
3513 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
3514 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
3515 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
3516 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
3517 (HMENU)id,
109
94d273843a41 Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 107
diff changeset
3518 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
3519 NULL);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3520 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3521
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3522 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3523 * Create a notebook object to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3524 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3525 * id: An ID to be used for getting the resource from the
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3526 * resource file.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3527 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
3528 HWND API dw_notebook_new(ULONG id, int top)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3529 {
58
5c66a108aa47 Fixed 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 ULONG flags = 0;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3531 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
3532 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
3533
5c66a108aa47 Fixed 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 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
3535 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
3536
5c66a108aa47 Fixed 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 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
3538 "",
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
3539 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
3540 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
3541 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
3542 (HMENU)id,
109
94d273843a41 Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 107
diff changeset
3543 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
3544 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
3545 SetWindowLong(tmp, GWL_USERDATA, (ULONG)array);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3546 dw_window_set_font(tmp, DefaultFont);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3547 return tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3548 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3549
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3550 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3551 * Create a menu object to be popped up.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3552 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3553 * id: An ID to be used for getting the resource from the
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3554 * resource file.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3555 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
3556 HMENUI API dw_menu_new(ULONG id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3557 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3558 HMENUI tmp = malloc(sizeof(struct _hmenui));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3559
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3560 if(!tmp)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3561 return NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3562
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
3563 tmp->menu = CreatePopupMenu();
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
3564 tmp->hwnd = NULL;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3565 return tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3566 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3567
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3568 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3569 * Create a menubar on a window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3570 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3571 * location: Handle of a window frame to be attached to.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3572 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
3573 HMENUI API dw_menubar_new(HWND location)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3574 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3575 HMENUI tmp = malloc(sizeof(struct _hmenui));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3576
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3577 if(!tmp)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3578 return NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3579
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
3580 tmp->menu = CreateMenu();
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
3581 tmp->hwnd = location;
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
3582
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
3583 SetMenu(location, tmp->menu);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3584 return tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3585 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3586
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3587 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3588 * Destroys a menu created with dw_menubar_new or dw_menu_new.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3589 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3590 * menu: Handle of a menu.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3591 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
3592 void API dw_menu_destroy(HMENUI *menu)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3593 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3594 if(menu && *menu)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
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 DestroyMenu((*menu)->menu);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3597 free(*menu);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3598 *menu = NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3599 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3600 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3601
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3602 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3603 * Adds a menuitem or submenu to an existing menu.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3604 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3605 * menu: The handle the the existing menu.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3606 * title: The title text on the menu item to be added.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3607 * id: An ID to be used for message passing.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3608 * end: If TRUE memu is positioned at the end of the menu.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3609 * 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
3610 * flags: Extended attributes to set on the menu.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3611 * submenu: Handle to an existing menu to be a submenu or NULL.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3612 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
3613 HWND API dw_menu_append_item(HMENUI menux, char *title, ULONG id, ULONG flags, int end, int check, HMENUI submenu)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3614 {
58
5c66a108aa47 Fixed 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 MENUITEMINFO mii;
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
3616 HMENU menu;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3617
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3618 if(!menux)
58
5c66a108aa47 Fixed 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 return NULL;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3620
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3621 menu = menux->menu;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3622
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
3623 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
3624 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
3625
5c66a108aa47 Fixed 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 /* 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
3627 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
3628 {
5c66a108aa47 Fixed 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 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
3630
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
3631 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
3632 {
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
3633 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
3634 *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
3635 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
3636 }
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
3637 }
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
3638
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
3639 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
3640 mii.fType = MFT_STRING;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3641 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
3642 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
3643
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
3644 mii.wID = 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
3645 mii.hSubMenu = submenu ? submenu->menu : 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
3646 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
3647 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
3648
5c66a108aa47 Fixed 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 InsertMenuItem(menu, 65535, TRUE, &mii);
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
3650 if(menux->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
3651 DrawMenuBar(menux->hwnd);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3652 return (HWND)id;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3653 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3654
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3655 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3656 * Sets the state of a menu item check.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3657 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3658 * menu: The handle the the existing menu.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3659 * id: Menuitem id.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3660 * check: TRUE for checked FALSE for not checked.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3661 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
3662 void API dw_menu_item_set_check(HMENUI menux, unsigned long id, int check)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3663 {
58
5c66a108aa47 Fixed 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 MENUITEMINFO mii;
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
3665 HMENU menu;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3666
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3667 if(!menux)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3668 return;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3669
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3670 menu = menux->menu;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3671
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
3672 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
3673 mii.fMask = MIIM_STATE;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3674 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
3675 mii.fState = MFS_CHECKED;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3676 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
3677 mii.fState = MFS_UNCHECKED;
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
3678 SetMenuItemInfo(menu, id, FALSE, &mii);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3679 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3680
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3681 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3682 * Pops up a context menu at given x and y coordinates.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3683 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3684 * menu: The handle the the existing menu.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3685 * parent: Handle to the window initiating the popup.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3686 * x: X coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3687 * y: Y coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3688 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
3689 void API dw_menu_popup(HMENUI *menu, HWND parent, int x, int y)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3690 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3691 if(menu && *menu)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3692 {
93
98cce029a611 Changed handling of menu item click events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 90
diff changeset
3693 popup = 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
3694 TrackPopupMenu((*menu)->menu, 0, x, y, 0, parent, NULL);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3695 free(*menu);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3696 *menu = NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3697 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3698 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3699
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3700
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3701 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3702 * Create a container object to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3703 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3704 * id: An ID to be used for getting the resource from the
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3705 * resource file.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3706 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
3707 HWND API dw_container_new(ULONG id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3708 {
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
3709 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
3710 "",
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
3711 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
3712 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
3713 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
3714 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
3715 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
3716 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
3717 (HMENU)id,
109
94d273843a41 Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 107
diff changeset
3718 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
3719 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 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
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 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
3723 {
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
3724 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
3725 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
3726 }
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
3727
5c66a108aa47 Fixed 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 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
3729 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
3730
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
3731 SetWindowLong(tmp, GWL_USERDATA, (ULONG)cinfo);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3732 dw_window_set_font(tmp, DefaultFont);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3733 return tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3734 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3735
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3736 /*
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 17
diff changeset
3737 * 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
3738 * Parameters:
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 17
diff changeset
3739 * 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
3740 * 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
3741 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
3742 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
3743 {
58
5c66a108aa47 Fixed 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 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
3745 "",
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
3746 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
3747 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
3748 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
3749 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
3750 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
3751 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
3752 (HMENU)id,
109
94d273843a41 Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 107
diff changeset
3753 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
3754 NULL);
68
8d6100960adf Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 67
diff changeset
3755 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
3756 TreeView_SetItemHeight(tmp, 16);
68
8d6100960adf Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 67
diff changeset
3757
8d6100960adf Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 67
diff changeset
3758 if(!cinfo)
8d6100960adf Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 67
diff changeset
3759 {
8d6100960adf Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 67
diff changeset
3760 DestroyWindow(tmp);
8d6100960adf Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 67
diff changeset
3761 return NULL;
8d6100960adf Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 67
diff changeset
3762 }
8d6100960adf Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 67
diff changeset
3763
8d6100960adf Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 67
diff changeset
3764 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
3765 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
3766
8d6100960adf Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 67
diff changeset
3767 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
3768 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
3769 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
3770 }
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 17
diff changeset
3771
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 17
diff changeset
3772 /*
58
5c66a108aa47 Fixed 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 * 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
3774 * 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
3775 * 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
3776 * 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
3777 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
3778 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
3779 {
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
3780 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
3781
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
3782 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
3783 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
3784 {
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
3785 *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
3786 *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
3787 }
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
3788 }
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
3789
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
3790 /*
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
3791 * 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
3792 * 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
3793 * 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
3794 * 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
3795 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
3796 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
3797 {
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
3798 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
3799 }
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
3800
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
3801 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3802 * Create a new static text window (widget) to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3803 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3804 * text: The text to be display by the static text widget.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3805 * id: An ID to be used with WinWindowFromID() or 0L.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3806 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
3807 HWND API dw_text_new(char *text, ULONG id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3808 {
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
3809 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
3810 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
3811 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
3812 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
3813 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
3814 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
3815 (HMENU)id,
109
94d273843a41 Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 107
diff changeset
3816 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
3817 NULL);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3818 dw_window_set_font(tmp, DefaultFont);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3819 return tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3820 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3821
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3822 /*
7
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
3823 * 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
3824 * Parameters:
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
3825 * text: The text to be display by the static text widget.
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
3826 * id: An ID to be used with WinWindowFromID() or 0L.
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
3827 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
3828 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
3829 {
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
3830 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
3831 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
3832 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
3833 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
3834 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
3835 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
3836 (HMENU)id,
109
94d273843a41 Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 107
diff changeset
3837 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
3838 NULL);
7
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
3839 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
3840 SubclassWindow(tmp, _statuswndproc);
7
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
3841 return tmp;
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
3842 }
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
3843
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
3844 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3845 * Create a new Multiline Editbox window (widget) to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3846 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3847 * id: An ID to be used with WinWindowFromID() or 0L.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3848 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
3849 HWND API dw_mle_new(ULONG id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3850 {
58
5c66a108aa47 Fixed 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
63
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 61
diff changeset
3852 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
3853 EDITCLASSNAME,
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 61
diff changeset
3854 "",
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
3855 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
3856 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
3857 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
3858 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
3859 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
3860 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
3861 (HMENU)id,
109
94d273843a41 Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 107
diff changeset
3862 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
3863 NULL);
68
8d6100960adf Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 67
diff changeset
3864 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
3865
8d6100960adf Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 67
diff changeset
3866 if(!cinfo)
8d6100960adf Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 67
diff changeset
3867 {
8d6100960adf Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 67
diff changeset
3868 DestroyWindow(tmp);
8d6100960adf Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 67
diff changeset
3869 return NULL;
8d6100960adf Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 67
diff changeset
3870 }
8d6100960adf Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 67
diff changeset
3871
8d6100960adf Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 67
diff changeset
3872 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
3873 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
3874
8d6100960adf Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 67
diff changeset
3875 SetWindowLong(tmp, GWL_USERDATA, (ULONG)cinfo);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3876 dw_window_set_font(tmp, DefaultFont);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3877 return tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3878 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3879
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3880 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3881 * Create a new Entryfield window (widget) to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3882 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3883 * text: The default text to be in the entryfield widget.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3884 * id: An ID to be used with WinWindowFromID() or 0L.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3885 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
3886 HWND API dw_entryfield_new(char *text, ULONG id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3887 {
63
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 61
diff changeset
3888 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
3889 EDITCLASSNAME,
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 61
diff changeset
3890 text,
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 61
diff changeset
3891 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
3892 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
3893 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
3894 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
3895 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
3896 (HMENU)id,
109
94d273843a41 Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 107
diff changeset
3897 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
3898 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
3899 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
3900
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
3901 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
3902 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
3903
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
3904 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
3905 SetWindowLong(tmp, GWL_USERDATA, (ULONG)cinfo);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3906 dw_window_set_font(tmp, DefaultFont);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3907 return tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3908 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3909
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3910 /*
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
3911 * Create a new Entryfield passwird window (widget) to be packed.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3912 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3913 * text: The default text to be in the entryfield widget.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3914 * id: An ID to be used with WinWindowFromID() or 0L.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3915 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
3916 HWND API dw_entryfield_password_new(char *text, ULONG id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3917 {
63
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 61
diff changeset
3918 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
3919 EDITCLASSNAME,
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 61
diff changeset
3920 text,
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 61
diff changeset
3921 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
3922 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
3923 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
3924 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
3925 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
3926 (HMENU)id,
109
94d273843a41 Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 107
diff changeset
3927 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
3928 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
3929 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
3930
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
3931 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
3932 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
3933
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
3934 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
3935 SetWindowLong(tmp, GWL_USERDATA, (ULONG)cinfo);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3936 dw_window_set_font(tmp, DefaultFont);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3937 return tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3938 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3939
58
5c66a108aa47 Fixed 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 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
3941 {
5c66a108aa47 Fixed 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 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
3943
5c66a108aa47 Fixed 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 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
3945 {
5c66a108aa47 Fixed 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 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
3947 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
3948 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
3949 }
5c66a108aa47 Fixed 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 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
3951 }
5c66a108aa47 Fixed 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
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3953 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3954 * Create a new Combobox window (widget) to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3955 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3956 * text: The default text to be in the combpbox widget.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3957 * id: An ID to be used with WinWindowFromID() or 0L.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3958 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
3959 HWND API dw_combobox_new(char *text, ULONG id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3960 {
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
3961 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
3962 text,
ec311fe773da Include a vertical scrollbar on comboboxes when there are too many items.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 88
diff changeset
3963 WS_CHILD | CBS_DROPDOWN | WS_VSCROLL |
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
3964 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
3965 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
3966 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
3967 (HMENU)id,
109
94d273843a41 Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 107
diff changeset
3968 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
3969 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
3970 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
3971 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
3972
90
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 89
diff changeset
3973 if(!cinfo || !cinfo2)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3974 {
90
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 89
diff changeset
3975 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
3976 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
3977 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
3978 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
3979 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
3980 return NULL;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3981 }
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
3982
5c66a108aa47 Fixed 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 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
3984 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
3985 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
3986 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
3987
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
3988 SetWindowLong(tmp, GWL_USERDATA, (ULONG)cinfo);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3989 dw_window_set_font(tmp, DefaultFont);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3990 return tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3991 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3992
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3993 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3994 * Create a new button window (widget) to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3995 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3996 * text: The text to be display by the static text widget.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3997 * id: An ID to be used with WinWindowFromID() or 0L.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3998 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
3999 HWND API dw_button_new(char *text, ULONG id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4000 {
60
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 59
diff changeset
4001 BubbleButton *bubble = calloc(1, sizeof(BubbleButton));
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4002
58
5c66a108aa47 Fixed 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 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
4004 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
4005 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
4006 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
4007 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
4008 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
4009 (HMENU)id,
109
94d273843a41 Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 107
diff changeset
4010 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
4011 NULL);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4012
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4013 bubble->id = id;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4014 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
4015 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
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 SetWindowLong(tmp, GWL_USERDATA, (ULONG)bubble);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4018 dw_window_set_font(tmp, DefaultFont);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4019 return tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4020 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4021
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4022 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4023 * Create a new bitmap button window (widget) to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4024 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4025 * text: Bubble help text to be displayed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4026 * id: An ID of a bitmap in the resource file.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4027 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
4028 HWND API dw_bitmapbutton_new(char *text, ULONG id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4029 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4030 HWND tmp;
60
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 59
diff changeset
4031 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
4032 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
4033
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4034 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
4035 "",
5c66a108aa47 Fixed 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 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
4037 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
4038 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
4039 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
4040 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
4041 (HMENU)id,
109
94d273843a41 Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 107
diff changeset
4042 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
4043 NULL);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4044
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4045 bubble->id = id;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4046 strncpy(bubble->bubbletext, text, BUBBLE_HELP_MAX - 1);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4047 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
4048 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
4049
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4050 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
4051
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4052 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
4053 (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
4054 (LPARAM) hbitmap);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4055 return tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4056 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4057
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4058 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4059 * Create a new spinbutton window (widget) to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4060 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4061 * text: The text to be display by the static text widget.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4062 * id: An ID to be used with WinWindowFromID() or 0L.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4063 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
4064 HWND API dw_spinbutton_new(char *text, ULONG id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4065 {
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4066 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
4067 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
4068 EDITCLASSNAME,
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 61
diff changeset
4069 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
4070 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
4071 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
4072 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
4073 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
4074 NULL,
109
94d273843a41 Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 107
diff changeset
4075 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
4076 NULL);
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 61
diff changeset
4077 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
4078 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
4079 NULL,
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 61
diff changeset
4080 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
4081 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
4082 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
4083 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
4084 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
4085 (HMENU)id,
109
94d273843a41 Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 107
diff changeset
4086 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
4087 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
4088 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
4089
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 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
4091 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
4092 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
4093
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4094 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
4095 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
4096
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4097 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
4098 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
4099 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
4100
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4101 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
4102 dw_window_set_font(buddy, DefaultFont);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4103 return tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4104 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4105
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4106 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4107 * Create a new radiobutton window (widget) to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4108 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4109 * text: The text to be display by the static text widget.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4110 * id: An ID to be used with WinWindowFromID() or 0L.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4111 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
4112 HWND API dw_radiobutton_new(char *text, ULONG id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4113 {
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4114 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
4115 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
4116 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
4117 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
4118 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
4119 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
4120 (HMENU)id,
109
94d273843a41 Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 107
diff changeset
4121 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
4122 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
4123 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
4124 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
4125 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
4126 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
4127 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
4128 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
4129 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
4130 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
4131 }
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 61
diff changeset
4132
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 61
diff changeset
4133
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 61
diff changeset
4134 /*
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 61
diff changeset
4135 * 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
4136 * Parameters:
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 61
diff changeset
4137 * 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
4138 * increments: Number of increments available.
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 61
diff changeset
4139 * id: An ID to be used with WinWindowFromID() or 0L.
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 61
diff changeset
4140 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
4141 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
4142 {
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 61
diff changeset
4143 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
4144 "",
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
4145 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
4146 (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
4147 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
4148 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
4149 (HMENU)id,
109
94d273843a41 Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 107
diff changeset
4150 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
4151 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
4152 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
4153
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4154 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
4155 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
4156 cinfo->user = 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
4157
5c66a108aa47 Fixed 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 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
4159 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
4160 SendMessage(tmp, TBM_SETRANGE, (WPARAM)FALSE, (LPARAM)MAKELONG(0, increments-1));
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4161 return tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4162 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4163
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4164 /*
33
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 32
diff changeset
4165 * Create a new percent bar window (widget) to be packed.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4166 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4167 * id: An ID to be used with WinWindowFromID() or 0L.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4168 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
4169 HWND API dw_percent_new(ULONG id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4170 {
58
5c66a108aa47 Fixed 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 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
4172 "",
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
4173 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
4174 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
4175 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
4176 (HMENU)id,
109
94d273843a41 Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 107
diff changeset
4177 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
4178 NULL);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4179 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4180
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4181 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4182 * Create a new checkbox window (widget) to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4183 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4184 * text: The text to be display by the static text widget.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4185 * id: An ID to be used with WinWindowFromID() or 0L.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4186 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
4187 HWND API dw_checkbox_new(char *text, ULONG id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4188 {
60
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 59
diff changeset
4189 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
4190 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
4191 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
4192 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
4193 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
4194 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
4195 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
4196 (HMENU)id,
109
94d273843a41 Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 107
diff changeset
4197 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
4198 NULL);
60
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 59
diff changeset
4199 bubble->id = id;
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 59
diff changeset
4200 bubble->checkbox = 1;
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 59
diff changeset
4201 bubble->pOldProc = (WNDPROC)SubclassWindow(tmp, _BtProc);
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 59
diff changeset
4202 bubble->cinfo.fore = -1;
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 59
diff changeset
4203 bubble->cinfo.back = -1;
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 59
diff changeset
4204 SetWindowLong(tmp, GWL_USERDATA, (ULONG)bubble);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4205 dw_window_set_font(tmp, DefaultFont);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4206 return tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4207 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4208
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4209 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4210 * Create a new listbox window (widget) to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4211 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4212 * id: An ID to be used with WinWindowFromID() or 0L.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4213 * multi: Multiple select TRUE or FALSE.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4214 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
4215 HWND API dw_listbox_new(ULONG id, int multi)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4216 {
155
840c54766306 Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 153
diff changeset
4217 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
4218 LISTBOXCLASSNAME,
840c54766306 Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 153
diff changeset
4219 "",
840c54766306 Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 153
diff changeset
4220 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
4221 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
4222 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
4223 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
4224 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
4225 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
4226 (HMENU)id,
840c54766306 Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 153
diff changeset
4227 DWInstance,
840c54766306 Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 153
diff changeset
4228 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
4229 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
4230
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4231 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
4232 {
5c66a108aa47 Fixed 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 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
4234 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
4235 }
5c66a108aa47 Fixed 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
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4237 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
4238 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
4239 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
4240
5c66a108aa47 Fixed 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 SetWindowLong(tmp, GWL_USERDATA, (ULONG)cinfo);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4242 dw_window_set_font(tmp, DefaultFont);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4243 return tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4244 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4245
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4246 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4247 * Sets the icon used for a given window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4248 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4249 * handle: Handle to the window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4250 * id: An ID to be used to specify the icon.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4251 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
4252 void API dw_window_set_icon(HWND handle, ULONG id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4253 {
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4254 HICON hicon = LoadIcon(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
4255
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4256 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
4257 (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
4258 (LPARAM) hicon);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4259 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4260
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4261 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4262 * Sets the bitmap used for a given static window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4263 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4264 * handle: Handle to the window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4265 * id: An ID to be used to specify the icon.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4266 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
4267 void API dw_window_set_bitmap(HWND handle, ULONG id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4268 {
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4269 HBITMAP hbitmap = LoadBitmap(DWInstance, MAKEINTRESOURCE(id));
167
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
4270 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
4271
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4272 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
4273 (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
4274 (LPARAM) hbitmap);
167
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
4275
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
4276 if(oldbitmap)
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
4277 DeleteObject(oldbitmap);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4278 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4279
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4280 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4281 * Sets the text used for a given window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4282 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4283 * handle: Handle to the window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4284 * text: The text associsated with a given window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4285 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
4286 void API dw_window_set_text(HWND handle, char *text)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4287 {
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
4288 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
4289
c629838d9805 Updated to latest DW, and updated the Makefile to install the header files
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 73
diff changeset
4290 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
4291
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4292 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
4293
c629838d9805 Updated to latest DW, and updated the Makefile to install the header files
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 73
diff changeset
4294 /* 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
4295 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
4296 SendMessage(handle, CB_SETEDITSEL, 0, MAKELPARAM(-1, 0));
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4297 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4298
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4299 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4300 * Gets the text used for a given window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4301 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4302 * handle: Handle to the window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4303 * Returns:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4304 * text: The text associsated with a given window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4305 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
4306 char * API dw_window_get_text(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4307 {
173
c2b5d0019ec3 Updated dw_window_get_text() on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 168
diff changeset
4308 int len = GetWindowTextLength(handle);
c2b5d0019ec3 Updated dw_window_get_text() on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 168
diff changeset
4309 char *tempbuf = calloc(1, len + 2);
c2b5d0019ec3 Updated dw_window_get_text() on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 168
diff changeset
4310
c2b5d0019ec3 Updated dw_window_get_text() on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 168
diff changeset
4311 GetWindowText(handle, tempbuf, len + 1);
c2b5d0019ec3 Updated dw_window_get_text() on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 168
diff changeset
4312
c2b5d0019ec3 Updated dw_window_get_text() on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 168
diff changeset
4313 return tempbuf;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4314 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4315
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4316 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4317 * Disables given window (widget).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4318 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4319 * handle: Handle to the window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4320 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
4321 void API dw_window_disable(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4322 {
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4323 EnableWindow(handle, FALSE);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4324 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4325
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4326 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4327 * Enables given window (widget).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4328 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4329 * handle: Handle to the window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4330 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
4331 void API dw_window_enable(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4332 {
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4333 EnableWindow(handle, TRUE);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4334 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4335
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4336 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4337 * Gets the child window handle with specified ID.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4338 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4339 * handle: Handle to the parent window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4340 * id: Integer ID of the child.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4341 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
4342 HWND API dw_window_from_id(HWND handle, int id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4343 {
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4344 return 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
4345 }
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4346 /*
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4347 * Pack windows (widgets) into a box from the start (or top).
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4348 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4349 * box: Window handle of the box to be packed into.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4350 * item: Window handle of the item to be back.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4351 * width: Width in pixels of the item or -1 to be self determined.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4352 * height: Height in pixels of the item or -1 to be self determined.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4353 * hsize: TRUE if the window (widget) should expand horizontally to fill space given.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4354 * vsize: TRUE if the window (widget) should expand vertically to fill space given.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4355 * pad: Number of pixels of padding around the item.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4356 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
4357 void API dw_box_pack_start(HWND box, HWND item, int width, int height, int hsize, int vsize, int pad)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4358 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4359 Box *thisbox;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4360
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4361 thisbox = (Box *)GetWindowLong(box, GWL_USERDATA);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4362 if(thisbox)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4363 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4364 int z;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4365 Item *tmpitem, *thisitem = thisbox->items;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4366 char tmpbuf[100];
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4367
14
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
4368 tmpitem = malloc(sizeof(Item)*(thisbox->count+1));
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4369
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4370 for(z=0;z<thisbox->count;z++)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4371 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4372 tmpitem[z] = thisitem[z];
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4373 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4374
58
5c66a108aa47 Fixed 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 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
4376
5c66a108aa47 Fixed 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 if(strnicmp(tmpbuf, FRAMECLASSNAME, 2)==0)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4378 tmpitem[thisbox->count].type = TYPEBOX;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4379 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4380 tmpitem[thisbox->count].type = TYPEITEM;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4381
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4382 tmpitem[thisbox->count].hwnd = item;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4383 tmpitem[thisbox->count].origwidth = tmpitem[thisbox->count].width = width;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4384 tmpitem[thisbox->count].origheight = tmpitem[thisbox->count].height = height;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4385 tmpitem[thisbox->count].pad = pad;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4386 if(hsize)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4387 tmpitem[thisbox->count].hsize = SIZEEXPAND;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4388 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4389 tmpitem[thisbox->count].hsize = SIZESTATIC;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4390
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4391 if(vsize)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4392 tmpitem[thisbox->count].vsize = SIZEEXPAND;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4393 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4394 tmpitem[thisbox->count].vsize = SIZESTATIC;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4395
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4396 thisbox->items = tmpitem;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4397
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4398 if(thisbox->count)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4399 free(thisitem);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4400
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4401 thisbox->count++;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4402
58
5c66a108aa47 Fixed 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 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
4404 if(strncmp(tmpbuf, UPDOWN_CLASS, strlen(UPDOWN_CLASS))==0)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4405 {
58
5c66a108aa47 Fixed 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 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
4407
5c66a108aa47 Fixed 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 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
4409 {
5c66a108aa47 Fixed 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 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
4411 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
4412 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
4413 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4414 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4415 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4416 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4417
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4418 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4419 * Sets the size of a given window (widget).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4420 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4421 * handle: Window (widget) handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4422 * width: New width in pixels.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4423 * height: New height in pixels.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4424 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
4425 void API dw_window_set_usize(HWND handle, ULONG width, ULONG height)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4426 {
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4427 SetWindowPos(handle, (HWND)NULL, 0, 0, width, height, SWP_SHOWWINDOW | SWP_NOZORDER | SWP_NOMOVE);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4428 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4429
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4430 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4431 * Returns the width of the screen.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4432 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
4433 int API dw_screen_width(void)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4434 {
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4435 return GetSystemMetrics(SM_CXSCREEN);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4436 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4437
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4438 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4439 * Returns the height of the screen.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4440 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
4441 int API dw_screen_height(void)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4442 {
58
5c66a108aa47 Fixed 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 return GetSystemMetrics(SM_CYSCREEN);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4444 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4445
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4446 /* This should return the current color depth */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
4447 unsigned long API dw_color_depth(void)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4448 {
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4449 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
4450 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
4451
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4452 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
4453
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4454 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
4455
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4456 return bpp;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4457 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4458
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4459
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4460 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4461 * Sets the position of a given window (widget).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4462 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4463 * handle: Window (widget) handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4464 * x: X location from the bottom left.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4465 * y: Y location from the bottom left.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4466 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
4467 void API dw_window_set_pos(HWND handle, ULONG x, ULONG y)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4468 {
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4469 SetWindowPos(handle, (HWND)NULL, x, y, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4470 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4471
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4472 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4473 * Sets the position and size of a given window (widget).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4474 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4475 * handle: Window (widget) handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4476 * x: X location from the bottom left.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4477 * y: Y location from the bottom left.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4478 * width: Width of the widget.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4479 * height: Height of the widget.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4480 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
4481 void API dw_window_set_pos_size(HWND handle, ULONG x, ULONG y, ULONG width, ULONG height)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4482 {
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4483 SetWindowPos(handle, (HWND)NULL, x, y, width, height, SWP_NOZORDER | SWP_SHOWWINDOW | SWP_NOACTIVATE);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4484 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4485
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4486 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4487 * Gets the position and size of a given window (widget).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4488 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4489 * handle: Window (widget) handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4490 * x: X location from the bottom left.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4491 * y: Y location from the bottom left.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4492 * width: Width of the widget.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4493 * height: Height of the widget.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4494 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
4495 void API dw_window_get_pos_size(HWND handle, ULONG *x, ULONG *y, ULONG *width, ULONG *height)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4496 {
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4497 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
4498
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4499 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
4500
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4501 GetWindowPlacement(handle, &wp);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4502 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
4503 *x = wp.rcNormalPosition.left;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4504 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
4505 *y = wp.rcNormalPosition.top;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4506 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
4507 *width = wp.rcNormalPosition.right - wp.rcNormalPosition.left;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4508 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
4509 *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
4510
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4511 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4512
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4513 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4514 * Sets the style of a given window (widget).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4515 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4516 * handle: Window (widget) handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4517 * width: New width in pixels.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4518 * height: New height in pixels.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4519 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
4520 void API dw_window_set_style(HWND handle, ULONG style, ULONG mask)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4521 {
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4522 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
4523 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
4524
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4525 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
4526 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
4527 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
4528
88
58d8139fe0a2 Added vertical center logic for static text controls on windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 87
diff changeset
4529
58d8139fe0a2 Added vertical center logic for static text controls on windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 87
diff changeset
4530 /* 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
4531 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
4532 {
58d8139fe0a2 Added vertical center logic for static text controls on windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 87
diff changeset
4533
58d8139fe0a2 Added vertical center logic for static text controls on windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 87
diff changeset
4534 if(cinfo)
58d8139fe0a2 Added vertical center logic for static text controls on windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 87
diff changeset
4535 cinfo->vcenter = 1;
58d8139fe0a2 Added vertical center logic for static text controls on windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 87
diff changeset
4536 else
58d8139fe0a2 Added vertical center logic for static text controls on windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 87
diff changeset
4537 {
58d8139fe0a2 Added vertical center logic for static text controls on windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 87
diff changeset
4538 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
4539 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
4540 cinfo->vcenter = 1;
58d8139fe0a2 Added vertical center logic for static text controls on windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 87
diff changeset
4541
58d8139fe0a2 Added vertical center logic for static text controls on windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 87
diff changeset
4542 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
4543 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
4544 }
58d8139fe0a2 Added vertical center logic for static text controls on windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 87
diff changeset
4545 }
58d8139fe0a2 Added vertical center logic for static text controls on windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 87
diff changeset
4546 else if(cinfo)
58d8139fe0a2 Added vertical center logic for static text controls on windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 87
diff changeset
4547 cinfo->vcenter = 0;
58d8139fe0a2 Added vertical center logic for static text controls on windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 87
diff changeset
4548
58
5c66a108aa47 Fixed 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 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
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
5c66a108aa47 Fixed 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 /* 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
4553 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
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 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
4556
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4557 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
4558 {
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4559 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
4560 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
4561 }
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4562 return -1;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4563 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4564
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4565 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4566 * Adds a new page to specified notebook.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4567 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4568 * handle: Window (widget) handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4569 * flags: Any additional page creation flags.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4570 * front: If TRUE page is added at the beginning.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4571 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
4572 unsigned long API dw_notebook_page_new(HWND handle, ULONG flags, int front)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4573 {
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4574 NotebookPage **array = (NotebookPage **)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
4575
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4576 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
4577 {
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4578 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
4579
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4580 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
4581 {
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4582 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
4583 {
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4584 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
4585 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
4586 }
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4587 }
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4588
5c66a108aa47 Fixed 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 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
4590 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
4591
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4592 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
4593 {
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4594 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
4595 {
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4596 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
4597
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4598 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
4599 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
4600 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
4601 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
4602 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
4603 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
4604
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4605 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
4606 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
4607
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4608 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
4609 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
4610 }
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4611 }
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4612 }
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4613 return -1;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4614 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4615
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4616 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4617 * Sets the text on the specified notebook tab.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4618 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4619 * handle: Notebook handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4620 * pageid: Page ID of the tab to set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4621 * text: Pointer to the text to set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4622 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
4623 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
4624 {
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4625
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4626 NotebookPage **array = (NotebookPage **)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
4627 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
4628
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4629 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
4630 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
4631
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4632 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
4633
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4634 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
4635 {
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4636 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
4637 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
4638 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
4639 _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
4640 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4641 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4642
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4643 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4644 * Sets the text on the specified notebook tab status area.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4645 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4646 * handle: Notebook handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4647 * pageid: Page ID of the tab to set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4648 * text: Pointer to the text to set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4649 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
4650 void API dw_notebook_page_set_status_text(HWND handle, ULONG pageid, char *text)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4651 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4652 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4653
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4654 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4655 * Packs the specified box into the notebook page.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4656 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4657 * handle: Handle to the notebook to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4658 * pageid: Page ID in the notebook which is being packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4659 * page: Box handle to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4660 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
4661 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
4662 {
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4663 NotebookPage **array = (NotebookPage **)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
4664 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
4665
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4666 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
4667 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
4668
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4669 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
4670
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4671 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
4672 {
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4673 HWND tmpbox = dw_box_new(BOXVERT, 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
4674
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4675 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
4676 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
4677 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
4678 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
4679 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
4680 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
4681 {
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4682 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
4683 _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
4684 }
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4685 }
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4686 }
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4687
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4688 /*
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4689 * 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
4690 * 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
4691 * 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
4692 * 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
4693 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
4694 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
4695 {
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4696 NotebookPage **array = (NotebookPage **)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
4697 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
4698
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4699 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
4700 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
4701
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4702 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
4703
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4704 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
4705 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
4706
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4707 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
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 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
4710 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
4711 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
4712 }
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4713
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4714 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
4715
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4716 /* 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
4717 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
4718 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
4719 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
4720
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4721 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
4722 {
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4723 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
4724 {
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4725 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
4726 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
4727 }
5c66a108aa47 Fixed 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 }
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4729 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
4730 {
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4731 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
4732 _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
4733 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
4734 }
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4735 }
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4736
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4737 /*
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4738 * 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
4739 * 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
4740 * 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
4741 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
4742 unsigned int 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
4743 {
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4744 NotebookPage **array = (NotebookPage **)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
4745 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
4746
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4747 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
4748 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
4749 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
4750 }
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4751
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4752 /*
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4753 * 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
4754 * 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
4755 * 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
4756 * 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
4757 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
4758 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
4759 {
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4760 NotebookPage **array = (NotebookPage **)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
4761 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
4762
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4763 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
4764 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
4765
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4766 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
4767
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4768 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
4769 {
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4770 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
4771
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4772 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
4773 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
4774
5c66a108aa47 Fixed 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 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
4776
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4777 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
4778 _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
4779 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4780 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4781
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4782 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4783 * Appends the specified text to the listbox's (or combobox) entry list.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4784 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4785 * handle: Handle to the listbox to be appended to.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4786 * text: Text to append into listbox.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4787 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
4788 void API dw_listbox_append(HWND handle, char *text)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4789 {
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4790 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
4791
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4792 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
4793
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4794 if(strnicmp(tmpbuf, COMBOBOXCLASSNAME, strlen(COMBOBOXCLASSNAME))==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
4795 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
4796 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
4797 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
4798 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
4799 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
4800 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
4801 0, (LPARAM)text);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4802 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4803
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4804 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4805 * Clears the listbox's (or combobox) list of all entries.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4806 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4807 * handle: Handle to the listbox to be cleared.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4808 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
4809 void API dw_listbox_clear(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4810 {
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4811 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
4812
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4813 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
4814
5c66a108aa47 Fixed 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 if(strnicmp(tmpbuf, COMBOBOXCLASSNAME, strlen(COMBOBOXCLASSNAME))==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
4816 {
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4817 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
4818
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4819 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
4820 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
4821
5c66a108aa47 Fixed 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 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
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 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
4825 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
4826 }
5c66a108aa47 Fixed 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 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
4829 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
4830 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
4831 }
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4832
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4833 /*
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4834 * 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
4835 * 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
4836 * 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
4837 * 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
4838 * 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
4839 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
4840 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
4841 {
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4842 unsigned int sel = (unsigned int)SendMessage(handle, LB_GETCURSEL, 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
4843 SendMessage(handle, LB_DELETESTRING, (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
4844 SendMessage(handle, LB_INSERTSTRING, (WPARAM)index, (LPARAM)buffer);
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4845 SendMessage(handle, LB_SETCURSEL, (WPARAM)sel, 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
4846 SendMessage(handle, LB_SETSEL, (WPARAM)TRUE, (LPARAM)sel);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4847 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4848
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4849 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4850 * Copies the given index item's text into buffer.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4851 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4852 * handle: Handle to the listbox to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4853 * index: Index into the list to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4854 * buffer: Buffer where text will be copied.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4855 * length: Length of the buffer (including NULL).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4856 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
4857 void API dw_listbox_query_text(HWND handle, unsigned int index, char *buffer, unsigned int length)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4858 {
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4859 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
4860 LB_GETTEXT, (WPARAM)index, (LPARAM)buffer);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4861 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4862
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4863 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4864 * Returns the index to the item in the list currently selected.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4865 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4866 * handle: Handle to the listbox to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4867 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
4868 unsigned int API dw_listbox_selected(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4869 {
58
5c66a108aa47 Fixed 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 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
4871
5c66a108aa47 Fixed 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 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
4873
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4874 if(strnicmp(tmpbuf, COMBOBOXCLASSNAME, strlen(COMBOBOXCLASSNAME))==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
4875 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
4876 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
4877 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
4878
5c66a108aa47 Fixed 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 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
4880 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
4881 0, 0);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4882 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4883
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4884 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4885 * Returns the index to the current selected item or -1 when done.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4886 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4887 * handle: Handle to the listbox to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4888 * where: Either the previous return or -1 to restart.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4889 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
4890 int API dw_listbox_selected_multi(HWND handle, int where)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4891 {
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4892 int *array, 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
4893
5c66a108aa47 Fixed 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 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
4895 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
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 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
4898 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
4899
5c66a108aa47 Fixed 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 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
4901 {
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4902 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
4903 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
4904 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
4905 }
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4906 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
4907 {
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4908 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
4909 {
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4910 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
4911 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
4912 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
4913 }
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4914 }
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4915 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
4916 }
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4917 return -1;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4918 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4919
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4920 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4921 * Sets the selection state of a given index.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4922 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4923 * handle: Handle to the listbox to be set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4924 * index: Item index.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4925 * state: TRUE if selected FALSE if unselected.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4926 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
4927 void API dw_listbox_select(HWND handle, int index, int state)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4928 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4929 char tmpbuf[100];
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4930
58
5c66a108aa47 Fixed 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 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
4932
5c66a108aa47 Fixed 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 if(strnicmp(tmpbuf, COMBOBOXCLASSNAME, strlen(COMBOBOXCLASSNAME))==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
4934 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
4935 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
4936 {
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4937 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
4938 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
4939 }
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
4940 _wndproc(handle, WM_COMMAND, (WPARAM)(LBN_SELCHANGE << 16), (LPARAM)handle);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4941 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4942
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4943 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4944 * Deletes the item with given index from the list.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4945 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4946 * handle: Handle to the listbox to be set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4947 * index: Item index.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4948 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
4949 void API dw_listbox_delete(HWND handle, int index)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4950 {
58
5c66a108aa47 Fixed 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 SendMessage(handle, LB_DELETESTRING, (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
4952 }
5c66a108aa47 Fixed 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 /*
5c66a108aa47 Fixed 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 * 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
4956 * 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
4957 * 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
4958 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
4959 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
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 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
4962
5c66a108aa47 Fixed 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 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
4964
5c66a108aa47 Fixed 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 if(strnicmp(tmpbuf, COMBOBOXCLASSNAME, strlen(COMBOBOXCLASSNAME))==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
4966 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
4967 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
4968
5c66a108aa47 Fixed 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 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
4970 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
4971 }
5c66a108aa47 Fixed 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
5c66a108aa47 Fixed 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 /*
5c66a108aa47 Fixed 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 * 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
4975 * 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
4976 * 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
4977 * 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
4978 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
4979 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
4980 {
5c66a108aa47 Fixed 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 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
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
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4984 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4985 * Adds text to an MLE box and returns the current point.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4986 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4987 * handle: Handle to the MLE to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4988 * buffer: Text buffer to be imported.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4989 * startpoint: Point to start entering text.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4990 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
4991 unsigned int API dw_mle_import(HWND handle, char *buffer, int startpoint)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4992 {
95
636c37ca7238 Avoid allocating super huge buffers when dealing with the MLEs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
4993 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
4994 char *tmpbuf;
636c37ca7238 Avoid allocating super huge buffers when dealing with the MLEs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
4995
636c37ca7238 Avoid allocating super huge buffers when dealing with the MLEs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
4996 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
4997 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
4998
5c66a108aa47 Fixed 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 startpoint++;
95
636c37ca7238 Avoid allocating super huge buffers when dealing with the MLEs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
5000 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
5001
5c66a108aa47 Fixed 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 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
5003 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
5004
5c66a108aa47 Fixed 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 if(len)
37
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
5006 {
95
636c37ca7238 Avoid allocating super huge buffers when dealing with the MLEs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
5007 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
5008 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
5009
95
636c37ca7238 Avoid allocating super huge buffers when dealing with the MLEs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
5010 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
5011
636c37ca7238 Avoid allocating super huge buffers when dealing with the MLEs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
5012 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
5013 start = &tmpbuf[startpoint];
636c37ca7238 Avoid allocating super huge buffers when dealing with the MLEs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
5014
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
5015 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
5016 memcpy(dest, start, copylen);
37
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
5017 }
95
636c37ca7238 Avoid allocating super huge buffers when dealing with the MLEs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
5018 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
5019
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
5020 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
5021
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
5022 free(tmpbuf);
95
636c37ca7238 Avoid allocating super huge buffers when dealing with the MLEs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
5023 return (startpoint + textlen - 1);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5024 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5025
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5026 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5027 * Grabs text from an MLE box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5028 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5029 * handle: Handle to the MLE to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5030 * buffer: Text buffer to be exported.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5031 * startpoint: Point to start grabbing text.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5032 * length: Amount of text to be grabbed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5033 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
5034 void API dw_mle_export(HWND handle, char *buffer, int startpoint, int length)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5035 {
95
636c37ca7238 Avoid allocating super huge buffers when dealing with the MLEs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
5036 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
5037 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
5038
636c37ca7238 Avoid allocating super huge buffers when dealing with the MLEs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
5039 if(len)
636c37ca7238 Avoid allocating super huge buffers when dealing with the MLEs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
5040 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
5041
636c37ca7238 Avoid allocating super huge buffers when dealing with the MLEs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
5042 buffer[0] = 0;
636c37ca7238 Avoid allocating super huge buffers when dealing with the MLEs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
5043
636c37ca7238 Avoid allocating super huge buffers when dealing with the MLEs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
5044 if(startpoint < len)
636c37ca7238 Avoid allocating super huge buffers when dealing with the MLEs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
5045 {
636c37ca7238 Avoid allocating super huge buffers when dealing with the MLEs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
5046 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
5047
636c37ca7238 Avoid allocating super huge buffers when dealing with the MLEs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
5048 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
5049 }
58
5c66a108aa47 Fixed 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
5c66a108aa47 Fixed 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 free(tmpbuf);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5052 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5053
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5054 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5055 * Obtains information about an MLE box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5056 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5057 * handle: Handle to the MLE to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5058 * bytes: A pointer to a variable to return the total bytes.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5059 * lines: A pointer to a variable to return the number of lines.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5060 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
5061 void API dw_mle_query(HWND handle, unsigned long *bytes, unsigned long *lines)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5062 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5063 if(bytes)
95
636c37ca7238 Avoid allocating super huge buffers when dealing with the MLEs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
5064 *bytes = GetWindowTextLength(handle);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5065 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
5066 *lines = (unsigned long)SendMessage(handle, EM_GETLINECOUNT, 0, 0);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5067 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5068
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5069 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5070 * Deletes text from an MLE box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5071 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5072 * handle: Handle to the MLE to be deleted from.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5073 * startpoint: Point to start deleting text.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5074 * length: Amount of text to be deleted.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5075 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
5076 void API dw_mle_delete(HWND handle, int startpoint, int length)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5077 {
95
636c37ca7238 Avoid allocating super huge buffers when dealing with the MLEs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
5078 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
5079 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
5080
636c37ca7238 Avoid allocating super huge buffers when dealing with the MLEs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
5081 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
5082
636c37ca7238 Avoid allocating super huge buffers when dealing with the MLEs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
5083 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
5084 {
636c37ca7238 Avoid allocating super huge buffers when dealing with the MLEs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
5085 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
5086
636c37ca7238 Avoid allocating super huge buffers when dealing with the MLEs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
5087 SetWindowText(handle, tmpbuf);
636c37ca7238 Avoid allocating super huge buffers when dealing with the MLEs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
5088 }
58
5c66a108aa47 Fixed 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
5c66a108aa47 Fixed 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 free(tmpbuf);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5091 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5092
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5093 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5094 * Clears all text from an MLE box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5095 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5096 * handle: Handle to the MLE to be cleared.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5097 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
5098 void API dw_mle_clear(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5099 {
58
5c66a108aa47 Fixed 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 SetWindowText(handle, "");
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5101 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5102
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5103 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5104 * Sets the visible line of an MLE box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5105 * 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
5106 * handle: Handle to the MLE.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5107 * line: Line to be visible.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5108 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
5109 void API dw_mle_set_visible(HWND handle, int line)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5110 {
58
5c66a108aa47 Fixed 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 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
5112 dw_mle_set(handle, point);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5113 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5114
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5115 /*
7
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
5116 * Sets the editablity of an MLE box.
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
5117 * Parameters:
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
5118 * handle: Handle to the MLE.
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
5119 * 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
5120 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
5121 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
5122 {
58
5c66a108aa47 Fixed 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 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
5124 }
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
5125
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
5126 /*
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
5127 * Sets the word wrap state of an MLE box.
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
5128 * Parameters:
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
5129 * handle: Handle to the MLE.
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
5130 * 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
5131 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
5132 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
5133 {
58
5c66a108aa47 Fixed 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 /* 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
5135 * 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
5136 */
5c66a108aa47 Fixed 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 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
5138 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
5139 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
5140 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
5141 }
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
5142
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
5143 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5144 * Sets the current cursor position of an MLE box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5145 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5146 * handle: Handle to the MLE to be positioned.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5147 * point: Point to position cursor.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5148 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
5149 void API dw_mle_set(HWND handle, int point)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5150 {
58
5c66a108aa47 Fixed 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 SendMessage(handle, EM_SETSEL, (WPARAM)point, (LPARAM)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
5152 SendMessage(handle, EM_SCROLLCARET, 0, 0);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5153 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5154
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5155 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5156 * Finds text in an MLE box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5157 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5158 * handle: Handle to the MLE to be cleared.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5159 * text: Text to search for.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5160 * point: Start point of search.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5161 * flags: Search specific flags.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5162 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
5163 int API dw_mle_search(HWND handle, char *text, int point, unsigned long flags)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5164 {
95
636c37ca7238 Avoid allocating super huge buffers when dealing with the MLEs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
5165 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
5166 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
5167 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
5168
636c37ca7238 Avoid allocating super huge buffers when dealing with the MLEs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
5169 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
5170
58
5c66a108aa47 Fixed 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 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
5172
5c66a108aa47 Fixed 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 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
5174 {
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
5175 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
5176 {
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
5177 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
5178 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
5179 }
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
5180 }
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
5181 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
5182 {
5c66a108aa47 Fixed 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 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
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 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
5186 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
5187 }
5c66a108aa47 Fixed 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
5c66a108aa47 Fixed 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 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
5191 {
5c66a108aa47 Fixed 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 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
5193 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
5194 }
5c66a108aa47 Fixed 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 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
5197
5c66a108aa47 Fixed 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 return retval;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5199 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5200
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5201 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5202 * Stops redrawing of an MLE box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5203 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5204 * handle: Handle to the MLE to freeze.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5205 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
5206 void API dw_mle_freeze(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5207 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5208 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5209
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5210 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5211 * Resumes redrawing of an MLE box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5212 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5213 * handle: Handle to the MLE to thaw.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5214 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
5215 void API dw_mle_thaw(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5216 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5217 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5218
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5219 /*
33
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 32
diff changeset
5220 * Returns the range of the percent bar.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5221 * 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
5222 * handle: Handle to the percent bar to be queried.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5223 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
5224 unsigned int API dw_percent_query_range(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5225 {
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
5226 return (unsigned int)SendMessage(handle, PBM_GETRANGE, (WPARAM)FALSE, 0);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5227 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5228
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5229 /*
33
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 32
diff changeset
5230 * Sets the percent bar position.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5231 * 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
5232 * 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
5233 * position: Position of the percent bar withing the range.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5234 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
5235 void API dw_percent_set_pos(HWND handle, unsigned int position)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5236 {
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
5237 SendMessage(handle, PBM_SETPOS, (WPARAM)position, 0);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5238 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5239
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5240 /*
63
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 61
diff changeset
5241 * 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
5242 * Parameters:
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 61
diff changeset
5243 * 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
5244 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
5245 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
5246 {
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 61
diff changeset
5247 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
5248 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
5249
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 61
diff changeset
5250 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
5251 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
5252 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
5253 }
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 61
diff changeset
5254
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 61
diff changeset
5255 /*
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 61
diff changeset
5256 * 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
5257 * Parameters:
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 61
diff changeset
5258 * 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
5259 * 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
5260 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
5261 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
5262 {
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 61
diff changeset
5263 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
5264 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
5265
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 61
diff changeset
5266 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
5267 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
5268 else
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 61
diff changeset
5269 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
5270 }
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 61
diff changeset
5271
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 61
diff changeset
5272 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5273 * Sets the spinbutton value.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5274 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5275 * handle: Handle to the spinbutton to be set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5276 * position: Current value of the spinbutton.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5277 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
5278 void API dw_spinbutton_set_pos(HWND handle, long position)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5279 {
58
5c66a108aa47 Fixed 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 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
5281 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
5282
5c66a108aa47 Fixed 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 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
5284
5c66a108aa47 Fixed 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 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
5286 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
5287
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
5288 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
5289 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
5290 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
5291 SendMessage(handle, UDM_SETPOS, 0, (LPARAM)MAKELONG((short)position, 0));
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5292 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5293
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5294 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5295 * Sets the spinbutton limits.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5296 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5297 * 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
5298 * 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
5299 * position: Current value of the spinbutton.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5300 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
5301 void API dw_spinbutton_set_limits(HWND handle, long upper, long lower)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5302 {
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
5303 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
5304 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
5305 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
5306 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
5307 (LPARAM)((short)upper));
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5308 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5309
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5310 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5311 * Sets the entryfield character limit.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5312 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5313 * handle: Handle to the spinbutton to be set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5314 * limit: Number of characters the entryfield will take.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5315 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
5316 void API dw_entryfield_set_limit(HWND handle, ULONG limit)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5317 {
58
5c66a108aa47 Fixed 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 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
5319 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5320
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5321 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5322 * Returns the current value of the spinbutton.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5323 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5324 * handle: Handle to the spinbutton to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5325 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
5326 long API dw_spinbutton_query(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5327 {
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
5328 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
5329 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
5330 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
5331 return (long)SendMessage(handle, UDM_GETPOS, 0, 0);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5332 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5333
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5334 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5335 * Returns the state of the checkbox.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5336 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5337 * handle: Handle to the checkbox to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5338 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
5339 int API dw_checkbox_query(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5340 {
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
5341 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
5342 return (in_checkbox_handler ? FALSE : TRUE);
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 59
diff changeset
5343 return (in_checkbox_handler ? TRUE : FALSE);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5344 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5345
63
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 61
diff changeset
5346 /* 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
5347 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
5348 {
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 61
diff changeset
5349 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
5350
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 61
diff changeset
5351 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
5352
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 61
diff changeset
5353 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
5354 {
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 61
diff changeset
5355 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
5356
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 61
diff changeset
5357 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
5358 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
5359 }
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 61
diff changeset
5360 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
5361 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5362 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5363 * Sets the state of the checkbox.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5364 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5365 * handle: Handle to the checkbox to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5366 * value: TRUE for checked, FALSE for unchecked.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5367 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
5368 void API dw_checkbox_set(HWND handle, int value)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5369 {
63
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 61
diff changeset
5370 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
5371
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 61
diff changeset
5372 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
5373 {
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 61
diff changeset
5374 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
5375
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 61
diff changeset
5376 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
5377 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
5378 }
58
5c66a108aa47 Fixed 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 SendMessage(handle, BM_SETCHECK, (WPARAM)value, 0);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5380 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5381
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5382 /*
60
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 59
diff changeset
5383 * 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
5384 * Parameters:
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 59
diff changeset
5385 * 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
5386 * 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
5387 * title: The text title of the entry.
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 59
diff changeset
5388 * icon: Handle to coresponding icon.
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 59
diff changeset
5389 * parent: Parent handle or 0 if root.
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 59
diff changeset
5390 * itemdata: Item specific data.
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 59
diff changeset
5391 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
5392 HWND API dw_tree_insert_after(HWND handle, HWND item, char *title, unsigned long icon, HWND parent, void *itemdata)
60
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 59
diff changeset
5393 {
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 59
diff changeset
5394 TVITEM tvi;
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 59
diff changeset
5395 TVINSERTSTRUCT tvins;
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 59
diff changeset
5396 HTREEITEM hti;
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 59
diff changeset
5397 void **ptrs= malloc(sizeof(void *) * 2);
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 59
diff changeset
5398
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 59
diff changeset
5399 ptrs[0] = title;
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 59
diff changeset
5400 ptrs[1] = itemdata;
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 59
diff changeset
5401
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 59
diff changeset
5402 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
5403 tvi.pszText = title;
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 59
diff changeset
5404 tvi.lParam = (LONG)ptrs;
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 59
diff changeset
5405 tvi.cchTextMax = strlen(title);
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 59
diff changeset
5406 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
5407
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 59
diff changeset
5408 tvins.item = tvi;
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 59
diff changeset
5409 tvins.hParent = (HTREEITEM)parent;
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 59
diff changeset
5410 tvins.hInsertAfter = item ? (HTREEITEM)item : TVI_FIRST;
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 59
diff changeset
5411
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 59
diff changeset
5412 hti = TreeView_InsertItem(handle, &tvins);
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 59
diff changeset
5413
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 59
diff changeset
5414 return (HWND)hti;
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 59
diff changeset
5415 }
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 59
diff changeset
5416
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 59
diff changeset
5417 /*
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 17
diff changeset
5418 * 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
5419 * Parameters:
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 17
diff changeset
5420 * 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
5421 * 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
5422 * 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
5423 * 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
5424 * 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
5425 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
5426 HWND API dw_tree_insert(HWND handle, char *title, unsigned long icon, HWND parent, void *itemdata)
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 17
diff changeset
5427 {
58
5c66a108aa47 Fixed 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 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
5429 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
5430 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
5431 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
5432
5c66a108aa47 Fixed 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 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
5434 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
5435
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
5436 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
5437 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
5438 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
5439 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
5440 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
5441
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
5442 tvins.item = 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
5443 tvins.hParent = (HTREEITEM)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
5444 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
5445
5c66a108aa47 Fixed 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 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
5447
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
5448 return (HWND)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
5449 }
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 17
diff changeset
5450
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 17
diff changeset
5451 /*
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
5452 * 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
5453 * 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
5454 * 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
5455 * 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
5456 * 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
5457 * 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
5458 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
5459 void API dw_tree_set(HWND handle, HWND item, char *title, unsigned long icon)
54
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
5460 {
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
5461 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
5462 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
5463
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
5464 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
5465 tvi.hItem = (HTREEITEM)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
5466
60
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 59
diff changeset
5467 if(TreeView_GetItem(handle, &tvi))
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 59
diff changeset
5468 {
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 59
diff changeset
5469
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 59
diff changeset
5470 ptrs = (void **)tvi.lParam;
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 59
diff changeset
5471 ptrs[0] = title;
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 59
diff changeset
5472
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 59
diff changeset
5473 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
5474 tvi.pszText = title;
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 59
diff changeset
5475 tvi.cchTextMax = strlen(title);
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 59
diff changeset
5476 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
5477 tvi.hItem = (HTREEITEM)item;
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 59
diff changeset
5478
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 59
diff changeset
5479 TreeView_SetItem(handle, &tvi);
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 59
diff changeset
5480 }
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
5481 }
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
5482
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
5483 /*
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
5484 * 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
5485 * 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
5486 * 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
5487 * 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
5488 * 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
5489 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
5490 void API dw_tree_set_data(HWND handle, HWND item, void *itemdata)
54
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
5491 {
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
5492 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
5493 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
5494
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
5495 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
5496 tvi.hItem = (HTREEITEM)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
5497
60
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 59
diff changeset
5498 if(TreeView_GetItem(handle, &tvi))
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 59
diff changeset
5499 {
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 59
diff changeset
5500 ptrs = (void **)tvi.lParam;
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 59
diff changeset
5501 ptrs[1] = itemdata;
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 59
diff changeset
5502 }
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
5503 }
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
5504
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
5505 /*
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
5506 * 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
5507 * 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
5508 * 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
5509 * 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
5510 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
5511 void API dw_tree_item_select(HWND handle, HWND item)
54
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
5512 {
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
5513 TreeView_SelectItem(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
5514 }
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
5515
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
5516 /*
30
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 22
diff changeset
5517 * Removes all nodes from a tree.
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 22
diff changeset
5518 * Parameters:
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 22
diff changeset
5519 * 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
5520 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
5521 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
5522 {
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
5523 TreeView_DeleteAllItems(handle);
30
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 22
diff changeset
5524 }
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 22
diff changeset
5525
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 22
diff changeset
5526 /*
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
5527 * 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
5528 * 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
5529 * 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
5530 * 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
5531 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
5532 void API dw_tree_expand(HWND handle, HWND item)
54
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
5533 {
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
5534 TreeView_Expand(handle, (HTREEITEM)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
5535 }
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
5536
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
5537 /*
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
5538 * 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
5539 * 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
5540 * 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
5541 * 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
5542 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
5543 void API dw_tree_collapse(HWND handle, HWND item)
54
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
5544 {
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
5545 TreeView_Expand(handle, (HTREEITEM)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
5546 }
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
5547
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
5548 /*
30
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 22
diff changeset
5549 * Removes a node from a tree.
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 22
diff changeset
5550 * Parameters:
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 22
diff changeset
5551 * 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
5552 * item: Handle to node to be deleted.
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 22
diff changeset
5553 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
5554 void API dw_tree_delete(HWND handle, HWND item)
30
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 22
diff changeset
5555 {
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
5556 if((HTREEITEM)item == TVI_ROOT || !item)
60
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 59
diff changeset
5557 return;
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 59
diff changeset
5558
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
5559 TreeView_DeleteItem(handle, (HTREEITEM)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
5560 }
30
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 22
diff changeset
5561
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 22
diff changeset
5562 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5563 * Sets up the container columns.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5564 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5565 * handle: Handle to the container to be configured.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5566 * flags: An array of unsigned longs with column flags.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5567 * titles: An array of strings with column text titles.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5568 * count: The number of columns (this should match the arrays).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5569 * 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
5570 * (only used on OS/2 but must be >= 0 on all)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5571 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
5572 int API dw_container_setup(HWND handle, unsigned long *flags, char **titles, int count, int separator)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5573 {
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
5574 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
5575 int z, l = 0;
105
ad95fc623ff3 Some changes to the container optimization code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 104
diff changeset
5576 unsigned long *tempflags = calloc(sizeof(unsigned long), count + 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
5577 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
5578
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
5579 if(separator == -1)
105
ad95fc623ff3 Some changes to the container optimization code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 104
diff changeset
5580 {
ad95fc623ff3 Some changes to the container optimization code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 104
diff changeset
5581 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
5582 l = 1;
105
ad95fc623ff3 Some changes to the container optimization code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 104
diff changeset
5583 }
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
5584
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
5585 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
5586 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
5587 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
5588 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
5589
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5590
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5591 for(z=0;z<count;z++)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5592 {
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
5593 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
5594 {
102
372a7581b312 Minor changes to the container code on windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 95
diff changeset
5595 lvc.mask = LVCF_TEXT | LVCF_WIDTH | LVCF_SUBITEM;
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
5596 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
5597 lvc.cchTextMax = strlen(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
5598 lvc.fmt = flags[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
5599 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
5600 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
5601 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
5602 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5603 }
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
5604 ListView_SetExtendedListViewStyle(handle, LVS_EX_FULLROWSELECT | LVS_EX_SUBITEMIMAGES);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5605 return TRUE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5606 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5607
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5608 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5609 * Sets up the filesystem columns, note: filesystem always has an icon/filename field.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5610 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5611 * handle: Handle to the container to be configured.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5612 * flags: An array of unsigned longs with column flags.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5613 * titles: An array of strings with column text titles.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5614 * count: The number of columns (this should match the arrays).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5615 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
5616 int API dw_filesystem_setup(HWND handle, unsigned long *flags, char **titles, int count)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5617 {
58
5c66a108aa47 Fixed 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 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
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 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
5621 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
5622 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
5623 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
5624 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
5625 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
5626 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
5627 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
5628 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
5629 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
5630 dw_container_setup(handle, flags, titles, count, -1);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5631 return TRUE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5632 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5633
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5634 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5635 * Obtains an icon from a module (or header in GTK).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5636 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5637 * module: Handle to module (DLL) in OS/2 and Windows.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5638 * id: A unsigned long id int the resources on OS/2 and
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5639 * Windows, on GTK this is converted to a pointer
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5640 * to an embedded XPM.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5641 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
5642 unsigned long API dw_icon_load(unsigned long module, unsigned long id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5643 {
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
5644 return (unsigned long)LoadIcon(DWInstance, MAKEINTRESOURCE(id));
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5645 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5646
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5647 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5648 * Frees a loaded resource in OS/2 and Windows.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5649 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5650 * handle: Handle to icon returned by dw_icon_load().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5651 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
5652 void API dw_icon_free(unsigned long handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5653 {
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
5654 DestroyIcon((HICON)handle);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5655 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5656
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5657 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5658 * Allocates memory used to populate a container.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5659 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5660 * handle: Handle to the container window (widget).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5661 * rowcount: The number of items to be populated.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5662 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
5663 void * API dw_container_alloc(HWND handle, int rowcount)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5664 {
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
5665 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
5666 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
5667
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
5668 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
5669 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
5670 /* 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
5671 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
5672 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
5673 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
5674 lvi.iImage = -1;
7
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
5675
79
8082cb0e7c2e Updated to the latest DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 75
diff changeset
5676 ShowWindow(handle, SW_HIDE);
7
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
5677 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
5678 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
5679 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
5680 }
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
5681
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
5682 /* 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
5683 * 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
5684 */
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
5685 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
5686 {
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
5687 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
5688 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
5689
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
5690 if(!hSmall || !hLarge)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5691 {
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
5692 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
5693 hLarge = ImageList_Create(32, 32, ILC_COLOR16 | ILC_MASK, ICON_INDEX_LIMIT, 0);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5694 }
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
5695 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
5696 {
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
5697 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
5698 {
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
5699 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
5700 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
5701 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
5702 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
5703 {
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
5704 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
5705 }
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
5706 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
5707 {
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
5708 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
5709 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
5710 }
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
5711 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
5712 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
5713 }
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
5714
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
5715 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
5716 {
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
5717 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
5718 {
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
5719 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
5720 {
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
5721 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
5722 }
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
5723 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
5724 {
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
5725 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
5726 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
5727 }
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
5728 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
5729 }
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
5730 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
5731 }
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
5732 }
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
5733 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
5734 }
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
5735
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
5736 /*
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
5737 * 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
5738 * 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
5739 * 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
5740 * 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
5741 * 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
5742 * 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
5743 * 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
5744 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
5745 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
5746 {
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
5747 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
5748
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
5749 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
5750 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
5751 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
5752 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
5753 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
5754 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
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 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
5757 }
5c66a108aa47 Fixed 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
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
5759 /*
5c66a108aa47 Fixed 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 * 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
5761 * 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
5762 * 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
5763 * 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
5764 * 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
5765 * 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
5766 * 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
5767 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
5768 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
5769 {
5c66a108aa47 Fixed 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 dw_container_set_item(handle, pointer, column + 1, row, data);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5771 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5772
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5773 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5774 * Sets an item in specified row and column to the given data.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5775 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5776 * handle: Handle to the container window (widget).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5777 * pointer: Pointer to the allocated memory in dw_container_alloc().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5778 * column: Zero based column of data being set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5779 * row: Zero based row of data being set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5780 * data: Pointer to the data to be added.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5781 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
5782 void API dw_container_set_item(HWND handle, void *pointer, int column, int row, void *data)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5783 {
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
5784 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
5785 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
5786 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
5787 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
5788
5c66a108aa47 Fixed 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 if(!cinfo || !cinfo->flags || !data)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5790 return;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5791
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
5792 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
5793
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
5794 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
5795 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
5796 lvi.iSubItem = column;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5797
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5798 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
5799 {
5c66a108aa47 Fixed 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 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
5801
5c66a108aa47 Fixed 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 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
5803 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
5804 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
5805
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
5806 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
5807 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5808 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
5809 {
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
5810 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
5811
5c66a108aa47 Fixed 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(!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
5813 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
5814
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
5815 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
5816 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
5817 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
5818 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5819 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
5820 {
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
5821 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
5822
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
5823 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
5824
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
5825 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
5826 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
5827 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5828 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
5829 {
165
d03716228b7f Use strftime to display time and date on Windows and unix.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 161
diff changeset
5830 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
5831 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
5832
d03716228b7f Use strftime to display time and date on Windows and unix.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 161
diff changeset
5833 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
5834 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
5835 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
5836
d03716228b7f Use strftime to display time and date on Windows and unix.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 161
diff changeset
5837 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
5838
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
5839 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
5840 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
5841 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5842 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
5843 {
165
d03716228b7f Use strftime to display time and date on Windows and unix.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 161
diff changeset
5844 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
5845 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
5846
d03716228b7f Use strftime to display time and date on Windows and unix.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 161
diff changeset
5847 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
5848 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
5849 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
5850
d03716228b7f Use strftime to display time and date on Windows and unix.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 161
diff changeset
5851 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
5852
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
5853 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
5854 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
5855 }
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
5856
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
5857 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
5858 }
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 17
diff changeset
5859
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 17
diff changeset
5860 /*
167
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
5861 * 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
5862 * Parameters:
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
5863 * 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
5864 * 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
5865 * 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
5866 * 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
5867 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
5868 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
5869 {
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
5870 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
5871 }
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
5872
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
5873 /*
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 17
diff changeset
5874 * 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
5875 * Parameters:
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 17
diff changeset
5876 * 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
5877 * 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
5878 * 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
5879 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
5880 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
5881 {
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
5882 ListView_SetColumnWidth(handle, column, width);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5883 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5884
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5885 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5886 * Sets the title of a row in the container.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5887 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5888 * pointer: Pointer to the allocated memory in dw_container_alloc().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5889 * row: Zero based row of data being set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5890 * title: String title of the item.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5891 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
5892 void API dw_container_set_row_title(void *pointer, int row, char *title)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5893 {
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
5894 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
5895 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
5896
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
5897 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
5898 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
5899 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
5900 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
5901
5c66a108aa47 Fixed 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 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
5903 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
5904
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5905 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5906
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5907 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5908 * Sets the title of a row in the container.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5909 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5910 * handle: Handle to the container window (widget).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5911 * pointer: Pointer to the allocated memory in dw_container_alloc().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5912 * rowcount: The number of rows to be inserted.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5913 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
5914 void API dw_container_insert(HWND handle, void *pointer, int rowcount)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5915 {
79
8082cb0e7c2e Updated to the latest DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 75
diff changeset
5916 ShowWindow(handle, SW_SHOW);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5917 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5918
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5919 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5920 * Removes all rows from a container.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5921 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5922 * 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
5923 * 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
5924 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
5925 void API dw_container_clear(HWND handle, int redraw)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5926 {
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
5927 ListView_DeleteAllItems(handle);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5928 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5929
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5930 /*
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 17
diff changeset
5931 * 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
5932 * Parameters:
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 17
diff changeset
5933 * 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
5934 * 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
5935 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
5936 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
5937 {
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
5938 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
5939
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
5940 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
5941 {
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
5942 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
5943 }
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 17
diff changeset
5944 }
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 17
diff changeset
5945
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 17
diff changeset
5946 /*
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 17
diff changeset
5947 * 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
5948 * Parameters:
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 17
diff changeset
5949 * 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
5950 * 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
5951 * 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
5952 * 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
5953 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
5954 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
5955 {
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 17
diff changeset
5956 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
5957 {
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 17
diff changeset
5958 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
5959 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
5960 break;
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 17
diff changeset
5961 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
5962 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
5963 break;
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 17
diff changeset
5964 }
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 17
diff changeset
5965 }
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 17
diff changeset
5966
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 17
diff changeset
5967 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5968 * Removes all rows from a container.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5969 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5970 * handle: Handle to the window (widget) to be cleared.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5971 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
5972 void API dw_container_set_view(HWND handle, unsigned long flags, int iconwidth, int iconheight)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5973 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5974 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5975
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5976 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5977 * Starts a new query of a container.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5978 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5979 * handle: Handle to the window (widget) to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5980 * flags: If this parameter is DW_CRA_SELECTED it will only
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5981 * return items that are currently selected. Otherwise
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5982 * it will return all records in the container.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5983 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
5984 char * API dw_container_query_start(HWND handle, unsigned long flags)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5985 {
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
5986 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
5987
69
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
5988 _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
5989
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
5990 if(_index == -1)
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
5991 return NULL;
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
5992
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
5993 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
5994
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
5995 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
5996 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
5997
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
5998 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
5999
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
6000 return (char *)lvi.lParam;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6001 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6002
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6003 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6004 * Continues an existing query of a container.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6005 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6006 * handle: Handle to the window (widget) to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6007 * flags: If this parameter is DW_CRA_SELECTED it will only
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6008 * return items that are currently selected. Otherwise
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6009 * it will return all records in the container.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6010 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
6011 char * API dw_container_query_next(HWND handle, unsigned long flags)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6012 {
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
6013 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
6014
69
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6015 _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
6016
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
6017 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
6018 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
6019
69
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6020 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
6021
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
6022 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
6023 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
6024
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
6025 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
6026
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
6027 return (char *)lvi.lParam;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6028 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6029
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6030 /*
69
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6031 * 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
6032 * Parameters:
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6033 * 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
6034 * 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
6035 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
6036 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
6037 {
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6038 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
6039
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6040 while(index != -1)
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6041 {
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6042 LV_ITEM lvi;
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6043
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6044 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
6045
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6046 lvi.iItem = index;
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6047 lvi.mask = LVIF_PARAM;
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6048
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6049 ListView_GetItem(handle, &lvi);
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6050
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6051 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
6052 {
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6053 RECT viewport, item;
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6054
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6055 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
6056 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
6057 return;
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6058 }
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6059
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6060 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
6061 }
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6062 }
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6063
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6064 /*
167
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
6065 * 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
6066 * Parameters:
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
6067 * 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
6068 * 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
6069 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
6070 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
6071 {
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
6072 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
6073
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
6074 while(index != -1)
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
6075 {
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
6076 LV_ITEM lvi;
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
6077
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
6078 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
6079
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
6080 lvi.iItem = index;
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
6081 lvi.mask = LVIF_PARAM;
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
6082
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
6083 ListView_GetItem(handle, &lvi);
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
6084
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
6085 if((char *)lvi.lParam == text)
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
6086 {
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
6087 ListView_DeleteItem(handle, index);
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
6088 return;
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
6089 }
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
6090
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
6091 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
6092 }
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
6093 }
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
6094
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 165
diff changeset
6095 /*
69
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6096 * 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
6097 * Parameters:
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6098 * 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
6099 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
6100 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
6101 {
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6102 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
6103 ULONG *flags;
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6104 LV_ITEM lvi;
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6105
102
372a7581b312 Minor changes to the container code on windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 95
diff changeset
6106 if(cinfo && cinfo->columns == 1)
372a7581b312 Minor changes to the container code on windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 95
diff changeset
6107 {
372a7581b312 Minor changes to the container code on windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 95
diff changeset
6108 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
6109 }
372a7581b312 Minor changes to the container code on windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 95
diff changeset
6110 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
6111 {
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6112 int z, index;
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6113 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
6114 char *text = malloc(1024);
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6115
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6116 /* 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
6117 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
6118 {
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6119 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
6120 columns[z] = 5;
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6121 else
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6122 {
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6123 LVCOLUMN lvc;
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6124
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6125 lvc.mask = LVCF_TEXT;
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6126 lvc.cchTextMax = 1023;
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6127 lvc.pszText = text;
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6128
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6129 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
6130 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
6131
ad95fc623ff3 Some changes to the container optimization code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 104
diff changeset
6132 if(flags[z] & DW_CFA_RESERVED)
ad95fc623ff3 Some changes to the container optimization code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 104
diff changeset
6133 columns[z] += 20;
69
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6134 }
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6135 }
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6136
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6137 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
6138
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6139 /* 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
6140 while(index != -1)
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6141 {
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6142 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
6143 {
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6144 LV_ITEM lvi;
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6145
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6146 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
6147
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6148 lvi.iItem = index;
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6149 lvi.iSubItem = z;
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6150 lvi.mask = LVIF_TEXT;
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6151 lvi.cchTextMax = 1023;
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6152 lvi.pszText = text;
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6153
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6154 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
6155 {
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6156 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
6157 if(width > columns[z])
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6158 {
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6159 if(z == 0)
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6160 columns[z] = width + 20;
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6161 else
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6162 columns[z] = width;
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6163 }
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6164 }
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6165 }
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6166
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6167 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
6168 }
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6169
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6170 /* Set the new sizes */
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6171 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
6172 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
6173
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6174 free(columns);
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6175 free(text);
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6176 }
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6177 }
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6178
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6179 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6180 * Creates a rendering context widget (window) to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6181 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6182 * id: An id to be used with dw_window_from_id.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6183 * Returns:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6184 * A handle to the widget or NULL on failure.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6185 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
6186 HWND API dw_render_new(unsigned long id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6187 {
90
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 89
diff changeset
6188 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
6189 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
6190 "",
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
6191 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
6192 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
6193 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
6194 (HMENU)id,
109
94d273843a41 Use DWInstance, and some updates to the spinbutton hack.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 107
diff changeset
6195 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
6196 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
6197 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
6198 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
6199 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
6200 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
6201 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
6202 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
6203
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
6204 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
6205 return tmp;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6206 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6207
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6208 /* Sets the current foreground drawing color.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6209 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6210 * red: red value.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6211 * green: green value.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6212 * blue: blue value.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6213 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
6214 void API dw_color_foreground_set(unsigned long value)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6215 {
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
6216 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
6217
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
6218 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
6219 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
6220
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
6221 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
6222 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
6223 _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
6224 _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
6225 _hBrush[threadid] = CreateSolidBrush(_foreground[threadid]);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6226 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6227
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6228 /* Sets the current background drawing color.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6229 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6230 * red: red value.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6231 * green: green value.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6232 * blue: blue value.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6233 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
6234 void API dw_color_background_set(unsigned long value)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6235 {
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
6236 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
6237
5c66a108aa47 Fixed 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 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
6239 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
6240
5c66a108aa47 Fixed 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 _background[threadid] = RGB(DW_RED_VALUE(value), DW_GREEN_VALUE(value), DW_BLUE_VALUE(value));
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6242 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6243
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6244 /* Draw a point on a window (preferably a render window).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6245 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6246 * handle: Handle to the window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6247 * pixmap: Handle to the pixmap. (choose only one of these)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6248 * x: X coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6249 * y: Y coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6250 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
6251 void API dw_draw_point(HWND handle, HPIXMAP pixmap, int x, int y)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6252 {
58
5c66a108aa47 Fixed 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 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
6254 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
6255
5c66a108aa47 Fixed 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 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
6257 threadid = 0;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6258
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6259 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
6260 hdcPaint = GetDC(handle);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6261 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
6262 hdcPaint = pixmap->hdc;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6263 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6264 return;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6265
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
6266 SetPixel(hdcPaint, x, y, _foreground[threadid]);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6267 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
6268 ReleaseDC(handle, hdcPaint);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6269 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6270
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6271 /* Draw a line on a window (preferably a render window).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6272 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6273 * handle: Handle to the window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6274 * pixmap: Handle to the pixmap. (choose only one of these)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6275 * x1: First X coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6276 * y1: First Y coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6277 * x2: Second X coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6278 * y2: Second Y coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6279 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
6280 void API dw_draw_line(HWND handle, HPIXMAP pixmap, int x1, int y1, int x2, int y2)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6281 {
58
5c66a108aa47 Fixed 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 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
6283 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
6284 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
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 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
6287 threadid = 0;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6288
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6289 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
6290 hdcPaint = GetDC(handle);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6291 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
6292 hdcPaint = pixmap->hdc;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6293 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6294 return;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6295
58
5c66a108aa47 Fixed 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 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
6297 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
6298 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
6299 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
6300 /* 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
6301 * 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
6302 */
5c66a108aa47 Fixed 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 SetPixel(hdcPaint, x2, y2, _foreground[threadid]);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6304 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
6305 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
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 /* 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
6309 * 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
6310 * 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
6311 * 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
6312 * 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
6313 * 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
6314 * 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
6315 * 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
6316 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
6317 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
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 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
6320 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
6321 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
6322 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
6323
5c66a108aa47 Fixed 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 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
6325 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
6326
5c66a108aa47 Fixed 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 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
6328 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
6329 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
6330 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
6331 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
6332 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
6333
5c66a108aa47 Fixed 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 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
6335 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
6336 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
6337 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
6338 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
6339 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
6340 ReleaseDC(handle, hdcPaint);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6341 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6342
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6343 /* Draw text on a window (preferably a render window).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6344 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6345 * handle: Handle to the window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6346 * pixmap: Handle to the pixmap. (choose only one of these)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6347 * x: X coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6348 * y: Y coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6349 * text: Text to be displayed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6350 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
6351 void API dw_draw_text(HWND handle, HPIXMAP pixmap, int x, int y, char *text)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6352 {
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
6353 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
6354 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
6355 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
6356 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
6357
5c66a108aa47 Fixed 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 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
6359 threadid = 0;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6360
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6361 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
6362 hdc = GetDC(handle);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6363 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
6364 hdc = pixmap->hdc;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6365 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6366 return;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6367
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6368 {
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
6369 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
6370
5c66a108aa47 Fixed 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 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
6372 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
6373 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
6374 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
6375
5c66a108aa47 Fixed 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 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
6377 {
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
6378 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
6379 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
6380 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6381 }
58
5c66a108aa47 Fixed 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 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
6383 SetTextColor(hdc, _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
6384 SetBkMode(hdc, TRANSPARENT);
5c66a108aa47 Fixed 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 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
6386 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
6387 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
6388 DeleteObject(hFont);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6389 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
6390 ReleaseDC(handle, hdc);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6391 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6392
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
6393 /* 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
6394 * 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
6395 * 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
6396 * 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
6397 * 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
6398 * 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
6399 * 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
6400 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
6401 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
6402 {
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
6403 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
6404 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
6405 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
6406 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
6407
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
6408 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
6409 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
6410 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
6411 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
6412 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
6413 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
6414
58
5c66a108aa47 Fixed 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 {
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
6416 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
6417
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
6418 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
6419 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
6420 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
6421 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
6422
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
6423 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
6424 {
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
6425 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
6426 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
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 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
6430
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
6431 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
6432
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
6433 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
6434 *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
6435
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
6436 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
6437 *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
6438
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
6439 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
6440 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
6441 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
6442 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
6443 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
6444 }
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
6445
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6446 /* Call this after drawing to the screen to make sure
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6447 * anything you have drawn is visible.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6448 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
6449 void API dw_flush(void)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6450 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6451 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6452
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6453 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6454 * Creates a pixmap with given parameters.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6455 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6456 * handle: Window handle the pixmap is associated with.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6457 * width: Width of the pixmap in pixels.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6458 * height: Height of the pixmap in pixels.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6459 * depth: Color depth of the pixmap.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6460 * Returns:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6461 * A handle to a pixmap or NULL on failure.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6462 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
6463 HPIXMAP API dw_pixmap_new(HWND handle, unsigned long width, unsigned long height, int depth)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6464 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6465 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
6466 BITMAP bm;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6467 HDC hdc;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6468
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6469 if (!(pixmap = calloc(1,sizeof(struct _hpixmap))))
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6470 return NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6471
58
5c66a108aa47 Fixed 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 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
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 pixmap->width = width; pixmap->height = height;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6475
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6476 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
6477 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
6478 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
6479
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
6480 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
6481
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
6482 ReleaseDC(handle, hdc);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6483
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6484 return pixmap;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6485 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6486
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6487 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6488 * Creates a pixmap from internal resource graphic specified by id.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6489 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6490 * handle: Window handle the pixmap is associated with.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6491 * id: Resource ID associated with requested pixmap.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6492 * Returns:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6493 * A handle to a pixmap or NULL on failure.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6494 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
6495 HPIXMAP API dw_pixmap_grab(HWND handle, ULONG id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6496 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6497 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
6498 BITMAP bm;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6499 HDC hdc;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6500
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6501 if (!(pixmap = calloc(1,sizeof(struct _hpixmap))))
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6502 return NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6503
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
6504 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
6505
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
6506
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
6507 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
6508 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
6509
5c66a108aa47 Fixed 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 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
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 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
6513
5c66a108aa47 Fixed 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 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
6515
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
6516 ReleaseDC(handle, hdc);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6517
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6518 return pixmap;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6519 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6520
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6521 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6522 * Destroys an allocated pixmap.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6523 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6524 * pixmap: Handle to a pixmap returned by
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6525 * dw_pixmap_new..
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6526 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
6527 void API dw_pixmap_destroy(HPIXMAP pixmap)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6528 {
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
6529 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
6530 {
5c66a108aa47 Fixed 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 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
6532 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
6533 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
6534 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6535 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6536
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6537 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6538 * Copies from one item to another.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6539 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6540 * dest: Destination window handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6541 * destp: Destination pixmap. (choose only one).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6542 * xdest: X coordinate of destination.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6543 * ydest: Y coordinate of destination.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6544 * width: Width of area to copy.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6545 * height: Height of area to copy.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6546 * src: Source window handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6547 * srcp: Source pixmap. (choose only one).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6548 * xsrc: X coordinate of source.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6549 * ysrc: Y coordinate of source.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6550 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
6551 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
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6552 {
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
6553 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
6554 HDC hdcsrc;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6555
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6556 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
6557 hdcdest = GetDC(dest);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6558 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
6559 hdcdest = destp->hdc;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6560 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6561 return;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6562
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6563 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
6564 hdcsrc = GetDC(src);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6565 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
6566 hdcsrc = srcp->hdc;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6567 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6568 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
6569
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
6570 BitBlt(hdcdest, xdest, ydest, width, height, hdcsrc, xsrc, ysrc, SRCCOPY);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6571
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6572 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
6573 ReleaseDC(dest, hdcdest);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6574 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
6575 ReleaseDC(src, hdcsrc);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6576 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6577
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6578 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6579 * Emits a beep.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6580 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6581 * freq: Frequency.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6582 * dur: Duration.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6583 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
6584 void API dw_beep(int freq, int dur)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6585 {
58
5c66a108aa47 Fixed 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 Beep(freq, dur);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6587 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6588
157
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
6589 /* Open a shared library and return a handle.
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
6590 * Parameters:
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
6591 * name: Base name of the shared library.
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
6592 * handle: Pointer to a module handle,
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
6593 * will be filled in with the handle.
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
6594 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
6595 int API dw_module_load(char *name, HMOD *handle)
157
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
6596 {
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
6597 if(!handle)
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
6598 return -1;
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
6599
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
6600 *handle = LoadLibrary(name);
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
6601 return (NULL == *handle);
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
6602 }
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
6603
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
6604 /* Queries the address of a symbol within open handle.
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
6605 * Parameters:
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
6606 * handle: Module handle returned by dw_module_load()
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
6607 * name: Name of the symbol you want the address of.
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
6608 * func: A pointer to a function pointer, to obtain
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
6609 * the address.
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
6610 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
6611 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
6612 {
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
6613 if(!func || !name)
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
6614 return -1;
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
6615
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
6616 if(0 == strlen(name))
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
6617 return -1;
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
6618
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
6619 *func = (void*)GetProcAddress(handle, name);
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
6620 return (NULL == *func);
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
6621 }
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
6622
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
6623 /* Frees the shared library previously opened.
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
6624 * Parameters:
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
6625 * handle: Module handle returned by dw_module_load()
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
6626 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
6627 int API dw_module_close(HMOD handle)
157
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
6628 {
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
6629 return FreeLibrary(handle);
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
6630 }
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
6631
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6632 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6633 * Returns the handle to an unnamed mutex semaphore.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6634 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
6635 HMTX API dw_mutex_new(void)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6636 {
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
6637 return (HMTX)CreateMutex(NULL, FALSE, NULL);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6638 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6639
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6640 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6641 * Closes a semaphore created by dw_mutex_new().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6642 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6643 * mutex: The handle to the mutex returned by dw_mutex_new().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6644 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
6645 void API dw_mutex_close(HMTX mutex)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6646 {
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
6647 CloseHandle((HANDLE)mutex);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6648 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6649
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6650 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6651 * Tries to gain access to the semaphore, if it can't it blocks.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6652 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6653 * mutex: The handle to the mutex returned by dw_mutex_new().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6654 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
6655 void API dw_mutex_lock(HMTX mutex)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6656 {
63
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 61
diff changeset
6657 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
6658 {
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 61
diff changeset
6659 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
6660
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 61
diff changeset
6661 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
6662 {
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 61
diff changeset
6663 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
6664 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
6665 }
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 61
diff changeset
6666 }
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 61
diff changeset
6667 else
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 61
diff changeset
6668 WaitForSingleObject((HANDLE)mutex, INFINITE);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6669 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6670
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6671 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6672 * Reliquishes the access to the semaphore.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6673 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6674 * mutex: The handle to the mutex returned by dw_mutex_new().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6675 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
6676 void API dw_mutex_unlock(HMTX mutex)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6677 {
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
6678 ReleaseMutex((HANDLE)mutex);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6679 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6680
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6681 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6682 * Returns the handle to an unnamed event semaphore.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6683 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
6684 HEV API dw_event_new(void)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6685 {
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
6686 return CreateEvent(NULL, TRUE, FALSE, NULL);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6687 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6688
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6689 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6690 * Resets a semaphore created by dw_event_new().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6691 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6692 * eve: The handle to the event returned by dw_event_new().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6693 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
6694 int API dw_event_reset(HEV eve)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6695 {
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
6696 return ResetEvent(eve);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6697 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6698
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6699 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6700 * Posts a semaphore created by dw_event_new(). Causing all threads
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6701 * waiting on this event in dw_event_wait to continue.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6702 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6703 * eve: The handle to the event returned by dw_event_new().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6704 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
6705 int API dw_event_post(HEV eve)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6706 {
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
6707 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
6708 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6709
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6710 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6711 * Waits on a semaphore created by dw_event_new(), until the
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6712 * event gets posted or until the timeout expires.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6713 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6714 * eve: The handle to the event returned by dw_event_new().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6715 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
6716 int API dw_event_wait(HEV eve, unsigned long timeout)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6717 {
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
6718 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
6719
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
6720 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
6721 if(rc == WAIT_OBJECT_0)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6722 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
6723 if(rc == WAIT_ABANDONED)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6724 return -1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6725 return 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6726 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6727
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6728 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6729 * Closes a semaphore created by dw_event_new().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6730 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6731 * eve: The handle to the event returned by dw_event_new().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6732 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
6733 int API dw_event_close(HEV *eve)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6734 {
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
6735 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
6736 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
6737 return FALSE;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6738 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6739
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6740 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6741 * Creates a new thread with a starting point of func.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6742 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6743 * func: Function which will be run in the new thread.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6744 * data: Parameter(s) passed to the function.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6745 * stack: Stack size of new thread (OS/2 and Windows only).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6746 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
6747 DWTID API dw_thread_new(void *func, void *data, int stack)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6748 {
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
6749 #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
6750 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
6751 #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
6752 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
6753 #endif
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6754 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6755
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6756 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6757 * Ends execution of current thread immediately.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6758 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
6759 void API dw_thread_end(void)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6760 {
58
5c66a108aa47 Fixed 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 #if !defined(__CYGWIN__)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6762 _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
6763 #endif
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6764 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6765
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6766 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6767 * Returns the current thread's ID.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6768 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
6769 DWTID API dw_thread_id(void)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6770 {
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
6771 #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
6772 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
6773 #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
6774 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
6775 #endif
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6776 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6777
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6778 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6779 * Cleanly terminates a DW session, should be signal handler safe.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6780 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6781 * exitcode: Exit code reported to the operating system.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6782 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
6783 void API dw_exit(int exitcode)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6784 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6785 exit(exitcode);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6786 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6787
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6788 /*
118
c170181668b7 Initial new splitbar code on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 111
diff changeset
6789 * 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
6790 * Parameters:
c170181668b7 Initial new splitbar code on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 111
diff changeset
6791 * type: Value can be BOXVERT or BOXHORZ.
c170181668b7 Initial new splitbar code on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 111
diff changeset
6792 * 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
6793 * 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
6794 * Returns:
c170181668b7 Initial new splitbar code on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 111
diff changeset
6795 * 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
6796 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
6797 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
6798 {
c170181668b7 Initial new splitbar code on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 111
diff changeset
6799 HWND tmp = CreateWindow(SplitbarClassName,
c170181668b7 Initial new splitbar code on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 111
diff changeset
6800 "",
c170181668b7 Initial new splitbar code on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 111
diff changeset
6801 WS_VISIBLE | WS_CHILD | WS_CLIPCHILDREN,
c170181668b7 Initial new splitbar code on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 111
diff changeset
6802 0,0,2000,1000,
c170181668b7 Initial new splitbar code on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 111
diff changeset
6803 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
6804 (HMENU)id,
118
c170181668b7 Initial new splitbar code on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 111
diff changeset
6805 DWInstance,
c170181668b7 Initial new splitbar code on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 111
diff changeset
6806 NULL);
c170181668b7 Initial new splitbar code on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 111
diff changeset
6807
c170181668b7 Initial new splitbar code on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 111
diff changeset
6808 if(tmp)
c170181668b7 Initial new splitbar code on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 111
diff changeset
6809 {
c170181668b7 Initial new splitbar code on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 111
diff changeset
6810 HWND tmpbox = dw_box_new(BOXVERT, 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
6811 float *percent = (float *)malloc(sizeof(float));
118
c170181668b7 Initial new splitbar code on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 111
diff changeset
6812
c170181668b7 Initial new splitbar code on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 111
diff changeset
6813 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
6814 SetParent(tmpbox, tmp);
c170181668b7 Initial new splitbar code on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 111
diff changeset
6815 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
6816
c170181668b7 Initial new splitbar code on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 111
diff changeset
6817 tmpbox = dw_box_new(BOXVERT, 0);
c170181668b7 Initial new splitbar code on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 111
diff changeset
6818 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
6819 SetParent(tmpbox, tmp);
c170181668b7 Initial new splitbar code on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 111
diff changeset
6820 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
6821 *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
6822 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
6823 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
6824 }
c170181668b7 Initial new splitbar code on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 111
diff changeset
6825 return tmp;
c170181668b7 Initial new splitbar code on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 111
diff changeset
6826 }
c170181668b7 Initial new splitbar code on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 111
diff changeset
6827
c170181668b7 Initial new splitbar code on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 111
diff changeset
6828 /*
c170181668b7 Initial new splitbar code on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 111
diff changeset
6829 * Sets the position of a splitbar (pecentage).
c170181668b7 Initial new splitbar code on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 111
diff changeset
6830 * Parameters:
c170181668b7 Initial new splitbar code on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 111
diff changeset
6831 * 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
6832 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
6833 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
6834 {
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
6835 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
6836 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
6837 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
6838
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
6839 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
6840 *mypercent = percent;
129
e47c52b37cdd Code cleanup and OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 127
diff changeset
6841
e47c52b37cdd Code cleanup and OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 127
diff changeset
6842 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
6843
e47c52b37cdd Code cleanup and OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 127
diff changeset
6844 _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
6845 }
c170181668b7 Initial new splitbar code on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 111
diff changeset
6846
c170181668b7 Initial new splitbar code on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 111
diff changeset
6847 /*
c170181668b7 Initial new splitbar code on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 111
diff changeset
6848 * Gets the position of a splitbar (pecentage).
c170181668b7 Initial new splitbar code on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 111
diff changeset
6849 * Parameters:
c170181668b7 Initial new splitbar code on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 111
diff changeset
6850 * 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
6851 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
6852 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
6853 {
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
6854 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
6855
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
6856 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
6857 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
6858 return 0.0;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6859 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6860
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6861 /*
58
5c66a108aa47 Fixed 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 * Pack windows (widgets) into a box from the end (or bottom).
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6863 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6864 * box: Window handle of the box to be packed into.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6865 * item: Window handle of the item to be back.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6866 * width: Width in pixels of the item or -1 to be self determined.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6867 * height: Height in pixels of the item or -1 to be self determined.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6868 * hsize: TRUE if the window (widget) should expand horizontally to fill space given.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6869 * vsize: TRUE if the window (widget) should expand vertically to fill space given.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6870 * pad: Number of pixels of padding around the item.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6871 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
6872 void API dw_box_pack_end(HWND box, HWND item, int width, int height, int hsize, int vsize, int pad)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6873 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6874 Box *thisbox;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6875
58
5c66a108aa47 Fixed 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 thisbox = (Box *)GetWindowLong(box, GWL_USERDATA);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6877 if(thisbox)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6878 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6879 int z;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6880 Item *tmpitem, *thisitem = thisbox->items;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6881 char tmpbuf[100];
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6882
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6883 tmpitem = malloc(sizeof(Item)*(thisbox->count+1));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6884
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6885 for(z=0;z<thisbox->count;z++)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6886 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6887 tmpitem[z+1] = thisitem[z];
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6888 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6889
58
5c66a108aa47 Fixed 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 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
6891
5c66a108aa47 Fixed 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 if(strnicmp(tmpbuf, FRAMECLASSNAME, 2)==0)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6893 tmpitem[0].type = TYPEBOX;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6894 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6895 tmpitem[0].type = TYPEITEM;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6896
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6897 tmpitem[0].hwnd = item;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6898 tmpitem[0].origwidth = tmpitem[0].width = width;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6899 tmpitem[0].origheight = tmpitem[0].height = height;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6900 tmpitem[0].pad = pad;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6901 if(hsize)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6902 tmpitem[0].hsize = SIZEEXPAND;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6903 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6904 tmpitem[0].hsize = SIZESTATIC;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6905
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6906 if(vsize)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6907 tmpitem[0].vsize = SIZEEXPAND;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6908 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6909 tmpitem[0].vsize = SIZESTATIC;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6910
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6911 thisbox->items = tmpitem;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6912
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6913 if(thisbox->count)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6914 free(thisitem);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6915
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6916 thisbox->count++;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6917
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
6918 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
6919 if(strncmp(tmpbuf, UPDOWN_CLASS, strlen(UPDOWN_CLASS))==0)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6920 {
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
6921 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
6922
5c66a108aa47 Fixed 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 if(cinfo)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6924 {
58
5c66a108aa47 Fixed 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 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
6926 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
6927 SendMessage(item, UDM_SETBUDDY, (WPARAM)cinfo->buddy, 0);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6928 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6929 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6930 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6931 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6932
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6933 /*
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
6934 * 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
6935 * 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
6936 * 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
6937 * 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
6938 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
6939 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
6940 {
58
5c66a108aa47 Fixed 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 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
6942
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
6943 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
6944 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
6945 }
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
6946
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
6947 /*
40
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
6948 * 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
6949 * Parameters:
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
6950 * 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
6951 * 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
6952 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
6953 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
6954 {
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
6955 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
6956
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
6957 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
6958 cinfo->clickdefault = next;
40
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
6959 }
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
6960
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
6961 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6962 * Returns some information about the current operating environment.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6963 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6964 * env: Pointer to a DWEnv struct.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6965 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
6966 void API dw_environment_query(DWEnv *env)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6967 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6968 if(!env)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6969 return;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6970
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
6971 /* 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
6972
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
6973 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
6974 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
6975
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
6976 /* 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
6977
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
6978 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
6979
5c66a108aa47 Fixed 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 if (dwVersion < 0x80000000)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6981 {
58
5c66a108aa47 Fixed 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 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
6983 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
6984 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
6985 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
6986 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
6987 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
6988
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
6989 env->MajorBuild = (DWORD)(HIWORD(dwVersion));
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
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 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
6992 {
5c66a108aa47 Fixed 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 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
6994 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
6995 }
5c66a108aa47 Fixed 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
15
81833f25b1aa Added new Dynamic Windows build information to the DWEnv struct.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 14
diff changeset
6997 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
6998 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
6999 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
7000 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
7001 env->DWSubVersion = DW_SUB_VERSION;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7002 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7003
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7004 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7005 * Opens a file dialog and queries user selection.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7006 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7007 * title: Title bar text for dialog.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7008 * defpath: The default path of the open dialog.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7009 * ext: Default file extention.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7010 * flags: DW_FILE_OPEN or DW_FILE_SAVE.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7011 * Returns:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7012 * NULL on error. A malloced buffer containing
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7013 * the file path on success.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7014 *
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7015 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
7016 char * API dw_file_browse(char *title, char *defpath, char *ext, int flags)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7017 {
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
7018 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
7019 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
7020 int rc;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7021
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7022 if(ext)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7023 {
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
7024 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
7025 strcat(filenamebuf, ext);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7026 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7027
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
7028 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
7029
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
7030 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
7031 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
7032 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
7033 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
7034 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
7035 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
7036 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
7037 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
7038 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
7039
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
7040 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
7041 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
7042 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
7043 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
7044
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
7045 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
7046 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
7047
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7048 return NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7049 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7050
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7051 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7052 * Execute and external program in a seperate session.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7053 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7054 * program: Program name with optional path.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7055 * type: Either DW_EXEC_CON or DW_EXEC_GUI.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7056 * params: An array of pointers to string arguements.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7057 * Returns:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7058 * -1 on error.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7059 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
7060 int API dw_exec(char *program, int type, char **params)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7061 {
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
7062 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
7063 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
7064
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
7065 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
7066 {
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
7067 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
7068 }
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
7069
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
7070 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
7071
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
7072 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
7073 {
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
7074 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
7075 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
7076 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
7077 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
7078 }
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
7079 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
7080
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
7081 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
7082
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
7083 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
7084 {
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
7085 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
7086 }
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
7087 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
7088
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
7089 return retcode;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7090 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7091
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7092 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7093 * Loads a web browser pointed at the given URL.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7094 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7095 * url: Uniform resource locator.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7096 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
7097 int API dw_browse(char *url)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7098 {
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
7099 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
7100 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
7101
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
7102 if(strlen(url) > 7 && strncmp(url, "file://", 7) == 0)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7103 {
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
7104 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
7105
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
7106 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
7107 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
7108
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
7109 for(z=0;z<len;z++)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7110 {
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
7111 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
7112 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
7113 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
7114 browseurl[z] = '\\';
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7115 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7116 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7117
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
7118 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
7119 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
7120 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
7121 return 1;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7122 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7123
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7124 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7125 * Returns a pointer to a static buffer which containes the
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7126 * current user directory. Or the root directory (C:\ on
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7127 * OS/2 and Windows).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7128 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
7129 char * API dw_user_dir(void)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7130 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7131 static char _user_dir[1024] = "";
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7132
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7133 if(!_user_dir[0])
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7134 {
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
7135 /* Figure out how to do this the "Windows way" */
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7136 char *home = getenv("HOME");
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7137
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7138 if(home)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7139 strcpy(_user_dir, home);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7140 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7141 strcpy(_user_dir, "C:\\");
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7142 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7143 return _user_dir;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7144 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7145
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7146 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7147 * Call a function from the window (widget)'s context.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7148 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7149 * handle: Window handle of the widget.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7150 * function: Function pointer to be called.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7151 * data: Pointer to the data to be passed to the function.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7152 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
7153 void API dw_window_function(HWND handle, void *function, void *data)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7154 {
58
5c66a108aa47 Fixed 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 SendMessage(handle, WM_USER, (WPARAM)function, (LPARAM)data);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7156 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7157
90
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 89
diff changeset
7158 /* 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
7159 * 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
7160 * 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
7161 */
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 89
diff changeset
7162 UserData *find_userdata(UserData **root, char *varname)
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 89
diff changeset
7163 {
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 89
diff changeset
7164 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
7165
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 89
diff changeset
7166 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
7167 {
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 89
diff changeset
7168 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
7169 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
7170 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
7171 }
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 89
diff changeset
7172 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
7173 }
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 89
diff changeset
7174
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 89
diff changeset
7175 int new_userdata(UserData **root, char *varname, void *data)
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 89
diff changeset
7176 {
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 89
diff changeset
7177 UserData *new = find_userdata(root, varname);
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 89
diff changeset
7178
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 89
diff changeset
7179 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
7180 {
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 89
diff changeset
7181 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
7182 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
7183 }
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 89
diff changeset
7184 else
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 89
diff changeset
7185 {
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 89
diff changeset
7186 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
7187 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
7188 {
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 89
diff changeset
7189 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
7190 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
7191
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 89
diff changeset
7192 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
7193
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 89
diff changeset
7194 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
7195 *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
7196 else
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 89
diff changeset
7197 {
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 89
diff changeset
7198 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
7199 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
7200 {
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 89
diff changeset
7201 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
7202 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
7203 }
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 89
diff changeset
7204 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
7205 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
7206 else
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 89
diff changeset
7207 *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
7208 }
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 89
diff changeset
7209 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
7210 }
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 89
diff changeset
7211 }
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 89
diff changeset
7212 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
7213 }
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 89
diff changeset
7214
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 89
diff changeset
7215 int remove_userdata(UserData **root, char *varname, int all)
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 89
diff changeset
7216 {
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 89
diff changeset
7217 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
7218
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 89
diff changeset
7219 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
7220 {
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 89
diff changeset
7221 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
7222 {
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 89
diff changeset
7223 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
7224 {
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
7225 *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
7226 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
7227 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
7228 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
7229 }
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 89
diff changeset
7230 else
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 89
diff changeset
7231 {
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 89
diff changeset
7232 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
7233 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
7234 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
7235 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
7236 }
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 89
diff changeset
7237 }
136
2584a4646b41 Fixed a horrible bug in the code to remove user data from a window on OS/2
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 129
diff changeset
7238 prev = tmp;
90
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 89
diff changeset
7239 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
7240 }
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 89
diff changeset
7241 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
7242 }
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 89
diff changeset
7243
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 89
diff changeset
7244 /*
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 89
diff changeset
7245 * 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
7246 * Parameters:
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 89
diff changeset
7247 * 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
7248 * 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
7249 * 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
7250 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
7251 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
7252 {
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 89
diff changeset
7253 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
7254
118
c170181668b7 Initial new splitbar code on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 111
diff changeset
7255 if(!cinfo)
c170181668b7 Initial new splitbar code on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 111
diff changeset
7256 {
c170181668b7 Initial new splitbar code on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 111
diff changeset
7257 cinfo = calloc(1, sizeof(ColorInfo));
c170181668b7 Initial new splitbar code on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 111
diff changeset
7258 SetWindowLong(window, GWL_USERDATA, (LONG)cinfo);
c170181668b7 Initial new splitbar code on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 111
diff changeset
7259 }
c170181668b7 Initial new splitbar code on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 111
diff changeset
7260
90
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 89
diff changeset
7261 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
7262 {
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 89
diff changeset
7263 if(data)
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 89
diff changeset
7264 new_userdata(&(cinfo->root), dataname, data);
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 89
diff changeset
7265 else
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 89
diff changeset
7266 {
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 89
diff changeset
7267 if(dataname)
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 89
diff changeset
7268 remove_userdata(&(cinfo->root), dataname, FALSE);
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 89
diff changeset
7269 else
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 89
diff changeset
7270 remove_userdata(&(cinfo->root), NULL, TRUE);
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 89
diff changeset
7271 }
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 89
diff changeset
7272 }
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 89
diff changeset
7273 }
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 89
diff changeset
7274
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 89
diff changeset
7275 /*
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 89
diff changeset
7276 * 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
7277 * Parameters:
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 89
diff changeset
7278 * 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
7279 * 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
7280 * 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
7281 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
7282 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
7283 {
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 89
diff changeset
7284 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
7285
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 89
diff changeset
7286 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
7287 {
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 89
diff changeset
7288 UserData *ud = find_userdata(&(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
7289 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
7290 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
7291 }
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 89
diff changeset
7292 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
7293 }
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 89
diff changeset
7294
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7295 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7296 * Add a callback to a window event.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7297 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7298 * window: Window handle of signal to be called back.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7299 * signame: A string pointer identifying which signal to be hooked.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7300 * sigfunc: The pointer to the function to be used as the callback.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7301 * data: User data to be passed to the handler function.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7302 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
7303 void API dw_signal_connect(HWND window, char *signame, void *sigfunc, void *data)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7304 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7305 ULONG message = 0L;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7306
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7307 if(window && signame && sigfunc)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7308 {
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 57
diff changeset
7309 if(stricmp(signame, "set-focus") == 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
7310 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
7311
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7312 if((message = _findsigmessage(signame)) != 0)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7313 _new_signal(message, window, sigfunc, data);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7314 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7315 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7316
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7317 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7318 * Removes callbacks for a given window with given name.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7319 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7320 * window: Window handle of callback to be removed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7321 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
7322 void API dw_signal_disconnect_by_name(HWND window, char *signame)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7323 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7324 SignalHandler *prev = NULL, *tmp = Root;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7325 ULONG message;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7326
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7327 if(!window || !signame || (message = _findsigmessage(signame)) == 0)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7328 return;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7329
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7330 while(tmp)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7331 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7332 if(tmp->window == window && tmp->message == message)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7333 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7334 if(prev)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7335 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7336 prev->next = tmp->next;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7337 free(tmp);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7338 tmp = prev->next;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7339 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7340 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7341 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7342 Root = tmp->next;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7343 free(tmp);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7344 tmp = Root;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7345 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7346 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7347 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7348 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7349 prev = tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7350 tmp = tmp->next;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7351 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7352 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7353 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7354
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7355 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7356 * Removes all callbacks for a given window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7357 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7358 * window: Window handle of callback to be removed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7359 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
7360 void API dw_signal_disconnect_by_window(HWND window)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7361 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7362 SignalHandler *prev = NULL, *tmp = Root;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7363
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7364 while(tmp)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7365 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7366 if(tmp->window == window)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7367 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7368 if(prev)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7369 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7370 prev->next = tmp->next;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7371 free(tmp);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7372 tmp = prev->next;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7373 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7374 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7375 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7376 Root = tmp->next;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7377 free(tmp);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7378 tmp = Root;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7379 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7380 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7381 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7382 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7383 prev = tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7384 tmp = tmp->next;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7385 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7386 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7387 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7388
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7389 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7390 * Removes all callbacks for a given window with specified data.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7391 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7392 * window: Window handle of callback to be removed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7393 * data: Pointer to the data to be compared against.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7394 */
177
e3dd5c765775 Fixes for Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 173
diff changeset
7395 void API dw_signal_disconnect_by_data(HWND window, void *data)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7396 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7397 SignalHandler *prev = NULL, *tmp = Root;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7398
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7399 while(tmp)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7400 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7401 if(tmp->window == window && tmp->data == data)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7402 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7403 if(prev)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7404 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7405 prev->next = tmp->next;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7406 free(tmp);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7407 tmp = prev->next;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7408 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7409 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7410 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7411 Root = tmp->next;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7412 free(tmp);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7413 tmp = Root;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7414 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7415 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7416 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7417 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7418 prev = tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7419 tmp = tmp->next;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7420 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7421 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7422 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7423