bool.cpp revision 0f0f026a553fd84ffaaa90a368f87a842ecfcdd5
/*
* Copyright (C) 2005-2007 Authors:
* Ted Gould <ted@gould.cx>
* Johan Engelen <johan@shouraizou.nl> *
* Jon A. Cruz <jon@joncruz.org>
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <gtkmm/adjustment.h>
#include <gtkmm/spinbutton.h>
#include "../extension.h"
#include "bool.h"
#include "preferences.h"
namespace Inkscape {
namespace Extension {
ParamBool::ParamBool(const gchar * name, const gchar * guitext, const gchar * desc, const Parameter::_scope_t scope, bool gui_hidden, const gchar * gui_tip, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml) :
{
const char * defaultval = NULL;
}
if (defaultval != NULL && (!strcmp(defaultval, "true") || !strcmp(defaultval, "true") || !strcmp(defaultval, "1"))) {
_value = true;
} else {
_value = false;
}
}
return;
}
{
return _value;
}
{
return _value;
}
/**
* A check button which is Param aware. It works with the
* parameter to change it's value as the check button changes
* value.
*/
public:
/**
* Initialize the check button.
* This function sets the value of the checkbox to be that of the
* parameter, and then sets up a callback to \c on_toggle.
*
* @param param Which parameter to adjust on changing the check button
*/
ParamBoolCheckButton (ParamBool * param, SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal) :
return;
}
/**
* A function to respond to the check box changing.
* Adjusts the value of the preference to match that in the check box.
*/
void on_toggle (void);
private:
/** Param to change. */
SPDocument * _doc;
};
void ParamBoolCheckButton::on_toggle(void)
{
if (_changeSignal != NULL) {
_changeSignal->emit();
}
return;
}
{
if (_value) {
string += "true";
} else {
string += "false";
}
return;
}
Gtk::Widget *ParamBool::get_widget(SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal)
{
if (_gui_hidden) {
return NULL;
}
ParamBoolCheckButton * checkbox = Gtk::manage(new ParamBoolCheckButton(this, doc, node, changeSignal));
}
} /* namespace Extension */
} /* namespace Inkscape */
/*
Local Variables:
mode:c++
c-file-style:"stroustrup"
c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
indent-tabs-mode:nil
fill-column:99
End:
*/
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :