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

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

More updates.

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