00001 /* AbiSource Application Framework 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 00021 #ifndef XAP_TOOLBAR_LAYOUTS_H 00022 #define XAP_TOOLBAR_LAYOUTS_H 00023 00024 #include "ut_string_class.h" 00025 #include "ut_vector.h" 00026 00027 #include "xap_Strings.h" 00028 00029 #include "ev_Toolbar_Layouts.h" 00030 #include "ev_EditBits.h" 00031 00032 class XAP_App; 00033 00034 EV_Toolbar_Layout * AP_CreateToolbarLayout(const char * szName); 00035 00036 struct ABI_EXPORT XAP_Toolbar_Factory_lt 00037 { 00038 EV_Toolbar_LayoutFlags m_flags; 00039 XAP_Toolbar_Id m_id; 00040 }; 00041 00042 struct ABI_EXPORT XAP_Toolbar_Factory_tt 00043 { 00044 const char * m_name; 00045 XAP_String_Id m_label; 00046 const gchar* m_prefKey; 00047 UT_uint32 m_nrEntries; 00048 XAP_Toolbar_Factory_lt * m_lt; 00049 }; 00050 00051 class ABI_EXPORT XAP_Toolbar_Factory_vec 00052 { 00053 public: 00054 XAP_Toolbar_Factory_vec(const char * szName); 00055 XAP_Toolbar_Factory_vec(XAP_Toolbar_Factory_tt * orig); 00056 XAP_Toolbar_Factory_vec(EV_Toolbar_Layout * orig); 00057 ~XAP_Toolbar_Factory_vec(); 00058 UT_uint32 getNrEntries(void); 00059 void add_lt(XAP_Toolbar_Factory_lt * plt); 00060 XAP_Toolbar_Factory_lt * getNth_lt(UT_uint32 i); 00061 void insertLastItem(XAP_Toolbar_Factory_lt * p); 00062 void insertItemBefore(XAP_Toolbar_Factory_lt * p, XAP_Toolbar_Id id); 00063 void insertItemAfter(XAP_Toolbar_Factory_lt * p, XAP_Toolbar_Id id); 00064 bool removeToolbarId(XAP_Toolbar_Id id); 00065 const char * getToolbarName(void); 00066 XAP_String_Id getLabelStringID(void); 00067 const gchar * getPrefKey(void); 00068 private: 00069 UT_String m_name; 00070 XAP_String_Id m_label; 00071 const gchar* m_prefKey; 00072 UT_GenericVector<XAP_Toolbar_Factory_lt *> m_Vec_lt; 00073 }; 00074 00075 class ABI_EXPORT XAP_Toolbar_Factory 00076 { 00077 public: 00078 00079 XAP_Toolbar_Factory(XAP_App * pApp); 00080 ~XAP_Toolbar_Factory(void); 00081 EV_Toolbar_Layout * CreateToolbarLayout(const char * szName); 00082 EV_Toolbar_Layout * DuplicateToolbarLayout(const char * szName); 00083 void restoreToolbarLayout( EV_Toolbar_Layout * pTB); 00084 bool addIconBefore(const char * szName, 00085 XAP_Toolbar_Id newId, 00086 XAP_Toolbar_Id beforeId); 00087 bool addIconAfter(const char * szName, 00088 XAP_Toolbar_Id newId, 00089 XAP_Toolbar_Id afterId); 00090 bool addIconAtEnd(const char * szName, 00091 XAP_Toolbar_Id newId); 00092 bool removeIcon(const char * szName, 00093 XAP_Toolbar_Id nukeId); 00094 bool saveToolbarsInCurrentScheme(void); 00095 bool restoreToolbarsFromCurrentScheme(void); 00096 const UT_GenericVector<UT_UTF8String*> & getToolbarNames(void); 00097 UT_uint32 countToolbars(void) const; 00098 const gchar* prefKeyForToolbar(UT_uint32 t) const; 00099 private: 00100 UT_GenericVector<XAP_Toolbar_Factory_vec*> m_vecTT; 00101 XAP_App * m_pApp; 00102 UT_GenericVector<UT_UTF8String*> m_tbNames; 00103 }; 00104 00105 00106 #endif /* XAP_TOOLBAR_LAYOUTS_H */ 00107 00108 00109 00110 00111