1 /* -*- mode: C++; tab-width: 4; c-basic-offset: 4; -*- */ 2 3 /* AbiSource Program Utilities 4 * Copyright (C) 1998 AbiSource, Inc. 5 * Copyright (C) 2001-2003 Hubert Figuiere 6 * 7 * This program is free software; you can redistribute it and/or 8 * modify it under the terms of the GNU General Public License 9 * as published by the Free Software Foundation; either version 2 10 * of the License, or (at your option) any later version. 11 * 12 * This program is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with this program; if not, write to the Free Software 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 20 * 02110-1301 USA. 21 */ 22 23 #ifndef EV_COCOATOOLBAR_H 24 #define EV_COCOATOOLBAR_H 25 26 #include "ut_types.h" 27 #include "xap_Types.h" 28 #include "ev_Toolbar.h" 29 #include "xav_Listener.h" 30 #include "ap_Toolbar_Id.h" 31 #include "ap_CocoaToolbar_StyleCombo.h" 32 33 #import <Cocoa/Cocoa.h> 34 35 class AP_CocoaFrame; 36 class XAP_CocoaToolbar_Icons; 37 class EV_CocoaToolbar_ViewListener; 38 class EV_Toolbar_Label; 39 40 class EV_CocoaToolbar; 41 @class EV_CocoaToolbarTarget; 42 43 44 class EV_CocoaToolbar : public EV_Toolbar 45 { 46 public: 47 EV_CocoaToolbar(AP_CocoaFrame * pCocoaFrame, 48 const char * szToolbarLayoutName, 49 const char * szToolbarLabelSetName); 50 51 virtual ~EV_CocoaToolbar(void); 52 53 bool toolbarEvent(XAP_Toolbar_Id tlbrid, const UT_UCSChar * pData, UT_uint32 dataLength); 54 virtual bool synthesize(void); 55 bool bindListenerToView(AV_View * pView); 56 virtual bool refreshToolbar(AV_View * pView, AV_ChangeMask mask); 57 virtual bool repopulateStyles(void); 58 UT_sint32 destroy(void); 59 void rebuildToolbar(UT_sint32 oldpos); 60 AP_CocoaFrame * getFrame(void); 61 virtual void show(void); 62 virtual void hide(void); 63 getButtonWidth(void)64 static float getButtonWidth (void) 65 { return 28.0f; }; getButtonHeight(void)66 static float getButtonHeight (void) 67 { return 28.0f; }; 68 getToolbarHeight(void)69 static float getToolbarHeight(void) 70 { return getButtonHeight(); }; 71 _getToolbarView(void)72 NSView* _getToolbarView(void) const 73 { return m_wToolbar; }; 74 protected: 75 void _releaseListener(void); 76 77 AP_CocoaFrame * m_pCocoaFrame; 78 EV_CocoaToolbar_ViewListener * m_pViewListener; 79 AV_ListenerId m_lid; /* view listener id */ 80 81 NSView * m_wToolbar; 82 NSView * m_superView; 83 XAP_CocoaToolbar_Icons * m_pCocoaToolbarIcons; 84 private: 85 NSButton * _makeToolbarButton (int type, EV_Toolbar_Label * pLabel, 86 XAP_Toolbar_Id tlbrid, NSView *parent, 87 float & btnX); 88 EV_CocoaToolbarTarget * m_target; 89 }; 90 91 #endif /* EV_COCOATOOLBAR_H */ 92 93 94 95 96 97 98 99 100 101