1 |
|
---|
2 | /*
|
---|
3 | *@@sourcefile comctl.h:
|
---|
4 | * header file for comctl.c. See remarks there.
|
---|
5 | *
|
---|
6 | * Note: Version numbering in this file relates to XWorkplace version
|
---|
7 | * numbering.
|
---|
8 | */
|
---|
9 |
|
---|
10 | /* Copyright (C) 1997-2000 Ulrich Mller.
|
---|
11 | * This file is part of the "XWorkplace helpers" source package.
|
---|
12 | * This is free software; you can redistribute it and/or modify
|
---|
13 | * it under the terms of the GNU General Public License as published
|
---|
14 | * by the Free Software Foundation, in version 2 as it comes in the
|
---|
15 | * "COPYING" file of the XWorkplace main distribution.
|
---|
16 | * This program is distributed in the hope that it will be useful,
|
---|
17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
19 | * GNU General Public License for more details.
|
---|
20 | *
|
---|
21 | *@@include #define INCL_WINWINDOWMGR
|
---|
22 | *@@include #define INCL_WINMESSAGEMGR
|
---|
23 | *@@include #define INCL_WINDIALOGS
|
---|
24 | *@@include #define INCL_WINSTDCNR // for checkbox containers
|
---|
25 | *@@include #define INCL_WININPUT
|
---|
26 | *@@include #define INCL_WINSYS
|
---|
27 | *@@include #define INCL_WINSHELLDATA
|
---|
28 | *@@include #include <os2.h>
|
---|
29 | *@@include #include "helpers\comctl.h"
|
---|
30 | */
|
---|
31 |
|
---|
32 | #if __cplusplus
|
---|
33 | extern "C" {
|
---|
34 | #endif
|
---|
35 |
|
---|
36 | #ifndef COMCTL_HEADER_INCLUDED
|
---|
37 | #define COMCTL_HEADER_INCLUDED
|
---|
38 |
|
---|
39 | /* ******************************************************************
|
---|
40 | *
|
---|
41 | * Shared stuff
|
---|
42 | *
|
---|
43 | ********************************************************************/
|
---|
44 |
|
---|
45 | MRESULT ctlSendWmControl(HWND hwndControl,
|
---|
46 | USHORT usCode,
|
---|
47 | MPARAM mp2);
|
---|
48 |
|
---|
49 | BOOL ctlPostWmControl(HWND hwndControl,
|
---|
50 | USHORT usCode,
|
---|
51 | MPARAM mp2);
|
---|
52 |
|
---|
53 | /*
|
---|
54 | *@@ SYSCOLORSET:
|
---|
55 | *
|
---|
56 | *@@added V1.0.1 (2002-11-30) [umoeller]
|
---|
57 | */
|
---|
58 |
|
---|
59 | typedef struct _SYSCOLORSET
|
---|
60 | {
|
---|
61 | BOOL fInheritPP;
|
---|
62 |
|
---|
63 | LONG lBackIndex,
|
---|
64 | lForeIndex;
|
---|
65 | } SYSCOLORSET, *PSYSCOLORSET;
|
---|
66 |
|
---|
67 | /*
|
---|
68 | *@@ DEFWINDOWDATA:
|
---|
69 | *
|
---|
70 | *@@added V1.0.1 (2002-11-30) [umoeller]
|
---|
71 | */
|
---|
72 |
|
---|
73 | typedef struct _DEFWINDATA
|
---|
74 | {
|
---|
75 | HWND hwnd;
|
---|
76 | HAB hab;
|
---|
77 |
|
---|
78 | PFNWP pDefWindowProc;
|
---|
79 | const SYSCOLORSET *pSysColorSet;
|
---|
80 |
|
---|
81 | LONG lcolBackground,
|
---|
82 | lcolForeground;
|
---|
83 |
|
---|
84 | SIZEL szlWin; // current window dimensions
|
---|
85 |
|
---|
86 | PSZ pszText; // window text or NULL
|
---|
87 |
|
---|
88 | } DEFWINDATA, *PDEFWINDATA;
|
---|
89 |
|
---|
90 | VOID ctlInitDWD(HWND hwnd,
|
---|
91 | MPARAM mp2,
|
---|
92 | PDEFWINDATA pdwd,
|
---|
93 | PFNWP pDefWindowProc,
|
---|
94 | const SYSCOLORSET *pSysColorSet);
|
---|
95 |
|
---|
96 | VOID ctlRefreshColors(PDEFWINDATA pdwd);
|
---|
97 |
|
---|
98 | MRESULT ctlDefWindowProc(PDEFWINDATA pdwd, ULONG msg, MPARAM mp1, MPARAM mp2);
|
---|
99 |
|
---|
100 | /* ******************************************************************
|
---|
101 | *
|
---|
102 | * "Separator line" control
|
---|
103 | *
|
---|
104 | ********************************************************************/
|
---|
105 |
|
---|
106 | #define WC_CCTL_SEPARATOR "ComctlSeparator"
|
---|
107 |
|
---|
108 | #define SEPS_HORIZONTAL 0x0000
|
---|
109 | #define SEPS_VERTICAL 0x0001
|
---|
110 |
|
---|
111 | BOOL ctlRegisterSeparatorLine(HAB hab);
|
---|
112 |
|
---|
113 | /* ******************************************************************
|
---|
114 | *
|
---|
115 | * "Menu button" control
|
---|
116 | *
|
---|
117 | ********************************************************************/
|
---|
118 |
|
---|
119 | VOID ctlDisplayButtonMenu(HWND hwndButton,
|
---|
120 | HWND hwndMenu);
|
---|
121 |
|
---|
122 | BOOL ctlMakeMenuButton(HWND hwndButton,
|
---|
123 | HMODULE hmodMenu,
|
---|
124 | ULONG idMenu);
|
---|
125 |
|
---|
126 | /* ******************************************************************
|
---|
127 | *
|
---|
128 | * Progress bars
|
---|
129 | *
|
---|
130 | ********************************************************************/
|
---|
131 |
|
---|
132 | /*
|
---|
133 | *@@ PROGRESSBARDATA:
|
---|
134 | * structure for progress bar data,
|
---|
135 | * saved at QWL_USER window ulong.
|
---|
136 | */
|
---|
137 |
|
---|
138 | typedef struct _PROGRESSBARDATA
|
---|
139 | {
|
---|
140 | ULONG ulNow,
|
---|
141 | ulMax,
|
---|
142 | ulPaintX,
|
---|
143 | ulOldPaintX;
|
---|
144 | ULONG ulAttr;
|
---|
145 | PFNWP OldStaticProc;
|
---|
146 | } PROGRESSBARDATA, *PPROGRESSBARDATA;
|
---|
147 |
|
---|
148 | #define WM_UPDATEPROGRESSBAR WM_USER+1000
|
---|
149 |
|
---|
150 | // status bar style attributes
|
---|
151 | #define PBA_NOPERCENTAGE 0x0000
|
---|
152 | #define PBA_ALIGNLEFT 0x0001
|
---|
153 | #define PBA_ALIGNRIGHT 0x0002
|
---|
154 | #define PBA_ALIGNCENTER 0x0003
|
---|
155 | #define PBA_PERCENTFLAGS 0x0003
|
---|
156 | #define PBA_BUTTONSTYLE 0x0010
|
---|
157 |
|
---|
158 | BOOL ctlProgressBarFromStatic(HWND hwndStatic, ULONG ulAttr);
|
---|
159 |
|
---|
160 | /* ******************************************************************
|
---|
161 | *
|
---|
162 | * Chart Control
|
---|
163 | *
|
---|
164 | ********************************************************************/
|
---|
165 |
|
---|
166 | /*
|
---|
167 | *@@ CHARTDATA:
|
---|
168 | * chart data. This represents the
|
---|
169 | * data to be displayed.
|
---|
170 | *
|
---|
171 | * Used with the CHTM_SETCHARTDATA message
|
---|
172 | * and stored within CHARTCDATA (below).
|
---|
173 | */
|
---|
174 |
|
---|
175 | typedef struct _CHARTDATA
|
---|
176 | {
|
---|
177 | USHORT usStartAngle,
|
---|
178 | // for "pie chart" mode, angle to start with (0%).
|
---|
179 | // This must be in the range of 0 to 360 degrees,
|
---|
180 | // with 0 degrees being the rightmost point
|
---|
181 | // of the arc.
|
---|
182 |
|
---|
183 | // All degree values are counter-clockwise from that point.
|
---|
184 | // Example: 90 will start the arc at the top.
|
---|
185 |
|
---|
186 | // 90ø
|
---|
187 | // +++++++
|
---|
188 | // + +
|
---|
189 | // + +
|
---|
190 | // + +
|
---|
191 | // + +
|
---|
192 | // + +
|
---|
193 | // 180ø + X + 0ø
|
---|
194 | // + +
|
---|
195 | // + +
|
---|
196 | // + +
|
---|
197 | // + +
|
---|
198 | // + +
|
---|
199 | // +++++++
|
---|
200 | // 270ø
|
---|
201 |
|
---|
202 | usSweepAngle;
|
---|
203 | // the maximum angle to use for 100%, in addition to
|
---|
204 | // usStartAngle.
|
---|
205 | // This must be in the range of 0 to 360 degrees,
|
---|
206 | // with 0 degrees being usStartAngle.
|
---|
207 | // All degree values are counter-clockwise from that point.
|
---|
208 | // Example: Specify usStartAngle = 180 (1) to start the pie
|
---|
209 | // at the left and usSweepAngle = 270 (2) to draw a
|
---|
210 | // three-quarter total pie.
|
---|
211 |
|
---|
212 | // 90ø
|
---|
213 | // ++++
|
---|
214 | // + _ +
|
---|
215 | // + |\ +
|
---|
216 | // + \ +
|
---|
217 | // + \ +
|
---|
218 | // + | +
|
---|
219 | // (1) 180ø +++++++++++ | + 0ø
|
---|
220 | // + / +
|
---|
221 | // + \ (2) +
|
---|
222 | // + \ / +
|
---|
223 | // + ------ +
|
---|
224 | // + +
|
---|
225 | // +++++++
|
---|
226 | // 270ø
|
---|
227 |
|
---|
228 | ULONG cValues;
|
---|
229 | // data item count; the arrays in *padValues and *palColors
|
---|
230 | // (and also *papszDescriptions, if CHS_DESCRIPTIONS is
|
---|
231 | // enabled in CHARTSTYLE) must have this many items.
|
---|
232 | double* padValues;
|
---|
233 | // pointer to an array of double values;
|
---|
234 | // the sum of all these will make up 100%
|
---|
235 | // in the chart. In "pie chart" mode, the
|
---|
236 | // sum of all these values corresponds to
|
---|
237 | // the usSweepAngle angle; in "bar chart" mode,
|
---|
238 | // the sum corresponds to the width of the control.
|
---|
239 | // If this ptr is NULL, the chart displays nothing.
|
---|
240 | // Otherwise, this array must have cValues items.
|
---|
241 | LONG* palColors;
|
---|
242 | // pointer to an array of LONG RGB colors;
|
---|
243 | // each item in this array must correspond
|
---|
244 | // to an item in padValues and specifies the color
|
---|
245 | // to paint the corresponding data item with.
|
---|
246 | // This _must_ be specified if padValues is != NULL.
|
---|
247 | // This array must have cValues items.
|
---|
248 | PSZ* papszDescriptions;
|
---|
249 | // pointer to an array of PSZs containing
|
---|
250 | // data descriptions. If this pointer is
|
---|
251 | // NULL, or CHARTSTYLE.ulStyle does not have
|
---|
252 | // CHS_DESCRIPTIONS set, no texts will be displayed.
|
---|
253 | // Otherwise, this array must have cValues items.
|
---|
254 | } CHARTDATA, *PCHARTDATA;
|
---|
255 |
|
---|
256 | // chart display mode:
|
---|
257 | #define CHS_PIECHART 0x0000
|
---|
258 | #define CHS_BARCHART 0x0001
|
---|
259 |
|
---|
260 | // chart display flags (CHARTSTYLE.ulStyle):
|
---|
261 | #define CHS_SHADOW 0x0100 // (pie chart only) draw shadow
|
---|
262 | #define CHS_3D_BRIGHT 0x0200 // (pie chart only)
|
---|
263 | // // draw 3D block in same color as surface;
|
---|
264 | // CHARTSTYLE.ulThickness defines thickness
|
---|
265 | #define CHS_3D_DARKEN 0x0600 // (pie chart only)
|
---|
266 | // draw 3D block too, but darker
|
---|
267 | // compared to surface;
|
---|
268 | // CHARTSTYLE.ulThickness defines thickness
|
---|
269 |
|
---|
270 | #define CHS_DRAWLINES 0x0800 // draw lines between pie slices
|
---|
271 | // added V0.9.12 (2001-05-03) [umoeller]
|
---|
272 |
|
---|
273 | #define CHS_DESCRIPTIONS 0x1000 // show descriptions
|
---|
274 | #define CHS_DESCRIPTIONS_3D 0x3000 // same as CHS_DESCRIPTIONS, but shaded
|
---|
275 |
|
---|
276 | #define CHS_SELECTIONS 0x4000 // allow data items to be selected using
|
---|
277 | // mouse and keyboard; this also enables
|
---|
278 | // WM_CONTROL notifications
|
---|
279 |
|
---|
280 | /*
|
---|
281 | *@@ CHARTSTYLE:
|
---|
282 | *
|
---|
283 | */
|
---|
284 |
|
---|
285 | typedef struct _CHARTSTYLE
|
---|
286 | {
|
---|
287 | ULONG ulStyle; // CHS_* flags
|
---|
288 |
|
---|
289 | ULONG ulThickness; // (pie chart only)
|
---|
290 | // pie thickness (with CHS_3D_xxx) in pixels
|
---|
291 |
|
---|
292 | double dPieSize; // (pie chart only)
|
---|
293 | // // size of the pie chart relative to the control
|
---|
294 | // size. A value of 1 would make the pie chart
|
---|
295 | // consume all available space. A value of .5
|
---|
296 | // would make the pie chart consume half of the
|
---|
297 | // control's space. The pie chart is always
|
---|
298 | // centered within the control.
|
---|
299 |
|
---|
300 | double dDescriptions; // (pie chart only)
|
---|
301 | // position of the slice descriptions on the pie
|
---|
302 | // relative to the window size. To calculate the
|
---|
303 | // description positions, the control calculates
|
---|
304 | // an invisible pie slice again, for which this
|
---|
305 | // value is used. So a value of 1 would make the
|
---|
306 | // descriptions appear on the outer parts of the
|
---|
307 | // window (not recommended). A value of .5 would
|
---|
308 | // make the descriptions appear in the center of
|
---|
309 | // an imaginary line between the pie's center
|
---|
310 | // and the pie slice's outer border.
|
---|
311 | // This should be chosen in conjunction with
|
---|
312 | // dPieSize as well. If this is equal to dPieSize,
|
---|
313 | // the descriptions appear on the border of the
|
---|
314 | // slice. If this is half dPieSize, the descriptions
|
---|
315 | // appear in the center of the pie slice. If this
|
---|
316 | // is larger than dPieSize, the descriptions appear
|
---|
317 | // outside the slice.
|
---|
318 | } CHARTSTYLE, *PCHARTSTYLE;
|
---|
319 |
|
---|
320 | HBITMAP ctlCreateChartBitmap(HPS hpsMem,
|
---|
321 | LONG lcx,
|
---|
322 | LONG lcy,
|
---|
323 | PCHARTDATA pChartData,
|
---|
324 | PCHARTSTYLE pChartStyle,
|
---|
325 | LONG lBackgroundColor,
|
---|
326 | LONG lTextColor,
|
---|
327 | HRGN* paRegions);
|
---|
328 |
|
---|
329 | BOOL ctlChartFromStatic(HWND hwndStatic);
|
---|
330 |
|
---|
331 | #define CHTM_SETCHARTDATA (WM_USER + 2)
|
---|
332 |
|
---|
333 | #define CHTM_SETCHARTSTYLE (WM_USER + 3)
|
---|
334 |
|
---|
335 | #define CHTM_ITEMFROMPOINT (WM_USER + 4)
|
---|
336 |
|
---|
337 | #define CHTM_SETEMPHASIS (WM_USER + 5)
|
---|
338 |
|
---|
339 | // WM_CONTROL notification codes
|
---|
340 |
|
---|
341 | /*
|
---|
342 | *@@ CHTN_EMPHASISCHANGED:
|
---|
343 | * WM_CONTROL notification code sent (!)
|
---|
344 | * by a chart control to its owner when
|
---|
345 | * selections change in the control.
|
---|
346 | *
|
---|
347 | * This is only sent if the CHS_SELECTIONS
|
---|
348 | * style bit is set in the control.
|
---|
349 | *
|
---|
350 | * Parameters:
|
---|
351 | *
|
---|
352 | * -- USHORT SHORT1FROMMP(mp1): usid (control ID).
|
---|
353 | * -- USHORT SHORT2FROMMP(mp1): CHTN_EMPHASISCHANGED.
|
---|
354 | *
|
---|
355 | * -- mp2: pointer to EMPHASISNOTIFY structure.
|
---|
356 | *
|
---|
357 | * Note: The control only sends one such notification,
|
---|
358 | * even if an old selection was undone. That is, if
|
---|
359 | * item 1 was previously selected and item 2 is then
|
---|
360 | * selected, only one notification for item 2 is sent.
|
---|
361 | *
|
---|
362 | *@@added V0.9.12 (2001-05-03) [umoeller]
|
---|
363 | */
|
---|
364 |
|
---|
365 | #define CHTN_EMPHASISCHANGED 1001
|
---|
366 |
|
---|
367 | /*
|
---|
368 | *@@ CHTN_CONTEXTMENU:
|
---|
369 | * WM_CONTROL notification code sent (!)
|
---|
370 | * by a chart control to its owner when
|
---|
371 | * a context menu was requested on the
|
---|
372 | * control.
|
---|
373 | *
|
---|
374 | * This is only sent if the CHS_SELECTIONS
|
---|
375 | * style bit is set in the control.
|
---|
376 | *
|
---|
377 | * Parameters:
|
---|
378 | *
|
---|
379 | * -- USHORT SHORT1FROMMP(mp1): usid (control ID).
|
---|
380 | * -- USHORT SHORT2FROMMP(mp1): CHTN_EMPHASISCHANGED.
|
---|
381 | *
|
---|
382 | * -- mp2: pointer to EMPHASISNOTIFY structure.
|
---|
383 | * If the context menu was requested on a chart
|
---|
384 | * slice, lIndex has the index of the slice.
|
---|
385 | * Otherwise (e.g. whitespace), lIndex will
|
---|
386 | * be -1.
|
---|
387 | *
|
---|
388 | *@@added V0.9.12 (2001-05-03) [umoeller]
|
---|
389 | */
|
---|
390 |
|
---|
391 | #define CHTN_CONTEXTMENU 1002
|
---|
392 |
|
---|
393 | /*
|
---|
394 | *@@ CHTN_ENTER:
|
---|
395 | * WM_CONTROL notification code sent (!)
|
---|
396 | * by a chart control to its owner when
|
---|
397 | * the user double-clicked on a data item.
|
---|
398 | *
|
---|
399 | * This is only sent if the CHS_SELECTIONS
|
---|
400 | * style bit is set in the control.
|
---|
401 | *
|
---|
402 | * Parameters:
|
---|
403 | *
|
---|
404 | * -- USHORT SHORT1FROMMP(mp1): usid (control ID).
|
---|
405 | * -- USHORT SHORT2FROMMP(mp1): CHTN_ENTER.
|
---|
406 | *
|
---|
407 | * -- mp2: pointer to EMPHASISNOTIFY structure.
|
---|
408 | * If the double click occured on a chart
|
---|
409 | * slice, lIndex has the index of the slice.
|
---|
410 | * Otherwise (e.g. whitespace), lIndex will
|
---|
411 | * be -1.
|
---|
412 | *
|
---|
413 | *@@added V0.9.12 (2001-05-03) [umoeller]
|
---|
414 | */
|
---|
415 |
|
---|
416 | #define CHTN_ENTER 1003
|
---|
417 |
|
---|
418 | /*
|
---|
419 | *@@ CHTN_SETFOCUS:
|
---|
420 | * WM_CONTROL notification code sent (!)
|
---|
421 | * by a chart control to its owner when
|
---|
422 | * gaining focus.
|
---|
423 | *
|
---|
424 | * Parameters:
|
---|
425 | *
|
---|
426 | * -- USHORT SHORT1FROMMP(mp1): usid (control ID).
|
---|
427 | * -- USHORT SHORT2FROMMP(mp1): CHTN_SETFOCUS.
|
---|
428 | *
|
---|
429 | * -- mp2: pointer to EMPHASISNOTIFY structure.
|
---|
430 | *
|
---|
431 | *@@added V0.9.20 (2002-07-17) [pr]
|
---|
432 | */
|
---|
433 |
|
---|
434 | #define CHTN_SETFOCUS 1004
|
---|
435 |
|
---|
436 | /*
|
---|
437 | *@@ CHTN_KILLFOCUS:
|
---|
438 | * WM_CONTROL notification code sent (!)
|
---|
439 | * by a chart control to its owner when
|
---|
440 | * losing focus.
|
---|
441 | *
|
---|
442 | * Parameters:
|
---|
443 | *
|
---|
444 | * -- USHORT SHORT1FROMMP(mp1): usid (control ID).
|
---|
445 | * -- USHORT SHORT2FROMMP(mp1): CHTN_KILLFOCUS.
|
---|
446 | *
|
---|
447 | * -- mp2: pointer to EMPHASISNOTIFY structure.
|
---|
448 | *
|
---|
449 | *@@added V0.9.20 (2002-07-17) [pr]
|
---|
450 | */
|
---|
451 |
|
---|
452 | #define CHTN_KILLFOCUS 1005
|
---|
453 |
|
---|
454 | /*
|
---|
455 | *@@ EMPHASISNOTIFY:
|
---|
456 | * structure used with CHTN_EMPHASISCHANGED,
|
---|
457 | * CHTN_ENTER, and CHTN_CONTEXTMENU.
|
---|
458 | *
|
---|
459 | *@@added V0.9.12 (2001-05-03) [umoeller]
|
---|
460 | */
|
---|
461 |
|
---|
462 | typedef struct _EMPHASISNOTIFY
|
---|
463 | {
|
---|
464 | HWND hwndSource;
|
---|
465 | // window handle of the chart control
|
---|
466 | ULONG ulEmphasis;
|
---|
467 | // with CHTN_EMPHASISCHANGED: emphasis which has changed
|
---|
468 | // (0 for selection, 1 for source emphasis).
|
---|
469 | // Otherwise undefined.
|
---|
470 | LONG lIndex;
|
---|
471 | // with CHTN_EMPHASISCHANGED: index of the data
|
---|
472 | // item for which emphasis has changed (counting
|
---|
473 | // from 0); if -1, a previous emphasis has been undone.
|
---|
474 | // With CHTN_CONTEXTMENU and CHTN_ENTER, index of the
|
---|
475 | // data item for which the request occured, or -1 for
|
---|
476 | // a request on the control's whitespace.
|
---|
477 | POINTL ptl;
|
---|
478 | // exact window coordinates where mouse
|
---|
479 | // click occured (e.g. for context menu).
|
---|
480 | // This is undefined (-1) if the event was not
|
---|
481 | // caused by a mouse click.
|
---|
482 | } EMPHASISNOTIFY, *PEMPHASISNOTIFY;
|
---|
483 |
|
---|
484 | /* ******************************************************************
|
---|
485 | *
|
---|
486 | * Super Combo Box
|
---|
487 | *
|
---|
488 | ********************************************************************/
|
---|
489 |
|
---|
490 | BOOL ctlComboFromEntryField(HWND hwnd,
|
---|
491 | ULONG flStyle);
|
---|
492 |
|
---|
493 | /* ******************************************************************
|
---|
494 | *
|
---|
495 | * Split bars
|
---|
496 | *
|
---|
497 | ********************************************************************/
|
---|
498 |
|
---|
499 | #define WC_SPLITWINDOW "SplitWindowClass"
|
---|
500 |
|
---|
501 | #define SBCF_VERTICAL 0x0000
|
---|
502 | #define SBCF_HORIZONTAL 0x0001
|
---|
503 |
|
---|
504 | #define SBCF_PERCENTAGE 0x0002
|
---|
505 | #define SBCF_3DSUNK 0x0100
|
---|
506 | #define SBCF_3DEXPLORERSTYLE 0x0200
|
---|
507 | // new with V1.0.0 (2002-08-21) [umoeller]
|
---|
508 | // this simulates the Warp 4 entry field margins around the
|
---|
509 | // right split window, but leaves the left window flat
|
---|
510 | #define SBCF_MOVEABLE 0x1000
|
---|
511 |
|
---|
512 | /*
|
---|
513 | *@@ SPLITBARCDATA:
|
---|
514 | * split bar creation data
|
---|
515 | */
|
---|
516 |
|
---|
517 | typedef struct _SPLITBARCDATA
|
---|
518 | {
|
---|
519 | ULONG ulSplitWindowID;
|
---|
520 | // window ID of the split window
|
---|
521 | ULONG ulCreateFlags;
|
---|
522 | // split window style flags.
|
---|
523 | // One of the following:
|
---|
524 | // -- SBCF_VERTICAL: the split bar will be vertical.
|
---|
525 | // -- SBCF_HORIZONTAL: the split bar will be horizontal.
|
---|
526 | // plus any or none of the following:
|
---|
527 | // -- SBCF_PERCENTAGE: lPos does not specify absolute
|
---|
528 | // coordinates, but a percentage of the window
|
---|
529 | // width or height. In that case, the split
|
---|
530 | // bar position is not fixed, but always recalculated
|
---|
531 | // as a percentage.
|
---|
532 | // Otherwise, the split bar will be fixed.
|
---|
533 | // -- SBCF_3DSUNK: draw a "sunk" 3D frame around the
|
---|
534 | // split windows.
|
---|
535 | // -- SBCF_MOVEABLE: the split bar may be moved with
|
---|
536 | // the mouse.
|
---|
537 | LONG lPos;
|
---|
538 | // position of the split bar within hwndParentAndOwner.
|
---|
539 | // If SBCF_PERCENTAGE, this has the percentage;
|
---|
540 | // otherwise:
|
---|
541 | // if this value is positive, it's considered
|
---|
542 | // an offset from the left/bottom of the frame;
|
---|
543 | // if it's negative, it's from the right
|
---|
544 | ULONG ulLeftOrBottomLimit,
|
---|
545 | ulRightOrTopLimit;
|
---|
546 | // when moving the split bar (SBCF_MOVEABLE), these
|
---|
547 | // are the minimum and maximum values.
|
---|
548 | // ulLeftOrBottomLimit is the left (or bottom) limit,
|
---|
549 | // ulRightOrTopLimit is the right (or top) limit.
|
---|
550 | // Both are offsets in window coordinates from the
|
---|
551 | // left (or bottom) and right (or top) boundaries of
|
---|
552 | // the split window. If both are 0, the whole split
|
---|
553 | // window is allowed (not recommended).
|
---|
554 | HWND hwndParentAndOwner;
|
---|
555 | // the owner and parent of the split bar
|
---|
556 | // and other windows; this must be the FID_CLIENT
|
---|
557 | // of a frame or another split window (when nesting)
|
---|
558 | } SPLITBARCDATA, *PSPLITBARCDATA;
|
---|
559 |
|
---|
560 | /*
|
---|
561 | *@@ SPLITBARDATA:
|
---|
562 | * internal split bar data,
|
---|
563 | * stored in QWL_USER window ulong
|
---|
564 | */
|
---|
565 |
|
---|
566 | typedef struct _SPLITBARDATA
|
---|
567 | {
|
---|
568 | SPLITBARCDATA sbcd;
|
---|
569 | PFNWP OldStaticProc;
|
---|
570 | HPOINTER hptrOld, // old pointer stored upon WM_MOUSEMOVE
|
---|
571 | hptrMove; // PM move pointer, either vertical or horizontal
|
---|
572 | BOOL fCaptured;
|
---|
573 | POINTS ptsMousePos;
|
---|
574 | POINTL ptlDrawLineFrom,
|
---|
575 | ptlDrawLineTo;
|
---|
576 | HPS hpsTrackBar;
|
---|
577 | HWND hwndLinked1,
|
---|
578 | // the left/bottom window to link
|
---|
579 | hwndLinked2;
|
---|
580 | // the right/top window to link
|
---|
581 | LONG lcol3DDark,
|
---|
582 | lcol3DLight,
|
---|
583 | lcolInactiveBorder;
|
---|
584 | } SPLITBARDATA, *PSPLITBARDATA;
|
---|
585 |
|
---|
586 | #define ID_SPLITBAR 5000 // fixed ID of the split bar
|
---|
587 | // (child of split window)
|
---|
588 |
|
---|
589 | /*
|
---|
590 | *@@ SPLM_SETLINKS:
|
---|
591 | * this specifies the windows which the
|
---|
592 | * split window will link. This updates
|
---|
593 | * the internal SPLITBARDATA and changes
|
---|
594 | * the parents of the two subwindows to
|
---|
595 | * the split window.
|
---|
596 | *
|
---|
597 | * Parameters:
|
---|
598 | * HWND mp1: left or bottom subwindow
|
---|
599 | * HWND mp2: right or top subwindow
|
---|
600 | */
|
---|
601 |
|
---|
602 | #define SPLM_SETLINKS (WM_USER + 500)
|
---|
603 |
|
---|
604 | HWND ctlCreateSplitWindow(HAB hab,
|
---|
605 | PSPLITBARCDATA psbcd);
|
---|
606 |
|
---|
607 | BOOL ctlUpdateSplitWindow(HWND hwndSplit);
|
---|
608 |
|
---|
609 | BOOL ctlSetSplitFrameWindowPos(HWND hwndFrame,
|
---|
610 | HWND hwndInsertBehind,
|
---|
611 | LONG x,
|
---|
612 | LONG y,
|
---|
613 | LONG cx,
|
---|
614 | LONG cy,
|
---|
615 | ULONG fl,
|
---|
616 | HWND *pahwnd,
|
---|
617 | ULONG cbhwnd);
|
---|
618 |
|
---|
619 | LONG ctlQuerySplitPos(HWND hwndSplit);
|
---|
620 |
|
---|
621 | /* ******************************************************************
|
---|
622 | *
|
---|
623 | * Subclassed Static Bitmap Control
|
---|
624 | *
|
---|
625 | ********************************************************************/
|
---|
626 |
|
---|
627 | // flags for ANIMATIONDATA.ulFlags
|
---|
628 | #define ANF_ICON 0x0001
|
---|
629 | #define ANF_BITMAP 0x0002
|
---|
630 | #define ANF_PROPORTIONAL 0x0004
|
---|
631 |
|
---|
632 | /*
|
---|
633 | *@@ ANIMATIONDATA:
|
---|
634 | * this structure gets stored in QWL_USER
|
---|
635 | * before subclassing the static control
|
---|
636 | *
|
---|
637 | *@@changed V0.9.0: added fields for bitmap support
|
---|
638 | *@@changed V0.9.16 (2001-10-15) [umoeller]: added lIconSize
|
---|
639 | *@@changed V0.9.19 (2002-06-18) [umoeller]: added szlIcon
|
---|
640 | */
|
---|
641 |
|
---|
642 | typedef struct _ANIMATIONDATA
|
---|
643 | {
|
---|
644 | // the following need to be initialized before
|
---|
645 | // subclassing
|
---|
646 | HAB hab; // (added V0.9.0)
|
---|
647 | ULONG ulFlags;
|
---|
648 | // one of the following:
|
---|
649 | // -- ANF_ICON: display icons
|
---|
650 | // -- ANF_BITMAP: display bitmaps
|
---|
651 | // -- ANF_BITMAP | ANF_PROPORTIONAL: display bitmaps, but preserve proportions
|
---|
652 | SIZEL szlIcon; // system icon size V0.9.19 (2002-06-18) [umoeller]
|
---|
653 | RECTL rclIcon; // size of static control
|
---|
654 | PFNWP OldStaticProc; // original WC_STATIC wnd proc
|
---|
655 |
|
---|
656 | // the following are set by fnwpSubclassedStatic upon
|
---|
657 | // receiving SM_SETHANDLE (in all modes) or later
|
---|
658 | HBITMAP hbm, // bitmap to be painted upon WM_PAINT
|
---|
659 | hbmHalftoned; // bitmap in case of WS_DISABLED (added V0.9.0)
|
---|
660 | HPOINTER hptr; // icon handle passed to SM_SETHANDLE
|
---|
661 | HBITMAP hbmSource; // bitmap handle passed to SM_SETHANDLE
|
---|
662 | // (this can be deleted later) (added V0.9.0)
|
---|
663 |
|
---|
664 | // the following need to be initialized
|
---|
665 | // for icon mode only (ANF_ICON)
|
---|
666 | ULONG ulDelay; // delay per animation step in ms
|
---|
667 | USHORT usAniCurrent; // current animation step (>= 0)
|
---|
668 |
|
---|
669 | USHORT usAniCount; // no. of animation steps
|
---|
670 | HPOINTER ahptrAniIcons[1]; // variable-size array of animation steps;
|
---|
671 | // there must be usAniCount items
|
---|
672 | } ANIMATIONDATA, *PANIMATIONDATA;
|
---|
673 |
|
---|
674 | PANIMATIONDATA ctlPrepareStaticIcon(HWND hwndStatic, USHORT usAnimCount);
|
---|
675 |
|
---|
676 | BOOL ctlPrepareAnimation(HWND hwndStatic,
|
---|
677 | USHORT usAnimCount,
|
---|
678 | HPOINTER *pahptr,
|
---|
679 | ULONG ulDelay,
|
---|
680 | BOOL fStartAnimation);
|
---|
681 |
|
---|
682 | BOOL ctlStartAnimation(HWND hwndStatic);
|
---|
683 |
|
---|
684 | BOOL ctlStopAnimation(HWND hwndStatic);
|
---|
685 |
|
---|
686 | PANIMATIONDATA ctlPrepareStretchedBitmap(HWND hwndStatic,
|
---|
687 | BOOL fPreserveProportions);
|
---|
688 |
|
---|
689 |
|
---|
690 | /* ******************************************************************
|
---|
691 | *
|
---|
692 | * "Tooltip" control
|
---|
693 | *
|
---|
694 | ********************************************************************/
|
---|
695 |
|
---|
696 | #define WC_CCTL_TOOLTIP "ComctlTooltipClass"
|
---|
697 | // define identifier changed V1.0.1 (2002-11-30) [umoeller]
|
---|
698 |
|
---|
699 | // addt'l tooltip window styles: use lower 16 bits
|
---|
700 | #define TTS_ALWAYSTIP 0x0001
|
---|
701 | #define TTS_NOPREFIX 0x0002
|
---|
702 | // non-Win95 flags
|
---|
703 | #define TTS_ROUNDED 0x0004
|
---|
704 | #define TTS_SHADOW 0x0008
|
---|
705 |
|
---|
706 | // TOOLINFO.uFlags flags (ORed)
|
---|
707 | // #define TTF_IDISHWND 0x0001
|
---|
708 | // V0.9.7 (2001-01-03) [umoeller]: removed this win95 crap
|
---|
709 | // #define TTF_CENTERBELOW 0x0002
|
---|
710 | // #define TTF_CENTERABOVE 0x0004
|
---|
711 | // #define TTF_RTLREADING 0x0004
|
---|
712 | // V0.9.7 (2001-01-03) [umoeller]: removed this win95 crap
|
---|
713 |
|
---|
714 | #define TTF_SUBCLASS 0x0008
|
---|
715 | // non-Win95 flags
|
---|
716 | #define TTF_SHYMOUSE 0x0010
|
---|
717 |
|
---|
718 | // new flags with V0.9.7 (2001-01-20) [umoeller]
|
---|
719 | #define TTF_CENTER_X_ON_TOOL 0x0020
|
---|
720 | #define TTF_POS_Y_ABOVE_TOOL 0x0040
|
---|
721 | #define TTF_POS_Y_BELOW_TOOL 0x0080
|
---|
722 |
|
---|
723 | #define PSZ_TEXTCALLBACK (PSZ)-1
|
---|
724 |
|
---|
725 | #define TT_SHADOWOFS 10
|
---|
726 | #define TT_ROUNDING 8
|
---|
727 |
|
---|
728 | /*
|
---|
729 | *@@ TOOLINFO:
|
---|
730 | * info structure to register a tool with a
|
---|
731 | * tooltip control. Used with TTM_ADDTOOL
|
---|
732 | * and many other TTM_* messages.
|
---|
733 | *
|
---|
734 | *@@changed V0.9.7 (2001-01-03) [umoeller]: removed all that win95 crap
|
---|
735 | */
|
---|
736 |
|
---|
737 | typedef struct _TOOLINFO
|
---|
738 | {
|
---|
739 | ULONG ulFlags;
|
---|
740 | // in: flags for the tool, any combination of:
|
---|
741 | // -- TTF_SUBCLASS: Indicates that the tooltip control should
|
---|
742 | // subclass hwndTool to intercept messages,
|
---|
743 | // such as WM_MOUSEMOVE. See TTM_RELAYEVENT.
|
---|
744 | // -- TTF_SHYMOUSE: shy away from mouse pointer;
|
---|
745 | // always position the tool tip such that it is never
|
---|
746 | // covered by the mouse pointer (for readability);
|
---|
747 | // added V0.9.1 (2000-02-04) [umoeller]
|
---|
748 | // -- TTF_CENTER_X_ON_TOOL: position tooltip X so that
|
---|
749 | // it's centered on the tool (doesn't affect Y)
|
---|
750 | // -- TTF_POS_Y_ABOVE_TOOL: position tooltip Y above
|
---|
751 | // the tool; cannot be used with TTF_POS_Y_BELOW_TOOL
|
---|
752 | // -- TTF_POS_Y_BELOW_TOOL: position tooltip Y below
|
---|
753 | // the tool; cannot be used with TTF_POS_Y_ABOVE_TOOL
|
---|
754 | HWND hwndToolOwner;
|
---|
755 | // in: handle to the window that contains the tool. If
|
---|
756 | // pszText includes the PSZ_TEXTCALLBACK value, this
|
---|
757 | // member identifies the window that receives TTN_NEEDTEXT
|
---|
758 | // notification messages.
|
---|
759 | HWND hwndTool;
|
---|
760 | // in: window handle of the tool.
|
---|
761 | PSZ pszText;
|
---|
762 | // in: pointer to the buffer that contains the text for the
|
---|
763 | // tool (if the hiword is != NULL), or identifier of the string
|
---|
764 | // resource that contains the text (if the hiword == NULL).
|
---|
765 | // If this member is set to the PSZ_TEXTCALLBACK value,
|
---|
766 | // the control sends the TTN_NEEDTEXT notification message to
|
---|
767 | // hwndToolOwner to retrieve the text.
|
---|
768 | } TOOLINFO, *PTOOLINFO;
|
---|
769 |
|
---|
770 | /*
|
---|
771 | * tooltip messages
|
---|
772 | *
|
---|
773 | */
|
---|
774 |
|
---|
775 | #define TTM_FIRST (WM_USER + 1000)
|
---|
776 |
|
---|
777 | #define TTM_ACTIVATE (TTM_FIRST + 1)
|
---|
778 |
|
---|
779 | #define TTM_ADDTOOL (TTM_FIRST + 2)
|
---|
780 |
|
---|
781 | #define TTM_DELTOOL (TTM_FIRST + 3)
|
---|
782 |
|
---|
783 | #define TTM_NEWTOOLRECT (TTM_FIRST + 4)
|
---|
784 |
|
---|
785 | #define TTM_RELAYEVENT (TTM_FIRST + 5)
|
---|
786 |
|
---|
787 | // flags for TTM_SETDELAYTIME
|
---|
788 | #define TTDT_AUTOMATIC 1
|
---|
789 | #define TTDT_AUTOPOP 2
|
---|
790 | #define TTDT_INITIAL 3
|
---|
791 | #define TTDT_RESHOW 4
|
---|
792 |
|
---|
793 | #define TTM_GETDELAYTIME (TTM_FIRST + 6)
|
---|
794 | // added V0.9.12 (2001-04-28) [umoeller]
|
---|
795 |
|
---|
796 | #define TTM_SETDELAYTIME (TTM_FIRST + 7)
|
---|
797 |
|
---|
798 | #define TTFMT_PSZ 0x01
|
---|
799 | #define TTFMT_STRINGRES 0x02
|
---|
800 |
|
---|
801 | /*
|
---|
802 | *@@ TOOLTIPTEXT:
|
---|
803 | * identifies a tool for which text is to
|
---|
804 | * be displayed and receives the text for
|
---|
805 | * the tool. The tool must fill all fields
|
---|
806 | * of this structure.
|
---|
807 | *
|
---|
808 | * This structure is used with the TTN_NEEDTEXT
|
---|
809 | * notification.
|
---|
810 | *
|
---|
811 | *@@changed V0.9.7 (2001-01-03) [umoeller]: got rid of this win95 crap
|
---|
812 | */
|
---|
813 |
|
---|
814 | typedef struct _TOOLTIPTEXT
|
---|
815 | {
|
---|
816 | HWND hwndTooltip;
|
---|
817 | // in: tooltip control who's sending this.
|
---|
818 | HWND hwndTool;
|
---|
819 | // in: tool for which the text is needed.
|
---|
820 | ULONG ulFormat;
|
---|
821 | // out: one of:
|
---|
822 | // -- TTFMT_PSZ: pszText contains the new, zero-terminated string.
|
---|
823 | // -- TTFMT_STRINGRES: hmod and idResource specify a string resource
|
---|
824 | // to be loaded.
|
---|
825 | PSZ pszText;
|
---|
826 | // out: with TTFMT_PSZ, pointer to a string that contains the
|
---|
827 | // tool text. Note that this is not copied into the tooltip...
|
---|
828 | // so this must point to a static buffer that is valid while
|
---|
829 | // the tooltip is showing.
|
---|
830 | HMODULE hmod;
|
---|
831 | // out: with TTFMT_STRINGRES, the module handle of the resource.
|
---|
832 | ULONG idResource;
|
---|
833 | // out: with TTFMT_STRINGRES, the string resource ID.
|
---|
834 | } TOOLTIPTEXT, *PTOOLTIPTEXT;
|
---|
835 |
|
---|
836 | #define TTM_GETTEXT (TTM_FIRST + 8)
|
---|
837 |
|
---|
838 | #define TTM_UPDATETIPTEXT (TTM_FIRST + 9)
|
---|
839 |
|
---|
840 | /*
|
---|
841 | *@@ TT_HITTESTINFO:
|
---|
842 | * contains information that a tooltip control uses to determine whether
|
---|
843 | * a point is in the bounding rectangle of the specified tool. If the point
|
---|
844 | * is in the rectangle, the structure receives information about the tool.
|
---|
845 | *
|
---|
846 | * This structure is used with the TTM_HITTEST message.
|
---|
847 | */
|
---|
848 |
|
---|
849 | typedef struct _TT_HITTESTINFO
|
---|
850 | {
|
---|
851 | HWND hwnd; // in: handle to the tool or window with the specified tool.
|
---|
852 | POINTL /* POINT */ pt;
|
---|
853 | // in: client coordinates of the point to test (Win95: POINT)
|
---|
854 | TOOLINFO ti; // out: receives information about the specified tool.
|
---|
855 | } TTHITTESTINFO, *PHITTESTINFO;
|
---|
856 |
|
---|
857 | #define TTM_HITTEST (TTM_FIRST + 10)
|
---|
858 |
|
---|
859 | #define TTM_WINDOWFROMPOINT (TTM_FIRST + 11)
|
---|
860 |
|
---|
861 | #define TTM_ENUMTOOLS (TTM_FIRST + 12)
|
---|
862 |
|
---|
863 | #define TTM_GETCURRENTTOOL (TTM_FIRST + 13)
|
---|
864 |
|
---|
865 | #define TTM_GETTOOLCOUNT (TTM_FIRST + 14)
|
---|
866 |
|
---|
867 | #define TTM_GETTOOLINFO (TTM_FIRST + 15)
|
---|
868 |
|
---|
869 | #define TTM_SETTOOLINFO (TTM_FIRST + 16)
|
---|
870 |
|
---|
871 | // non-Win95 messages
|
---|
872 |
|
---|
873 | #define TTM_SHOWTOOLTIPNOW (TTM_FIRST + 17)
|
---|
874 |
|
---|
875 | /*
|
---|
876 | * tooltip notification codes (WM_CONTROL)
|
---|
877 | *
|
---|
878 | */
|
---|
879 |
|
---|
880 | /*
|
---|
881 | *@@ TTN_NEEDTEXT:
|
---|
882 | * notification code used with WM_CONTROL when a tooltip
|
---|
883 | * needs a tooltip text for a tool.
|
---|
884 | *
|
---|
885 | * Parameters:
|
---|
886 | *
|
---|
887 | * -- SHORT1FROMMP(mp1) usID: ID of the tooltip control).
|
---|
888 | *
|
---|
889 | * -- SHORT2FROMMP(mp1) usNotifyCode: TTN_NEEDTEXT.
|
---|
890 | *
|
---|
891 | * -- PTOOLTIPTEXT mp2: pointer to a TOOLTIPTEXT structure.
|
---|
892 | * hwndTool identifies the tool for which text is needed.
|
---|
893 | *
|
---|
894 | * This notification message is sent to the window specified
|
---|
895 | * in the hwndToolOwner member of the TOOLINFO structure for the tool.
|
---|
896 | * This notification is sent only if the PSZ_TEXTCALLBACK
|
---|
897 | * value is specified when the tool is added to a tooltip control.
|
---|
898 | *
|
---|
899 | * To specify the text, the target window (hwndToolOwner) must:
|
---|
900 | *
|
---|
901 | * 1. Set TOOLTIPTEXT.ulFormat to one of the format flags.
|
---|
902 | *
|
---|
903 | * 2. Fill the corresponding field(s) in TOOLTIPTEXT.
|
---|
904 | *
|
---|
905 | * Specifying PSZ_TEXTCALLBACK in TOOLINFO.lpszText with
|
---|
906 | * TTM_ADDTOOL is the only way under OS/2 to have strings
|
---|
907 | * displayed which are longer than 256 characters, since
|
---|
908 | * string resources are limited to 256 characters with OS/2.
|
---|
909 | * It is the responsibility of the application to set the
|
---|
910 | * pszText member to a _static_ string buffer which holds
|
---|
911 | * the string for the tool. A common error would be to have
|
---|
912 | * that member point to some variable which has only been
|
---|
913 | * allocated on the stack... this will lead to problems.
|
---|
914 | */
|
---|
915 |
|
---|
916 | #define TTN_NEEDTEXT 1000
|
---|
917 |
|
---|
918 | /*
|
---|
919 | *@@ TTN_SHOW:
|
---|
920 | * control notification sent with the WM_NOTIFY (Win95)
|
---|
921 | * and WM_CONTROL (OS/2) messages.
|
---|
922 | *
|
---|
923 | * Parameters (OS/2, incompatible with Win95):
|
---|
924 | * -- mp1 USHORT usID;
|
---|
925 | * USHORT usNotifyCode == TTN_NEEDTEXT
|
---|
926 | * -- ULONG mp2: PTOOLINFO of the tool for which the
|
---|
927 | * tool is about to be displayed.
|
---|
928 | *
|
---|
929 | * Return value: always 0.
|
---|
930 | *
|
---|
931 | * The TTN_SHOW notification message notifies the owner window
|
---|
932 | * that a tooltip is about to be displayed.
|
---|
933 | */
|
---|
934 |
|
---|
935 | #define TTN_SHOW 1001
|
---|
936 |
|
---|
937 | /*
|
---|
938 | *@@ TTN_POP:
|
---|
939 | * control notification sent with the WM_NOTIFY (Win95)
|
---|
940 | * and WM_CONTROL (OS/2) messages.
|
---|
941 | *
|
---|
942 | * Parameters (OS/2, incompatible with Win95):
|
---|
943 | * -- mp1 USHORT usID;
|
---|
944 | * USHORT usNotifyCode == TTN_NEEDTEXT
|
---|
945 | * -- ULONG mp2: PTOOLINFO of the tool for which the
|
---|
946 | * tooltip was visible.
|
---|
947 | *
|
---|
948 | * Return value: always 0.
|
---|
949 | *
|
---|
950 | * The TTN_SHOW notification message notifies the owner window
|
---|
951 | * that a tooltip is about to be hidden.
|
---|
952 | */
|
---|
953 |
|
---|
954 | #define TTN_POP 1002
|
---|
955 |
|
---|
956 | BOOL ctlRegisterTooltip(HAB hab);
|
---|
957 |
|
---|
958 | MRESULT EXPENTRY ctl_fnwpTooltip(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2);
|
---|
959 |
|
---|
960 | /* ******************************************************************
|
---|
961 | *
|
---|
962 | * "Tool bar button" control
|
---|
963 | *
|
---|
964 | ********************************************************************/
|
---|
965 |
|
---|
966 | #define WC_CCTL_TOOLBAR "ComctlToolbarClass"
|
---|
967 |
|
---|
968 | // toolbar button styles: use lower 16 bits
|
---|
969 | #define TBBS_BIGICON 0x0001
|
---|
970 | #define TBBS_MINIICON 0x0002
|
---|
971 | #define TBBS_BITMAP 0x0004
|
---|
972 | #define TBBS_TEXT 0x0008
|
---|
973 |
|
---|
974 | #define TBBS_CHECK 0x0010
|
---|
975 | #define TBBS_RADIO 0x0020
|
---|
976 | #define TBBS_CHECKINITIAL 0x0040
|
---|
977 |
|
---|
978 | #define TBBS_AUTORESIZE 0x0100
|
---|
979 | #define TBBS_HILITE 0x0200
|
---|
980 | #define TBBS_FLAT 0x0400
|
---|
981 |
|
---|
982 | #define TBBS_COMMAND 0x1000
|
---|
983 | #define TBBS_SYSCOMMAND 0x2000
|
---|
984 | #define TBBS_DROPMNEMONIC 0x4000
|
---|
985 |
|
---|
986 | // tool bar button messages
|
---|
987 |
|
---|
988 | #define TBBM_CHECK (WM_USER + 1)
|
---|
989 |
|
---|
990 | #define TBBM_QUERYCHECK (WM_USER + 2)
|
---|
991 |
|
---|
992 | /*
|
---|
993 | *@@ XBUTTONDATA:
|
---|
994 | * paint data for ctlPaintTBButton.
|
---|
995 | *
|
---|
996 | *@@added V0.9.13 (2001-06-21) [umoeller]
|
---|
997 | */
|
---|
998 |
|
---|
999 | typedef struct _XBUTTONDATA
|
---|
1000 | {
|
---|
1001 | DEFWINDATA dwd; // color for center (button background)
|
---|
1002 |
|
---|
1003 | SIZEL szlIconOrBitmap;
|
---|
1004 |
|
---|
1005 | HPOINTER hptr; // icon to paint or NULLHANDLE
|
---|
1006 |
|
---|
1007 | // BOOL fPaintButtonSunk;
|
---|
1008 |
|
---|
1009 | } XBUTTONDATA, *PXBUTTONDATA;
|
---|
1010 |
|
---|
1011 | /*
|
---|
1012 | *@@ XBUTTONSTATE:
|
---|
1013 | *
|
---|
1014 | *@@added V1.0.1 (2002-11-30) [umoeller]
|
---|
1015 | */
|
---|
1016 |
|
---|
1017 | typedef struct _XBUTTONSTATE
|
---|
1018 | {
|
---|
1019 | BOOL fMB1Pressed; // if TRUE, mouse button is currently pressed
|
---|
1020 | BOOL fIgnoreMB1Up;
|
---|
1021 | BOOL fPaintButtonSunk; // if TRUE, button control is to be painted "down"
|
---|
1022 | BOOL fMouseCaptured; // if TRUE, mouse is currently captured
|
---|
1023 | BOOL fMouseOver;
|
---|
1024 | } XBUTTONSTATE, *PXBUTTONSTATE;
|
---|
1025 |
|
---|
1026 | // the following styles are only for painting and not stored
|
---|
1027 | #define TBBS_BACKGROUND 0x00010000
|
---|
1028 | #define TBBS_INUSE 0x00020000
|
---|
1029 |
|
---|
1030 | VOID ctlPaintTBButton(HPS hps,
|
---|
1031 | ULONG fl,
|
---|
1032 | PXBUTTONDATA pbd,
|
---|
1033 | PXBUTTONSTATE pbs);
|
---|
1034 |
|
---|
1035 | MRESULT EXPENTRY ctl_fnwpToolbarButton(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2);
|
---|
1036 |
|
---|
1037 | /* ******************************************************************
|
---|
1038 | *
|
---|
1039 | * "Tool bar" control
|
---|
1040 | *
|
---|
1041 | ********************************************************************/
|
---|
1042 |
|
---|
1043 | #define WC_CCTL_TBBUTTON "ComCtlToolbarButton"
|
---|
1044 | // define identifier changed V1.0.1 (2002-11-30) [umoeller]
|
---|
1045 |
|
---|
1046 | // tool bar window styles: use lower 16 bits
|
---|
1047 | #define TBS_TOOLTIPS 0x0001
|
---|
1048 | #define TBS_AUTORESIZE 0x0002
|
---|
1049 |
|
---|
1050 | /*
|
---|
1051 | *@@ TOOLBARCONTROL:
|
---|
1052 | *
|
---|
1053 | *@@added V1.0.1 (2002-11-30) [umoeller]
|
---|
1054 | */
|
---|
1055 |
|
---|
1056 | typedef struct _TOOLBARCONTROL
|
---|
1057 | {
|
---|
1058 | PCSZ pcszClass;
|
---|
1059 | PCSZ pcszTitle;
|
---|
1060 | ULONG flStyle;
|
---|
1061 | ULONG id;
|
---|
1062 | LONG cx,
|
---|
1063 | cy;
|
---|
1064 | } TOOLBARCONTROL, *PTOOLBARCONTROL;
|
---|
1065 |
|
---|
1066 | /*
|
---|
1067 | *@@ TOOLBARCDATA:
|
---|
1068 | *
|
---|
1069 | *@@added V1.0.1 (2002-11-30) [umoeller]
|
---|
1070 | */
|
---|
1071 |
|
---|
1072 | typedef struct _TOOLBARCDATA
|
---|
1073 | {
|
---|
1074 | USHORT cb;
|
---|
1075 |
|
---|
1076 | HWND hwndControlsOwner;
|
---|
1077 |
|
---|
1078 | ULONG cControls;
|
---|
1079 | PTOOLBARCONTROL patbc;
|
---|
1080 |
|
---|
1081 | } TOOLBARCDATA, *PTOOLBARCDATA;
|
---|
1082 |
|
---|
1083 | #define TBM_ADDCONTROLS (WM_USER + 1)
|
---|
1084 |
|
---|
1085 | /*
|
---|
1086 | *@@ TBN_RESIZED:
|
---|
1087 | * notification code posted with WM_CONTROL when
|
---|
1088 | * a tool bar has resized itself, e.g. because
|
---|
1089 | * controls were added or removed.
|
---|
1090 | *
|
---|
1091 | * Parameters:
|
---|
1092 | *
|
---|
1093 | * -- SHORT1FROMMP(mp1): ID of the tool bar control.
|
---|
1094 | *
|
---|
1095 | * -- SHORT2FROMMP(mp1): TBN_RESIZED code.
|
---|
1096 | *
|
---|
1097 | * -- mp2: unused.
|
---|
1098 | *
|
---|
1099 | *@@added V1.0.1 (2002-11-30) [umoeller]
|
---|
1100 | */
|
---|
1101 |
|
---|
1102 | #define TBN_RESIZED 1
|
---|
1103 |
|
---|
1104 | MRESULT EXPENTRY ctl_fnwpToolbar(HWND hwndToolbar, ULONG msg, MPARAM mp1, MPARAM mp2);
|
---|
1105 |
|
---|
1106 | BOOL ctlRegisterToolbar(HAB hab);
|
---|
1107 |
|
---|
1108 | HWND ctlCreateToolBar(HWND hwndParent,
|
---|
1109 | HWND hwndOwner,
|
---|
1110 | ULONG flStyle,
|
---|
1111 | HWND hwndControlsOwner,
|
---|
1112 | ULONG cControls,
|
---|
1113 | PTOOLBARCONTROL patbc);
|
---|
1114 |
|
---|
1115 | /* ******************************************************************
|
---|
1116 | *
|
---|
1117 | * Extended frame
|
---|
1118 | *
|
---|
1119 | ********************************************************************/
|
---|
1120 |
|
---|
1121 | #define FID_TOOLBAR 0x8101
|
---|
1122 | #define FID_STATUSBAR 0x8100
|
---|
1123 |
|
---|
1124 | /*
|
---|
1125 | *@@ EXTFRAMECDATA:
|
---|
1126 | *
|
---|
1127 | *@@added V0.9.16 (2001-09-29) [umoeller]
|
---|
1128 | */
|
---|
1129 |
|
---|
1130 | typedef struct _EXTFRAMECDATA
|
---|
1131 | {
|
---|
1132 | PSWP pswpFrame; // in: frame wnd pos (can be NULL)
|
---|
1133 | ULONG flFrame; // in: standard FCF_* flags
|
---|
1134 | ULONG flExtFrame; // in: XFCF_* flags
|
---|
1135 | #define XFCF_STATUSBAR 0x0001
|
---|
1136 | // create a status bar for the frame
|
---|
1137 | #define XFCF_TOOLBAR 0x0002
|
---|
1138 | // create a tool bar for the frame
|
---|
1139 | #define XFCF_FORCETBOWNER 0x0004
|
---|
1140 | // if set, we will enfore that all toolbar controls have
|
---|
1141 | // the main frame as their owner, otherwise they'll have
|
---|
1142 | // the frame's client, if one exists
|
---|
1143 | ULONG flStyleFrame; // in: frame style (WS_* flags, e.g. WS_VISIBLE | WS_ANIMATE)
|
---|
1144 | PCSZ pcszFrameTitle; // in: frame title (title bar)
|
---|
1145 | ULONG ulResourcesID; // in: according to FCF_* flags
|
---|
1146 |
|
---|
1147 | PCSZ pcszClassClient; // in: client class name or NULL for no client
|
---|
1148 | ULONG flStyleClient; // in: client style (WS_* flags, e.g. WS_VISIBLE)
|
---|
1149 |
|
---|
1150 | ULONG ulID; // in: frame window ID
|
---|
1151 | PVOID pClientCtlData; // in: pCtlData structure pointer for client
|
---|
1152 |
|
---|
1153 | HINI hiniSaveWinPos; // in: HINI for saving window position or NULLHANDLE
|
---|
1154 | PCSZ pcszIniApp,
|
---|
1155 | pcszIniKey;
|
---|
1156 |
|
---|
1157 | ULONG cTBControls; // in: count of tool bar controls in paTBControls or 0
|
---|
1158 | PTOOLBARCONTROL paTBControls;
|
---|
1159 |
|
---|
1160 | } EXTFRAMECDATA, *PEXTFRAMECDATA;
|
---|
1161 |
|
---|
1162 | /*
|
---|
1163 | *@@ XFRAMECONTROLS:
|
---|
1164 | *
|
---|
1165 | *@@added V1.0.1 (2002-11-30) [umoeller]
|
---|
1166 | */
|
---|
1167 |
|
---|
1168 | typedef struct _XFRAMECONTROLS
|
---|
1169 | {
|
---|
1170 | PFNWP pfnwpOrig; // original frame wnd proc from subclassing
|
---|
1171 |
|
---|
1172 | HWND hwndToolBar,
|
---|
1173 | hwndStatusBar;
|
---|
1174 |
|
---|
1175 | LONG lToolBarHeight,
|
---|
1176 | lStatusBarHeight;
|
---|
1177 |
|
---|
1178 | } XFRAMECONTROLS, *PXFRAMECONTROLS;
|
---|
1179 |
|
---|
1180 | /*
|
---|
1181 | *@@ EXTFRAMEDATA:
|
---|
1182 | *
|
---|
1183 | *@@added V0.9.16 (2001-09-29) [umoeller]
|
---|
1184 | */
|
---|
1185 |
|
---|
1186 | typedef struct _EXTFRAMEDATA
|
---|
1187 | {
|
---|
1188 | EXTFRAMECDATA CData;
|
---|
1189 |
|
---|
1190 | XFRAMECONTROLS xfc;
|
---|
1191 |
|
---|
1192 | PVOID pvUser; // more data for user (e.g. for additional subclassing)
|
---|
1193 |
|
---|
1194 | } EXTFRAMEDATA, *PEXTFRAMEDATA;
|
---|
1195 |
|
---|
1196 | MRESULT ctlFormatExtFrame(HWND hwndFrame,
|
---|
1197 | PXFRAMECONTROLS pxfc,
|
---|
1198 | MPARAM mp1,
|
---|
1199 | MPARAM mp2);
|
---|
1200 |
|
---|
1201 | VOID ctlCalcExtFrameRect(MPARAM mp1,
|
---|
1202 | MPARAM mp2,
|
---|
1203 | LONG lStatusBarHeight);
|
---|
1204 |
|
---|
1205 | HWND ctlCreateStatusBar(HWND hwndFrame,
|
---|
1206 | HWND hwndOwner,
|
---|
1207 | const char *pcszText,
|
---|
1208 | const char *pcszFont,
|
---|
1209 | LONG lColor);
|
---|
1210 |
|
---|
1211 | HWND ctlCreateStdWindow(PEXTFRAMECDATA pData,
|
---|
1212 | PHWND phwndClient);
|
---|
1213 |
|
---|
1214 | /* ******************************************************************
|
---|
1215 | *
|
---|
1216 | * Checkbox container record cores
|
---|
1217 | *
|
---|
1218 | ********************************************************************/
|
---|
1219 |
|
---|
1220 | BOOL ctlDrawCheckbox(HPS hps,
|
---|
1221 | LONG x,
|
---|
1222 | LONG y,
|
---|
1223 | USHORT usRow,
|
---|
1224 | USHORT usColumn,
|
---|
1225 | BOOL fHalftoned);
|
---|
1226 |
|
---|
1227 | #ifdef INCL_WINSTDCNR
|
---|
1228 |
|
---|
1229 | /*
|
---|
1230 | *@@ CN_RECORDCHECKED:
|
---|
1231 | * extra WM_CONTROL notification code.
|
---|
1232 | * See ctlMakeCheckboxContainer for
|
---|
1233 | * details.
|
---|
1234 | */
|
---|
1235 |
|
---|
1236 | #define CN_RECORDCHECKED 999
|
---|
1237 |
|
---|
1238 | /*
|
---|
1239 | *@@ CHECKBOXRECORDCORE:
|
---|
1240 | * extended record core structure used
|
---|
1241 | * with checkbox containers. See
|
---|
1242 | * ctlMakeCheckboxContainer for details.
|
---|
1243 | *
|
---|
1244 | * The check box painting is determined
|
---|
1245 | * by the following flags:
|
---|
1246 | *
|
---|
1247 | * -- Only if (ulStyle & WS_VISIBLE), the check
|
---|
1248 | * box is painted at all. Otherwise hptrIcon
|
---|
1249 | * is painted. (Is this true?)
|
---|
1250 | *
|
---|
1251 | * -- In that case, usCheckState determines
|
---|
1252 | * whether the check box is painted checked,
|
---|
1253 | * unchecked, or indeterminate.
|
---|
1254 | *
|
---|
1255 | * -- In addition, if RECORDCORE.flRecordAttr
|
---|
1256 | * has the CRA_DISABLED bit set, the check
|
---|
1257 | * box is painted disabled (halftoned).
|
---|
1258 | *
|
---|
1259 | *@@changed V0.9.9 (2001-03-27) [umoeller]: made item id a ULONG
|
---|
1260 | */
|
---|
1261 |
|
---|
1262 | typedef struct _CHECKBOXRECORDCORE
|
---|
1263 | {
|
---|
1264 | RECORDCORE recc;
|
---|
1265 | // standard record core structure
|
---|
1266 | ULONG ulStyle;
|
---|
1267 | // any combination of the following:
|
---|
1268 | // -- WS_VISIBLE
|
---|
1269 | // -- none or one of the following:
|
---|
1270 | // BS_AUTOCHECKBOX, BS_AUTO3STATE, BS_3STATE
|
---|
1271 | // Internally, we use BS_BITMAP to identify
|
---|
1272 | // the depressed checkbox button.
|
---|
1273 | ULONG ulItemID;
|
---|
1274 | // this identifies the record; must be
|
---|
1275 | // unique within the container
|
---|
1276 | // changed V0.9.9 (2001-03-27) [umoeller]: turned USHORT into ULONG
|
---|
1277 | USHORT usCheckState;
|
---|
1278 | // current check state as with checkboxes
|
---|
1279 | // (0, 1, or 2 for tri-state).
|
---|
1280 | HPOINTER hptrIcon;
|
---|
1281 | // if this is != NULLHANDLE, this icon
|
---|
1282 | // will always be used for painting,
|
---|
1283 | // instead of the default check box
|
---|
1284 | // bitmaps. Useful for non-auto check
|
---|
1285 | // box records to implement something
|
---|
1286 | // other than checkboxes.
|
---|
1287 | } CHECKBOXRECORDCORE, *PCHECKBOXRECORDCORE;
|
---|
1288 |
|
---|
1289 | /*
|
---|
1290 | *@@ CHECKBOXCNROWNER:
|
---|
1291 | *
|
---|
1292 | *
|
---|
1293 | *@@added V0.9.0 (99-11-28) [umoeller]
|
---|
1294 | */
|
---|
1295 |
|
---|
1296 | typedef struct _CHECKBOXCNROWNER
|
---|
1297 | {
|
---|
1298 | HWND hwndCnr; // container window handle
|
---|
1299 | USHORT usCnrID; // container item ID
|
---|
1300 | HWND hwndOwner; // owner of that container
|
---|
1301 | PFNWP pfnwpCnrOrig; // original window proc of hwndCnr
|
---|
1302 | PFNWP pfnwpOwnerOrig; // original window proc of hwndOwner
|
---|
1303 |
|
---|
1304 | HAB habCnr;
|
---|
1305 |
|
---|
1306 | PCHECKBOXRECORDCORE preccClicked; // != NULL if mb1 is currently down on recc
|
---|
1307 | PCHECKBOXRECORDCORE preccSpace; // != NULL if space key is down with recc
|
---|
1308 | RECTL rclReccClicked; // rectangle of that record
|
---|
1309 | } CHECKBOXCNROWNER, *PCHECKBOXCNROWNER;
|
---|
1310 |
|
---|
1311 | MRESULT ctlDrawCheckBoxRecord(MPARAM mp2);
|
---|
1312 |
|
---|
1313 | ULONG ctlQueryCheckboxSize(VOID);
|
---|
1314 |
|
---|
1315 | VOID ctlInitCheckboxContainer(HWND hwndCnr);
|
---|
1316 |
|
---|
1317 | BOOL ctlMakeCheckboxContainer(HWND hwndCnrOwner,
|
---|
1318 | USHORT usCnrID);
|
---|
1319 |
|
---|
1320 | PCHECKBOXRECORDCORE ctlFindCheckRecord(HWND hwndCnr,
|
---|
1321 | ULONG ulItemID);
|
---|
1322 |
|
---|
1323 | BOOL ctlSetRecordChecked(HWND hwndCnr,
|
---|
1324 | ULONG ulItemID,
|
---|
1325 | USHORT usCheckState);
|
---|
1326 |
|
---|
1327 | ULONG ctlQueryRecordChecked(HWND hwndCnr,
|
---|
1328 | ULONG ulItemID,
|
---|
1329 | USHORT usCheckState);
|
---|
1330 |
|
---|
1331 | BOOL ctlEnableRecord(HWND hwndCnr,
|
---|
1332 | ULONG ulItemID,
|
---|
1333 | BOOL fEnable);
|
---|
1334 | #endif
|
---|
1335 |
|
---|
1336 | /* ******************************************************************
|
---|
1337 | *
|
---|
1338 | * Hotkey entry field
|
---|
1339 | *
|
---|
1340 | ********************************************************************/
|
---|
1341 |
|
---|
1342 | /*
|
---|
1343 | *@@ EN_HOTKEY:
|
---|
1344 | * extra notification code with WM_CONTROL
|
---|
1345 | * and subclassed hotkey entry fields.
|
---|
1346 | * This is SENT to the entry field's owner
|
---|
1347 | * every time a key is pressed. Note that
|
---|
1348 | * this is only sent for key-down events
|
---|
1349 | * and if all the KC_DEADKEY | KC_COMPOSITE | KC_INVALIDCOMP
|
---|
1350 | * flags are not set.
|
---|
1351 | *
|
---|
1352 | * WM_CONTROL parameters in this case:
|
---|
1353 | * -- mp1: USHORT id,
|
---|
1354 | * USHORT usNotifyCode == EN_HOTKEY
|
---|
1355 | * -- mp2: PHOTKEYNOTIFY struct pointer
|
---|
1356 | *
|
---|
1357 | * The receiving owner must check if the key
|
---|
1358 | * combo described in HOTKEYNOTIFY makes up
|
---|
1359 | * a valid hotkey and return a ULONG composed
|
---|
1360 | * of the following flags:
|
---|
1361 | *
|
---|
1362 | * -- HEFL_SETTEXT: if this is set, the text
|
---|
1363 | * of the entry field is set to the
|
---|
1364 | * text in HOTKEYNOTIFY.szDescription.
|
---|
1365 | *
|
---|
1366 | * -- HEFL_FORWARD2OWNER: if this is set, the
|
---|
1367 | * WM_CHAR message is instead passed
|
---|
1368 | * to the owner. Use this for the tab
|
---|
1369 | * key and such.
|
---|
1370 | *
|
---|
1371 | *@@added V0.9.1 (99-12-19) [umoeller]
|
---|
1372 | *@@changed V0.9.4 (2000-08-03) [umoeller]: added HEFL_* flags
|
---|
1373 | */
|
---|
1374 |
|
---|
1375 | #define EN_HOTKEY 0x1000
|
---|
1376 |
|
---|
1377 | #define HEFL_SETTEXT 0x0001
|
---|
1378 | #define HEFL_FORWARD2OWNER 0x0002
|
---|
1379 |
|
---|
1380 | typedef struct _HOTKEYNOTIFY
|
---|
1381 | {
|
---|
1382 | USHORT usFlags, // in: as in WM_CHAR
|
---|
1383 | usvk, // in: as in WM_CHAR
|
---|
1384 | usch; // in: as in WM_CHAR
|
---|
1385 | UCHAR ucScanCode; // in: as in WM_CHAR
|
---|
1386 | USHORT usKeyCode; // in: if KC_VIRTUAL is set, this has usKeyCode;
|
---|
1387 | // otherwise usCharCode
|
---|
1388 | CHAR szDescription[100]; // out: key description
|
---|
1389 | } HOTKEYNOTIFY, *PHOTKEYNOTIFY;
|
---|
1390 |
|
---|
1391 | BOOL ctlMakeHotkeyEntryField(HWND hwndHotkeyEntryField);
|
---|
1392 |
|
---|
1393 | /* ******************************************************************
|
---|
1394 | *
|
---|
1395 | * Color rectangle
|
---|
1396 | *
|
---|
1397 | ********************************************************************/
|
---|
1398 |
|
---|
1399 | BOOL ctlMakeColorRect(HWND hwndStatic);
|
---|
1400 | typedef BOOL CTLMAKECOLORRECT(HWND hwndStatic);
|
---|
1401 | typedef CTLMAKECOLORRECT *PCTLMAKECOLORRECT;
|
---|
1402 |
|
---|
1403 | #endif
|
---|
1404 |
|
---|
1405 | #if __cplusplus
|
---|
1406 | }
|
---|
1407 | #endif
|
---|
1408 |
|
---|