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_MENU_ACTIONS_H
00021 #define EV_MENU_ACTIONS_H
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041 #include "ut_types.h"
00042 #include "xap_Types.h"
00043 #include "ut_vector.h"
00044 #include "ut_string_class.h"
00045
00046 class XAP_App;
00047 class XAP_Frame;
00048 class AV_View;
00049 class EV_Menu_Label;
00050
00051
00052
00053
00054
00055 typedef enum _ev_Menu_ItemState
00056 {
00057 EV_MIS_ZERO = 0x00,
00058 EV_MIS_Gray = 0x01,
00059 EV_MIS_Toggled = 0x02,
00060 EV_MIS_Bold = 0x04
00061
00062 } EV_Menu_ItemState;
00063
00064 typedef EV_Menu_ItemState ( EV_GetMenuItemState_Fn )(AV_View * pView, XAP_Menu_Id id);
00065 typedef EV_Menu_ItemState (*EV_GetMenuItemState_pFn)(AV_View * pView, XAP_Menu_Id id);
00066 #ifdef ABI_DLL
00067 #define Defun_EV_GetMenuItemState_Fn(fn) EV_Menu_ItemState fn(AV_View * pAV_View, XAP_Menu_Id id)
00068 #else
00069 #define Defun_EV_GetMenuItemState_Fn(fn) ABI_EXPORT EV_Menu_ItemState fn(AV_View * pAV_View, XAP_Menu_Id id)
00070 #endif
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080 typedef const char * ( EV_GetMenuItemComputedLabel_Fn )(const EV_Menu_Label * pLabel, XAP_Menu_Id id);
00081 typedef const char * (*EV_GetMenuItemComputedLabel_pFn)(const EV_Menu_Label * pLabel, XAP_Menu_Id id);
00082 #ifdef ABI_DLL
00083 #define Defun_EV_GetMenuItemComputedLabel_Fn(fn) const char * fn(const EV_Menu_Label * pLabel, XAP_Menu_Id id)
00084 #else
00085 #define Defun_EV_GetMenuItemComputedLabel_Fn(fn) ABI_EXPORT const char * fn(const EV_Menu_Label * pLabel, XAP_Menu_Id id)
00086 #endif
00087
00088
00089
00090 class ABI_EXPORT EV_Menu_Action
00091 {
00092 public:
00093 EV_Menu_Action(XAP_Menu_Id id,
00094 bool bHoldsSubMenu,
00095 bool bRaisesDialog,
00096 bool bCheckable,
00097 bool bRadio,
00098 const char* szMethodName,
00099 EV_GetMenuItemState_pFn pfnGetState,
00100 EV_GetMenuItemComputedLabel_pFn pfnGetLabel,
00101 const UT_String& stScriptName = "");
00102 ~EV_Menu_Action();
00103
00104 XAP_Menu_Id getMenuId() const;
00105 void incrementId(void);
00106 bool hasDynamicLabel() const;
00107 const char* getDynamicLabel(const EV_Menu_Label * pLabel) const;
00108 const char* getMethodName() const;
00109 const UT_String& getScriptName() const { return m_stScriptName; }
00110 bool hasGetStateFunction() const;
00111 EV_Menu_ItemState getMenuItemState(AV_View * pView) const;
00112 bool raisesDialog() const;
00113 bool isCheckable() const;
00114 bool isRadio () const;
00115
00116 private:
00117 XAP_Menu_Id m_id;
00118 bool m_bHoldsSubMenu;
00119 bool m_bRaisesDialog;
00120 bool m_bCheckable;
00121 bool m_bRadio;
00122 char * m_szMethodName;
00123 EV_GetMenuItemState_pFn m_pfnGetState;
00124 EV_GetMenuItemComputedLabel_pFn m_pfnGetLabel;
00125 UT_String m_stScriptName;
00126 };
00127
00128
00129
00130 class ABI_EXPORT EV_Menu_ActionSet
00131 {
00132 public:
00133 EV_Menu_ActionSet(XAP_Menu_Id first, XAP_Menu_Id last);
00134 ~EV_Menu_ActionSet();
00135
00136 bool setAction(XAP_Menu_Id id,
00137 bool bHoldsSubMenu,
00138 bool bRaisesDialog,
00139 bool bCheckable,
00140 bool bRadio,
00141 const char * szMethodName,
00142 EV_GetMenuItemState_pFn pfnGetState,
00143 EV_GetMenuItemComputedLabel_pFn pfnGetLabel,
00144 const UT_String& stScriptName = "");
00145 bool addAction(EV_Menu_Action *pAction);
00146
00147 const EV_Menu_Action * getAction(XAP_Menu_Id id) const;
00148
00149 private:
00150 UT_GenericVector<EV_Menu_Action *> m_actionTable;
00151 XAP_Menu_Id m_first;
00152 };
00153
00154 #endif