Debian Codegraph @

src/af/xap/xp/xap_Dlg_History.h

raw
1 /* AbiWord
2 * Copyright (C) 2004 Tomas Frydrych <[email protected]>
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17 * 02110-1301 USA.
18 */
19
20 #ifndef XAP_DIALOG_HISTORY_H
21 #define XAP_DIALOG_HISTORY_H
22
23 #include "xap_Dialog.h"
24 #include "ut_vector.h"
25
26 /*
27 The dialogue consists of three segements (see PNG attached to
28 commit message of Feb 5, 2004)
29
30 Buttons: there are getButtonCount() buttons (currently 2) which
31 should be localised by getButtonLabel(n); the 0-th button
32 is the default one; count-1 button is the cancel button.
33
34 Header section: the upper part of the dialogue; consists of
35 getHeaderItemCount() pairs of labels, each pair on a
36 separate row; the content of the labels is obtained
37 by getHeaderLabel(n) and getHeaderValue(n)
38
39 List control: a multicolumn list; the number of columns is
40 getListColumnCount(), while the number of items (i.e.,
41 rows) is getListItemCount(). Strings for each cell in the
42 list are obtained via getListValue(row, column); the
43 title for entire list comes from getListTitle().
44
45 getListItemId(n) returns numerical id for a given row; if
46 the user closes the dialogue in any other way than
47 pressing Cancel, the numerical id for selected row should
48 be passed to setSelectionId() before the dialogue closes;
49 m_answer should be set as usual.
50
51 Title for the dialogue window is obtained by getWindowLabel().
52 */
53
54 class XAP_Frame;
55 class AD_Document;
56 class XAP_StringSet;
57
58 const UT_uint32 iHeaderItemCount = 6;
59 const UT_uint32 iButtonCount = 2;
60 const UT_uint32 iListColumnCount = 3;
61
62 class ABI_EXPORT XAP_Dialog_History : public XAP_Dialog_NonPersistent
63 {
64 public:
65 XAP_Dialog_History(XAP_DialogFactory * pDlgFactory, XAP_Dialog_Id id);
66
67 virtual ~XAP_Dialog_History(void) {};
68
69 virtual void runModal(XAP_Frame * pFrame) = 0;
70
71 typedef enum { a_OK, a_CANCEL, a_SHOW } tAnswer;
72
73 XAP_Dialog_History::tAnswer getAnswer(void) const {return m_answer;};
74
75 void setDocument(AD_Document * pDoc) {m_pDoc = pDoc;}
76
77 UT_uint32 getHeaderItemCount() const {return iHeaderItemCount;}
78 const char * getHeaderLabel(UT_uint32 indx) const;
79 char * getHeaderValue(UT_uint32 indx) const;
80
81 UT_uint32 getButtonCount() const {return iButtonCount;}
82 const char * getButtonLabel(UT_uint32 indx) const;
83
84 const char * getListTitle() const;
85 UT_uint32 getListColumnCount() const {return iListColumnCount;}
86 const char * getListHeader(UT_uint32 column) const;
87 UT_uint32 getListItemCount() const;
88 char * getListValue(UT_uint32 item, UT_uint32 column) const;
89 UT_uint32 getListItemId(UT_uint32 item) const;
90
91 const char * getWindowLabel() const;
92
93 UT_uint32 getSelectionId() const {return m_iId;}
94 void setSelectionId(UT_uint32 iId) {m_iId = iId;}
95
96 protected:
97 XAP_Dialog_History::tAnswer m_answer;
98
99 private:
100 const AD_Document * m_pDoc;
101 const XAP_StringSet * m_pSS;
102 UT_uint32 m_iId;
103 };
104
105 #endif /* XAP_DIALOG_HISTORY_H */