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
00097
00098 #define SET_GATHER(a,u) virtual u _gather##a(void) = 0; \
00099 virtual void _set##a( u ) = 0
00100 SET_GATHER (Alignment, eTabType);
00101 SET_GATHER (Leader, eTabLeader);
00102 SET_GATHER (DefaultTabStop, const gchar*);
00103
00104
00105 virtual void _setTabList(UT_uint32 count) = 0;
00106
00107
00108
00109
00110 SET_GATHER (SelectTab, UT_sint32);
00111
00112
00113 SET_GATHER (TabEdit, const char *);
00114 #undef SET_GATHER
00115
00116
00117 virtual void _clearList()=0;
00118
00119 protected:
00120 tAnswer m_answer;
00121 XAP_Frame * m_pFrame;
00122 UT_Dimension m_dim;
00123
00124 char * m_pszTabStops;
00125 UT_GenericVector<fl_TabStop*> m_tabInfo;
00126
00127
00128 void _event_TabChange(void);
00129 void _event_TabSelected( UT_sint32 index);
00130 void _event_AlignmentChange(void);
00131
00132 void _event_Set(void);
00133 void _event_Update(void);
00134 void _event_Clear(void);
00135 void _event_ClearAll(void);
00136
00137 void _event_somethingChanged();
00138
00139 private:
00140 TabSaveCallBack m_pCallbackFn;
00141 void * m_closure;
00142
00143 char buf[20];
00144
00145 };
00146
00147 #endif