Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef AP_DIALOG_TAB_H
00021 #define AP_DIALOG_TAB_H
00022
00023 #include "xap_Frame.h"
00024 #include "xap_Dialog.h"
00025 #include "xav_View.h"
00026 #include "ut_units.h"
00027 #include "fl_BlockLayout.h"
00028
00029 class XAP_Frame;
00030 class AP_Dialog_Tab;
00031 class FV_View;
00032
00033 #define MAX_TAB_LENGTH 15 // the maximum length the the tab input can have
00034
00035 typedef void (*TabSaveCallBack)(AP_Dialog_Tab * pDlg,
00036 FV_View *pView, const char * szTabStops,
00037 const char * szDflTabStop, void * closure);
00038
00039 class ABI_EXPORT AP_Dialog_Tab : public XAP_Dialog_NonPersistent
00040 {
00041 public:
00042
00043 AP_Dialog_Tab(XAP_DialogFactory * pDlgFactory, XAP_Dialog_Id id);
00044 virtual ~AP_Dialog_Tab(void);
00045
00046 virtual void runModal(XAP_Frame * pFrame) = 0;
00047
00048
00049 typedef enum { a_OK, a_CANCEL } tAnswer;
00050
00051
00052 typedef enum { id_EDIT_TAB = 0, id_LIST_TAB,
00053 id_SPIN_DEFAULT_TAB_STOP,
00054
00055
00056 id_ALIGN_LEFT, id_ALIGN_CENTER, id_ALIGN_RIGHT, id_ALIGN_DECIMAL, id_ALIGN_BAR,
00057
00058
00059 id_LEADER_NONE, id_LEADER_DOT, id_LEADER_DASH, id_LEADER_UNDERLINE,
00060
00061 id_BUTTON_SET, id_BUTTON_CLEAR, id_BUTTON_CLEAR_ALL,
00062 id_BUTTON_OK, id_BUTTON_CANCEL,
00063
00064 id_last } tControl;
00065
00066 AP_Dialog_Tab::tAnswer getAnswer(void) const;
00067
00068
00069 void clearList();
00070
00071 static unsigned char AlignmentToChar( eTabType a );
00072 static eTabType CharToAlignment( unsigned char ch );
00073
00074 void setSaveCallback (TabSaveCallBack, void * closure);
00075
00076 protected:
00077
00078
00079 virtual void _controlEnable( tControl id, bool value )=0;
00080
00081
00082 void _initEnableControls();
00083
00084
00085 void _populateWindowData(void);
00086 void _storeWindowData(void);
00087
00088
00089 bool buildTab( UT_String & buffer );
00090
00091 UT_Dimension _getDimension () { return m_dim; }
00092 char *_getTabDimensionString(UT_sint32 tabIndex);
00093 char *_getTabString(fl_TabStop *pTabInfo);
00094 void _deleteTabFromTabString(fl_TabStop *pTabInfo);
00095 void _doSpin( tControl id, UT_sint32 amount);
00096 void _doSpinValue(tControl id, double value);
00097
00098
00099 #define SET_GATHER(a,u) virtual u _gather##a(void) = 0; \
00100 virtual void _set##a( u ) = 0
00101 SET_GATHER (Alignment, eTabType);
00102 SET_GATHER (Leader, eTabLeader);
00103 SET_GATHER (DefaultTabStop, const gchar*);
00104
00105
00106 virtual void _setTabList(UT_uint32 count) = 0;
00107
00108
00109
00110
00111 SET_GATHER (SelectTab, UT_sint32);
00112
00113
00114 SET_GATHER (TabEdit, const char *);
00115 #undef SET_GATHER
00116
00117
00118 virtual void _clearList()=0;
00119
00120 protected:
00121 tAnswer m_answer;
00122 XAP_Frame * m_pFrame;
00123 UT_Dimension m_dim;
00124
00125 char * m_pszTabStops;
00126 UT_GenericVector<fl_TabStop*> m_tabInfo;
00127
00128
00129 void _event_TabChange(void);
00130 void _event_TabSelected( UT_sint32 index);
00131 void _event_AlignmentChange(void);
00132
00133 void _event_Set(void);
00134 void _event_Update(void);
00135 void _event_Clear(void);
00136 void _event_ClearAll(void);
00137
00138 void _event_somethingChanged();
00139
00140 private:
00141 TabSaveCallBack m_pCallbackFn;
00142 void * m_closure;
00143
00144 char buf[20];
00145
00146 };
00147
00148 #endif