00001 /* -*- mode: C++; tab-width: 4; c-basic-offset: 4; -*- */ 00002 /* AbiWord 00003 * Copyright (C) 1998 AbiSource, Inc. 00004 * Copyright (C) 2009 Hubert Figuiere 00005 * 00006 * This program is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU General Public License 00008 * as published by the Free Software Foundation; either version 2 00009 * of the License, or (at your option) any later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License 00017 * along with this program; if not, write to the Free Software 00018 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 00019 * 02110-1301 USA. 00020 */ 00021 00022 #ifndef AP_UNIXDIALOG_LISTS_H 00023 #define AP_UNIXDIALOG_LISTS_H 00024 00025 #include <vector> 00026 #include <string> 00027 00028 #include "ap_Dialog_Lists.h" 00029 #include "ut_timer.h" 00030 #include "xap_GtkObjectHolder.h" 00031 00032 class XAP_UnixFrame; 00033 class GR_CairoGraphics; 00034 00035 /*****************************************************************/ 00036 00037 class AP_UnixDialog_Lists: public AP_Dialog_Lists 00038 { 00039 public: 00040 AP_UnixDialog_Lists(XAP_DialogFactory * pDlgFactory, XAP_Dialog_Id id); 00041 virtual ~AP_UnixDialog_Lists(void); 00042 00043 static XAP_Dialog * static_constructor(XAP_DialogFactory *, XAP_Dialog_Id id); 00044 00045 virtual void runModeless(XAP_Frame * pFrame); 00046 virtual void destroy(void); 00047 virtual void activate(void); 00048 virtual void notifyActiveFrame(XAP_Frame *pFrame); 00049 virtual void runModal(XAP_Frame * pFrame); 00050 /* CALLBACKS */ 00051 00052 void customChanged(void); 00053 void applyClicked(void); 00054 void closeClicked(void); 00055 void styleChanged( gint style); 00056 void previewExposed(void); 00057 void setFoldLevel(UT_sint32 iLevel,bool bSet); 00058 00059 /* Just Plain Useful Functions */ 00060 00061 void setListTypeFromWidget(void); 00062 void setXPFromLocal(void); 00063 void loadXPDataIntoLocal(void); 00064 void updateFromDocument(void); 00065 void setAllSensitivity(void); 00066 void updateDialog(void); 00067 bool dontUpdate(void); 00068 static void autoupdateLists(UT_Worker * pTimer); 00069 virtual bool isPageLists(void); 00070 virtual void setFoldLevelInGUI(void); 00071 protected: 00072 virtual GtkWidget * _constructWindow(void); 00073 GtkWidget * _constructWindowContents(void); 00074 void _setRadioButtonLabels(void); 00075 void _connectSignals(void); 00076 void _fillNumberedStyleMenu( GtkListStore *listmenu); 00077 void _fillBulletedStyleMenu( GtkListStore *listmenu); 00078 void _fillNoneStyleMenu( GtkListStore *listmenu); 00079 void _gatherData(void); 00080 void _getGlistFonts (std::vector<std::string> & glFonts); 00081 void _fillFontMenu(GtkListStore* store); 00082 00083 inline GtkWidget * _getCloseButton(void) { return m_wClose; } 00084 inline GtkWidget * _getApplyButton(void) { return m_wApply; } 00085 inline GtkWidget * _getMainWindow(void) { return m_wMainWindow; } 00086 00087 inline void _setCloseButton(GtkWidget *w) { m_wClose = w; } 00088 inline void _setApplyButton(GtkWidget *w) { m_wApply = w; } 00089 inline void _setMainWindow(GtkWidget *w) { m_wMainWindow = w; } 00090 00091 private: 00092 typedef enum 00093 { 00094 BUTTON_OK = GTK_RESPONSE_OK, 00095 BUTTON_CANCEL = GTK_RESPONSE_CANCEL, 00096 BUTTON_CLOSE = GTK_RESPONSE_CLOSE, 00097 BUTTON_APPLY = GTK_RESPONSE_APPLY, 00098 BUTTON_RESET 00099 } ResponseId ; 00100 00101 std::vector<std::string> m_glFonts; 00102 GR_CairoGraphics * m_pPreviewWidget; 00103 00104 bool m_bManualListStyle; 00105 bool m_bDestroy_says_stopupdating; 00106 bool m_bAutoUpdate_happening_now; 00107 bool m_bDontUpdate; 00108 UT_Timer * m_pAutoUpdateLists; 00109 00110 GtkWidget * m_wMainWindow; 00111 00112 GtkWidget * m_wApply; 00113 GtkWidget * m_wClose; 00114 GtkWidget * m_wContents; 00115 GtkWidget * m_wStartNewList; 00116 GtkWidget * m_wApplyCurrent; 00117 GtkWidget * m_wStartSubList; 00118 GSList * m_wRadioGroup; 00119 GtkWidget * m_wPreviewArea; 00120 GtkWidget * m_wDelimEntry; 00121 GtkWidget * m_wDecimalEntry; 00122 GtkAdjustment * m_oAlignList_adj; 00123 GtkWidget * m_wAlignListSpin; 00124 GtkAdjustment * m_oIndentAlign_adj; 00125 GtkWidget * m_wIndentAlignSpin; 00126 GtkComboBox * m_wFontOptions; 00127 GtkListStore * m_wFontOptions_menu; 00128 GtkWidget * m_wCustomFrame; 00129 GtkWidget * m_wCustomTable; 00130 GtkWidget * m_wCustomLabel; 00131 GtkComboBox * m_wListStyleBox; 00132 XAP_GtkObjectHolder<GtkListStore> m_wListStyleNumbered_menu; 00133 XAP_GtkObjectHolder<GtkListStore> m_wListStyleBulleted_menu; 00134 XAP_GtkObjectHolder<GtkListStore> m_wListStyleNone_menu; 00135 XAP_GtkObjectHolder<GtkListStore> m_wListStyle_menu; 00136 GtkComboBox * m_wListTypeBox; 00137 XAP_GtkObjectHolder<GtkListStore> m_wListType_menu; 00138 GtkAdjustment * m_oStartSpin_adj; 00139 GtkWidget * m_wStartSpin; 00140 GtkWidget * m_wStartSub_label; 00141 GtkWidget * m_wStartNew_label; 00142 gint m_iDelimEntryID; 00143 gint m_iDecimalEntryID; 00144 gint m_iStyleBoxID; 00145 gint m_iAlignListSpinID; 00146 gint m_iIndentAlignSpinID; 00147 UT_sint32 m_iPageLists; 00148 UT_sint32 m_iPageFold; 00149 UT_GenericVector<GtkWidget*> m_vecFoldCheck; 00150 UT_NumberVector m_vecFoldID; 00151 }; 00152 00153 #endif /* AP_UNIXDIALOG_LISTS_H */ 00154 00155 00156 00157 00158 00159 00160