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