source: trunk/include/helpers/comctl.h@ 210

Last change on this file since 210 was 209, checked in by umoeller, 23 years ago

Dialog formatter rewrite.

  • Property svn:eol-style set to CRLF
  • Property svn:keywords set to Author Date Id Revision
File size: 44.4 KB
Line 
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 M”ller.
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
33extern "C" {
34#endif
35
36#ifndef COMCTL_HEADER_INCLUDED
37 #define COMCTL_HEADER_INCLUDED
38
39 /* ******************************************************************
40 *
41 * "Separator line" control
42 *
43 ********************************************************************/
44
45 #define WC_SEPARATORLINE "XwpSeparatorLine"
46
47 BOOL ctlRegisterSeparatorLine(HAB hab);
48
49 /* ******************************************************************
50 *
51 * "XButton" control
52 *
53 ********************************************************************/
54
55 /*
56 *@@ XBUTTONDATA:
57 * paint data for ctlPaintXButton.
58 *
59 *@@added V0.9.13 (2001-06-21) [umoeller]
60 */
61
62 typedef struct _XBUTTONDATA
63 {
64 RECTL rcl; // size of button (in presentation space
65 // coordinates); exclusive!
66
67 ULONG cxIconOrBitmap, // icon size
68 cyIconOrBitmap;
69
70 LONG lcol3DDark, // lo-3D color
71 lcol3DLight, // hi-3D color
72 lMiddle; // color for center (button background)
73
74 HPOINTER hptr; // icon to paint or NULLHANDLE
75
76 } XBUTTONDATA, *PXBUTTONDATA;
77
78 #define XBF_FLAT 0x00000001
79 #define XBF_BITMAP 0x00000002
80
81 #define XBF_PRESSED 0x00010000
82 #define XBF_BACKGROUND 0x00020000
83 #define XBF_INUSE 0x00040000
84
85 VOID ctlPaintXButton(HPS hps,
86 ULONG fl,
87 PXBUTTONDATA pxbd);
88
89 /* ******************************************************************
90 *
91 * "Menu button" control
92 *
93 ********************************************************************/
94
95 VOID ctlDisplayButtonMenu(HWND hwndButton,
96 HWND hwndMenu);
97
98 BOOL ctlMakeMenuButton(HWND hwndButton,
99 HMODULE hmodMenu,
100 ULONG idMenu);
101
102 /* ******************************************************************
103 *
104 * Progress bars
105 *
106 ********************************************************************/
107
108 /*
109 *@@ PROGRESSBARDATA:
110 * structure for progress bar data,
111 * saved at QWL_USER window ulong.
112 */
113
114 typedef struct _PROGRESSBARDATA
115 {
116 ULONG ulNow,
117 ulMax,
118 ulPaintX,
119 ulOldPaintX;
120 ULONG ulAttr;
121 PFNWP OldStaticProc;
122 } PROGRESSBARDATA, *PPROGRESSBARDATA;
123
124 #define WM_UPDATEPROGRESSBAR WM_USER+1000
125
126 // status bar style attributes
127 #define PBA_NOPERCENTAGE 0x0000
128 #define PBA_ALIGNLEFT 0x0001
129 #define PBA_ALIGNRIGHT 0x0002
130 #define PBA_ALIGNCENTER 0x0003
131 #define PBA_PERCENTFLAGS 0x0003
132 #define PBA_BUTTONSTYLE 0x0010
133
134 BOOL ctlProgressBarFromStatic(HWND hwndStatic, ULONG ulAttr);
135
136 /* ******************************************************************
137 *
138 * Chart Control
139 *
140 ********************************************************************/
141
142 /*
143 *@@ CHARTDATA:
144 * chart data. This represents the
145 * data to be displayed.
146 *
147 * Used with the CHTM_SETCHARTDATA message
148 * and stored within CHARTCDATA (below).
149 */
150
151 typedef struct _CHARTDATA
152 {
153 USHORT usStartAngle,
154 // for "pie chart" mode, angle to start with (0%).
155 // This must be in the range of 0 to 360 degrees,
156 // with 0 degrees being the rightmost point
157 // of the arc.
158
159 // All degree values are counter-clockwise from that point.
160 // Example: 90 will start the arc at the top.
161
162 // 90ø
163 // +++++++
164 // + +
165 // + +
166 // + +
167 // + +
168 // + +
169 // 180ø + X + 0ø
170 // + +
171 // + +
172 // + +
173 // + +
174 // + +
175 // +++++++
176 // 270ø
177
178 usSweepAngle;
179 // the maximum angle to use for 100%, in addition to
180 // usStartAngle.
181 // This must be in the range of 0 to 360 degrees,
182 // with 0 degrees being usStartAngle.
183 // All degree values are counter-clockwise from that point.
184 // Example: Specify usStartAngle = 180 (1) to start the pie
185 // at the left and usSweepAngle = 270 (2) to draw a
186 // three-quarter total pie.
187
188 // 90ø
189 // ++++
190 // + _ +
191 // + |\ +
192 // + \ +
193 // + \ +
194 // + | +
195 // (1) 180ø +++++++++++ | + 0ø
196 // + / +
197 // + \ (2) +
198 // + \ / +
199 // + ------ +
200 // + +
201 // +++++++
202 // 270ø
203
204 ULONG cValues;
205 // data item count; the arrays in *padValues and *palColors
206 // (and also *papszDescriptions, if CHS_DESCRIPTIONS is
207 // enabled in CHARTSTYLE) must have this many items.
208 double* padValues;
209 // pointer to an array of double values;
210 // the sum of all these will make up 100%
211 // in the chart. In "pie chart" mode, the
212 // sum of all these values corresponds to
213 // the usSweepAngle angle; in "bar chart" mode,
214 // the sum corresponds to the width of the control.
215 // If this ptr is NULL, the chart displays nothing.
216 // Otherwise, this array must have cValues items.
217 LONG* palColors;
218 // pointer to an array of LONG RGB colors;
219 // each item in this array must correspond
220 // to an item in padValues and specifies the color
221 // to paint the corresponding data item with.
222 // This _must_ be specified if padValues is != NULL.
223 // This array must have cValues items.
224 PSZ* papszDescriptions;
225 // pointer to an array of PSZs containing
226 // data descriptions. If this pointer is
227 // NULL, or CHARTSTYLE.ulStyle does not have
228 // CHS_DESCRIPTIONS set, no texts will be displayed.
229 // Otherwise, this array must have cValues items.
230 } CHARTDATA, *PCHARTDATA;
231
232 // chart display mode:
233 #define CHS_PIECHART 0x0000
234 #define CHS_BARCHART 0x0001
235
236 // chart display flags (CHARTSTYLE.ulStyle):
237 #define CHS_SHADOW 0x0100 // (pie chart only) draw shadow
238 #define CHS_3D_BRIGHT 0x0200 // (pie chart only)
239 // // draw 3D block in same color as surface;
240 // CHARTSTYLE.ulThickness defines thickness
241 #define CHS_3D_DARKEN 0x0600 // (pie chart only)
242 // draw 3D block too, but darker
243 // compared to surface;
244 // CHARTSTYLE.ulThickness defines thickness
245
246 #define CHS_DRAWLINES 0x0800 // draw lines between pie slices
247 // added V0.9.12 (2001-05-03) [umoeller]
248
249 #define CHS_DESCRIPTIONS 0x1000 // show descriptions
250 #define CHS_DESCRIPTIONS_3D 0x3000 // same as CHS_DESCRIPTIONS, but shaded
251
252 #define CHS_SELECTIONS 0x4000 // allow data items to be selected using
253 // mouse and keyboard; this also enables
254 // WM_CONTROL notifications
255
256 /*
257 *@@ CHARTSTYLE:
258 *
259 */
260
261 typedef struct _CHARTSTYLE
262 {
263 ULONG ulStyle; // CHS_* flags
264
265 ULONG ulThickness; // (pie chart only)
266 // pie thickness (with CHS_3D_xxx) in pixels
267
268 double dPieSize; // (pie chart only)
269 // // size of the pie chart relative to the control
270 // size. A value of 1 would make the pie chart
271 // consume all available space. A value of .5
272 // would make the pie chart consume half of the
273 // control's space. The pie chart is always
274 // centered within the control.
275
276 double dDescriptions; // (pie chart only)
277 // position of the slice descriptions on the pie
278 // relative to the window size. To calculate the
279 // description positions, the control calculates
280 // an invisible pie slice again, for which this
281 // value is used. So a value of 1 would make the
282 // descriptions appear on the outer parts of the
283 // window (not recommended). A value of .5 would
284 // make the descriptions appear in the center of
285 // an imaginary line between the pie's center
286 // and the pie slice's outer border.
287 // This should be chosen in conjunction with
288 // dPieSize as well. If this is equal to dPieSize,
289 // the descriptions appear on the border of the
290 // slice. If this is half dPieSize, the descriptions
291 // appear in the center of the pie slice. If this
292 // is larger than dPieSize, the descriptions appear
293 // outside the slice.
294 } CHARTSTYLE, *PCHARTSTYLE;
295
296 HBITMAP ctlCreateChartBitmap(HPS hpsMem,
297 LONG lcx,
298 LONG lcy,
299 PCHARTDATA pChartData,
300 PCHARTSTYLE pChartStyle,
301 LONG lBackgroundColor,
302 LONG lTextColor,
303 HRGN* paRegions);
304
305 BOOL ctlChartFromStatic(HWND hwndStatic);
306
307 #define CHTM_SETCHARTDATA (WM_USER + 2)
308
309 #define CHTM_SETCHARTSTYLE (WM_USER + 3)
310
311 #define CHTM_ITEMFROMPOINT (WM_USER + 4)
312
313 #define CHTM_SETEMPHASIS (WM_USER + 5)
314
315 // WM_CONTROL notification codes
316
317 /*
318 *@@ CHTN_EMPHASISCHANGED:
319 * WM_CONTROL notification code sent (!)
320 * by a chart control to its owner when
321 * selections change in the control.
322 *
323 * This is only sent if the CHS_SELECTIONS
324 * style bit is set in the control.
325 *
326 * Parameters:
327 *
328 * -- USHORT SHORT1FROMMP(mp1): usid (control ID).
329 * -- USHORT SHORT2FROMMP(mp1): CHTN_EMPHASISCHANGED.
330 *
331 * -- mp2: pointer to EMPHASISNOTIFY structure.
332 *
333 * Note: The control only sends one such notification,
334 * even if an old selection was undone. That is, if
335 * item 1 was previously selected and item 2 is then
336 * selected, only one notification for item 2 is sent.
337 *
338 *@@added V0.9.12 (2001-05-03) [umoeller]
339 */
340
341 #define CHTN_EMPHASISCHANGED 1001
342
343 /*
344 *@@ CHTN_CONTEXTMENU:
345 * WM_CONTROL notification code sent (!)
346 * by a chart control to its owner when
347 * a context menu was requested on the
348 * control.
349 *
350 * This is only sent if the CHS_SELECTIONS
351 * style bit is set in the control.
352 *
353 * Parameters:
354 *
355 * -- USHORT SHORT1FROMMP(mp1): usid (control ID).
356 * -- USHORT SHORT2FROMMP(mp1): CHTN_EMPHASISCHANGED.
357 *
358 * -- mp2: pointer to EMPHASISNOTIFY structure.
359 * If the context menu was requested on a chart
360 * slice, lIndex has the index of the slice.
361 * Otherwise (e.g. whitespace), lIndex will
362 * be -1.
363 *
364 *@@added V0.9.12 (2001-05-03) [umoeller]
365 */
366
367 #define CHTN_CONTEXTMENU 1002
368
369 /*
370 *@@ CHTN_ENTER:
371 * WM_CONTROL notification code sent (!)
372 * by a chart control to its owner when
373 * the user double-clicked on a data item.
374 *
375 * This is only sent if the CHS_SELECTIONS
376 * style bit is set in the control.
377 *
378 * Parameters:
379 *
380 * -- USHORT SHORT1FROMMP(mp1): usid (control ID).
381 * -- USHORT SHORT2FROMMP(mp1): CHTN_ENTER.
382 *
383 * -- mp2: pointer to EMPHASISNOTIFY structure.
384 * If the double click occured on a chart
385 * slice, lIndex has the index of the slice.
386 * Otherwise (e.g. whitespace), lIndex will
387 * be -1.
388 *
389 *@@added V0.9.12 (2001-05-03) [umoeller]
390 */
391
392 #define CHTN_ENTER 1003
393
394 /*
395 *@@ CHTN_SETFOCUS:
396 * WM_CONTROL notification code sent (!)
397 * by a chart control to its owner when
398 * gaining focus.
399 *
400 * Parameters:
401 *
402 * -- USHORT SHORT1FROMMP(mp1): usid (control ID).
403 * -- USHORT SHORT2FROMMP(mp1): CHTN_SETFOCUS.
404 *
405 * -- mp2: pointer to EMPHASISNOTIFY structure.
406 *
407 *@@added V0.9.20 (2002-07-17) [pr]
408 */
409
410 #define CHTN_SETFOCUS 1004
411
412 /*
413 *@@ CHTN_KILLFOCUS:
414 * WM_CONTROL notification code sent (!)
415 * by a chart control to its owner when
416 * losing focus.
417 *
418 * Parameters:
419 *
420 * -- USHORT SHORT1FROMMP(mp1): usid (control ID).
421 * -- USHORT SHORT2FROMMP(mp1): CHTN_KILLFOCUS.
422 *
423 * -- mp2: pointer to EMPHASISNOTIFY structure.
424 *
425 *@@added V0.9.20 (2002-07-17) [pr]
426 */
427
428 #define CHTN_KILLFOCUS 1005
429
430 /*
431 *@@ EMPHASISNOTIFY:
432 * structure used with CHTN_EMPHASISCHANGED,
433 * CHTN_ENTER, and CHTN_CONTEXTMENU.
434 *
435 *@@added V0.9.12 (2001-05-03) [umoeller]
436 */
437
438 typedef struct _EMPHASISNOTIFY
439 {
440 HWND hwndSource;
441 // window handle of the chart control
442 ULONG ulEmphasis;
443 // with CHTN_EMPHASISCHANGED: emphasis which has changed
444 // (0 for selection, 1 for source emphasis).
445 // Otherwise undefined.
446 LONG lIndex;
447 // with CHTN_EMPHASISCHANGED: index of the data
448 // item for which emphasis has changed (counting
449 // from 0); if -1, a previous emphasis has been undone.
450 // With CHTN_CONTEXTMENU and CHTN_ENTER, index of the
451 // data item for which the request occured, or -1 for
452 // a request on the control's whitespace.
453 POINTL ptl;
454 // exact window coordinates where mouse
455 // click occured (e.g. for context menu).
456 // This is undefined (-1) if the event was not
457 // caused by a mouse click.
458 } EMPHASISNOTIFY, *PEMPHASISNOTIFY;
459
460 /* ******************************************************************
461 *
462 * Super Combo Box
463 *
464 ********************************************************************/
465
466 BOOL ctlComboFromEntryField(HWND hwnd,
467 ULONG flStyle);
468
469 /* ******************************************************************
470 *
471 * Split bars
472 *
473 ********************************************************************/
474
475 #define WC_SPLITWINDOW "SplitWindowClass"
476
477 #define SBCF_VERTICAL 0x0000
478 #define SBCF_HORIZONTAL 0x0001
479
480 #define SBCF_PERCENTAGE 0x0002
481 #define SBCF_3DSUNK 0x0100
482 #define SBCF_MOVEABLE 0x1000
483
484 /*
485 *@@ SPLITBARCDATA:
486 * split bar creation data
487 */
488
489 typedef struct _SPLITBARCDATA
490 {
491 ULONG ulSplitWindowID;
492 // window ID of the split window
493 ULONG ulCreateFlags;
494 // split window style flags.
495 // One of the following:
496 // -- SBCF_VERTICAL: the split bar will be vertical.
497 // -- SBCF_HORIZONTAL: the split bar will be horizontal.
498 // plus any or none of the following:
499 // -- SBCF_PERCENTAGE: lPos does not specify absolute
500 // coordinates, but a percentage of the window
501 // width or height. In that case, the split
502 // bar position is not fixed, but always recalculated
503 // as a percentage.
504 // Otherwise, the split bar will be fixed.
505 // -- SBCF_3DSUNK: draw a "sunk" 3D frame around the
506 // split windows.
507 // -- SBCF_MOVEABLE: the split bar may be moved with
508 // the mouse.
509 LONG lPos;
510 // position of the split bar within hwndParentAndOwner.
511 // If SBCF_PERCENTAGE, this has the percentage;
512 // otherwise:
513 // if this value is positive, it's considered
514 // an offset from the left/bottom of the frame;
515 // if it's negative, it's from the right
516 ULONG ulLeftOrBottomLimit,
517 ulRightOrTopLimit;
518 // when moving the split bar (SBCF_MOVEABLE), these
519 // are the minimum and maximum values.
520 // ulLeftOrBottomLimit is the left (or bottom) limit,
521 // ulRightOrTopLimit is the right (or top) limit.
522 // Both are offsets in window coordinates from the
523 // left (or bottom) and right (or top) boundaries of
524 // the split window. If both are 0, the whole split
525 // window is allowed (not recommended).
526 HWND hwndParentAndOwner;
527 // the owner and parent of the split bar
528 // and other windows; this must be the FID_CLIENT
529 // of a frame or another split window (when nesting)
530 } SPLITBARCDATA, *PSPLITBARCDATA;
531
532 /*
533 *@@ SPLITBARDATA:
534 * internal split bar data,
535 * stored in QWL_USER window ulong
536 */
537
538 typedef struct _SPLITBARDATA
539 {
540 SPLITBARCDATA sbcd;
541 PFNWP OldStaticProc;
542 // RECTL rclBar;
543 HPOINTER hptrOld, // old pointer stored upon WM_MOUSEMOVE
544 hptrMove; // PM move pointer, either vertical or horizontal
545 BOOL fCaptured;
546 POINTS ptsMousePos;
547 POINTL ptlDrawLineFrom,
548 ptlDrawLineTo;
549 HPS hpsTrackBar;
550 HWND hwndLinked1,
551 // the left/bottom window to link
552 hwndLinked2;
553 // the right/top window to link
554 } SPLITBARDATA, *PSPLITBARDATA;
555
556 #define ID_SPLITBAR 5000 // fixed ID of the split bar
557 // (child of split window)
558
559 /*
560 *@@ SPLM_SETLINKS:
561 * this specifies the windows which the
562 * split window will link. This updates
563 * the internal SPLITBARDATA and changes
564 * the parents of the two subwindows to
565 * the split window.
566 *
567 * Parameters:
568 * HWND mp1: left or bottom subwindow
569 * HWND mp2: right or top subwindow
570 */
571
572 #define SPLM_SETLINKS (WM_USER + 500)
573
574 HWND ctlCreateSplitWindow(HAB hab,
575 PSPLITBARCDATA psbcd);
576
577 BOOL ctlUpdateSplitWindow(HWND hwndSplit);
578
579 BOOL ctlSetSplitFrameWindowPos(HWND hwndFrame,
580 HWND hwndInsertBehind,
581 LONG x,
582 LONG y,
583 LONG cx,
584 LONG cy,
585 ULONG fl,
586 HWND *pahwnd,
587 ULONG cbhwnd);
588
589 LONG ctlQuerySplitPos(HWND hwndSplit);
590
591 /* ******************************************************************
592 *
593 * Subclassed Static Bitmap Control
594 *
595 ********************************************************************/
596
597 // flags for ANIMATIONDATA.ulFlags
598 #define ANF_ICON 0x0001
599 #define ANF_BITMAP 0x0002
600 #define ANF_PROPORTIONAL 0x0004
601
602 /*
603 *@@ ANIMATIONDATA:
604 * this structure gets stored in QWL_USER
605 * before subclassing the static control
606 *
607 *@@changed V0.9.0: added fields for bitmap support
608 *@@changed V0.9.16 (2001-10-15) [umoeller]: added lIconSize
609 *@@changed V0.9.19 (2002-06-18) [umoeller]: added szlIcon
610 */
611
612 typedef struct _ANIMATIONDATA
613 {
614 // the following need to be initialized before
615 // subclassing
616 HAB hab; // (added V0.9.0)
617 ULONG ulFlags;
618 // one of the following:
619 // -- ANF_ICON: display icons
620 // -- ANF_BITMAP: display bitmaps
621 // -- ANF_BITMAP | ANF_PROPORTIONAL: display bitmaps, but preserve proportions
622 SIZEL szlIcon; // system icon size V0.9.19 (2002-06-18) [umoeller]
623 RECTL rclIcon; // size of static control
624 PFNWP OldStaticProc; // original WC_STATIC wnd proc
625
626 // the following are set by fnwpSubclassedStatic upon
627 // receiving SM_SETHANDLE (in all modes) or later
628 HBITMAP hbm, // bitmap to be painted upon WM_PAINT
629 hbmHalftoned; // bitmap in case of WS_DISABLED (added V0.9.0)
630 HPOINTER hptr; // icon handle passed to SM_SETHANDLE
631 HBITMAP hbmSource; // bitmap handle passed to SM_SETHANDLE
632 // (this can be deleted later) (added V0.9.0)
633
634 // the following need to be initialized
635 // for icon mode only (ANF_ICON)
636 ULONG ulDelay; // delay per animation step in ms
637 USHORT usAniCurrent; // current animation step (>= 0)
638
639 USHORT usAniCount; // no. of animation steps
640 HPOINTER ahptrAniIcons[1]; // variable-size array of animation steps;
641 // there must be usAniCount items
642 } ANIMATIONDATA, *PANIMATIONDATA;
643
644 PANIMATIONDATA ctlPrepareStaticIcon(HWND hwndStatic, USHORT usAnimCount);
645
646 BOOL ctlPrepareAnimation(HWND hwndStatic,
647 USHORT usAnimCount,
648 HPOINTER *pahptr,
649 ULONG ulDelay,
650 BOOL fStartAnimation);
651
652 BOOL ctlStartAnimation(HWND hwndStatic);
653
654 BOOL ctlStopAnimation(HWND hwndStatic);
655
656 PANIMATIONDATA ctlPrepareStretchedBitmap(HWND hwndStatic,
657 BOOL fPreserveProportions);
658
659
660 /* ******************************************************************
661 *
662 * "Tooltip" control
663 *
664 ********************************************************************/
665
666 // addt'l tooltip window styles: use lower 16 bits
667 #define TTS_ALWAYSTIP 0x0001
668 #define TTS_NOPREFIX 0x0002
669 // non-Win95 flags
670 #define TTS_ROUNDED 0x0004
671 #define TTS_SHADOW 0x0008
672
673 // TOOLINFO.uFlags flags (ORed)
674 // #define TTF_IDISHWND 0x0001
675 // V0.9.7 (2001-01-03) [umoeller]: removed this win95 crap
676 // #define TTF_CENTERBELOW 0x0002
677 // #define TTF_CENTERABOVE 0x0004
678 // #define TTF_RTLREADING 0x0004
679 // V0.9.7 (2001-01-03) [umoeller]: removed this win95 crap
680
681 #define TTF_SUBCLASS 0x0008
682 // non-Win95 flags
683 #define TTF_SHYMOUSE 0x0010
684
685 // new flags with V0.9.7 (2001-01-20) [umoeller]
686 #define TTF_CENTER_X_ON_TOOL 0x0020
687 #define TTF_POS_Y_ABOVE_TOOL 0x0040
688 #define TTF_POS_Y_BELOW_TOOL 0x0080
689
690 #define PSZ_TEXTCALLBACK (PSZ)-1
691
692 #define TT_SHADOWOFS 10
693 #define TT_ROUNDING 8
694
695 /*
696 *@@ TOOLINFO:
697 * info structure to register a tool with a
698 * tooltip control. Used with TTM_ADDTOOL
699 * and many other TTM_* messages.
700 *
701 *@@changed V0.9.7 (2001-01-03) [umoeller]: removed all that win95 crap
702 */
703
704 typedef struct _TOOLINFO
705 {
706 ULONG ulFlags;
707 // in: flags for the tool, any combination of:
708 // -- TTF_SUBCLASS: Indicates that the tooltip control should
709 // subclass hwndTool to intercept messages,
710 // such as WM_MOUSEMOVE. See TTM_RELAYEVENT.
711 // -- TTF_SHYMOUSE: shy away from mouse pointer;
712 // always position the tool tip such that it is never
713 // covered by the mouse pointer (for readability);
714 // added V0.9.1 (2000-02-04) [umoeller]
715 // -- TTF_CENTER_X_ON_TOOL: position tooltip X so that
716 // it's centered on the tool (doesn't affect Y)
717 // -- TTF_POS_Y_ABOVE_TOOL: position tooltip Y above
718 // the tool; cannot be used with TTF_POS_Y_BELOW_TOOL
719 // -- TTF_POS_Y_BELOW_TOOL: position tooltip Y below
720 // the tool; cannot be used with TTF_POS_Y_ABOVE_TOOL
721 HWND hwndToolOwner;
722 // in: handle to the window that contains the tool. If
723 // pszText includes the PSZ_TEXTCALLBACK value, this
724 // member identifies the window that receives TTN_NEEDTEXT
725 // notification messages.
726 HWND hwndTool;
727 // in: window handle of the tool.
728 PSZ pszText;
729 // in: pointer to the buffer that contains the text for the
730 // tool (if the hiword is != NULL), or identifier of the string
731 // resource that contains the text (if the hiword == NULL).
732 // If this member is set to the PSZ_TEXTCALLBACK value,
733 // the control sends the TTN_NEEDTEXT notification message to
734 // hwndToolOwner to retrieve the text.
735 } TOOLINFO, *PTOOLINFO;
736
737 /*
738 * tooltip messages
739 *
740 */
741
742 #define TTM_FIRST (WM_USER + 1000)
743
744 #define TTM_ACTIVATE (TTM_FIRST + 1)
745
746 #define TTM_ADDTOOL (TTM_FIRST + 2)
747
748 #define TTM_DELTOOL (TTM_FIRST + 3)
749
750 #define TTM_NEWTOOLRECT (TTM_FIRST + 4)
751
752 #define TTM_RELAYEVENT (TTM_FIRST + 5)
753
754 // flags for TTM_SETDELAYTIME
755 #define TTDT_AUTOMATIC 1
756 #define TTDT_AUTOPOP 2
757 #define TTDT_INITIAL 3
758 #define TTDT_RESHOW 4
759
760 #define TTM_GETDELAYTIME (TTM_FIRST + 6)
761 // added V0.9.12 (2001-04-28) [umoeller]
762
763 #define TTM_SETDELAYTIME (TTM_FIRST + 7)
764
765 #define TTFMT_PSZ 0x01
766 #define TTFMT_STRINGRES 0x02
767
768 /*
769 *@@ TOOLTIPTEXT:
770 * identifies a tool for which text is to
771 * be displayed and receives the text for
772 * the tool. The tool must fill all fields
773 * of this structure.
774 *
775 * This structure is used with the TTN_NEEDTEXT
776 * notification.
777 *
778 *@@changed V0.9.7 (2001-01-03) [umoeller]: got rid of this win95 crap
779 */
780
781 typedef struct _TOOLTIPTEXT
782 {
783 HWND hwndTooltip;
784 // in: tooltip control who's sending this.
785 HWND hwndTool;
786 // in: tool for which the text is needed.
787 ULONG ulFormat;
788 // out: one of:
789 // -- TTFMT_PSZ: pszText contains the new, zero-terminated string.
790 // -- TTFMT_STRINGRES: hmod and idResource specify a string resource
791 // to be loaded.
792 PSZ pszText;
793 // out: with TTFMT_PSZ, pointer to a string that contains the
794 // tool text. Note that this is not copied into the tooltip...
795 // so this must point to a static buffer that is valid while
796 // the tooltip is showing.
797 HMODULE hmod;
798 // out: with TTFMT_STRINGRES, the module handle of the resource.
799 ULONG idResource;
800 // out: with TTFMT_STRINGRES, the string resource ID.
801 } TOOLTIPTEXT, *PTOOLTIPTEXT;
802
803 #define TTM_GETTEXT (TTM_FIRST + 8)
804
805 #define TTM_UPDATETIPTEXT (TTM_FIRST + 9)
806
807 /*
808 *@@ TT_HITTESTINFO:
809 * contains information that a tooltip control uses to determine whether
810 * a point is in the bounding rectangle of the specified tool. If the point
811 * is in the rectangle, the structure receives information about the tool.
812 *
813 * This structure is used with the TTM_HITTEST message.
814 */
815
816 typedef struct _TT_HITTESTINFO
817 {
818 HWND hwnd; // in: handle to the tool or window with the specified tool.
819 POINTL /* POINT */ pt;
820 // in: client coordinates of the point to test (Win95: POINT)
821 TOOLINFO ti; // out: receives information about the specified tool.
822 } TTHITTESTINFO, *PHITTESTINFO;
823
824 #define TTM_HITTEST (TTM_FIRST + 10)
825
826 #define TTM_WINDOWFROMPOINT (TTM_FIRST + 11)
827
828 #define TTM_ENUMTOOLS (TTM_FIRST + 12)
829
830 #define TTM_GETCURRENTTOOL (TTM_FIRST + 13)
831
832 #define TTM_GETTOOLCOUNT (TTM_FIRST + 14)
833
834 #define TTM_GETTOOLINFO (TTM_FIRST + 15)
835
836 #define TTM_SETTOOLINFO (TTM_FIRST + 16)
837
838 // non-Win95 messages
839
840 #define TTM_SHOWTOOLTIPNOW (TTM_FIRST + 17)
841
842 /*
843 * tooltip notification codes (WM_CONTROL)
844 *
845 */
846
847 /*
848 *@@ TTN_NEEDTEXT:
849 * notification code used with WM_CONTROL when a tooltip
850 * needs a tooltip text for a tool.
851 *
852 * Parameters:
853 *
854 * -- SHORT1FROMMP(mp1) usID: ID of the tooltip control).
855 *
856 * -- SHORT2FROMMP(mp1) usNotifyCode: TTN_NEEDTEXT.
857 *
858 * -- PTOOLTIPTEXT mp2: pointer to a TOOLTIPTEXT structure.
859 * hwndTool identifies the tool for which text is needed.
860 *
861 * This notification message is sent to the window specified
862 * in the hwndToolOwner member of the TOOLINFO structure for the tool.
863 * This notification is sent only if the PSZ_TEXTCALLBACK
864 * value is specified when the tool is added to a tooltip control.
865 *
866 * To specify the text, the target window (hwndToolOwner) must:
867 *
868 * 1. Set TOOLTIPTEXT.ulFormat to one of the format flags.
869 *
870 * 2. Fill the corresponding field(s) in TOOLTIPTEXT.
871 *
872 * Specifying PSZ_TEXTCALLBACK in TOOLINFO.lpszText with
873 * TTM_ADDTOOL is the only way under OS/2 to have strings
874 * displayed which are longer than 256 characters, since
875 * string resources are limited to 256 characters with OS/2.
876 * It is the responsibility of the application to set the
877 * pszText member to a _static_ string buffer which holds
878 * the string for the tool. A common error would be to have
879 * that member point to some variable which has only been
880 * allocated on the stack... this will lead to problems.
881 */
882
883 #define TTN_NEEDTEXT 1000
884
885 /*
886 *@@ TTN_SHOW:
887 * control notification sent with the WM_NOTIFY (Win95)
888 * and WM_CONTROL (OS/2) messages.
889 *
890 * Parameters (OS/2, incompatible with Win95):
891 * -- mp1 USHORT usID;
892 * USHORT usNotifyCode == TTN_NEEDTEXT
893 * -- ULONG mp2: PTOOLINFO of the tool for which the
894 * tool is about to be displayed.
895 *
896 * Return value: always 0.
897 *
898 * The TTN_SHOW notification message notifies the owner window
899 * that a tooltip is about to be displayed.
900 */
901
902 #define TTN_SHOW 1001
903
904 /*
905 *@@ TTN_POP:
906 * control notification sent with the WM_NOTIFY (Win95)
907 * and WM_CONTROL (OS/2) messages.
908 *
909 * Parameters (OS/2, incompatible with Win95):
910 * -- mp1 USHORT usID;
911 * USHORT usNotifyCode == TTN_NEEDTEXT
912 * -- ULONG mp2: PTOOLINFO of the tool for which the
913 * tooltip was visible.
914 *
915 * Return value: always 0.
916 *
917 * The TTN_SHOW notification message notifies the owner window
918 * that a tooltip is about to be hidden.
919 */
920
921 #define TTN_POP 1002
922
923 #define COMCTL_TOOLTIP_CLASS "ComctlTooltipClass"
924
925 BOOL ctlRegisterTooltip(HAB hab);
926
927 MRESULT EXPENTRY ctl_fnwpTooltip(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2);
928
929 /* ******************************************************************
930 *
931 * Checkbox container record cores
932 *
933 ********************************************************************/
934
935 BOOL ctlDrawCheckbox(HPS hps,
936 LONG x,
937 LONG y,
938 USHORT usRow,
939 USHORT usColumn,
940 BOOL fHalftoned);
941
942 #ifdef INCL_WINSTDCNR
943
944 /*
945 *@@ CN_RECORDCHECKED:
946 * extra WM_CONTROL notification code.
947 * See ctlMakeCheckboxContainer for
948 * details.
949 */
950
951 #define CN_RECORDCHECKED 999
952
953 /*
954 *@@ CHECKBOXRECORDCORE:
955 * extended record core structure used
956 * with checkbox containers. See
957 * ctlMakeCheckboxContainer for details.
958 *
959 * The check box painting is determined
960 * by the following flags:
961 *
962 * -- Only if (ulStyle & WS_VISIBLE), the check
963 * box is painted at all. Otherwise hptrIcon
964 * is painted. (Is this true?)
965 *
966 * -- In that case, usCheckState determines
967 * whether the check box is painted checked,
968 * unchecked, or indeterminate.
969 *
970 * -- In addition, if RECORDCORE.flRecordAttr
971 * has the CRA_DISABLED bit set, the check
972 * box is painted disabled (halftoned).
973 *
974 *@@changed V0.9.9 (2001-03-27) [umoeller]: made item id a ULONG
975 */
976
977 typedef struct _CHECKBOXRECORDCORE
978 {
979 RECORDCORE recc;
980 // standard record core structure
981 ULONG ulStyle;
982 // any combination of the following:
983 // -- WS_VISIBLE
984 // -- none or one of the following:
985 // BS_AUTOCHECKBOX, BS_AUTO3STATE, BS_3STATE
986 // Internally, we use BS_BITMAP to identify
987 // the depressed checkbox button.
988 ULONG ulItemID;
989 // this identifies the record; must be
990 // unique within the container
991 // changed V0.9.9 (2001-03-27) [umoeller]: turned USHORT into ULONG
992 USHORT usCheckState;
993 // current check state as with checkboxes
994 // (0, 1, or 2 for tri-state).
995 HPOINTER hptrIcon;
996 // if this is != NULLHANDLE, this icon
997 // will always be used for painting,
998 // instead of the default check box
999 // bitmaps. Useful for non-auto check
1000 // box records to implement something
1001 // other than checkboxes.
1002 } CHECKBOXRECORDCORE, *PCHECKBOXRECORDCORE;
1003
1004 /*
1005 *@@ CHECKBOXCNROWNER:
1006 *
1007 *
1008 *@@added V0.9.0 (99-11-28) [umoeller]
1009 */
1010
1011 typedef struct _CHECKBOXCNROWNER
1012 {
1013 HWND hwndCnr; // container window handle
1014 USHORT usCnrID; // container item ID
1015 HWND hwndOwner; // owner of that container
1016 PFNWP pfnwpCnrOrig; // original window proc of hwndCnr
1017 PFNWP pfnwpOwnerOrig; // original window proc of hwndOwner
1018
1019 HAB habCnr;
1020
1021 PCHECKBOXRECORDCORE preccClicked; // != NULL if mb1 is currently down on recc
1022 PCHECKBOXRECORDCORE preccSpace; // != NULL if space key is down with recc
1023 RECTL rclReccClicked; // rectangle of that record
1024 } CHECKBOXCNROWNER, *PCHECKBOXCNROWNER;
1025
1026 MRESULT ctlDrawCheckBoxRecord(MPARAM mp2);
1027
1028 ULONG ctlQueryCheckboxSize(VOID);
1029
1030 VOID ctlInitCheckboxContainer(HWND hwndCnr);
1031
1032 BOOL ctlMakeCheckboxContainer(HWND hwndCnrOwner,
1033 USHORT usCnrID);
1034
1035 PCHECKBOXRECORDCORE ctlFindCheckRecord(HWND hwndCnr,
1036 ULONG ulItemID);
1037
1038 BOOL ctlSetRecordChecked(HWND hwndCnr,
1039 ULONG ulItemID,
1040 USHORT usCheckState);
1041
1042 ULONG ctlQueryRecordChecked(HWND hwndCnr,
1043 ULONG ulItemID,
1044 USHORT usCheckState);
1045
1046 BOOL ctlEnableRecord(HWND hwndCnr,
1047 ULONG ulItemID,
1048 BOOL fEnable);
1049 #endif
1050
1051 /* ******************************************************************
1052 *
1053 * Hotkey entry field
1054 *
1055 ********************************************************************/
1056
1057 /*
1058 *@@ EN_HOTKEY:
1059 * extra notification code with WM_CONTROL
1060 * and subclassed hotkey entry fields.
1061 * This is SENT to the entry field's owner
1062 * every time a key is pressed. Note that
1063 * this is only sent for key-down events
1064 * and if all the KC_DEADKEY | KC_COMPOSITE | KC_INVALIDCOMP
1065 * flags are not set.
1066 *
1067 * WM_CONTROL parameters in this case:
1068 * -- mp1: USHORT id,
1069 * USHORT usNotifyCode == EN_HOTKEY
1070 * -- mp2: PHOTKEYNOTIFY struct pointer
1071 *
1072 * The receiving owner must check if the key
1073 * combo described in HOTKEYNOTIFY makes up
1074 * a valid hotkey and return a ULONG composed
1075 * of the following flags:
1076 *
1077 * -- HEFL_SETTEXT: if this is set, the text
1078 * of the entry field is set to the
1079 * text in HOTKEYNOTIFY.szDescription.
1080 *
1081 * -- HEFL_FORWARD2OWNER: if this is set, the
1082 * WM_CHAR message is instead passed
1083 * to the owner. Use this for the tab
1084 * key and such.
1085 *
1086 *@@added V0.9.1 (99-12-19) [umoeller]
1087 *@@changed V0.9.4 (2000-08-03) [umoeller]: added HEFL_* flags
1088 */
1089
1090 #define EN_HOTKEY 0x1000
1091
1092 #define HEFL_SETTEXT 0x0001
1093 #define HEFL_FORWARD2OWNER 0x0002
1094
1095 typedef struct _HOTKEYNOTIFY
1096 {
1097 USHORT usFlags, // in: as in WM_CHAR
1098 usvk, // in: as in WM_CHAR
1099 usch; // in: as in WM_CHAR
1100 UCHAR ucScanCode; // in: as in WM_CHAR
1101 USHORT usKeyCode; // in: if KC_VIRTUAL is set, this has usKeyCode;
1102 // otherwise usCharCode
1103 CHAR szDescription[100]; // out: key description
1104 } HOTKEYNOTIFY, *PHOTKEYNOTIFY;
1105
1106 BOOL ctlMakeHotkeyEntryField(HWND hwndHotkeyEntryField);
1107
1108 /* ******************************************************************
1109 *
1110 * Color rectangle
1111 *
1112 ********************************************************************/
1113
1114 BOOL ctlMakeColorRect(HWND hwndStatic);
1115 typedef BOOL CTLMAKECOLORRECT(HWND hwndStatic);
1116 typedef CTLMAKECOLORRECT *PCTLMAKECOLORRECT;
1117
1118#endif
1119
1120#if __cplusplus
1121}
1122#endif
1123
Note: See TracBrowser for help on using the repository browser.