Debian Codegraph @

editor/TableManage.h

raw symbols SCIP
1 /*
2 * Descent 3
3 * Copyright (C) 2024 Parallax Software
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19 #ifndef _TABLE_MANAGE_H_
20 #define _TABLE_MANAGE_H_
21
22 #include "genericpage.h"
23 #include "pstypes.h"
24
25 #define NO_DESCRIPTION_STRING "<None>"
26 #define TEMP_TABLE_FILENAME "TempTable.loc"
27
28 // Generic Page Node class
29 class GenericPageNode {
30 friend class GenericPageList;
31
32 private:
33 GenericPageNode *prev;
34 GenericPageNode *next;
35
36 mngs_generic_page genericpage; // Generic Page Data
37 uint32_t page_id; // Page's file index (i.e. the page_id'th page in file)
38
39 public:
40 GenericPageNode::GenericPageNode();
41 GenericPageNode::~GenericPageNode();
42
43 bool operator<(const GenericPageNode &node);
44 };
45
46 // Generic Page List class (maintains linked list of pages)
47 class GenericPageList {
48 private:
49 GenericPageNode *m_head;
50 GenericPageNode *m_tail;
51 uint32_t m_size;
52
53 CString m_TableFilename;
54 bool m_TableLoaded;
55
56 bool m_TableModified;
57
58 GenericPageNode *m_SelectedNode;
59 uint32_t m_SelectedIndex;
60
61 public:
62 GenericPageList::GenericPageList();
63 GenericPageList::~GenericPageList();
64
65 void SetModified(bool mMod) { m_TableModified = mMod; }
66 bool IsModified(void) { return (m_TableModified); }
67 bool IsLoaded(void) { return (m_TableLoaded); }
68
69 void ClearList(void);
70 bool AddToList(GenericPageNode *node);
71 bool LoadTable(char *table_filename);
72 bool SaveTable(char *table_filename);
73 bool FillFromList(CComboBox *list);
74
75 GenericPageNode *FindNode(uint32_t page_id);
76
77 void SelectNext(void);
78 void SelectPrev(void);
79 void SelectNode(uint32_t list_index);
80 void DisplaySelected(CComboBox *list, CEdit *description);
81 void SaveSelected(CEdit *description);
82
83 int ModifiedPrompt(CDialog *wnd);
84 void SetTitleString(CDialog *wnd);
85 };
86
87 #endif /* _TABLE_MANAGE_H_ */