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

ev_Win32Toolbar.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_WIN32TOOLBAR_H
00021 #define EV_WIN32TOOLBAR_H
00022 
00023 #include <windows.h>
00024 
00025 #include "ut_types.h"
00026 #include "ut_vector.h"
00027 #include "xap_Types.h"
00028 #include "ev_Toolbar.h"
00029 #include "xav_Listener.h"
00030 #include "ap_Toolbar_Id.h"
00031 #include "ap_Win32Toolbar_StyleCombo.h"
00032 #include "ap_Win32Toolbar_FontCombo.h"
00033 #include "ut_string_class.h"
00034 
00035 
00036 class XAP_Win32App;
00037 class XAP_Frame;
00038 class EV_Win32Toolbar_ViewListener;
00039 class EV_Toolbar_Action;
00040 
00041 // HACK: it'd be nice to guarantee that menu and toolbar IDs don't overlap
00042 #ifdef AP_MENU_ID__BOGUS2__
00043 #define _ev_MENU_OFFSET     AP_MENU_ID__BOGUS2__
00044 #else
00045 #define _ev_MENU_OFFSET     1000
00046 #endif
00047 
00048 class ABI_EXPORT EV_Win32Toolbar : public EV_Toolbar
00049 {
00050 public:
00051     EV_Win32Toolbar(XAP_Win32App * pWin32App, XAP_Frame * pFrame,
00052                    const char * szToolbarLayoutName,
00053                    const char * szToolbarLabelSetName);
00054 
00055     virtual ~EV_Win32Toolbar(void);
00056 
00057     bool toolbarEvent(XAP_Toolbar_Id id,
00058                          UT_UCSChar * pData = 0,
00059                          UT_uint32 dataLength = 0);
00060     virtual bool synthesize(void);
00061     bool bindListenerToView(AV_View * pView);
00062     virtual bool refreshToolbar(AV_View * pView, AV_ChangeMask mask);
00063     virtual bool repopulateStyles(void);
00064     bool getToolTip(LPARAM lParam);
00065 
00066     HWND getWindow(void) const;
00067 
00068     XAP_Frame * getFrame(void);
00069 
00070     void    onDropArrow(UINT cmd);
00071 
00072     /*
00073         Note that the namespaces for toolbar and menu command ids
00074         do *not* overlap.
00075     */
00076     inline XAP_Toolbar_Id   ItemIdFromWmCommand(UINT cmd)           { return (XAP_Toolbar_Id)(cmd - WM_USER - _ev_MENU_OFFSET); };
00077     inline UINT             WmCommandFromItemId(XAP_Toolbar_Id id)  { return (id + WM_USER + _ev_MENU_OFFSET); };
00078     inline bool             bVisible( void ) { return m_bVisible; }
00079 
00080 protected:
00081     virtual void                    show(void);
00082     virtual void                    hide(void);
00083 
00084     void                            _releaseListener(void);
00085     HWND                            _getControlWindow(XAP_Toolbar_Id id);
00086 
00087     bool                            _refreshID(XAP_Toolbar_Id id);
00088     bool                            _refreshItem(AV_View * pView,
00089                                                  const EV_Toolbar_Action * pAction,
00090                                                  XAP_Toolbar_Id id);
00091 
00092 private:
00093     int                             _getBandForHwnd(HWND hToolbar) const;
00094     void                            _addToRebar();
00095     static LRESULT CALLBACK         _ComboWndProc(HWND, UINT, WPARAM, LPARAM);
00096     static LRESULT CALLBACK         _ComboEditWndProc(HWND, UINT, WPARAM, LPARAM);
00097     static LRESULT CALLBACK         _ToolBarWndProc (HWND hWnd, UINT uMessage, WPARAM wParam, LPARAM lParam);
00098 
00099     XAP_Win32App *                  m_pWin32App;
00100     XAP_Frame *                     m_pWin32Frame;
00101     EV_Win32Toolbar_ViewListener *  m_pViewListener;
00102     AV_ListenerId                   m_lid;  /* view listener id */
00103 
00104     HWND                            m_hwnd;
00105     UT_Vector                       m_vecToolbarWidgets;
00106     AP_Win32Toolbar_FontCombo*      m_pFontCtrl;
00107     bool                            m_bVisible;
00108     UT_GenericVector<UT_UTF8String *>   m_vecOrgStylesNames;
00109 
00110 };
00111 
00112 #endif /* EV_WIN32TOOLBAR_H */

Generated on Sun Feb 14 2021 for AbiWord by  doxygen 1.7.1