Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef EV_WIN32MENU_H
00021 #define EV_WIN32MENU_H
00022
00023 #include <windows.h>
00024 #include "ut_types.h"
00025 #include "xap_Types.h"
00026 #include "ev_Menu.h"
00027 #include "ut_color.h"
00028 #include "ut_misc.h"
00029 #include <vector>
00030
00031
00032 class AV_View;
00033 class XAP_Win32App;
00034 class EV_EditEventMapper;
00035 class XAP_Frame;
00036
00037
00038
00039 typedef struct
00040 {
00041 XAP_Menu_Id id;
00042 char szName[255];
00043 } EV_Menu_Bitmap;
00044
00045
00046 class ABI_EXPORT EV_Win32Menu : public EV_Menu
00047 {
00048 public:
00049 EV_Win32Menu(XAP_Win32App * pWin32App,
00050 const EV_EditEventMapper * pEEM,
00051 const char * szMenuLayoutName,
00052 const char * szMenuLabelSetName);
00053 ~EV_Win32Menu();
00054
00055 void destroy();
00056
00057 bool synthesizeMenu(XAP_Frame * pFrame, HMENU menuRoot);
00058 bool onCommand(AV_View * pView, HWND hWnd, WPARAM wParam);
00059 bool onInitMenu(XAP_Frame * pFrame, AV_View * pView, HWND hWnd, HMENU hMenuBar);
00060 bool onMenuSelect(XAP_Frame * pFrame, AV_View * pView,
00061 HWND hWnd, HMENU hMenu, WPARAM wParam);
00062
00063 HMENU getMenuHandle() const { return m_myMenu; }
00064 XAP_Menu_Id MenuIdFromWmCommand(UINT cmd) { return (XAP_Menu_Id)(cmd - WM_USER); }
00065 UINT WmCommandFromMenuId(XAP_Menu_Id id) { return (id + WM_USER); }
00066
00067 virtual bool _doAddMenuItem(UT_uint32 ) { UT_ASSERT_HARMLESS(UT_TODO); return false; }
00068 void onDrawItem(HWND hwnd, WPARAM wParam, LPARAM lParam);
00069 void onMeasureItem(HWND hwnd, WPARAM wParam, LPARAM lParam);
00070 LPARAM onMenuChar(HWND hwnd, WPARAM wParam, LPARAM lParam);
00071 void setTrackMenu(bool bTrack){m_bTrack=bTrack;};
00072
00073 protected:
00074
00075 static bool _isAMenuBar(XAP_Menu_Id id,HMENU hMenu);
00076 static HBITMAP _loadBitmap(XAP_Menu_Id id, int width, int height, const UT_RGBColor & color);
00077 void _setBitmapforID(HMENU hMenu, XAP_Menu_Id id, UINT cmd);
00078
00079 XAP_Win32App * m_pWin32App;
00080 const EV_EditEventMapper * m_pEEM;
00081 EV_Menu_Bitmap* m_pArMenuBitmaps;
00082 HMENU m_myMenu;
00083 UINT m_nBitmapCX, m_nBitmapCY;
00084 HFONT m_hFont;
00085 UT_Vector m_vecItems;
00086 bool m_bTrack;
00087 UINT m_iDIR;
00088 std::vector <HBITMAP> m_vechBitmaps;
00089
00090 };
00091
00092
00093 typedef struct
00094 {
00095 XAP_Menu_Id id;
00096 wchar_t szText[256];
00097 EV_Win32Menu* pMenu;
00098 } EV_Menu_Item;
00099
00100
00101
00102 class ABI_EXPORT EV_Win32MenuBar : public EV_Win32Menu
00103 {
00104 public:
00105 EV_Win32MenuBar(XAP_Win32App * pWin32App,
00106 const EV_EditEventMapper * pEEM,
00107 const char * szMenuLayoutName,
00108 const char * szMenuLabelSetName);
00109 ~EV_Win32MenuBar();
00110
00111 bool synthesizeMenuBar(XAP_Frame * pFrame);
00112 };
00113
00114
00115
00116 class ABI_EXPORT EV_Win32MenuPopup : public EV_Win32Menu
00117 {
00118 public:
00119 EV_Win32MenuPopup(XAP_Win32App * pWin32App,
00120 const char * szMenuLayoutName,
00121 const char * szMenuLabelSetName);
00122 ~EV_Win32MenuPopup();
00123
00124 bool synthesizeMenuPopup(XAP_Frame * pFrame);
00125 };
00126
00127 #endif