source: trunk/src/3rdparty/os2/xsystray/shared/center.h@ 256

Last change on this file since 256 was 252, checked in by Dmitry A. Kuminov, 16 years ago

3rdparty: Added sketch of the Extended system tray XCenter plug-in.

File size: 61.4 KB
Line 
1
2/*
3 *@@sourcefile center.h:
4 * public header file for the XCenter and plugins.
5 *
6 * This contains all declarations which are needed by
7 * all parts of the XCenter and to implement widget
8 * plugin DLLs.
9 *
10 * WARNING: The XCenter is still work in progress. The
11 * definitions in this file are still subject to change,
12 * even though I try to maintain backwards compatibility.
13 *
14 * If you are looking at this file from the "toolkit\shared"
15 * directory of a binary XWorkplace release, this is an
16 * exact copy of the file in "include\shared" from the
17 * XWorkplace sources.
18 *
19 *@@include #include "shared\center.h"
20 */
21
22/*
23 * Copyright (C) 2000-2003 Ulrich M”ller,
24 * Martin Lafaix.
25 *
26 * This file is part of the XWorkplace source package.
27 * Even though XWorkplace is free software under the GNU General
28 * Public License version 2 (GPL), permission is granted, free
29 * of charge, to use this file for the purpose of creating software
30 * that integrates into XWorkplace or eComStation, even if that
31 * software is not published under the GPL.
32 *
33 * This permission extends to this single file only, but NOT to
34 * other files of the XWorkplace sources, not even those that
35 * are based on or include this file.
36 *
37 * As a special exception to the GPL, using this file for the
38 * purpose of creating software that integrates into XWorkplace
39 * or eComStation is not considered creating a derivative work
40 * in the sense of the GPL. In plain English, you are not bound
41 * to the terms and conditions of the GPL if you use only this
42 * file for that purpose. You are bound by the GPL however if
43 * you incorporate code from GPL'ed XWorkplace source files where
44 * this notice is not present.
45 *
46 * This file is distributed in the hope that it will be useful,
47 * but still WITHOUT ANY WARRANTY; without even the implied
48 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
49 * In no event shall the authors and/or copyright holders be
50 * liable for any damages or other claims arising from the use
51 * of this software.
52 */
53
54#ifndef CENTER_HEADER_INCLUDED
55 #define CENTER_HEADER_INCLUDED
56
57 /* ******************************************************************
58 *
59 * Public definitions
60 *
61 ********************************************************************/
62
63 // button types (src\xcenter\w_objbutton.c)
64 #define BTF_OBJBUTTON 1
65 #define BTF_XBUTTON 2
66
67 /*
68 *@@ XCENTERGLOBALS:
69 * global data for a running XCenter instance.
70 * This is created once per open XCenter.
71 *
72 * A pointer to this one structure exists in each
73 * XCENTERWIDGET instance so that the widgets
74 * can access some of the data of the XCenter
75 * they belong to.
76 *
77 * In this structure, an XCenter instance
78 * passes a number of variables to its member
79 * widgets so that they can access some things
80 * more quickly for convenience. This structure
81 * is fully initialized at the time the widgets
82 * are created, but values may change while the
83 * XCenter is open (e.g. if the user changes
84 * view settings in the XCenter settings notebook).
85 *
86 * "Globals" isn't really a good name since
87 * one of these structures is created for
88 * each open XCenter (and there can be several),
89 * but this is definitely more global than the
90 * widget-specific structures.
91 */
92
93 typedef struct _XCENTERGLOBALS
94 {
95 HAB hab;
96 // anchor block of the XCenter thread and thus
97 // all XCenter windows (including widgets)
98 HWND hwndFrame,
99 // be XCenter frame window (constant)
100 hwndClient;
101 // XCenter client (child of XCenter frame) (constant)
102
103 PVOID pCountrySettings;
104 // country settings; this really points to a
105 // COUNTRYSETTINGS structure (include\helpers\prfh.h)
106 // and might be useful if you want to use settings
107 // from the "Country" object (constant)
108
109 ULONG cyInnerClient;
110 // height of inner client (same as height of all widgets!).
111 // This is normally == cyWidgetmax unless the user has
112 // resized the XCenter, but it will always be >= cyWidgetMax.
113 // The "inner client" plus the 3D border width plus the
114 // border spacing make up the full height of the XCenter.
115
116 // This can change while the XCenter is open.
117 // This was changed with V0.9.9 (2001-03-09) [umoeller];
118 // this field still always has the client height, but this
119 // is no longer neccessarily the same as the tallest
120 // widget (see cyWidgetMax below).
121
122 ULONG cxMiniIcon;
123 // system mini-icon size (for convenience); either 16 or 20
124 // (constant)
125
126 LONG lcol3DDark,
127 lcol3DLight;
128 // system colors for 3D frames (for convenience; RGB!) (constant)
129
130 // the following are the width settings from the second "View"
131 // settings page;
132 // a widget may or may not want to consider these.
133 ULONG flDisplayStyle;
134 // XCenter display style flags;
135 // a widget may or may not want to consider these.
136 // Can be changed by the user while the XCenter is open.
137 // These flags can be any combination of the following:
138
139 #define XCS_FLATBUTTONS 0x0001
140 // -- XCS_FLATBUTTONS: paint buttons flat. If not set,
141 // paint them raised.
142
143 #define XCS_SUNKBORDERS 0x0002
144 // -- XCS_SUNKBORDERS: paint static controls (e.g. CPU meter)
145 // with a "sunk" 3D frame. If not set, do not.
146
147 #define XCS_SIZINGBARS 0x0004
148 // -- XCS_SIZINGBARS: XCenter should automatically paint
149 // sizing bars for sizeable widgets.
150
151 #define XCS_ALL3DBORDERS 0x0008
152 // -- XCS_ALL3DBORDERS: XCenter should draw all four 3D
153 // borders around itself. If not set, it will only
154 // draw one border (the one towards the screen).
155
156 #define XCS_SPACINGLINES 0x0010 // added V0.9.13 (2001-06-19) [umoeller]
157 // -- XCS_SPACINGLINES: XCenter should draw small 3D lines
158 // between the widgets too (V0.9.13 (2001-06-19) [umoeller]).
159
160 #define XCS_NOHATCHINUSE 0x0020 // added V0.9.16 (2001-10-24) [umoeller]
161 // -- XCS_NOHATCHINUSE: XCenter should not add hatching to
162 // object widgets which represent open objects
163 // (V0.9.16 (2001-10-24) [umoeller])
164
165 ULONG ulPosition;
166 // XCenter position on screen, if a widget cares...
167 // can be changed by the user while the XCenter is open.
168 // This is _one_ of the following:
169 #define XCENTER_BOTTOM 0
170 #define XCENTER_TOP 1
171 // Left and right are not yet supported.
172
173 ULONG ul3DBorderWidth;
174 // 3D border width; can be changed by user at any time
175 ULONG ulBorderSpacing;
176 // border spacing (added to 3D border width);
177 // can be changed by user at any time
178 ULONG ulWidgetSpacing;
179 // spacing between widgets; can be changed by user at any time;
180 // if flDisplayStyle also has XCS_SPACINGLINES set,
181 // an extra 2 pixels will be added internally to this
182 // value
183
184 /*
185 * The following fields have been added with
186 * releases later than V0.9.7. Since they have
187 * been added at the bottom, the structure is
188 * still backward-compatible with old plugin
189 * binaries... but you cannot use these new
190 * fields unless you also require the corresponding
191 * XCenter revision by using the "version" export @3.
192 */
193
194 PVOID pvXTimerSet;
195 // XCenter timer set, which can be used by widgets
196 // to start XTimers instead of regular PM timers.
197 // This was added V0.9.9 (2001-03-07) [umoeller].
198 // See src\helpers\timer.c for an introduction.
199 // This pointer is really an XTIMERSET pointer but
200 // has been declared as PVOID to avoid having to
201 // #include include\helpers\timer.h all the time.
202 // This is constant while the XCenter is open.
203
204 ULONG cyWidgetMax;
205 // height of tallest widget == minimum height of client
206 // V0.9.9 (2001-03-09) [umoeller]
207 // This may change while the XCenter is open if
208 // widgets are added or removed.
209
210 LONG lcolClientBackground;
211 // background color of the XCenter client area,
212 // in case a widget is interested.
213 // V0.9.13 (2001-06-19) [umoeller]
214
215 PVOID pvSomSelf;
216 // XCenter's somSelf object pointer. This is a
217 // XCenter* pointer really, but has been declared
218 // as PVOID so you won't have to include the WPS
219 // SOM headers.
220 // V0.9.13 (2001-06-19) [umoeller]
221
222 HWND hwndTooltip;
223 // XCenter's tooltip control (comctl.c). This is
224 // the one tooltip that is created for all widgets.
225 // This member has been made public so widgets may
226 // choose to work with the tooltip... but do not
227 // mess with this unless you know what you're doing,
228 // since all widgets share this one tooltip.
229 // V0.9.13 (2001-06-21) [umoeller]
230
231 } XCENTERGLOBALS, *PXCENTERGLOBALS;
232
233 typedef const struct _XCENTERGLOBALS *PCXCENTERGLOBALS;
234
235 // forward declaration
236 typedef struct _XCENTERWIDGET *PXCENTERWIDGET;
237
238 BOOL APIENTRY ctrSetSetupString(LHANDLE hSetting, PCSZ pcszNewSetupString);
239 typedef BOOL APIENTRY CTRSETSETUPSTRING(LHANDLE hSetting, PCSZ pcszNewSetupString);
240 typedef CTRSETSETUPSTRING *PCTRSETSETUPSTRING;
241
242 /*
243 *@@ WIDGETSETTINGSDLGDATA:
244 * a bunch of data passed to a "show settings
245 * dialog" function (WGTSHOWSETTINGSDLG), if
246 * the widget has specified such a thing.
247 *
248 * XCenter widget settings dialogs basically
249 * work as follows:
250 *
251 * 1. You must write a function that displays a modal
252 * dialog. This function must have the following
253 * prototype:
254 *
255 + VOID EXPENTRY ShowSettingsDlg(PWIDGETSETTINGSDLGDATA pData)
256 *
257 * 2. In the "init module" export, store that function
258 * in the XCENTERWIDGETCLASS.pShowSettingsDlg field
259 * for your widget class.
260 *
261 * This will enable the "Properties" menu item
262 * for the widget.
263 *
264 * 3. Your function gets called when the user selects
265 * "Properties". What that function does, doesn't
266 * matter... it should however display a modal
267 * dialog and update the widget's settings string
268 * and call ctrSetSetupString with the "hSettings"
269 * handle that was given to it in the
270 * WIDGETSETTINGSDLGDATA structure. This will give
271 * the widget the new settings.
272 *
273 * The address of the ctrSetSetupString helper is
274 * given to you in this structure so that you
275 * won't have to import it from XFLDR.DLL.
276 *
277 * If a widget class supports settings dialogs,
278 * it must specify this in its XCENTERWIDGETCLASS.
279 *
280 *@@added V0.9.7 (2000-12-07) [umoeller]
281 *@@changed V0.9.9 (2001-02-06) [umoeller]: added pctrSetSetupString
282 */
283
284 typedef struct _WIDGETSETTINGSDLGDATA
285 {
286 HWND hwndOwner;
287 // proposed owner for settings dialog; this
288 // will either be the HWND of the XCenter frame
289 // or some other HWND, if the settings dialog
290 // is displayed from elsewhere
291
292 const char *pcszSetupString;
293 // present setup string (do not change)
294
295 const LHANDLE hSettings;
296 // widget setting handle; this must
297 // be passed to ctrSetSetupString;
298 // DO NOT CHANGE
299
300 PCXCENTERGLOBALS pGlobals;
301 // if != NULL, currently open XCenter
302 // for which widget data is being changed.
303 // If NULL, the XCenter isn't currently
304 // open.
305
306 PXCENTERWIDGET pView;
307 // if != NULL, currently open view
308 // of the widget. If NULL, the widget
309 // isn't currently open.
310
311 PVOID pUser;
312 // some room for additional data the
313 // settings dialog might want
314
315 /*
316 * The following fields have been added with
317 * releases later than V0.9.7. Since they have
318 * been added at the bottom, the structure is
319 * still backward-compatible with old plugin
320 * binaries... but you cannot use these new
321 * fields unless you also require the corresponding
322 * XCenter revision by using the "version" export @3.
323 */
324
325 PCTRSETSETUPSTRING pctrSetSetupString;
326 // ptr to ctrSetSetupString function in
327 // src\shared\center.c; this must be
328 // called by the settings dialog to
329 // change the widget's setup string.
330 // This pointer has been added with V0.9.9
331 // to allow using settings dialog without
332 // having to import this from XFLDR.DLL.
333
334 } WIDGETSETTINGSDLGDATA, *PWIDGETSETTINGSDLGDATA;
335
336 typedef VOID EXPENTRY WGTSHOWSETTINGSDLG(PWIDGETSETTINGSDLGDATA);
337 typedef WGTSHOWSETTINGSDLG *PWGTSHOWSETTINGSDLG;
338
339 /*
340 *@@ XCENTERWIDGETCLASS:
341 * describes one widget class which can be
342 * used in an XCenter. Such a class can either
343 * be internal or in a widget plugin DLL.
344 *
345 * This structure _must_ have the same layout as
346 * PLUGINCLASS. It can redefine the ulUser* fields
347 * to its liking, though.
348 *
349 * The window procedure which implements the widget
350 * class must be registered by a plug-in DLL when
351 * its INIT callback gets called by the XCenter.
352 *
353 * There are a few rules which must be followed
354 * with the window procedures of the widget classes:
355 *
356 * -- At the very least, the widget's window proc must
357 * implement WM_CREATE, WM_PAINT, and (if cleanup
358 * is necessary) WM_DESTROY. WM_PRESPARAMCHANGED
359 * would also be nice to support fonts and colors
360 * dropped on the widget.
361 *
362 * -- On WM_CREATE, the widget receives a pointer to
363 * its XCENTERWIDGET structure in mp1.
364 *
365 * The first thing the widget _must_ do on WM_CREATE
366 * is to store the XCENTERWIDGET pointer (from mp1)
367 * in its QWL_USER window word by calling:
368 *
369 + WinSetWindowPtr(hwnd, QWL_USER, mp1);
370 *
371 * -- The XCenter communicates with the widget using
372 * WM_CONTROL messages. SHORT1FROMMP(mp1), the
373 * source window ID, is always ID_XCENTER_CLIENT.
374 * SHORT2FROMMP(mp1), the notification code, can
375 * be:
376 *
377 * -- XN_QUERYSIZE: the XCenter wants to know the
378 * widget's size.
379 *
380 * -- XN_SETUPCHANGED: widget's setup string has
381 * changed.
382 *
383 * -- XN_BEGINANIMATE: the widget is about to be
384 * shown/hidden.
385 *
386 * -- XN_ENDANIMATE: the widget is now fully shown/hidden.
387 *
388 * -- XN_HITTEST: for transparent widgets, the XCenter
389 * wants to know if the specified location is covered.
390 *
391 * -- All unprocessed notifications must be routed
392 * to ctrDefWidgetProc instead of WinDefWindowProc.
393 * Do not swallow unprocessed messages.
394 *
395 * -- You must never use WinSetWindowPos on your widget
396 * window yourself because this will solidly confuse
397 * the XCenter widget formatting. If you want your
398 * widget window to be resized, post XCM_SETWIDGETSIZE
399 * to the widget's parent instead, which will resize
400 * your widget properly and also reformat the other
401 * widgets, if necessary.
402 *
403 * -- All unprocessed messages should be routed
404 * to ctrDefWidgetProc instead of WinDefWindowProc.
405 *
406 * -- WM_MENUEND must _always_ be passed on after your
407 * own processing (if any) to remove source emphasis
408 * for popup menus.
409 *
410 * -- WM_DESTROY must _always_ be passed on after
411 * your own cleanup code to avoid memory leaks,
412 * because this function performs important cleanup
413 * as well.
414 *
415 * -- WM_COMMAND command values above 0x7f00 are reserved.
416 * If you extend the context menu given to you in
417 * XCENTERWIDGET.hwndContextMenu, you must use
418 * menu item IDs < 0x7f00. This has been changed
419 * with V0.9.11 (2001-04-25) [umoeller] to avoid
420 * conflicts with the WPS menu item IDs, sorry.
421 *
422 * <B>Resource management</B>
423 *
424 * You should always be aware that your widget is a PM
425 * window in the WPS process. As a result, all resource
426 * leaks that you produce in your widget code will affect
427 * the entire WPS, and all crashes will too.
428 *
429 * As a general rule, the XCenter will free all widget
430 * resources that it has allocated itself (such as the
431 * structures that were created for it). By contrast,
432 * if you allocate something yourself, it is your
433 * responsibility to free it. This applies especially
434 * to XCENTERWIDGET.pUser, which is your general pointer
435 * to store widget-specific things.
436 *
437 * Of course the same rules apply to PM resources such
438 * as icons, bitmaps, regions, memory PS's etc. You can
439 * quickly bring down the WPS if you forget to free those.
440 * Same thing if you start additional threads in your
441 * widget code.
442 *
443 * This is especially important because widget windows
444 * can be created and destroyed without the widgets
445 * cooperation. For example, if the widget is in a tray,
446 * it will be created and destroyed when the current
447 * tray changes. If you leak something in this situation,
448 * this can quickly become a major problem.
449 *
450 * I also recommend to use exception handling in your
451 * widget code to properly clean up things if something
452 * goes wrong. As said in center.c, do not use exit
453 * lists because that will cause DLL unloading to fail.
454 *
455 * <B>Tooltip support</B>
456 *
457 * If your widget class has the WGTF_TOOLTIP flag set,
458 * it will receive WM_CONTROL with TTN_* notifications
459 * and the source window ID set to ID_XCENTER_TOOLTIP.
460 * If it responds to TTN_NEEDTEXT, it must fill the
461 * TOOLTIPTEXT pointed to by mp2. See include\helpers\comctl.h
462 * for details.
463 *
464 * In addition, the widget will also receive the TTN_SHOW
465 * and TTN_POP notifications when the tooltip is being
466 * shown or hidden above it.
467 *
468 * <B>Trayable widgets</B>
469 *
470 * If your widget is supposed to be trayable (i.e.
471 * the WGTF_TRAYABLE flag is set in the XCENTERWIDGETCLASS),
472 * it must conform to a few extra rules:
473 *
474 * -- Trayable widgets cannot be sizeable or greedy
475 * because the tray widget itself is sizeable.
476 *
477 * -- You must never assume that the parent window of
478 * your widget really is the XCenter client. It can
479 * also be a tray widget. Always use
480 * WinQueryWindow(hwndWidget, QW_PARENT) to find your
481 * parent window, which will properly give you either
482 * the XCenter client or the tray widget.
483 *
484 * -- If you use XCM_* messages, never post them to the
485 * XCenter client window (whose handle is available
486 * thru XCENTERGLOBALS). All XCM_* essages are understood
487 * by the tray widget also, and if your widget is in a tray,
488 * it must post them to the tray instead of the client.
489 *
490 * -- Your widget must be prepared for being created or
491 * destroyed at times other than XCenter creation or
492 * destruction because the tray widget will do this
493 * when the current tray is switched.
494 */
495
496 typedef struct _XCENTERWIDGETCLASS
497 {
498 const char *pcszPMClass;
499 // PM window class name of this widget class (can be shared among
500 // several widget classes). A plugin DLL is responsible for
501 // registering this window class when it's loaded.
502 // Naturally, this must be unique on the system.
503
504 ULONG ulExtra;
505 // additional identifiers the class might need if the
506 // same PM window class is used for several widget classes.
507 // This is not used by the XCenter, but you can access it
508 // during WM_CREATE so you can differentiate between several
509 // widget classes in the same window proc. You must copy this
510 // to your private widget data then.
511 // For example, MONITORS.DLL uses this to differentiate
512 // between the various monitor widget classes.
513
514 const char *pcszWidgetClass;
515 // internal widget class name; this is used to identify
516 // the class. This must be unique on the system and must
517 // not contain special characters like commas, brackets,
518 // etc. Besides, since this must work with all codepages,
519 // use only ASCII characters <= 127, and use an English
520 // name always.
521 // A valid name would be "MySampleClass".
522 // This is stored internally in the XCenter data and is
523 // used whenever the XCenter is opened to create all the
524 // widgets from the respective widget classes. In other
525 // words, this is the class identifier and must never
526 // change between several releases or different NLS versions
527 // of your plugin DLL, or otherwise widget creation will fail.
528 // Choose this name carefully.
529
530 const char *pcszClassTitle;
531 // explanatory widget class title, which is shown to the
532 // user in the "Add widget" popup menu. Example: "Sample widget".
533 // This is not used to identify the class internally and may
534 // change between releases and NLS versions. So you can set
535 // this to a language-specific string.
536 // Note: If this has the highest bit set, it is assumed to
537 // be a string resource ID in the XWorkplace NLS DLL instead
538 // of a real string:
539 #define XCENTER_STRING_RESOURCE 0x80000000
540 // V0.9.19 (2002-05-07) [umoeller]
541
542 ULONG ulClassFlags;
543 // WGTF_* flags; any combination of the following:
544
545 #define WGTF_SIZEABLE 0x0001
546 // -- WGTF_SIZEABLE: widget window can be resized with
547 // the mouse by the user. A sizing bar is automatically
548 // painted by the XCenter engine then.
549
550 #define WGTF_NOUSERCREATE 0x0002
551 // -- WGTF_NOUSERCREATE: do not show this class in
552 // the "add widget" menu, and do not allow creating
553 // instances of this in the XCenter settings notebook.
554 // This is used for the object button widget, which
555 // can only be created through drag'n'drop. This flag
556 // isn't terribly useful for plug-in DLLs because
557 // without support in the XCenter engine the widget
558 // could then not be created at all.
559
560 #define WGTF_UNIQUEPERXCENTER 0x0004
561 // -- WGTF_UNIQUEPERXCENTER: only one widget of this class
562 // should be created per XCenter.
563
564 #define WGTF_UNIQUEGLOBAL (0x0008 + 0x0004)
565 // -- WGTF_UNIQUEGLOBAL: only one widget of this class
566 // should be created in all XCenters on the system.
567 // This implies WGTF_UNIQUEPERXCENTER.
568
569 #define WGTF_TOOLTIP 0x0010
570 // -- WGTF_TOOLTIP: if set, the widget has a tooltip
571 // and will receive WM_CONTROL messages with the
572 // TTN_NEEDTEXT, TTN_SHOW, or TTN_POP notification codes
573 // (see helpers\comctl.h).
574 // The window ID of the tooltip control is ID_XCENTER_TOOLTIP.
575 // See XCENTERWIDGETCLASS for tooltip handling.
576
577 #define WGTF_TOOLTIP_AT_MOUSE (0x0020 + 0x0010)
578 // -- WGTF_TOOLTIP_AT_MOUSE: like WGTF_TOOPTIP, but the
579 // tooltip is not centered above the widget, but put
580 // at the mouse position instead.
581 // This implies WGTF_TOOLTIP.
582
583 #define WGTF_TRANSPARENT 0x0040
584 // -- WGTF_TRANSPARENT: some parts of the widget window
585 // are transparent. The widget will receive WM_CONTROL
586 // messages with the XN_HITTEST notification code.
587 // If the widget returns FALSE to the notification,
588 // the action will be forwarded to its parent (the
589 // XCenter client or a tray widget).
590
591 #define WGTF_NONFOCUSTRAVERSABLE 0x0100
592 // Reserved for future use.
593
594 #define WGTF_TRAYABLE 0x0200
595 // -- WGTF_TRAYABLE: widget is "trayable", that is, it
596 // supports being created inside a tray widget.
597 // Note: Restrictions apply if you want your widget
598 // to be trayable. See above.
599
600 #define WGTF_CANTAKECENTERHOTKEY 0x0400
601 // -- WGTF_CANTAKECENTERHOTKEY: signals that the widget is
602 // willing to take action when the XCenter gets
603 // resurfaced via its object hotkey.
604 // The widget will then receive WM_CONTROL with
605 // the XN_CENTERHOTKEYPRESSED code; see remarks for
606 // XN_CENTERHOTKEYPRESSED.
607 // V0.9.19 (2002-04-17) [umoeller]
608
609 #define WGTF_CONFIRMREMOVE 0x0800
610 // -- WGTF_CONFIRMREMOVE: adds "..." to the "Remove widget"
611 // context menu item and confirms removal if the user
612 // selects that.
613 // V0.9.20 (2002-08-08) [umoeller]
614
615 PWGTSHOWSETTINGSDLG pShowSettingsDlg;
616 // if the widget supports a settings dialog,
617 // it must set this func pointer to a procedure
618 // that will show that dialog. If this is != NULL,
619 // the "Properties" menu item and the button in
620 // the widgets list of the XCenter settings notebook
621 // will be enabled. See WIDGETSETTINGSDLGDATA for
622 // details about how to implement widget settings dialogs.
623
624 } XCENTERWIDGETCLASS, *PXCENTERWIDGETCLASS;
625
626 typedef const struct _XCENTERWIDGETCLASS *PCXCENTERWIDGETCLASS;
627
628 /*
629 *@@ XCENTERWIDGETSETTING:
630 * describes one widget to be created. One instance
631 * of this is created for each widget that the
632 * user has configured for a widget.
633 *
634 * An array of these is stored in packed form in the
635 * XCenter instance data and describes all widgets
636 * in the XCenter. Widget classes normally don't need
637 * this.
638 *
639 * An array of these is returned by XCenter::xwpQueryWidgets.
640 */
641
642 typedef struct _XCENTERWIDGETSETTING
643 {
644 PSZ pszWidgetClass; // widget class name;
645 // we cannot use the binary PXCENTERWIDGETCLASS pointer
646 // here because these structures are dynamically unloaded...
647 // use ctrpFindClass to find the XCENTERWIDGETCLASS ptr.
648 PSZ pszSetupString;
649 // widget-class-specific setup string; can be NULL
650
651 // Note: both pointers are assumed to be allocated
652 // using malloc() or strdup() and are automatically
653 // freed.
654
655 } XCENTERWIDGETSETTING, *PXCENTERWIDGETSETTING;
656
657 /*
658 *@@ XCENTERWIDGET:
659 * public structure to hold data for an XCenter
660 * widget, i.e. a PM window in the XCenter client
661 * area.
662 *
663 * Each XCenter widget is a separate window,
664 * being a child window of the XCenter client,
665 * which in turn is a child of the XCenter frame.
666 * The exception is a widget in a tray, which is
667 * a child of a tray widget, which in turn is a
668 * child of the XCenter client.
669 *
670 * This structure is created once for each widget
671 * and passed to each widget in mp1 of WM_CREATE.
672 * The first thing a widget must do on WM_CREATE
673 * is to store a pointer to this structure in its
674 * QWL_USER window word.
675 *
676 * The widget can allocate another widget-specific
677 * buffer and store its pointer into the pUser
678 * field. This is strongly recommended because
679 * otherwise your widget will have no place to
680 * store its instance data.
681 *
682 * This structure is automatically freed by the
683 * XCenter when the widget is destroyed. However,
684 * if you allocated more memory for pUser, it is
685 * your own responsibility to free that on WM_DESTROY.
686 * General rule: The widget must clean up what it
687 * allocated itself.
688 *
689 * See XCENTERWIDGETCLASS for rules that a widget
690 * window proc must conform to.
691 */
692
693 typedef struct _XCENTERWIDGET
694 {
695 /*
696 * Informational fields:
697 * all these are meant for reading only
698 * and set up by the XCenter for the widget.
699 */
700
701 HWND hwndWidget;
702 // window handle of this widget; this is valid
703 // only _after_ WM_CREATE.
704
705 HAB habWidget;
706 // widget's anchor block (copied for convenience).
707
708 PFNWP pfnwpDefWidgetProc;
709 // address of default widget window procedure. This
710 // always points to ctrDefWidgetProc (in
711 // src/shared/center.c). The widget's own window
712 // proc must pass all unprocessed messages (and a
713 // few more) to this instead of WinDefWindowProc.
714 // See XCENTERWIDGETCLASS for details.
715
716 PCXCENTERGLOBALS pGlobals;
717 // ptr to client/frame window data (do not change)
718
719 PCXCENTERWIDGETCLASS pWidgetClass;
720 // widget class this widget was created from;
721 // this ptr is only valid during WM_CREATE and
722 // always NULL afterwards
723
724 PCSZ pcszWidgetClass;
725 // internal name of the widget's class; this
726 // is the same as pWidgetClass->pcszWidgetClass,
727 // but this is valid after WM_CREATE.
728 // DO NOT CHANGE it, the XCenter relies on this!
729 ULONG ulClassFlags;
730 // class flags copied from XCENTERWIDGETCLASS.
731
732 PCSZ pcszSetupString;
733 // class-specific setup string. This field
734 // is only valid during WM_CREATE and then holds
735 // the setup string which was last stored with
736 // the widget. The pointer can be NULL if no
737 // setup string exists. After WM_CREATE, the
738 // pointer is set to NULL always.
739 // The widget should use this string to initialize
740 // itself. When its instance data changes, it
741 // should send XCM_SAVESETUP to its parent
742 // so that the XCenter can record the new setup
743 // string.
744
745 /*
746 * Setup fields:
747 * all these should be set up by the widget
748 * (normally during WM_CREATE). The XCenter
749 * reads these fields to find out more about
750 * the widget's wishes.
751 *
752 * All these fields are initialized to safe
753 * defaults, which are probably not suitable
754 * for most widgets though.
755 */
756
757 BOOL fSizeable;
758 // if TRUE, the widget is sizeable with the mouse.
759 // This is initially set to TRUE if the widget's
760 // class has the WGTF_SIZEABLE flag, but can be
761 // changed by the widget at any time.
762 // NOTE: If your widget is "greedy", i.e. wants
763 // all remaining size on the XCenter bar (by
764 // returning -1 for cx with WM_CONTROL and
765 // XCN_QUERYSIZE), it cannot be sizeable.
766
767 HWND hwndContextMenu;
768 // default context menu for this widget.
769 // The XCenter loads a the same standard context menu
770 // for each widget, which is displayed on WM_CONTEXTMENU
771 // in ctrDefWidgetProc. Normally, the widget needs not
772 // do anything to have the context menu displayed;
773 // ctrDefWidgetProc takes care of this. However, you may
774 // safely manipulate this context menu if you want to
775 // insert/remove items.
776 // The menu in here gets destroyed using WinDestroyWindow
777 // when the widget window is destroyed.
778 // This is only valid after WM_CREATE.
779
780 PCSZ pcszHelpLibrary;
781 ULONG ulHelpPanelID;
782 // if these two are specified, the XCenter will
783 // enable the "Help" item in the widget's context
784 // menu and display the specified help panel when
785 // the menu item is selected. Both default to NULL.
786
787 /*
788 * Additional fields:
789 */
790
791 PVOID pUser;
792 // user data allocated by window class; this is
793 // initially NULL, but you can use this for your
794 // own data (which you must clean up yourself on
795 // WM_DESTROY).
796
797 PVOID pvWidgetSetting;
798 // private pointer for tray widget. DO NOT USE THIS.
799 // V0.9.13 (2001-06-21) [umoeller]
800
801 } XCENTERWIDGET;
802
803 /* ******************************************************************
804 *
805 * Public widget helpers (exported from XFLDR.DLL)
806 *
807 ********************************************************************/
808
809 // All these are specified as both simple prototypes and
810 // function pointer declarations so that widget classes
811 // can import these functions from XFLDR.DLL in the init
812 // export.
813
814 PSZ APIENTRY ctrScanSetupString(PCSZ pcszSetupString,
815 PCSZ pcszKeyword);
816 typedef PSZ APIENTRY CTRSCANSETUPSTRING(PCSZ pcszSetupString,
817 PCSZ pcszKeyword);
818 typedef CTRSCANSETUPSTRING *PCTRSCANSETUPSTRING;
819
820 LONG APIENTRY ctrParseColorString(PCSZ p);
821 typedef LONG APIENTRY CTRPARSECOLORSTRING(PCSZ p);
822 typedef CTRPARSECOLORSTRING *PCTRPARSECOLORSTRING;
823
824 VOID APIENTRY ctrFreeSetupValue(PSZ p);
825 typedef VOID APIENTRY CTRFREESETUPVALUE(PSZ p);
826 typedef CTRFREESETUPVALUE *PCTRFREESETUPVALUE;
827
828 // ctrSetSetupString has been defined above
829
830 BOOL APIENTRY ctrDisplayHelp(PCXCENTERGLOBALS pGlobals,
831 PCSZ pcszHelpFile,
832 ULONG ulHelpPanelID);
833 typedef BOOL APIENTRY CTRDISPLAYHELP(PCXCENTERGLOBALS pGlobals,
834 PCSZ pcszHelpFile,
835 ULONG ulHelpPanelID);
836 typedef CTRDISPLAYHELP *PCTRDISPLAYHELP;
837
838 VOID APIENTRY ctrShowContextMenu(PXCENTERWIDGET pWidget, HWND hwndContextMenu);
839 typedef VOID APIENTRY CTRSHOWCONTEXTMENU(PXCENTERWIDGET pWidget, HWND hwndContextMenu);
840 typedef CTRSHOWCONTEXTMENU *PCTRSHOWCONTEXTMENU;
841
842 VOID APIENTRY ctrPaintStaticWidgetBorder(HPS hps, PXCENTERWIDGET pWidget);
843 typedef VOID APIENTRY CTRPAINTSTATICWIDGETBORDER(HPS hps, PXCENTERWIDGET pWidget);
844 typedef CTRPAINTSTATICWIDGETBORDER *PCTRPAINTSTATICWIDGETBORDER;
845
846 VOID APIENTRY ctrDrawWidgetEmphasis(PXCENTERWIDGET pWidget, BOOL fRemove);
847 typedef VOID APIENTRY CTRDRAWWIDGETEMPHASIS(PXCENTERWIDGET pWidget, BOOL fRemove);
848 typedef CTRDRAWWIDGETEMPHASIS *PCTRDRAWWIDGETEMPHASIS;
849
850 VOID APIENTRY ctrPlaceAndPopupMenu(HWND hwndOwner, HWND hwndMenu, BOOL fAbove);
851 typedef VOID APIENTRY CTRPLACEANDPOPUPMENU(HWND hwndOwner, HWND hwndMenu, BOOL fAbove);
852 typedef CTRPLACEANDPOPUPMENU *PCTRPLACEANDPOPUPMENU;
853
854 MRESULT EXPENTRY ctrDefWidgetProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2);
855 // a pointer to this is in XCENTERWIDGET if the widget
856 // is a non-container widget
857 typedef MRESULT EXPENTRY CTRDEFWIDGETPROC(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2);
858 typedef CTRDEFWIDGETPROC *PCTRDEFWIDGETPROC;
859
860 /* ******************************************************************
861 *
862 * Open XCenter views
863 *
864 ********************************************************************/
865
866 BOOL APIENTRY ctrIsXCenterView(HWND hwndFrame);
867 typedef BOOL APIENTRY CTRISXCENTERVIEW(HWND hwndFrame);
868 typedef CTRISXCENTERVIEW *PCTRISXCENTERVIEW;
869 // this function was added with V0.9.16
870
871 /* ******************************************************************
872 *
873 * WM_CONTROL notification codes _from_ XCenter client
874 *
875 ********************************************************************/
876
877 #define ID_XCENTER_CLIENT 7000
878 #define ID_XCENTER_TOOLTIP 7001
879
880 /*
881 *@@ XN_QUERYSIZE:
882 * notification code for WM_CONTROL sent from
883 * the XCenter to a widget when it needs to
884 * know its desired size. This comes in once
885 * after WM_CREATE and may come in again later
886 * if the user changes XCenter view settings.
887 *
888 * Parameters:
889 *
890 * -- SHORT1FROMMP(mp1): ID, always ID_XCENTER_CLIENT.
891 *
892 * -- SHORT2FROMMP(mp1): notify code (XN_QUERYSIZE).
893 *
894 * -- PSIZEL mp2: pointer to a SIZEL structure in which
895 * the widget must fill in its desired
896 * size.
897 *
898 * The widget must return TRUE if it has put its
899 * desired size into the SIZEL structure. Otherwise
900 * the XCenter will assume some dumb default for
901 * the widget size.
902 *
903 * As a special case, a widget can put -1 into the
904 * cx field of the SIZEL structure. It will then
905 * receive all remaining space on the XCenter bar
906 * ("greedy" widgets). This is what the window list
907 * widget does, for example.
908 *
909 * If several widgets request to be "greedy", the
910 * remaining space on the XCenter bar is evenly
911 * distributed among the greedy widgets.
912 *
913 * After all widgets have been created, the XCenter
914 * (and all widgets) are resized to have the largest
915 * cy requested. As a result, your window proc cannot
916 * assume that it will always have the size it
917 * requested.
918 *
919 *@@added V0.9.7 (2000-12-14) [umoeller]
920 */
921
922 #define XN_QUERYSIZE 1
923
924 /*
925 *@@ XN_SETUPCHANGED:
926 * notification code for WM_CONTROL sent from
927 * the XCenter to a widget when its setup string
928 * has changed.
929 *
930 * Parameters:
931 *
932 * -- SHORT1FROMMP(mp1): ID, always ID_XCENTER_CLIENT.
933 *
934 * -- SHORT2FROMMP(mp1): notify code (XN_SETUPCHANGED).
935 *
936 * -- const char* mp2: pointer to a new zero-termianted
937 * setup string.
938 *
939 * The widget must return TRUE if it has processed
940 * the setup string successfully.
941 *
942 * This gets sent to an open widget when
943 * ctrSetSetupString has been invoked on it to allow
944 * it to update its display. This normally happens
945 * when its settings dialog saves a new setup string.
946 *
947 *@@added V0.9.7 (2000-12-13) [umoeller]
948 */
949
950 #define XN_SETUPCHANGED 2
951
952 /*
953 *@@ XN_OBJECTDESTROYED:
954 * notification code for WM_CONTROL posted (!)
955 * to a widget if it has registered itself with
956 * XFldObject::xwpSetWidgetNotify.
957 *
958 * This is a last chance for the widget to clean
959 * up itself when an object that it relies on gets
960 * destroyed (deleted or made dormant). This message
961 * is posted from XFldObject::wpUnInitData.
962 *
963 * Parameters:
964 *
965 * -- SHORT1FROMMP(mp1): ID, always ID_XCENTER_CLIENT.
966 *
967 * -- SHORT2FROMMP(mp1): notify code (XN_OBJECTDESTROYED).
968 *
969 * -- WPObject* mp2: SOM object pointer of object
970 * being destroyed. NOTE: This pointer
971 * is no longer valid. Do not invoke
972 * any SOM methods on it.
973 *
974 *@@added V0.9.7 (2001-01-03) [umoeller]
975 */
976
977 #define XN_OBJECTDESTROYED 3
978
979 /*
980 * XN_QUERYSETUP:
981 * notification code for WM_CONTROL sent to a widget
982 * when the sender needs to know the widget's setup string.
983 *
984 * Parameters:
985 *
986 * -- SHORT1FROMMP(mp1): ID, always ID_XCENTER_CLIENT.
987 *
988 * -- SHORT2FROMMP(mp1): notify code (XN_QUERYSETUP).
989 *
990 * -- char *mp2: buffer into which the setup string is
991 * copied. It can be NULL, in which case
992 * nothing is copied. Otherwise, it is
993 * expected to contain enough room for the
994 * whole setup string.
995 *
996 * The widget must return the minimum required size needed
997 * to store the setup string (even if mp2 is NULL).
998 *
999 *added V0.9.9 (2001-03-01) [lafaix]
1000 */
1001
1002 // #define XN_QUERYSETUP 4
1003
1004 // flags for XN_BEGINANIMATE and XN_ENDANIMATE
1005 #define XAF_SHOW 1
1006 #define XAF_HIDE 2
1007
1008 /*
1009 *@@ XN_BEGINANIMATE:
1010 * notification code for WM_CONTROL sent to a widget from
1011 * an XCenter when it is about to begin animating.
1012 *
1013 * Parameters:
1014 *
1015 * -- SHORT1FROMMP(mp1): ID, always ID_XCENTER_CLIENT.
1016 *
1017 * -- SHORT2FROMMP(mp1): notify code (XN_BEGINANIMATE).
1018 *
1019 * -- ULONG mp2: XAF_SHOW if the parent initiate a 'show' animation,
1020 * XAF_HIDE if the parent initiate a 'hide' animation.
1021 *
1022 * This notification is sent regardless of whether the XCenter
1023 * actually does animation. If it does no animation,
1024 * XN_ENDANIMATE immediately follows XN_BEGINANIMATE.
1025 *
1026 * An active widget can react to this message to start or
1027 * stop doing something. For example, a gauge widget can
1028 * choose to stop running when the container is hidden, to
1029 * save CPU cycles.
1030 *
1031 *@added V0.9.9 (2001-03-01) [lafaix]
1032 */
1033
1034 #define XN_BEGINANIMATE 5
1035
1036 /*
1037 *@@ XN_ENDANIMATE:
1038 * notification code for WM_CONTROL sent to a widget from
1039 * an XCenter when it has ended animating.
1040 *
1041 * Parameters:
1042 *
1043 * -- SHORT1FROMMP(mp1): ID, always ID_XCENTER_CLIENT.
1044 *
1045 * -- SHORT2FROMMP(mp1): notify code (XN_ENDANIMATE).
1046 *
1047 * -- ULONG mp2: XAF_SHOW if the parent ended a 'show' animation,
1048 * XAF_HIDE if the parent ended a 'hide' animation.
1049 *
1050 * This notification is sent regardless of whether the XCenter
1051 * actually does animation. If it does no animation,
1052 * XN_ENDANIMATE immediately follows XN_BEGINANIMATE.
1053 *
1054 * An active widget can react to this message to start or
1055 * stop doing something. For example, a gauge widget can
1056 * choose to stop running when the container is hidden, to
1057 * save CPU cycles.
1058 *
1059 *@added V0.9.9 (2001-03-01) [lafaix]
1060 */
1061
1062 #define XN_ENDANIMATE 6
1063
1064 /*
1065 * XN_QUERYWIDGETCOUNT:
1066 * notification code for WM_CONTROL sent from the XCenter
1067 * to a widget when it needs to know how many elements a
1068 * container-widget contains.
1069 *
1070 * Parameters:
1071 *
1072 * -- SHORT1FROMMP(mp1): ID, always ID_XCENTER_CLIENT.
1073 *
1074 * -- SHORT2FROMMP(mp1): notify code (XN_QUERYWIDGETCOUNT).
1075 *
1076 * -- PULONG mp2: pointer to an ULONG in which the widget
1077 * must fill in its widget count.
1078 *
1079 * The widgets count must only include first level elements.
1080 * That is, if a container contains other containers, the
1081 * elements in those sub-containers should not be included.
1082 *
1083 * The widget must return TRUE if it has put its count in the
1084 * ULONG. Otherwise, the XCenter will assume some dumb default
1085 * for the count.
1086 *
1087 *added V0.9.9 (2001-02-23) [lafaix]
1088 *changed V0.9.9 (2001-03-11) [lafaix]: uses a PULONG to return the count.
1089 */
1090
1091 // #define XN_QUERYWIDGETCOUNT 7
1092
1093 /*
1094 * XN_QUERYWIDGET:
1095 * notification code for WM_CONTROL sent from the XCenter
1096 * to a widget when it needs to know the widget present at
1097 * a given position.
1098 *
1099 * Parameters:
1100 *
1101 * -- SHORT1FROMMP(mp1): ID, always ID_XCENTER_CLIENT.
1102 *
1103 * -- SHORT2FROMMP(mp1): notify code (XN_QUERYWIDGET).
1104 *
1105 * -- ULONG mp2: widget index (0 is the first widget).
1106 *
1107 * The widget must return 0 if no widget exists at that index.
1108 * Otherwise it must return a pointer to the corresponding
1109 * XCENTERWIDGET structure.
1110 *
1111 *added V0.9.9 (2001-02-23) [lafaix]
1112 */
1113
1114 // #define XN_QUERYWIDGET 8
1115
1116 // structure needed for XN_INSERTWIDGET
1117 typedef struct _WIDGETINFO
1118 {
1119 SHORT sOffset;
1120 // either WGT_END or the 0-based offset
1121 PXCENTERWIDGET pWidget;
1122 // the widget to be inserted
1123 } WIDGETINFO, *PWIDGETINFO;
1124
1125 // flags and return values for XN_INSERTWIDGET:
1126 #define WGT_END (-1)
1127 #define WGT_ERROR (-1)
1128
1129 /*
1130 * XN_INSERTWIDGET:
1131 * notification code for WM_CONTROL sent from the XCenter
1132 * to a widget when it needs to add a widget at a specified
1133 * offset to a container-widget.
1134 *
1135 * Parameters:
1136 *
1137 * -- SHORT1FROMMP(mp1): ID, always ID_XCENTER_CLIENT.
1138 *
1139 * -- SHORT2FROMMP(mp1): notify code (XN_INSERTWIDGET).
1140 *
1141 * -- PWIDGETINFO mp2: a pointer to a WIDGETINFO structure
1142 * that details the insertion.
1143 *
1144 * The widget must return WGT_ERROR if the insertion failed.
1145 * Otherwise it must return the offset of the widget following
1146 * the inserted one.
1147 *
1148 *added V0.9.9 (2001-02-23) [lafaix]
1149 */
1150
1151 // #define XN_INSERTWIDGET 9
1152
1153 /*
1154 * XN_DELETEWIDGET:
1155 * notification code for WM_CONTROL sent from the XCenter
1156 * to a widget when it needs to remove a widget at a specified
1157 * offset.
1158 *
1159 * Parameters:
1160 *
1161 * -- SHORT1FROMMP(mp1): ID, always ID_XCENTER_CLIENT.
1162 *
1163 * -- SHORT2FROMMP(mp1): notify code (XN_INSERTWIDGET).
1164 *
1165 * -- SHORT mp2: the to be removed widget's offset.
1166 *
1167 * The widget must return the count of remaining widgets.
1168 *
1169 *added V0.9.9 (2001-02-23) [lafaix]
1170 */
1171
1172 // #define XN_DELETEWIDGET 10
1173
1174 /*
1175 *@@ XN_HITTEST:
1176 * notification code for WM_CONTROL sent from the XCenter
1177 * to a widget when it needs to know whether a specific
1178 * location is covered by the widget.
1179 *
1180 * Parameters:
1181 *
1182 * -- SHORT1FROMMP(mp1): ID, always ID_XCENTER_CLIENT.
1183 *
1184 * -- SHORT2FROMMP(mp1): notify code (XN_HITTEST).
1185 *
1186 * -- POINTS mp2: the location to test.
1187 *
1188 * The widget must return TRUE if the location is covered, or
1189 * FALSE otherwise.
1190 *
1191 *@@added V0.9.13 (2001-06-23) [umoeller]
1192 */
1193
1194 #define XN_HITTEST 11
1195
1196 /*
1197 *@@ XN_DISPLAYSTYLECHANGED:
1198 * notification code for WM_CONTROL sent (!)
1199 * to all widgets whenever an XCenter display
1200 * style changes.
1201 *
1202 * If your widget caches data from XCENTERGLOBALS
1203 * locally somewhere, or needs to rearrange its
1204 * display based on those settings, you should
1205 * intercept this and reformat yourself.
1206 *
1207 * It is not necessary to invalidate your widget
1208 * display though since this will be done
1209 * automatically by the XCenter when display
1210 * styles change. So after this notification,
1211 * you can be sure that WM_PAINT will come in
1212 * anyway.
1213 *
1214 * Parameters:
1215 *
1216 * -- SHORT1FROMMP(mp1): ID, always ID_XCENTER_CLIENT.
1217 *
1218 * -- SHORT2FROMMP(mp1): notify code (XN_DISPLAYSTYLECHANGED).
1219 *
1220 * -- mp2: unused, always NULL.
1221 *
1222 *@@added V0.9.13 (2001-06-21) [umoeller]
1223 */
1224
1225 #define XN_DISPLAYSTYLECHANGED 12
1226
1227 /*
1228 *@@ XN_INUSECHANGED:
1229 * notification code for WM_CONTROL posted (!)
1230 * to a widget if it has registered itself with
1231 * XFldObject::xwpSetWidgetNotify.
1232 *
1233 * This is posted from XFldObject::wpCnrSetEmphasis
1234 * when the object's in-use emphasis changes.
1235 *
1236 * Parameters:
1237 *
1238 * -- SHORT1FROMMP(mp1): ID, always ID_XCENTER_CLIENT.
1239 *
1240 * -- SHORT2FROMMP(mp1): notify code (XN_INUSECHANGED).
1241 *
1242 * -- WPObject* mp2: SOM object pointer of object whose
1243 * emphasis changed.
1244 *
1245 *@@added V0.9.13 (2001-06-21) [umoeller]
1246 */
1247
1248 #define XN_INUSECHANGED 13
1249
1250 /*
1251 *@@ XN_CENTERHOTKEYPRESSED:
1252 * notification code for WM_CONTROL sent (!)
1253 * to the first widget that has the WGTF_CANTAKECENTERHOTKEY
1254 * class flag when the XCenter hotkey is pressed.
1255 *
1256 * Presently this is only used by the X-button to
1257 * open its menu when the XCenter gets activated via
1258 * hotkey, but other widget classes could behave
1259 * accordingly.
1260 *
1261 * Parameters:
1262 *
1263 * -- SHORT1FROMMP(mp1): ID, always ID_XCENTER_CLIENT.
1264 *
1265 * -- SHORT2FROMMP(mp1): notify code (XN_CENTERHOTKEYPRESSED).
1266 *
1267 * -- mp2: unused, always NULL.
1268 *
1269 *@@added V0.9.19 (2002-04-17) [umoeller]
1270 */
1271
1272 #define XN_CENTERHOTKEYPRESSED 14
1273
1274 /* ******************************************************************
1275 *
1276 * Public messages _to_ XCenter client
1277 *
1278 ********************************************************************/
1279
1280 /*
1281 *@@ XCM_SETWIDGETSIZE:
1282 * this msg can be posted by a widget
1283 * to its parent if it wants to change
1284 * its size, e.g. because its display
1285 * has changed and it needs more room.
1286 *
1287 * The widget's parent will usually be
1288 * the XCenter client. However, if you
1289 * want your widget to be trayable, you
1290 * should never use XCENTERGLOBALS.hwndClient
1291 * but use WinQueryWindow(hwndWidget, QW_PARENT)
1292 * instead, because if your widget is in
1293 * a tray, its parent will be a tray widget,
1294 * which understands this message as well.
1295 *
1296 * Parameters:
1297 *
1298 * -- HWND mp1: widget's window.
1299 *
1300 * -- ULONG mp2: the new width that the
1301 * widget wants to have.
1302 *
1303 * Note: _Post_, do not send this message.
1304 * This causes excessive redraw of possibly
1305 * all widgets and will cause a flurry of
1306 * messages being sent back to your widget.
1307 *
1308 * Restrictions: This doesn't work during WM_CREATE
1309 * of your widget.
1310 */
1311
1312 #define XCM_SETWIDGETSIZE WM_USER
1313
1314 // formatting flags
1315 #define XFMF_DISPLAYSTYLECHANGED 0x0002
1316 #define XFMF_GETWIDGETSIZES 0x0001
1317 #define XFMF_RECALCHEIGHT 0x0004
1318 #define XFMF_REPOSITIONWIDGETS 0x0008
1319 #define XFMF_SHOWWIDGETS 0x0010
1320 #define XFMF_RESURFACE 0x0020
1321 #define XFMF_FOCUS2FIRSTWIDGET 0x0040
1322
1323 /*
1324 *@@ XCM_REFORMAT:
1325 * posted by a widget to its parent to reformat
1326 * the XCenter (or a tray) and all sibling widgets.
1327 * This gets posted by ctrDefWidgetProc when a widget
1328 * gets destroyed, but can be posted by anyone.
1329 *
1330 * The widget's parent will usually be
1331 * the XCenter client. However, if you
1332 * want your widget to be trayable, you
1333 * should never use XCENTERGLOBALS.hwndClient
1334 * but use WinQueryWindow(hwndWidget, QW_PARENT)
1335 * instead, because if your widget is in
1336 * a tray, its parent will be a tray widget,
1337 * which understands this message as well.
1338 *
1339 * Parameters:
1340 *
1341 * -- ULONG mp1: reformat flags. Any combination
1342 * of the following:
1343 *
1344 * -- XFMF_GETWIDGETSIZES: ask each widget for its
1345 * desired size.
1346 *
1347 * -- XFMF_DISPLAYSTYLECHANGED: display style has
1348 * changed, repaint everything.
1349 *
1350 * -- XFMF_RECALCHEIGHT: recalculate the XCenter's
1351 * height, e.g. if a widget has been added or
1352 * removed or vertically resized.
1353 *
1354 * -- XFMF_REPOSITIONWIDGETS: reposition all widgets.
1355 * This is necessary if a widget's horizontal size
1356 * has changed.
1357 *
1358 * -- XFMF_SHOWWIDGETS: set WS_VISIBLE on all widgets.
1359 *
1360 * -- XFMF_RESURFACE: resurface XCenter to HWND_TOP.
1361 *
1362 * -- XFMF_FOCUS2FIRSTWIDGET: implies XFMF_RESURFACE,
1363 * but will open the X-Button widget's menu, if
1364 * appplicable.
1365 *
1366 * Even if you specify 0, the XCenter will be re-shown
1367 * if it is currently auto-hidden.
1368 *
1369 * -- mp2: reserved, must be 0.
1370 *
1371 * Note: _Post_, do not send this message.
1372 * This causes excessive redraw of possibly
1373 * all widgets and will cause a flurry of
1374 * messages being sent back to your widget.
1375 *
1376 * Restrictions: This doesn't work during WM_CREATE
1377 * of your widget.
1378 */
1379
1380 #define XCM_REFORMAT (WM_USER + 1)
1381
1382 /*
1383 *@@ XCM_SAVESETUP:
1384 * this msg can be sent (!) by a widget to
1385 * its parent if its settings have been
1386 * changed and it wants these settings to
1387 * be saved with the XCenter instance data.
1388 *
1389 * The widget's parent will usually be
1390 * the XCenter client. However, if you
1391 * want your widget to be trayable, you
1392 * should never use XCENTERGLOBALS.hwndClient
1393 * but use WinQueryWindow(hwndWidget, QW_PARENT)
1394 * instead, because if your widget is in
1395 * a tray, its parent will be a tray widget,
1396 * which understands this message as well.
1397 *
1398 * This is useful when fonts or colors have
1399 * been dropped on the widget and no settings
1400 * dialog is currently open (and ctrSetSetupString
1401 * therefore won't work).
1402 *
1403 * Note: Saving widget setup strings in the XCenter
1404 * data is a possibly expensive operation. Use
1405 * this message economically.
1406 *
1407 * Restrictions: This doesn't work during WM_CREATE
1408 * of your widget.
1409 *
1410 * Parameters:
1411 *
1412 * -- HWND mp1: widget's window.
1413 *
1414 * -- const char* mp2: zero-terminated setup string.
1415 *
1416 * Returns: TRUE if the setup string was successfully
1417 * saved.
1418 *
1419 *@@added V0.9.7 (2000-12-04) [umoeller]
1420 */
1421
1422 #define XCM_SAVESETUP (WM_USER + 2)
1423
1424 // WM_USER + 3 to WM_USER + 10 are reserved
1425
1426 /* ******************************************************************
1427 *
1428 * Widget Plugin DLL Exports
1429 *
1430 ********************************************************************/
1431
1432 // init-module export (ordinal 1)
1433 // WARNING: THIS PROTOTYPE HAS CHANGED WITH V0.9.9
1434 // IF QUERY-VERSION IS EXPORTED (@3, see below) THE NEW
1435 // PROTOTYPE IS USED
1436 typedef ULONG EXPENTRY FNWGTINITMODULE_OLD(HAB hab,
1437 HMODULE hmodXFLDR,
1438 PCXCENTERWIDGETCLASS *ppaClasses,
1439 PSZ pszErrorMsg);
1440 typedef FNWGTINITMODULE_OLD *PFNWGTINITMODULE_OLD;
1441
1442 typedef ULONG EXPENTRY FNWGTINITMODULE_099(HAB hab,
1443 HMODULE hmodPlugin,
1444 HMODULE hmodXFLDR,
1445 PCXCENTERWIDGETCLASS *ppaClasses,
1446 PSZ pszErrorMsg);
1447 typedef FNWGTINITMODULE_099 *PFNWGTINITMODULE_099;
1448
1449 // un-init-module export (ordinal 2)
1450 typedef VOID EXPENTRY FNWGTUNINITMODULE(VOID);
1451 typedef FNWGTUNINITMODULE *PFNWGTUNINITMODULE;
1452
1453 // query version (ordinal 3; added V0.9.9 (2001-02-01) [umoeller])
1454 // IF QUERY-VERSION IS EXPORTED,THE NEW PROTOTYPE FOR
1455 // INIT_MODULE (above) WILL BE USED
1456 typedef VOID EXPENTRY FNWGTQUERYVERSION(PULONG pulMajor,
1457 PULONG pulMinor,
1458 PULONG pulRevision);
1459 typedef FNWGTQUERYVERSION *PFNWGTQUERYVERSION;
1460#endif
1461
Note: See TracBrowser for help on using the repository browser.