00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #pragma once
00017
00018 #include "maxheap.h"
00019 #include "strclass.h"
00020 #include "color.h"
00021 #include "GetCOREInterface.h"
00022
00023
00024 class IPoint2;
00025 class Box2;
00026
00027 #ifdef MENUS_EXPORTS
00028 #define MENUS_API __declspec(dllexport)
00029 #else
00030 #define MENUS_API __declspec(dllimport)
00031 #endif
00032
00033 enum Event
00034 {
00035 EVENT_BEGIN_TRACK = 0,
00036 EVENT_CURSOR_DOWN,
00037 EVENT_RIGHT_CURSOR_DOWN,
00038 EVENT_CURSOR_MOVED,
00039 EVENT_CURSOR_UP,
00040 EVENT_END_TRACK,
00041 EVENT_KEY,
00042 EVENT_RIGHT_CURSOR_UP,
00043 EVENT_MIDDLE_CURSOR_DOWN,
00044 EVENT_MIDDLE_CURSOR_UP,
00045 };
00046
00047 enum EventParam { EP_NULL = 0, EP_SHOW_SUBMENU, EP_HIDE_SUBMENU };
00048
00053 struct MenuEvent: public MaxHeapOperators
00054 {
00064 Event mEvent;
00069 unsigned int mEventParam;
00070 };
00071
00072 enum QuadIndex { QUAD_ONE = 0, QUAD_TWO, QUAD_THREE, QUAD_FOUR };
00073
00074 enum DisplayMethod { DM_NORMAL = 0, DM_STRETCH, DM_FADE, DM_NUM_METHODS };
00075
00076
00077
00078
00079 class IMenu;
00080 class IMenuItem;
00081 class ActionItem;
00082
00083
00084
00085
00086
00096 class ItemID: public MaxHeapOperators
00097 {
00098 public:
00099 IMenu* mpMenu;
00100 IMenuItem* mpItem;
00101
00106 ItemID() : mpMenu(NULL), mpItem(NULL) { }
00109 void Null() { mpMenu = NULL; mpItem = NULL; }
00110
00116 friend bool operator==(ItemID& a, ItemID& b);
00124 friend bool operator!=(ItemID& a, ItemID& b) { return !(a == b); }
00125 };
00126
00127 inline bool operator==(ItemID& a, ItemID& b)
00128 {
00129 if ( a.mpMenu != b.mpMenu ||
00130 a.mpItem != b.mpItem )
00131 return false;
00132 else
00133 return true;
00134 }
00135
00136
00137
00138
00139
00140
00146 class IMenuTimer: public MaxHeapOperators
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157 {
00158 public:
00160 virtual ~IMenuTimer() {;}
00161
00165 virtual bool IsRunning() = 0;
00166
00167
00170 virtual void Start(IMenu* pIMenu, EventParam timingType) = 0;
00171
00172
00175 virtual void Stop() = 0;
00176
00177
00181 virtual void CheckTime() = 0;
00182
00183
00187 virtual bool HasElapsed() = 0;
00188
00189
00195 virtual void SetElapseTime(unsigned int elapseTime) = 0;
00198 virtual unsigned int GetElapseTime() const = 0;
00202 virtual IMenu* GetIMenu() const = 0;
00205 virtual EventParam GetTimingType() const = 0;
00206 };
00207
00208
00209 typedef unsigned int ValidityToken;
00210
00211
00212
00213
00214
00215 class MenuColors: public MaxHeapOperators
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226 {
00227 public:
00228 MenuColors() { ResetDefaults(); }
00229
00230
00231 void ResetDefaults()
00232 {
00233 mTitleBarBackgroundColor = Color(.0f, .0f, .0f);
00234 mTitleBarTextColor = Color(.75f, .75f, .75f);
00235 mItemBackgroundColor = Color(.75f, .75f, .75f);
00236 mItemTextColor = Color(.0f, .0f, .0f);
00237 mLastExecutedItemTextColor = Color(.95f, .85f, .0f);
00238 mHighlightedItemBackgroundColor = Color(.95f, .85f, .0f);
00239 mHighlightedItemTextColor = Color(.0f, .0f, .0f);
00240 mBorderColor = Color(.0f, .0f, .0f);
00241 mDisabledShadowColor = Color(.5f, .5f, .5f);
00242 mDisabledHighlightColor = Color(1.0f, 1.0f, 1.0f);
00243 }
00244
00245 Color mTitleBarBackgroundColor,
00246 mTitleBarTextColor,
00247 mItemBackgroundColor,
00248 mItemTextColor,
00249 mLastExecutedItemTextColor,
00250 mHighlightedItemBackgroundColor,
00251 mHighlightedItemTextColor,
00252 mBorderColor,
00253 mDisabledShadowColor,
00254 mDisabledHighlightColor;
00255 };
00256
00257 inline COLORREF MakeCOLORREF(const Color& c) { return RGB( FLto255(c.r), FLto255(c.g), FLto255(c.b) ); }
00258
00259
00260
00261
00267 class IMenuSettings: public MaxHeapOperators
00268
00269
00270
00271
00272
00273
00274
00275
00276
00277
00278 {
00279 public:
00281 virtual ~IMenuSettings() {;}
00282
00289 virtual bool IsTokenValid(const ValidityToken& token) = 0;
00295 virtual void UpdateValidityToken(ValidityToken& token) const = 0;
00296
00297
00300 virtual void ResetDefaults() = 0;
00301
00302
00307 virtual void SetBorderSz(int borderSz) = 0;
00309 virtual int GetBorderSz() const = 0;
00310
00311
00317 virtual void SetHorizontalMarginInPoints(int horizontalMarginInPoints) = 0;
00320 virtual int GetHorizontalMarginInPoints() const = 0;
00321
00322
00328 virtual void SetVerticalMarginInPoints(int verticalMarginInPoints) = 0;
00331 virtual int GetVerticalMarginInPoints() const = 0;
00332
00333
00338 virtual int GetHorizontalMargin(HDC hDC) const = 0;
00345 virtual int GetVerticalMargin(HDC hDC) const = 0;
00346
00347
00352 virtual void SetItemFontFace(MCHAR* szItemFontFace) = 0;
00355 virtual const MCHAR* GetItemFontFace() const = 0;
00356
00357
00362 virtual void SetTitleFontFace(MCHAR* szTitleFontFace) = 0;
00365 virtual const MCHAR* GetTitleFontFace() const = 0;
00366
00367
00372 virtual void SetItemFontSize(int itemFontSize) = 0;
00374 virtual int GetItemFontSize() const = 0;
00375
00376
00381 virtual void SetTitleFontSize(int titleFontSize) = 0;
00383 virtual int GetTitleFontSize() const = 0;
00384
00385
00391 virtual void SetUseUniformItemHeight(bool useUniformItemHeight) = 0;
00394 virtual bool GetUseUniformItemHeight() const = 0;
00395
00402 virtual void SetUseUniformItemHeightBOOL(BOOL useUniformItemHeight) = 0;
00407 virtual BOOL GetUseUniformItemHeightBOOL() const = 0;
00408
00409
00414 virtual void SetOpacity(float opacity) = 0;
00416 virtual float GetOpacity() const = 0;
00417
00418
00424 virtual void SetDisplayMethod(DisplayMethod displayMethod) = 0;
00428 virtual DisplayMethod GetDisplayMethod() const = 0;
00429
00430
00436 virtual void SetAnimatedSteps(unsigned int steps) = 0;
00439 virtual unsigned int GetAnimatedSteps() const = 0;
00440
00441
00446 virtual void SetAnimatedStepTime(unsigned int ms) = 0;
00449 virtual unsigned int GetAnimatedStepTime() const = 0;
00450
00451
00457 virtual void SetSubMenuPauseTime(unsigned int ms) = 0;
00460 virtual unsigned int GetSubMenuPauseTime() const = 0;
00461
00462
00469 virtual void SetUseLastExecutedItem(bool useLastExecutedItem) = 0;
00473 virtual bool GetUseLastExecutedItem() const = 0;
00474
00484 virtual void SetUseLastExecutedItemBOOL(BOOL useLastExecutedItem) = 0;
00490 virtual BOOL GetUseLastExecutedItemBOOL() const = 0;
00491
00492
00499 virtual void SetRepositionWhenClipped(bool repositionWhenClipped) = 0;
00504 virtual bool GetRepositionWhenClipped() const = 0;
00505
00513 virtual void SetRepositionWhenClippedBOOL(BOOL repositionWhenClipped) = 0;
00519 virtual BOOL GetRepositionWhenClippedBOOL() const = 0;
00520
00521
00527 virtual void SetRemoveRedundantSeparators(bool removeRedundantSeparators) = 0;
00531 virtual bool GetRemoveRedundantSeparators() const = 0;
00532
00540 virtual void SetRemoveRedundantSeparatorsBOOL(BOOL removeRedundantSeparators) = 0;
00546 virtual BOOL GetRemoveRedundantSeparatorsBOOL() const = 0;
00547 };
00548
00549
00550
00551
00552
00559 class IMenuGlobalContext: public MaxHeapOperators
00560
00561
00562
00563
00564
00565
00566
00567
00568
00569
00570
00571 {
00572 public:
00574 virtual ~IMenuGlobalContext() {}
00575
00582 virtual void SetIMenuSettings(IMenuSettings* pIMenuSettings) = 0;
00586 virtual IMenuSettings* GetIMenuSettings() const = 0;
00587
00588
00591 virtual void UpdateCursorPosition() = 0;
00592
00593
00597 virtual const IPoint2& GetCursorPosition() const = 0;
00598
00599
00604 virtual const IPoint2& GetInitialCursorPosition() const = 0;
00611 virtual void SetInitialCursorPosition(IPoint2& initPos) = 0;
00612
00613
00619 virtual void SetIMenuTimer(IMenuTimer* pIMenuTimer) = 0;
00623 virtual IMenuTimer* GetIMenuTimer() const = 0;
00624
00625
00631 virtual void SetHDisplayWnd(HWND hDisplayWnd) = 0;
00634 virtual HWND GetHDisplayWnd() const = 0;
00635
00636
00642 virtual void SetHMessageWnd(HWND hDisplayWnd) = 0;
00645 virtual HWND GetHMessageWnd() const = 0;
00646
00647
00653 virtual void SetHDisplayDC(HDC hDisplayDC) = 0;
00656 virtual HDC GetHDisplayDC() const = 0;
00657
00658
00664 virtual void SetTitleHFont(HFONT hTitleFont) = 0;
00667 virtual HFONT GetTitleHFont() const = 0;
00668
00669
00675 virtual void SetItemHFont(HFONT hItemFont) = 0;
00678 virtual HFONT GetItemHFont() const = 0;
00679
00680
00686 virtual void SetAcceleratorHFont(HFONT hItemFont) = 0;
00689 virtual HFONT GetAcceleratorHFont() const = 0;
00690
00691
00697 virtual void SetUniformItemSize(const IPoint2& itemSize) = 0;
00700 virtual const IPoint2& GetUniformItemSize() const = 0;
00701
00702
00706 virtual int GetTitleBarHeight() = 0;
00707
00708
00712 virtual ItemID& GetCurrentItemID() = 0;
00713
00714
00718 virtual ItemID& GetSelectionItemID() = 0;
00719
00720
00724 virtual bool HasSelection() = 0;
00725
00726
00730 virtual bool IsCurrentMenuSelected() = 0;
00735 virtual bool IsCurrentItemSelected() = 0;
00736
00737
00740 virtual void SelectCurrentItem() = 0;
00741 };
00742
00743
00744
00745
00746
00753 class IMenuLocalContext: public MaxHeapOperators
00754
00755
00756
00757
00758
00759
00760
00761
00762
00763
00764 {
00765 public:
00767 virtual ~IMenuLocalContext() {;}
00768
00774 virtual void SetHDrawDC(HDC hDrawDC) = 0;
00777 virtual HDC GetHDrawDC() const = 0;
00778
00779
00786 virtual void SetLocalCursorPosition(const IPoint2& localCursorPos) = 0;
00790 virtual const IPoint2& GetLocalCursorPosition() const = 0;
00791
00792
00798 virtual void SetMenuItemWidth(int menuWidth) = 0;
00801 virtual int GetMenuItemWidth() const = 0;
00802
00803
00810 virtual void SetLevel(int level) = 0;
00813 virtual int GetLevel() const = 0;
00814
00815
00823 virtual void SetLastExecutedItemPath(Tab<IMenuItem *> *pExecutedItemPath) = 0;
00828 virtual Tab<IMenuItem *> *GetLastExecutedItemPath() = 0;
00829
00830
00836 virtual void SetMenuColors(const MenuColors *pMenuColors) = 0;
00839 virtual const MenuColors *GetMenuColors() const = 0;
00840
00841
00854 virtual void SetIMenuGlobalContext(IMenuGlobalContext* pIMenuGlobalContext, int level, Tab<IMenuItem *> *pExecutedItemPath, const MenuColors *pMenuColors) = 0;
00857 virtual IMenuGlobalContext* GetIMenuGlobalContext() const = 0;
00858 };
00859
00860
00861 #include "iFnPub.h"
00862
00863
00864
00865
00872 class IQuadMenuSettings : public IMenuSettings, public FPStaticInterface
00873
00874
00875
00876
00877
00878
00879
00880
00881
00882
00883 {
00884 public:
00885
00886 enum
00887 {
00888
00889 fnIdResetDefaults,
00890 fnIdSetBorderSize,
00891 fnIdGetBorderSize,
00892 fnIdSetHorizontalMarginInPoints,
00893 fnIdGetHorizontalMarginInPoints,
00894 fnIdSetVerticalMarginInPoints,
00895 fnIdGetVerticalMarginInPoints,
00896 fnIdSetItemFontFace,
00897 fnIdGetItemFontFace,
00898 fnIdSetTitleFontFace,
00899 fnIdGetTitleFontFace,
00900 fnIdSetItemFontSize,
00901 fnIdGetItemFontSize,
00902 fnIdSetTitleFontSize,
00903 fnIdGetTitleFontSize,
00904 fnIdSetUseUniformItemHeight,
00905 fnIdGetUseUniformItemHeight,
00906 fnIdSetOpacity,
00907 fnIdGetOpacity,
00908 fnIdSetDisplayMethod,
00909 fnIdGetDisplayMethod,
00910 fnIdSetAnimatedSteps,
00911 fnIdGetAnimatedSteps,
00912 fnIdSetAnimatedStepTime,
00913 fnIdGetAnimatedStepTime,
00914 fnIdSetSubMenuPauseTime,
00915 fnIdGetSubMenuPauseTime,
00916 fnIdSetUseLastExecutedItem,
00917 fnIdGetUseLastExecutedItem,
00918 fnIdSetRepositionWhenClipped,
00919 fnIdGetRepositionWhenClipped,
00920 fnIdSetRemoveRedundantSeparators,
00921 fnIdGetRemoveRedundantSeparators,
00922
00923
00924 fnIdSetFirstQuadDisplayed,
00925 fnIdGetFirstQuadDisplayed,
00926 fnIdSetUseUniformQuadWidth,
00927 fnIdGetUseUniformQuadWidth,
00928 fnIdSetMirrorQuad,
00929 fnIdGetMirrorQuad,
00930 fnIdSetMoveCursorOnReposition,
00931 fnIdGetMoveCursorOnReposition,
00932 fnIdSetReturnCursorAfterReposition,
00933 fnIdGetReturnCursorAfterReposition,
00934 fnIdSetInitialCursorLocInBox_0to1,
00935 fnIdGetInitialCursorLocXInBox_0to1,
00936 fnIdGetInitialCursorLocYInBox_0to1,
00937
00938 fnIdSetTitleBarBackgroundColor,
00939 fnIdGetTitleBarBackgroundColor,
00940 fnIdSetTitleBarTextColor,
00941 fnIdGetTitleBarTextColor,
00942 fnIdSetItemBackgroundColor,
00943 fnIdGetItemBackgroundColor,
00944 fnIdSetItemTextColor,
00945 fnIdGetItemTextColor,
00946 fnIdSetLastExecutedItemTextColor,
00947 fnIdGetLastExecutedItemTextColor,
00948 fnIdSetHighlightedItemBackgroundColor,
00949 fnIdGetHighlightedItemBackgroundColor,
00950 fnIdSetHighlightedItemTextColor,
00951 fnIdGetHighlightedItemTextColor,
00952 fnIdSetBorderColor,
00953 fnIdGetBorderColor,
00954 fnIdSetDisabledShadowColor,
00955 fnIdGetDisabledShadowColor,
00956 fnIdSetDisabledHighlightColor,
00957 fnIdGetDisabledHighlightColor,
00958 #if defined(USE_NEW_CUI_IO_METHODS) && !defined(NO_CUI) // russom - 02/15/02
00959 fnIdSaveSettingsFile,
00960 fnIdLoadSettingsFile,
00961 #endif
00962 };
00963
00964
00971 virtual void SetFirstQuadDisplayed(QuadIndex firstQuadDisplayed) = 0;
00976 virtual QuadIndex GetFirstQuadDisplayed() const = 0;
00977
00978
00984 virtual void SetUseUniformQuadWidth(bool useUniformQuadWidth) = 0;
00988 virtual bool GetUseUniformQuadWidth() const = 0;
00989
00996 virtual void SetUseUniformQuadWidthBOOL(BOOL useUniformQuadWidth) = 0;
01001 virtual BOOL GetUseUniformQuadWidthBOOL() const = 0;
01002
01003
01009 virtual void SetMirrorQuad(bool mirrorQuad) = 0;
01012 virtual bool GetMirrorQuad() const = 0;
01013
01020 virtual void SetMirrorQuadBOOL(BOOL mirrorQuad) = 0;
01024 virtual BOOL GetMirrorQuadBOOL() const = 0;
01025
01026
01032 virtual void SetMoveCursorOnReposition(bool moveCursorOnReposition) = 0;
01036 virtual bool GetMoveCursorOnReposition() const = 0;
01037
01045 virtual void SetMoveCursorOnRepositionBOOL(BOOL moveCursorOnReposition) = 0;
01050 virtual BOOL GetMoveCursorOnRepositionBOOL() const = 0;
01051
01052
01059 virtual void SetReturnCursorAfterReposition(bool returnCursorAfterReposition) = 0;
01063 virtual bool GetReturnCursorAfterReposition() const = 0;
01064
01073 virtual void SetReturnCursorAfterRepositionBOOL(BOOL returnCursorAfterReposition) = 0;
01079 virtual BOOL GetReturnCursorAfterRepositionBOOL() const = 0;
01080
01081
01088 virtual void SetCursorLocInBox_0to1(float x, float y) = 0;
01091 virtual float GetCursorLocXInBox_0to1() const = 0;
01094 virtual float GetCursorLocYInBox_0to1() const = 0;
01095
01096
01097
01102 virtual const MenuColors *GetMenuColors(int quadNum) const = 0;
01103
01104
01112 virtual void SetTitleBarBackgroundColor(int quadNum, const Color& color) = 0;
01118 virtual const Color& GetTitleBarBackgroundColor(int quadNum) const = 0;
01124 virtual COLORREF GetTitleBarBackgroundColorRef(int quadNum) const = 0;
01125
01126
01134 virtual void SetTitleBarTextColor(int quadNum, const Color& color) = 0;
01140 virtual const Color& GetTitleBarTextColor(int quadNum) const = 0;
01146 virtual COLORREF GetTitleBarTextColorRef(int quadNum) const = 0;
01147
01148
01156 virtual void SetItemBackgroundColor(int quadNum, const Color& color) = 0;
01162 virtual const Color& GetItemBackgroundColor(int quadNum) const = 0;
01168 virtual COLORREF GetItemBackgroundColorRef(int quadNum) const = 0;
01169
01170
01178 virtual void SetItemTextColor(int quadNum, const Color& color) = 0;
01184 virtual const Color& GetItemTextColor(int quadNum) const = 0;
01190 virtual COLORREF GetItemTextColorRef(int quadNum) const = 0;
01191
01192
01200 virtual void SetLastExecutedItemTextColor(int quadNum, const Color& color) = 0;
01206 virtual const Color& GetLastExecutedItemTextColor(int quadNum) const = 0;
01212 virtual COLORREF GetLastExecutedItemTextColorRef(int quadNum) const = 0;
01213
01214
01222 virtual void SetHighlightedItemBackgroundColor(int quadNum, const Color& color) = 0;
01228 virtual const Color& GetHighlightedItemBackgroundColor(int quadNum) const = 0;
01234 virtual COLORREF GetHighlightedItemBackgroundColorRef(int quadNum) const = 0;
01235
01236
01244 virtual void SetHighlightedItemTextColor(int quadNum, const Color& color) = 0;
01250 virtual const Color& GetHighlightedItemTextColor(int quadNum) const = 0;
01256 virtual COLORREF GetHighlightedItemTextColorRef(int quadNum) const = 0;
01257
01258
01266 virtual void SetBorderColor(int quadNum, const Color& color) = 0;
01272 virtual const Color& GetBorderColor(int quadNum) const = 0;
01278 virtual COLORREF GetBorderColorRef(int quadNum) const = 0;
01279
01280
01288 virtual void SetDisabledShadowColor(int quadNum, const Color& color) = 0;
01294 virtual const Color& GetDisabledShadowColor(int quadNum) const = 0;
01300 virtual COLORREF GetDisabledShadowColorRef(int quadNum) const = 0;
01301
01302
01310 virtual void SetDisabledHighlightColor(int quadNum, const Color& color) = 0;
01316 virtual const Color& GetDisabledHighlightColor(int quadNum) const = 0;
01322 virtual COLORREF GetDisabledHighlightColorRef(int quadNum) const = 0;
01323
01324 #ifdef USE_NEW_CUI_IO_METHODS // russom - 02/15/02
01325
01326 virtual BOOL SaveSettingsFile( MCHAR *szFilename ) = 0;
01327 virtual BOOL LoadSettingsFile( MCHAR *szFilename ) = 0;
01328 #endif
01329
01330 };
01331
01332
01333 #define MENU_SETTINGS Interface_ID(0x31561ddb, 0x1a2f4619)
01334 inline IQuadMenuSettings* GetQuadSettings() { return (IQuadMenuSettings*)GetCOREInterface(MENU_SETTINGS); }
01335
01336
01337
01338
01339
01345 class IMenuElement: public MaxHeapOperators
01346
01347
01348
01349
01350
01351
01352
01353
01354
01355
01356 {
01357 public:
01358
01359 enum OriginLocation { UPPER_LEFT, LOWER_LEFT, LOWER_RIGHT, UPPER_RIGHT };
01361 virtual ~IMenuElement() {;}
01362
01371 virtual void SetOrigin(const IPoint2& origin, OriginLocation location) = 0;
01374 virtual const IPoint2& GetOrigin() const = 0;
01375
01376
01381 virtual void SetVisible(bool visible) = 0;
01384 virtual bool GetVisible() = 0;
01385
01386
01391 virtual void SetTitle(const MCHAR *customTitle) = 0;
01393 virtual const MSTR& GetTitle() = 0;
01394
01395
01400 virtual void SetEnabled(bool enabled) = 0;
01403 virtual bool GetEnabled() = 0;
01404
01405
01408 virtual const IPoint2& GetSize() = 0;
01409
01410
01414 virtual const Box2& GetRect() = 0;
01415
01416
01424 virtual bool IsInRect(const IPoint2& point) = 0;
01425 };
01426
01427
01428
01429
01430
01431 #define MENU_ITEM_INTERFACE Interface_ID(0x2e926bd1, 0x296e68f6)
01432
01438 class IMenuItem : public FPMixinInterface, public IMenuElement
01439
01440
01441
01442
01443
01444
01445
01446
01447
01448
01449 {
01450 public:
01451 typedef int IMenuItemIcon;
01452
01453
01454 typedef void (* ActionFn)(void);
01455
01456 typedef void (* PreDisplayCB)(IMenuItem& menuItem);
01457
01458
01459
01460
01461 enum ActionMode { AM_INACTIVE = 0,
01462 AM_SEPARATOR,
01463 AM_ITEM,
01464 AM_FN,
01465 AM_SUBMENU,
01466 AM_ITEM_SUBMENU };
01467
01468
01475 virtual void SetIMenuLocalContext(IMenuLocalContext* pIMenuLocalContext) = 0;
01476
01477
01483 virtual ActionMode GetActionMode() const = 0;
01484
01485
01488 virtual bool ExecuteAction() const = 0;
01489
01490
01493 virtual void ActAsSeparator() = 0;
01494
01497 virtual bool IsSeparator() const = 0;
01498
01499
01506 virtual void SetActionItem(ActionItem* pActionItem) = 0;
01509 virtual ActionItem* GetActionItem() const = 0;
01510
01511
01519 virtual void SetActionFn(ActionFn actionFn) = 0;
01523 virtual const ActionFn GetActionFn() const = 0;
01524
01525
01532 virtual void SetSubMenu(IMenu* menu) = 0;
01535 virtual IMenu* GetSubMenu() = 0;
01536
01537
01543 virtual void SetPreDisplayCB(PreDisplayCB preDisplayCB) = 0;
01545 virtual const PreDisplayCB GetPreDisplayCB() const = 0;
01546
01547
01549 virtual void Display(bool leftToRight) = 0;
01550
01551
01554 virtual MCHAR GetAccelerator() = 0;
01555
01556
01561 virtual void SetIcon(MaxIcon* pMaxIcon) = 0;
01563 virtual const MaxIcon* GetIcon() const = 0;
01564
01565
01570 virtual void SetChecked(bool checked) = 0;
01573 virtual bool GetChecked() = 0;
01574
01575
01582 virtual void SetHighlighted(bool highlighted) = 0;
01585 virtual bool GetHighlighted() const = 0;
01586
01587
01593 virtual void SetUseCustomTitle(bool useCustomTitle) = 0;
01596 virtual bool GetUseCustomTitle() const = 0;
01597
01598
01604 virtual void SetDisplayFlat(bool displayFlat) = 0;
01607 virtual bool GetDisplayFlat() const = 0;
01608
01609
01613 virtual void PostMenuInteraction() = 0;
01614
01615
01616 enum
01617 {
01618 setTitle,
01619 getTitle,
01620 setUseCustomTitle,
01621 getUseCustomTitle,
01622 setDisplayFlat,
01623 getDisplayFlat,
01624 getIsSeparator,
01625 getSubMenu,
01626 getMacroScript,
01627 };
01628 };
01629
01630
01631 #define MENU_INTERFACE Interface_ID(0x4bd57e2e, 0x6de57aeb)
01632
01638 class IMenu : public FPMixinInterface, public IMenuElement
01639 {
01640 public:
01641
01647 virtual void SetIMenuGlobalContext(IMenuGlobalContext* pIMenuGlobalContext, int level, Tab<IMenuItem *> *pExecutedItemPath, const MenuColors *pMenuColors) = 0;
01648
01649
01652 virtual IMenuLocalContext* GetIMenuLocalContext() = 0;
01653
01654
01656 virtual int NumItems() const = 0;
01657
01658
01663 virtual IMenuItem* GetItem(int position) = 0;
01664
01665
01666
01675 virtual void AddItem(IMenuItem* item, int position = -1) = 0;
01676
01677
01683 virtual void RemoveItem(int position) = 0;
01684
01685
01691 virtual void RemoveItem(IMenuItem* item) = 0;
01692
01693
01696 virtual IPoint2 GetMaxItemSize() = 0;
01697
01698
01702 virtual void Initialize() = 0;
01703
01704
01707 virtual void PostMenuInteraction() = 0;
01708
01709
01717 virtual bool HandleEvent(MenuEvent &event) = 0;
01718
01719
01722 virtual void Show(DisplayMethod displayMethod = DM_NORMAL, Box2 *rect = NULL) = 0;
01723
01724
01727 virtual void Hide(DisplayMethod displayMethod = DM_NORMAL) = 0;
01728
01735 virtual IMenuItem* FindAccelItem(MCHAR accelerator) = 0;
01738 virtual IMenuItem* FindNewSelectedItem() = 0;
01739
01740
01746 virtual void Display(IMenu* pParentMenu = NULL, bool show = true) = 0;
01747
01749 virtual void DisplayItems(IPoint2& origin, bool descending, bool leftToRight, bool nextSeparatorOK) = 0;
01750
01751
01754 virtual void Undisplay() = 0;
01755
01756
01759 virtual bool IsDisplayingSubMenu() = 0;
01760
01761
01764 virtual void TimerElapsed(EventParam timingType) = 0;
01765
01766
01772 virtual void SetShowTitle(bool showTitle) = 0;
01775 virtual bool GetShowTitle() const = 0;
01776
01777
01782 virtual void SetCustomTitle(const MCHAR *customTitle) = 0;
01784 virtual const MSTR& GetCustomTitle() const = 0;
01785
01786
01791 virtual void SetUseCustomTitle(bool useCustomTitle) = 0;
01794 virtual bool GetUseCustomTitle() const = 0;
01795
01796
01803 virtual void SetUseGlobalWidths(bool useGlobalWidths) = 0;
01807 virtual bool GetUseGlobalWidths() const = 0;
01808
01809
01812 virtual bool NoVisibleItems() = 0;
01813
01814
01815 enum
01816 {
01817 numItems,
01818 getItem,
01819 addItem,
01820 removeItem,
01821 removeItemByPosition,
01822 setTitle,
01823 getTitle,
01824 getUseCustomTitle,
01825 };
01826 };
01827
01828
01834 class IPopupMenu : public IMenu
01835 {
01836 public:
01837
01843 virtual void SetMenu(IMenu* menu) const = 0;
01847 virtual IMenu* GetMenu() const = 0;
01848
01856 virtual void TrackMenu(HWND hMessageWnd, bool displayAll = false) = 0;
01857 };
01858
01859
01864 class IMultiMenu: public MaxHeapOperators
01865 {
01866 public:
01868 virtual ~IMultiMenu() {;}
01869
01872 virtual int NumMenusAllowed() const = 0;
01873
01874
01876 virtual int NumMenus() const = 0;
01877
01878
01884 virtual IMenu* GetMenu(int position) = 0;
01885
01886
01887
01896 virtual void AddMenu(IMenu* menu, int pos = -1) = 0;
01897
01898
01904 virtual void RemoveMenu(int position) = 0;
01905
01906
01912 virtual void RemoveMenu(IMenu* menu) = 0;
01913
01914
01922 virtual void SetTitle(const MCHAR *customTitle, int pos) = 0;
01925 virtual const MSTR& GetTitle(int pos) = 0;
01926
01927
01935 virtual void SetUseCustomTitle(int pos, bool useCustomTitle) = 0;
01941 virtual bool GetUseCustomTitle(int pos) const = 0;
01942 };
01943
01944
01950 class IMenuBar : public IMultiMenu
01951 {
01952 public:
01960 virtual void TrackMenu(HWND hMessageWnd, bool displayAll = false) = 0;
01961 };
01962
01963
01964 #define QUAD_MENU_INTERFACE Interface_ID(0x78b735e9, 0x7c001f68)
01965
01970 class IQuadMenu : public FPMixinInterface, public IMultiMenu
01971 {
01972 public:
01979 virtual void TrackMenu(HWND hMessageWnd, bool displayAll = false) = 0;
01980
01981
01982 enum
01983 {
01984 getMenu,
01985 addMenu,
01986 removeMenu,
01987 removeMenuByPosition,
01988 setTitle,
01989 getTitle,
01990 trackMenu,
01991 };
01992 };
01993
01994
01996 MENUS_API IMenuItem * GetIMenuItem();
02001 MENUS_API void ReleaseIMenuItem(IMenuItem *);
02002
02004 MENUS_API IMenu * GetIMenu();
02009 MENUS_API void ReleaseIMenu(IMenu *);
02010
02012 MENUS_API IQuadMenu * GetIQuadMenu();
02017 MENUS_API void ReleaseIQuadMenu(IQuadMenu *);
02018