source: branches/branch-1-0/include/helpers/comctl.h@ 431

Last change on this file since 431 was 264, checked in by pr, 21 years ago

Fix spelling errors.

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