Debian Codegraph @

src/af/xap/xp/xap_Dlg_ListDocuments.h

raw
1 /* AbiSource Application Framework
2 * Copyright (C) 2003 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_LISTDOCS_H
21 #define XAP_DIALOG_LISTDOCS_H
22
23 #include "xap_Dialog.h"
24 #include "ut_assert.h"
25 #include "ut_vector.h"
26
27 class AD_Document;
28
29 /*!
30
31 This dialogue lists documents that are open; by default
32 the current document is excluded from the list. This can be
33 changed by calling setIncludeActiveDocument(true) before the
34 dialogue is displayed.
35
36 PLATFORM NOTES
37 --------------
38 Platform subclasses need to provide the usual static_constructor()
39 and runModal() methods.
40
41 The dialogue contains a single column list which is filled by
42 document names using _getDocumentCount() and
43 _getNthDocumentName(). There is a heading text for the list,
44 obtained through _getHeading();
45
46 When the user selects a particular entry on the list,
47 _setSelDocumentIndx() should be called to store the index of the
48 selection (if the subclass sorts the list, it needs to ensure that
49 the index stored is the original index of that entry).
50
51 There should be two buttons: OK and Cancel; the text for the OK
52 button needs to be obtained using _getOKButtonText().
53
54 Title for the dialogue window is obtained through _getTitle().
55
56 (this dialogue is very much like ListRevisions, except the list
57 has only one column and the OK button label is not static)
58
59 */
60
61 class ABI_EXPORT XAP_Dialog_ListDocuments : public XAP_Dialog_NonPersistent
62 {
63 public:
64 XAP_Dialog_ListDocuments(XAP_DialogFactory * pDlgFactory, XAP_Dialog_Id id);
65 virtual ~XAP_Dialog_ListDocuments(void);
66
67 virtual void runModal(XAP_Frame * pFrame) = 0;
68
69 typedef enum { a_OK, a_CANCEL } tAnswer;
70
71 XAP_Dialog_ListDocuments::tAnswer getAnswer(void) const {return m_answer;}
72
73 AD_Document * getDocument(void) const;
74
75 void setIncludeActiveDoc(bool b);
76
77 protected:
78 void _setAnswer(XAP_Dialog_ListDocuments::tAnswer a){m_answer=a;}
79 UT_sint32 _getDocumentCount() {return m_vDocs.getItemCount();}
80 const char * _getNthDocumentName(UT_sint32 n) const;
81
82 void _setSelDocumentIndx(UT_sint32 i);
83
84 const char * _getTitle() const;
85 const char * _getOKButtonText() const;
86 const char * _getHeading() const;
87
88 private:
89
90 void _init();
91
92 XAP_Dialog_ListDocuments::tAnswer m_answer;
93
94 UT_sint32 m_ndxSelDoc;
95 UT_Vector m_vDocs;
96 bool m_bIncludeActiveDoc;
97 };
98
99 #endif /* XAP_DIALOG_WINDOWMORE_H */