00001 /* -*- mode: C++; tab-width: 4; c-basic-offset: 4; -*- */ 00002 00003 /* AbiSource Program Utilities 00004 * Copyright (C) 1998 AbiSource, Inc. 00005 * Copyright (C) 2001-2003 Hubert Figuiere 00006 * 00007 * This program is free software; you can redistribute it and/or 00008 * modify it under the terms of the GNU General Public License 00009 * as published by the Free Software Foundation; either version 2 00010 * of the License, or (at your option) any later version. 00011 * 00012 * This program is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU General Public License 00018 * along with this program; if not, write to the Free Software 00019 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 00020 * 02110-1301 USA. 00021 */ 00022 00023 #ifndef EV_COCOATOOLBAR_H 00024 #define EV_COCOATOOLBAR_H 00025 00026 #include "ut_types.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_CocoaToolbar_StyleCombo.h" 00032 00033 #import <Cocoa/Cocoa.h> 00034 00035 class AP_CocoaFrame; 00036 class XAP_CocoaToolbar_Icons; 00037 class EV_CocoaToolbar_ViewListener; 00038 class EV_Toolbar_Label; 00039 00040 class EV_CocoaToolbar; 00041 @class EV_CocoaToolbarTarget; 00042 00043 00044 class EV_CocoaToolbar : public EV_Toolbar 00045 { 00046 public: 00047 EV_CocoaToolbar(AP_CocoaFrame * pCocoaFrame, 00048 const char * szToolbarLayoutName, 00049 const char * szToolbarLabelSetName); 00050 00051 virtual ~EV_CocoaToolbar(void); 00052 00053 bool toolbarEvent(XAP_Toolbar_Id tlbrid, const UT_UCSChar * pData, UT_uint32 dataLength); 00054 virtual bool synthesize(void); 00055 bool bindListenerToView(AV_View * pView); 00056 virtual bool refreshToolbar(AV_View * pView, AV_ChangeMask mask); 00057 virtual bool repopulateStyles(void); 00058 UT_sint32 destroy(void); 00059 void rebuildToolbar(UT_sint32 oldpos); 00060 AP_CocoaFrame * getFrame(void); 00061 virtual void show(void); 00062 virtual void hide(void); 00063 00064 static float getButtonWidth (void) 00065 { return 28.0f; }; 00066 static float getButtonHeight (void) 00067 { return 28.0f; }; 00068 00069 static float getToolbarHeight(void) 00070 { return getButtonHeight(); }; 00071 00072 NSView* _getToolbarView(void) const 00073 { return m_wToolbar; }; 00074 protected: 00075 void _releaseListener(void); 00076 00077 AP_CocoaFrame * m_pCocoaFrame; 00078 EV_CocoaToolbar_ViewListener * m_pViewListener; 00079 AV_ListenerId m_lid; /* view listener id */ 00080 00081 NSView * m_wToolbar; 00082 NSView * m_superView; 00083 XAP_CocoaToolbar_Icons * m_pCocoaToolbarIcons; 00084 private: 00085 NSButton * _makeToolbarButton (int type, EV_Toolbar_Label * pLabel, 00086 XAP_Toolbar_Id tlbrid, NSView *parent, 00087 float & btnX); 00088 EV_CocoaToolbarTarget * m_target; 00089 }; 00090 00091 #endif /* EV_COCOATOOLBAR_H */ 00092 00093 00094 00095 00096 00097 00098 00099 00100