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

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

Tons of updates for turbo folders and replacement icons.

  • Property svn:eol-style set to CRLF
  • Property svn:keywords set to Author Date Id Revision
File size: 41.7 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 * Super Combo Box
417 *
418 ********************************************************************/
419
420 BOOL ctlComboFromEntryField(HWND hwnd,
421 ULONG flStyle);
422
423 /* ******************************************************************
424 *
425 * Split bars
426 *
427 ********************************************************************/
428
429 #define WC_SPLITWINDOW "SplitWindowClass"
430
431 #define SBCF_VERTICAL 0x0000
432 #define SBCF_HORIZONTAL 0x0001
433
434 #define SBCF_PERCENTAGE 0x0002
435 #define SBCF_3DSUNK 0x0100
436 #define SBCF_MOVEABLE 0x1000
437
438 /*
439 *@@ SPLITBARCDATA:
440 * split bar creation data
441 */
442
443 typedef struct _SPLITBARCDATA
444 {
445 ULONG ulSplitWindowID;
446 // window ID of the split window
447 ULONG ulCreateFlags;
448 // split window style flags.
449 // One of the following:
450 // -- SBCF_VERTICAL: the split bar will be vertical.
451 // -- SBCF_HORIZONTAL: the split bar will be horizontal.
452 // plus any or none of the following:
453 // -- SBCF_PERCENTAGE: lPos does not specify absolute
454 // coordinates, but a percentage of the window
455 // width or height. In that case, the split
456 // bar position is not fixed, but always recalculated
457 // as a percentage.
458 // Otherwise, the split bar will be fixed.
459 // -- SBCF_3DSUNK: draw a "sunk" 3D frame around the
460 // split windows.
461 // -- SBCF_MOVEABLE: the split bar may be moved with
462 // the mouse.
463 LONG lPos;
464 // position of the split bar within hwndParentAndOwner.
465 // If SBCF_PERCENTAGE, this has the percentage;
466 // otherwise:
467 // if this value is positive, it's considered
468 // an offset from the left/bottom of the frame;
469 // if it's negative, it's from the right
470 ULONG ulLeftOrBottomLimit,
471 ulRightOrTopLimit;
472 // when moving the split bar (SBCF_MOVEABLE), these
473 // are the minimum and maximum values.
474 // ulLeftOrBottomLimit is the left (or bottom) limit,
475 // ulRightOrTopLimit is the right (or top) limit.
476 // Both are offsets in window coordinates from the
477 // left (or bottom) and right (or top) boundaries of
478 // the split window. If both are 0, the whole split
479 // window is allowed (not recommended).
480 HWND hwndParentAndOwner;
481 // the owner and parent of the split bar
482 // and other windows; this must be the FID_CLIENT
483 // of a frame or another split window (when nesting)
484 } SPLITBARCDATA, *PSPLITBARCDATA;
485
486 /*
487 *@@ SPLITBARDATA:
488 * internal split bar data,
489 * stored in QWL_USER window ulong
490 */
491
492 typedef struct _SPLITBARDATA
493 {
494 SPLITBARCDATA sbcd;
495 PFNWP OldStaticProc;
496 // RECTL rclBar;
497 HPOINTER hptrOld, // old pointer stored upon WM_MOUSEMOVE
498 hptrMove; // PM move pointer, either vertical or horizontal
499 BOOL fCaptured;
500 POINTS ptsMousePos;
501 POINTL ptlDrawLineFrom,
502 ptlDrawLineTo;
503 HPS hpsTrackBar;
504 HWND hwndLinked1,
505 // the left/bottom window to link
506 hwndLinked2;
507 // the right/top window to link
508 } SPLITBARDATA, *PSPLITBARDATA;
509
510 #define ID_SPLITBAR 5000 // fixed ID of the split bar
511 // (child of split window)
512
513 /*
514 *@@ SPLM_SETLINKS:
515 * this specifies the windows which the
516 * split window will link. This updates
517 * the internal SPLITBARDATA and changes
518 * the parents of the two subwindows to
519 * the split window.
520 *
521 * Parameters:
522 * HWND mp1: left or bottom subwindow
523 * HWND mp2: right or top subwindow
524 */
525
526 #define SPLM_SETLINKS (WM_USER + 500)
527
528 HWND ctlCreateSplitWindow(HAB hab,
529 PSPLITBARCDATA psbcd);
530
531 BOOL ctlUpdateSplitWindow(HWND hwndSplit);
532
533 BOOL ctlSetSplitFrameWindowPos(HWND hwndFrame,
534 HWND hwndInsertBehind,
535 LONG x,
536 LONG y,
537 LONG cx,
538 LONG cy,
539 ULONG fl,
540 HWND *pahwnd,
541 ULONG cbhwnd);
542
543 LONG ctlQuerySplitPos(HWND hwndSplit);
544
545 /* ******************************************************************
546 *
547 * Subclassed Static Bitmap Control
548 *
549 ********************************************************************/
550
551 // flags for ANIMATIONDATA.ulFlags
552 #define ANF_ICON 0x0001
553 #define ANF_BITMAP 0x0002
554 #define ANF_PROPORTIONAL 0x0004
555
556 /*
557 *@@ ANIMATIONDATA:
558 * this structure gets stored in QWL_USER
559 * before subclassing the static control
560 *
561 *@@changed V0.9.0: added fields for bitmap support
562 *@@changed V0.9.16 (2001-10-15) [umoeller]: added ulIconSize
563 */
564
565 typedef struct _ANIMATIONDATA
566 {
567 // the following need to be initialized before
568 // subclassing
569 HAB hab; // (added V0.9.0)
570 ULONG ulFlags;
571 // one of the following:
572 // -- ANF_ICON: display icons
573 // -- ANF_BITMAP: display bitmaps
574 // -- ANF_BITMAP | ANF_PROPORTIONAL: display bitmaps, but preserve proportions
575 LONG lIconSize; // system icon size V0.9.16 (2001-10-15) [umoeller]
576 RECTL rclIcon; // size of static control
577 PFNWP OldStaticProc; // original WC_STATIC wnd proc
578
579 // the following are set by fnwpSubclassedStatic upon
580 // receiving SM_SETHANDLE (in all modes) or later
581 HBITMAP hbm, // bitmap to be painted upon WM_PAINT
582 hbmHalftoned; // bitmap in case of WS_DISABLED (added V0.9.0)
583 HPOINTER hptr; // icon handle passed to SM_SETHANDLE
584 HBITMAP hbmSource; // bitmap handle passed to SM_SETHANDLE
585 // (this can be deleted later) (added V0.9.0)
586
587 // the following need to be initialized
588 // for icon mode only (ANF_ICON)
589 ULONG ulDelay; // delay per animation step in ms
590 USHORT usAniCurrent; // current animation step (>= 0)
591
592 USHORT usAniCount; // no. of animation steps
593 HPOINTER ahptrAniIcons[1]; // variable-size array of animation steps;
594 // there must be usAniCount items
595 } ANIMATIONDATA, *PANIMATIONDATA;
596
597 PANIMATIONDATA ctlPrepareStaticIcon(HWND hwndStatic, USHORT usAnimCount);
598
599 BOOL ctlPrepareAnimation(HWND hwndStatic,
600 USHORT usAnimCount,
601 HPOINTER *pahptr,
602 ULONG ulDelay,
603 BOOL fStartAnimation);
604
605 BOOL ctlStartAnimation(HWND hwndStatic);
606
607 BOOL ctlStopAnimation(HWND hwndStatic);
608
609 PANIMATIONDATA ctlPrepareStretchedBitmap(HWND hwndStatic,
610 BOOL fPreserveProportions);
611
612
613 /* ******************************************************************
614 *
615 * "Tooltip" control
616 *
617 ********************************************************************/
618
619 // addt'l tooltip window styles: use lower 16 bits
620 #define TTS_ALWAYSTIP 0x0001
621 #define TTS_NOPREFIX 0x0002
622 // non-Win95 flags
623 #define TTS_ROUNDED 0x0004
624 #define TTS_SHADOW 0x0008
625
626 // TOOLINFO.uFlags flags (ORed)
627 // #define TTF_IDISHWND 0x0001
628 // V0.9.7 (2001-01-03) [umoeller]: removed this win95 crap
629 // #define TTF_CENTERBELOW 0x0002
630 // #define TTF_CENTERABOVE 0x0004
631 // #define TTF_RTLREADING 0x0004
632 // V0.9.7 (2001-01-03) [umoeller]: removed this win95 crap
633
634 #define TTF_SUBCLASS 0x0008
635 // non-Win95 flags
636 #define TTF_SHYMOUSE 0x0010
637
638 // new flags with V0.9.7 (2001-01-20) [umoeller]
639 #define TTF_CENTER_X_ON_TOOL 0x0020
640 #define TTF_POS_Y_ABOVE_TOOL 0x0040
641 #define TTF_POS_Y_BELOW_TOOL 0x0080
642
643 #define PSZ_TEXTCALLBACK (PSZ)-1
644
645 #define TT_SHADOWOFS 10
646 #define TT_ROUNDING 8
647
648 /*
649 *@@ TOOLINFO:
650 * info structure to register a tool with a
651 * tooltip control. Used with TTM_ADDTOOL
652 * and many other TTM_* messages.
653 *
654 *@@changed V0.9.7 (2001-01-03) [umoeller]: removed all that win95 crap
655 */
656
657 typedef struct _TOOLINFO
658 {
659 ULONG ulFlags;
660 // in: flags for the tool, any combination of:
661 // -- TTF_SUBCLASS: Indicates that the tooltip control should
662 // subclass hwndTool to intercept messages,
663 // such as WM_MOUSEMOVE. See TTM_RELAYEVENT.
664 // -- TTF_SHYMOUSE: shy away from mouse pointer;
665 // always position the tool tip such that it is never
666 // covered by the mouse pointer (for readability);
667 // added V0.9.1 (2000-02-04) [umoeller]
668 // -- TTF_CENTER_X_ON_TOOL: position tooltip X so that
669 // it's centered on the tool (doesn't affect Y)
670 // -- TTF_POS_Y_ABOVE_TOOL: position tooltip Y above
671 // the tool; cannot be used with TTF_POS_Y_BELOW_TOOL
672 // -- TTF_POS_Y_BELOW_TOOL: position tooltip Y below
673 // the tool; cannot be used with TTF_POS_Y_ABOVE_TOOL
674 HWND hwndToolOwner;
675 // in: handle to the window that contains the tool. If
676 // pszText includes the PSZ_TEXTCALLBACK value, this
677 // member identifies the window that receives TTN_NEEDTEXT
678 // notification messages.
679 HWND hwndTool;
680 // in: window handle of the tool.
681 PSZ pszText;
682 // in: pointer to the buffer that contains the text for the
683 // tool (if the hiword is != NULL), or identifier of the string
684 // resource that contains the text (if the hiword == NULL).
685 // If this member is set to the PSZ_TEXTCALLBACK value,
686 // the control sends the TTN_NEEDTEXT notification message to
687 // hwndToolOwner to retrieve the text.
688 } TOOLINFO, *PTOOLINFO;
689
690 /*
691 * tooltip messages
692 *
693 */
694
695 #define TTM_FIRST (WM_USER + 1000)
696
697 #define TTM_ACTIVATE (TTM_FIRST + 1)
698
699 #define TTM_ADDTOOL (TTM_FIRST + 2)
700
701 #define TTM_DELTOOL (TTM_FIRST + 3)
702
703 #define TTM_NEWTOOLRECT (TTM_FIRST + 4)
704
705 #define TTM_RELAYEVENT (TTM_FIRST + 5)
706
707 // flags for TTM_SETDELAYTIME
708 #define TTDT_AUTOMATIC 1
709 #define TTDT_AUTOPOP 2
710 #define TTDT_INITIAL 3
711 #define TTDT_RESHOW 4
712
713 #define TTM_GETDELAYTIME (TTM_FIRST + 6)
714 // added V0.9.12 (2001-04-28) [umoeller]
715
716 #define TTM_SETDELAYTIME (TTM_FIRST + 7)
717
718 #define TTFMT_PSZ 0x01
719 #define TTFMT_STRINGRES 0x02
720
721 /*
722 *@@ TOOLTIPTEXT:
723 * identifies a tool for which text is to
724 * be displayed and receives the text for
725 * the tool. The tool must fill all fields
726 * of this structure.
727 *
728 * This structure is used with the TTN_NEEDTEXT
729 * notification.
730 *
731 *@@changed V0.9.7 (2001-01-03) [umoeller]: got rid of this win95 crap
732 */
733
734 typedef struct _TOOLTIPTEXT
735 {
736 HWND hwndTooltip;
737 // in: tooltip control who's sending this.
738 HWND hwndTool;
739 // in: tool for which the text is needed.
740 ULONG ulFormat;
741 // out: one of:
742 // -- TTFMT_PSZ: pszText contains the new, zero-terminated string.
743 // -- TTFMT_STRINGRES: hmod and idResource specify a string resource
744 // to be loaded.
745 PSZ pszText;
746 // out: with TTFMT_PSZ, pointer to a string that contains the
747 // tool text. Note that this is not copied into the tooltip...
748 // so this must point to a static buffer that is valid while
749 // the tooltip is showing.
750 HMODULE hmod;
751 // out: with TTFMT_STRINGRES, the module handle of the resource.
752 ULONG idResource;
753 // out: with TTFMT_STRINGRES, the string resource ID.
754 } TOOLTIPTEXT, *PTOOLTIPTEXT;
755
756 #define TTM_GETTEXT (TTM_FIRST + 8)
757
758 #define TTM_UPDATETIPTEXT (TTM_FIRST + 9)
759
760 /*
761 *@@ TT_HITTESTINFO:
762 * contains information that a tooltip control uses to determine whether
763 * a point is in the bounding rectangle of the specified tool. If the point
764 * is in the rectangle, the structure receives information about the tool.
765 *
766 * This structure is used with the TTM_HITTEST message.
767 */
768
769 typedef struct _TT_HITTESTINFO
770 {
771 HWND hwnd; // in: handle to the tool or window with the specified tool.
772 POINTL /* POINT */ pt;
773 // in: client coordinates of the point to test (Win95: POINT)
774 TOOLINFO ti; // out: receives information about the specified tool.
775 } TTHITTESTINFO, *PHITTESTINFO;
776
777 #define TTM_HITTEST (TTM_FIRST + 10)
778
779 #define TTM_WINDOWFROMPOINT (TTM_FIRST + 11)
780
781 #define TTM_ENUMTOOLS (TTM_FIRST + 12)
782
783 #define TTM_GETCURRENTTOOL (TTM_FIRST + 13)
784
785 #define TTM_GETTOOLCOUNT (TTM_FIRST + 14)
786
787 #define TTM_GETTOOLINFO (TTM_FIRST + 15)
788
789 #define TTM_SETTOOLINFO (TTM_FIRST + 16)
790
791 // non-Win95 messages
792
793 #define TTM_SHOWTOOLTIPNOW (TTM_FIRST + 17)
794
795 /*
796 * tooltip notification codes (WM_CONTROL)
797 *
798 */
799
800 /*
801 *@@ TTN_NEEDTEXT:
802 * notification code used with WM_CONTROL when a tooltip
803 * needs a tooltip text for a tool.
804 *
805 * Parameters:
806 *
807 * -- SHORT1FROMMP(mp1) usID: ID of the tooltip control).
808 *
809 * -- SHORT2FROMMP(mp1) usNotifyCode: TTN_NEEDTEXT.
810 *
811 * -- PTOOLTIPTEXT mp2: pointer to a TOOLTIPTEXT structure.
812 * hwndTool identifies the tool for which text is needed.
813 *
814 * This notification message is sent to the window specified
815 * in the hwndToolOwner member of the TOOLINFO structure for the tool.
816 * This notification is sent only if the PSZ_TEXTCALLBACK
817 * value is specified when the tool is added to a tooltip control.
818 *
819 * To specify the text, the target window (hwndToolOwner) must:
820 *
821 * 1. Set TOOLTIPTEXT.ulFormat to one of the format flags.
822 *
823 * 2. Fill the corresponding field(s) in TOOLTIPTEXT.
824 *
825 * Specifying PSZ_TEXTCALLBACK in TOOLINFO.lpszText with
826 * TTM_ADDTOOL is the only way under OS/2 to have strings
827 * displayed which are longer than 256 characters, since
828 * string resources are limited to 256 characters with OS/2.
829 * It is the responsibility of the application to set the
830 * pszText member to a _static_ string buffer which holds
831 * the string for the tool. A common error would be to have
832 * that member point to some variable which has only been
833 * allocated on the stack... this will lead to problems.
834 */
835
836 #define TTN_NEEDTEXT 1000
837
838 /*
839 *@@ TTN_SHOW:
840 * control notification sent with the WM_NOTIFY (Win95)
841 * and WM_CONTROL (OS/2) messages.
842 *
843 * Parameters (OS/2, incompatible with Win95):
844 * -- mp1 USHORT usID;
845 * USHORT usNotifyCode == TTN_NEEDTEXT
846 * -- ULONG mp2: PTOOLINFO of the tool for which the
847 * tool is about to be displayed.
848 *
849 * Return value: always 0.
850 *
851 * The TTN_SHOW notification message notifies the owner window
852 * that a tooltip is about to be displayed.
853 */
854
855 #define TTN_SHOW 1001
856
857 /*
858 *@@ TTN_POP:
859 * control notification sent with the WM_NOTIFY (Win95)
860 * and WM_CONTROL (OS/2) messages.
861 *
862 * Parameters (OS/2, incompatible with Win95):
863 * -- mp1 USHORT usID;
864 * USHORT usNotifyCode == TTN_NEEDTEXT
865 * -- ULONG mp2: PTOOLINFO of the tool for which the
866 * tooltip was visible.
867 *
868 * Return value: always 0.
869 *
870 * The TTN_SHOW notification message notifies the owner window
871 * that a tooltip is about to be hidden.
872 */
873
874 #define TTN_POP 1002
875
876 #define COMCTL_TOOLTIP_CLASS "ComctlTooltipClass"
877
878 BOOL ctlRegisterTooltip(HAB hab);
879
880 MRESULT EXPENTRY ctl_fnwpTooltip(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2);
881
882 /* ******************************************************************
883 *
884 * Checkbox container record cores
885 *
886 ********************************************************************/
887
888 BOOL ctlDrawCheckbox(HPS hps,
889 LONG x,
890 LONG y,
891 USHORT usRow,
892 USHORT usColumn,
893 BOOL fHalftoned);
894
895 #ifdef INCL_WINSTDCNR
896
897 /*
898 *@@ CN_RECORDCHECKED:
899 * extra WM_CONTROL notification code.
900 * See ctlMakeCheckboxContainer for
901 * details.
902 */
903
904 #define CN_RECORDCHECKED 999
905
906 /*
907 *@@ CHECKBOXRECORDCORE:
908 * extended record core structure used
909 * with checkbox containers. See
910 * ctlMakeCheckboxContainer for details.
911 *
912 * The check box painting is determined
913 * by the following flags:
914 *
915 * -- Only if (ulStyle & WS_VISIBLE), the check
916 * box is painted at all. Otherwise hptrIcon
917 * is painted. (Is this true?)
918 *
919 * -- In that case, usCheckState determines
920 * whether the check box is painted checked,
921 * unchecked, or indeterminate.
922 *
923 * -- In addition, if RECORDCORE.flRecordAttr
924 * has the CRA_DISABLED bit set, the check
925 * box is painted disabled (halftoned).
926 *
927 *@@changed V0.9.9 (2001-03-27) [umoeller]: made item id a ULONG
928 */
929
930 typedef struct _CHECKBOXRECORDCORE
931 {
932 RECORDCORE recc;
933 // standard record core structure
934 ULONG ulStyle;
935 // any combination of the following:
936 // -- WS_VISIBLE
937 // -- none or one of the following:
938 // BS_AUTOCHECKBOX, BS_AUTO3STATE, BS_3STATE
939 // Internally, we use BS_BITMAP to identify
940 // the depressed checkbox button.
941 ULONG ulItemID;
942 // this identifies the record; must be
943 // unique within the container
944 // changed V0.9.9 (2001-03-27) [umoeller]: turned USHORT into ULONG
945 USHORT usCheckState;
946 // current check state as with checkboxes
947 // (0, 1, or 2 for tri-state).
948 HPOINTER hptrIcon;
949 // if this is != NULLHANDLE, this icon
950 // will always be used for painting,
951 // instead of the default check box
952 // bitmaps. Useful for non-auto check
953 // box records to implement something
954 // other than checkboxes.
955 } CHECKBOXRECORDCORE, *PCHECKBOXRECORDCORE;
956
957 BOOL ctlMakeCheckboxContainer(HWND hwndCnrOwner,
958 USHORT usCnrID);
959
960 PCHECKBOXRECORDCORE ctlFindCheckRecord(HWND hwndCnr,
961 ULONG ulItemID);
962
963 BOOL ctlSetRecordChecked(HWND hwndCnr,
964 ULONG ulItemID,
965 USHORT usCheckState);
966
967 ULONG ctlQueryRecordChecked(HWND hwndCnr,
968 ULONG ulItemID,
969 USHORT usCheckState);
970
971 BOOL ctlEnableRecord(HWND hwndCnr,
972 ULONG ulItemID,
973 BOOL fEnable);
974 #endif
975
976 /* ******************************************************************
977 *
978 * Hotkey entry field
979 *
980 ********************************************************************/
981
982 /*
983 *@@ EN_HOTKEY:
984 * extra notification code with WM_CONTROL
985 * and subclassed hotkey entry fields.
986 * This is SENT to the entry field's owner
987 * every time a key is pressed. Note that
988 * this is only sent for key-down events
989 * and if all the KC_DEADKEY | KC_COMPOSITE | KC_INVALIDCOMP
990 * flags are not set.
991 *
992 * WM_CONTROL parameters in this case:
993 * -- mp1: USHORT id,
994 * USHORT usNotifyCode == EN_HOTKEY
995 * -- mp2: PHOTKEYNOTIFY struct pointer
996 *
997 * The receiving owner must check if the key
998 * combo described in HOTKEYNOTIFY makes up
999 * a valid hotkey and return a ULONG composed
1000 * of the following flags:
1001 *
1002 * -- HEFL_SETTEXT: if this is set, the text
1003 * of the entry field is set to the
1004 * text in HOTKEYNOTIFY.szDescription.
1005 *
1006 * -- HEFL_FORWARD2OWNER: if this is set, the
1007 * WM_CHAR message is instead passed
1008 * to the owner. Use this for the tab
1009 * key and such.
1010 *
1011 *@@added V0.9.1 (99-12-19) [umoeller]
1012 *@@changed V0.9.4 (2000-08-03) [umoeller]: added HEFL_* flags
1013 */
1014
1015 #define EN_HOTKEY 0x1000
1016
1017 #define HEFL_SETTEXT 0x0001
1018 #define HEFL_FORWARD2OWNER 0x0002
1019
1020 typedef struct _HOTKEYNOTIFY
1021 {
1022 USHORT usFlags, // in: as in WM_CHAR
1023 usvk, // in: as in WM_CHAR
1024 usch; // in: as in WM_CHAR
1025 UCHAR ucScanCode; // in: as in WM_CHAR
1026 USHORT usKeyCode; // in: if KC_VIRTUAL is set, this has usKeyCode;
1027 // otherwise usCharCode
1028 CHAR szDescription[100]; // out: key description
1029 } HOTKEYNOTIFY, *PHOTKEYNOTIFY;
1030
1031 BOOL ctlMakeHotkeyEntryField(HWND hwndHotkeyEntryField);
1032
1033#endif
1034
1035#if __cplusplus
1036}
1037#endif
1038
Note: See TracBrowser for help on using the repository browser.