1
// Copyright (C) 2006-2007 W. Pantke <gnome-color-chooser@punk-ass-bitch.org>
3
// This program is free software; you can redistribute it and/or modify
4
// it under the terms of the GNU General Public License as published by
5
// the Free Software Foundation; either version 2 of the License, or
6
// (at your option) any later version.
8
// This program is distributed in the hope that it will be useful,
9
// but WITHOUT ANY WARRANTY; without even the implied warranty of
10
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
// GNU General Public License for more details.
13
// You should have received a copy of the GNU General Public License
14
// along with this program; if not, write to the Free Software
15
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17
#include "checkbutton.h"
20
CheckButton::CheckButton(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& refGlade)
21
: Gtk::CheckButton(cobject)
23
this->m_refGlade = refGlade;
26
CheckButton::CheckButton()
31
CheckButton::~CheckButton()
36
void CheckButton::init(int id, TreeHandler* config, string name) // for association with another widget
38
this->isParamWidget = false;
39
this->isEngineWidget = false;
42
this->setConfig(config);
43
ModWidget::register_widget(this);
47
void CheckButton::init(int id, TreeHandler* config) // as a standalone widget
49
this->isParamWidget = false;
50
this->isEngineWidget = false;
52
this->setConfig(config);
53
ModWidget::register_widget(this);
57
void CheckButton::init(string category, TreeHandler* config) // as engine widget
59
this->isParamWidget = false;
60
this->isEngineWidget = true;
61
this->category = category;
62
this->setConfig(config);
63
ModWidget::register_widget(this);
67
void CheckButton::init(string category, string id, TreeHandler* config, bool alone) // as param widget
69
this->isEngineWidget = false;
70
this->isParamWidget = true;
71
this->isParamAloneWidget = alone;
72
this->category = category;
74
this->setConfig(config);
78
void CheckButton::reload()
81
this->set_active(m_pConfig->getEngineOverride(this->category));
82
else if(isParamWidget)
84
if(isParamAloneWidget)
89
if((value = m_pConfig->getValue(this->category, this->id_string)) != "" &&
90
(checked = m_pConfig->getChecked(this->category, this->id_string)) != "" &&
92
this->set_active(true);
94
this->set_active(false);
96
this->set_sensitive(m_pConfig->getOverride(this->category, this->id_string));
100
this->set_active(m_pConfig->getOverride(this->category, this->id_string));
104
this->set_active(m_pConfig->getOverride(this->id));
107
char* CheckButton::getName()
112
return (char*)(this->name.c_str());