00001 /* -*- mode: C++; tab-width: 4; c-basic-offset: 4; -*- */ 00002 00003 /* AbiWord 00004 * Copyright (C) 1998 AbiSource, Inc. 00005 * Copyright (C) 2005 Robert Staudinger <robsta@stereolyzer.net> 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 AP_UNIXDIALOG_TAB_H 00024 #define AP_UNIXDIALOG_TAB_H 00025 00026 #include <gtk/gtk.h> 00027 00028 #include "ut_types.h" 00029 #include "ap_Dialog_Tab.h" 00030 00031 class XAP_UnixFrame; 00032 00033 class AP_UnixDialog_Tab: public AP_Dialog_Tab 00034 { 00035 public: 00036 AP_UnixDialog_Tab (XAP_DialogFactory *pDlgFactory, 00037 XAP_Dialog_Id id); 00038 virtual ~AP_UnixDialog_Tab (void); 00039 00040 static XAP_Dialog * static_constructor (XAP_DialogFactory *pDlgFactory, 00041 XAP_Dialog_Id id); 00042 00043 virtual void runModal (XAP_Frame *pFrame); 00044 00045 // Event-Handler 00046 void onDefaultTabChanged (double value); 00047 void onDefaultTabFocusOut (void); 00048 void onTabSelected (void); 00049 void onPositionChanged (double value); 00050 void onPositionFocusOut (void); 00051 void onAlignmentChanged (void); 00052 void onLeaderChanged (void); 00053 void onAddTab (void); 00054 void onDeleteTab (void); 00055 00056 GtkWidget *getWindow (void) { return m_wDialog; } 00057 00058 protected: 00059 00060 GtkWidget *_lookupWidget( tControl id ); 00061 virtual void _controlEnable( tControl id, bool value ); 00062 void _spinChanged(void); 00063 // we implement these so the XP dialog can set/grab our data 00064 #define SET_GATHER(a,t) virtual t _gather##a(void); \ 00065 virtual void _set##a( t ) 00066 SET_GATHER (Alignment, eTabType); 00067 SET_GATHER (Leader, eTabLeader); 00068 SET_GATHER (DefaultTabStop, const gchar*); 00069 00070 00071 // to populate the whole list 00072 virtual void _setTabList(UT_uint32 count); 00073 00074 // get/set the selected tab 00075 // the list of n tabs are index 0..(n-1) 00076 // -1 deselects everything 00077 SET_GATHER (SelectTab, UT_sint32); 00078 00079 // a pointer to the text in the edit box, MUST BE FREEd on get 00080 SET_GATHER (TabEdit, const char *); 00081 #undef SET_GATHER 00082 00083 // clear all the items from the tab list - only gui side 00084 virtual void _clearList(); 00085 00086 // private construction functions 00087 virtual GtkWidget * _constructWindow(void); 00088 00089 private: 00090 00091 void _connectSignals (GtkBuilder *builder); 00092 UT_sint32 _getSelectedIndex (void); 00093 00094 GtkBuilder *m_pBuilder; 00095 GtkWidget *m_wDialog; 00096 GtkWidget *m_sbDefaultTab; 00097 GtkWidget *m_exUserTabs; 00098 GtkWidget *m_lvTabs; 00099 GtkWidget *m_btDelete; 00100 GtkWidget *m_sbPosition; 00101 GtkWidget *m_cobAlignment; 00102 GtkWidget *m_cobLeader; 00103 GtkTreeSelection *m_tsSelection; 00104 00105 gchar *m_AlignmentMapping[__FL_TAB_MAX]; 00106 gchar *m_LeaderMapping[__FL_LEADER_MAX]; 00107 00108 guint m_hSigDefaultTabChanged; 00109 guint m_hSigPositionChanged; 00110 guint m_hSigAlignmentChanged; 00111 guint m_hSigLeaderChanged; 00112 guint m_hTabSelected; 00113 }; 00114 00115 #endif /* AP_UNIXDIALOG_TAB_H */ 00116 00117 00118