plugin code
[lbook_fbreader.git] / fbreader / src / optionsDialog / OptionsPage.cpp
blob6cf4528416369f86351f3792984141ab673b0b66
1 /*
2 * Copyright (C) 2004-2008 Geometer Plus <contact@geometerplus.com>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
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.
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.
20 #include <ZLOptionsDialog.h>
21 #include <ZLOptionEntry.h>
23 #include "OptionsPage.h"
25 void ComboOptionEntry::onValueSelected(int index) {
26 const std::string &selectedValue = values()[index];
27 const std::map<ZLOptionEntry*,std::string> &entries = myPage.myEntries;
28 int count = 0;
29 for (std::map<ZLOptionEntry*,std::string>::const_iterator it = entries.begin(); it != entries.end(); ++it, ++count) {
30 it->first->setVisible(it->second == selectedValue);
34 void OptionsPage::registerEntry(ZLDialogContent &tab, const ZLResourceKey &entryKey, ZLOptionEntry *entry, const std::string &name) {
35 if (entry != 0) {
36 entry->setVisible(false);
37 myEntries[entry] = name;
39 tab.addOption(entryKey, entry);
42 void OptionsPage::registerEntries(ZLDialogContent &tab, const ZLResourceKey &entry0Key, ZLOptionEntry *entry0, const ZLResourceKey &entry1Key, ZLOptionEntry *entry1, const std::string &name) {
43 if (entry0 != 0) {
44 entry0->setVisible(false);
45 myEntries[entry0] = name;
47 if (entry1 != 0) {
48 entry1->setVisible(false);
49 myEntries[entry1] = name;
51 tab.addOptions(entry0Key, entry0, entry1Key, entry1);