source: branches/branch-1-0/include/helpers/comctl.h@ 455

Last change on this file since 455 was 455, checked in by rlwalsh, 22 months ago

XButton: add full-size icon support

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