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

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

Lotsa fixes from the last two weeks.

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