00001 /* AbiWord 00002 * Copyright (C) 2004 Tomas Frydrych <tomasfrydrych@yahoo.co.uk> 00003 * 00004 * This program is free software; you can redistribute it and/or 00005 * modify it under the terms of the GNU General Public License 00006 * as published by the Free Software Foundation; either version 2 00007 * of the License, or (at your option) any later version. 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with this program; if not, write to the Free Software 00016 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 00017 * 02110-1301 USA. 00018 */ 00019 00020 #ifndef XAP_DIALOG_HISTORY_H 00021 #define XAP_DIALOG_HISTORY_H 00022 00023 #include "xap_Dialog.h" 00024 #include "ut_vector.h" 00025 00026 /* 00027 The dialogue consists of three segements (see PNG attached to 00028 commit message of Feb 5, 2004) 00029 00030 Buttons: there are getButtonCount() buttons (currently 2) which 00031 should be localised by getButtonLabel(n); the 0-th button 00032 is the default one; count-1 button is the cancel button. 00033 00034 Header section: the upper part of the dialogue; consists of 00035 getHeaderItemCount() pairs of labels, each pair on a 00036 separate row; the content of the labels is obtained 00037 by getHeaderLabel(n) and getHeaderValue(n) 00038 00039 List control: a multicolumn list; the number of columns is 00040 getListColumnCount(), while the number of items (i.e., 00041 rows) is getListItemCount(). Strings for each cell in the 00042 list are obtained via getListValue(row, column); the 00043 title for entire list comes from getListTitle(). 00044 00045 getListItemId(n) returns numerical id for a given row; if 00046 the user closes the dialogue in any other way than 00047 pressing Cancel, the numerical id for selected row should 00048 be passed to setSelectionId() before the dialogue closes; 00049 m_answer should be set as usual. 00050 00051 Title for the dialogue window is obtained by getWindowLabel(). 00052 */ 00053 00054 class XAP_Frame; 00055 class AD_Document; 00056 class XAP_StringSet; 00057 00058 const UT_uint32 iHeaderItemCount = 6; 00059 const UT_uint32 iButtonCount = 2; 00060 const UT_uint32 iListColumnCount = 3; 00061 00062 class ABI_EXPORT XAP_Dialog_History : public XAP_Dialog_NonPersistent 00063 { 00064 public: 00065 XAP_Dialog_History(XAP_DialogFactory * pDlgFactory, XAP_Dialog_Id id); 00066 00067 virtual ~XAP_Dialog_History(void) {}; 00068 00069 virtual void runModal(XAP_Frame * pFrame) = 0; 00070 00071 typedef enum { a_OK, a_CANCEL, a_SHOW } tAnswer; 00072 00073 XAP_Dialog_History::tAnswer getAnswer(void) const {return m_answer;}; 00074 00075 void setDocument(AD_Document * pDoc) {m_pDoc = pDoc;} 00076 00077 UT_uint32 getHeaderItemCount() const {return iHeaderItemCount;} 00078 const char * getHeaderLabel(UT_uint32 indx) const; 00079 char * getHeaderValue(UT_uint32 indx) const; 00080 00081 UT_uint32 getButtonCount() const {return iButtonCount;} 00082 const char * getButtonLabel(UT_uint32 indx) const; 00083 00084 const char * getListTitle() const; 00085 UT_uint32 getListColumnCount() const {return iListColumnCount;} 00086 const char * getListHeader(UT_uint32 column) const; 00087 UT_uint32 getListItemCount() const; 00088 char * getListValue(UT_uint32 item, UT_uint32 column) const; 00089 UT_uint32 getListItemId(UT_uint32 item) const; 00090 00091 const char * getWindowLabel() const; 00092 00093 UT_uint32 getSelectionId() const {return m_iId;} 00094 void setSelectionId(UT_uint32 iId) {m_iId = iId;} 00095 00096 protected: 00097 XAP_Dialog_History::tAnswer m_answer; 00098 00099 private: 00100 const AD_Document * m_pDoc; 00101 const XAP_StringSet * m_pSS; 00102 UT_uint32 m_iId; 00103 }; 00104 00105 #endif /* XAP_DIALOG_HISTORY_H */