summaryrefslogtreecommitdiffstats
path: root/fbreader/src/optionsDialog/lookAndFeel/OptionsPage.h
diff options
context:
space:
mode:
authorMichele Calgaro <[email protected]>2024-05-11 21:28:48 +0900
committerMichele Calgaro <[email protected]>2024-05-11 21:28:48 +0900
commit2462d03f322261bd616721c2b2065c4004b36c9c (patch)
tree239947a0737bb8386703a1497f12c09aebd3080a /fbreader/src/optionsDialog/lookAndFeel/OptionsPage.h
downloadtde-ebook-reader-2462d03f322261bd616721c2b2065c4004b36c9c.tar.gz
tde-ebook-reader-2462d03f322261bd616721c2b2065c4004b36c9c.zip
Initial import (as is) from Debian Snapshot's 'fbreader' source code (https://snapshot.debian.org/package/fbreader/0.99.4%2Bdfsg-6).
The Debian code is provided under GPL2 license. Signed-off-by: Michele Calgaro <[email protected]>
Diffstat (limited to 'fbreader/src/optionsDialog/lookAndFeel/OptionsPage.h')
-rw-r--r--fbreader/src/optionsDialog/lookAndFeel/OptionsPage.h76
1 files changed, 76 insertions, 0 deletions
diff --git a/fbreader/src/optionsDialog/lookAndFeel/OptionsPage.h b/fbreader/src/optionsDialog/lookAndFeel/OptionsPage.h
new file mode 100644
index 0000000..a175c2b
--- /dev/null
+++ b/fbreader/src/optionsDialog/lookAndFeel/OptionsPage.h
@@ -0,0 +1,76 @@
+/*
+ * Copyright (C) 2004-2012 Geometer Plus <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301, USA.
+ */
+
+#ifndef __OPTIONSPAGE_H__
+#define __OPTIONSPAGE_H__
+
+#include <map>
+
+#include <ZLOptionEntry.h>
+
+class ZLDialogContent;
+
+class OptionsPage;
+
+class ComboOptionEntry : public ZLComboOptionEntry {
+
+public:
+ ComboOptionEntry(OptionsPage &page, const std::string &initialValue);
+ const std::string &initialValue() const;
+ const std::vector<std::string> &values() const;
+ void onAccept(const std::string&);
+ void onValueSelected(int index);
+ void addValue(const std::string &value);
+
+protected:
+ OptionsPage &myPage;
+ std::vector<std::string> myValues;
+ std::string myInitialValue;
+};
+
+class OptionsPage {
+
+public:
+ virtual ~OptionsPage();
+
+protected:
+ OptionsPage();
+
+ void registerEntry(ZLDialogContent &tab, const ZLResourceKey &entryKey, ZLOptionEntry *entry, const std::string &name);
+ void registerEntries(ZLDialogContent &tab, const ZLResourceKey &entry0Key, ZLOptionEntry *entry0, const ZLResourceKey &entry1Key, ZLOptionEntry *entry1, const std::string &name);
+
+protected:
+ ComboOptionEntry *myComboEntry;
+
+private:
+ std::map<ZLOptionEntry*,std::string> myEntries;
+
+friend class ComboOptionEntry;
+};
+
+inline ComboOptionEntry::ComboOptionEntry(OptionsPage &page, const std::string &initialValue) : myPage(page), myInitialValue(initialValue) {}
+inline const std::string &ComboOptionEntry::initialValue() const { return myInitialValue; }
+inline const std::vector<std::string> &ComboOptionEntry::values() const { return myValues; }
+inline void ComboOptionEntry::onAccept(const std::string&) {}
+inline void ComboOptionEntry::addValue(const std::string &value) { myValues.push_back(value); }
+
+inline OptionsPage::OptionsPage() {}
+inline OptionsPage::~OptionsPage() {}
+
+#endif /* __OPTIONSPAGE_H__ */