• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

ev_Win32Menu.h

Go to the documentation of this file.
00001 /* AbiSource Program Utilities
00002  * Copyright (C) 1998 AbiSource, Inc.
00003  *
00004  * This program is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU General Public License
00006  * as published by the Free Software Foundation; either version 2
00007  * of the License, or (at your option) any later version.
00008  *
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software
00016  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
00017  * 02110-1301 USA.
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 //#include "ap_Win32FrameImpl.h"
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;                 // Menu ID
00042     char            szName[255];        // BitmapName
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 /*id*/) { UT_ASSERT_HARMLESS(UT_TODO); return false;/* TODO */ }
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;                 // Menu ID
00096     wchar_t         szText[256];        // Text
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 /* EV_WIN32MENU_H */

Generated on Sun Feb 14 2021 for AbiWord by  doxygen 1.7.1