00001
00015 #ifndef _XPOPUPMENU_H_
00016 #define _XPOPUPMENU_H_
00017
00018 #include "../defines.h"
00019 #include "xpopupmenuitem.h"
00020
00021 #define XPS_ICON3D 0x01
00022 #define XPS_DISABLEDSEL 0x02
00023 #define XPS_ICON3DSHADOW 0x04
00024
00025
00031 typedef struct tagXPMENUCOLORS {
00032
00033 COLORREF m_clrBack;
00034 COLORREF m_clrBox;
00035 COLORREF m_clrSelection;
00036 COLORREF m_clrDisabledSelection;
00037 COLORREF m_clrText;
00038 COLORREF m_clrDisabledText;
00039 COLORREF m_clrCheckBox;
00040 COLORREF m_clrDisabledCheckBox;
00041 COLORREF m_clrSeparatorLine;
00042 COLORREF m_clrSelectionBorder;
00043
00044 } XPMENUCOLORS, * LPXPMENUCOLORS;
00045
00052 class XPopupMenu {
00053
00054 public:
00055
00061 enum MenuStyle {
00062
00063 XPMS_OFFICE2003,
00064 XPMS_OFFICE2003_REV,
00065 XPMS_OFFICEXP,
00066 XPMS_ICY,
00067 XPMS_ICY_REV,
00068 XPMS_GRADE,
00069 XPMS_GRADE_REV,
00070 XPMS_NORMAL,
00071 XPMS_CUSTOM
00072 };
00073
00074 XPopupMenu( HMENU hMenu );
00075 XPopupMenu( TString & tsMenuName, MenuStyle mStyle );
00076 virtual ~XPopupMenu( );
00077
00078 void parseXPopCommand( TString & input );
00079 void parseXPopIdentifier( TString & input, char * szReturnValue );
00080
00081 HMENU parsePath( TString & path, HMENU hParent, int depth = 1 );
00082
00083 HIMAGELIST getImageList( );
00084 void destroyImageList( );
00085
00086 MenuStyle getStyle( );
00087 void setStyle( MenuStyle style );
00088 UINT getItemStyle( );
00089 void setItemStyle( UINT iExStyles );
00090
00091 void deleteMenuItemData( XPopupMenuItem * p_Item );
00092 void deleteAllItemData( HMENU hMenu );
00093
00094 TString getName( );
00095
00096 HMENU getMenuHandle( ) { return this->m_hMenu; };
00097
00098 LPXPMENUCOLORS getColors( );
00099 void setColor( int nColor, COLORREF clrColor );
00100 COLORREF getColor( int nColor );
00101
00102 static LRESULT CALLBACK XPopupMenuProc( HWND mHwnd, UINT uMsg, WPARAM wParam, LPARAM lParam );
00103 static LRESULT CALLBACK XPopupWinProc( HWND mHwnd, UINT uMsg, WPARAM wParam, LPARAM lParam );
00104
00105 static LRESULT OnMeasureItem( HWND mHwnd, LPMEASUREITEMSTRUCT lpmis );
00106 static LRESULT OnDrawItem( HWND mHwnd, LPDRAWITEMSTRUCT lpdis );
00107
00108 void convertMenu( HMENU hMenu, BOOL bForce );
00109 void cleanMenu( HMENU hMenu );
00110 void clearAllMenuItems( );
00111
00112 HBITMAP getBackBitmap( );
00113 void setBackBitmap( HBITMAP hBitmap );
00114
00115 protected:
00116
00117 HMENU m_hMenu;
00118 HIMAGELIST m_hImageList;
00119 MenuStyle m_MenuStyle;
00120 TString m_tsMenuName;
00121 VectorOfXPopupMenuItem m_vpMenuItem;
00122 UINT m_MenuItemStyles;
00123
00124 HBITMAP m_hBitmap;
00125
00126 XPMENUCOLORS m_MenuColors;
00127
00128 void parseSwitchFlags( TString * switchs, XSwitchFlags * flags );
00129 };
00130
00131 typedef std::vector<XPopupMenu *> VectorOfXPopupMenu;
00132
00133 #endif // _XPOPUPMENU_H_