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

ev_Toolbar_Actions.h

Go to the documentation of this file.
00001 /* -*- mode: C++; tab-width: 4; c-basic-offset: 4; -*- */
00002 
00003 /* AbiSource Program Utilities
00004  * Copyright (C) 1998 AbiSource, Inc.
00005  *
00006  * This program is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU General Public License
00008  * as published by the Free Software Foundation; either version 2
00009  * of the License, or (at your option) any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software
00018  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
00019  * 02110-1301 USA.
00020  */
00021 
00022 #ifndef EV_TOOLBAR_ACTIONS_H
00023 #define EV_TOOLBAR_ACTIONS_H
00024 
00025 /****************************************************************
00026 *****************************************************************
00027 ** This file defines a framework for the set of actions which
00028 ** may be bound to a Toolbar Id.  This binding is independent of
00029 ** the actual toolbar containing the item and actual toolbar layout.
00030 **
00031 ** We create one EV_Toolbar_Action per toolbar-item per application.
00032 **
00033 ** We create one EV_Toolbar_ActionSet per application.
00034 **
00035 *****************************************************************
00036 ****************************************************************/
00037 
00038 #include "ut_types.h"
00039 #include "xap_Types.h"
00040 #include "xav_Listener.h"
00041 
00042 class XAP_App;
00043 class AV_View;
00044 class EV_Toolbar_Label;
00045 
00046 
00047 /*****************************************************************/
00048 
00049 typedef enum _ev_Toolbar_ItemState          /* values may be ORed */
00050 {
00051     EV_TIS_ZERO             = 0x00,
00052     EV_TIS_Gray             = 0x01,         /* should be grayed */
00053     EV_TIS_Toggled          = 0x02,         /* should be pressed down */
00054     EV_TIS_UseString        = 0x04,         /* should reference pszState */
00055     EV_TIS_Hidden           = 0x08          /* stronger version of Gray, you want to hide if possible */
00056 
00057 } EV_Toolbar_ItemState;
00058 
00059 typedef EV_Toolbar_ItemState ( EV_GetToolbarItemState_Fn )(AV_View * pAV_View, XAP_Toolbar_Id id, const char ** pszState);
00060 typedef EV_Toolbar_ItemState (*EV_GetToolbarItemState_pFn)(AV_View * pAV_View, XAP_Toolbar_Id id, const char ** pszState);
00061 #ifdef ABI_DLL
00062 #define Defun_EV_GetToolbarItemState_Fn(fn) EV_Toolbar_ItemState fn(AV_View * pAV_View, XAP_Toolbar_Id id, const char ** pszState)
00063 #else
00064 #define Defun_EV_GetToolbarItemState_Fn(fn) ABI_EXPORT EV_Toolbar_ItemState fn(AV_View * pAV_View, XAP_Toolbar_Id id, const char ** pszState)
00065 #endif
00066 
00067 #define EV_TIS_ShouldBeGray(tis)        (((tis) & EV_TIS_Gray)!=0)
00068 #define EV_TIS_ShouldBeHidden(tis)      (((tis) & EV_TIS_Hidden)!=0)
00069 #define EV_TIS_ShouldBeToggled(tis)     (((tis) & EV_TIS_Toggled)!=0)
00070 #define EV_TIS_ShouldUseString(tis)     (((tis) & EV_TIS_UseString)!=0)
00071 
00072 /*****************************************************************/
00073 
00074 typedef enum _ev_Toolbar_ItemType
00075 {
00076     EV_TBIT_BOGUS           = 0,
00077     EV_TBIT_PushButton      = 1,    /* simple push to fire */
00078     EV_TBIT_ToggleButton    = 2,    /* push-on/push-off */
00079     EV_TBIT_GroupButton     = 3,    /* like a Toggle, but w/group semantics */
00080     EV_TBIT_EditText        = 4,    /* text entry field */
00081     EV_TBIT_DropDown        = 5,    /* list box w/no text entry */
00082     EV_TBIT_ComboBox        = 6,    /* list box w/ text entry */
00083     EV_TBIT_StaticLabel     = 7,    /* a static control */
00084     EV_TBIT_Spacer          = 8,    /* for extra space between buttons */
00085     EV_TBIT_ColorFore       = 9,    /* control to set the foreground color */
00086     EV_TBIT_ColorBack       = 10,   /* control to set the background color */
00087     EV_TBIT_MenuButton      = 11    /* Button that brings up a menu */
00088 
00089 } EV_Toolbar_ItemType;
00090 
00091 /*****************************************************************/
00092 
00093 class ABI_EXPORT EV_Toolbar_Action
00094 {
00095 public:
00096     EV_Toolbar_Action(XAP_Toolbar_Id id,
00097                       EV_Toolbar_ItemType type,
00098                       const char * szMethodName,
00099                       AV_ChangeMask maskOfInterest,
00100                       EV_GetToolbarItemState_pFn pfnGetState);
00101     ~EV_Toolbar_Action(void);
00102 
00103     XAP_Toolbar_Id                  getToolbarId(void) const;
00104     EV_Toolbar_ItemType             getItemType(void) const;
00105     const char *                    getMethodName(void) const;
00106     AV_ChangeMask                   getChangeMaskOfInterest(void) const;
00107     EV_Toolbar_ItemState            getToolbarItemState(AV_View * pView, const char ** pszState) const;
00108 
00109 protected:
00110     XAP_Toolbar_Id                  m_id;
00111     EV_Toolbar_ItemType             m_type;
00112     char *                          m_szMethodName;     /* name of method to invoke */
00113 
00114     AV_ChangeMask                   m_maskOfInterest;
00115     EV_GetToolbarItemState_pFn      m_pfnGetState;
00116 };
00117 
00118 /*****************************************************************/
00119 
00120 class ABI_EXPORT EV_Toolbar_ActionSet               /* a glorified array with bounds checking */
00121 {
00122 public:
00123     EV_Toolbar_ActionSet(XAP_Toolbar_Id first, XAP_Toolbar_Id last);
00124     ~EV_Toolbar_ActionSet(void);
00125 
00126     bool                setAction(XAP_Toolbar_Id id,
00127                                   EV_Toolbar_ItemType type,
00128                                   const char * szMethodName,
00129                                   AV_ChangeMask maskOfInterest,
00130                                   EV_GetToolbarItemState_pFn pfnGetState);
00131     EV_Toolbar_Action * getAction(XAP_Toolbar_Id id) const;
00132 
00133 protected:
00134     EV_Toolbar_Action **    m_actionTable;
00135     XAP_Toolbar_Id          m_first;
00136     XAP_Toolbar_Id          m_last;
00137 };
00138 
00139 #endif /* EV_TOOLBAR_ACTIONS_H */

Generated on Sun Feb 14 2021 for AbiWord by  doxygen 1.7.1