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

Last change on this file since 180 was 178, checked in by umoeller, 23 years ago

More pager fixes.

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