imenus.h

Go to the documentation of this file.
00001 /* -----------------------------------------------------------------------------
00002 // -----------------------------------------------------------------------------
00003 
00004    FILE: iMenus.h
00005 
00006      DESCRIPTION: abstract classes for menus
00007 
00008      CREATED BY: michael malone (mjm)
00009 
00010      HISTORY: created February 17, 2000
00011 
00012      Copyright (c) 2000, All Rights Reserved
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 // forward declarations
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, //RK:01/31/02, to support action options
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 // predeclarations
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 //  PURPOSE:
00149 //    Abstract class (Interface) for for a timer
00150 //
00151 //  NOTES:
00152 //    created:  04.04.00 - mjm
00153 //
00154 // -----------------------------------------------------------------------------
00155 // -----------------------------------------------------------------------------
00156 
00157 {
00158 public:
00160     virtual ~IMenuTimer() {;}
00161     // checks if timer is running
00165     virtual bool IsRunning() = 0;
00166 
00167     // (re)starts the timer
00170     virtual void Start(IMenu* pIMenu, EventParam timingType) = 0;
00171 
00172     // stops the timer
00175     virtual void Stop() = 0;
00176 
00177     // tells timer to check time. if elapsed, will notify its IMenu client
00181     virtual void CheckTime() = 0;
00182 
00183     // checks if timer has elapsed
00187     virtual bool HasElapsed() = 0;
00188 
00189     // sets/gets the elapse time
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 //  PURPOSE:
00218 //    class declaration for a menu's color settings
00219 //
00220 //  NOTES:
00221 //    created:  08.28.00 - mjm
00222 //
00223 // -----------------------------------------------------------------------------
00224 // -----------------------------------------------------------------------------
00225 
00226 {
00227 public:
00228     MenuColors() { ResetDefaults(); }
00229 
00230     // sets values to defaults
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 //  PURPOSE:
00270 //    Abstract class (Interface) for general menu settings
00271 //
00272 //  NOTES:
00273 //    created:  02.17.00 - mjm
00274 //
00275 // -----------------------------------------------------------------------------
00276 // -----------------------------------------------------------------------------
00277 
00278 {
00279 public:
00281     virtual ~IMenuSettings() {;}
00282     // to determine validity of settings
00289     virtual bool IsTokenValid(const ValidityToken& token) = 0;
00295     virtual void UpdateValidityToken(ValidityToken& token) const = 0;
00296 
00297     // sets values to defaults
00300     virtual void ResetDefaults() = 0;
00301 
00302     // sets and gets the border size
00307     virtual void SetBorderSz(int borderSz) = 0;
00309     virtual int GetBorderSz() const = 0;
00310 
00311     // sets and gets the horizontal margin size (in points)
00317     virtual void SetHorizontalMarginInPoints(int horizontalMarginInPoints) = 0;
00320     virtual int GetHorizontalMarginInPoints() const = 0;
00321 
00322     // sets and gets the vertical margin size (in points)
00328     virtual void SetVerticalMarginInPoints(int verticalMarginInPoints) = 0;
00331     virtual int GetVerticalMarginInPoints() const = 0;
00332 
00333     // gets the margins in pixels
00338     virtual int GetHorizontalMargin(HDC hDC) const = 0;
00345     virtual int GetVerticalMargin(HDC hDC) const = 0;
00346 
00347     // sets and gets the item font face
00352     virtual void SetItemFontFace(MCHAR* szItemFontFace) = 0;
00355     virtual const MCHAR* GetItemFontFace() const = 0;
00356 
00357     // sets and gets the title font face
00362     virtual void SetTitleFontFace(MCHAR* szTitleFontFace) = 0;
00365     virtual const MCHAR* GetTitleFontFace() const = 0;
00366 
00367     // sets and gets the item font size
00372     virtual void SetItemFontSize(int itemFontSize) = 0;
00374     virtual int GetItemFontSize() const = 0;
00375 
00376     // sets and gets the title font size
00381     virtual void SetTitleFontSize(int titleFontSize) = 0;
00383     virtual int GetTitleFontSize() const = 0;
00384 
00385     // sets and gets whether menu item's have uniform height
00391     virtual void SetUseUniformItemHeight(bool useUniformItemHeight) = 0;
00394     virtual bool GetUseUniformItemHeight() const = 0;
00395     // these overrides are provided for the function publishing system
00402     virtual void SetUseUniformItemHeightBOOL(BOOL useUniformItemHeight) = 0;
00407     virtual BOOL GetUseUniformItemHeightBOOL() const = 0;
00408 
00409     // sets and gets the opacity - 0 to 1
00414     virtual void SetOpacity(float opacity) = 0;
00416     virtual float GetOpacity() const = 0;
00417 
00418     // sets and gets the display method
00424     virtual void SetDisplayMethod(DisplayMethod displayMethod) = 0;
00428     virtual DisplayMethod GetDisplayMethod() const = 0;
00429 
00430     // sets and gets the number of animation steps
00436     virtual void SetAnimatedSteps(unsigned int steps) = 0;
00439     virtual unsigned int GetAnimatedSteps() const = 0;
00440 
00441     // sets and gets the duration of an animation step (milliseconds)
00446     virtual void SetAnimatedStepTime(unsigned int ms) = 0;
00449     virtual unsigned int GetAnimatedStepTime() const = 0;
00450 
00451     // sets and gets the delay before a submenu is displayed (milliseconds)
00457     virtual void SetSubMenuPauseTime(unsigned int ms) = 0;
00460     virtual unsigned int GetSubMenuPauseTime() const = 0;
00461 
00462     // sets and gets whether to use the menu's last executed item (when user clicks in title bar)
00469     virtual void SetUseLastExecutedItem(bool useLastExecutedItem) = 0;
00473     virtual bool GetUseLastExecutedItem() const = 0;
00474     // these overrides are provided for the function publishing system
00484     virtual void SetUseLastExecutedItemBOOL(BOOL useLastExecutedItem) = 0;
00490     virtual BOOL GetUseLastExecutedItemBOOL() const = 0;
00491 
00492     // sets and gets whether the menu is repositioned when near the edge of the screen
00499     virtual void SetRepositionWhenClipped(bool repositionWhenClipped) = 0;
00504     virtual bool GetRepositionWhenClipped() const = 0;
00505     // these overrides are provided for the function publishing system
00513     virtual void SetRepositionWhenClippedBOOL(BOOL repositionWhenClipped) = 0;
00519     virtual BOOL GetRepositionWhenClippedBOOL() const = 0;
00520 
00521     // sets and gets whether the menu should remove redundant separators
00527     virtual void SetRemoveRedundantSeparators(bool removeRedundantSeparators) = 0;
00531     virtual bool GetRemoveRedundantSeparators() const = 0;
00532     // these overrides are provided for the function publishing system
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 //  PURPOSE:
00562 //    Abstract class (Interface) for context global to all menus that might be
00563 //    displayed during a user's menuing action
00564 //
00565 //  NOTES:
00566 //    created:  02.17.00 - mjm
00567 //
00568 // -----------------------------------------------------------------------------
00569 // -----------------------------------------------------------------------------
00570 
00571 {
00572 public:
00574     virtual ~IMenuGlobalContext() {}
00575     // sets and gets the menu settings
00582     virtual void SetIMenuSettings(IMenuSettings* pIMenuSettings) = 0;
00586     virtual IMenuSettings* GetIMenuSettings() const = 0;
00587 
00588     // updates cursor position from win32
00591     virtual void UpdateCursorPosition() = 0;
00592 
00593     // gets the cached cursor position
00597     virtual const IPoint2& GetCursorPosition() const = 0;
00598 
00599     // sets and gets the cached initial cursor position. This is where the user clicked
00604     virtual const IPoint2& GetInitialCursorPosition() const = 0;
00611     virtual void SetInitialCursorPosition(IPoint2& initPos) = 0;
00612 
00613     // sets and gets the global timer
00619     virtual void SetIMenuTimer(IMenuTimer* pIMenuTimer) = 0;
00623     virtual IMenuTimer* GetIMenuTimer() const = 0;
00624 
00625     // sets and gets the handle to the display window
00631     virtual void SetHDisplayWnd(HWND hDisplayWnd) = 0;
00634     virtual HWND GetHDisplayWnd() const = 0;
00635 
00636     // sets and gets the handle to the messsage window
00642     virtual void SetHMessageWnd(HWND hDisplayWnd) = 0;
00645     virtual HWND GetHMessageWnd() const = 0;
00646 
00647     // sets and gets the handle to the display device context
00653     virtual void SetHDisplayDC(HDC hDisplayDC) = 0;
00656     virtual HDC GetHDisplayDC() const = 0;
00657 
00658     // sets and gets the handle to the title font
00664     virtual void SetTitleHFont(HFONT hTitleFont) = 0;
00667     virtual HFONT GetTitleHFont() const = 0;
00668 
00669     // sets and gets the handle to the item font
00675     virtual void SetItemHFont(HFONT hItemFont) = 0;
00678     virtual HFONT GetItemHFont() const = 0;
00679 
00680     // sets and gets the handle to the accelerator font
00686     virtual void SetAcceleratorHFont(HFONT hItemFont) = 0;
00689     virtual HFONT GetAcceleratorHFont() const = 0;
00690 
00691     // sets and gets the menu's maximum item size
00697     virtual void SetUniformItemSize(const IPoint2& itemSize) = 0;
00700     virtual const IPoint2& GetUniformItemSize() const = 0;
00701 
00702     // gets the height of a title bar, not counting the border
00706     virtual int GetTitleBarHeight() = 0;
00707 
00708     // gets the ItemID of the menu/item triplet currently being traversed
00712     virtual ItemID& GetCurrentItemID() = 0;
00713 
00714     // gets the ItemID of the menu/item triplet currently selected
00718     virtual ItemID& GetSelectionItemID() = 0;
00719 
00720     // convenience functions to determine selection is available
00724     virtual bool HasSelection() = 0;
00725 
00726     // convenience functions to determine selection status
00730     virtual bool IsCurrentMenuSelected() = 0;  // current menu is selected
00735     virtual bool IsCurrentItemSelected() = 0;  // current menu and item are selected
00736 
00737     // convenience function to select current menu item
00740     virtual void SelectCurrentItem() = 0;
00741 };
00742 
00743 
00744 // -----------------------------------------------------------------------------
00745 // -----------------------------------------------------------------------------
00746 
00753 class IMenuLocalContext: public MaxHeapOperators
00754 
00755 //  PURPOSE:
00756 //    Abstract class (Interface) for context local to a specific menu
00757 //
00758 //  NOTES:
00759 //    created:  02.17.00 - mjm
00760 //
00761 // -----------------------------------------------------------------------------
00762 // -----------------------------------------------------------------------------
00763 
00764 {
00765 public:
00767     virtual ~IMenuLocalContext() {;}
00768     // sets and gets the handle to the drawing device context
00774     virtual void SetHDrawDC(HDC hDrawDC) = 0;
00777     virtual HDC GetHDrawDC() const = 0;
00778 
00779     // sets and gets the cursor position in the local coordinates
00786     virtual void SetLocalCursorPosition(const IPoint2& localCursorPos) = 0;
00790     virtual const IPoint2& GetLocalCursorPosition() const = 0;
00791 
00792     // sets and gets the menu's current width
00798     virtual void SetMenuItemWidth(int menuWidth) = 0;
00801     virtual int GetMenuItemWidth() const = 0;
00802 
00803     // sets and gets the menu's current level (submenus have level > 0)
00810     virtual void SetLevel(int level) = 0;
00813     virtual int GetLevel() const = 0;
00814 
00815     // sets and gets the menu's last executed item path (a tab of IMenuItems, listing the selected item at each menu level)
00823     virtual void SetLastExecutedItemPath(Tab<IMenuItem *> *pExecutedItemPath) = 0;
00828     virtual Tab<IMenuItem *> *GetLastExecutedItemPath() = 0;
00829 
00830     // sets and gets the menu's current colors
00836     virtual void SetMenuColors(const MenuColors *pMenuColors) = 0;
00839     virtual const MenuColors *GetMenuColors() const = 0;
00840 
00841     // sets and gets the global menu context
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 //  PURPOSE:
00875 //    Abstract class (Interface) for quad menu settings
00876 //
00877 //  NOTES:
00878 //    created:  02.17.00 - mjm
00879 //
00880 // -----------------------------------------------------------------------------
00881 // -----------------------------------------------------------------------------
00882 
00883 {
00884 public:
00885 // function IDs 
00886     enum
00887     {
00888         // from IMenuSettings
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         // from IQuadMenuSettings
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     // sets and gets the first quadrant displayed
00971     virtual void SetFirstQuadDisplayed(QuadIndex firstQuadDisplayed) = 0;
00976     virtual QuadIndex GetFirstQuadDisplayed() const = 0;
00977 
00978     // sets and gets whether the quadrants have uniform width
00984     virtual void SetUseUniformQuadWidth(bool useUniformQuadWidth) = 0;
00988     virtual bool GetUseUniformQuadWidth() const = 0;
00989     // these overrides are provided for the function publishing system
00996     virtual void SetUseUniformQuadWidthBOOL(BOOL useUniformQuadWidth) = 0;
01001     virtual BOOL GetUseUniformQuadWidthBOOL() const = 0;
01002 
01003     // sets and gets whether the quad menus are mirrored (left - right)
01009     virtual void SetMirrorQuad(bool mirrorQuad) = 0;
01012     virtual bool GetMirrorQuad() const = 0;
01013     // these overrides are provided for the function publishing system
01020     virtual void SetMirrorQuadBOOL(BOOL mirrorQuad) = 0;
01024     virtual BOOL GetMirrorQuadBOOL() const = 0;
01025 
01026     // sets and gets whether the cursor moves when the quad menu is repositioned because of clipping the edge of the screen
01032     virtual void SetMoveCursorOnReposition(bool moveCursorOnReposition) = 0;
01036     virtual bool GetMoveCursorOnReposition() const = 0;
01037     // these overrides are provided for the function publishing system
01045     virtual void SetMoveCursorOnRepositionBOOL(BOOL moveCursorOnReposition) = 0;
01050     virtual BOOL GetMoveCursorOnRepositionBOOL() const = 0;
01051 
01052     // sets and gets whether the cursor is moved the opposite distance that it was automatically moved when the quad menu is repositioned because of clipping the edge of the screen
01059     virtual void SetReturnCursorAfterReposition(bool returnCursorAfterReposition) = 0;
01063     virtual bool GetReturnCursorAfterReposition() const = 0;
01064     // these overrides are provided for the function publishing system
01073     virtual void SetReturnCursorAfterRepositionBOOL(BOOL returnCursorAfterReposition) = 0;
01079     virtual BOOL GetReturnCursorAfterRepositionBOOL() const = 0;
01080 
01081     // sets and gets the initial location of the cursor in the center box - as a ratio (0 to 1) of box size
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     // gets the color array for a specific quad (numbered 1 through 4)
01102     virtual const MenuColors *GetMenuColors(int quadNum) const = 0;
01103 
01104     // sets and gets the title bar background color for a specific quad (numbered 1 through 4)
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     // sets and gets the title bar text color for a specific quad (numbered 1 through 4)
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     // sets and gets the item background color for a specific quad (numbered 1 through 4)
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     // sets and gets the item text color for a specific quad (numbered 1 through 4)
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     // sets and gets the last executed item text color for a specific quad (numbered 1 through 4)
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     // sets and gets the highlighted item background color for a specific quad (numbered 1 through 4)
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     // sets and gets the highlighted item text color for a specific quad (numbered 1 through 4)
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     // sets and gets the border color for a specific quad (numbered 1 through 4)
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     // sets and gets the disabled shadow color for a specific quad (numbered 1 through 4)
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     // sets and gets the disabled highlight color for a specific quad (numbered 1 through 4)
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     // save and load .qmo quad menu option files
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 //  PURPOSE:
01348 //    Abstract class (Interface) for any menu element
01349 //
01350 //  NOTES:
01351 //    created:  02.17.00 - mjm
01352 //
01353 // -----------------------------------------------------------------------------
01354 // -----------------------------------------------------------------------------
01355 
01356 {
01357 public:
01358     // location indicates origin location relative to element rectangle
01359     enum OriginLocation { UPPER_LEFT, LOWER_LEFT, LOWER_RIGHT, UPPER_RIGHT };
01361     virtual ~IMenuElement() {;}
01362     // sets and gets the element's origin, and origin location
01371     virtual void SetOrigin(const IPoint2& origin, OriginLocation location) = 0;
01374     virtual const IPoint2& GetOrigin() const = 0;
01375 
01376     // sets and gets the item's visibility
01381     virtual void SetVisible(bool visible) = 0;
01384     virtual bool GetVisible() = 0;
01385 
01386     // sets and gets the item's title
01391     virtual void SetTitle(const MCHAR *customTitle) = 0;
01393     virtual const MSTR& GetTitle() = 0;
01394 
01395     // sets and gets the enabled state of the element
01400     virtual void SetEnabled(bool enabled) = 0;
01403     virtual bool GetEnabled() = 0;
01404 
01405     // gets the element's size, in the menu's coordinate space
01408     virtual const IPoint2& GetSize() = 0;
01409 
01410     // gets the element's rectangle, in the menu's coordinate space
01414     virtual const Box2& GetRect() = 0;
01415 
01416     // determines if point is in element's rectangle
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 //  PURPOSE:
01441 //    Abstract class (Interface) for a menu item
01442 //
01443 //  NOTES:
01444 //    created:  02.17.00 - mjm
01445 //
01446 // -----------------------------------------------------------------------------
01447 // -----------------------------------------------------------------------------
01448 
01449 {
01450 public:
01451     typedef int IMenuItemIcon;
01452 
01453     // function prototype - to be called when item is selected
01454     typedef void (* ActionFn)(void);
01455     // function prototype - to be called before item is displayed
01456     typedef void (* PreDisplayCB)(IMenuItem& menuItem);
01457 
01458     // action mode - item selection instigates action item, calls function, or displays a submenu
01459     // these values are saved/loaded by the menu customization system. you may append new values,
01460     // but cannot change any existing values.
01461     enum ActionMode { AM_INACTIVE = 0,
01462                       AM_SEPARATOR,
01463                       AM_ITEM,
01464                       AM_FN,
01465                       AM_SUBMENU,
01466                       AM_ITEM_SUBMENU };
01467 
01468     // sets a new context for the menu, invalidating the menu's cache
01475     virtual void SetIMenuLocalContext(IMenuLocalContext* pIMenuLocalContext) = 0;
01476 
01477     // gets the current action mode
01483     virtual ActionMode GetActionMode() const = 0;
01484 
01485     // executes the current action
01488     virtual bool ExecuteAction() const = 0;
01489 
01490     // makes the item act as an item separator
01493     virtual void ActAsSeparator() = 0;
01494     // checks if the item is acting as an item separator
01497     virtual bool IsSeparator() const = 0;
01498 
01499     // sets and gets the current action item. GetActionItem returns NULL if the ActionMode is not AM_ITEM
01506     virtual void SetActionItem(ActionItem* pActionItem) = 0;
01509     virtual ActionItem* GetActionItem() const = 0;
01510 
01511     // sets and gets the current action function. GetActionFn returns NULL if the ActionMode is not AM_FN
01519     virtual void SetActionFn(ActionFn actionFn) = 0;
01523     virtual const ActionFn GetActionFn() const = 0;
01524 
01525     // sets and gets the submenu. GetSubMenu returns NULL if the ActionMode is not AM_SUBMENU
01532     virtual void SetSubMenu(IMenu* menu) = 0;
01535     virtual IMenu* GetSubMenu() = 0;
01536 
01537     // sets and gets the current pre-display callback
01543     virtual void SetPreDisplayCB(PreDisplayCB preDisplayCB) = 0;
01545     virtual const PreDisplayCB GetPreDisplayCB() const = 0;
01546 
01547     // displays the item
01549     virtual void Display(bool leftToRight) = 0;
01550 
01551     // gets the item's accelerator, returns 0 if none
01554     virtual MCHAR GetAccelerator() = 0;
01555 
01556     // sets and gets the item's icon
01561     virtual void SetIcon(MaxIcon* pMaxIcon) = 0;
01563     virtual const MaxIcon* GetIcon() const = 0;
01564 
01565     // sets and gets the item's checked state
01570     virtual void SetChecked(bool checked) = 0;
01573     virtual bool GetChecked() = 0;
01574 
01575     // sets and gets the item's highlighted state
01582     virtual void SetHighlighted(bool highlighted) = 0;
01585     virtual bool GetHighlighted() const = 0;
01586 
01587     // sets and gets if the item should use a custom title -- set via SetTitle()
01593     virtual void SetUseCustomTitle(bool useCustomTitle) = 0;
01596     virtual bool GetUseCustomTitle() const = 0;
01597 
01598     // sets and gets if the submenu-item should be displayed flat
01604     virtual void SetDisplayFlat(bool displayFlat) = 0;
01607     virtual bool GetDisplayFlat() const = 0;
01608 
01609     // called after a user/menu interaction
01613     virtual void PostMenuInteraction() = 0;
01614 
01615     // Function publishing function ids.
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     // sets a new context for the menu, invalidating the menu's cache
01647     virtual void SetIMenuGlobalContext(IMenuGlobalContext* pIMenuGlobalContext, int level, Tab<IMenuItem *> *pExecutedItemPath, const MenuColors *pMenuColors) = 0;
01648 
01649     // gets the menu's local context
01652     virtual IMenuLocalContext* GetIMenuLocalContext() = 0;
01653 
01654     // returns number of contained items
01656     virtual int NumItems() const = 0;
01657 
01658     // retrieves an item from the menu
01663     virtual IMenuItem* GetItem(int position) = 0;
01664 
01665     // adds an item into the menu, defaulting to the end position.
01666     // position 0 indicates beginnng of list. a negative or otherwise invalid position defaults to end of list.
01675     virtual void AddItem(IMenuItem* item, int position = -1) = 0;
01676 
01677     // if valid position, removes item at position in menu
01683     virtual void RemoveItem(int position) = 0;
01684 
01685     // if present, removes an item from the menu
01691     virtual void RemoveItem(IMenuItem* item) = 0;
01692 
01693     // returns the maximum size of all items in menu
01696     virtual IPoint2 GetMaxItemSize() = 0;
01697 
01698     // called before menu is first displayed during a user/menu interaction
01702     virtual void Initialize() = 0;
01703 
01704     // called after a user/menu interaction
01707     virtual void PostMenuInteraction() = 0;
01708 
01709     // handles an event occuring within the menu
01717     virtual bool HandleEvent(MenuEvent &event) = 0;
01718 
01719     // shows the menu with the given show type
01722     virtual void Show(DisplayMethod displayMethod = DM_NORMAL, Box2 *rect = NULL) = 0;
01723 
01724     // hides the menu with the given show type
01727     virtual void Hide(DisplayMethod displayMethod = DM_NORMAL) = 0;
01728 
01735     virtual IMenuItem* FindAccelItem(MCHAR accelerator) = 0;
01738     virtual IMenuItem* FindNewSelectedItem() = 0;
01739 
01740     // displays the menu
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     // removes the menu from the display
01754     virtual void Undisplay() = 0;
01755 
01756     // determines if menu is displaying a submenu
01759     virtual bool IsDisplayingSubMenu() = 0;
01760 
01761     // notifies menu that timer has elapsed
01764     virtual void TimerElapsed(EventParam timingType) = 0;
01765 
01766     // sets/gets whether to show the title
01772     virtual void SetShowTitle(bool showTitle) = 0;
01775     virtual bool GetShowTitle() const = 0;
01776 
01777     // sets and gets the custom title
01782     virtual void SetCustomTitle(const MCHAR *customTitle) = 0;
01784     virtual const MSTR& GetCustomTitle() const = 0;
01785 
01786     // sets and gets if the item should use a custom title -- set via SetCustomTitle()
01791     virtual void SetUseCustomTitle(bool useCustomTitle) = 0;
01794     virtual bool GetUseCustomTitle() const = 0;
01795 
01796     // sets/gets whether to show the title
01803     virtual void SetUseGlobalWidths(bool useGlobalWidths) = 0;
01807     virtual bool GetUseGlobalWidths() const = 0;
01808 
01809     // return true if the menu has no visible items in it.
01812     virtual bool NoVisibleItems() = 0;
01813 
01814     // Function publishing function ids.
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     // sets and gets the menu
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     // returns number of contained menus allowed, -1 indicates infinite
01872     virtual int NumMenusAllowed() const = 0;
01873 
01874     // returns number of contained menus
01876     virtual int NumMenus() const = 0;
01877 
01878     // retrieves a menu from the multi-menu
01884     virtual IMenu* GetMenu(int position) = 0;
01885 
01886     // adds a menu into the container, defaulting to the end position.
01887     // position of -1 means end of list, 0 means beginning.
01896     virtual void AddMenu(IMenu* menu, int pos = -1) = 0;
01897 
01898     // if valid position, removes menu at position in menu
01904     virtual void RemoveMenu(int position) = 0;
01905 
01906     // if present, removes a menu from the quad menu
01912     virtual void RemoveMenu(IMenu* menu) = 0;
01913 
01914     // sets and gets the title for the menu position indicated. used when SetUseCustomTitle(true) has been called
01922     virtual void SetTitle(const MCHAR *customTitle, int pos) = 0; // TODO: use 'customtitle' in item as well
01925     virtual const MSTR& GetTitle(int pos) = 0;
01926 
01927     // sets and gets if the menu at indicated position should use a custom title -- set via SetTitle()
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     // Function publishing function ids.
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