annotate os2/dw.c @ 60:61869769c050

Sync with the latest DW code.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Thu, 29 Nov 2001 15:10:39 +0000
parents 5c66a108aa47
children 4a02842f8074
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:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3 * A GTK like implementation of the PM GUI
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4 *
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5 * (C) 2000,2001 Brian Smith <dbsoft@technologist.com>
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6 * (C) 2000 Achim Hasenmueller <achimha@innotek.de>
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7 * (C) 2000 Peter Nielsen <peter@pmview.com>
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8 * (C) 1998 Sergey I. Yevtushenko (some code borrowed from cell toolkit)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9 *
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11 #define INCL_DOS
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12 #define INCL_DOSERRORS
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
13 #define INCL_WIN
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
14 #define INCL_GPI
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
15
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
16 #include <os2.h>
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
17 #include <stdlib.h>
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
18 #include <string.h>
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
19 #include <stdio.h>
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
20 #include <stdarg.h>
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
21 #include <stddef.h>
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
22 #include <ctype.h>
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
23 #include <process.h>
37
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
24 #include <time.h>
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
25 #include "dw.h"
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
26
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
27 #define QWP_USER 0
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
28
37
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
29 MRESULT EXPENTRY _run_event(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2);
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
30
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
31 char ClassName[] = "dynamicwindows";
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
32 char SplitbarClassName[] = "dwsplitbar";
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
33 char DefaultFont[] = "9.WarpSans";
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
34
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
35 /* this is the callback handle for the window procedure
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
36 * make sure you always match the calling convention!
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
37 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
38 int (* EXPENTRY filterfunc)(HWND, ULONG, MPARAM, MPARAM) = 0L;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
39
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
40 HAB dwhab = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
41 HMQ dwhmq = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
42 DWTID _dwtid = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
43 LONG _foreground = 0xAAAAAA, _background = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
44
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
45 HWND hwndBubble = NULLHANDLE, hwndBubbleLast = NULLHANDLE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
46 PRECORDCORE pCore = NULL;
20
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
47 ULONG aulBuffer[4];
55
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
48 HWND lasthcnr = 0, lastitem = 0;
20
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
49
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
50 #define IS_WARP4() (aulBuffer[0] == 20 && aulBuffer[1] >= 40)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
51
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
52 #ifndef min
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
53 #define min(a, b) (((a < b) ? a : b))
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
54 #endif
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
55
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
56 #ifdef DWDEBUG
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
57 FILE *f;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
58
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
59 void reopen(void)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
60 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
61 fclose(f);
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
62 f = fopen("dw.log", "a+");
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
63 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
64 #endif
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
65
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
66 static LONG lColor[SPLITBAR_WIDTH] =
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
67 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
68 DW_CLR_BLACK,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
69 DW_CLR_PALEGRAY,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
70 DW_CLR_WHITE
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
71 };
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
72
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
73 #ifdef NO_SIGNALS
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
74 #define USE_FILTER
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
75 #else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
76 typedef struct _sighandler
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
77 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
78 struct _sighandler *next;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
79 ULONG message;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
80 HWND window;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
81 void *signalfunction;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
82 void *data;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
83
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
84 } SignalHandler;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
85
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
86 SignalHandler *Root = NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
87
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
88 typedef struct
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
89 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
90 ULONG message;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
91 char name[30];
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
92
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
93 } SignalList;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
94
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
95 /* List of signals and their equivilent OS/2 message */
55
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
96 #define SIGNALMAX 14
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
97
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
98 SignalList SignalTranslate[SIGNALMAX] = {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
99 { WM_SIZE, "configure_event" },
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
100 { WM_CHAR, "key_press_event" },
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
101 { WM_BUTTON1DOWN, "button_press_event" },
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
102 { WM_BUTTON1UP, "button_release_event"},
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
103 { WM_MOUSEMOVE, "motion_notify_event" },
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
104 { WM_CLOSE, "delete_event" },
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
105 { WM_PAINT, "expose_event" },
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
106 { WM_COMMAND, "clicked" },
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
107 { CN_ENTER, "container-select" },
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
108 { CN_CONTEXTMENU, "container-context" },
14
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
109 { LN_SELECT, "item-select" },
54
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
110 { CN_EMPHASIS, "tree-select" },
55
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
111 { WM_SETFOCUS, "set-focus" },
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
112 { WM_USER+1, "lose-focus" }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
113 };
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
114
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
115 /* This function adds a signal handler callback into the linked list.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
116 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
117 void _new_signal(ULONG message, HWND window, void *signalfunction, void *data)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
118 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
119 SignalHandler *new = malloc(sizeof(SignalHandler));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
120
55
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
121 #ifndef NO_SIGNALS
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
122 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
123 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
124 #endif
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
125
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
126 new->message = message;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
127 new->window = window;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
128 new->signalfunction = signalfunction;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
129 new->data = data;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
130 new->next = NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
131
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
132 if (!Root)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
133 Root = new;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
134 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
135 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
136 SignalHandler *prev = NULL, *tmp = Root;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
137 while(tmp)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
138 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
139 prev = tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
140 tmp = tmp->next;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
141 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
142 if(prev)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
143 prev->next = new;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
144 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
145 Root = new;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
146 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
147 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
148
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
149 /* Finds the message number for a given signal name */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
150 ULONG _findsigmessage(char *signame)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
151 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
152 int z;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
153
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
154 for(z=0;z<SIGNALMAX;z++)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
155 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
156 if(stricmp(signame, SignalTranslate[z].name) == 0)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
157 return SignalTranslate[z].message;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
158 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
159 return 0L;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
160 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
161 #endif
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
162
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
163 typedef struct _CNRITEM
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
164 {
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
165 MINIRECORDCORE rc;
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
166 HPOINTER hptrIcon;
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
167 PVOID user;
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
168
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
169 } CNRITEM, *PCNRITEM;
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
170
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
171
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
172 /* This function changes the owner of buttons in to the
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
173 * dynamicwindows handle to fix a problem in notebooks.
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
174 */
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
175 void _fix_button_owner(HWND handle, HWND dw)
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
176 {
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
177 HENUM henum;
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
178 HWND child;
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
179
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
180 henum = WinBeginEnumWindows(handle);
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
181 while((child = WinGetNextWindow(henum)) != NULLHANDLE)
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
182 {
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
183 char tmpbuf[100];
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
184
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
185 WinQueryClassName(child, 99, tmpbuf);
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
186
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
187 if(strncmp(tmpbuf, "#3", 3)==0 && dw) /* Button */
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
188 WinSetOwner(child, dw);
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
189 else if(strncmp(tmpbuf, "dynamicwindows", 14) == 0)
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
190 dw = child;
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
191
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
192 _fix_button_owner(child, dw);
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
193 }
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
194 WinEndEnumWindows(henum);
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
195 return;
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
196 }
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
197
55
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
198 void _disconnect_windows(HWND handle)
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
199 {
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
200 HENUM henum;
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
201 HWND child;
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
202
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
203 #ifndef NO_SIGNALS
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
204 dw_signal_disconnect_by_window(handle);
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
205 #endif
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
206
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
207 henum = WinBeginEnumWindows(handle);
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
208 while((child = WinGetNextWindow(henum)) != NULLHANDLE)
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
209 _disconnect_windows(child);
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
210
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
211 WinEndEnumWindows(henum);
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
212 }
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
213
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
214 /* This function removes and handlers on windows and frees
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
215 * the user memory allocated to it.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
216 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
217 void _free_window_memory(HWND handle)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
218 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
219 HENUM henum;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
220 HWND child;
54
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
221 void *ptr = (void *)WinQueryWindowPtr(handle, QWP_USER);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
222
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
223 #ifndef NO_SIGNALS
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
224 dw_signal_disconnect_by_window(handle);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
225 #endif
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
226
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
227 if(ptr)
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
228 {
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
229 WinSetWindowPtr(handle, QWP_USER, 0);
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
230 free(ptr);
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
231 }
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
232
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
233 henum = WinBeginEnumWindows(handle);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
234 while((child = WinGetNextWindow(henum)) != NULLHANDLE)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
235 _free_window_memory(child);
54
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
236
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
237 WinEndEnumWindows(henum);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
238 return;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
239 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
240
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
241 /* This function returns 1 if the window (widget) handle
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
242 * passed to it is a valid window that can gain input focus.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
243 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
244 int _validate_focus(HWND handle)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
245 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
246 char tmpbuf[100];
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
247
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
248 if(!handle)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
249 return 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
250
37
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
251 if(!WinIsWindowEnabled(handle))
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
252 return 0;
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
253
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
254 WinQueryClassName(handle, 99, tmpbuf);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
255
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
256 /* These are the window classes which can
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
257 * obtain input focus.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
258 */
55
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
259 if(strncmp(tmpbuf, "#2", 3)==0 || /* Combobox */
34
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
260 strncmp(tmpbuf, "#3", 3)==0 || /* Button */
55
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
261 strncmp(tmpbuf, "#6", 3)==0 || /* Entryfield */
34
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
262 strncmp(tmpbuf, "#7", 3)==0 || /* List box */
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
263 strncmp(tmpbuf, "#10", 3)==0 || /* MLE */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
264 strncmp(tmpbuf, "#32", 3)==0 || /* Spinbutton */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
265 strncmp(tmpbuf, "#37", 3)== 0) /* Container */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
266 return 1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
267 return 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
268 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
269
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
270 int _focus_check_box(Box *box, HWND handle, int start, HWND defaultitem)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
271 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
272 int z;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
273 static HWND lasthwnd, firsthwnd;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
274 static int finish_searching;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
275
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
276 /* Start is 2 when we have cycled completely and
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
277 * need to set the focus to the last widget we found
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
278 * that was valid.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
279 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
280 if(start == 2)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
281 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
282 if(lasthwnd)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
283 WinSetFocus(HWND_DESKTOP, lasthwnd);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
284 return 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
285 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
286
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
287 /* Start is 1 when we are entering the function
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
288 * for the first time, it is zero when entering
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
289 * the function recursively.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
290 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
291 if(start == 1)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
292 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
293 lasthwnd = handle;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
294 finish_searching = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
295 firsthwnd = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
296 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
297
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
298 /* Vertical boxes are inverted on OS/2 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
299 if(box->type == BOXVERT)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
300 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
301 for(z=0;z<box->count;z++)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
302 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
303 if(box->items[z].type == TYPEBOX)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
304 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
305 Box *thisbox = WinQueryWindowPtr(box->items[z].hwnd, QWP_USER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
306
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
307 if(thisbox && _focus_check_box(thisbox, handle, start == 3 ? 3 : 0, defaultitem))
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
308 return 1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
309 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
310 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
311 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
312 if(box->items[z].hwnd == handle)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
313 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
314 if(lasthwnd == handle && firsthwnd)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
315 WinSetFocus(HWND_DESKTOP, firsthwnd);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
316 else if(lasthwnd == handle && !firsthwnd)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
317 finish_searching = 1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
318 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
319 WinSetFocus(HWND_DESKTOP, lasthwnd);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
320
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
321 /* If we aren't looking for the last handle,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
322 * return immediately.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
323 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
324 if(!finish_searching)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
325 return 1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
326 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
327 if(_validate_focus(box->items[z].hwnd))
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
328 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
329 /* Start is 3 when we are looking for the
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
330 * first valid item in the layout.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
331 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
332 if(start == 3)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
333 {
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
334 if(!defaultitem || (defaultitem && defaultitem == box->items[z].hwnd))
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
335 {
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
336 WinSetFocus(HWND_DESKTOP, box->items[z].hwnd);
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
337 return 1;
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
338 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
339 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
340
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
341 if(!firsthwnd)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
342 firsthwnd = box->items[z].hwnd;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
343
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
344 lasthwnd = box->items[z].hwnd;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
345 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
346 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
347 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
348 char tmpbuf[100] = "";
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
349
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
350 WinQueryClassName(box->items[z].hwnd, 99, tmpbuf);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
351 if(strncmp(tmpbuf, "#40", 3)==0) /* Notebook */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
352 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
353 Box *notebox;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
354 HWND page = (HWND)WinSendMsg(box->items[z].hwnd, BKM_QUERYPAGEWINDOWHWND,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
355 (MPARAM)dw_notebook_page_query(box->items[z].hwnd), 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
356
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
357 if(page)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
358 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
359 notebox = (Box *)WinQueryWindowPtr(page, QWP_USER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
360
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
361 if(notebox && _focus_check_box(notebox, handle, start == 3 ? 3 : 0, defaultitem))
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
362 return 1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
363 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
364 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
365 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
366 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
367 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
368 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
369 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
370 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
371 for(z=box->count-1;z>-1;z--)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
372 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
373 if(box->items[z].type == TYPEBOX)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
374 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
375 Box *thisbox = WinQueryWindowPtr(box->items[z].hwnd, QWP_USER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
376
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
377 if(thisbox && _focus_check_box(thisbox, handle, start == 3 ? 3 : 0, defaultitem))
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
378 return 1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
379 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
380 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
381 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
382 if(box->items[z].hwnd == handle)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
383 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
384 if(lasthwnd == handle && firsthwnd)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
385 WinSetFocus(HWND_DESKTOP, firsthwnd);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
386 else if(lasthwnd == handle && !firsthwnd)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
387 finish_searching = 1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
388 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
389 WinSetFocus(HWND_DESKTOP, lasthwnd);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
390
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
391 /* If we aren't looking for the last handle,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
392 * return immediately.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
393 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
394 if(!finish_searching)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
395 return 1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
396 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
397 if(_validate_focus(box->items[z].hwnd))
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
398 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
399 /* Start is 3 when we are looking for the
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
400 * first valid item in the layout.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
401 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
402 if(start == 3)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
403 {
34
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
404 if(!defaultitem || (defaultitem && defaultitem == box->items[z].hwnd))
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
405 {
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
406 WinSetFocus(HWND_DESKTOP, box->items[z].hwnd);
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
407 return 1;
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
408 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
409 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
410
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
411 if(!firsthwnd)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
412 firsthwnd = box->items[z].hwnd;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
413
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
414 lasthwnd = box->items[z].hwnd;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
415 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
416 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
417 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
418 char tmpbuf[100] = "";
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
419
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
420 WinQueryClassName(box->items[z].hwnd, 99, tmpbuf);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
421 if(strncmp(tmpbuf, "#40", 3)==0) /* Notebook */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
422 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
423 Box *notebox;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
424 HWND page = (HWND)WinSendMsg(box->items[z].hwnd, BKM_QUERYPAGEWINDOWHWND,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
425 (MPARAM)dw_notebook_page_query(box->items[z].hwnd), 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
426
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
427 if(page)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
428 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
429 notebox = (Box *)WinQueryWindowPtr(page, QWP_USER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
430
34
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
431 if(notebox && _focus_check_box(notebox, handle, start == 3 ? 3 : 0, defaultitem))
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
432 return 1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
433 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
434 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
435 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
436 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
437 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
438 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
439 return 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
440 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
441
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
442 /* This function finds the first widget in the
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
443 * layout and moves the current focus to it.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
444 */
55
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
445 int _initial_focus(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
446 {
14
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
447 Box *thisbox = NULL;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
448 HWND box;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
449
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
450 box = WinWindowFromID(handle, FID_CLIENT);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
451 if(box)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
452 thisbox = WinQueryWindowPtr(box, QWP_USER);
55
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
453 else
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
454 return 1;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
455
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
456 if(thisbox)
34
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
457 _focus_check_box(thisbox, handle, 3, thisbox->defaultitem);
55
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
458 return 0;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
459 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
460
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
461 /* This function finds the current widget in the
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
462 * layout and moves the current focus to the next item.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
463 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
464 void _shift_focus(HWND handle)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
465 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
466 Box *thisbox;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
467 HWND box, lastbox = WinQueryWindow(handle, QW_PARENT);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
468
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
469 /* Find the toplevel window */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
470 while((box = WinQueryWindow(lastbox, QW_PARENT)) > 0x80000001)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
471 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
472 lastbox = box;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
473 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
474
14
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
475 box = WinWindowFromID(lastbox, FID_CLIENT);
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
476 if(box)
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
477 thisbox = WinQueryWindowPtr(box, QWP_USER);
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
478 else
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
479 thisbox = WinQueryWindowPtr(lastbox, QWP_USER);
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
480
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
481 if(thisbox)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
482 {
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
483 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
484 _focus_check_box(thisbox, handle, 2, 0);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
485 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
486 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
487
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
488 /* ResetWindow:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
489 * Resizes window to the exact same size to trigger
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
490 * recalculation of frame.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
491 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
492 void _ResetWindow(HWND hwndFrame)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
493 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
494 SWP swp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
495
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
496 WinQueryWindowPos(hwndFrame, &swp);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
497 WinSetWindowPos(hwndFrame, HWND_TOP, 0, 0, swp.cx, swp.cy-1, SWP_SIZE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
498 WinSetWindowPos(hwndFrame, HWND_TOP, 0, 0, swp.cx, swp.cy, SWP_SIZE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
499 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
500
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
501 /* This function will recursively search a box and add up the total height of it */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
502 void _count_size(HWND box, int type, int *xsize, int *xorigsize)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
503 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
504 int size = 0, origsize = 0, z;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
505 Box *tmp = WinQueryWindowPtr(box, QWP_USER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
506
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
507 if(!tmp)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
508 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
509 *xsize = *xorigsize = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
510 return;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
511 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
512
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
513 if(type == tmp->type)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
514 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
515 /* If the box is going in the direction we want, then we
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
516 * return the entire sum of the items.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
517 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
518 for(z=0;z<tmp->count;z++)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
519 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
520 if(tmp->items[z].type == TYPEBOX)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
521 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
522 int s, os;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
523
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
524 _count_size(tmp->items[z].hwnd, type, &s, &os);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
525 size += s;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
526 origsize += os;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
527 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
528 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
529 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
530 size += (type == BOXHORZ ? tmp->items[z].width : tmp->items[z].height);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
531 origsize += (type == BOXHORZ ? tmp->items[z].origwidth : tmp->items[z].origheight);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
532 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
533 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
534 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
535 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
536 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
537 /* If the box is not going in the direction we want, then we only
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
538 * want to return the maximum value.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
539 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
540 int tmpsize = 0, tmporigsize = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
541
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
542 for(z=0;z<tmp->count;z++)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
543 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
544 if(tmp->items[z].type == TYPEBOX)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
545 _count_size(tmp->items[z].hwnd, type, &tmpsize, &tmporigsize);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
546 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
547 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
548 tmpsize = (type == BOXHORZ ? tmp->items[z].width : tmp->items[z].height);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
549 tmporigsize = (type == BOXHORZ ? tmp->items[z].origwidth : tmp->items[z].origheight);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
550 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
551
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
552 if(tmpsize > size)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
553 size = tmpsize;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
554 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
555 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
556
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
557 *xsize = size;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
558 *xorigsize = origsize;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
559 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
560
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
561
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
562 /* Function: TrackRectangle
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
563 * Abstract: Tracks given rectangle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
564 *
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
565 * If rclBounds is NULL, then track rectangle on entire desktop.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
566 * rclTrack is in window coorditates and will be mapped to
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
567 * desktop.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
568 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
569
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
570 BOOL _TrackRectangle(HWND hwndBase, RECTL* rclTrack, RECTL* rclBounds)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
571 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
572 TRACKINFO track;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
573 APIRET rc;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
574
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
575 track.cxBorder = 1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
576 track.cyBorder = 1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
577 track.cxGrid = 1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
578 track.cyGrid = 1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
579 track.cxKeyboard = 8;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
580 track.cyKeyboard = 8;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
581
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
582 if(!rclTrack)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
583 return FALSE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
584
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
585 if(rclBounds)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
586 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
587 track.rclBoundary = *rclBounds;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
588 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
589 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
590 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
591 track.rclBoundary.yTop =
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
592 track.rclBoundary.xRight = 3000;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
593 track.rclBoundary.yBottom =
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
594 track.rclBoundary.xLeft = -3000;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
595 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
596
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
597 track.rclTrack = *rclTrack;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
598
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
599 WinMapWindowPoints(hwndBase,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
600 HWND_DESKTOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
601 (PPOINTL)&track.rclTrack,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
602 2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
603
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
604 track.ptlMinTrackSize.x = track.rclTrack.xRight
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
605 - track.rclTrack.xLeft;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
606 track.ptlMinTrackSize.y = track.rclTrack.yTop
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
607 - track.rclTrack.yBottom;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
608 track.ptlMaxTrackSize.x = track.rclTrack.xRight
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
609 - track.rclTrack.xLeft;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
610 track.ptlMaxTrackSize.y = track.rclTrack.yTop
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
611 - track.rclTrack.yBottom;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
612
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
613 track.fs = TF_MOVE | TF_ALLINBOUNDARY;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
614
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
615 rc = WinTrackRect(HWND_DESKTOP, 0, &track);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
616
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
617 if(rc)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
618 *rclTrack = track.rclTrack;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
619
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
620 return rc;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
621 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
622
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
623 /* This function calculates how much space the widgets and boxes require
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
624 * and does expansion as necessary.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
625 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
626 int _resize_box(Box *thisbox, int *depth, int x, int y, int *usedx, int *usedy,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
627 int pass, int *usedpadx, int *usedpady)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
628 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
629 int z, currentx = 0, currenty = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
630 int uymax = 0, uxmax = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
631 int upymax = 0, upxmax = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
632 /* Used for the SIZEEXPAND */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
633 int nux = *usedx, nuy = *usedy;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
634 int nupx = *usedpadx, nupy = *usedpady;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
635
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
636 (*usedx) += (thisbox->pad * 2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
637 (*usedy) += (thisbox->pad * 2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
638
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
639 for(z=0;z<thisbox->count;z++)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
640 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
641 if(thisbox->items[z].type == TYPEBOX)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
642 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
643 int initialx, initialy;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
644 Box *tmp = WinQueryWindowPtr(thisbox->items[z].hwnd, QWP_USER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
645
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
646 initialx = x - (*usedx);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
647 initialy = y - (*usedy);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
648
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
649 if(tmp)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
650 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
651 int newx, newy;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
652 int nux = *usedx, nuy = *usedy;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
653 int upx = *usedpadx + (tmp->pad*2), upy = *usedpady + (tmp->pad*2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
654
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
655 /* On the second pass we know how big the box needs to be and how
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
656 * much space we have, so we can calculate a ratio for the new box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
657 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
658 if(pass == 2)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
659 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
660 int deep = *depth + 1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
661
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
662 _resize_box(tmp, &deep, x, y, &nux, &nuy, 1, &upx, &upy);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
663
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
664 tmp->upx = upx - *usedpadx;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
665 tmp->upy = upy - *usedpady;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
666
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
667 newx = x - nux;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
668 newy = y - nuy;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
669
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
670 tmp->width = thisbox->items[z].width = initialx - newx;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
671 tmp->height = thisbox->items[z].height = initialy - newy;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
672
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
673 tmp->parentxratio = thisbox->xratio;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
674 tmp->parentyratio = thisbox->yratio;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
675
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
676 tmp->parentpad = tmp->pad;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
677
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
678 /* Just in case */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
679 tmp->xratio = thisbox->xratio;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
680 tmp->yratio = thisbox->yratio;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
681
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
682 #ifdef DWDEBUG
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
683 if(pass > 1)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
684 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
685 fprintf(f, "FARK! depth %d\r\nwidth = %d, height = %d, nux = %d, nuy = %d, upx = %d, upy = %d xratio = %f, yratio = %f\r\n\r\n",
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
686 *depth, thisbox->items[z].width, thisbox->items[z].height, nux, nuy, tmp->upx, tmp->upy, tmp->xratio, tmp->yratio);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
687 reopen();
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
688 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
689 #endif
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
690
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
691 if(thisbox->type == BOXVERT)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
692 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
693 if((thisbox->items[z].width-((thisbox->items[z].pad*2)+(tmp->pad*2)))!=0)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
694 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
695 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
696 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
697 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
698 if((thisbox->items[z].width-tmp->upx)!=0)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
699 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
700 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
701 if(thisbox->type == BOXHORZ)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
702 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
703 if((thisbox->items[z].height-((thisbox->items[z].pad*2)+(tmp->pad*2)))!=0)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
704 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
705 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
706 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
707 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
708 if((thisbox->items[z].height-tmp->upy)!=0)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
709 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
710 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
711
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
712 nux = *usedx; nuy = *usedy;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
713 upx = *usedpadx + (tmp->pad*2); upy = *usedpady + (tmp->pad*2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
714 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
715
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
716 (*depth)++;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
717
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
718 #ifdef DWDEBUG
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
719 if(pass > 1)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
720 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
721 fprintf(f, "Before Resize Box depth %d\r\nx = %d, y = %d, usedx = %d, usedy = %d, usedpadx = %d, usedpady = %d xratio = %f, yratio = %f\r\n\r\n",
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
722 *depth, x, y, *usedx, *usedy, *usedpadx, *usedpady, tmp->xratio, tmp->yratio);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
723 reopen();
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
724 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
725 #endif
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
726
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
727 _resize_box(tmp, depth, x, y, &nux, &nuy, pass, &upx, &upy);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
728
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
729 (*depth)--;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
730
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
731 newx = x - nux;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
732 newy = y - nuy;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
733
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
734 tmp->minwidth = thisbox->items[z].width = initialx - newx;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
735 tmp->minheight = thisbox->items[z].height = initialy - newy;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
736
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
737 #ifdef DWDEBUG
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
738 if(pass > 1)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
739 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
740 fprintf(f, "After Resize Box depth %d\r\nx = %d, y = %d, usedx = %d, usedy = %d, usedpadx = %d, usedpady = %d width = %d, height = %d\r\n\r\n",
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
741 *depth, x, y, *usedx, *usedy, *usedpadx, *usedpady, thisbox->items[z].width, thisbox->items[z].height);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
742 reopen();
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
743 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
744 #endif
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
745 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
746 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
747
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
748 if(pass > 1 && *depth > 0)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
749 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
750 if(thisbox->type == BOXVERT)
60
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
751 {
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
752 if((thisbox->minwidth-((thisbox->items[z].pad*2)+(thisbox->parentpad*2))) == 0)
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
753 thisbox->items[z].xratio = 1.0;
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
754 else
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
755 thisbox->items[z].xratio = ((float)((thisbox->width * thisbox->parentxratio)-((thisbox->items[z].pad*2)+(thisbox->parentpad*2))))/((float)(thisbox->minwidth-((thisbox->items[z].pad*2)+(thisbox->parentpad*2))));
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
756 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
757 else
60
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
758 {
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
759 if(thisbox->minwidth-thisbox->upx == 0)
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
760 thisbox->items[z].xratio = 1.0;
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
761 else
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
762 thisbox->items[z].xratio = ((float)((thisbox->width * thisbox->parentxratio)-thisbox->upx))/((float)(thisbox->minwidth-thisbox->upx));
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
763 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
764
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
765 if(thisbox->type == BOXHORZ)
60
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
766 {
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
767 if((thisbox->minheight-((thisbox->items[z].pad*2)+(thisbox->parentpad*2))) == 0)
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
768 thisbox->items[z].yratio = 1.0;
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
769 else
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
770 thisbox->items[z].yratio = ((float)((thisbox->height * thisbox->parentyratio)-((thisbox->items[z].pad*2)+(thisbox->parentpad*2))))/((float)(thisbox->minheight-((thisbox->items[z].pad*2)+(thisbox->parentpad*2))));
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
771 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
772 else
60
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
773 {
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
774 if(thisbox->minheight-thisbox->upy == 0)
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
775 thisbox->items[z].yratio = 1.0;
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
776 else
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
777 thisbox->items[z].yratio = ((float)((thisbox->height * thisbox->parentyratio)-thisbox->upy))/((float)(thisbox->minheight-thisbox->upy));
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
778 }
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
779
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
780 if(thisbox->items[z].type == TYPEBOX)
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
781 {
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
782 Box *tmp = WinQueryWindowPtr(thisbox->items[z].hwnd, QWP_USER);
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
783
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
784 if(tmp)
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
785 {
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
786 tmp->parentxratio = thisbox->items[z].xratio;
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
787 tmp->parentyratio = thisbox->items[z].yratio;
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
788 }
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
789 }
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
790
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
791 #ifdef DWDEBUG
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
792 fprintf(f, "RATIO- xratio = %f, yratio = %f, width = %d, height = %d, pad = %d, box xratio = %f, box yratio = %f, parent xratio = %f, parent yratio = %f, minwidth = %d, minheight = %d, width = %d, height = %d, upx = %d, upy = %d\r\n\r\n",
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
793 thisbox->items[z].xratio, thisbox->items[z].yratio, thisbox->items[z].width, thisbox->items[z].height, thisbox->items[z].pad, thisbox->xratio, thisbox->yratio, thisbox->parentxratio, thisbox->parentyratio, thisbox->minwidth, thisbox->minheight, thisbox->width, thisbox->height, thisbox->upx, thisbox->upy);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
794 reopen();
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
795 #endif
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
796 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
797 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
798 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
799 thisbox->items[z].xratio = thisbox->xratio;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
800 thisbox->items[z].yratio = thisbox->yratio;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
801 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
802
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
803 if(thisbox->type == BOXVERT)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
804 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
805 if((thisbox->items[z].width + (thisbox->items[z].pad*2)) > uxmax)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
806 uxmax = (thisbox->items[z].width + (thisbox->items[z].pad*2));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
807 if(thisbox->items[z].hsize != SIZEEXPAND)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
808 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
809 if(((thisbox->items[z].pad*2) + thisbox->items[z].width) > upxmax)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
810 upxmax = (thisbox->items[z].pad*2) + thisbox->items[z].width;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
811 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
812 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
813 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
814 if(thisbox->items[z].pad*2 > upxmax)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
815 upxmax = thisbox->items[z].pad*2;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
816 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
817 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
818 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
819 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
820 if(thisbox->items[z].width == -1)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
821 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
822 /* figure out how much space this item requires */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
823 /* thisbox->items[z].width = */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
824 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
825 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
826 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
827 (*usedx) += thisbox->items[z].width + (thisbox->items[z].pad*2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
828 if(thisbox->items[z].hsize != SIZEEXPAND)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
829 (*usedpadx) += (thisbox->items[z].pad*2) + thisbox->items[z].width;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
830 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
831 (*usedpadx) += thisbox->items[z].pad*2;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
832 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
833 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
834 if(thisbox->type == BOXHORZ)
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 + (thisbox->items[z].pad*2)) > uymax)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
837 uymax = (thisbox->items[z].height + (thisbox->items[z].pad*2));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
838 if(thisbox->items[z].vsize != SIZEEXPAND)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
839 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
840 if(((thisbox->items[z].pad*2) + thisbox->items[z].height) > upymax)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
841 upymax = (thisbox->items[z].pad*2) + thisbox->items[z].height;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
842 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
843 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
844 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
845 if(thisbox->items[z].pad*2 > upymax)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
846 upymax = thisbox->items[z].pad*2;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
847 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
848 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
849 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
850 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
851 if(thisbox->items[z].height == -1)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
852 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
853 /* figure out how much space this item requires */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
854 /* thisbox->items[z].height = */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
855 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
856 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
857 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
858 (*usedy) += thisbox->items[z].height + (thisbox->items[z].pad*2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
859 if(thisbox->items[z].vsize != SIZEEXPAND)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
860 (*usedpady) += (thisbox->items[z].pad*2) + thisbox->items[z].height;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
861 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
862 (*usedpady) += thisbox->items[z].pad*2;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
863 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
864 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
865 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
866
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
867 (*usedx) += uxmax;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
868 (*usedy) += uymax;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
869 (*usedpadx) += upxmax;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
870 (*usedpady) += upymax;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
871
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
872 currentx += thisbox->pad;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
873 currenty += thisbox->pad;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
874
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
875 #ifdef DWDEBUG
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
876 fprintf(f, "Done Calc depth %d\r\nusedx = %d, usedy = %d, usedpadx = %d, usedpady = %d, currentx = %d, currenty = %d, uxmax = %d, uymax = %d\r\n\r\n",
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
877 *depth, *usedx, *usedy, *usedpadx, *usedpady, currentx, currenty, uxmax, uymax);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
878 reopen();
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
879 #endif
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
880
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
881 /* The second pass is for expansion and actual placement. */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
882 if(pass > 1)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
883 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
884 /* Any SIZEEXPAND items should be set to uxmax/uymax */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
885 for(z=0;z<thisbox->count;z++)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
886 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
887 if(thisbox->items[z].hsize == SIZEEXPAND && thisbox->type == BOXVERT)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
888 thisbox->items[z].width = uxmax-(thisbox->items[z].pad*2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
889 if(thisbox->items[z].vsize == SIZEEXPAND && thisbox->type == BOXHORZ)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
890 thisbox->items[z].height = uymax-(thisbox->items[z].pad*2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
891 /* Run this code segment again to finalize the sized after setting uxmax/uymax values. */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
892 if(thisbox->items[z].type == TYPEBOX)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
893 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
894 Box *tmp = WinQueryWindowPtr(thisbox->items[z].hwnd, QWP_USER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
895
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
896 if(tmp)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
897 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
898 if(*depth > 0)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
899 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
900 if(thisbox->type == BOXVERT)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
901 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
902 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
903 tmp->width = thisbox->items[z].width;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
904 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
905 if(thisbox->type == BOXHORZ)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
906 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
907 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
908 tmp->height = thisbox->items[z].height;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
909 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
910 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
911
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
912 (*depth)++;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
913
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
914 #ifdef DWDEBUG
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
915 fprintf(f, "2- Resize Box depth %d\r\nx = %d, y = %d, usedx = %d, usedy = %d, usedpadx = %d, usedpady = %d xratio = %f, yratio = %f,\r\nupx = %d, upy = %d, width = %d, height = %d, minwidth = %d, minheight = %d, box xratio = %f, box yratio = %f\r\n\r\n",
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
916 *depth, x, y, *usedx, *usedy, *usedpadx, *usedpady, tmp->xratio, tmp->yratio, tmp->upx, tmp->upy, thisbox->items[z].width, thisbox->items[z].height, tmp->minwidth, tmp->minheight, thisbox->xratio, thisbox->yratio);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
917 reopen();
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
918 #endif
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
919
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
920 _resize_box(tmp, depth, x, y, &nux, &nuy, 3, &nupx, &nupy);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
921
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
922 (*depth)--;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
923
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
924 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
925 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
926 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
927
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
928 for(z=0;z<(thisbox->count);z++)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
929 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
930 int height = thisbox->items[z].height;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
931 int width = thisbox->items[z].width;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
932 int pad = thisbox->items[z].pad;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
933 HWND handle = thisbox->items[z].hwnd;
47
997e9ed670ef Fixes for box alignment problem on OS/2, crash in dw_bitmap_new() on unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 40
diff changeset
934 int vectorx, vectory;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
935
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
936 /* When upxmax != pad*2 then ratios are incorrect. */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
937 vectorx = (int)((width*thisbox->items[z].xratio)-width);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
938 vectory = (int)((height*thisbox->items[z].yratio)-height);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
939
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
940 if(width > 0 && height > 0)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
941 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
942 char tmpbuf[100];
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
943 /* This is a hack to fix rounding of the sizing */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
944 if(*depth == 0)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
945 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
946 vectorx++;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
947 vectory++;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
948 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
949
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
950 /* If this item isn't going to expand... reset the vectors to 0 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
951 if(thisbox->items[z].vsize != SIZEEXPAND)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
952 vectory = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
953 if(thisbox->items[z].hsize != SIZEEXPAND)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
954 vectorx = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
955
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
956 WinQueryClassName(handle, 99, tmpbuf);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
957
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
958 if(strncmp(tmpbuf, "#2", 3)==0)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
959 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
960 /* Make the combobox big enough to drop down. :) */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
961 WinSetWindowPos(handle, HWND_TOP, currentx + pad, (currenty + pad) - 100,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
962 width + vectorx, (height + vectory) + 100, SWP_MOVE | SWP_SIZE | SWP_ZORDER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
963 }
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
964 else if(strncmp(tmpbuf, "#6", 3)==0)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
965 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
966 /* Entryfields on OS/2 have a thick border that isn't on Windows and GTK */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
967 WinSetWindowPos(handle, HWND_TOP, (currentx + pad) + 3, (currenty + pad) + 3,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
968 (width + vectorx) - 6, (height + vectory) - 6, SWP_MOVE | SWP_SIZE | SWP_ZORDER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
969 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
970 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
971 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
972 WinSetWindowPos(handle, HWND_TOP, currentx + pad, currenty + pad,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
973 width + vectorx, height + vectory, SWP_MOVE | SWP_SIZE | SWP_ZORDER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
974 if(thisbox->items[z].type == TYPEBOX)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
975 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
976 Box *boxinfo = WinQueryWindowPtr(handle, QWP_USER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
977
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
978 if(boxinfo && boxinfo->grouphwnd)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
979 WinSetWindowPos(boxinfo->grouphwnd, HWND_TOP, 0, 0,
47
997e9ed670ef Fixes for box alignment problem on OS/2, crash in dw_bitmap_new() on unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 40
diff changeset
980 width + vectorx, height + vectory, SWP_MOVE | SWP_SIZE);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
981
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
982 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
983
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
984 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
985
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
986 #ifdef DWDEBUG
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
987 fprintf(f, "Window Pos depth %d\r\ncurrentx = %d, currenty = %d, pad = %d, width = %d, height = %d, vectorx = %d, vectory = %d, Box type = %s\r\n\r\n",
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
988 *depth, currentx, currenty, pad, width, height, vectorx, vectory,thisbox->type == BOXHORZ ? "Horizontal" : "Vertical");
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
989 reopen();
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
990 #endif
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
991
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
992 if(thisbox->type == BOXHORZ)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
993 currentx += width + vectorx + (pad * 2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
994 if(thisbox->type == BOXVERT)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
995 currenty += height + vectory + (pad * 2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
996 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
997 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
998 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
999 return 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1000 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1001
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1002 void _do_resize(Box *thisbox, int x, int y)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1003 {
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
1004 if(x != 0 && y != 0)
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
1005 {
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1006 if(thisbox)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1007 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1008 int usedx = 0, usedy = 0, usedpadx = 0, usedpady = 0, depth = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1009
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1010 _resize_box(thisbox, &depth, x, y, &usedx, &usedy, 1, &usedpadx, &usedpady);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1011
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1012 if(usedx-usedpadx == 0 || usedy-usedpady == 0)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1013 return;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1014
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1015 thisbox->xratio = ((float)(x-usedpadx))/((float)(usedx-usedpadx));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1016 thisbox->yratio = ((float)(y-usedpady))/((float)(usedy-usedpady));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1017
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1018 #ifdef DWDEBUG
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1019 fprintf(f, "WM_SIZE Resize Box Pass 1\r\nx = %d, y = %d, usedx = %d, usedy = %d, usedpadx = %d, usedpady = %d xratio = %f, yratio = %f\r\n\r\n",
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1020 x, y, usedx, usedy, usedpadx, usedpady, thisbox->xratio, thisbox->yratio);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1021 reopen();
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1022 #endif
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1023
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1024 usedx = usedy = usedpadx = usedpady = depth = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1025
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1026 _resize_box(thisbox, &depth, x, y, &usedx, &usedy, 2, &usedpadx, &usedpady);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1027 #ifdef DWDEBUG
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1028 fprintf(f, "WM_SIZE Resize Box Pass 2\r\nx = %d, y = %d, usedx = %d, usedy = %d, usedpadx = %d, usedpady = %d\r\n",
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1029 x, y, usedx, usedy, usedpadx, usedpady);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1030 reopen();
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1031 #endif
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1032 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1033 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1034 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1035
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1036 /* This procedure handles WM_QUERYTRACKINFO requests from the frame */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1037 MRESULT EXPENTRY _sizeproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1038 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1039 PFNWP *blah = WinQueryWindowPtr(hWnd, QWP_USER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1040
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1041 switch(msg)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1042 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1043 case WM_QUERYTRACKINFO:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1044 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1045 if(blah && *blah)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1046 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1047 PTRACKINFO ptInfo;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1048 int res;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1049 PFNWP myfunc = *blah;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1050 res = (int)myfunc(hWnd, msg, mp1, mp2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1051
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1052 ptInfo = (PTRACKINFO)(mp2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1053
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1054 ptInfo->ptlMinTrackSize.y = 8;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1055 ptInfo->ptlMinTrackSize.x = 8;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1056
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1057 return (MRESULT)res;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1058 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1059 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1060 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1061 if(blah && *blah)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1062 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1063 PFNWP myfunc = *blah;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1064 return myfunc(hWnd, msg, mp1, mp2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1065 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1066
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1067 return WinDefWindowProc(hWnd, msg, mp1, mp2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1068 }
33
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1069
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1070 void _Top(HPS hpsPaint, RECTL rclPaint)
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1071 {
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1072 POINTL ptl1, ptl2;
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1073
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1074 ptl1.x = rclPaint.xLeft;
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1075 ptl2.y = ptl1.y = rclPaint.yTop - 1;
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1076 ptl2.x = rclPaint.xRight - 1;
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1077 GpiMove(hpsPaint, &ptl1);
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1078 GpiLine(hpsPaint, &ptl2);
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1079 }
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1080
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1081 /* Left hits the bottom */
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1082 void _Left(HPS hpsPaint, RECTL rclPaint)
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1083 {
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1084 POINTL ptl1, ptl2;
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1085
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1086 ptl2.x = ptl1.x = rclPaint.xLeft;
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1087 ptl1.y = rclPaint.yTop - 1;
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1088 ptl2.y = rclPaint.yBottom;
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1089 GpiMove(hpsPaint, &ptl1);
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1090 GpiLine(hpsPaint, &ptl2);
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1091 }
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1092
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1093 void _Bottom(HPS hpsPaint, RECTL rclPaint)
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1094 {
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1095 POINTL ptl1, ptl2;
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1096
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1097 ptl1.x = rclPaint.xRight - 1;
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1098 ptl1.y = ptl2.y = rclPaint.yBottom;
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1099 ptl2.x = rclPaint.xLeft;
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1100 GpiMove(hpsPaint, &ptl1);
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1101 GpiLine(hpsPaint, &ptl2);
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1102 }
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1103
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1104 /* Right hits the top */
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1105 void _Right(HPS hpsPaint, RECTL rclPaint)
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1106 {
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1107 POINTL ptl1, ptl2;
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1108
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1109 ptl2.x = ptl1.x = rclPaint.xRight - 1;
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1110 ptl1.y = rclPaint.yBottom + 1;
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1111 ptl2.y = rclPaint.yTop - 1;
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1112 GpiMove(hpsPaint, &ptl1);
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1113 GpiLine(hpsPaint, &ptl2);
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1114 }
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1115
7
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1116 /* This procedure handles drawing of a status border */
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1117 MRESULT EXPENTRY _statusproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2)
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1118 {
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1119 PFNWP *blah = WinQueryWindowPtr(hWnd, QWP_USER);
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1120
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1121 if(blah && *blah)
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1122 {
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1123 PFNWP myfunc = *blah;
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1124
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1125 switch(msg)
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1126 {
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1127 case WM_PAINT:
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1128 {
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1129 HPS hpsPaint;
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1130 RECTL rclPaint;
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1131 char buf[1024];
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1132
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1133 hpsPaint = WinBeginPaint(hWnd, 0, 0);
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1134 WinQueryWindowRect(hWnd, &rclPaint);
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1135 WinFillRect(hpsPaint, &rclPaint, CLR_PALEGRAY);
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1136
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1137 GpiSetColor(hpsPaint, CLR_DARKGRAY);
33
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1138 _Top(hpsPaint, rclPaint);
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1139 _Left(hpsPaint, rclPaint);
7
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1140
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1141 GpiSetColor(hpsPaint, CLR_WHITE);
33
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1142 _Right(hpsPaint, rclPaint);
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1143 _Bottom(hpsPaint, rclPaint);
7
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1144
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1145 WinQueryWindowText(hWnd, 1024, buf);
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1146 rclPaint.xLeft += 3;
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1147 rclPaint.xRight--;
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1148 rclPaint.yTop--;
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1149 rclPaint.yBottom++;
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1150
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1151 GpiSetColor(hpsPaint, CLR_BLACK);
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1152 WinDrawText(hpsPaint, -1, buf, &rclPaint, DT_TEXTATTRS, DT_TEXTATTRS, DT_VCENTER | DT_LEFT | DT_TEXTATTRS);
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1153 WinEndPaint(hpsPaint);
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1154
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1155 return (MRESULT)TRUE;
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1156 }
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1157 }
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1158 return myfunc(hWnd, msg, mp1, mp2);
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1159 }
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1160
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1161 return WinDefWindowProc(hWnd, msg, mp1, mp2);
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1162 }
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1163
33
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1164 /* This procedure handles drawing of a percent bar */
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1165 MRESULT EXPENTRY _percentproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2)
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1166 {
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1167 PercentBar *blah = (PercentBar *)WinQueryWindowPtr(hWnd, QWP_USER);
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1168
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1169 if(blah)
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1170 {
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1171 PFNWP myfunc = blah->oldproc;
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1172
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1173 switch(msg)
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1174 {
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1175 case WM_PAINT:
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1176 {
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1177 HPS hpsPaint;
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1178 RECTL rclPaint, rclBar;
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1179
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1180 hpsPaint = WinBeginPaint(hWnd, 0, 0);
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1181 WinQueryWindowRect(hWnd, &rclPaint);
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1182
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1183 /* Draw outer border */
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1184 rclBar = rclPaint;
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1185 GpiSetColor(hpsPaint, CLR_PALEGRAY);
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1186 _Top(hpsPaint, rclBar);
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1187 _Bottom(hpsPaint, rclBar);
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1188 rclBar.yTop--;
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1189 GpiSetColor(hpsPaint, CLR_WHITE);
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1190 _Right(hpsPaint, rclBar);
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1191 rclBar.yBottom++;
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1192 GpiSetColor(hpsPaint, CLR_DARKGRAY);
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1193 _Left(hpsPaint, rclBar);
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1194
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1195 /* Draw inner border */
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1196 rclBar.xLeft++;
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1197 rclBar.xRight--;
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1198 GpiSetColor(hpsPaint, CLR_DARKGRAY);
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1199 _Left(hpsPaint, rclBar);
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1200 _Top(hpsPaint, rclBar);
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1201 GpiSetColor(hpsPaint, CLR_WHITE);
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1202 _Bottom(hpsPaint, rclBar);
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1203 _Right(hpsPaint, rclBar);
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1204
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1205 /* Draw bar border */
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1206 rclBar.xLeft++;
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1207 rclBar.xRight--;
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1208 rclBar.yBottom++;
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1209 rclBar.yTop--;
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1210 GpiSetColor(hpsPaint, CLR_DARKGRAY);
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1211 _Left(hpsPaint, rclBar);
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1212 _Top(hpsPaint, rclBar);
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1213 _Bottom(hpsPaint, rclBar);
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1214 _Right(hpsPaint, rclBar);
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1215
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1216 if(blah->pos)
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1217 {
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1218 rclBar.xRight = 3 + blah->pos;
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1219 _Right(hpsPaint, rclBar);
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1220
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1221 /* Draw Bar itself */
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1222 rclBar.xLeft = rclPaint.xLeft + 3;
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1223 rclBar.xRight = rclPaint.xLeft + 2 + blah->pos;
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1224 rclBar.yTop = rclPaint.yTop - 3;
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1225 rclBar.yBottom = rclPaint.yBottom + 3;
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1226
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1227 WinFillRect(hpsPaint, &rclBar, CLR_DARKBLUE);
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1228 }
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1229
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1230 /* Draw the background */
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1231 rclBar.xLeft = rclPaint.xLeft + 3 + blah->pos;
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1232 rclBar.xRight = rclPaint.xRight - 3;
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1233 rclBar.yTop = rclPaint.yTop - 3;
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1234 rclBar.yBottom = rclPaint.yBottom + 3;
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1235
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1236 WinFillRect(hpsPaint, &rclBar, CLR_PALEGRAY);
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1237
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1238 WinEndPaint(hpsPaint);
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1239
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1240 return (MRESULT)TRUE;
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1241 }
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1242 }
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1243 return myfunc(hWnd, msg, mp1, mp2);
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1244 }
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1245
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1246 return WinDefWindowProc(hWnd, msg, mp1, mp2);
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1247 }
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1248
40
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1249 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
1250 {
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1251 char tmpbuf[100];
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1252
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1253 WinQueryClassName(handle, 99, tmpbuf);
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1254
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1255 /* 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
1256 * obtain input focus.
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1257 */
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1258 if(strncmp(tmpbuf, "#3", 3)==0)
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1259 {
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1260 /* 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
1261 SignalHandler *tmp = Root;
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1262
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1263 /* 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
1264 while(tmp)
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1265 {
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1266 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
1267 {
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1268 int (*clickfunc)(HWND, void *) = (int (*)(HWND, void *))tmp->signalfunction;
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1269
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1270 /* 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
1271 if(tmp->window == handle)
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1272 {
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1273 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
1274 tmp = NULL;
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1275 }
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1276 }
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1277 if(tmp)
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1278 tmp= tmp->next;
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1279 }
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1280 }
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1281 else
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1282 WinSetFocus(HWND_DESKTOP, handle);
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1283 }
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1284
55
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
1285 MRESULT EXPENTRY _comboentryproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2)
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
1286 {
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
1287 WindowData *blah = (WindowData *)WinQueryWindowPtr(hWnd, QWP_USER);
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
1288
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
1289 switch(msg)
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
1290 {
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
1291 case WM_SETFOCUS:
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
1292 _run_event(hWnd, msg, mp1, mp2);
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
1293 break;
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
1294 }
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
1295
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
1296 if(blah && blah->oldproc)
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
1297 return blah->oldproc(hWnd, msg, mp1, mp2);
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
1298
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
1299 return WinDefWindowProc(hWnd, msg, mp1, mp2);
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
1300 }
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
1301
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1302 /* Originally just intended for entryfields, it now serves as a generic
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1303 * procedure for handling TAB presses to change input focus on controls.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1304 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1305 MRESULT EXPENTRY _entryproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1306 {
40
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1307 WindowData *blah = (WindowData *)WinQueryWindowPtr(hWnd, QWP_USER);
55
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
1308 PFNWP oldproc = 0;
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
1309
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
1310 if(blah)
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
1311 oldproc = blah->oldproc;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1312
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1313 switch(msg)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1314 {
37
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
1315 case WM_BUTTON1DOWN:
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
1316 case WM_BUTTON2DOWN:
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
1317 case WM_BUTTON3DOWN:
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
1318 {
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
1319 char tmpbuf[100];
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
1320
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
1321 WinQueryClassName(hWnd, 99, tmpbuf);
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
1322
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
1323 if(strncmp(tmpbuf, "#32", 3)==0)
38
538db2a48bac Added typecast to MPARAM.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 37
diff changeset
1324 _run_event(hWnd, WM_SETFOCUS, (MPARAM)FALSE, (MPARAM)TRUE);
37
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
1325 }
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
1326 break;
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
1327 case WM_SETFOCUS:
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
1328 _run_event(hWnd, msg, mp1, mp2);
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
1329 break;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1330 case WM_CHAR:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1331 if(SHORT1FROMMP(mp2) == '\t')
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1332 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1333 _shift_focus(hWnd);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1334 return FALSE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1335 }
40
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1336 else if(SHORT1FROMMP(mp2) == '\r' && blah && blah->clickdefault)
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1337 _click_default(blah->clickdefault);
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1338
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1339 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1340 }
55
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
1341
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
1342 if(oldproc)
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
1343 return oldproc(hWnd, msg, mp1, mp2);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1344
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1345 return WinDefWindowProc(hWnd, msg, mp1, mp2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1346 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1347
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1348 /* Handle correct painting of a combobox with the WS_CLIPCHILDREN
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1349 * flag enabled, and also handle TABs to switch input focus.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1350 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1351 MRESULT EXPENTRY _comboproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1352 {
40
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1353 WindowData *blah = WinQueryWindowPtr(hWnd, QWP_USER);
55
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
1354 PFNWP oldproc = 0;
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
1355
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
1356 if(blah)
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
1357 oldproc = blah->oldproc;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1358
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1359 switch(msg)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1360 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1361 case WM_CHAR:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1362 if(SHORT1FROMMP(mp2) == '\t')
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1363 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1364 _shift_focus(hWnd);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1365 return FALSE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1366 }
40
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1367 else if(SHORT1FROMMP(mp2) == '\r' && blah && blah->clickdefault)
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1368 _click_default(blah->clickdefault);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1369 break;
39
3aa9ef0b3996 Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 38
diff changeset
1370 case WM_BUTTON1DOWN:
3aa9ef0b3996 Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 38
diff changeset
1371 case WM_BUTTON2DOWN:
3aa9ef0b3996 Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 38
diff changeset
1372 case WM_BUTTON3DOWN:
3aa9ef0b3996 Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 38
diff changeset
1373 _run_event(hWnd, WM_SETFOCUS, (MPARAM)FALSE, (MPARAM)TRUE);
3aa9ef0b3996 Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 38
diff changeset
1374 break;
3aa9ef0b3996 Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 38
diff changeset
1375 case WM_SETFOCUS:
3aa9ef0b3996 Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 38
diff changeset
1376 _run_event(hWnd, msg, mp1, mp2);
3aa9ef0b3996 Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 38
diff changeset
1377 break;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1378 case WM_PAINT:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1379 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1380 HWND parent = WinQueryWindow(hWnd, QW_PARENT);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1381 ULONG bcol, av[32];
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1382 HPS hpsPaint;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1383 POINTL ptl; /* Add 6 because it has a thick border like the entryfield */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1384 unsigned long width, height, thumbheight = WinQuerySysValue(HWND_DESKTOP, SV_CYVSCROLLARROW) + 6;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1385
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1386 WinQueryPresParam(parent, PP_BACKGROUNDCOLORINDEX, 0, &bcol, sizeof(ULONG), &av, QPF_ID1COLORINDEX | QPF_NOINHERIT);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1387 dw_window_get_pos_size(hWnd, 0, 0, &width, &height);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1388
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1389 hpsPaint = WinGetPS(hWnd);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1390 GpiSetColor(hpsPaint, CLR_PALEGRAY);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1391
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1392 ptl.x = 0;
24
d9e87e8bcf1d Updated dynamic windows to build with EMX.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 23
diff changeset
1393 ptl.y = 0;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1394 GpiMove(hpsPaint, &ptl);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1395
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1396 ptl.x = width;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1397 ptl.y = height - thumbheight;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1398 GpiBox(hpsPaint, DRO_FILL, &ptl, 0, 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1399
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1400 WinReleasePS(hpsPaint);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1401 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1402 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1403 }
55
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
1404 if(oldproc)
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
1405 return oldproc(hWnd, msg, mp1, mp2);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1406
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1407 return WinDefWindowProc(hWnd, msg, mp1, mp2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1408 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1409
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1410 void _GetPPFont(HWND hwnd, char *buff)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1411 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1412 ULONG AttrFound;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1413 BYTE AttrValue[128];
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1414 ULONG cbRetLen;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1415
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1416 cbRetLen = WinQueryPresParam(hwnd,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1417 PP_FONTNAMESIZE,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1418 0,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1419 &AttrFound,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1420 sizeof(AttrValue),
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1421 &AttrValue,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1422 QPF_NOINHERIT);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1423
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1424 if(PP_FONTNAMESIZE == AttrFound && cbRetLen)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1425 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1426 memcpy(buff, AttrValue, cbRetLen);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1427 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1428 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1429
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1430 /* Returns height of specified window. */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1431 int _get_height(HWND handle)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1432 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1433 unsigned long height;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1434 dw_window_get_pos_size(handle, NULL, NULL, NULL, &height);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1435 return (int)height;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1436 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1437
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1438 /* Find the height of the frame a desktop style window is sitting on */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1439 int _get_frame_height(HWND handle)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1440 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1441 while(handle)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1442 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1443 HWND client;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1444 if((client = WinWindowFromID(handle, FID_CLIENT)) != NULLHANDLE)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1445 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1446 return _get_height(WinQueryWindow(handle, QW_PARENT));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1447 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1448 handle = WinQueryWindow(handle, QW_PARENT);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1449 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1450 return dw_screen_height();
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1451 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1452
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1453 #ifndef NO_SIGNALS
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1454 MRESULT EXPENTRY _run_event(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1455 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1456 int result = -1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1457 SignalHandler *tmp = Root;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1458 ULONG origmsg = msg;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1459
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1460 if(msg == WM_BUTTON2DOWN || msg == WM_BUTTON3DOWN)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1461 msg = WM_BUTTON1DOWN;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1462 if(msg == WM_BUTTON2UP || msg == WM_BUTTON3UP)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1463 msg = WM_BUTTON1UP;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1464
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1465 /* Find any callbacks for this function */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1466 while(tmp)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1467 {
55
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
1468 if(tmp->message == msg || msg == WM_CONTROL || tmp->message == WM_USER+1)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1469 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1470 switch(msg)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1471 {
14
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
1472 case WM_SETFOCUS:
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
1473 {
55
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
1474 if((mp2 && tmp->message == WM_SETFOCUS) || (!mp2 && tmp->message == WM_USER+1))
14
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
1475 {
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
1476 int (*setfocusfunc)(HWND, void *) = (int (*)(HWND, void *))tmp->signalfunction;
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
1477
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
1478 if(hWnd == tmp->window || WinWindowFromID(tmp->window, FID_CLIENT) == hWnd)
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
1479 {
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
1480 result = setfocusfunc(tmp->window, tmp->data);
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
1481 tmp = NULL;
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
1482 }
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
1483 }
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
1484 }
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
1485 break;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1486 case WM_SIZE:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1487 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1488 int (*sizefunc)(HWND, int, int, void *) = (int (*)(HWND, int, int, void *))tmp->signalfunction;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1489
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1490 if(hWnd == tmp->window || WinWindowFromID(tmp->window, FID_CLIENT) == hWnd)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1491 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1492 result = sizefunc(tmp->window, SHORT1FROMMP(mp2), SHORT2FROMMP(mp2), tmp->data);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1493 tmp = NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1494 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1495 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1496 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1497 case WM_BUTTON1DOWN:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1498 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1499 POINTS pts = (*((POINTS*)&mp1));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1500 int (*buttonfunc)(HWND, int, int, int, void *) = (int (*)(HWND, int, int, int, void *))tmp->signalfunction;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1501
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1502 if(hWnd == tmp->window || WinWindowFromID(tmp->window, FID_CLIENT) == hWnd || WinQueryCapture(HWND_DESKTOP) == tmp->window)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1503 {
24
d9e87e8bcf1d Updated dynamic windows to build with EMX.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 23
diff changeset
1504 int button = 0;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1505
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1506 switch(origmsg)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1507 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1508 case WM_BUTTON1DOWN:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1509 button = 1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1510 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1511 case WM_BUTTON2DOWN:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1512 button = 2;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1513 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1514 case WM_BUTTON3DOWN:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1515 button = 3;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1516 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1517 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1518
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1519 result = buttonfunc(tmp->window, pts.x, _get_frame_height(tmp->window) - pts.y, button, tmp->data);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1520 tmp = NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1521 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1522 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1523 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1524 case WM_BUTTON1UP:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1525 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1526 POINTS pts = (*((POINTS*)&mp1));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1527 int (*buttonfunc)(HWND, int, int, int, void *) = (int (*)(HWND, int, int, int, void *))tmp->signalfunction;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1528
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1529 if(hWnd == tmp->window || WinWindowFromID(tmp->window, FID_CLIENT) == hWnd || WinQueryCapture(HWND_DESKTOP) == tmp->window)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1530 {
24
d9e87e8bcf1d Updated dynamic windows to build with EMX.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 23
diff changeset
1531 int button = 0;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1532
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1533 switch(origmsg)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1534 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1535 case WM_BUTTON1UP:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1536 button = 1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1537 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1538 case WM_BUTTON2UP:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1539 button = 2;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1540 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1541 case WM_BUTTON3UP:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1542 button = 3;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1543 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1544 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1545
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1546 result = buttonfunc(tmp->window, pts.x, WinQueryWindow(tmp->window, QW_PARENT) == HWND_DESKTOP ? dw_screen_height() - pts.y : _get_height(tmp->window) - pts.y, button, tmp->data);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1547 tmp = NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1548 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1549 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1550 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1551 case WM_MOUSEMOVE:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1552 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1553 int (*motionfunc)(HWND, int, int, int, void *) = (int (*)(HWND, int, int, int, void *))tmp->signalfunction;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1554
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1555 if(hWnd == tmp->window || WinWindowFromID(tmp->window, FID_CLIENT) == hWnd || WinQueryCapture(HWND_DESKTOP) == tmp->window)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1556 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1557 int keys = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1558 SHORT x = SHORT1FROMMP(mp1), y = SHORT2FROMMP(mp1);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1559
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1560 if (WinGetKeyState(HWND_DESKTOP, VK_BUTTON1) & 0x8000)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1561 keys = DW_BUTTON1_MASK;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1562 if (WinGetKeyState(HWND_DESKTOP, VK_BUTTON2) & 0x8000)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1563 keys |= DW_BUTTON2_MASK;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1564 if (WinGetKeyState(HWND_DESKTOP, VK_BUTTON3) & 0x8000)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1565 keys |= DW_BUTTON3_MASK;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1566
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1567 result = motionfunc(tmp->window, x, _get_frame_height(tmp->window) - y, keys, tmp->data);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1568 tmp = NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1569 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1570 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1571 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1572 case WM_CHAR:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1573 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1574 int (*keypressfunc)(HWND, int, void *) = (int (*)(HWND, int, void *))tmp->signalfunction;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1575
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1576 if(hWnd == tmp->window)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1577 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1578 result = keypressfunc(tmp->window, SHORT1FROMMP(mp2), tmp->data);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1579 tmp = NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1580 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1581 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1582 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1583 case WM_CLOSE:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1584 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1585 int (*closefunc)(HWND, void *) = (int (*)(HWND, void *))tmp->signalfunction;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1586
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1587 if(hWnd == tmp->window || hWnd == WinWindowFromID(tmp->window, FID_CLIENT))
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1588 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1589 result = closefunc(tmp->window, tmp->data);
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
1590 if(result)
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
1591 result = FALSE;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1592 tmp = NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1593 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1594 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1595 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1596 case WM_PAINT:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1597 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1598 HPS hps;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1599 DWExpose exp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1600 int (*exposefunc)(HWND, DWExpose *, void *) = (int (*)(HWND, DWExpose *, void *))tmp->signalfunction;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1601 RECTL rc;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1602
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1603 if(hWnd == tmp->window)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1604 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1605 int height = _get_height(hWnd);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1606
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1607 hps = WinBeginPaint(hWnd, 0L, &rc);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1608 exp.x = rc.xLeft;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1609 exp.y = height - rc.yTop - 1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1610 exp.width = rc.xRight - rc. xLeft;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1611 exp.height = rc.yTop - rc.yBottom;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1612 result = exposefunc(hWnd, &exp, tmp->data);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1613 WinEndPaint(hps);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1614 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1615 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1616 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1617 case WM_COMMAND:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1618 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1619 int (*clickfunc)(HWND, void *) = (int (*)(HWND, void *))tmp->signalfunction;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1620 ULONG command = COMMANDMSG(&msg)->cmd;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1621
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1622 if(tmp->window < 65536 && command == tmp->window)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1623 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1624 result = clickfunc(tmp->window, tmp->data);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1625 tmp = NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1626 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1627 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1628 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1629 case WM_CONTROL:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1630 if(tmp->message == SHORT2FROMMP(mp1))
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1631 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1632 switch(SHORT2FROMMP(mp1))
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1633 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1634 case CN_ENTER:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1635 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1636 int (*containerselectfunc)(HWND, char *, void *) = (int (*)(HWND, char *, void *))tmp->signalfunction;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1637 int id = SHORT1FROMMP(mp1);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1638 HWND conthwnd = dw_window_from_id(hWnd, id);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1639 char *text = NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1640
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1641 if(mp2)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1642 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1643 PRECORDCORE pre;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1644
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1645 pre = ((PNOTIFYRECORDENTER)mp2)->pRecord;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1646 if(pre)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1647 text = pre->pszIcon;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1648 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1649
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1650 if(tmp->window == conthwnd)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1651 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1652 result = containerselectfunc(tmp->window, text, tmp->data);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1653 tmp = NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1654 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1655 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1656 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1657 case CN_CONTEXTMENU:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1658 {
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
1659 int (*containercontextfunc)(HWND, char *, int, int, void *, void *) = (int (*)(HWND, char *, int, int, void *, void *))tmp->signalfunction;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1660 int id = SHORT1FROMMP(mp1);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1661 HWND conthwnd = dw_window_from_id(hWnd, id);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1662 char *text = NULL;
54
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
1663 void *user = NULL;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1664 LONG x,y;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1665
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1666 if(mp2)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1667 {
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
1668 PCNRITEM pci;
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
1669
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
1670 pci = (PCNRITEM)mp2;
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
1671
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
1672 text = pci->rc.pszIcon;
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
1673 user = pci->user;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1674 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1675
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1676 dw_pointer_query_pos(&x, &y);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1677
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1678 if(tmp->window == conthwnd)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1679 {
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
1680 if(mp2)
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
1681 {
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
1682 NOTIFYRECORDEMPHASIS pre;
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
1683
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
1684 dw_tree_item_select(tmp->window, (HWND)mp2);
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
1685 pre.pRecord = mp2;
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
1686 pre.fEmphasisMask = CRA_CURSORED;
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
1687 pre.hwndCnr = tmp->window;
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
1688 _run_event(hWnd, WM_CONTROL, MPFROM2SHORT(0, CN_EMPHASIS), (MPARAM)&pre);
55
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
1689 pre.pRecord->flRecordAttr |= CRA_CURSORED;
54
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
1690 }
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
1691 result = containercontextfunc(tmp->window, text, x, y, tmp->data, user);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1692 tmp = NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1693 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1694 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1695 break;
54
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
1696 case CN_EMPHASIS:
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
1697 {
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
1698 PNOTIFYRECORDEMPHASIS pre = (PNOTIFYRECORDEMPHASIS)mp2;
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
1699 static int emph_recurse = 0;
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
1700
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
1701 if(!emph_recurse)
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
1702 {
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
1703 emph_recurse = 1;
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
1704
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
1705 if(mp2)
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
1706 {
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
1707 if(tmp->window == pre->hwndCnr)
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
1708 {
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
1709 PCNRITEM pci = (PCNRITEM)pre->pRecord;
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
1710
55
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
1711 if(pci && pre->fEmphasisMask & CRA_CURSORED && (pci->rc.flRecordAttr & CRA_CURSORED))
54
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
1712 {
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
1713 int (*treeselectfunc)(HWND, HWND, char *, void *, void *) = (int (*)(HWND, HWND, char *, void *, void *))tmp->signalfunction;
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
1714
55
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
1715 if(lasthcnr == tmp->window && lastitem == (HWND)pci)
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
1716 {
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
1717 lasthcnr = 0;
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
1718 lastitem = 0;
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
1719 }
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
1720 else
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
1721 {
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
1722 lasthcnr = tmp->window;
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
1723 lastitem = (HWND)pci;
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
1724 result = treeselectfunc(tmp->window, (HWND)pci, pci->rc.pszIcon, pci->user, tmp->data);
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
1725 }
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
1726 tmp = NULL;
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
1727 }
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
1728 }
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
1729 }
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
1730 emph_recurse = 0;
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
1731 }
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
1732 }
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
1733 break;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1734 case LN_SELECT:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1735 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1736 int (*listboxselectfunc)(HWND, int, void *) = (int (*)(HWND, int, void *))tmp->signalfunction;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1737 int id = SHORT1FROMMP(mp1);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1738 HWND conthwnd = dw_window_from_id(hWnd, id);
39
3aa9ef0b3996 Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 38
diff changeset
1739 static int _recursing = 0;
3aa9ef0b3996 Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 38
diff changeset
1740
3aa9ef0b3996 Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 38
diff changeset
1741 if(_recursing == 0 && (tmp->window == conthwnd || (!id && tmp->window == (HWND)mp2)))
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1742 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1743 char buf1[500], classbuf[100];
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1744 unsigned int index = dw_listbox_selected(tmp->window);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1745
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1746 dw_listbox_query_text(tmp->window, index, buf1, 500);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1747
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1748 WinQueryClassName(tmp->window, 99, classbuf);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1749
39
3aa9ef0b3996 Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 38
diff changeset
1750 _recursing = 1;
3aa9ef0b3996 Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 38
diff changeset
1751
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
1752 if(id && strncmp(classbuf, "#2", 3)==0)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1753 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1754 char *buf2;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1755
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1756 buf2 = dw_window_get_text(tmp->window);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1757
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1758 /* This is to make sure the listboxselect function doesn't
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1759 * get called if the user is modifying the entry text.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1760 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1761 if(buf2 && *buf2 && *buf1 && strncmp(buf1, buf2, 500) == 0)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1762 result = listboxselectfunc(tmp->window, index, tmp->data);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1763
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1764 if(buf2)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1765 free(buf2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1766 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1767 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1768 result = listboxselectfunc(tmp->window, index, tmp->data);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1769
39
3aa9ef0b3996 Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 38
diff changeset
1770 _recursing = 0;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1771 tmp = NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1772 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1773 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1774 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1775 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1776 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1777 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1778 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1779 }
30
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
1780
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1781 if(tmp)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1782 tmp = tmp->next;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1783
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1784 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1785
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1786 return (MRESULT)result;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1787 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1788 #endif
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1789
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1790 /* Handles control messages sent to the box (owner). */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1791 MRESULT EXPENTRY _controlproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1792 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1793 Box *blah = WinQueryWindowPtr(hWnd, QWP_USER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1794
30
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
1795 #ifndef NO_SIGNALS
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1796 switch(msg)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1797 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1798 case WM_CONTROL:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1799 _run_event(hWnd, msg, mp1, mp2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1800 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1801 }
30
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
1802 #endif
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1803 if(blah && blah->oldproc)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1804 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1805 return blah->oldproc(hWnd, msg, mp1, mp2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1806 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1807
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1808 return WinDefWindowProc(hWnd, msg, mp1, mp2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1809 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1810
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1811 /* The main window procedure for Dynamic Windows, all the resizing code is done here. */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1812 MRESULT EXPENTRY _wndproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1813 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1814 int result = -1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1815 static int command_active = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1816 void (* windowfunc)(PVOID) = 0L;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1817
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1818 if(filterfunc)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1819 result = filterfunc(hWnd, msg, mp1, mp2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1820
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1821 #ifndef NO_SIGNALS
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1822 if(result == -1 && !command_active)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1823 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1824 /* Make sure we don't end up in infinite recursion */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1825 command_active = 1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1826
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1827 result = (int)_run_event(hWnd, msg, mp1, mp2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1828
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1829 command_active = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1830 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1831 #endif
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1832
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1833 /* Now that any handlers are done... do normal processing */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1834 switch( msg )
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1835 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1836 case WM_ERASEBACKGROUND:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1837 return 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1838
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1839 case WM_PAINT:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1840 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1841 HPS hps;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1842 RECTL rc;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1843
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1844 hps = WinBeginPaint( hWnd, 0L, &rc );
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1845 WinEndPaint( hps );
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1846 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1847 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1848
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1849 case WM_SIZE:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1850 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1851 Box *mybox = (Box *)WinQueryWindowPtr(hWnd, QWP_USER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1852
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1853 if(!SHORT1FROMMP(mp2) && !SHORT2FROMMP(mp2))
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1854 return (MPARAM)TRUE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1855
7
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1856 if(mybox && mybox->flags != DW_MINIMIZED)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1857 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1858 /* Hide the window when recalculating to reduce
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1859 * CPU load.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1860 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1861 WinShowWindow(hWnd, FALSE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1862
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1863 _do_resize(mybox, SHORT1FROMMP(mp2), SHORT2FROMMP(mp2));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1864
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1865 WinShowWindow(hWnd, TRUE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1866 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1867 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1868 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1869 case WM_MINMAXFRAME:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1870 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1871 Box *mybox = (Box *)WinQueryWindowPtr(hWnd, QWP_USER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1872 SWP *swp = (SWP *)mp1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1873
7
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1874 if(mybox && (swp->fl & SWP_MINIMIZE))
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1875 mybox->flags = DW_MINIMIZED;
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1876
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1877 if(mybox && (swp->fl & SWP_RESTORE))
39
3aa9ef0b3996 Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 38
diff changeset
1878 {
3aa9ef0b3996 Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 38
diff changeset
1879 if(!mybox->titlebar && mybox->hwndtitle)
3aa9ef0b3996 Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 38
diff changeset
1880 WinSetParent(mybox->hwndtitle, HWND_OBJECT, FALSE);
7
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1881 mybox->flags = 0;
39
3aa9ef0b3996 Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 38
diff changeset
1882 }
7
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1883
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1884 if(mybox && (swp->fl & SWP_MAXIMIZE))
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1885 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1886 int z;
34
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
1887 SWP swp2;
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
1888
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
1889 WinQueryWindowPos(swp->hwnd, &swp2);
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
1890
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
1891 if(swp2.cx == swp->cx && swp2.cy == swp->cy)
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
1892 return FALSE;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1893
7
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1894 mybox->flags = 0;
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1895
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1896 /* Hide the window when recalculating to reduce
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1897 * CPU load.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1898 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1899 WinShowWindow(hWnd, FALSE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1900
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1901 _do_resize(mybox, swp->cx, swp->cy);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1902
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1903 if(mybox->count == 1 && mybox->items[0].type == TYPEBOX)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1904 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1905 mybox = (Box *)WinQueryWindowPtr(mybox->items[0].hwnd, QWP_USER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1906
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1907 for(z=0;z<mybox->count;z++)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1908 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1909 char tmpbuf[100];
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1910
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1911 WinQueryClassName(mybox->items[z].hwnd, 99, tmpbuf);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1912
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1913 /* If we have a notebook we resize the page again. */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1914 if(strncmp(tmpbuf, "#40", 3)==0)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1915 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1916 unsigned long x, y, width, height;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1917 int page = dw_notebook_page_query(mybox->items[z].hwnd);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1918 HWND pagehwnd = (HWND)WinSendMsg(mybox->items[z].hwnd, BKM_QUERYPAGEWINDOWHWND, MPFROMLONG(page), 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1919 RECTL rc;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1920
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1921 Box *pagebox = (Box *)WinQueryWindowPtr(pagehwnd, QWP_USER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1922 if(pagebox)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1923 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1924 dw_window_get_pos_size(mybox->items[z].hwnd, &x, &y, &width, &height);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1925
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1926 rc.xLeft = x;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1927 rc.yBottom = y;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1928 rc.xRight = x + width;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1929 rc.yTop = y + height;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1930
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1931 WinSendMsg(mybox->items[z].hwnd, BKM_CALCPAGERECT, (MPARAM)&rc, (MPARAM)TRUE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1932
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1933 _do_resize(pagebox, rc.xRight - rc.xLeft, rc.yTop - rc.yBottom);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1934 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1935
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1936 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1937 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1938
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1939 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1940
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1941 WinShowWindow(hWnd, TRUE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1942 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1943 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1944 break;
20
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
1945 case WM_CONTROL:
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
1946 switch(SHORT2FROMMP(mp1))
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
1947 {
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
1948 case BKN_PAGESELECTEDPENDING:
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
1949 {
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
1950 PAGESELECTNOTIFY *psn = (PAGESELECTNOTIFY *)mp2;
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
1951 HWND pagehwnd = (HWND)WinSendMsg(psn->hwndBook, BKM_QUERYPAGEWINDOWHWND, MPFROMLONG(psn->ulPageIdNew), 0);
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
1952 Box *pagebox = (Box *)WinQueryWindowPtr(pagehwnd, QWP_USER);
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
1953 unsigned long x, y, width, height;
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
1954 RECTL rc;
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
1955
21
c6e76b796b28 Stopped unnecessary redrawing when switching to the same page.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 20
diff changeset
1956 if(pagebox && psn->ulPageIdNew != psn->ulPageIdCur)
20
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
1957 {
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
1958 dw_window_get_pos_size(psn->hwndBook, &x, &y, &width, &height);
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
1959
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
1960 rc.xLeft = x;
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
1961 rc.yBottom = y;
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
1962 rc.xRight = x + width;
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
1963 rc.yTop = y + height;
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
1964
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
1965 WinSendMsg(psn->hwndBook, BKM_CALCPAGERECT, (MPARAM)&rc, (MPARAM)TRUE);
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
1966
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
1967 _do_resize(pagebox, rc.xRight - rc.xLeft, rc.yTop - rc.yBottom);
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
1968 }
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
1969 }
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
1970 break;
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
1971 }
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
1972 break;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1973 case WM_CLOSE:
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
1974 if(result == -1)
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
1975 {
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
1976 dw_window_destroy(WinQueryWindow(hWnd, QW_PARENT));
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
1977 return (MRESULT)TRUE;
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
1978 }
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
1979 break;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1980 case WM_USER:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1981 windowfunc = (void (*)(void *))mp1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1982
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1983 if(windowfunc)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1984 windowfunc((void *)mp2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1985 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1986 case WM_CHAR:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1987 if(SHORT1FROMMP(mp2) == '\t')
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1988 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1989 _shift_focus(hWnd);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1990 return FALSE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1991 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1992 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1993 case WM_DESTROY:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1994 /* Free memory before destroying */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1995 _free_window_memory(hWnd);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1996 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1997 }
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
1998 if(result != -1)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1999 return (MRESULT)result;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2000 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2001 return WinDefWindowProc(hWnd, msg, mp1, mp2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2002 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2003
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2004 void _changebox(Box *thisbox, int percent, int type)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2005 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2006 int z;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2007
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2008 for(z=0;z<thisbox->count;z++)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2009 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2010 if(thisbox->items[z].type == TYPEBOX)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2011 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2012 Box *tmp = WinQueryWindowPtr(thisbox->items[z].hwnd, QWP_USER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2013 _changebox(tmp, percent, type);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2014 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2015 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2016 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2017 if(type == BOXHORZ)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2018 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2019 if(thisbox->items[z].hsize == SIZEEXPAND)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2020 thisbox->items[z].width = (int)(((float)thisbox->items[z].origwidth) * (((float)percent)/((float)100.0)));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2021 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2022 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2023 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2024 if(thisbox->items[z].vsize == SIZEEXPAND)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2025 thisbox->items[z].height = (int)(((float)thisbox->items[z].origheight) * (((float)percent)/((float)100.0)));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2026 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2027 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2028 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2029 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2030
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2031 /* This handles any activity on the splitbars (sizers) */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2032 MRESULT EXPENTRY _splitwndproc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2033 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2034 HWND hwndFrame = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2035 Box *thisbox = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2036
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2037 hwndFrame = WinQueryWindow(hwnd, QW_PARENT);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2038 if(hwndFrame)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2039 thisbox = WinQueryWindowPtr(hwndFrame, QWL_USER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2040
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2041 switch (msg)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2042 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2043 case WM_ACTIVATE:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2044 case WM_SETFOCUS:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2045 return (MRESULT)(FALSE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2046
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2047 case WM_PAINT:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2048 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2049 HPS hpsPaint;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2050 RECTL rclPaint;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2051 POINTL ptlStart[SPLITBAR_WIDTH];
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2052 POINTL ptlEnd[SPLITBAR_WIDTH];
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2053 USHORT i;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2054
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2055 hpsPaint = WinBeginPaint(hwnd, 0, 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2056 WinQueryWindowRect(hwnd, &rclPaint);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2057
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2058 if(thisbox->type == BOXHORZ)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2059 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2060 for(i = 0; i < SPLITBAR_WIDTH; i++)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2061 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2062 ptlStart[i].x = rclPaint.xLeft + i;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2063 ptlStart[i].y = rclPaint.yTop;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2064
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2065 ptlEnd[i].x = rclPaint.xLeft + i;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2066 ptlEnd[i].y = rclPaint.yBottom;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2067 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2068 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2069 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2070 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2071 for(i = 0; i < SPLITBAR_WIDTH; i++)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2072 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2073 ptlStart[i].x = rclPaint.xLeft;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2074 ptlStart[i].y = rclPaint.yBottom + i;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2075
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2076 ptlEnd[i].x = rclPaint.xRight;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2077 ptlEnd[i].y = rclPaint.yBottom + i;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2078 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2079 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2080
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2081 for(i = 0; i < SPLITBAR_WIDTH; i++)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2082 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2083 GpiSetColor( hpsPaint, lColor[i]);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2084 GpiMove(hpsPaint, &ptlStart[i]);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2085 GpiLine(hpsPaint, &ptlEnd[i]);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2086 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2087 WinEndPaint(hpsPaint);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2088 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2089 return MRFROMSHORT(FALSE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2090
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2091 case WM_MOUSEMOVE:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2092 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2093 if(thisbox->type == BOXHORZ)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2094 WinSetPointer(HWND_DESKTOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2095 WinQuerySysPointer(HWND_DESKTOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2096 SPTR_SIZEWE,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2097 FALSE));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2098 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2099 WinSetPointer(HWND_DESKTOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2100 WinQuerySysPointer(HWND_DESKTOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2101 SPTR_SIZENS,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2102 FALSE));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2103 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2104 return MRFROMSHORT(FALSE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2105 case WM_BUTTON1DOWN:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2106 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2107 APIRET rc;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2108 RECTL rclFrame;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2109 RECTL rclBounds;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2110 RECTL rclStart;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2111 USHORT startSize, orig, actual;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2112
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2113 WinQueryWindowRect(hwnd, &rclFrame);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2114 WinQueryWindowRect(hwnd, &rclStart);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2115
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2116 WinQueryWindowRect(hwndFrame, &rclBounds);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2117
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2118 WinMapWindowPoints(hwndFrame, HWND_DESKTOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2119 (PPOINTL)&rclBounds, 2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2120 WinMapWindowPoints(hwnd, HWND_DESKTOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2121 (PPOINTL)&rclStart, 2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2122
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2123 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2124 int z, pastsplitbar = FALSE, found = FALSE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2125 orig = actual = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2126
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2127 for(z=0;z<thisbox->count;z++)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2128 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2129 if(thisbox->items[z].hwnd == hwnd)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2130 pastsplitbar = TRUE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2131 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2132 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2133 if(thisbox->type == BOXHORZ)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2134 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2135 int tmpwidth, tmporigwidth;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2136
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2137 if(thisbox->items[z].type == TYPEBOX)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2138 _count_size(thisbox->items[z].hwnd, BOXHORZ, &tmpwidth, &tmporigwidth);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2139 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2140 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2141 tmpwidth = thisbox->items[z].width;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2142 tmporigwidth = thisbox->items[z].origwidth;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2143 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2144
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2145 if(thisbox->items[z].hsize != SIZESTATIC && tmpwidth > actual && tmporigwidth)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2146 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2147 found = pastsplitbar;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2148 orig = tmporigwidth;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2149 actual = tmpwidth;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2150 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2151 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2152 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2153 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2154 int tmpheight, tmporigheight;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2155
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2156 if(thisbox->items[z].type == TYPEBOX)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2157 _count_size(thisbox->items[z].hwnd, BOXVERT, &tmpheight, &tmporigheight);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2158 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2159 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2160 tmpheight = thisbox->items[z].height;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2161 tmporigheight = thisbox->items[z].origheight;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2162 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2163
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2164 if(thisbox->items[z].vsize != SIZESTATIC && tmpheight > actual && tmporigheight)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2165 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2166 found = pastsplitbar;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2167 orig = tmporigheight;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2168 actual = tmpheight;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2169 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2170 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2171 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2172 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2173
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2174 /* If we couldn't determine a valid scale... then abort */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2175 if(!orig || !actual)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2176 return MRFROMSHORT(FALSE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2177
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2178 if(thisbox->type == BOXHORZ)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2179 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2180 if(found)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2181 startSize = (rclStart.xLeft - rclBounds.xLeft)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2182 * (((float)actual)/((float)orig));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2183 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2184 startSize = (rclStart.xLeft - rclBounds.xLeft)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2185 * (((float)orig)/((float)actual));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2186 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2187 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2188 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2189 if(found)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2190 startSize = (rclStart.yBottom - rclBounds.yBottom)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2191 * (((float)actual)/((float)orig));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2192 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2193 startSize = (rclStart.yBottom - rclBounds.yBottom)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2194 * (((float)orig)/((float)actual));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2195 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2196 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2197
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2198 rc = _TrackRectangle(hwnd, &rclFrame, &rclBounds);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2199
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2200 if(rc == TRUE)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2201 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2202 USHORT usNewRB;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2203 USHORT percent;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2204 int z;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2205
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2206 if(thisbox->type == BOXHORZ)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2207 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2208 usNewRB = rclFrame.xLeft
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2209 - rclBounds.xLeft;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2210 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2211 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2212 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2213 usNewRB = rclFrame.yBottom
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2214 - rclBounds.yBottom;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2215 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2216
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2217 /* We don't want the item to disappear completely */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2218 if(!usNewRB)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2219 usNewRB++;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2220
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2221 if(!startSize)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2222 startSize++;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2223
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2224 percent = (usNewRB*100)/startSize;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2225
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2226 for(z=0;z<thisbox->count;z++)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2227 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2228 if(thisbox->items[z].type == TYPEBOX)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2229 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2230 Box *tmp = WinQueryWindowPtr(thisbox->items[z].hwnd, QWP_USER);
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
2231
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
2232 if(tmp)
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
2233 _changebox(tmp, percent, thisbox->type);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2234 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2235 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2236 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2237 if(thisbox->items[z].hwnd == hwnd)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2238 percent = (startSize*100)/usNewRB;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2239
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2240 if(thisbox->type == BOXHORZ)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2241 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2242 if(thisbox->items[z].hsize == SIZEEXPAND)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2243 thisbox->items[z].width = (int)(((float)thisbox->items[z].origwidth) * (((float)percent)/((float)100.0)));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2244 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2245 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2246 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2247 if(thisbox->items[z].vsize == SIZEEXPAND)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2248 thisbox->items[z].height = (int)(((float)thisbox->items[z].origheight) * (((float)percent)/((float)100.0)));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2249 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2250 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2251 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2252
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2253 _ResetWindow(WinQueryWindow(hwnd, QW_OWNER));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2254 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2255 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2256 return MRFROMSHORT(FALSE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2257 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2258 return WinDefWindowProc(hwnd, msg, mp1, mp2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2259 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2260
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2261 /* Function: BubbleProc
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2262 * Abstract: Subclass procedure for bubble help
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2263 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2264 MRESULT EXPENTRY _BubbleProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2265 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2266 MRESULT res;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2267 PFNWP proc = (PFNWP)WinQueryWindowPtr(hwnd, QWL_USER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2268
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2269 if(proc)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2270 res = proc(hwnd, msg, mp1, mp2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2271 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2272 res = WinDefWindowProc(hwnd, msg, mp1, mp2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2273
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2274 if(msg == WM_PAINT)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2275 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2276 POINTL ptl;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2277 HPS hpsTemp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2278 RECTL rcl;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2279 int height, width;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2280
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2281 WinQueryWindowRect(hwnd, &rcl);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2282 height = rcl.yTop - rcl.yBottom - 1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2283 width = rcl.xRight - rcl.xLeft - 1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2284
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2285 /* Draw a border around the bubble help */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2286 hpsTemp = WinGetPS(hwnd);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2287 GpiSetColor(hpsTemp, DW_CLR_BLACK);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2288 ptl.x = ptl.y = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2289 GpiMove(hpsTemp, &ptl);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2290 ptl.x = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2291 ptl.y = height;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2292 GpiLine(hpsTemp, &ptl);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2293 ptl.x = ptl.y = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2294 GpiMove(hpsTemp, &ptl);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2295 ptl.y = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2296 ptl.x = width;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2297 GpiLine(hpsTemp, &ptl);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2298 ptl.x = width;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2299 ptl.y = height;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2300 GpiMove(hpsTemp, &ptl);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2301 ptl.x = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2302 ptl.y = height;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2303 GpiLine(hpsTemp, &ptl);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2304 ptl.x = width;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2305 ptl.y = height;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2306 GpiMove(hpsTemp, &ptl);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2307 ptl.y = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2308 ptl.x = width;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2309 GpiLine(hpsTemp, &ptl);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2310 WinReleasePS(hpsTemp);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2311 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2312 return res;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2313 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2314
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2315 /* Function: BtProc
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2316 * Abstract: Subclass procedure for buttons
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2317 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2318
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2319 MRESULT EXPENTRY _BtProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2320 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2321 BubbleButton *bubble;
54
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
2322 PFNWP oldproc;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2323
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2324 bubble = (BubbleButton *)WinQueryWindowPtr(hwnd, QWL_USER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2325
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2326 if(!bubble)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2327 return WinDefWindowProc(hwnd, msg, mp1, mp2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2328
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
2329 oldproc = bubble->pOldProc;
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
2330
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2331 switch(msg)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2332 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2333 #ifndef NO_SIGNALS
37
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
2334 case WM_SETFOCUS:
39
3aa9ef0b3996 Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 38
diff changeset
2335 if(mp2)
3aa9ef0b3996 Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 38
diff changeset
2336 _run_event(hwnd, msg, mp1, mp2);
3aa9ef0b3996 Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 38
diff changeset
2337 else
3aa9ef0b3996 Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 38
diff changeset
2338 WinSendMsg(hwnd, BM_SETDEFAULT, 0, 0);
37
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
2339 break;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2340 case WM_BUTTON1UP:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2341 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2342 SignalHandler *tmp = Root;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2343
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2344 if(WinIsWindowEnabled(hwnd))
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2345 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2346 /* Find any callbacks for this function */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2347 while(tmp)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2348 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2349 if(tmp->message == WM_COMMAND)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2350 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2351 /* Make sure it's the right window, and the right ID */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2352 if(tmp->window == hwnd)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2353 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2354 /* Due to the fact that if we run the function
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2355 * here, finishing actions on the button will occur
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2356 * after we run the signal handler. So we post the
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2357 * message so the button can finish what it needs to
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2358 * do before we run our handler.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2359 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2360 WinPostMsg(hwnd, WM_USER, (MPARAM)tmp, 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2361 tmp = NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2362 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2363 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2364 if(tmp)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2365 tmp= tmp->next;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2366 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2367 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2368 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2369 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2370 case WM_USER:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2371 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2372 SignalHandler *tmp = (SignalHandler *)mp1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2373 int (*clickfunc)(HWND, void *) = NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2374
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2375 if(tmp)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2376 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2377 clickfunc = (int (*)(HWND, void *))tmp->signalfunction;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2378
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2379 clickfunc(tmp->window, tmp->data);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2380 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2381 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2382 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2383 #endif
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2384 case WM_CHAR:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2385 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2386 #ifndef NO_SIGNALS
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2387 /* A button press should also occur for an ENTER or SPACE press
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2388 * while the button has the active input focus.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2389 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2390 if(SHORT1FROMMP(mp2) == '\r' || SHORT1FROMMP(mp2) == ' ')
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2391 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2392 SignalHandler *tmp = Root;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2393
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2394 /* Find any callbacks for this function */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2395 while(tmp)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2396 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2397 if(tmp->message == WM_COMMAND)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2398 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2399 /* Make sure it's the right window, and the right ID */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2400 if(tmp->window == hwnd)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2401 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2402 WinPostMsg(hwnd, WM_USER, (MPARAM)tmp, 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2403 tmp = NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2404 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2405 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2406 if(tmp)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2407 tmp= tmp->next;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2408 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2409 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2410 #endif
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2411 if(SHORT1FROMMP(mp2) == '\t')
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2412 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2413 _shift_focus(hwnd);
39
3aa9ef0b3996 Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 38
diff changeset
2414 WinSendMsg(hwnd, BM_SETDEFAULT, 0, 0);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2415 return FALSE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2416 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2417 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2418 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2419 case 0x041f:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2420 if (hwndBubble)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2421 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2422 WinDestroyWindow(hwndBubble);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2423 hwndBubble = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2424 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2425 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2426
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2427 case 0x041e:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2428
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2429 if(!*bubble->bubbletext)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2430 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2431
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2432
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2433 if(hwndBubble)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2434 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2435 WinDestroyWindow(hwndBubble);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2436 hwndBubble = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2437 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2438
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2439 if(!hwndBubble)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2440 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2441 HPS hpsTemp = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2442 LONG lHight;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2443 LONG lWidth;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2444 POINTL txtPointl[TXTBOX_COUNT];
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2445 POINTL ptlWork = {0,0};
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2446 ULONG ulColor = DW_CLR_YELLOW;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2447 void *blah;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2448
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2449 hwndBubbleLast = hwnd;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2450 hwndBubble = WinCreateWindow(HWND_DESKTOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2451 WC_STATIC,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2452 "",
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2453 SS_TEXT |
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2454 DT_CENTER |
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2455 DT_VCENTER,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2456 0,0,0,0,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2457 HWND_DESKTOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2458 HWND_TOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2459 0,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2460 NULL,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2461 NULL);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2462
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2463 WinSetPresParam(hwndBubble,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2464 PP_FONTNAMESIZE,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2465 sizeof(DefaultFont),
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2466 DefaultFont);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2467
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2468
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2469 WinSetPresParam(hwndBubble,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2470 PP_BACKGROUNDCOLORINDEX,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2471 sizeof(ulColor),
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2472 &ulColor);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2473
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2474 WinSetWindowText(hwndBubble,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2475 bubble->bubbletext);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2476
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2477 WinMapWindowPoints(hwnd, HWND_DESKTOP, &ptlWork, 1);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2478
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2479 hpsTemp = WinGetPS(hwndBubble);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2480 GpiQueryTextBox(hpsTemp,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2481 strlen(bubble->bubbletext),
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2482 bubble->bubbletext,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2483 TXTBOX_COUNT,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2484 txtPointl);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2485 WinReleasePS(hpsTemp);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2486
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2487 lWidth = txtPointl[TXTBOX_TOPRIGHT].x -
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2488 txtPointl[TXTBOX_TOPLEFT ].x + 8;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2489
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2490 lHight = txtPointl[TXTBOX_TOPLEFT].y -
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2491 txtPointl[TXTBOX_BOTTOMLEFT].y + 8;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2492
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2493 ptlWork.y -= lHight;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2494
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2495 blah = (void *)WinSubclassWindow(hwndBubble, _BubbleProc);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2496
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2497 if(blah)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2498 WinSetWindowPtr(hwndBubble, QWP_USER, blah);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2499
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2500 WinSetWindowPos(hwndBubble,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2501 HWND_TOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2502 ptlWork.x,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2503 ptlWork.y,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2504 lWidth,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2505 lHight,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2506 SWP_SIZE | SWP_MOVE | SWP_SHOW);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2507 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2508 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2509 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2510
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
2511 if(!oldproc)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2512 return WinDefWindowProc(hwnd, msg, mp1, mp2);
54
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
2513 return oldproc(hwnd, msg, mp1, mp2);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2514 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2515
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2516 MRESULT EXPENTRY _RendProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2517 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2518 int res = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2519 #ifndef NO_SIGNALS
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2520 res = (int)_run_event(hwnd, msg, mp1, mp2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2521 #endif
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2522 switch(msg)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2523 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2524 case WM_BUTTON1DOWN:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2525 case WM_BUTTON2DOWN:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2526 case WM_BUTTON3DOWN:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2527 if(!res)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2528 WinSetFocus(HWND_DESKTOP, hwnd);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2529 return (MPARAM)TRUE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2530 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2531 return WinDefWindowProc(hwnd, msg, mp1, mp2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2532 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2533
30
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
2534 MRESULT EXPENTRY _TreeProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
2535 {
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
2536 Box *blah = WinQueryWindowPtr(hwnd, QWP_USER);
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
2537
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
2538 #ifndef NO_SIGNALS
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
2539 _run_event(hwnd, msg, mp1, mp2);
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
2540 #endif
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
2541 if(blah && blah->oldproc)
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
2542 return blah->oldproc(hwnd, msg, mp1, mp2);
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
2543 return WinDefWindowProc(hwnd, msg, mp1, mp2);
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
2544 }
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
2545
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2546 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2547 * Initializes the Dynamic Windows engine.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2548 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2549 * newthread: True if this is the only thread.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2550 * False if there is already a message loop running.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2551 */
14
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
2552 int dw_init(int newthread, int argc, char *argv[])
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2553 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2554 APIRET rc;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2555
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2556 if(newthread)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2557 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2558 dwhab = WinInitialize(0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2559 dwhmq = WinCreateMsgQueue(dwhab, 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2560 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2561
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2562 rc = WinRegisterClass(dwhab, ClassName, _wndproc, CS_SIZEREDRAW | CS_CLIPCHILDREN, 32);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2563 rc = WinRegisterClass(dwhab, SplitbarClassName, _splitwndproc, 0L, 32);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2564
20
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
2565 /* Get the OS/2 version. */
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
2566 DosQuerySysInfo(QSV_VERSION_MAJOR, QSV_MS_COUNT,(void *)aulBuffer, 4*sizeof(ULONG));
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
2567
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2568 #ifdef DWDEBUG
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
2569 f = fopen("dw.log", "w");
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2570 #endif
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2571 return rc;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2572 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2573
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2574 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2575 * Runs a message loop for Dynamic Windows.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2576 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2577 * currenthab: The handle to the current anchor block
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2578 * or NULL if this DW is handling the message loop.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2579 * func: Function pointer to the message filter function.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2580 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2581 void dw_main(HAB currenthab, void *func)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2582 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2583 QMSG qmsg;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2584 HAB habtouse;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2585
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2586 if(!currenthab)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2587 habtouse = dwhab;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2588 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2589 habtouse = currenthab;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2590
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2591 /* Setup the filter function */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2592 filterfunc = (int (* EXPENTRY)(HWND, ULONG, MPARAM, MPARAM))func;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2593
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2594 _dwtid = dw_thread_id();
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2595
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2596 while (WinGetMsg(habtouse, &qmsg, 0, 0, 0))
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2597 WinDispatchMsg(habtouse, &qmsg);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2598
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2599 #ifdef DWDEBUG
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2600 fclose(f);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2601 #endif
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2602
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2603 if(!currenthab)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2604 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2605 WinDestroyMsgQueue(dwhmq);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2606 WinTerminate(dwhab);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2607 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2608 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2609
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2610 /*
37
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
2611 * Runs a message loop for Dynamic Windows, for a period of seconds.
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
2612 * Parameters:
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
2613 * seconds: Number of seconds to run the loop for.
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
2614 */
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
2615 void dw_main_sleep(int seconds)
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
2616 {
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
2617 QMSG qmsg;
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
2618 time_t start = time(NULL);
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
2619
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
2620 while(time(NULL) - start <= seconds)
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
2621 {
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
2622 if(WinPeekMsg(dwhab, &qmsg, 0, 0, 0, PM_NOREMOVE))
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
2623 {
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
2624 WinGetMsg(dwhab, &qmsg, 0, 0, 0);
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
2625 WinDispatchMsg(dwhab, &qmsg);
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
2626 }
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
2627 else
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
2628 DosSleep(1);
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
2629 }
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
2630 }
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
2631
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
2632 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2633 * Free's memory allocated by dynamic windows.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2634 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2635 * ptr: Pointer to dynamic windows allocated
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2636 * memory to be free()'d.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2637 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2638 void dw_free(void *ptr)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2639 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2640 free(ptr);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2641 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2642
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2643 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2644 * Allocates and initializes a dialog struct.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2645 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2646 * data: User defined data to be passed to functions.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2647 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2648 DWDialog *dw_dialog_new(void *data)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2649 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2650 DWDialog *tmp = malloc(sizeof(DWDialog));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2651
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2652 tmp->eve = dw_event_new();
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2653 dw_event_reset(tmp->eve);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2654 tmp->data = data;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2655 tmp->done = FALSE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2656 tmp->result = NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2657
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2658 return tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2659 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2660
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2661 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2662 * Accepts a dialog struct and returns the given data to the
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2663 * initial called of dw_dialog_wait().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2664 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2665 * dialog: Pointer to a dialog struct aquired by dw_dialog_new).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2666 * result: Data to be returned by dw_dialog_wait().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2667 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2668 int dw_dialog_dismiss(DWDialog *dialog, void *result)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2669 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2670 dialog->result = result;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2671 dw_event_post(dialog->eve);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2672 dialog->done = TRUE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2673 return 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2674 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2675
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2676 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2677 * Accepts a dialog struct waits for dw_dialog_dismiss() to be
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2678 * called by a signal handler with the given dialog struct.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2679 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2680 * dialog: Pointer to a dialog struct aquired by dw_dialog_new).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2681 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2682 void *dw_dialog_wait(DWDialog *dialog)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2683 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2684 QMSG qmsg;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2685 void *tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2686
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2687 while (WinGetMsg(dwhab, &qmsg, 0, 0, 0))
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2688 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2689 WinDispatchMsg(dwhab, &qmsg);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2690 if(dialog->done)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2691 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2692 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2693 dw_event_close(&dialog->eve);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2694 tmp = dialog->result;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2695 free(dialog);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2696 return tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2697 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2698
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2699
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2700 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2701 * Displays a Message Box with given text and title..
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2702 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2703 * title: The title of the message box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2704 * format: printf style format string.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2705 * ...: Additional variables for use in the format.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2706 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2707 int dw_messagebox(char *title, char *format, ...)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2708 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2709 va_list args;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2710 char outbuf[1024];
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2711
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2712 va_start(args, format);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2713 vsprintf(outbuf, format, args);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2714 va_end(args);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2715
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2716 WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, outbuf, title, 0, MB_OK | MB_INFORMATION | MB_MOVEABLE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2717
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2718 return strlen(outbuf);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2719 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2720
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2721 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2722 * Displays a Message Box with given text and title..
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2723 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2724 * title: The title of the message box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2725 * text: The text to display in the box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2726 * Returns:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2727 * True if YES False of NO.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2728 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2729 int dw_yesno(char *title, char *text)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2730 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2731 if(WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, text, title, 0, MB_YESNO | MB_INFORMATION | MB_MOVEABLE | MB_SYSTEMMODAL)==MBID_YES)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2732 return TRUE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2733 return FALSE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2734 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2735
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2736 /*
40
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
2737 * Makes the window topmost.
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
2738 * Parameters:
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
2739 * 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
2740 */
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
2741 int dw_window_raise(HWND handle)
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
2742 {
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
2743 return WinSetWindowPos(handle, HWND_TOP, 0, 0, 0, 0, SWP_ZORDER);
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
2744 }
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
2745
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
2746 /*
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
2747 * Makes the window bottommost.
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
2748 * Parameters:
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
2749 * 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
2750 */
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
2751 int dw_window_lower(HWND handle)
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
2752 {
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
2753 return WinSetWindowPos(handle, HWND_BOTTOM, 0, 0, 0, 0, SWP_ZORDER);
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
2754 }
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
2755
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
2756 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2757 * Makes the window visible.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2758 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2759 * handle: The window handle to make visible.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2760 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2761 int dw_window_show(HWND handle)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2762 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2763 int rc = WinSetWindowPos(handle, NULLHANDLE, 0, 0, 0, 0, SWP_SHOW);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2764 HSWITCH hswitch;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2765 SWCNTRL swcntrl;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2766
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
2767 _fix_button_owner(handle, 0);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2768 WinSetFocus(HWND_DESKTOP, handle);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2769 _initial_focus(handle);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2770
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2771 /* If this window has a switch list entry make sure it is visible */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2772 hswitch = WinQuerySwitchHandle(handle, 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2773 if(hswitch)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2774 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2775 WinQuerySwitchEntry(hswitch, &swcntrl);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2776 swcntrl.uchVisibility = SWL_VISIBLE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2777 WinChangeSwitchEntry(hswitch, &swcntrl);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2778 }
60
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
2779 if(WinWindowFromID(handle, FID_CLIENT))
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
2780 {
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
2781 WindowData *blah = WinQueryWindowPtr(handle, QWP_USER);
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
2782
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
2783 if(blah && !(blah->flags & DW_OS2_NEW_WINDOW))
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
2784 {
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
2785 ULONG cx = dw_screen_width(), cy = dw_screen_height();
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
2786 int newx, newy, changed = 0;
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
2787 SWP swp;
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
2788
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
2789 blah->flags |= DW_OS2_NEW_WINDOW;
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
2790
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
2791 WinQueryWindowPos(handle, &swp);
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
2792
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
2793 newx = swp.x;
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
2794 newy = swp.y;
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
2795
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
2796 if((swp.x+swp.cx) > cx)
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
2797 {
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
2798 newx = (cx - swp.cx)/2;
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
2799 changed = 1;
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
2800 }
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
2801 if((swp.y+swp.cy) > cy)
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
2802 {
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
2803 newy = (cy - swp.cy)/2;
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
2804 changed = 1;
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
2805 }
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
2806 if(changed)
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
2807 WinSetWindowPos(handle, NULLHANDLE, newx, newy, 0, 0, SWP_MOVE);
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
2808 }
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
2809 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2810 return rc;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2811 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2812
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2813 /*
14
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
2814 * Minimizes or Iconifies a top-level window.
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
2815 * Parameters:
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
2816 * handle: The window handle to minimize.
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
2817 */
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
2818 int dw_window_minimize(HWND handle)
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
2819 {
39
3aa9ef0b3996 Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 38
diff changeset
2820 HWND hwndclient = WinWindowFromID(handle, FID_CLIENT);
3aa9ef0b3996 Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 38
diff changeset
2821
3aa9ef0b3996 Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 38
diff changeset
2822 if(hwndclient)
3aa9ef0b3996 Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 38
diff changeset
2823 {
3aa9ef0b3996 Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 38
diff changeset
2824 Box *box = (Box *)WinQueryWindowPtr(hwndclient, QWP_USER);
3aa9ef0b3996 Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 38
diff changeset
2825
3aa9ef0b3996 Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 38
diff changeset
2826 if(box)
3aa9ef0b3996 Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 38
diff changeset
2827 {
3aa9ef0b3996 Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 38
diff changeset
2828 if(!box->titlebar && box->hwndtitle)
3aa9ef0b3996 Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 38
diff changeset
2829 WinSetParent(box->hwndtitle, handle, FALSE);
3aa9ef0b3996 Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 38
diff changeset
2830 }
3aa9ef0b3996 Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 38
diff changeset
2831 }
3aa9ef0b3996 Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 38
diff changeset
2832
14
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
2833 return WinSetWindowPos(handle, NULLHANDLE, 0, 0, 0, 0, SWP_MINIMIZE);
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
2834 }
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
2835
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
2836 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2837 * Makes the window invisible.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2838 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2839 * handle: The window handle to make visible.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2840 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2841 int dw_window_hide(HWND handle)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2842 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2843 HSWITCH hswitch;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2844 SWCNTRL swcntrl;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2845
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2846 /* If this window has a switch list entry make sure it is invisible */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2847 hswitch = WinQuerySwitchHandle(handle, 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2848 if(hswitch)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2849 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2850 WinQuerySwitchEntry(hswitch, &swcntrl);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2851 swcntrl.uchVisibility = SWL_INVISIBLE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2852 WinChangeSwitchEntry(hswitch, &swcntrl);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2853 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2854 return WinShowWindow(handle, FALSE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2855 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2856
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2857 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2858 * Destroys a window and all of it's children.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2859 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2860 * handle: The window handle to destroy.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2861 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2862 int dw_window_destroy(HWND handle)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2863 {
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
2864 HWND parent = WinQueryWindow(handle, QW_PARENT);
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
2865 Box *thisbox = WinQueryWindowPtr(parent, QWP_USER);
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
2866
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
2867 if(!handle)
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
2868 return -1;
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
2869
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
2870 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
2871 {
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
2872 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
2873 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
2874
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
2875 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
2876 {
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
2877 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
2878 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
2879 }
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
2880
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
2881 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
2882 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
2883
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
2884 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
2885
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
2886 /* 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
2887 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
2888 {
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
2889 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
2890 }
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
2891 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
2892 {
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
2893 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
2894 }
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
2895
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
2896 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
2897 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
2898 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
2899 }
55
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
2900 _disconnect_windows(handle);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2901 return WinDestroyWindow(handle);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2902 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2903
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
2904 /* 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
2905 * 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
2906 * 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
2907 */
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
2908 void dw_window_redraw(HWND handle)
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
2909 {
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
2910 HWND window = WinWindowFromID(handle, FID_CLIENT);
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
2911 Box *mybox = (Box *)WinQueryWindowPtr(window, QWP_USER);
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
2912
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
2913 if(window && mybox)
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
2914 {
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
2915 unsigned long width, height;
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
2916
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
2917 dw_window_get_pos_size(window, NULL, NULL, &width, &height);
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
2918
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
2919 WinShowWindow(mybox->items[0].hwnd, FALSE);
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
2920 _do_resize(mybox, width, height);
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
2921 WinShowWindow(mybox->items[0].hwnd, TRUE);
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
2922 }
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
2923 }
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
2924
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2925 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2926 * Changes a window's parent to newparent.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2927 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2928 * handle: The window handle to destroy.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2929 * newparent: The window's new parent window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2930 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2931 void dw_window_reparent(HWND handle, HWND newparent)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2932 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2933 HWND blah = WinWindowFromID(newparent, FID_CLIENT);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2934 WinSetParent(handle, blah ? blah : newparent, TRUE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2935 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2936
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2937 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2938 * Sets the font used by a specified window (widget) handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2939 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2940 * handle: The window (widget) handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2941 * fontname: Name and size of the font in the form "size.fontname"
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2942 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2943 int dw_window_set_font(HWND handle, char *fontname)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2944 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2945 return WinSetPresParam(handle, PP_FONTNAMESIZE, strlen(fontname)+1, fontname);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2946 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2947
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2948 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2949 * Sets the colors used by a specified window (widget) handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2950 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2951 * handle: The window (widget) handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2952 * fore: Foreground color in DW_RGB format or a default color index.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2953 * back: Background color in DW_RGB format or a default color index.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2954 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2955 int dw_window_set_color(HWND handle, ULONG fore, ULONG back)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2956 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2957 if((fore & DW_RGB_COLOR) == DW_RGB_COLOR)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2958 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2959 RGB2 rgb2;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2960
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2961 rgb2.bBlue = DW_BLUE_VALUE(fore);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2962 rgb2.bGreen = DW_GREEN_VALUE(fore);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2963 rgb2.bRed = DW_RED_VALUE(fore);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2964 rgb2.fcOptions = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2965
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2966 WinSetPresParam(handle, PP_FOREGROUNDCOLOR, sizeof(RGB2), &rgb2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2967
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2968 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2969 if((back & DW_RGB_COLOR) == DW_RGB_COLOR)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2970 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2971 RGB2 rgb2;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2972
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2973 rgb2.bBlue = DW_BLUE_VALUE(back);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2974 rgb2.bGreen = DW_GREEN_VALUE(back);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2975 rgb2.bRed = DW_RED_VALUE(back);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2976 rgb2.fcOptions = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2977
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2978 WinSetPresParam(handle, PP_BACKGROUNDCOLOR, sizeof(RGB2), &rgb2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2979 return 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2980 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2981 if((fore & DW_RGB_COLOR) == DW_RGB_COLOR)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2982 return 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2983
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2984 /* Slight conversion */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2985 if(fore == DW_CLR_BLACK)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2986 fore = CLR_BLACK;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2987 if(fore == DW_CLR_WHITE)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2988 fore = CLR_WHITE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2989
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2990 if(back == DW_CLR_BLACK)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2991 back = CLR_BLACK;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2992 if(back == DW_CLR_WHITE)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2993 back = CLR_WHITE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2994
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2995 return (WinSetPresParam(handle, PP_FOREGROUNDCOLORINDEX, sizeof(ULONG), &fore) |
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2996 WinSetPresParam(handle, PP_BACKGROUNDCOLORINDEX, sizeof(ULONG), &back));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2997 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2998
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2999 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3000 * Sets the font used by a specified window (widget) handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3001 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3002 * handle: The window (widget) handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3003 * border: Size of the window border in pixels.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3004 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3005 int dw_window_set_border(HWND handle, int border)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3006 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3007 WinSendMsg(handle, WM_SETBORDERSIZE, MPFROMSHORT(border), MPFROMSHORT(border));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3008 return 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3009 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3010
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3011 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3012 * Captures the mouse input to this window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3013 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3014 * handle: Handle to receive mouse input.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3015 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3016 void dw_window_capture(HWND handle)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3017 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3018 WinSetCapture(HWND_DESKTOP, handle);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3019 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3020
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3021 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3022 * Releases previous mouse capture.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3023 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3024 void dw_window_release(void)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3025 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3026 WinSetCapture(HWND_DESKTOP, NULLHANDLE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3027 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3028
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3029 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3030 * Tracks this window movement.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3031 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3032 * handle: Handle to frame to be tracked.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3033 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3034 void dw_window_track(HWND handle)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3035 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3036 WinSendMsg(handle, WM_TRACKFRAME, MPFROMSHORT(TF_MOVE), 0);
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 /*
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
3040 * Changes the appearance of the mouse pointer.
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
3041 * Parameters:
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
3042 * handle: Handle to widget for which to change.
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
3043 * cursortype: ID of the pointer you want.
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
3044 */
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
3045 void dw_window_pointer(HWND handle, int pointertype)
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
3046 {
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
3047 WinSetPointer(handle,
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
3048 WinQuerySysPointer(HWND_DESKTOP,
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
3049 pointertype,
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
3050 FALSE));
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
3051 }
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
3052
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
3053 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3054 * Create a new Window Frame.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3055 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3056 * owner: The Owner's window handle or HWND_DESKTOP.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3057 * title: The Window title.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3058 * flStyle: Style flags, see the PM reference.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3059 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3060 HWND dw_window_new(HWND hwndOwner, char *title, ULONG flStyle)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3061 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3062 HWND hwndclient = 0, hwndframe;
8
e22584460709 Switched allocating the box structs with calloc instead of malloc so
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 7
diff changeset
3063 Box *newbox = calloc(1, sizeof(Box));
60
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
3064 WindowData *blah = calloc(1, sizeof(WindowData));
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3065
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3066 newbox->pad = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3067 newbox->type = BOXVERT;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3068 newbox->count = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3069
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3070 flStyle |= FCF_NOBYTEALIGN;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3071
39
3aa9ef0b3996 Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 38
diff changeset
3072 if(flStyle & DW_FCF_TITLEBAR)
3aa9ef0b3996 Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 38
diff changeset
3073 newbox->titlebar = 1;
3aa9ef0b3996 Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 38
diff changeset
3074 else
3aa9ef0b3996 Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 38
diff changeset
3075 flStyle |= FCF_TITLEBAR;
3aa9ef0b3996 Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 38
diff changeset
3076
60
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
3077 if(!(flStyle & FCF_SHELLPOSITION))
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
3078 blah->flags |= DW_OS2_NEW_WINDOW;
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
3079
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3080 hwndframe = WinCreateStdWindow(hwndOwner, 0L, &flStyle, ClassName, title, 0L, NULLHANDLE, 0L, &hwndclient);
39
3aa9ef0b3996 Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 38
diff changeset
3081 newbox->hwndtitle = WinWindowFromID(hwndframe, FID_TITLEBAR);
3aa9ef0b3996 Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 38
diff changeset
3082 if(!newbox->titlebar && newbox->hwndtitle)
3aa9ef0b3996 Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 38
diff changeset
3083 WinSetParent(newbox->hwndtitle, HWND_OBJECT, FALSE);
60
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
3084 blah->oldproc = WinSubclassWindow(hwndframe, _sizeproc);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3085 WinSetWindowPtr(hwndframe, QWP_USER, blah);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3086 WinSetWindowPtr(hwndclient, QWP_USER, newbox);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3087
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3088 return hwndframe;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3089 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3090
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3091 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3092 * Create a new Box to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3093 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3094 * type: Either BOXVERT (vertical) or BOXHORZ (horizontal).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3095 * pad: Number of pixels to pad around the box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3096 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3097 HWND dw_box_new(int type, int pad)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3098 {
8
e22584460709 Switched allocating the box structs with calloc instead of malloc so
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 7
diff changeset
3099 Box *newbox = calloc(1, sizeof(Box));
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3100 HWND hwndframe;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3101
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3102 newbox->pad = pad;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3103 newbox->type = type;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3104 newbox->count = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3105 newbox->grouphwnd = NULLHANDLE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3106
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3107 hwndframe = WinCreateWindow(HWND_OBJECT,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3108 WC_FRAME,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3109 NULL,
47
997e9ed670ef Fixes for box alignment problem on OS/2, crash in dw_bitmap_new() on unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 40
diff changeset
3110 WS_VISIBLE | WS_CLIPCHILDREN |
997e9ed670ef Fixes for box alignment problem on OS/2, crash in dw_bitmap_new() on unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 40
diff changeset
3111 FS_NOBYTEALIGN,
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3112 0,0,2000,1000,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3113 NULLHANDLE,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3114 HWND_TOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3115 0L,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3116 NULL,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3117 NULL);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3118
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3119 newbox->oldproc = WinSubclassWindow(hwndframe, _controlproc);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3120 WinSetWindowPtr(hwndframe, QWP_USER, newbox);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3121 dw_window_set_color(hwndframe, DW_CLR_PALEGRAY, DW_CLR_PALEGRAY);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3122 return hwndframe;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3123 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3124
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3125 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3126 * Create a new Group Box to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3127 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3128 * type: Either BOXVERT (vertical) or BOXHORZ (horizontal).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3129 * pad: Number of pixels to pad around the box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3130 * title: Text to be displayined in the group outline.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3131 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3132 HWND dw_groupbox_new(int type, int pad, char *title)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3133 {
8
e22584460709 Switched allocating the box structs with calloc instead of malloc so
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 7
diff changeset
3134 Box *newbox = calloc(1, sizeof(Box));
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3135 HWND hwndframe;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3136
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3137 newbox->pad = pad;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3138 newbox->type = type;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3139 newbox->count = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3140
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3141 hwndframe = WinCreateWindow(HWND_OBJECT,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3142 WC_FRAME,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3143 NULL,
47
997e9ed670ef Fixes for box alignment problem on OS/2, crash in dw_bitmap_new() on unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 40
diff changeset
3144 WS_VISIBLE |
997e9ed670ef Fixes for box alignment problem on OS/2, crash in dw_bitmap_new() on unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 40
diff changeset
3145 FS_NOBYTEALIGN,
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3146 0,0,2000,1000,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3147 NULLHANDLE,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3148 HWND_TOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3149 0L,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3150 NULL,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3151 NULL);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3152
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3153 newbox->grouphwnd = WinCreateWindow(hwndframe,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3154 WC_STATIC,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3155 title,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3156 WS_VISIBLE | SS_GROUPBOX |
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3157 WS_GROUP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3158 0,0,2000,1000,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3159 NULLHANDLE,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3160 HWND_TOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3161 0L,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3162 NULL,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3163 NULL);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3164
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3165 WinSetWindowPtr(hwndframe, QWP_USER, newbox);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3166 dw_window_set_color(hwndframe, DW_CLR_PALEGRAY, DW_CLR_PALEGRAY);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3167 dw_window_set_color(newbox->grouphwnd, DW_CLR_BLACK, DW_CLR_PALEGRAY);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3168 dw_window_set_font(newbox->grouphwnd, DefaultFont);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3169 return hwndframe;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3170 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3171
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3172 /*
14
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
3173 * 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
3174 * Parameters:
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
3175 * 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
3176 */
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
3177 HWND dw_mdi_new(unsigned long id)
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
3178 {
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
3179 HWND hwndframe;
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
3180
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
3181 hwndframe = WinCreateWindow(HWND_OBJECT,
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
3182 WC_FRAME,
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
3183 NULL,
47
997e9ed670ef Fixes for box alignment problem on OS/2, crash in dw_bitmap_new() on unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 40
diff changeset
3184 WS_VISIBLE | WS_CLIPCHILDREN |
997e9ed670ef Fixes for box alignment problem on OS/2, crash in dw_bitmap_new() on unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 40
diff changeset
3185 FS_NOBYTEALIGN,
14
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
3186 0,0,2000,1000,
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
3187 NULLHANDLE,
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
3188 HWND_TOP,
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
3189 0L,
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
3190 NULL,
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
3191 NULL);
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
3192 return hwndframe;
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
3193 }
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
3194
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
3195 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3196 * Create a bitmap object to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3197 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3198 * id: An ID to be used with WinWindowFromID() or 0L.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3199 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3200 HWND dw_bitmap_new(ULONG id)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3201 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3202 return WinCreateWindow(HWND_OBJECT,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3203 WC_STATIC,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3204 NULL,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3205 WS_VISIBLE | SS_TEXT,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3206 0,0,2000,1000,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3207 NULLHANDLE,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3208 HWND_TOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3209 id,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3210 NULL,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3211 NULL);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3212 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3213
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3214 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3215 * Create a notebook object to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3216 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3217 * id: An ID to be used for getting the resource from the
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3218 * resource file.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3219 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3220 HWND dw_notebook_new(ULONG id, int top)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3221 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3222 ULONG flags;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3223 HWND tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3224
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3225 if(top)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3226 flags = BKS_MAJORTABTOP;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3227 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3228 flags = BKS_MAJORTABBOTTOM;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3229
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3230 tmp = WinCreateWindow(HWND_OBJECT,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3231 WC_NOTEBOOK,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3232 NULL,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3233 WS_VISIBLE |
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3234 BKS_TABBEDDIALOG |
7
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
3235 flags,
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3236 0,0,2000,1000,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3237 NULLHANDLE,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3238 HWND_TOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3239 id,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3240 NULL,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3241 NULL);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3242
20
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
3243 /* Fix tab sizes on Warp 3 */
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
3244 if(!IS_WARP4())
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
3245 {
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
3246 /* best sizes to be determined by trial and error */
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
3247 WinSendMsg(tmp, BKM_SETDIMENSIONS,MPFROM2SHORT(102, 28), MPFROMSHORT( BKA_MAJORTAB));
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
3248 }
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
3249
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3250 dw_window_set_font(tmp, DefaultFont);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3251 return tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3252 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3253
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3254 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3255 * Create a menu object to be popped up.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3256 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3257 * id: An ID to be used for getting the resource from the
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3258 * resource file.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3259 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3260 HMENUI dw_menu_new(ULONG id)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3261 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3262 HMENUI tmp = malloc(sizeof(struct _hmenui));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3263
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3264 if(!tmp)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3265 return NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3266
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3267 tmp->menu = WinCreateWindow(HWND_OBJECT,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3268 WC_MENU,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3269 NULL,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3270 WS_VISIBLE,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3271 0,0,2000,1000,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3272 NULLHANDLE,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3273 HWND_TOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3274 id,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3275 NULL,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3276 NULL);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3277 return tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3278 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3279
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3280 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3281 * Create a menubar on a window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3282 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3283 * location: Handle of a window frame to be attached to.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3284 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3285 HMENUI dw_menubar_new(HWND location)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3286 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3287 HMENUI tmp = malloc(sizeof(struct _hmenui));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3288
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3289 if(!tmp)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3290 return NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3291
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3292 tmp->menu = WinCreateWindow(location,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3293 WC_MENU,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3294 NULL,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3295 WS_VISIBLE | MS_ACTIONBAR,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3296 0,0,2000,1000,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3297 location,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3298 HWND_TOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3299 FID_MENU,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3300 NULL,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3301 NULL);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3302 return tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3303 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3304
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3305 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3306 * Destroys a menu created with dw_menubar_new or dw_menu_new.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3307 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3308 * menu: Handle of a menu.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3309 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3310 void dw_menu_destroy(HMENUI *menu)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3311 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3312 if(menu && *menu)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3313 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3314 WinDestroyWindow((*menu)->menu);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3315 free(*menu);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3316 *menu = NULL;
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
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3320 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3321 * Adds a menuitem or submenu to an existing menu.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3322 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3323 * menu: The handle the the existing menu.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3324 * title: The title text on the menu item to be added.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3325 * id: An ID to be used for message passing.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3326 * flags: Extended attributes to set on the menu.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3327 * end: If TRUE memu is positioned at the end of the menu.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3328 * check: If TRUE menu is "check"able.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3329 * submenu: Handle to an existing menu to be a submenu or NULL.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3330 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3331 HWND dw_menu_append_item(HMENUI menux, char *title, ULONG id, ULONG flags, int end, int check, HMENUI submenu)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3332 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3333 MENUITEM miSubMenu;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3334 HWND menu;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3335
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3336 if(!menux)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3337 return NULLHANDLE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3338
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3339 menu = menux->menu;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3340
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3341 if(end)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3342 miSubMenu.iPosition=MIT_END;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3343 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3344 miSubMenu.iPosition=0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3345
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3346 if(strlen(title) == 0)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3347 miSubMenu.afStyle=MIS_SEPARATOR | flags;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3348 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3349 miSubMenu.afStyle=MIS_TEXT | flags;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3350 miSubMenu.afAttribute=0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3351 miSubMenu.id=id;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3352 miSubMenu.hwndSubMenu = submenu ? submenu->menu : 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3353 miSubMenu.hItem=NULLHANDLE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3354
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3355 WinSendMsg(menu,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3356 MM_INSERTITEM,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3357 MPFROMP(&miSubMenu),
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3358 MPFROMP(title));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3359 return (HWND)id;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3360 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3361
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3362 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3363 * Sets the state of a menu item check.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3364 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3365 * menu: The handle the the existing menu.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3366 * id: Menuitem id.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3367 * check: TRUE for checked FALSE for not checked.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3368 */
12
26e2130135b9 Many Win32 and GTK fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 9
diff changeset
3369 void dw_menu_item_set_check(HMENUI menux, unsigned long id, int check)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3370 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3371 HWND menu;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3372
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3373 if(!menux)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3374 return;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3375
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3376 menu = menux->menu;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3377
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3378 if(check)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3379 WinSendMsg(menu, MM_SETITEMATTR, MPFROM2SHORT(id, TRUE),
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3380 MPFROM2SHORT(MIA_CHECKED, MIA_CHECKED));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3381 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3382 WinSendMsg(menu, MM_SETITEMATTR, MPFROM2SHORT(id, TRUE),
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3383 MPFROM2SHORT(MIA_CHECKED, 0));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3384 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3385
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3386 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3387 * Pops up a context menu at given x and y coordinates.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3388 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3389 * menu: The handle the the existing menu.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3390 * parent: Handle to the window initiating the popup.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3391 * x: X coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3392 * y: Y coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3393 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3394 void dw_menu_popup(HMENUI *menu, HWND parent, int x, int y)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3395 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3396 if(menu && *menu)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3397 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3398 WinPopupMenu(HWND_DESKTOP, parent, (*menu)->menu, x, dw_screen_height() - y, 0, PU_KEYBOARD | PU_MOUSEBUTTON1 | PU_VCONSTRAIN | PU_HCONSTRAIN);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3399 free(*menu);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3400 *menu = NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3401 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3402 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3403
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3404 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3405 * Returns the current X and Y coordinates of the mouse pointer.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3406 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3407 * x: Pointer to variable to store X coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3408 * y: Pointer to variable to store Y coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3409 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3410 void dw_pointer_query_pos(long *x, long *y)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3411 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3412 POINTL ptl;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3413
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3414 WinQueryPointerPos(HWND_DESKTOP, &ptl);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3415 if(x && y)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3416 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3417 *x = ptl.x;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3418 *y = dw_screen_height() - ptl.y;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3419 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3420 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3421
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3422 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3423 * Sets the X and Y coordinates of the mouse pointer.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3424 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3425 * x: X coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3426 * y: Y coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3427 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3428 void dw_pointer_set_pos(long x, long y)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3429 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3430 WinSetPointerPos(HWND_DESKTOP, x, dw_screen_height() - y);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3431 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3432
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3433 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3434 * Create a container object to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3435 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3436 * id: An ID to be used for getting the resource from the
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3437 * resource file.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3438 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3439 HWND dw_container_new(ULONG id)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3440 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3441 HWND tmp = WinCreateWindow(HWND_OBJECT,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3442 WC_CONTAINER,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3443 NULL,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3444 WS_VISIBLE | CCS_READONLY |
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3445 CCS_SINGLESEL | CCS_AUTOPOSITION,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3446 0,0,2000,1000,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3447 NULLHANDLE,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3448 HWND_TOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3449 id,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3450 NULL,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3451 NULL);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3452 dw_window_set_font(tmp, DefaultFont);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3453 return tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3454 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3455
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3456 /*
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
3457 * Create a tree object to be packed.
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
3458 * Parameters:
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
3459 * id: An ID to be used for getting the resource from the
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
3460 * resource file.
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
3461 */
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
3462 HWND dw_tree_new(ULONG id)
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
3463 {
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
3464 CNRINFO cnrinfo;
30
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
3465 Box *newbox = calloc(1, sizeof(Box));
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
3466 HWND tmp = WinCreateWindow(HWND_OBJECT,
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
3467 WC_CONTAINER,
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
3468 NULL,
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
3469 WS_VISIBLE | CCS_READONLY |
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
3470 CCS_SINGLESEL | CCS_AUTOPOSITION,
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
3471 0,0,2000,1000,
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
3472 NULLHANDLE,
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
3473 HWND_TOP,
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
3474 id,
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
3475 NULL,
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
3476 NULL);
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
3477
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
3478 cnrinfo.flWindowAttr = CV_TREE | CA_TREELINE;
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
3479 cnrinfo.slBitmapOrIcon.cx = 16;
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
3480 cnrinfo.slBitmapOrIcon.cy = 16;
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
3481
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
3482 WinSendMsg(tmp, CM_SETCNRINFO, &cnrinfo, MPFROMLONG(CMA_FLWINDOWATTR | CMA_SLBITMAPORICON));
30
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
3483 newbox->oldproc = WinSubclassWindow(tmp, _TreeProc);
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
3484 WinSetWindowPtr(tmp, QWP_USER, newbox);
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
3485 dw_window_set_font(tmp, DefaultFont);
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
3486 return tmp;
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
3487 }
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
3488
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
3489 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3490 * Create a new static text window (widget) to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3491 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3492 * text: The text to be display by the static text widget.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3493 * id: An ID to be used with WinWindowFromID() or 0L.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3494 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3495 HWND dw_text_new(char *text, ULONG id)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3496 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3497 HWND tmp = WinCreateWindow(HWND_OBJECT,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3498 WC_STATIC,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3499 text,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3500 WS_VISIBLE | SS_TEXT,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3501 0,0,2000,1000,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3502 NULLHANDLE,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3503 HWND_TOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3504 id,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3505 NULL,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3506 NULL);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3507 dw_window_set_font(tmp, DefaultFont);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3508 dw_window_set_color(tmp, DW_CLR_BLACK, DW_CLR_PALEGRAY);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3509 return tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3510 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3511
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3512 /*
7
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
3513 * 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
3514 * Parameters:
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
3515 * 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
3516 * 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
3517 */
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
3518 HWND dw_status_text_new(char *text, ULONG id)
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
3519 {
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
3520 PFNWP *blah = malloc(sizeof(PFNWP));
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
3521 HWND tmp = WinCreateWindow(HWND_OBJECT,
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
3522 WC_STATIC,
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
3523 text,
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
3524 WS_VISIBLE | SS_TEXT,
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
3525 0,0,2000,1000,
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
3526 NULLHANDLE,
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
3527 HWND_TOP,
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
3528 id,
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
3529 NULL,
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
3530 NULL);
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
3531 dw_window_set_font(tmp, DefaultFont);
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
3532 dw_window_set_color(tmp, DW_CLR_BLACK, DW_CLR_PALEGRAY);
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
3533
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
3534 *blah = WinSubclassWindow(tmp, _statusproc);
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
3535 WinSetWindowPtr(tmp, QWP_USER, blah);
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
3536 return tmp;
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
3537 }
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
3538
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
3539 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3540 * Create a new Multiline Editbox window (widget) to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3541 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3542 * id: An ID to be used with WinWindowFromID() or 0L.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3543 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3544 HWND dw_mle_new(ULONG id)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3545 {
60
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
3546 WindowData *blah = calloc(1, sizeof(WindowData));
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3547 HWND tmp = WinCreateWindow(HWND_OBJECT,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3548 WC_MLE,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3549 "",
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3550 WS_VISIBLE |
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3551 MLS_BORDER | MLS_IGNORETAB |
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3552 MLS_READONLY | MLS_VSCROLL,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3553 0,0,2000,1000,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3554 NULLHANDLE,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3555 HWND_TOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3556 id,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3557 NULL,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3558 NULL);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3559 dw_window_set_font(tmp, DefaultFont);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3560 dw_window_set_font(tmp, DefaultFont);
60
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
3561 blah->oldproc = WinSubclassWindow(tmp, _comboentryproc);
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
3562 WinSetWindowPtr(tmp, QWP_USER, blah);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3563 return tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3564 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3565
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3566 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3567 * Create a new Entryfield window (widget) to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3568 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3569 * text: The default text to be in the entryfield widget.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3570 * id: An ID to be used with WinWindowFromID() or 0L.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3571 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3572 HWND dw_entryfield_new(char *text, ULONG id)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3573 {
40
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
3574
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
3575 WindowData *blah = calloc(1, sizeof(WindowData));
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3576 HWND tmp = WinCreateWindow(HWND_OBJECT,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3577 WC_ENTRYFIELD,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3578 text,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3579 WS_VISIBLE | ES_MARGIN |
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3580 ES_AUTOSCROLL | WS_TABSTOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3581 0,0,2000,1000,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3582 NULLHANDLE,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3583 HWND_TOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3584 id,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3585 NULL,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3586 NULL);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3587 dw_window_set_font(tmp, DefaultFont);
40
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
3588 blah->oldproc = WinSubclassWindow(tmp, _entryproc);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3589 WinSetWindowPtr(tmp, QWP_USER, blah);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3590 return tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3591 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3592
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3593 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3594 * Create a new Entryfield (password) window (widget) to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3595 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3596 * text: The default text to be in the entryfield widget.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3597 * id: An ID to be used with WinWindowFromID() or 0L.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3598 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3599 HWND dw_entryfield_password_new(char *text, ULONG id)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3600 {
40
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
3601 WindowData *blah = calloc(1, sizeof(WindowData));
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3602 HWND tmp = WinCreateWindow(HWND_OBJECT,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3603 WC_ENTRYFIELD,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3604 text,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3605 WS_VISIBLE | ES_MARGIN | ES_UNREADABLE |
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3606 ES_AUTOSCROLL | WS_TABSTOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3607 0,0,2000,1000,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3608 NULLHANDLE,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3609 HWND_TOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3610 id,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3611 NULL,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3612 NULL);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3613 dw_window_set_font(tmp, DefaultFont);
40
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
3614 blah->oldproc = WinSubclassWindow(tmp, _entryproc);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3615 WinSetWindowPtr(tmp, QWP_USER, blah);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3616 return tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3617 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3618
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3619 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3620 * Create a new Combobox window (widget) to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3621 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3622 * text: The default text to be in the combpbox widget.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3623 * id: An ID to be used with WinWindowFromID() or 0L.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3624 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3625 HWND dw_combobox_new(char *text, ULONG id)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3626 {
40
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
3627 WindowData *blah = calloc(1, sizeof(WindowData));
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3628 HWND tmp = WinCreateWindow(HWND_OBJECT,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3629 WC_COMBOBOX,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3630 text,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3631 WS_VISIBLE | CBS_DROPDOWN | WS_GROUP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3632 0,0,2000,1000,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3633 NULLHANDLE,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3634 HWND_TOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3635 id,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3636 NULL,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3637 NULL);
55
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
3638 HENUM henum = WinBeginEnumWindows(tmp);
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
3639 HWND child;
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
3640
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
3641 while((child = WinGetNextWindow(henum)) != NULLHANDLE)
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
3642 {
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
3643 WindowData *moreblah = calloc(1, sizeof(WindowData));
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
3644 moreblah->oldproc = WinSubclassWindow(child, _comboentryproc);
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
3645 WinSetWindowPtr(child, QWP_USER, moreblah);
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
3646 }
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
3647 WinEndEnumWindows(henum);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3648 dw_window_set_font(tmp, DefaultFont);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3649 dw_window_set_color(tmp, DW_CLR_BLACK, DW_CLR_WHITE);
40
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
3650 blah->oldproc = WinSubclassWindow(tmp, _comboproc);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3651 WinSetWindowPtr(tmp, QWP_USER, blah);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3652 return tmp;
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 * Create a new button window (widget) to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3657 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3658 * text: The text to be display by the static text widget.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3659 * id: An ID to be used with WinWindowFromID() or 0L.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3660 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3661 HWND dw_button_new(char *text, ULONG id)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3662 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3663 BubbleButton *bubble = malloc(sizeof(BubbleButton));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3664
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3665 HWND tmp = WinCreateWindow(HWND_OBJECT,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3666 WC_BUTTON,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3667 text,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3668 WS_VISIBLE,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3669 0,0,2000,1000,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3670 NULLHANDLE,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3671 HWND_TOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3672 id,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3673 NULL,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3674 NULL);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3675
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3676 bubble->id = id;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3677 bubble->bubbletext[0] = '\0';
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3678 bubble->pOldProc = WinSubclassWindow(tmp, _BtProc);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3679
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3680 WinSetWindowPtr(tmp, QWP_USER, bubble);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3681 dw_window_set_font(tmp, DefaultFont);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3682 return tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3683 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3684
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3685 /* Function: GenResIDStr
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3686 ** Abstract: Generate string '#nnnn' for a given ID for using with Button
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3687 ** controls
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3688 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3689
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3690 void _GenResIDStr(CHAR *buff, ULONG ulID)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3691 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3692 char *str;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3693 int slen = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3694
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3695 *buff++ = '#';
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3696
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3697 str = buff;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3698
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3699 do
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3700 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3701 *str++ = (ulID % 10) + '0';
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3702 ulID /= 10;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3703 slen++;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3704 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3705 while(ulID);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3706
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3707 *str-- = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3708
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3709 for(; str > buff; str--, buff++)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3710 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3711 *buff ^= *str;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3712 *str ^= *buff;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3713 *buff ^= *str;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3714 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3715 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3716
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3717
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3718 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3719 * Create a new bitmap button window (widget) to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3720 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3721 * text: Bubble help text to be displayed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3722 * id: An ID of a bitmap in the resource file.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3723 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3724 HWND dw_bitmapbutton_new(char *text, ULONG id)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3725 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3726 char idbuf[256];
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3727 HWND tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3728 BubbleButton *bubble = malloc(sizeof(BubbleButton));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3729
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3730 _GenResIDStr(idbuf, id);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3731
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3732 tmp = WinCreateWindow(HWND_OBJECT,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3733 WC_BUTTON,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3734 idbuf,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3735 WS_VISIBLE | BS_PUSHBUTTON |
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3736 BS_BITMAP | BS_AUTOSIZE |
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3737 BS_NOPOINTERFOCUS,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3738 0,0,2000,1000,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3739 NULLHANDLE,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3740 HWND_TOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3741 id,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3742 NULL,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3743 NULL);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3744
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3745 bubble->id = id;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3746 strncpy(bubble->bubbletext, text, BUBBLE_HELP_MAX - 1);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3747 bubble->bubbletext[BUBBLE_HELP_MAX - 1] = '\0';
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3748 bubble->pOldProc = WinSubclassWindow(tmp, _BtProc);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3749
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3750 WinSetWindowPtr(tmp, QWP_USER, bubble);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3751 return tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3752 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3753
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3754 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3755 * Create a new spinbutton window (widget) to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3756 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3757 * text: The text to be display by the static text widget.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3758 * id: An ID to be used with WinWindowFromID() or 0L.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3759 */
7
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
3760 HWND dw_spinbutton_new(char *text, ULONG id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3761 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3762 PFNWP *blah = malloc(sizeof(PFNWP));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3763 HWND tmp = WinCreateWindow(HWND_OBJECT,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3764 WC_SPINBUTTON,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3765 text,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3766 WS_VISIBLE | SPBS_MASTER,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3767 0,0,2000,1000,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3768 NULLHANDLE,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3769 HWND_TOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3770 id,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3771 NULL,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3772 NULL);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3773 dw_window_set_font(tmp, DefaultFont);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3774 *blah = WinSubclassWindow(tmp, _entryproc);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3775 WinSetWindowPtr(tmp, QWP_USER, blah);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3776 return tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3777 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3778
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3779 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3780 * Create a new radiobutton window (widget) to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3781 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3782 * text: The text to be display by the static text widget.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3783 * id: An ID to be used with WinWindowFromID() or 0L.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3784 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3785 HWND dw_radiobutton_new(char *text, ULONG id)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3786 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3787 PFNWP *blah = malloc(sizeof(PFNWP));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3788 HWND tmp = WinCreateWindow(HWND_OBJECT,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3789 WC_BUTTON,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3790 text,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3791 WS_VISIBLE |
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3792 BS_AUTORADIOBUTTON,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3793 0,0,2000,1000,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3794 NULLHANDLE,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3795 HWND_TOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3796 id,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3797 NULL,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3798 NULL);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3799 dw_window_set_font(tmp, DefaultFont);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3800 dw_window_set_color(tmp, DW_CLR_BLACK, DW_CLR_PALEGRAY);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3801 *blah = WinSubclassWindow(tmp, _entryproc);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3802 WinSetWindowPtr(tmp, QWP_USER, blah);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3803 return tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3804 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3805
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3806 /*
33
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
3807 * Create a new percent bar window (widget) to be packed.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3808 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3809 * id: An ID to be used with WinWindowFromID() or 0L.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3810 */
33
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
3811 HWND dw_percent_new(ULONG id)
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
3812 {
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
3813 PercentBar *blah = malloc(sizeof(PercentBar));
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
3814 HWND tmp = WinCreateWindow(HWND_OBJECT,
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
3815 WC_STATIC,
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
3816 "",
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
3817 WS_VISIBLE | SS_TEXT,
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
3818 0,0,2000,1000,
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
3819 NULLHANDLE,
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
3820 HWND_TOP,
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
3821 id,
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
3822 NULL,
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
3823 NULL);
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
3824 dw_window_set_font(tmp, DefaultFont);
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
3825 dw_window_set_color(tmp, DW_CLR_BLUE, DW_CLR_PALEGRAY);
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
3826
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
3827 blah->oldproc = WinSubclassWindow(tmp, _percentproc);
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
3828 blah->pos = 0;
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
3829 WinSetWindowPtr(tmp, QWP_USER, blah);
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
3830 return tmp;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3831 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3832
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3833 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3834 * Create a new checkbox window (widget) to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3835 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3836 * text: The text to be display by the static text widget.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3837 * id: An ID to be used with WinWindowFromID() or 0L.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3838 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3839 HWND dw_checkbox_new(char *text, ULONG id)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3840 {
60
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
3841 BubbleButton *bubble = malloc(sizeof(BubbleButton));
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3842 HWND tmp = WinCreateWindow(HWND_OBJECT,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3843 WC_BUTTON,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3844 text,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3845 WS_VISIBLE | BS_AUTOCHECKBOX,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3846 0,0,2000,1000,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3847 NULLHANDLE,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3848 HWND_TOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3849 id,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3850 NULL,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3851 NULL);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3852 dw_window_set_font(tmp, DefaultFont);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3853 dw_window_set_color(tmp, DW_CLR_BLACK, DW_CLR_PALEGRAY);
60
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
3854 bubble->id = id;
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
3855 bubble->bubbletext[0] = '\0';
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
3856 bubble->pOldProc = WinSubclassWindow(tmp, _BtProc);
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
3857 WinSetWindowPtr(tmp, QWP_USER, bubble);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3858 return tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3859 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3860
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3861 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3862 * Create a new listbox window (widget) to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3863 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3864 * id: An ID to be used with WinWindowFromID() or 0L.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3865 * multi: Multiple select TRUE or FALSE.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3866 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3867 HWND dw_listbox_new(ULONG id, int multi)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3868 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3869 PFNWP *blah = malloc(sizeof(PFNWP));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3870 HWND tmp = WinCreateWindow(HWND_OBJECT,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3871 WC_LISTBOX,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3872 NULL,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3873 WS_VISIBLE | LS_NOADJUSTPOS |
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3874 (multi ? LS_MULTIPLESEL : 0),
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3875 0,0,2000,1000,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3876 NULLHANDLE,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3877 HWND_TOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3878 id,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3879 NULL,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3880 NULL);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3881 dw_window_set_font(tmp, DefaultFont);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3882 *blah = WinSubclassWindow(tmp, _entryproc);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3883 WinSetWindowPtr(tmp, QWP_USER, blah);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3884 return tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3885 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3886
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3887 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3888 * Sets the icon used for a given window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3889 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3890 * handle: Handle to the window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3891 * id: An ID to be used to specify the icon.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3892 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3893 void dw_window_set_icon(HWND handle, ULONG id)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3894 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3895 HPOINTER icon;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3896
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3897 icon = WinLoadPointer(HWND_DESKTOP,NULLHANDLE,id);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3898 WinSendMsg(handle, WM_SETICON, (MPARAM)icon, 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3899 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3900
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3901 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3902 * Sets the bitmap used for a given static window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3903 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3904 * handle: Handle to the window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3905 * id: An ID to be used to specify the icon.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3906 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3907 void dw_window_set_bitmap(HWND handle, ULONG id)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3908 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3909 HBITMAP hbm;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3910 HPS hps = WinGetPS(handle);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3911
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3912 hbm = GpiLoadBitmap(hps, NULLHANDLE, id, 0, 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3913 WinSetWindowBits(handle,QWL_STYLE,SS_BITMAP,SS_BITMAP | 0x7f);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3914 WinSendMsg( handle, SM_SETHANDLE, MPFROMP(hbm), NULL );
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3915 /*WinSetWindowULong( hwndDlg, QWL_USER, (ULONG) hbm );*/
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3916 WinReleasePS(hps);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3917 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3918
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3919 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3920 * Sets the text used for a given window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3921 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3922 * handle: Handle to the window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3923 * text: The text associsated with a given window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3924 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3925 void dw_window_set_text(HWND handle, char *text)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3926 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3927 WinSetWindowText(handle, text);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3928 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3929
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3930 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3931 * Gets the text used for a given window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3932 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3933 * handle: Handle to the window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3934 * Returns:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3935 * text: The text associsated with a given window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3936 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3937 char *dw_window_get_text(HWND handle)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3938 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3939 char tempbuf[4096] = "";
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3940
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3941 WinQueryWindowText(handle, 4095, tempbuf);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3942 tempbuf[4095] = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3943
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3944 return strdup(tempbuf);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3945 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3946
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3947 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3948 * Disables given window (widget).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3949 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3950 * handle: Handle to the window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3951 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3952 void dw_window_disable(HWND handle)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3953 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3954 WinEnableWindow(handle, FALSE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3955 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3956
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3957 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3958 * Enables given window (widget).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3959 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3960 * handle: Handle to the window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3961 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3962 void dw_window_enable(HWND handle)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3963 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3964 WinEnableWindow(handle, TRUE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3965 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3966
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3967 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3968 * Gets the child window handle with specified ID.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3969 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3970 * handle: Handle to the parent window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3971 * id: Integer ID of the child.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3972 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3973 HWND dw_window_from_id(HWND handle, int id)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3974 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3975 HENUM henum;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3976 HWND child;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3977 char tmpbuf[100];
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3978
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3979 henum = WinBeginEnumWindows(handle);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3980 while((child = WinGetNextWindow(henum)) != NULLHANDLE)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3981 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3982 int windowid = WinQueryWindowUShort(child, QWS_ID);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3983 HWND found;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3984
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3985 WinQueryClassName(child, 99, tmpbuf);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3986
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3987 /* If the child is a box (frame) then recurse into it */
34
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
3988 if(strncmp(tmpbuf, "#1", 3)==0)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3989 if((found = dw_window_from_id(child, id)) != NULLHANDLE)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3990 return found;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3991
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3992 if(windowid && windowid == id)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3993 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3994 WinEndEnumWindows(henum);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3995 return child;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3996 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3997 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3998 WinEndEnumWindows(henum);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3999 return NULLHANDLE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4000 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4001
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4002 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4003 * Pack windows (widgets) into a box from the end (or bottom).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4004 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4005 * box: Window handle of the box to be packed into.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4006 * item: Window handle of the item to be back.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4007 * width: Width in pixels of the item or -1 to be self determined.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4008 * height: Height in pixels of the item or -1 to be self determined.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4009 * hsize: TRUE if the window (widget) should expand horizontally to fill space given.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4010 * vsize: TRUE if the window (widget) should expand vertically to fill space given.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4011 * pad: Number of pixels of padding around the item.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4012 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4013 void dw_box_pack_end(HWND box, HWND item, int width, int height, int hsize, int vsize, int pad)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4014 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4015 Box *thisbox;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4016
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4017 if(WinWindowFromID(box, FID_CLIENT))
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4018 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4019 box = WinWindowFromID(box, FID_CLIENT);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4020 thisbox = WinQueryWindowPtr(box, QWP_USER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4021 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4022 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4023 thisbox = WinQueryWindowPtr(box, QWP_USER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4024 if(thisbox)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4025 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4026 if(thisbox->type == BOXHORZ)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4027 dw_box_pack_start_stub(box, item, width, height, hsize, vsize, pad);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4028 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4029 dw_box_pack_end_stub(box, item, width, height, hsize, vsize, pad);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4030 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4031 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4032
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4033 void dw_box_pack_end_stub(HWND box, HWND item, int width, int height, int hsize, int vsize, int pad)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4034 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4035 HWND boxowner = NULLHANDLE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4036 Box *thisbox;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4037
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4038 if(WinWindowFromID(box, FID_CLIENT))
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4039 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4040 box = WinWindowFromID(box, FID_CLIENT);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4041 thisbox = WinQueryWindowPtr(box, QWP_USER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4042 hsize = TRUE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4043 vsize = TRUE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4044 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4045 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4046 thisbox = WinQueryWindowPtr(box, QWP_USER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4047 if(!thisbox)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4048 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4049 box = WinWindowFromID(box, FID_CLIENT);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4050 if(box)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4051 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4052 thisbox = WinQueryWindowPtr(box, QWP_USER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4053 hsize = TRUE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4054 vsize = TRUE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4055 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4056 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4057 if(thisbox)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4058 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4059 int z;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4060 Item *tmpitem, *thisitem = thisbox->items;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4061 char tmpbuf[100];
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4062
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4063 tmpitem = malloc(sizeof(Item)*(thisbox->count+1));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4064
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4065 for(z=0;z<thisbox->count;z++)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4066 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4067 tmpitem[z] = thisitem[z];
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4068 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4069
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4070 WinQueryClassName(item, 99, tmpbuf);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4071
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
4072 if(strncmp(tmpbuf, "#1", 3)==0)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4073 tmpitem[thisbox->count].type = TYPEBOX;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4074 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4075 tmpitem[thisbox->count].type = TYPEITEM;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4076
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4077 tmpitem[thisbox->count].hwnd = item;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4078 tmpitem[thisbox->count].origwidth = tmpitem[thisbox->count].width = width;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4079 tmpitem[thisbox->count].origheight = tmpitem[thisbox->count].height = height;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4080 tmpitem[thisbox->count].pad = pad;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4081 if(hsize)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4082 tmpitem[thisbox->count].hsize = SIZEEXPAND;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4083 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4084 tmpitem[thisbox->count].hsize = SIZESTATIC;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4085
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4086 if(vsize)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4087 tmpitem[thisbox->count].vsize = SIZEEXPAND;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4088 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4089 tmpitem[thisbox->count].vsize = SIZESTATIC;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4090
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4091 thisbox->items = tmpitem;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4092
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4093 if(thisbox->count)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4094 free(thisitem);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4095
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4096 thisbox->count++;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4097
37
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
4098 /* Don't set the ownership if it's an entryfield or spinbutton */
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4099 WinQueryClassName(item, 99, tmpbuf);
37
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
4100 if(strncmp(tmpbuf, "#6", 3)!=0 && strncmp(tmpbuf, "#32", 3)!=0)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4101 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4102 if((boxowner = WinQueryWindow(box, QW_OWNER)) != 0)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4103 WinSetOwner(item, boxowner);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4104 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4105 WinSetOwner(item, box);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4106 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4107 WinSetParent(item, box, FALSE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4108 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4109 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4110
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4111 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4112 * Sets the size of a given window (widget).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4113 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4114 * handle: Window (widget) handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4115 * width: New width in pixels.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4116 * height: New height in pixels.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4117 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4118 void dw_window_set_usize(HWND handle, ULONG width, ULONG height)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4119 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4120 WinSetWindowPos(handle, NULLHANDLE, 0, 0, width, height, SWP_SHOW | SWP_SIZE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4121 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4122
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4123 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4124 * Returns the width of the screen.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4125 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4126 int dw_screen_width(void)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4127 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4128 return WinQuerySysValue(HWND_DESKTOP,SV_CXSCREEN);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4129 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4130
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4131 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4132 * Returns the height of the screen.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4133 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4134 int dw_screen_height(void)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4135 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4136 return WinQuerySysValue(HWND_DESKTOP,SV_CYSCREEN);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4137 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4138
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4139 /* This should return the current color depth */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4140 unsigned long dw_color_depth(void)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4141 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4142 HDC hdc = WinOpenWindowDC(HWND_DESKTOP);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4143 long colors;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4144
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4145 DevQueryCaps(hdc, CAPS_COLOR_BITCOUNT, 1, &colors);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4146 DevCloseDC(hdc);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4147 return colors;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4148 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4149
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4150
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4151 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4152 * Sets the position of a given window (widget).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4153 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4154 * handle: Window (widget) handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4155 * x: X location from the bottom left.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4156 * y: Y location from the bottom left.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4157 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4158 void dw_window_set_pos(HWND handle, ULONG x, ULONG y)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4159 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4160 int myy = _get_frame_height(handle) - (y + _get_height(handle));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4161
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4162 WinSetWindowPos(handle, NULLHANDLE, x, myy, 0, 0, SWP_MOVE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4163 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4164
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4165 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4166 * Sets the position and size of a given window (widget).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4167 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4168 * handle: Window (widget) handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4169 * x: X location from the bottom left.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4170 * y: Y location from the bottom left.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4171 * width: Width of the widget.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4172 * height: Height of the widget.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4173 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4174 void dw_window_set_pos_size(HWND handle, ULONG x, ULONG y, ULONG width, ULONG height)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4175 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4176 int myy = _get_frame_height(handle) - (y + height);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4177
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4178 WinSetWindowPos(handle, NULLHANDLE, x, myy, width, height, SWP_MOVE | SWP_SIZE | SWP_SHOW);
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 * Gets the position and size of a given window (widget).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4183 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4184 * handle: Window (widget) handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4185 * x: X location from the bottom left.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4186 * y: Y location from the bottom left.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4187 * width: Width of the widget.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4188 * height: Height of the widget.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4189 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4190 void dw_window_get_pos_size(HWND handle, ULONG *x, ULONG *y, ULONG *width, ULONG *height)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4191 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4192 SWP swp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4193 WinQueryWindowPos(handle, &swp);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4194 if(x)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4195 *x = swp.x;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4196 if(y)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4197 *y = _get_frame_height(handle) - (swp.y + swp.cy);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4198 if(width)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4199 *width = swp.cx;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4200 if(height)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4201 *height = swp.cy;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4202 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4203
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4204 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4205 * Sets the style of a given window (widget).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4206 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4207 * handle: Window (widget) handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4208 * width: New width in pixels.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4209 * height: New height in pixels.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4210 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4211 void dw_window_set_style(HWND handle, ULONG style, ULONG mask)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4212 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4213 WinSetWindowBits(handle, QWL_STYLE, style, mask);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4214 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4215
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4216 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4217 * Adds a new page to specified notebook.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4218 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4219 * handle: Window (widget) handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4220 * flags: Any additional page creation flags.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4221 * front: If TRUE page is added at the beginning.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4222 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4223 ULONG dw_notebook_page_new(HWND handle, ULONG flags, int front)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4224 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4225 if(front)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4226 return (ULONG)WinSendMsg(handle, BKM_INSERTPAGE, 0L,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4227 MPFROM2SHORT((BKA_STATUSTEXTON | BKA_AUTOPAGESIZE | BKA_MAJOR | flags), BKA_FIRST));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4228 return (ULONG)WinSendMsg(handle, BKM_INSERTPAGE, 0L,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4229 MPFROM2SHORT((BKA_STATUSTEXTON | BKA_AUTOPAGESIZE | BKA_MAJOR | flags), BKA_LAST));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4230 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4231
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4232 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4233 * Remove a page from a notebook.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4234 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4235 * handle: Handle to the notebook widget.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4236 * pageid: ID of the page to be destroyed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4237 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4238 void dw_notebook_page_destroy(HWND handle, unsigned int pageid)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4239 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4240 WinSendMsg(handle, BKM_DELETEPAGE,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4241 MPFROMLONG(pageid), (MPARAM)BKA_SINGLE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4242 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4243
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4244 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4245 * Queries the currently visible page ID.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4246 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4247 * handle: Handle to the notebook widget.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4248 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4249 unsigned int dw_notebook_page_query(HWND handle)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4250 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4251 return (int)WinSendMsg(handle, BKM_QUERYPAGEID,0L, MPFROM2SHORT(BKA_TOP, BKA_MAJOR));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4252 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4253
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4254 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4255 * Sets the currently visibale page ID.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4256 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4257 * handle: Handle to the notebook widget.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4258 * pageid: ID of the page to be made visible.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4259 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4260 void dw_notebook_page_set(HWND handle, unsigned int pageid)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4261 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4262 WinSendMsg(handle, BKM_TURNTOPAGE, MPFROMLONG(pageid), 0L);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4263 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4264
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4265 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4266 * Sets the text on the specified notebook tab.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4267 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4268 * handle: Notebook handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4269 * pageid: Page ID of the tab to set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4270 * text: Pointer to the text to set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4271 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4272 void dw_notebook_page_set_text(HWND handle, ULONG pageid, char *text)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4273 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4274 WinSendMsg(handle, BKM_SETTABTEXT,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4275 MPFROMLONG(pageid), MPFROMP(text));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4276 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4277
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4278 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4279 * Sets the text on the specified notebook tab status area.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4280 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4281 * handle: Notebook handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4282 * pageid: Page ID of the tab to set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4283 * text: Pointer to the text to set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4284 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4285 void dw_notebook_page_set_status_text(HWND handle, ULONG pageid, char *text)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4286 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4287 WinSendMsg(handle, BKM_SETSTATUSLINETEXT,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4288 MPFROMLONG(pageid), MPFROMP(text));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4289 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4290
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4291 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4292 * Packs the specified box into the notebook page.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4293 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4294 * handle: Handle to the notebook to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4295 * pageid: Page ID in the notebook which is being packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4296 * page: Box handle to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4297 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4298 void dw_notebook_pack(HWND handle, ULONG pageid, HWND page)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4299 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4300 HWND tmpbox = dw_box_new(BOXVERT, 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4301
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4302 dw_box_pack_start(tmpbox, page, 0, 0, TRUE, TRUE, 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4303 WinSubclassWindow(tmpbox, _wndproc);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4304 WinSendMsg(handle, BKM_SETPAGEWINDOWHWND,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4305 MPFROMLONG(pageid), MPFROMHWND(tmpbox));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4306 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4307
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4308 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4309 * Appends the specified text to the listbox's (or combobox) entry list.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4310 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4311 * handle: Handle to the listbox to be appended to.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4312 * text: Text to append into listbox.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4313 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4314 void dw_listbox_append(HWND handle, char *text)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4315 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4316 WinSendMsg(handle,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4317 LM_INSERTITEM,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4318 MPFROMSHORT(LIT_END),
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4319 MPFROMP(text));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4320 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4321
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4322 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4323 * Clears the listbox's (or combobox) list of all entries.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4324 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4325 * handle: Handle to the listbox to be cleared.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4326 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4327 void dw_listbox_clear(HWND handle)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4328 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4329 WinSendMsg(handle,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4330 LM_DELETEALL, 0L, 0L);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4331 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4332
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4333 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4334 * Returns the listbox's item count.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4335 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4336 * handle: Handle to the listbox to be cleared.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4337 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4338 int dw_listbox_count(HWND handle)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4339 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4340 return (int)WinSendMsg(handle,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4341 LM_QUERYITEMCOUNT,0L, 0L);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4342 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4343
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4344 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4345 * Sets the topmost item in the viewport.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4346 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4347 * handle: Handle to the listbox to be cleared.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4348 * top: Index to the top item.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4349 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4350 void dw_listbox_set_top(HWND handle, int top)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4351 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4352 WinSendMsg(handle,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4353 LM_SETTOPINDEX,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4354 MPFROMSHORT(top),
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4355 0L);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4356 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4357
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4358 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4359 * Copies the given index item's text into buffer.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4360 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4361 * handle: Handle to the listbox to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4362 * index: Index into the list to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4363 * buffer: Buffer where text will be copied.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4364 * length: Length of the buffer (including NULL).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4365 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4366 void dw_listbox_query_text(HWND handle, unsigned int index, char *buffer, unsigned int length)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4367 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4368 WinSendMsg(handle, LM_QUERYITEMTEXT, MPFROM2SHORT(index, length), (MPARAM)buffer);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4369 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4370
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4371 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4372 * Sets the text of a given listbox entry.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4373 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4374 * handle: Handle to the listbox to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4375 * index: Index into the list to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4376 * buffer: Buffer where text will be copied.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4377 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4378 void dw_listbox_set_text(HWND handle, unsigned int index, char *buffer)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4379 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4380 WinSendMsg(handle, LM_SETITEMTEXT, MPFROMSHORT(index), (MPARAM)buffer);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4381 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4382
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4383 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4384 * Returns the index to the item in the list currently selected.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4385 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4386 * handle: Handle to the listbox to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4387 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4388 unsigned int dw_listbox_selected(HWND handle)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4389 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4390 return (unsigned int)WinSendMsg(handle,
18
f1002d51d959 Fixed a container problem on OS/2 with separator set to 0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 16
diff changeset
4391 LM_QUERYSELECTION,
f1002d51d959 Fixed a container problem on OS/2 with separator set to 0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 16
diff changeset
4392 MPFROMSHORT(LIT_CURSOR),
f1002d51d959 Fixed a container problem on OS/2 with separator set to 0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 16
diff changeset
4393 0);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4394 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4395
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4396 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4397 * Returns the index to the current selected item or -1 when done.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4398 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4399 * handle: Handle to the listbox to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4400 * where: Either the previous return or -1 to restart.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4401 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4402 int dw_listbox_selected_multi(HWND handle, int where)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4403 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4404 int place = where;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4405
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4406 if(where == -1)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4407 place = LIT_FIRST;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4408
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4409 place = (int)WinSendMsg(handle,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4410 LM_QUERYSELECTION,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4411 MPFROMSHORT(place),0L);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4412 if(place == LIT_NONE)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4413 return -1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4414 return place;
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 * Sets the selection state of a given index.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4419 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4420 * handle: Handle to the listbox to be set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4421 * index: Item index.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4422 * state: TRUE if selected FALSE if unselected.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4423 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4424 void dw_listbox_select(HWND handle, int index, int state)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4425 {
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
4426 char tmpbuf[100];
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
4427
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4428 WinSendMsg(handle, LM_SELECTITEM, MPFROMSHORT(index), (MPARAM)state);
34
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
4429
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
4430 WinQueryClassName(handle, 99, tmpbuf);
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
4431
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
4432 /* If we are setting a combobox call the event handler manually */
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
4433 if(strncmp(tmpbuf, "#6", 3)==0)
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
4434 _run_event(handle, WM_CONTROL, MPFROM2SHORT(0, LN_SELECT), (MPARAM)handle);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4435 }
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 * Deletes the item with given index from the list.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4439 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4440 * handle: Handle to the listbox to be set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4441 * index: Item index.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4442 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4443 void dw_listbox_delete(HWND handle, int index)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4444 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4445 WinSendMsg(handle, LM_DELETEITEM, MPFROMSHORT(index), 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4446 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4447
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4448 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4449 * Adds text to an MLE box and returns the current point.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4450 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4451 * handle: Handle to the MLE to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4452 * buffer: Text buffer to be imported.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4453 * startpoint: Point to start entering text.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4454 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4455 unsigned int dw_mle_import(HWND handle, char *buffer, int startpoint)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4456 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4457 unsigned long point = startpoint;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4458 PBYTE mlebuf;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4459
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4460 /* Work around 64K limit */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4461 if(!DosAllocMem((PPVOID) &mlebuf, 65536, PAG_COMMIT | PAG_READ | PAG_WRITE | OBJ_TILE))
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4462 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4463 int amount, len = strlen(buffer), written = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4464
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4465 while(written < len)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4466 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4467 if((len - written) > 65535)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4468 amount = 65535;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4469 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4470 amount = len - written;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4471
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4472 memcpy(mlebuf, &buffer[written], amount);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4473 mlebuf[amount] = '\0';
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4474
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4475 WinSendMsg(handle, MLM_SETIMPORTEXPORT, MPFROMP(mlebuf), MPFROMLONG(amount+1));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4476 WinSendMsg(handle, MLM_IMPORT, MPFROMP(&point), MPFROMLONG(amount + 1));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4477 dw_mle_delete(handle, point, 1);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4478
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4479 written += amount;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4480 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4481 DosFreeMem(mlebuf);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4482 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4483 return point - 1;
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 * Grabs text from an MLE box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4488 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4489 * handle: Handle to the MLE to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4490 * buffer: Text buffer to be exported.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4491 * startpoint: Point to start grabbing text.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4492 * length: Amount of text to be grabbed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4493 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4494 void dw_mle_export(HWND handle, char *buffer, int startpoint, int length)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4495 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4496 PBYTE mlebuf;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4497
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4498 /* Work around 64K limit */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4499 if(!DosAllocMem((PPVOID) &mlebuf, 65535, PAG_COMMIT | PAG_READ | PAG_WRITE | OBJ_TILE))
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4500 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4501 int amount, copied, written = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4502
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4503 while(written < length)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4504 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4505 if((length - written) > 65535)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4506 amount = 65535;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4507 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4508 amount = length - written;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4509
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4510 WinSendMsg(handle, MLM_SETIMPORTEXPORT, MPFROMP(mlebuf), MPFROMLONG(amount));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4511 copied = (int)WinSendMsg(handle, MLM_EXPORT, MPFROMP(&startpoint), MPFROMLONG(&amount));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4512
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4513 if(copied)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4514 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4515 memcpy(&buffer[written], mlebuf, copied);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4516
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4517 written += copied;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4518 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4519 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4520 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4521 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4522 DosFreeMem(mlebuf);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4523 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4524 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4525
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4526 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4527 * Obtains information about an MLE box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4528 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4529 * handle: Handle to the MLE to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4530 * bytes: A pointer to a variable to return the total bytes.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4531 * lines: A pointer to a variable to return the number of lines.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4532 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4533 void dw_mle_query(HWND handle, unsigned long *bytes, unsigned long *lines)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4534 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4535 if(bytes)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4536 *bytes = (unsigned long)WinSendMsg(handle, MLM_QUERYTEXTLENGTH, 0, 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4537 if(lines)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4538 *lines = (unsigned long)WinSendMsg(handle, MLM_QUERYLINECOUNT, 0, 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4539 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4540
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4541 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4542 * Deletes text from an MLE box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4543 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4544 * handle: Handle to the MLE to be deleted from.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4545 * startpoint: Point to start deleting text.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4546 * length: Amount of text to be deleted.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4547 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4548 void dw_mle_delete(HWND handle, int startpoint, int length)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4549 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4550 char *buf = malloc(length+1);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4551 int z, dellen = length;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4552
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4553 dw_mle_export(handle, buf, startpoint, length);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4554
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4555 for(z=0;z<length-1;z++)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4556 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4557 if(strncmp(&buf[z], "\r\n", 2) == 0)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4558 dellen--;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4559 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4560 WinSendMsg(handle, MLM_DELETE, MPFROMLONG(startpoint), MPFROMLONG(dellen));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4561 free(buf);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4562 }
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 * Clears all text from an MLE box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4566 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4567 * handle: Handle to the MLE to be cleared.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4568 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4569 void dw_mle_clear(HWND handle)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4570 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4571 unsigned long bytes;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4572
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4573 dw_mle_query(handle, &bytes, NULL);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4574
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4575 WinSendMsg(handle, MLM_DELETE, MPFROMLONG(0), MPFROMLONG(bytes));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4576 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4577
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4578 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4579 * Sets the visible line of an MLE box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4580 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4581 * handle: Handle to the MLE to be positioned.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4582 * line: Line to be visible.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4583 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4584 void dw_mle_set_visible(HWND handle, int line)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4585 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4586 int tmppnt;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4587
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4588 if(line > 10)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4589 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4590 tmppnt = (int)WinSendMsg(handle, MLM_CHARFROMLINE, MPFROMLONG(line - 10), 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4591 WinSendMsg(handle, MLM_SETFIRSTCHAR, MPFROMLONG(tmppnt), 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4592 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4593 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4594
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4595 /*
7
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
4596 * Sets the editablity of an MLE box.
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
4597 * Parameters:
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
4598 * handle: Handle to the MLE.
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
4599 * 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
4600 */
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
4601 void dw_mle_set_editable(HWND handle, int state)
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
4602 {
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
4603 WinSendMsg(handle, MLM_SETREADONLY, MPFROMLONG(state ? FALSE : TRUE), 0);
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
4604 }
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
4605
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
4606 /*
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
4607 * Sets the word wrap state of an MLE box.
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
4608 * Parameters:
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
4609 * handle: Handle to the MLE.
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
4610 * 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
4611 */
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
4612 void dw_mle_set_word_wrap(HWND handle, int state)
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
4613 {
16
ca7a8215487a Removed structure packing option to fix a crash in dw_mle_search() when
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 15
diff changeset
4614 WinSendMsg(handle, MLM_SETWRAP, MPFROMLONG(state), 0);
7
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
4615 }
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
4616
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
4617 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4618 * Sets the current cursor position of an MLE box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4619 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4620 * handle: Handle to the MLE to be positioned.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4621 * point: Point to position cursor.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4622 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4623 void dw_mle_set(HWND handle, int point)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4624 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4625 WinSendMsg(handle, MLM_SETSEL, MPFROMLONG(point), MPFROMLONG(point));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4626 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4627
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4628 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4629 * Finds text in an MLE box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4630 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4631 * handle: Handle to the MLE to be cleared.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4632 * text: Text to search for.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4633 * point: Start point of search.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4634 * flags: Search specific flags.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4635 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4636 int dw_mle_search(HWND handle, char *text, int point, unsigned long flags)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4637 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4638 MLE_SEARCHDATA msd;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4639
16
ca7a8215487a Removed structure packing option to fix a crash in dw_mle_search() when
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 15
diff changeset
4640 /* This code breaks with structure packing set to 1 (/Sp1 in VAC)
ca7a8215487a Removed structure packing option to fix a crash in dw_mle_search() when
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 15
diff changeset
4641 * if this is needed we need to add a pragma here.
ca7a8215487a Removed structure packing option to fix a crash in dw_mle_search() when
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 15
diff changeset
4642 */
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4643 msd.cb = sizeof(msd);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4644 msd.pchFind = text;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4645 msd.pchReplace = NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4646 msd.cchFind = strlen(text);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4647 msd.cchReplace = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4648 msd.iptStart = point;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4649 msd.iptStop = -1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4650
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4651 if(WinSendMsg(handle, MLM_SEARCH, MPFROMLONG(MLFSEARCH_SELECTMATCH | flags), (MPARAM)&msd))
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4652 return (int)WinSendMsg(handle, MLM_QUERYSEL,(MPARAM)MLFQS_MAXSEL, 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4653 return 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4654 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4655
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4656 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4657 * Stops redrawing of an MLE box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4658 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4659 * handle: Handle to the MLE to freeze.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4660 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4661 void dw_mle_freeze(HWND handle)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4662 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4663 WinSendMsg(handle, MLM_DISABLEREFRESH, 0, 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4664 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4665
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4666 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4667 * Resumes redrawing of an MLE box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4668 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4669 * handle: Handle to the MLE to thaw.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4670 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4671 void dw_mle_thaw(HWND handle)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4672 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4673 WinSendMsg(handle, MLM_ENABLEREFRESH, 0, 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4674 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4675
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4676 /*
33
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
4677 * Returns the range of the percent bar.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4678 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4679 * handle: Handle to the slider to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4680 */
33
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
4681 unsigned int dw_percent_query_range(HWND handle)
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
4682 {
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
4683 unsigned long width;
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
4684
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
4685 dw_window_get_pos_size(handle, 0, 0, &width, 0);
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
4686
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
4687 if(width - 6 < 1)
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
4688 return 1;
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
4689 return width - 6;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4690 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4691
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4692 /*
33
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
4693 * Sets the percent bar position.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4694 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4695 * handle: Handle to the slider to be set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4696 * position: Position of the slider withing the range.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4697 */
33
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
4698 void dw_percent_set_pos(HWND handle, unsigned int position)
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
4699 {
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
4700 PercentBar *pb = (PercentBar *)WinQueryWindowPtr(handle, 0);
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
4701
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
4702 if(pb)
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
4703 {
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
4704 RECTL rcl;
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
4705
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
4706 pb->pos = position;
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
4707 WinQueryWindowRect(handle, &rcl);
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
4708 WinInvalidateRect(handle, &rcl, FALSE);
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
4709 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4710 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4711
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4712 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4713 * Sets the spinbutton value.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4714 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4715 * handle: Handle to the spinbutton to be set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4716 * position: Current value of the spinbutton.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4717 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4718 void dw_spinbutton_set_pos(HWND handle, long position)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4719 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4720 WinSendMsg(handle, SPBM_SETCURRENTVALUE, MPFROMLONG((long)position), 0L);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4721 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4722
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4723 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4724 * Sets the spinbutton limits.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4725 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4726 * handle: Handle to the spinbutton to be set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4727 * upper: Upper limit.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4728 * lower: Lower limit.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4729 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4730 void dw_spinbutton_set_limits(HWND handle, long upper, long lower)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4731 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4732 WinSendMsg(handle, SPBM_SETLIMITS, MPFROMLONG(upper), MPFROMLONG(lower));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4733 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4734
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4735 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4736 * Sets the entryfield character limit.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4737 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4738 * handle: Handle to the spinbutton to be set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4739 * limit: Number of characters the entryfield will take.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4740 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4741 void dw_entryfield_set_limit(HWND handle, ULONG limit)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4742 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4743 WinSendMsg(handle, EM_SETTEXTLIMIT, (MPARAM)limit, (MPARAM)0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4744 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4745
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4746
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4747 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4748 * Returns the current value of the spinbutton.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4749 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4750 * handle: Handle to the spinbutton to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4751 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4752 long dw_spinbutton_query(HWND handle)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4753 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4754 long tmpval = 0L;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4755
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4756 WinSendMsg(handle, SPBM_QUERYVALUE, (MPARAM)&tmpval,0L);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4757 return tmpval;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4758 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4759
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4760 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4761 * Returns the state of the checkbox.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4762 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4763 * handle: Handle to the checkbox to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4764 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4765 int dw_checkbox_query(HWND handle)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4766 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4767 return (int)WinSendMsg(handle,BM_QUERYCHECK,0,0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4768 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4769
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4770 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4771 * Sets the state of the checkbox.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4772 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4773 * handle: Handle to the checkbox to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4774 * value: TRUE for checked, FALSE for unchecked.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4775 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4776 void dw_checkbox_set(HWND handle, int value)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4777 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4778 WinSendMsg(handle,BM_SETCHECK,MPFROMSHORT(value),0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4779 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4780
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
4781 /*
60
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
4782 * Inserts an item into a tree window (widget) after another item.
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
4783 * Parameters:
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
4784 * handle: Handle to the tree to be inserted.
60
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
4785 * item: Handle to the item to be positioned after.
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
4786 * title: The text title of the entry.
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
4787 * icon: Handle to coresponding icon.
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
4788 * 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
4789 * 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
4790 */
60
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
4791 HWND dw_tree_insert_after(HWND handle, HWND item, char *title, unsigned long icon, HWND parent, void *itemdata)
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
4792 {
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
4793 ULONG cbExtra;
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
4794 PCNRITEM pci;
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
4795 RECORDINSERT ri;
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
4796
60
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
4797 if(!item)
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
4798 item = CMA_FIRST;
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
4799
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
4800 /* Calculate extra bytes needed for each record besides that needed for the
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
4801 * MINIRECORDCORE structure
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
4802 */
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
4803
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
4804 cbExtra = sizeof(CNRITEM) - sizeof(MINIRECORDCORE);
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
4805
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
4806 /* Allocate memory for the parent record */
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
4807
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
4808 pci = WinSendMsg(handle, CM_ALLOCRECORD, MPFROMLONG(cbExtra), MPFROMSHORT(1));
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
4809
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
4810 /* Fill in the parent record data */
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
4811
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
4812 pci->rc.cb = sizeof(MINIRECORDCORE);
55
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
4813 pci->rc.pszIcon = strdup(title);
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
4814 pci->rc.hptrIcon = icon;
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
4815
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
4816 pci->hptrIcon = icon;
54
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
4817 pci->user = itemdata;
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
4818
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
4819 memset(&ri, 0, sizeof(RECORDINSERT));
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
4820
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
4821 ri.cb = sizeof(RECORDINSERT);
60
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
4822 ri.pRecordOrder = (PRECORDCORE)item;
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
4823 ri.pRecordParent = (PRECORDCORE)NULL;
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
4824 ri.zOrder = (USHORT)CMA_TOP;
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
4825 ri.cRecordsInsert = 1;
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
4826 ri.fInvalidateRecord = TRUE;
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
4827
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
4828 /* We are about to insert the child records. Set the parent record to be
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
4829 * the one we just inserted.
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
4830 */
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
4831 ri.pRecordParent = (PRECORDCORE)parent;
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
4832
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
4833 /* Insert the record */
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
4834 WinSendMsg(handle, CM_INSERTRECORD, MPFROMP(pci), MPFROMP(&ri));
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
4835
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
4836 return (HWND)pci;
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
4837 }
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
4838
30
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
4839 /*
60
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
4840 * Inserts an item into a tree window (widget).
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
4841 * Parameters:
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
4842 * handle: Handle to the tree to be inserted.
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
4843 * title: The text title of the entry.
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
4844 * icon: Handle to coresponding icon.
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
4845 * parent: Parent handle or 0 if root.
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
4846 * itemdata: Item specific data.
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
4847 */
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
4848 HWND dw_tree_insert(HWND handle, char *title, unsigned long icon, HWND parent, void *itemdata)
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
4849 {
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
4850 return dw_tree_insert_after(handle, (HWND)CMA_END, title, icon, parent, itemdata);
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
4851 }
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
4852
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
4853 /*
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
4854 * 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
4855 * 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
4856 * 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
4857 * 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
4858 * 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
4859 * 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
4860 */
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
4861 void dw_tree_set(HWND handle, HWND item, char *title, unsigned long 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
4862 {
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
4863 PCNRITEM pci = (PCNRITEM)item;
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
4864
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
4865 if(!pci)
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
4866 return;
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
4867
55
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
4868 if(pci->rc.pszIcon)
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
4869 free(pci->rc.pszIcon);
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
4870
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
4871 pci->rc.pszIcon = strdup(title);
54
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
4872 pci->rc.hptrIcon = icon;
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
4873
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
4874 pci->hptrIcon = icon;
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
4875
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
4876 WinSendMsg(handle, CM_INVALIDATERECORD, (MPARAM)&pci, MPFROM2SHORT(1, CMA_TEXTCHANGED));
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
4877 }
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
4878
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
4879 /*
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
4880 * 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
4881 * 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
4882 * 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
4883 * 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
4884 * 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
4885 */
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
4886 void dw_tree_set_data(HWND handle, HWND item, void *itemdata)
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
4887 {
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
4888 PCNRITEM pci = (PCNRITEM)item;
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
4889
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
4890 if(!pci)
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
4891 return;
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
4892
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
4893 pci->user = itemdata;
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
4894 }
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
4895
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
4896 /*
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
4897 * 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
4898 * 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
4899 * 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
4900 * 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
4901 */
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
4902 void dw_tree_item_select(HWND handle, HWND 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
4903 {
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
4904 PRECORDCORE pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)0L, MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER));
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
4905
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
4906 while(pCore)
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
4907 {
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
4908 if(pCore->flRecordAttr & CRA_SELECTED)
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
4909 WinSendMsg(handle, CM_SETRECORDEMPHASIS, (MPARAM)pCore, MPFROM2SHORT(FALSE, CRA_SELECTED | CRA_CURSORED));
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
4910 pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)pCore, MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER));
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
4911 }
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
4912 WinSendMsg(handle, CM_SETRECORDEMPHASIS, (MPARAM)item, MPFROM2SHORT(TRUE, CRA_SELECTED | CRA_CURSORED));
55
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
4913 lastitem = 0;
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
4914 lasthcnr = 0;
54
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
4915 }
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
4916
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
4917 /*
30
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
4918 * Removes all nodes from a tree.
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
4919 * Parameters:
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
4920 * handle: Handle to the window (widget) to be cleared.
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
4921 */
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
4922 void dw_tree_clear(HWND handle)
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
4923 {
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
4924 WinSendMsg(handle, CM_REMOVERECORD, (MPARAM)0L, MPFROM2SHORT(0, CMA_INVALIDATE | CMA_FREE));
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
4925 }
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
4926
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
4927 /*
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
4928 * 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
4929 * 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
4930 * 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
4931 * 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
4932 */
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
4933 void dw_tree_expand(HWND handle, HWND 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
4934 {
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
4935 WinSendMsg(handle, CM_EXPANDTREE, MPFROMP(item), 0);
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
4936 }
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
4937
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
4938 /*
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
4939 * 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
4940 * 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
4941 * 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
4942 * 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
4943 */
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
4944 void dw_tree_collapse(HWND handle, HWND 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
4945 {
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
4946 WinSendMsg(handle, CM_COLLAPSETREE, MPFROMP(item), 0);
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
4947 }
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
4948
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
4949 /*
30
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
4950 * Removes a node from a tree.
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
4951 * Parameters:
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
4952 * handle: Handle to the window (widget) to be cleared.
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
4953 * item: Handle to node to be deleted.
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
4954 */
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
4955 void dw_tree_delete(HWND handle, HWND item)
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
4956 {
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
4957 PCNRITEM pci = (PCNRITEM)item;
55
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
4958
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
4959 if(!item)
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
4960 return;
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
4961
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
4962 if(pci->rc.pszIcon)
60
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
4963 {
55
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
4964 free(pci->rc.pszIcon);
60
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
4965 pci->rc.pszIcon = 0;
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
4966 }
55
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
4967
30
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
4968 WinSendMsg(handle, CM_REMOVERECORD, (MPARAM)&pci, MPFROM2SHORT(1, CMA_INVALIDATE | CMA_FREE));
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
4969 }
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
4970
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
4971 /* Some OS/2 specific container structs */
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
4972 typedef struct _containerinfo {
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
4973 int count;
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
4974 void *data;
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
4975 HWND handle;
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
4976 } ContainerInfo;
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
4977
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4978 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4979 * Sets up the container columns.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4980 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4981 * handle: Handle to the container to be configured.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4982 * flags: An array of unsigned longs with column flags.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4983 * titles: An array of strings with column text titles.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4984 * count: The number of columns (this should match the arrays).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4985 * separator: The column number that contains the main separator.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4986 * (this item may only be used in OS/2)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4987 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4988 int dw_container_setup(HWND handle, unsigned long *flags, char **titles, int count, int separator)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4989 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4990 PFIELDINFO details, first, left = NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4991 FIELDINFOINSERT detin;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4992 CNRINFO cnri;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4993 int z;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4994 ULONG size = sizeof(RECORDCORE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4995 ULONG *offStruct = malloc(count * sizeof(ULONG));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4996 ULONG *tempflags = malloc((count+1) * sizeof(ULONG));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4997 ULONG *oldflags = (ULONG *)WinQueryWindowPtr(handle, 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4998
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4999 if(!offStruct || !tempflags)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5000 return FALSE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5001
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5002 memcpy(tempflags, flags, count * sizeof(ULONG));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5003 tempflags[count] = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5004
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5005 WinSetWindowPtr(handle, 0, tempflags);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5006
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5007 if(oldflags)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5008 free(oldflags);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5009
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5010 while((first = (PFIELDINFO)WinSendMsg(handle, CM_QUERYDETAILFIELDINFO, 0, MPFROMSHORT(CMA_FIRST))) != NULL)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5011 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5012 WinSendMsg(handle, CM_REMOVEDETAILFIELDINFO, (MPARAM)&first, MPFROM2SHORT(1, CMA_FREE));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5013 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5014
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5015 /* Figure out the offsets to the items in the struct */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5016 for(z=0;z<count;z++)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5017 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5018 offStruct[z] = size;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5019 if(flags[z] & DW_CFA_BITMAPORICON)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5020 size += sizeof(HPOINTER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5021 else if(flags[z] & DW_CFA_STRING)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5022 size += sizeof(char *);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5023 else if(flags[z] & DW_CFA_ULONG)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5024 size += sizeof(ULONG);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5025 else if(flags[z] & DW_CFA_DATE)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5026 size += sizeof(CDATE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5027 else if(flags[z] & DW_CFA_TIME)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5028 size += sizeof(CTIME);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5029 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5030
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5031 first = details = (PFIELDINFO)WinSendMsg(handle, CM_ALLOCDETAILFIELDINFO, MPFROMLONG(count), 0L);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5032
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5033 if(!first)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5034 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5035 free(offStruct);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5036 return FALSE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5037 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5038
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5039 for(z=0;z<count;z++)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5040 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5041 if(z==separator-1)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5042 left=details;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5043 details->cb = sizeof(FIELDINFO);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5044 details->flData = flags[z];
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5045 details->flTitle = CFA_FITITLEREADONLY;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5046 details->pTitleData = titles[z];
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5047 details->offStruct = offStruct[z];
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5048 details = details->pNextFieldInfo;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5049 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5050
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5051 detin.cb = sizeof(FIELDINFOINSERT);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5052 detin.fInvalidateFieldInfo = FALSE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5053 detin.pFieldInfoOrder = (PFIELDINFO) CMA_FIRST;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5054 detin.cFieldInfoInsert = (ULONG)count;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5055
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5056 WinSendMsg(handle, CM_INSERTDETAILFIELDINFO, MPFROMP(first), MPFROMP(&detin));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5057
18
f1002d51d959 Fixed a container problem on OS/2 with separator set to 0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 16
diff changeset
5058 if(count > separator && separator > 0)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5059 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5060 cnri.cb = sizeof(CNRINFO);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5061 cnri.pFieldInfoLast = left;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5062 cnri.xVertSplitbar = 150;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5063
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5064 WinSendMsg(handle, CM_SETCNRINFO, MPFROMP(&cnri), MPFROMLONG(CMA_PFIELDINFOLAST | CMA_XVERTSPLITBAR));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5065 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5066
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5067 free(offStruct);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5068 return TRUE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5069 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5070
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5071 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5072 * Sets up the filesystem columns, note: filesystem always has an icon/filename field.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5073 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5074 * handle: Handle to the container to be configured.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5075 * flags: An array of unsigned longs with column flags.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5076 * titles: An array of strings with column text titles.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5077 * count: The number of columns (this should match the arrays).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5078 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5079 int dw_filesystem_setup(HWND handle, unsigned long *flags, char **titles, int count)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5080 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5081 char **newtitles = malloc(sizeof(char *) * (count + 2));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5082 unsigned long *newflags = malloc(sizeof(unsigned long) * (count + 2));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5083
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5084 newtitles[0] = "Icon";
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5085 newtitles[1] = "Filename";
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5086
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5087 newflags[0] = DW_CFA_BITMAPORICON | DW_CFA_CENTER | DW_CFA_HORZSEPARATOR | DW_CFA_SEPARATOR;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5088 newflags[1] = DW_CFA_STRING | DW_CFA_LEFT | DW_CFA_HORZSEPARATOR;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5089
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5090 memcpy(&newtitles[2], titles, sizeof(char *) * count);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5091 memcpy(&newflags[2], flags, sizeof(unsigned long) * count);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5092
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5093 dw_container_setup(handle, newflags, newtitles, count + 2, 2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5094
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5095 free(newtitles);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5096 free(newflags);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5097 return TRUE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5098 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5099
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5100 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5101 * Obtains an icon from a module (or header in GTK).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5102 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5103 * module: Handle to module (DLL) in OS/2 and Windows.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5104 * id: A unsigned long id int the resources on OS/2 and
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5105 * Windows, on GTK this is converted to a pointer
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5106 * to an embedded XPM.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5107 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5108 unsigned long dw_icon_load(unsigned long module, unsigned long id)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5109 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5110 return WinLoadPointer(HWND_DESKTOP,module,id);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5111 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5112
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5113 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5114 * Frees a loaded resource in OS/2 and Windows.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5115 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5116 * handle: Handle to icon returned by dw_icon_load().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5117 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5118 void dw_icon_free(unsigned long handle)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5119 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5120 WinDestroyPointer(handle);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5121 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5122
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5123 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5124 * Allocates memory used to populate a container.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5125 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5126 * handle: Handle to the container window (widget).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5127 * rowcount: The number of items to be populated.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5128 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5129 void *dw_container_alloc(HWND handle, int rowcount)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5130 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5131 ULONG *flags = (ULONG *)WinQueryWindowPtr(handle, 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5132 int z, size = 0, totalsize, count = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5133 PRECORDCORE temp;
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5134 ContainerInfo *ci;
34
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
5135 void *blah = NULL;
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
5136
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
5137 if(!flags || rowcount < 1)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5138 return NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5139
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5140 while(flags[count])
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5141 count++;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5142
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5143 /* Figure out the offsets to the items in the struct */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5144 for(z=0;z<count;z++)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5145 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5146 if(flags[z] & DW_CFA_BITMAPORICON)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5147 size += sizeof(HPOINTER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5148 else if(flags[z] & DW_CFA_STRING)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5149 size += sizeof(char *);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5150 else if(flags[z] & DW_CFA_ULONG)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5151 size += sizeof(ULONG);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5152 else if(flags[z] & DW_CFA_DATE)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5153 size += sizeof(CDATE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5154 else if(flags[z] & DW_CFA_TIME)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5155 size += sizeof(CTIME);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5156 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5157
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5158 totalsize = size + sizeof(RECORDCORE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5159
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
5160 z = 0;
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
5161
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
5162 while((blah = (void *)WinSendMsg(handle, CM_ALLOCRECORD, MPFROMLONG(size), MPFROMLONG(rowcount))) == NULL)
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
5163 {
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
5164 z++;
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
5165 if(z > 5000000)
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
5166 break;
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
5167 DosSleep(1);
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
5168 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5169
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5170 if(!blah)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5171 return NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5172
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5173 temp = (PRECORDCORE)blah;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5174
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5175 for(z=0;z<rowcount;z++)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5176 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5177 temp->cb = totalsize;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5178 temp = temp->preccNextRecord;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5179 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5180
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5181 ci = malloc(sizeof(struct _containerinfo));
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5182
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5183 ci->count = rowcount;
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5184 ci->data = blah;
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5185 ci->handle = handle;
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5186
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5187 return (void *)ci;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5188 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5189
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5190 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5191 * Sets an item in specified row and column to the given data.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5192 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5193 * handle: Handle to the container window (widget).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5194 * pointer: Pointer to the allocated memory in dw_container_alloc().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5195 * column: Zero based column of data being set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5196 * row: Zero based row of data being set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5197 * data: Pointer to the data to be added.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5198 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5199 void dw_container_set_item(HWND handle, void *pointer, int column, int row, void *data)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5200 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5201 ULONG totalsize, size = 0, *flags = (ULONG *)WinQueryWindowPtr(handle, 0);
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5202 int z, currentcount;
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5203 ContainerInfo *ci = (ContainerInfo *)pointer;
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5204 PRECORDCORE temp;
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5205 CNRINFO cnr;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5206 void *dest;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5207
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5208 if(!ci)
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5209 return;
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5210
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5211 if(!flags)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5212 return;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5213
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5214 temp = (PRECORDCORE)ci->data;
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5215
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5216 WinSendMsg(handle, CM_QUERYCNRINFO, (MPARAM)&cnr, MPFROMSHORT(sizeof(CNRINFO)));
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5217 currentcount = cnr.cRecords;
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5218
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5219 /* Figure out the offsets to the items in the struct */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5220 for(z=0;z<column;z++)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5221 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5222 if(flags[z] & DW_CFA_BITMAPORICON)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5223 size += sizeof(HPOINTER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5224 else if(flags[z] & DW_CFA_STRING)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5225 size += sizeof(char *);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5226 else if(flags[z] & DW_CFA_ULONG)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5227 size += sizeof(ULONG);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5228 else if(flags[z] & DW_CFA_DATE)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5229 size += sizeof(CDATE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5230 else if(flags[z] & DW_CFA_TIME)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5231 size += sizeof(CTIME);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5232 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5233
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5234 totalsize = size + sizeof(RECORDCORE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5235
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5236 for(z=0;z<(row-currentcount);z++)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5237 temp = temp->preccNextRecord;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5238
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5239 dest = (void *)(((ULONG)temp)+((ULONG)totalsize));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5240
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5241 if(flags[column] & DW_CFA_BITMAPORICON)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5242 memcpy(dest, data, sizeof(HPOINTER));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5243 else if(flags[column] & DW_CFA_STRING)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5244 memcpy(dest, data, sizeof(char *));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5245 else if(flags[column] & DW_CFA_ULONG)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5246 memcpy(dest, data, sizeof(ULONG));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5247 else if(flags[column] & DW_CFA_DATE)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5248 memcpy(dest, data, sizeof(CDATE));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5249 else if(flags[column] & DW_CFA_TIME)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5250 memcpy(dest, data, sizeof(CTIME));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5251 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5252
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5253 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5254 * Sets an item in specified row and column to the given data.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5255 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5256 * handle: Handle to the container window (widget).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5257 * pointer: Pointer to the allocated memory in dw_container_alloc().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5258 * column: Zero based column of data being set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5259 * row: Zero based row of data being set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5260 * data: Pointer to the data to be added.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5261 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5262 void dw_filesystem_set_file(HWND handle, void *pointer, int row, char *filename, unsigned long icon)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5263 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5264 dw_container_set_item(handle, pointer, 0, row, (void *)&icon);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5265 dw_container_set_item(handle, pointer, 1, row, (void *)&filename);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5266 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5267
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5268 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5269 * Sets an item in specified row and column to the given data.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5270 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5271 * handle: Handle to the container window (widget).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5272 * pointer: Pointer to the allocated memory in dw_container_alloc().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5273 * column: Zero based column of data being set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5274 * row: Zero based row of data being set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5275 * data: Pointer to the data to be added.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5276 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5277 void dw_filesystem_set_item(HWND handle, void *pointer, int column, int row, void *data)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5278 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5279 dw_container_set_item(handle, pointer, column + 2, row, data);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5280 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5281
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5282 /*
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5283 * Sets the width of a column in the container.
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5284 * Parameters:
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5285 * handle: Handle to window (widget) of container.
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5286 * column: Zero based column of width being set.
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5287 * width: Width of column in pixels.
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5288 */
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5289 void dw_container_set_column_width(HWND handle, int column, int width)
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5290 {
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5291 }
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5292
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5293 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5294 * Sets the title of a row in the container.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5295 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5296 * pointer: Pointer to the allocated memory in dw_container_alloc().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5297 * row: Zero based row of data being set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5298 * title: String title of the item.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5299 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5300 void dw_container_set_row_title(void *pointer, int row, char *title)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5301 {
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5302 ContainerInfo *ci = (ContainerInfo *)pointer;
34
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
5303 PRECORDCORE temp;
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5304 int z, currentcount;
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5305 CNRINFO cnr;
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5306
23
2932f9d2c7d5 New OS/2 code from FX changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 22
diff changeset
5307 if(!ci)
2932f9d2c7d5 New OS/2 code from FX changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 22
diff changeset
5308 return;
2932f9d2c7d5 New OS/2 code from FX changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 22
diff changeset
5309
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
5310 temp = (PRECORDCORE)ci->data;
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
5311
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5312 WinSendMsg(ci->handle, CM_QUERYCNRINFO, (MPARAM)&cnr, MPFROMSHORT(sizeof(CNRINFO)));
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5313 currentcount = cnr.cRecords;
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5314
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5315 for(z=0;z<(row-currentcount);z++)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5316 temp = temp->preccNextRecord;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5317
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5318 temp->pszIcon = title;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5319 temp->pszName = title;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5320 temp->pszText = title;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5321 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5322
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5323 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5324 * Sets the title of a row in the container.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5325 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5326 * handle: Handle to the container window (widget).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5327 * pointer: Pointer to the allocated memory in dw_container_alloc().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5328 * rowcount: The number of rows to be inserted.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5329 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5330 void dw_container_insert(HWND handle, void *pointer, int rowcount)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5331 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5332 RECORDINSERT recin;
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5333 ContainerInfo *ci = (ContainerInfo *)pointer;
34
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
5334 int z;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5335
23
2932f9d2c7d5 New OS/2 code from FX changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 22
diff changeset
5336 if(!ci)
2932f9d2c7d5 New OS/2 code from FX changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 22
diff changeset
5337 return;
2932f9d2c7d5 New OS/2 code from FX changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 22
diff changeset
5338
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5339 recin.cb = sizeof(RECORDINSERT);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5340 recin.pRecordOrder = (PRECORDCORE)CMA_END;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5341 recin.pRecordParent = NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5342 recin.zOrder = CMA_TOP;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5343 recin.fInvalidateRecord = TRUE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5344 recin.cRecordsInsert = rowcount;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5345
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
5346 z = 0;
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
5347
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
5348 while(WinSendMsg(handle, CM_INSERTRECORD, MPFROMP(ci->data), MPFROMP(&recin)) == 0)
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
5349 {
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
5350 z++;
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
5351 if(z > 5000000)
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
5352 break;
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
5353 DosSleep(1);
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
5354 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5355 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5356
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5357 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5358 * Removes all rows from a container.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5359 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5360 * 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
5361 * 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
5362 */
0804483f6320 Added a redraw parameter to dw_container_clear().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 49
diff changeset
5363 void dw_container_clear(HWND handle, int redraw)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5364 {
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
5365 int z = 0;
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
5366
52
0804483f6320 Added a redraw parameter to dw_container_clear().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 49
diff changeset
5367 while((int)WinSendMsg(handle, CM_REMOVERECORD, (MPARAM)0L, MPFROM2SHORT(0, (redraw ? CMA_INVALIDATE : 0) | CMA_FREE)) == -1)
34
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
5368 {
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
5369 z++;
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
5370 if(z > 5000000)
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
5371 break;
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
5372 DosSleep(1);
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
5373 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5374 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5375
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5376 /*
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5377 * Removes the first x rows from a container.
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5378 * Parameters:
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5379 * handle: Handle to the window (widget) to be deleted from.
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5380 * rowcount: The number of rows to be deleted.
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5381 */
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5382 void dw_container_delete(HWND handle, int rowcount)
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5383 {
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5384 RECORDCORE *last, **prc = malloc(sizeof(RECORDCORE *) * rowcount);
34
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
5385 int current = 1, z;
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5386
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5387 prc[0] = last = (RECORDCORE *)WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)0L, MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER));
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5388
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5389 while(last && current < rowcount)
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5390 {
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5391 prc[current] = last = (RECORDCORE *)WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)last, MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER));
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5392 current++;
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5393 }
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
5394
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
5395 z = 0;
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
5396
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
5397 while((int)WinSendMsg(handle, CM_REMOVERECORD, (MPARAM)prc, MPFROM2SHORT(current, CMA_INVALIDATE | CMA_FREE)) == -1)
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
5398 {
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
5399 z++;
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
5400 if(z > 5000000)
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
5401 break;
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
5402 DosSleep(1);
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
5403 }
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
5404
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5405 free(prc);
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5406 }
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5407
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5408 /*
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5409 * Scrolls container up or down.
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5410 * Parameters:
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5411 * handle: Handle to the window (widget) to be scrolled.
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5412 * direction: DW_SCROLL_UP, DW_SCROLL_DOWN, DW_SCROLL_TOP or
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5413 * DW_SCROLL_BOTTOM. (rows is ignored for last two)
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5414 * rows: The number of rows to be scrolled.
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5415 */
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5416 void dw_container_scroll(HWND handle, int direction, long rows)
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5417 {
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5418 switch(direction)
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5419 {
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5420 case DW_SCROLL_TOP:
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5421 WinSendMsg(handle, CM_SCROLLWINDOW, MPFROMSHORT(CMA_VERTICAL), MPFROMLONG(-10000000));
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5422 break;
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5423 case DW_SCROLL_BOTTOM:
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5424 WinSendMsg(handle, CM_SCROLLWINDOW, MPFROMSHORT(CMA_VERTICAL), MPFROMLONG(10000000));
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5425 break;
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5426 }
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5427 }
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5428
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5429 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5430 * Removes all rows from a container.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5431 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5432 * handle: Handle to the window (widget) to be cleared.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5433 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5434 void dw_container_set_view(HWND handle, unsigned long flags, int iconwidth, int iconheight)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5435 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5436 CNRINFO cnrinfo;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5437
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5438 cnrinfo.flWindowAttr = flags;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5439 cnrinfo.slBitmapOrIcon.cx = iconwidth;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5440 cnrinfo.slBitmapOrIcon.cy = iconheight;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5441
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5442 WinSendMsg(handle, CM_SETCNRINFO, &cnrinfo, MPFROMLONG(CMA_FLWINDOWATTR | CMA_SLBITMAPORICON));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5443 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5444
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5445 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5446 * Starts a new query of a container.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5447 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5448 * handle: Handle to the window (widget) to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5449 * flags: If this parameter is DW_CRA_SELECTED it will only
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5450 * return items that are currently selected. Otherwise
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5451 * it will return all records in the container.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5452 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5453 char *dw_container_query_start(HWND handle, unsigned long flags)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5454 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5455 pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)0L, MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5456 if(pCore)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5457 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5458 if(flags)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5459 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5460 while(pCore)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5461 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5462 if(pCore->flRecordAttr & CRA_SELECTED)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5463 return pCore->pszIcon;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5464 pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)pCore, MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5465 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5466 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5467 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5468 return pCore->pszIcon;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5469 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5470 return NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5471 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5472
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5473 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5474 * Continues an existing query of a container.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5475 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5476 * handle: Handle to the window (widget) to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5477 * flags: If this parameter is DW_CRA_SELECTED it will only
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5478 * return items that are currently selected. Otherwise
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5479 * it will return all records in the container.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5480 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5481 char *dw_container_query_next(HWND handle, unsigned long flags)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5482 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5483 pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)pCore, MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5484 if(pCore)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5485 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5486 if(flags)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5487 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5488 while(pCore)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5489 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5490 if(pCore->flRecordAttr & CRA_SELECTED)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5491 return pCore->pszIcon;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5492
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5493 pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)pCore, MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5494 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5495 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5496 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5497 return pCore->pszIcon;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5498 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5499 return NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5500 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5501
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5502 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5503 * Creates a rendering context widget (window) to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5504 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5505 * id: An id to be used with dw_window_from_id.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5506 * Returns:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5507 * A handle to the widget or NULL on failure.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5508 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5509 HWND dw_render_new(unsigned long id)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5510 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5511 HWND hwndframe = WinCreateWindow(HWND_OBJECT,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5512 WC_FRAME,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5513 NULL,
47
997e9ed670ef Fixes for box alignment problem on OS/2, crash in dw_bitmap_new() on unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 40
diff changeset
5514 WS_VISIBLE |
997e9ed670ef Fixes for box alignment problem on OS/2, crash in dw_bitmap_new() on unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 40
diff changeset
5515 FS_NOBYTEALIGN,
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5516 0,0,2000,1000,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5517 NULLHANDLE,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5518 HWND_TOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5519 id,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5520 NULL,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5521 NULL);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5522 WinSubclassWindow(hwndframe, _RendProc);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5523 return hwndframe;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5524 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5525
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5526 /* Sets the current foreground drawing color.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5527 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5528 * red: red value.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5529 * green: green value.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5530 * blue: blue value.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5531 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5532 void dw_color_foreground_set(unsigned long value)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5533 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5534 _foreground = DW_RED_VALUE(value) << 16 | DW_GREEN_VALUE(value) << 8 | DW_BLUE_VALUE(value);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5535 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5536
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5537 /* Sets the current background drawing color.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5538 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5539 * red: red value.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5540 * green: green value.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5541 * blue: blue value.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5542 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5543 void dw_color_background_set(unsigned long value)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5544 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5545 _background = DW_RED_VALUE(value) << 16 | DW_GREEN_VALUE(value) << 8 | DW_BLUE_VALUE(value);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5546 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5547
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5548 HPS _set_hps(HPS hps)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5549 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5550 LONG alTable[18];
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5551
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5552 GpiQueryLogColorTable(hps, 0L, 0L, 18L, alTable);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5553
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5554 alTable[16] = _foreground;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5555 alTable[17] = _background;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5556
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5557 GpiCreateLogColorTable(hps,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5558 0L,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5559 LCOLF_CONSECRGB,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5560 0L,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5561 18,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5562 alTable);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5563 GpiSetColor(hps, 16);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5564 GpiSetBackColor(hps, 17);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5565 return hps;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5566 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5567
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5568 HPS _set_colors(HWND handle)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5569 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5570 HPS hps = WinGetPS(handle);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5571
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5572 _set_hps(hps);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5573 return hps;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5574 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5575
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5576 /* Draw a point on a window (preferably a render window).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5577 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5578 * handle: Handle to the window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5579 * pixmap: Handle to the pixmap. (choose only one of these)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5580 * x: X coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5581 * y: Y coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5582 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5583 void dw_draw_point(HWND handle, HPIXMAP pixmap, int x, int y)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5584 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5585 HPS hps;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5586 int height;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5587 POINTL ptl;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5588
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5589 if(handle)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5590 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5591 hps = _set_colors(handle);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5592 height = _get_height(handle);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5593 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5594 else if(pixmap)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5595 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5596 hps = _set_hps(pixmap->hps);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5597 height = pixmap->height;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5598 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5599 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5600 return;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5601
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5602 ptl.x = x;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5603 ptl.y = height - y - 1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5604
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5605 GpiSetPel(hps, &ptl);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5606 if(!pixmap)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5607 WinReleasePS(hps);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5608 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5609
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5610 /* Draw a line on a window (preferably a render window).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5611 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5612 * handle: Handle to the window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5613 * pixmap: Handle to the pixmap. (choose only one of these)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5614 * x1: First X coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5615 * y1: First Y coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5616 * x2: Second X coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5617 * y2: Second Y coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5618 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5619 void dw_draw_line(HWND handle, HPIXMAP pixmap, int x1, int y1, int x2, int y2)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5620 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5621 HPS hps;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5622 int height;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5623 POINTL ptl[2];
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5624
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5625 if(handle)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5626 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5627 hps = _set_colors(handle);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5628 height = _get_height(handle);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5629 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5630 else if(pixmap)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5631 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5632 hps = _set_hps(pixmap->hps);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5633 height = pixmap->height;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5634 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5635 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5636 return;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5637
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5638 ptl[0].x = x1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5639 ptl[0].y = height - y1 - 1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5640 ptl[1].x = x2;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5641 ptl[1].y = height - y2 - 1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5642
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5643 GpiMove(hps, &ptl[0]);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5644 GpiLine(hps, &ptl[1]);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5645
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5646 if(!pixmap)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5647 WinReleasePS(hps);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5648 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5649
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5650
9
3383ed751a7e New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 8
diff changeset
5651 void _CopyFontSettings(HPS hpsSrc, HPS hpsDst)
3383ed751a7e New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 8
diff changeset
5652 {
3383ed751a7e New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 8
diff changeset
5653 FONTMETRICS fm;
3383ed751a7e New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 8
diff changeset
5654 FATTRS fat;
3383ed751a7e New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 8
diff changeset
5655 SIZEF sizf;
3383ed751a7e New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 8
diff changeset
5656
3383ed751a7e New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 8
diff changeset
5657 GpiQueryFontMetrics(hpsSrc, sizeof(FONTMETRICS), &fm);
3383ed751a7e New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 8
diff changeset
5658
3383ed751a7e New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 8
diff changeset
5659 memset(&fat, 0, sizeof(fat));
3383ed751a7e New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 8
diff changeset
5660
3383ed751a7e New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 8
diff changeset
5661 fat.usRecordLength = sizeof(FATTRS);
3383ed751a7e New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 8
diff changeset
5662 fat.lMatch = fm.lMatch;
3383ed751a7e New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 8
diff changeset
5663 strcpy(fat.szFacename, fm.szFacename);
3383ed751a7e New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 8
diff changeset
5664
3383ed751a7e New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 8
diff changeset
5665 GpiCreateLogFont(hpsDst, 0, 1L, &fat);
3383ed751a7e New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 8
diff changeset
5666 GpiSetCharSet(hpsDst, 1L);
3383ed751a7e New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 8
diff changeset
5667
3383ed751a7e New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 8
diff changeset
5668 sizf.cx = MAKEFIXED(fm.lEmInc,0);
3383ed751a7e New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 8
diff changeset
5669 sizf.cy = MAKEFIXED(fm.lMaxBaselineExt,0);
3383ed751a7e New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 8
diff changeset
5670 GpiSetCharBox(hpsDst, &sizf );
3383ed751a7e New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 8
diff changeset
5671 }
3383ed751a7e New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 8
diff changeset
5672
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5673 /* Draw text on a window (preferably a render window).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5674 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5675 * handle: Handle to the window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5676 * pixmap: Handle to the pixmap. (choose only one of these)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5677 * x: X coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5678 * y: Y coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5679 * text: Text to be displayed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5680 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5681 void dw_draw_text(HWND handle, HPIXMAP pixmap, int x, int y, char *text)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5682 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5683 HPS hps;
9
3383ed751a7e New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 8
diff changeset
5684 int size = 9, z, height;
3383ed751a7e New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 8
diff changeset
5685 RECTL rcl;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5686 char fontname[128];
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5687
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5688 if(handle)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5689 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5690 hps = _set_colors(handle);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5691 height = _get_height(handle);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5692 _GetPPFont(handle, fontname);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5693 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5694 else if(pixmap)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5695 {
9
3383ed751a7e New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 8
diff changeset
5696 HPS pixmaphps = WinGetPS(pixmap->handle);
3383ed751a7e New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 8
diff changeset
5697
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5698 hps = _set_hps(pixmap->hps);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5699 height = pixmap->height;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5700 _GetPPFont(pixmap->handle, fontname);
9
3383ed751a7e New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 8
diff changeset
5701 _CopyFontSettings(pixmaphps, hps);
3383ed751a7e New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 8
diff changeset
5702 WinReleasePS(pixmaphps);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5703 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5704 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5705 return;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5706
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5707 for(z=0;z<strlen(fontname);z++)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5708 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5709 if(fontname[z]=='.')
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5710 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5711 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5712 size = atoi(fontname);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5713
9
3383ed751a7e New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 8
diff changeset
5714 rcl.xLeft = x;
3383ed751a7e New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 8
diff changeset
5715 rcl.yTop = height - y;
3383ed751a7e New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 8
diff changeset
5716 rcl.yBottom = rcl.yTop - (size*2);
3383ed751a7e New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 8
diff changeset
5717 rcl.xRight = rcl.xLeft + (size * strlen(text));
3383ed751a7e New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 8
diff changeset
5718
3383ed751a7e New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 8
diff changeset
5719 WinDrawText(hps, -1, text, &rcl, DT_TEXTATTRS, DT_TEXTATTRS, DT_VCENTER | DT_LEFT | DT_TEXTATTRS);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5720
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5721 if(!pixmap)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5722 WinReleasePS(hps);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5723 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5724
49
bf42d08d72d7 Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 47
diff changeset
5725 /* Query the width and height of a text string.
bf42d08d72d7 Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 47
diff changeset
5726 * Parameters:
bf42d08d72d7 Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 47
diff changeset
5727 * handle: Handle to the window.
bf42d08d72d7 Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 47
diff changeset
5728 * pixmap: Handle to the pixmap. (choose only one of these)
bf42d08d72d7 Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 47
diff changeset
5729 * text: Text to be queried.
bf42d08d72d7 Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 47
diff changeset
5730 * width: Pointer to a variable to be filled in with the width.
bf42d08d72d7 Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 47
diff changeset
5731 * height Pointer to a variable to be filled in with the height.
bf42d08d72d7 Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 47
diff changeset
5732 */
bf42d08d72d7 Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 47
diff changeset
5733 void dw_font_text_extents(HWND handle, HPIXMAP pixmap, char *text, int *width, int *height)
bf42d08d72d7 Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 47
diff changeset
5734 {
bf42d08d72d7 Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 47
diff changeset
5735 HPS hps;
bf42d08d72d7 Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 47
diff changeset
5736 POINTL aptl[TXTBOX_COUNT];
bf42d08d72d7 Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 47
diff changeset
5737
bf42d08d72d7 Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 47
diff changeset
5738 if(handle)
bf42d08d72d7 Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 47
diff changeset
5739 {
bf42d08d72d7 Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 47
diff changeset
5740 hps = _set_colors(handle);
bf42d08d72d7 Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 47
diff changeset
5741 }
bf42d08d72d7 Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 47
diff changeset
5742 else if(pixmap)
bf42d08d72d7 Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 47
diff changeset
5743 {
bf42d08d72d7 Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 47
diff changeset
5744 HPS pixmaphps = WinGetPS(pixmap->handle);
bf42d08d72d7 Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 47
diff changeset
5745
bf42d08d72d7 Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 47
diff changeset
5746 hps = _set_hps(pixmap->hps);
bf42d08d72d7 Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 47
diff changeset
5747 _CopyFontSettings(pixmaphps, hps);
bf42d08d72d7 Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 47
diff changeset
5748 WinReleasePS(pixmaphps);
bf42d08d72d7 Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 47
diff changeset
5749 }
bf42d08d72d7 Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 47
diff changeset
5750 else
bf42d08d72d7 Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 47
diff changeset
5751 return;
bf42d08d72d7 Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 47
diff changeset
5752
bf42d08d72d7 Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 47
diff changeset
5753 GpiQueryTextBox(hps, strlen(text), text, TXTBOX_COUNT, aptl);
bf42d08d72d7 Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 47
diff changeset
5754
bf42d08d72d7 Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 47
diff changeset
5755 if(width)
bf42d08d72d7 Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 47
diff changeset
5756 *width = aptl[TXTBOX_TOPRIGHT].x - aptl[TXTBOX_TOPLEFT].x;
bf42d08d72d7 Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 47
diff changeset
5757
bf42d08d72d7 Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 47
diff changeset
5758 if(height)
bf42d08d72d7 Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 47
diff changeset
5759 *height = aptl[TXTBOX_TOPLEFT].y - aptl[TXTBOX_BOTTOMLEFT].y;
bf42d08d72d7 Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 47
diff changeset
5760
bf42d08d72d7 Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 47
diff changeset
5761 if(!pixmap)
bf42d08d72d7 Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 47
diff changeset
5762 WinReleasePS(hps);
bf42d08d72d7 Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 47
diff changeset
5763 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5764
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5765 /* Draw a rectangle on a window (preferably a render window).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5766 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5767 * handle: Handle to the window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5768 * pixmap: Handle to the pixmap. (choose only one of these)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5769 * fill: Fill box TRUE or FALSE.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5770 * x: X coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5771 * y: Y coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5772 * width: Width of rectangle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5773 * height: Height of rectangle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5774 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5775 void dw_draw_rect(HWND handle, HPIXMAP pixmap, int fill, int x, int y, int width, int height)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5776 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5777 HPS hps;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5778 int thisheight;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5779 POINTL ptl[2];
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5780
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5781 if(handle)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5782 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5783 hps = _set_colors(handle);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5784 thisheight = _get_height(handle);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5785 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5786 else if(pixmap)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5787 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5788 hps = _set_hps(pixmap->hps);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5789 thisheight = pixmap->height;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5790 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5791 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5792 return;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5793
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5794 ptl[0].x = x;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5795 ptl[0].y = thisheight - y - 1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5796 ptl[1].x = x + width - 1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5797 ptl[1].y = thisheight - y - height;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5798
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5799 GpiMove(hps, &ptl[0]);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5800 GpiBox(hps, fill ? DRO_OUTLINEFILL : DRO_OUTLINE, &ptl[1], 0, 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5801
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5802 if(!pixmap)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5803 WinReleasePS(hps);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5804 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5805
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5806 /* Call this after drawing to the screen to make sure
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5807 * anything you have drawn is visible.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5808 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5809 void dw_flush(void)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5810 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5811 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5812
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5813 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5814 * Creates a pixmap with given parameters.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5815 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5816 * handle: Window handle the pixmap is associated with.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5817 * width: Width of the pixmap in pixels.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5818 * height: Height of the pixmap in pixels.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5819 * depth: Color depth of the pixmap.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5820 * Returns:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5821 * A handle to a pixmap or NULL on failure.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5822 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5823 HPIXMAP dw_pixmap_new(HWND handle, unsigned long width, unsigned long height, int depth)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5824 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5825 BITMAPINFOHEADER bmih;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5826 SIZEL sizl = { 0, 0 };
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5827 HPIXMAP pixmap;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5828 HDC hdc;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5829 HPS hps;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5830 ULONG ulFlags;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5831 LONG cPlanes, cBitCount;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5832
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5833 if (!(pixmap = calloc(1,sizeof(struct _hpixmap))))
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5834 return NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5835
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5836 hps = WinGetPS(handle);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5837
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5838 hdc = GpiQueryDevice(hps);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5839 ulFlags = GpiQueryPS(hps, &sizl);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5840
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5841 pixmap->handle = handle;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5842 pixmap->hdc = DevOpenDC(dwhab, OD_MEMORY, "*", 0L, NULL, hdc);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5843 pixmap->hps = GpiCreatePS (dwhab, pixmap->hdc, &sizl, ulFlags | GPIA_ASSOC);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5844
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5845 DevQueryCaps(hdc, CAPS_COLOR_PLANES , 1L, &cPlanes);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5846 if (!depth)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5847 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5848 DevQueryCaps(hdc, CAPS_COLOR_BITCOUNT, 1L, &cBitCount);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5849 depth = cBitCount;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5850 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5851
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5852 memset(&bmih, 0, sizeof(BITMAPINFOHEADER));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5853 bmih.cbFix = sizeof(BITMAPINFOHEADER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5854 bmih.cx = (SHORT)width;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5855 bmih.cy = (SHORT)height;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5856 bmih.cPlanes = (SHORT)cPlanes;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5857 bmih.cBitCount = (SHORT)depth;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5858
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5859 pixmap->width = width; pixmap->height = height;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5860
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5861 pixmap->hbm = GpiCreateBitmap(pixmap->hps, (PBITMAPINFOHEADER2)&bmih, 0L, NULL, NULL);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5862
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5863 GpiSetBitmap(pixmap->hps, pixmap->hbm);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5864
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5865 if (depth>8)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5866 GpiCreateLogColorTable(pixmap->hps, LCOL_PURECOLOR, LCOLF_RGB, 0, 0, NULL );
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5867
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5868 WinReleasePS(hps);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5869
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5870 return pixmap;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5871 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5872
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5873 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5874 * Creates a pixmap from internal resource graphic specified by id.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5875 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5876 * handle: Window handle the pixmap is associated with.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5877 * id: Resource ID associated with requested pixmap.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5878 * Returns:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5879 * A handle to a pixmap or NULL on failure.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5880 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5881 HPIXMAP dw_pixmap_grab(HWND handle, ULONG id)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5882 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5883 BITMAPINFOHEADER bmih;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5884 SIZEL sizl = { 0, 0 };
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5885 HPIXMAP pixmap;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5886 HDC hdc;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5887 HPS hps;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5888 ULONG ulFlags;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5889
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5890 if (!(pixmap = calloc(1,sizeof(struct _hpixmap))))
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5891 return NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5892
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5893 hps = WinGetPS(handle);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5894
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5895 hdc = GpiQueryDevice(hps);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5896 ulFlags = GpiQueryPS(hps, &sizl);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5897
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5898 pixmap->hdc = DevOpenDC(dwhab, OD_MEMORY, "*", 0L, NULL, hdc);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5899 pixmap->hps = GpiCreatePS (dwhab, pixmap->hdc, &sizl, ulFlags | GPIA_ASSOC);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5900
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5901 pixmap->hbm = GpiLoadBitmap(pixmap->hps, NULLHANDLE, id, 0, 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5902
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5903 GpiQueryBitmapParameters(pixmap->hbm, &bmih);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5904
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5905 GpiSetBitmap(pixmap->hps, pixmap->hbm);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5906
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5907 pixmap->width = bmih.cx; pixmap->height = bmih.cy;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5908
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5909 WinReleasePS(hps);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5910
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5911 return pixmap;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5912 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5913
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5914 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5915 * Destroys an allocated pixmap.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5916 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5917 * pixmap: Handle to a pixmap returned by
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5918 * dw_pixmap_new..
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5919 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5920 void dw_pixmap_destroy(HPIXMAP pixmap)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5921 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5922 GpiSetBitmap(pixmap->hps, NULLHANDLE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5923 GpiDeleteBitmap(pixmap->hbm);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5924 GpiAssociate(pixmap->hps, NULLHANDLE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5925 GpiDestroyPS(pixmap->hps);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5926 DevCloseDC(pixmap->hdc);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5927 free(pixmap);
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 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5931 * Copies from one item to another.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5932 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5933 * dest: Destination window handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5934 * destp: Destination pixmap. (choose only one).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5935 * xdest: X coordinate of destination.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5936 * ydest: Y coordinate of destination.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5937 * width: Width of area to copy.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5938 * height: Height of area to copy.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5939 * src: Source window handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5940 * srcp: Source pixmap. (choose only one).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5941 * xsrc: X coordinate of source.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5942 * ysrc: Y coordinate of source.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5943 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5944 void dw_pixmap_bitblt(HWND dest, HPIXMAP destp, int xdest, int ydest, int width, int height, HWND src, HPIXMAP srcp, int xsrc, int ysrc)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5945 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5946 HPS hpsdest;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5947 HPS hpssrc;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5948 POINTL ptl[4];
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5949 int destheight, srcheight;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5950
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5951 if(dest)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5952 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5953 hpsdest = WinGetPS(dest);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5954 destheight = _get_height(dest);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5955 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5956 else if(destp)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5957 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5958 hpsdest = destp->hps;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5959 destheight = destp->height;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5960 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5961 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5962 return;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5963
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5964 if(src)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5965 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5966 hpssrc = WinGetPS(src);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5967 srcheight = _get_height(src);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5968 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5969 else if(srcp)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5970 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5971 hpssrc = srcp->hps;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5972 srcheight = srcp->height;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5973 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5974 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5975 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5976 if(!destp)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5977 WinReleasePS(hpsdest);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5978 return;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5979 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5980
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5981 ptl[0].x = xdest;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5982 ptl[0].y = (destheight - ydest) - height;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5983 ptl[1].x = ptl[0].x + width;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5984 ptl[1].y = destheight - ydest;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5985 ptl[2].x = xsrc;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5986 ptl[2].y = srcheight - (ysrc + height);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5987 ptl[3].x = ptl[2].x + width;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5988 ptl[3].y = ptl[2].y + height;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5989
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5990 GpiBitBlt(hpsdest, hpssrc, 4, ptl, ROP_SRCCOPY, BBO_IGNORE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5991
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5992 if(!destp)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5993 WinReleasePS(hpsdest);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5994 if(!srcp)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5995 WinReleasePS(hpssrc);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5996 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5997
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5998 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5999 * Emits a beep.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6000 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6001 * freq: Frequency.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6002 * dur: Duration.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6003 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6004 void dw_beep(int freq, int dur)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6005 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6006 DosBeep(freq, dur);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6007 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6008
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6009 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6010 * Returns the handle to an unnamed mutex semaphore.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6011 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6012 HMTX dw_mutex_new(void)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6013 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6014 HMTX mutex;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6015
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6016 DosCreateMutexSem(NULL, &mutex, 0, FALSE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6017 return mutex;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6018 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6019
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6020 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6021 * Closes a semaphore created by dw_mutex_new().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6022 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6023 * mutex: The handle to the mutex returned by dw_mutex_new().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6024 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6025 void dw_mutex_close(HMTX mutex)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6026 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6027 DosCloseMutexSem(mutex);
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 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6031 * Tries to gain access to the semaphore, if it can't it blocks.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6032 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6033 * mutex: The handle to the mutex returned by dw_mutex_new().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6034 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6035 void dw_mutex_lock(HMTX mutex)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6036 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6037 DosRequestMutexSem(mutex, SEM_INDEFINITE_WAIT);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6038 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6039
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6040 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6041 * Reliquishes the access to the semaphore.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6042 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6043 * mutex: The handle to the mutex returned by dw_mutex_new().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6044 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6045 void dw_mutex_unlock(HMTX mutex)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6046 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6047 DosReleaseMutexSem(mutex);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6048 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6049
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6050 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6051 * Returns the handle to an unnamed event semaphore.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6052 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6053 HEV dw_event_new(void)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6054 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6055 HEV blah;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6056
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6057 if(DosCreateEventSem (NULL, &blah, 0L, FALSE))
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6058 return 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6059
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6060 return blah;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6061 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6062
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6063 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6064 * Resets a semaphore created by dw_event_new().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6065 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6066 * eve: The handle to the event returned by dw_event_new().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6067 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6068 int dw_event_reset(HEV eve)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6069 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6070 ULONG count;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6071
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6072 if(DosResetEventSem(eve, &count))
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6073 return FALSE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6074 return TRUE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6075 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6076
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6077 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6078 * Posts a semaphore created by dw_event_new(). Causing all threads
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6079 * waiting on this event in dw_event_wait to continue.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6080 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6081 * eve: The handle to the event returned by dw_event_new().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6082 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6083 int dw_event_post(HEV eve)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6084 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6085 if(DosPostEventSem(eve))
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6086 return FALSE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6087 return TRUE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6088 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6089
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6090
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6091 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6092 * Waits on a semaphore created by dw_event_new(), until the
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6093 * event gets posted or until the timeout expires.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6094 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6095 * eve: The handle to the event returned by dw_event_new().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6096 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6097 int dw_event_wait(HEV eve, unsigned long timeout)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6098 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6099 int rc = DosWaitEventSem(eve, timeout);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6100 if(!rc)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6101 return 1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6102 if(rc == ERROR_TIMEOUT)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6103 return -1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6104 return 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6105 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6106
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6107 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6108 * Closes a semaphore created by dw_event_new().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6109 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6110 * eve: The handle to the event returned by dw_event_new().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6111 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6112 int dw_event_close(HEV *eve)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6113 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6114 if(!eve || ~DosCloseEventSem(*eve))
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6115 return FALSE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6116 return TRUE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6117 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6118
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6119 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6120 * Encapsulate the message queues on OS/2.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6121 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6122 void _dwthreadstart(void *data)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6123 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6124 HAB thishab = WinInitialize(0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6125 HMQ thishmq = WinCreateMsgQueue(dwhab, 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6126 void (*threadfunc)(void *) = NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6127 void **tmp = (void **)data;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6128
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6129 threadfunc = (void (*)(void *))tmp[0];
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6130 threadfunc(tmp[1]);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6131
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6132 free(tmp);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6133
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6134 WinDestroyMsgQueue(thishmq);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6135 WinTerminate(thishab);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6136 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6137
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6138 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6139 * Creates a new thread with a starting point of func.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6140 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6141 * func: Function which will be run in the new thread.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6142 * data: Parameter(s) passed to the function.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6143 * stack: Stack size of new thread (OS/2 and Windows only).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6144 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6145 DWTID dw_thread_new(void *func, void *data, int stack)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6146 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6147 void **tmp = malloc(sizeof(void *) * 2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6148
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6149 tmp[0] = func;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6150 tmp[1] = data;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6151
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6152 return (DWTID)_beginthread((void (*)(void *))_dwthreadstart, NULL, stack, (void *)tmp);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6153 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6154
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6155 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6156 * Ends execution of current thread immediately.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6157 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6158 void dw_thread_end(void)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6159 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6160 _endthread();
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6161 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6162
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6163 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6164 * Returns the current thread's ID.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6165 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6166 DWTID dw_thread_id(void)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6167 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6168 return (DWTID)_threadid;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6169 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6170
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6171 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6172 * Cleanly terminates a DW session, should be signal handler safe.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6173 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6174 * exitcode: Exit code reported to the operating system.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6175 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6176 void dw_exit(int exitcode)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6177 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6178 /* In case we are in a signal handler, don't
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6179 * try to free memory that could possibly be
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6180 * free()'d by the runtime already.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6181 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6182 #ifndef NO_SIGNALS
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6183 Root = NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6184 #endif
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6185 exit(exitcode);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6186 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6187
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6188 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6189 * Pack a splitbar (sizer) into the specified box from the start.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6190 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6191 * box: Window handle of the box to be packed into.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6192 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6193 void dw_box_pack_splitbar_start(HWND box)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6194 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6195 Box *thisbox;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6196
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6197 if(WinWindowFromID(box, FID_CLIENT))
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6198 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6199 box = WinWindowFromID(box, FID_CLIENT);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6200 thisbox = WinQueryWindowPtr(box, QWP_USER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6201 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6202 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6203 thisbox = WinQueryWindowPtr(box, QWP_USER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6204 if(thisbox)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6205 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6206 HWND tmp = WinCreateWindow(HWND_OBJECT,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6207 SplitbarClassName,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6208 NULL,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6209 WS_VISIBLE,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6210 0,0,2000,1000,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6211 NULLHANDLE,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6212 HWND_TOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6213 0L,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6214 NULL,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6215 NULL);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6216 if(thisbox->type == BOXVERT)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6217 dw_box_pack_start(box, tmp, 1, SPLITBAR_WIDTH, TRUE, FALSE, 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6218 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6219 dw_box_pack_start(box, tmp, SPLITBAR_WIDTH, 1, FALSE, TRUE, 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6220
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6221 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6222 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6223
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6224 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6225 * Pack a splitbar (sizer) into the specified box from the end.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6226 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6227 * box: Window handle of the box to be packed into.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6228 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6229 void dw_box_pack_splitbar_end(HWND box)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6230 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6231 Box *thisbox;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6232
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6233 if(WinWindowFromID(box, FID_CLIENT))
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6234 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6235 box = WinWindowFromID(box, FID_CLIENT);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6236 thisbox = WinQueryWindowPtr(box, QWP_USER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6237 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6238 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6239 thisbox = WinQueryWindowPtr(box, QWP_USER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6240 if(thisbox)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6241 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6242 HWND tmp = WinCreateWindow(HWND_OBJECT,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6243 SplitbarClassName,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6244 NULL,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6245 WS_VISIBLE,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6246 0,0,2000,1000,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6247 NULLHANDLE,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6248 HWND_TOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6249 0L,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6250 NULL,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6251 NULL);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6252 if(thisbox->type == BOXVERT)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6253 dw_box_pack_end(box, tmp, 1, SPLITBAR_WIDTH, TRUE, FALSE, 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6254 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6255 dw_box_pack_end(box, tmp, SPLITBAR_WIDTH, 1, FALSE, TRUE, 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6256
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6257 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6258 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6259
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6260 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6261 * Pack windows (widgets) into a box from the start (or top).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6262 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6263 * box: Window handle of the box to be packed into.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6264 * item: Window handle of the item to be back.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6265 * width: Width in pixels of the item or -1 to be self determined.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6266 * height: Height in pixels of the item or -1 to be self determined.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6267 * hsize: TRUE if the window (widget) should expand horizontally to fill space given.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6268 * vsize: TRUE if the window (widget) should expand vertically to fill space given.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6269 * pad: Number of pixels of padding around the item.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6270 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6271 void dw_box_pack_start(HWND box, HWND item, int width, int height, int hsize, int vsize, int pad)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6272 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6273 Box *thisbox;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6274
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6275 if(WinWindowFromID(box, FID_CLIENT))
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6276 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6277 box = WinWindowFromID(box, FID_CLIENT);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6278 thisbox = WinQueryWindowPtr(box, QWP_USER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6279 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6280 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6281 thisbox = WinQueryWindowPtr(box, QWP_USER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6282 if(thisbox)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6283 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6284 if(thisbox->type == BOXHORZ)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6285 dw_box_pack_end_stub(box, item, width, height, hsize, vsize, pad);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6286 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6287 dw_box_pack_start_stub(box, item, width, height, hsize, vsize, pad);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6288 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6289 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6290
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6291 void dw_box_pack_start_stub(HWND box, HWND item, int width, int height, int hsize, int vsize, int pad)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6292 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6293 HWND boxowner = NULLHANDLE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6294 Box *thisbox;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6295
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6296 if(WinWindowFromID(box, FID_CLIENT))
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6297 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6298 box = WinWindowFromID(box, FID_CLIENT);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6299 thisbox = WinQueryWindowPtr(box, QWP_USER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6300 hsize = TRUE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6301 vsize = TRUE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6302 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6303 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6304 thisbox = WinQueryWindowPtr(box, QWP_USER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6305 if(thisbox)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6306 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6307 int z;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6308 Item *tmpitem, *thisitem = thisbox->items;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6309 char tmpbuf[100];
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6310
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6311 tmpitem = malloc(sizeof(Item)*(thisbox->count+1));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6312
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6313 for(z=0;z<thisbox->count;z++)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6314 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6315 tmpitem[z+1] = thisitem[z];
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6316 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6317
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6318 WinQueryClassName(item, 99, tmpbuf);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6319
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
6320 if(strncmp(tmpbuf, "#1", 3)==0)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6321 tmpitem[0].type = TYPEBOX;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6322 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6323 tmpitem[0].type = TYPEITEM;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6324
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6325 tmpitem[0].hwnd = item;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6326 tmpitem[0].origwidth = tmpitem[0].width = width;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6327 tmpitem[0].origheight = tmpitem[0].height = height;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6328 tmpitem[0].pad = pad;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6329 if(hsize)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6330 tmpitem[0].hsize = SIZEEXPAND;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6331 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6332 tmpitem[0].hsize = SIZESTATIC;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6333
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6334 if(vsize)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6335 tmpitem[0].vsize = SIZEEXPAND;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6336 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6337 tmpitem[0].vsize = SIZESTATIC;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6338
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6339 thisbox->items = tmpitem;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6340
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6341 if(thisbox->count)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6342 free(thisitem);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6343
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6344 thisbox->count++;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6345
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6346 WinQueryClassName(item, 99, tmpbuf);
37
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
6347 /* Don't set the ownership if it's an entryfield or spinbutton */
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
6348 if(strncmp(tmpbuf, "#6", 3)!=0 && strncmp(tmpbuf, "#32", 3)!=0)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6349 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6350 if((boxowner = WinQueryWindow(box, QW_OWNER)) != 0)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6351 WinSetOwner(item, boxowner);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6352 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6353 WinSetOwner(item, box);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6354 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6355 WinSetParent(item, box, FALSE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6356 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6357 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6358
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6359 /* The following two functions graciously contributed by Peter Nielsen. */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6360 static ULONG _ParseBuildLevel (char* pchBuffer, ULONG ulSize) {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6361 char* pchStart = pchBuffer;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6362 char* pchEnd = pchStart + ulSize - 2;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6363
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6364 while (pchEnd >= pchStart)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6365 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6366 if ((pchEnd[0] == '#') && (pchEnd[1] == '@'))
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6367 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6368 *pchEnd-- = '\0';
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6369 while (pchEnd >= pchStart)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6370 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6371 if ((pchEnd[0] == '@') && (pchEnd[1] == '#'))
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6372 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6373 ULONG ulMajor = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6374 ULONG ulMinor = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6375
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6376 char* pch = pchEnd + 2;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6377 while (!isdigit (*pch) && *pch)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6378 pch++;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6379
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6380 while (isdigit (*pch))
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6381 ulMajor = ulMajor * 10 + *pch++ - '0';
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6382
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6383 if (*pch == '.')
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6384 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6385 while (isdigit (*++pch))
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6386 ulMinor = ulMinor * 10 + *pch - '0';
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6387 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6388 return ((ulMajor << 16) | ulMinor);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6389 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6390 pchEnd--;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6391 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6392 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6393 pchEnd--;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6394 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6395 return (0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6396 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6397
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6398 ULONG _GetSystemBuildLevel(void) {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6399 /* The build level info is normally available in the end of the OS2KRNL file. However, this is not the case in some beta versions of OS/2.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6400 * We first try to find the info in the 256 last bytes of the file. If that fails, we load the entire file and search it completely.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6401 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6402 ULONG ulBootDrive = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6403 ULONG ulBuild = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6404 if (DosQuerySysInfo (QSV_BOOT_DRIVE, QSV_BOOT_DRIVE, &ulBootDrive, sizeof (ulBootDrive)) == NO_ERROR)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6405 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6406 char achFileName[11] = { (char)('A'+ulBootDrive-1),':','\\','O','S','2','K','R','N','L','\0' };
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6407 HFILE hfile;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6408 ULONG ulResult;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6409 if (DosOpen (achFileName, &hfile, &ulResult, 0, 0, OPEN_ACTION_FAIL_IF_NEW | OPEN_ACTION_OPEN_IF_EXISTS, OPEN_FLAGS_FAIL_ON_ERROR | OPEN_FLAGS_NO_CACHE | OPEN_FLAGS_SEQUENTIAL | OPEN_SHARE_DENYNONE | OPEN_ACCESS_READONLY, NULL) == NO_ERROR)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6410 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6411 ULONG ulFileSize = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6412 if (DosSetFilePtr (hfile, 0, FILE_END, &ulFileSize) == NO_ERROR)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6413 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6414 const ULONG ulFirstTry = min (256, ulFileSize);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6415 if (DosSetFilePtr (hfile, -(LONG)ulFirstTry, FILE_END, &ulResult) == NO_ERROR)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6416 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6417 char *pchBuffer = malloc(ulFirstTry);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6418 if (DosRead (hfile, pchBuffer, ulFirstTry, &ulResult) == NO_ERROR)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6419 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6420 ulBuild = _ParseBuildLevel (pchBuffer, ulFirstTry);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6421 if (ulBuild == 0)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6422 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6423 if (DosSetFilePtr (hfile, 0, FILE_BEGIN, &ulResult) == NO_ERROR)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6424 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6425 free(pchBuffer);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6426 pchBuffer = malloc(ulFileSize);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6427
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6428 if (DosRead (hfile, pchBuffer, ulFileSize, &ulResult) == NO_ERROR)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6429 ulBuild = _ParseBuildLevel (pchBuffer, ulFileSize);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6430 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6431 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6432 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6433 free(pchBuffer);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6434 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6435 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6436 DosClose (hfile);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6437 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6438 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6439 return (ulBuild);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6440 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6441
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
6442 /*
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
6443 * 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
6444 * 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
6445 * 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
6446 * 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
6447 */
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
6448 void dw_window_default(HWND window, HWND defaultitem)
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
6449 {
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
6450 Box *thisbox = NULL;
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
6451 HWND box;
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
6452
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
6453 box = WinWindowFromID(window, FID_CLIENT);
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
6454 if(box)
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
6455 thisbox = WinQueryWindowPtr(box, QWP_USER);
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
6456
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
6457 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
6458 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
6459 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6460
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6461 /*
40
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
6462 * 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
6463 * Parameters:
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
6464 * 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
6465 * 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
6466 */
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
6467 void dw_window_click_default(HWND window, HWND next)
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
6468 {
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
6469 WindowData *blah = (WindowData *)WinQueryWindowPtr(window, QWP_USER);
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
6470 char tmpbuf[100];
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
6471
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
6472 WinQueryClassName(window, 99, tmpbuf);
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
6473
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
6474 /* 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
6475 * obtain input focus.
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
6476 */
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
6477 if(strncmp(tmpbuf, "#6", 3) == 0 && blah)
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
6478 blah->clickdefault = next;
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
6479 }
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
6480
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
6481 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6482 * Returns some information about the current operating environment.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6483 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6484 * env: Pointer to a DWEnv struct.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6485 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6486 void dw_environment_query(DWEnv *env)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6487 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6488 ULONG Build;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6489
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6490 if(!env)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6491 return;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6492
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6493 /* The default is OS/2 2.0 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6494 strcpy(env->osName,"OS/2");
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6495 env->MajorVersion = 2;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6496 env->MinorVersion = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6497
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6498 Build = _GetSystemBuildLevel();
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6499 env->MinorBuild = Build & 0xFFFF;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6500 env->MajorBuild = Build >> 16;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6501
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6502 if (aulBuffer[0] == 20)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6503 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6504 int i = (unsigned int)aulBuffer[1];
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6505 if (i > 20)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6506 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6507 strcpy(env->osName,"Warp");
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6508 env->MajorVersion = (int)i/10;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6509 env->MinorVersion = i-(((int)i/10)*10);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6510 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6511 else if (i == 10)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6512 env->MinorVersion = 1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6513 }
15
81833f25b1aa Added new Dynamic Windows build information to the DWEnv struct.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 14
diff changeset
6514 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
6515 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
6516 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
6517 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
6518 env->DWSubVersion = DW_SUB_VERSION;
3
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 * Opens a file dialog and queries user selection.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6523 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6524 * title: Title bar text for dialog.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6525 * defpath: The default path of the open dialog.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6526 * ext: Default file extention.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6527 * flags: DW_FILE_OPEN or DW_FILE_SAVE.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6528 * Returns:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6529 * NULL on error. A malloced buffer containing
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6530 * the file path on success.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6531 *
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6532 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6533 char *dw_file_browse(char *title, char *defpath, char *ext, int flags)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6534 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6535 FILEDLG fild;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6536 HWND hwndFile;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6537 int len;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6538
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6539 if(defpath)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6540 strcpy(fild.szFullFile, defpath);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6541 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6542 strcpy(fild.szFullFile, "");
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6543
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6544 len = strlen(fild.szFullFile);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6545
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6546 if(len)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6547 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6548 if(fild.szFullFile[len-1] != '\\')
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6549 strcat(fild.szFullFile, "\\");
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6550 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6551 strcat(fild.szFullFile, "*");
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6552
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6553 if(ext)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6554 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6555 strcat(fild.szFullFile, ".");
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6556 strcat(fild.szFullFile, ext);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6557 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6558
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6559 fild.cbSize = sizeof(FILEDLG);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6560 fild.fl = /*FDS_HELPBUTTON |*/ FDS_CENTER | FDS_OPEN_DIALOG;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6561 fild.pszTitle = title;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6562 fild.pszOKButton = ((flags & DW_FILE_SAVE) ? "Save" : "Open");
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6563 fild.ulUser = 0L;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6564 fild.pfnDlgProc = (PFNWP)WinDefFileDlgProc;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6565 fild.lReturn = 0L;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6566 fild.lSRC = 0L;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6567 fild.hMod = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6568 fild.x = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6569 fild.y = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6570 fild.pszIType = (PSZ)NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6571 fild.papszITypeList = (PAPSZ)NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6572 fild.pszIDrive = (PSZ)NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6573 fild.papszIDriveList= (PAPSZ)NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6574 fild.sEAType = (SHORT)0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6575 fild.papszFQFilename= (PAPSZ)NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6576 fild.ulFQFCount = 0L;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6577
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6578 hwndFile = WinFileDlg(HWND_DESKTOP, HWND_DESKTOP, &fild);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6579 if(hwndFile)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6580 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6581 switch(fild.lReturn)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6582 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6583 case DID_OK:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6584 return strdup(fild.szFullFile);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6585 case DID_CANCEL:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6586 return NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6587 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6588 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6589 return NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6590 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6591
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6592 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6593 * Execute and external program in a seperate session.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6594 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6595 * program: Program name with optional path.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6596 * type: Either DW_EXEC_CON or DW_EXEC_GUI.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6597 * params: An array of pointers to string arguements.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6598 * Returns:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6599 * -1 on error.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6600 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6601 int dw_exec(char *program, int type, char **params)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6602 {
55
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
6603 return spawnvp(P_NOWAIT, program, (const char **)params);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6604 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6605
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6606 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6607 * Loads a web browser pointed at the given URL.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6608 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6609 * url: Uniform resource locator.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6610 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6611 int dw_browse(char *url)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6612 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6613 /* Is there a way to find the webbrowser in Unix? */
20
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
6614 char *execargs[3], browser[1024], *newurl = NULL;
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
6615 int len;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6616
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6617 PrfQueryProfileString(HINI_USERPROFILE, "WPURLDEFAULTSETTINGS",
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6618 "DefaultBrowserExe", NULL, browser, 1024);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6619
20
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
6620 len = strlen(browser) - strlen("explore.exe");
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
6621
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6622 execargs[0] = browser;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6623 execargs[1] = url;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6624 execargs[2] = NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6625
20
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
6626 /* Special case for Web Explorer, it requires file:/// instead
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
6627 * of file:// so I am handling it here.
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
6628 */
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
6629 if(len > 0)
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
6630 {
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
6631 if(stricmp(&browser[len], "explore.exe") == 0)
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
6632 {
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
6633 int newlen, z;
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
6634 newurl = alloca(strlen(url) + 2);
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
6635 sprintf(newurl, "file:///%s", &url[7]);
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
6636 newlen = strlen(newurl);
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
6637 for(z=8;z<(newlen-8);z++)
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
6638 {
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
6639 if(newurl[z] == '|')
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
6640 newurl[z] = ':';
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
6641 if(newurl[z] == '/')
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
6642 newurl[z] = '\\';
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
6643 }
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
6644 execargs[1] = newurl;
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
6645 }
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
6646 }
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
6647
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6648 return dw_exec(browser, DW_EXEC_GUI, execargs);
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 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6652 * Returns a pointer to a static buffer which containes the
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6653 * current user directory. Or the root directory (C:\ on
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6654 * OS/2 and Windows).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6655 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6656 char *dw_user_dir(void)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6657 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6658 static char _user_dir[1024] = "";
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6659
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6660 if(!_user_dir[0])
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6661 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6662 char *home = getenv("HOME");
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6663
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6664 if(home)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6665 strcpy(_user_dir, home);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6666 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6667 strcpy(_user_dir, "C:\\");
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6668 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6669 return _user_dir;
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 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6673 * Call a function from the window (widget)'s context.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6674 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6675 * handle: Window handle of the widget.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6676 * function: Function pointer to be called.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6677 * data: Pointer to the data to be passed to the function.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6678 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6679 void dw_window_function(HWND handle, void *function, void *data)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6680 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6681 WinSendMsg(handle, WM_USER, (MPARAM)function, (MPARAM)data);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6682 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6683
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6684 #ifndef NO_SIGNALS
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6685 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6686 * Add a callback to a window event.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6687 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6688 * window: Window handle of signal to be called back.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6689 * signame: A string pointer identifying which signal to be hooked.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6690 * sigfunc: The pointer to the function to be used as the callback.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6691 * data: User data to be passed to the handler function.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6692 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6693 void dw_signal_connect(HWND window, char *signame, void *sigfunc, void *data)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6694 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6695 ULONG message = 0L;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6696
55
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
6697 if(strcmp(signame, "lose-focus") == 0)
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
6698 {
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
6699 char tmpbuf[100];
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
6700
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
6701 WinQueryClassName(window, 99, tmpbuf);
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
6702
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
6703 if(strncmp(tmpbuf, "#2", 3) == 0)
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
6704 {
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
6705 HENUM henum = WinBeginEnumWindows(window);
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
6706 HWND child = WinGetNextWindow(henum);
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
6707 WinEndEnumWindows(henum);
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
6708 if(child)
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
6709 window = child;
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
6710 }
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
6711 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6712 if(window && signame && sigfunc)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6713 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6714 if((message = _findsigmessage(signame)) != 0)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6715 _new_signal(message, window, sigfunc, data);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6716 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6717 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6718
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6719 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6720 * Removes callbacks for a given window with given name.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6721 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6722 * window: Window handle of callback to be removed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6723 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6724 void dw_signal_disconnect_by_name(HWND window, char *signame)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6725 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6726 SignalHandler *prev = NULL, *tmp = Root;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6727 ULONG message;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6728
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6729 if(!window || !signame || (message = _findsigmessage(signame)) == 0)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6730 return;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6731
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6732 while(tmp)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6733 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6734 if(tmp->window == window && tmp->message == message)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6735 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6736 if(prev)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6737 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6738 prev->next = tmp->next;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6739 free(tmp);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6740 tmp = prev->next;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6741 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6742 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6743 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6744 Root = tmp->next;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6745 free(tmp);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6746 tmp = Root;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6747 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6748 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6749 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6750 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6751 prev = tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6752 tmp = tmp->next;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6753 }
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 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6758 * Removes all callbacks for a given window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6759 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6760 * window: Window handle of callback to be removed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6761 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6762 void dw_signal_disconnect_by_window(HWND window)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6763 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6764 SignalHandler *prev = NULL, *tmp = Root;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6765
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6766 while(tmp)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6767 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6768 if(tmp->window == window)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6769 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6770 if(prev)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6771 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6772 prev->next = tmp->next;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6773 free(tmp);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6774 tmp = prev->next;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6775 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6776 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6777 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6778 Root = tmp->next;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6779 free(tmp);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6780 tmp = Root;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6781 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6782 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6783 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6784 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6785 prev = tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6786 tmp = tmp->next;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6787 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6788 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6789 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6790
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6791 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6792 * Removes all callbacks for a given window with specified data.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6793 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6794 * window: Window handle of callback to be removed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6795 * data: Pointer to the data to be compared against.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6796 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6797 void dw_signal_disconnect_by_data(HWND window, void *data)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6798 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6799 SignalHandler *prev = NULL, *tmp = Root;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6800
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6801 while(tmp)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6802 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6803 if(tmp->window == window && tmp->data == data)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6804 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6805 if(prev)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6806 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6807 prev->next = tmp->next;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6808 free(tmp);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6809 tmp = prev->next;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6810 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6811 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6812 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6813 Root = tmp->next;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6814 free(tmp);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6815 tmp = Root;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6816 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6817 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6818 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6819 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6820 prev = tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6821 tmp = tmp->next;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6822 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6823 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6824 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6825 #endif
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6826
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6827 #ifdef TEST
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6828 HWND mainwindow,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6829 listbox,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6830 okbutton,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6831 cancelbutton,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6832 lbbox,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6833 stext,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6834 buttonbox,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6835 testwindow,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6836 testbox,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6837 testok,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6838 testcancel,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6839 testbox2,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6840 testok2,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6841 testcancel2,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6842 notebook;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6843 int count = 2;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6844
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6845 #ifdef USE_FILTER
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6846 /* Do any handling you need in the filter function */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6847 LONG testfilter(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6848 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6849 switch(msg)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6850 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6851 case WM_COMMAND:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6852 switch (COMMANDMSG(&msg)->cmd)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6853 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6854 case 1001L:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6855 case 1002L:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6856 dw_window_destroy(mainwindow);;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6857 count--;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6858 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6859 case 1003L:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6860 case 1004L:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6861 dw_window_destroy(testwindow);;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6862 count--;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6863 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6864 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6865 if(!count)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6866 exit(0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6867 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6868 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6869 /* Return -1 to allow the default handlers to return. */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6870 return TRUE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6871 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6872 #else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6873 int test_callback(HWND window, void *data)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6874 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6875 dw_window_destroy((HWND)data);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6876 /* Return -1 to allow the default handlers to return. */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6877 count--;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6878 if(!count)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6879 exit(0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6880 return -1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6881 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6882 #endif
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6883
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6884 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6885 * Let's demonstrate the functionality of this library. :)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6886 */
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 55
diff changeset
6887 int main(int argc, char *argv[])
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6888 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6889 ULONG flStyle = DW_FCF_SYSMENU | DW_FCF_TITLEBAR |
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6890 DW_FCF_SHELLPOSITION | DW_FCF_TASKLIST | DW_FCF_DLGBORDER;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6891 int pageid;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6892
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 55
diff changeset
6893 dw_init(TRUE, argc, argv);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6894
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6895 /* Try a little server dialog. :) */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6896 mainwindow = dw_window_new(HWND_DESKTOP, "Server", flStyle | DW_FCF_SIZEBORDER | DW_FCF_MINMAX);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6897
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6898 lbbox = dw_box_new(BOXVERT, 10);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6899
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6900 dw_box_pack_start(mainwindow, lbbox, 0, 0, TRUE, TRUE, 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6901
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6902 stext = dw_text_new("Choose a server:", 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6903
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6904 dw_window_set_style(stext, DW_DT_VCENTER, DW_DT_VCENTER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6905
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6906 dw_box_pack_start(lbbox, stext, 130, 15, FALSE, FALSE, 10);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6907
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6908 listbox = dw_listbox_new(100L, FALSE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6909
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6910 dw_box_pack_start(lbbox, listbox, 130, 200, TRUE, TRUE, 10);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6911
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6912 buttonbox = dw_box_new(BOXHORZ, 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6913
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6914 dw_box_pack_start(lbbox, buttonbox, 0, 0, TRUE, TRUE, 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6915
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6916 okbutton = dw_button_new("Ok", 1001L);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6917
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6918 dw_box_pack_start(buttonbox, okbutton, 50, 30, TRUE, TRUE, 5);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6919
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6920 cancelbutton = dw_button_new("Cancel", 1002L);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6921
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6922 dw_box_pack_start(buttonbox, cancelbutton, 50, 30, TRUE, TRUE, 5);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6923
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6924 /* Set some nice fonts and colors */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6925 dw_window_set_color(lbbox, DW_CLR_PALEGRAY, DW_CLR_PALEGRAY);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6926 dw_window_set_color(buttonbox, DW_CLR_PALEGRAY, DW_CLR_PALEGRAY);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6927 dw_window_set_font(stext, "9.WarpSans");
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6928 dw_window_set_color(stext, DW_CLR_BLACK, DW_CLR_PALEGRAY);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6929 dw_window_set_font(listbox, "9.WarpSans");
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6930 dw_window_set_font(okbutton, "9.WarpSans");
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6931 dw_window_set_font(cancelbutton, "9.WarpSans");
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6932
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6933 dw_window_show(mainwindow);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6934
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6935 dw_window_set_usize(mainwindow, 170, 340);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6936
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6937 /* Another small example */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6938 flStyle |= FCF_MINMAX | FCF_SIZEBORDER;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6939
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6940 testwindow = dw_window_new(HWND_DESKTOP, "Wow a test dialog! :) yay!", flStyle);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6941
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6942 testbox = dw_box_new(BOXVERT, 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6943
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6944 dw_box_pack_start(testwindow, testbox, 0, 0, TRUE, TRUE, 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6945
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6946 notebook = dw_notebook_new(1010L, TRUE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6947
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6948 dw_box_pack_start(testbox, notebook, 100, 100, TRUE, TRUE, 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6949
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6950 testbox = dw_box_new(BOXVERT, 10);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6951
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6952 pageid = dw_notebook_page_new(notebook, 0L, FALSE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6953
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6954 dw_notebook_page_set_text(notebook, pageid, "Test page");
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6955 dw_notebook_page_set_status_text(notebook, pageid, "Test page");
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6956
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6957 dw_notebook_pack(notebook, pageid, testbox);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6958
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6959 testok = dw_button_new("Ok", 1003L);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6960
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6961 dw_box_pack_start(testbox, testok, 60, 40, TRUE, TRUE, 10);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6962
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6963 testcancel = dw_button_new("Cancel", 1004L);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6964
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6965 dw_box_pack_start(testbox, testcancel, 60, 40, TRUE, TRUE, 10);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6966
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6967 testbox2 = dw_box_new(BOXHORZ, 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6968
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6969 dw_box_pack_start(testbox, testbox2, 0, 0, TRUE, TRUE, 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6970
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6971 testok2 = dw_button_new("Ok", 1003L);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6972
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6973 dw_box_pack_start(testbox2, testok2, 60, 40, TRUE, TRUE, 10);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6974
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6975 dw_box_pack_splitbar_start(testbox2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6976
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6977 testcancel2 = dw_button_new("Cancel", 1004L);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6978
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6979 dw_box_pack_start(testbox2, testcancel2, 60, 40, TRUE, TRUE, 10);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6980
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6981 /* Set some nice fonts and colors */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6982 dw_window_set_color(testbox, DW_CLR_PALEGRAY, DW_CLR_PALEGRAY);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6983 dw_window_set_color(testbox2, DW_CLR_PALEGRAY, DW_CLR_PALEGRAY);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6984 dw_window_set_font(testok, "9.WarpSans");
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6985 dw_window_set_font(testcancel, "9.WarpSans");
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6986 dw_window_set_font(testok2, "9.WarpSans");
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6987 dw_window_set_font(testcancel2, "9.WarpSans");
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6988
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6989 dw_window_show(testwindow);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6990
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6991 #ifdef USE_FILTER
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6992 dw_main(0L, (void *)testfilter);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6993 #else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6994 /* Setup the function callbacks */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6995 dw_signal_connect(okbutton, "clicked", DW_SIGNAL_FUNC(test_callback), (void *)mainwindow);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6996 dw_signal_connect(cancelbutton, "clicked", DW_SIGNAL_FUNC(test_callback), (void *)mainwindow);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6997 dw_signal_connect(testok, "clicked", DW_SIGNAL_FUNC(test_callback), (void *)testwindow);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6998 dw_signal_connect(testcancel, "clicked", DW_SIGNAL_FUNC(test_callback), (void *)testwindow);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6999 dw_signal_connect(testok2, "clicked", DW_SIGNAL_FUNC(test_callback), (void *)testwindow);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7000 dw_signal_connect(testcancel2, "clicked", DW_SIGNAL_FUNC(test_callback), (void *)testwindow);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7001 dw_signal_connect(mainwindow, "delete_event", DW_SIGNAL_FUNC(test_callback), (void *)mainwindow);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7002 dw_signal_connect(testwindow, "delete_event", DW_SIGNAL_FUNC(test_callback), (void *)testwindow);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7003
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7004 dw_main(0L, NULL);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7005 #endif
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7006
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7007 return 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7008 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7009 #endif