radiobutton.cpp revision 5cacbbec22b42a0480f396eb94bcfb5f746ac68a
/** \file
* extension parameter for radiobuttons.
*
* It uses a Gtk:ComboBoxText widget in the extension UI.
*/
/*
* Author:
* Johan Engelen <johan@shouraizou.nl>
*
* Copyright (C) 2006-2007 Johan Engelen
* Copyright (C) 2008 Jon A. Cruz
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <gtkmm/comboboxtext.h>
#include "extension/extension.h"
#include "preferences.h"
#include "document-private.h"
#include "sp-object.h"
#include "radiobutton.h"
/**
* The root directory in the preferences database for extension
* related parameters.
*/
#define PREF_DIR "extensions"
namespace Inkscape {
namespace Extension {
/* For internal use only.
Note that value and guitext MUST be non-NULL. This is ensured by newing only at one location in the code where non-NULL checks are made. */
class optionentry {
public:
}
~optionentry() {
delete value;
delete guitext;
}
};
bool gui_hidden,
{
// Read XML tree to add enumeration items:
// printf("Extension Constructor: ");
while (child_repr != NULL) {
if (!strcmp(chname, INKSCAPE_EXTENSION_NS "option") || !strcmp(chname, INKSCAPE_EXTENSION_NS "_option")) {
// don't translate when 'item' but do translate when '_option'
} else {
}
} else {
}
} else {
continue;
}
} else {
}
}
}
}
}
// Initialize _value with the default value from xml
// for simplicity : default to the contents of the first xml-child
const char * defaultval = NULL;
if (choices) {
}
}
}
if (defaultval != NULL) {
}
}
ParamRadioButton::~ParamRadioButton (void)
{
//destroy choice strings
}
}
/**
* A function to set the \c _value.
*
* This function sets ONLY the internal value, but it also sets the value
* in the preferences structure. To put it in the right place, \c PREF_DIR
* and \c pref_name() are used.
*
* To copy the data into _value the old memory must be free'd first.
* It is important to note that \c g_free handles \c NULL just fine. Then
* the passed in value is duplicated using \c g_strdup().
*
* @param in The value to set.
* @param doc A document that should be used to set the value.
* @param node The node where the value may be placed.
*/
const gchar *ParamRadioButton::set(const gchar * in, SPDocument * /*doc*/, Inkscape::XML::Node * /*node*/)
{
return NULL; /* Can't have NULL string */
}
break; // break out of for loop
}
}
if (settext) {
}
}
return _value;
}
{
}
/** A special radiobutton class to use in ParamRadioButton. */
private:
SPDocument * _doc;
public:
/**
* Build a string preference for the given parameter.
* @param pref Where to put the radiobutton's string when it is selected.
*/
ParamRadioButton * pref, SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal ) :
};
ParamRadioButton * pref, SPDocument * doc, Inkscape::XML::Node * node , sigc::signal<void> * changeSignal) :
};
void add_changesignal() {
};
void changed (void);
};
/**
* Respond to the selected radiobutton changing.
*
* This function responds to the radiobutton selection changing by grabbing the value
* from the text box and putting it in the parameter.
*/
void ParamRadioButtonWdg::changed(void)
{
if (this->get_active()) {
}
if (_changeSignal != NULL) {
_changeSignal->emit();
}
}
public:
Gtk::ComboBoxText(),
{
}
virtual ~ComboWdg() {}
protected:
virtual void on_changed() {
if ( base ) {
}
}
};
/**
* Creates a combobox widget for an enumeration parameter.
*/
Gtk::Widget * ParamRadioButton::get_widget(SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal)
{
if (_gui_hidden) {
return NULL;
}
bool comboSet = false;
}
// add choice strings as radiobuttons
// and select last selected option (_value)
switch ( _mode ) {
case MINIMAL:
{
comboSet = true;
}
}
break;
case COMPACT:
case FULL:
{
ParamRadioButtonWdg * radio = Gtk::manage(new ParamRadioButtonWdg(group, *text, this, doc, node, changeSignal));
radio->set_active();
}
}
break;
}
}
cbt->set_active(0);
}
}
} /* 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 :