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

Last change on this file since 101 was 81, checked in by umoeller, 24 years ago

Tons of changes from the last weeks.

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