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

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

Misc updates.

  • Property svn:eol-style set to CRLF
  • Property svn:keywords set to Author Date Id Revision
File size: 41.3 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 * "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 *@@changed V0.9.16 (2001-10-15) [umoeller]: added ulIconSize
552 */
553
554 typedef struct _ANIMATIONDATA
555 {
556 // the following need to be initialized before
557 // subclassing
558 HAB hab; // (added V0.9.0)
559 ULONG ulFlags;
560 // one of the following:
561 // -- ANF_ICON: display icons
562 // -- ANF_BITMAP: display bitmaps
563 // -- ANF_BITMAP | ANF_PROPORTIONAL: display bitmaps, but preserve proportions
564 LONG lIconSize; // system icon size V0.9.16 (2001-10-15) [umoeller]
565 RECTL rclIcon; // size of static control
566 PFNWP OldStaticProc; // original WC_STATIC wnd proc
567
568 // the following are set by fnwpSubclassedStatic upon
569 // receiving SM_SETHANDLE (in all modes) or later
570 HBITMAP hbm, // bitmap to be painted upon WM_PAINT
571 hbmHalftoned; // bitmap in case of WS_DISABLED (added V0.9.0)
572 HPOINTER hptr; // icon handle passed to SM_SETHANDLE
573 HBITMAP hbmSource; // bitmap handle passed to SM_SETHANDLE
574 // (this can be deleted later) (added V0.9.0)
575
576 // the following need to be initialized
577 // for icon mode only (ANF_ICON)
578 ULONG ulDelay; // delay per animation step in ms
579 USHORT usAniCurrent; // current animation step (>= 0)
580
581 USHORT usAniCount; // no. of animation steps
582 HPOINTER ahptrAniIcons[1]; // variable-size array of animation steps;
583 // there must be usAniCount items
584 } ANIMATIONDATA, *PANIMATIONDATA;
585
586 PANIMATIONDATA ctlPrepareStaticIcon(HWND hwndStatic, USHORT usAnimCount);
587
588 BOOL ctlPrepareAnimation(HWND hwndStatic,
589 USHORT usAnimCount,
590 HPOINTER *pahptr,
591 ULONG ulDelay,
592 BOOL fStartAnimation);
593
594 BOOL ctlStartAnimation(HWND hwndStatic);
595
596 BOOL ctlStopAnimation(HWND hwndStatic);
597
598 PANIMATIONDATA ctlPrepareStretchedBitmap(HWND hwndStatic,
599 BOOL fPreserveProportions);
600
601
602 /* ******************************************************************
603 *
604 * "Tooltip" control
605 *
606 ********************************************************************/
607
608 // addt'l tooltip window styles: use lower 16 bits
609 #define TTS_ALWAYSTIP 0x0001
610 #define TTS_NOPREFIX 0x0002
611 // non-Win95 flags
612 #define TTS_ROUNDED 0x0004
613 #define TTS_SHADOW 0x0008
614
615 // TOOLINFO.uFlags flags (ORed)
616 // #define TTF_IDISHWND 0x0001
617 // V0.9.7 (2001-01-03) [umoeller]: removed this win95 crap
618 // #define TTF_CENTERBELOW 0x0002
619 // #define TTF_CENTERABOVE 0x0004
620 // #define TTF_RTLREADING 0x0004
621 // V0.9.7 (2001-01-03) [umoeller]: removed this win95 crap
622
623 #define TTF_SUBCLASS 0x0008
624 // non-Win95 flags
625 #define TTF_SHYMOUSE 0x0010
626
627 // new flags with V0.9.7 (2001-01-20) [umoeller]
628 #define TTF_CENTER_X_ON_TOOL 0x0020
629 #define TTF_POS_Y_ABOVE_TOOL 0x0040
630 #define TTF_POS_Y_BELOW_TOOL 0x0080
631
632 #define PSZ_TEXTCALLBACK (PSZ)-1
633
634 #define TT_SHADOWOFS 10
635 #define TT_ROUNDING 8
636
637 /*
638 *@@ TOOLINFO:
639 * info structure to register a tool with a
640 * tooltip control. Used with TTM_ADDTOOL
641 * and many other TTM_* messages.
642 *
643 *@@changed V0.9.7 (2001-01-03) [umoeller]: removed all that win95 crap
644 */
645
646 typedef struct _TOOLINFO
647 {
648 ULONG ulFlags;
649 // in: flags for the tool, any combination of:
650 // -- TTF_SUBCLASS: Indicates that the tooltip control should
651 // subclass hwndTool to intercept messages,
652 // such as WM_MOUSEMOVE. See TTM_RELAYEVENT.
653 // -- TTF_SHYMOUSE: shy away from mouse pointer;
654 // always position the tool tip such that it is never
655 // covered by the mouse pointer (for readability);
656 // added V0.9.1 (2000-02-04) [umoeller]
657 // -- TTF_CENTER_X_ON_TOOL: position tooltip X so that
658 // it's centered on the tool (doesn't affect Y)
659 // -- TTF_POS_Y_ABOVE_TOOL: position tooltip Y above
660 // the tool; cannot be used with TTF_POS_Y_BELOW_TOOL
661 // -- TTF_POS_Y_BELOW_TOOL: position tooltip Y below
662 // the tool; cannot be used with TTF_POS_Y_ABOVE_TOOL
663 HWND hwndToolOwner;
664 // in: handle to the window that contains the tool. If
665 // pszText includes the PSZ_TEXTCALLBACK value, this
666 // member identifies the window that receives TTN_NEEDTEXT
667 // notification messages.
668 HWND hwndTool;
669 // in: window handle of the tool.
670 PSZ pszText;
671 // in: pointer to the buffer that contains the text for the
672 // tool (if the hiword is != NULL), or identifier of the string
673 // resource that contains the text (if the hiword == NULL).
674 // If this member is set to the PSZ_TEXTCALLBACK value,
675 // the control sends the TTN_NEEDTEXT notification message to
676 // hwndToolOwner to retrieve the text.
677 } TOOLINFO, *PTOOLINFO;
678
679 /*
680 * tooltip messages
681 *
682 */
683
684 #define TTM_FIRST (WM_USER + 1000)
685
686 #define TTM_ACTIVATE (TTM_FIRST + 1)
687
688 #define TTM_ADDTOOL (TTM_FIRST + 2)
689
690 #define TTM_DELTOOL (TTM_FIRST + 3)
691
692 #define TTM_NEWTOOLRECT (TTM_FIRST + 4)
693
694 #define TTM_RELAYEVENT (TTM_FIRST + 5)
695
696 // flags for TTM_SETDELAYTIME
697 #define TTDT_AUTOMATIC 1
698 #define TTDT_AUTOPOP 2
699 #define TTDT_INITIAL 3
700 #define TTDT_RESHOW 4
701
702 #define TTM_GETDELAYTIME (TTM_FIRST + 6)
703 // added V0.9.12 (2001-04-28) [umoeller]
704
705 #define TTM_SETDELAYTIME (TTM_FIRST + 7)
706
707 #define TTFMT_PSZ 0x01
708 #define TTFMT_STRINGRES 0x02
709
710 /*
711 *@@ TOOLTIPTEXT:
712 * identifies a tool for which text is to
713 * be displayed and receives the text for
714 * the tool. The tool must fill all fields
715 * of this structure.
716 *
717 * This structure is used with the TTN_NEEDTEXT
718 * notification.
719 *
720 *@@changed V0.9.7 (2001-01-03) [umoeller]: got rid of this win95 crap
721 */
722
723 typedef struct _TOOLTIPTEXT
724 {
725 HWND hwndTooltip;
726 // in: tooltip control who's sending this.
727 HWND hwndTool;
728 // in: tool for which the text is needed.
729 ULONG ulFormat;
730 // out: one of:
731 // -- TTFMT_PSZ: pszText contains the new, zero-terminated string.
732 // -- TTFMT_STRINGRES: hmod and idResource specify a string resource
733 // to be loaded.
734 PSZ pszText;
735 // out: with TTFMT_PSZ, pointer to a string that contains the
736 // tool text. Note that this is not copied into the tooltip...
737 // so this must point to a static buffer that is valid while
738 // the tooltip is showing.
739 HMODULE hmod;
740 // out: with TTFMT_STRINGRES, the module handle of the resource.
741 ULONG idResource;
742 // out: with TTFMT_STRINGRES, the string resource ID.
743 } TOOLTIPTEXT, *PTOOLTIPTEXT;
744
745 #define TTM_GETTEXT (TTM_FIRST + 8)
746
747 #define TTM_UPDATETIPTEXT (TTM_FIRST + 9)
748
749 /*
750 *@@ TT_HITTESTINFO:
751 * contains information that a tooltip control uses to determine whether
752 * a point is in the bounding rectangle of the specified tool. If the point
753 * is in the rectangle, the structure receives information about the tool.
754 *
755 * This structure is used with the TTM_HITTEST message.
756 */
757
758 typedef struct _TT_HITTESTINFO
759 {
760 HWND hwnd; // in: handle to the tool or window with the specified tool.
761 POINTL /* POINT */ pt;
762 // in: client coordinates of the point to test (Win95: POINT)
763 TOOLINFO ti; // out: receives information about the specified tool.
764 } TTHITTESTINFO, *PHITTESTINFO;
765
766 #define TTM_HITTEST (TTM_FIRST + 10)
767
768 #define TTM_WINDOWFROMPOINT (TTM_FIRST + 11)
769
770 #define TTM_ENUMTOOLS (TTM_FIRST + 12)
771
772 #define TTM_GETCURRENTTOOL (TTM_FIRST + 13)
773
774 #define TTM_GETTOOLCOUNT (TTM_FIRST + 14)
775
776 #define TTM_GETTOOLINFO (TTM_FIRST + 15)
777
778 #define TTM_SETTOOLINFO (TTM_FIRST + 16)
779
780 // non-Win95 messages
781
782 #define TTM_SHOWTOOLTIPNOW (TTM_FIRST + 17)
783
784 /*
785 * tooltip notification codes (WM_CONTROL)
786 *
787 */
788
789 /*
790 *@@ TTN_NEEDTEXT:
791 * notification code used with WM_CONTROL when a tooltip
792 * needs a tooltip text for a tool.
793 *
794 * Parameters:
795 *
796 * -- SHORT1FROMMP(mp1) usID: ID of the tooltip control).
797 *
798 * -- SHORT2FROMMP(mp1) usNotifyCode: TTN_NEEDTEXT.
799 *
800 * -- PTOOLTIPTEXT mp2: pointer to a TOOLTIPTEXT structure.
801 * hwndTool identifies the tool for which text is needed.
802 *
803 * This notification message is sent to the window specified
804 * in the hwndToolOwner member of the TOOLINFO structure for the tool.
805 * This notification is sent only if the PSZ_TEXTCALLBACK
806 * value is specified when the tool is added to a tooltip control.
807 *
808 * To specify the text, the target window (hwndToolOwner) must:
809 *
810 * 1. Set TOOLTIPTEXT.ulFormat to one of the format flags.
811 *
812 * 2. Fill the corresponding field(s) in TOOLTIPTEXT.
813 *
814 * Specifying PSZ_TEXTCALLBACK in TOOLINFO.lpszText with
815 * TTM_ADDTOOL is the only way under OS/2 to have strings
816 * displayed which are longer than 256 characters, since
817 * string resources are limited to 256 characters with OS/2.
818 * It is the responsibility of the application to set the
819 * pszText member to a _static_ string buffer which holds
820 * the string for the tool. A common error would be to have
821 * that member point to some variable which has only been
822 * allocated on the stack... this will lead to problems.
823 */
824
825 #define TTN_NEEDTEXT 1000
826
827 /*
828 *@@ TTN_SHOW:
829 * control notification sent with the WM_NOTIFY (Win95)
830 * and WM_CONTROL (OS/2) messages.
831 *
832 * Parameters (OS/2, incompatible with Win95):
833 * -- mp1 USHORT usID;
834 * USHORT usNotifyCode == TTN_NEEDTEXT
835 * -- ULONG mp2: PTOOLINFO of the tool for which the
836 * tool is about to be displayed.
837 *
838 * Return value: always 0.
839 *
840 * The TTN_SHOW notification message notifies the owner window
841 * that a tooltip is about to be displayed.
842 */
843
844 #define TTN_SHOW 1001
845
846 /*
847 *@@ TTN_POP:
848 * control notification sent with the WM_NOTIFY (Win95)
849 * and WM_CONTROL (OS/2) messages.
850 *
851 * Parameters (OS/2, incompatible with Win95):
852 * -- mp1 USHORT usID;
853 * USHORT usNotifyCode == TTN_NEEDTEXT
854 * -- ULONG mp2: PTOOLINFO of the tool for which the
855 * tooltip was visible.
856 *
857 * Return value: always 0.
858 *
859 * The TTN_SHOW notification message notifies the owner window
860 * that a tooltip is about to be hidden.
861 */
862
863 #define TTN_POP 1002
864
865 #define COMCTL_TOOLTIP_CLASS "ComctlTooltipClass"
866
867 BOOL ctlRegisterTooltip(HAB hab);
868
869 MRESULT EXPENTRY ctl_fnwpTooltip(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2);
870
871 /* ******************************************************************
872 *
873 * Checkbox container record cores
874 *
875 ********************************************************************/
876
877 BOOL ctlDrawCheckbox(HPS hps,
878 LONG x,
879 LONG y,
880 USHORT usRow,
881 USHORT usColumn,
882 BOOL fHalftoned);
883
884 #ifdef INCL_WINSTDCNR
885
886 /*
887 *@@ CN_RECORDCHECKED:
888 * extra WM_CONTROL notification code.
889 * See ctlMakeCheckboxContainer for
890 * details.
891 */
892
893 #define CN_RECORDCHECKED 999
894
895 /*
896 *@@ CHECKBOXRECORDCORE:
897 * extended record core structure used
898 * with checkbox containers. See
899 * ctlMakeCheckboxContainer for details.
900 *
901 * The check box painting is determined
902 * by the following flags:
903 *
904 * -- Only if (ulStyle & WS_VISIBLE), the check
905 * box is painted at all. Otherwise hptrIcon
906 * is painted. (Is this true?)
907 *
908 * -- In that case, usCheckState determines
909 * whether the check box is painted checked,
910 * unchecked, or indeterminate.
911 *
912 * -- In addition, if RECORDCORE.flRecordAttr
913 * has the CRA_DISABLED bit set, the check
914 * box is painted disabled (halftoned).
915 *
916 *@@changed V0.9.9 (2001-03-27) [umoeller]: made item id a ULONG
917 */
918
919 typedef struct _CHECKBOXRECORDCORE
920 {
921 RECORDCORE recc;
922 // standard record core structure
923 ULONG ulStyle;
924 // any combination of the following:
925 // -- WS_VISIBLE
926 // -- none or one of the following:
927 // BS_AUTOCHECKBOX, BS_AUTO3STATE, BS_3STATE
928 // Internally, we use BS_BITMAP to identify
929 // the depressed checkbox button.
930 ULONG ulItemID;
931 // this identifies the record; must be
932 // unique within the container
933 // changed V0.9.9 (2001-03-27) [umoeller]: turned USHORT into ULONG
934 USHORT usCheckState;
935 // current check state as with checkboxes
936 // (0, 1, or 2 for tri-state).
937 HPOINTER hptrIcon;
938 // if this is != NULLHANDLE, this icon
939 // will always be used for painting,
940 // instead of the default check box
941 // bitmaps. Useful for non-auto check
942 // box records to implement something
943 // other than checkboxes.
944 } CHECKBOXRECORDCORE, *PCHECKBOXRECORDCORE;
945
946 BOOL ctlMakeCheckboxContainer(HWND hwndCnrOwner,
947 USHORT usCnrID);
948
949 PCHECKBOXRECORDCORE ctlFindCheckRecord(HWND hwndCnr,
950 ULONG ulItemID);
951
952 BOOL ctlSetRecordChecked(HWND hwndCnr,
953 ULONG ulItemID,
954 USHORT usCheckState);
955
956 ULONG ctlQueryRecordChecked(HWND hwndCnr,
957 ULONG ulItemID,
958 USHORT usCheckState);
959
960 BOOL ctlEnableRecord(HWND hwndCnr,
961 ULONG ulItemID,
962 BOOL fEnable);
963 #endif
964
965 /* ******************************************************************
966 *
967 * Hotkey entry field
968 *
969 ********************************************************************/
970
971 /*
972 *@@ EN_HOTKEY:
973 * extra notification code with WM_CONTROL
974 * and subclassed hotkey entry fields.
975 * This is SENT to the entry field's owner
976 * every time a key is pressed. Note that
977 * this is only sent for key-down events
978 * and if all the KC_DEADKEY | KC_COMPOSITE | KC_INVALIDCOMP
979 * flags are not set.
980 *
981 * WM_CONTROL parameters in this case:
982 * -- mp1: USHORT id,
983 * USHORT usNotifyCode == EN_HOTKEY
984 * -- mp2: PHOTKEYNOTIFY struct pointer
985 *
986 * The receiving owner must check if the key
987 * combo described in HOTKEYNOTIFY makes up
988 * a valid hotkey and return a ULONG composed
989 * of the following flags:
990 *
991 * -- HEFL_SETTEXT: if this is set, the text
992 * of the entry field is set to the
993 * text in HOTKEYNOTIFY.szDescription.
994 *
995 * -- HEFL_FORWARD2OWNER: if this is set, the
996 * WM_CHAR message is instead passed
997 * to the owner. Use this for the tab
998 * key and such.
999 *
1000 *@@added V0.9.1 (99-12-19) [umoeller]
1001 *@@changed V0.9.4 (2000-08-03) [umoeller]: added HEFL_* flags
1002 */
1003
1004 #define EN_HOTKEY 0x1000
1005
1006 #define HEFL_SETTEXT 0x0001
1007 #define HEFL_FORWARD2OWNER 0x0002
1008
1009 typedef struct _HOTKEYNOTIFY
1010 {
1011 USHORT usFlags, // in: as in WM_CHAR
1012 usvk, // in: as in WM_CHAR
1013 usch; // in: as in WM_CHAR
1014 UCHAR ucScanCode; // in: as in WM_CHAR
1015 USHORT usKeyCode; // in: if KC_VIRTUAL is set, this has usKeyCode;
1016 // otherwise usCharCode
1017 CHAR szDescription[100]; // out: key description
1018 } HOTKEYNOTIFY, *PHOTKEYNOTIFY;
1019
1020 BOOL ctlMakeHotkeyEntryField(HWND hwndHotkeyEntryField);
1021
1022#endif
1023
1024#if __cplusplus
1025}
1026#endif
1027
Note: See TracBrowser for help on using the repository browser.