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

Last change on this file since 196 was 189, checked in by umoeller, 23 years ago

Coupla fixes.

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