/** \file
* extension parameter for enumerations.
*
* It uses a Gtk:ComboBoxText widget in the extension UI.
*/
/*
* Author:
* Johan Engelen <johan@shouraizou.nl>
* Jon A. Cruz <jon@joncruz.org>
*
* Copyright (C) 2006-2007 Johan Engelen
*
* 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 "document-private.h"
#include "sp-object.h"
#include "enum.h"
#include "preferences.h"
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 enumentry {
public:
{}
};
, _indent(0)
{
// Read XML tree to add enumeration items:
if (!strcmp(chname, INKSCAPE_EXTENSION_NS "item") || !strcmp(chname, INKSCAPE_EXTENSION_NS "_item")) {
if (node->firstChild()) {
}
// don't translate when 'item' but do translate when '_item'
// NOTE: internal extensions use build_from_mem and don't need _item but
// still need to include if are to be localized
} else {
newguitext = _(contents);
}
} else {
}
} else
continue;
} else {
}
}
}
}
// Initialize _value with the default value from xml
// for simplicity : default to the contents of the first xml-child
}
}
}
} else if (xmlval) {
}
}
ParamComboBox::~ParamComboBox (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 *ParamComboBox::set(const gchar * in, SPDocument * /*doc*/, Inkscape::XML::Node * /*node*/)
{
return NULL; /* Can't have NULL string */
}
break; // break out of for loop
}
}
}
}
return _value;
}
/**
* function to test if \c guitext is selectable
*/
bool ParamComboBox::contains(const gchar * guitext, SPDocument const * /*doc*/, Inkscape::XML::Node const * /*node*/) const
{
return false; /* Can't have NULL string */
}
return true;
}
// if we did not find the guitext in this ParamComboBox:
return false;
}
void
}
{
}
/** A special category of Gtk::Entry to handle string parameteres. */
private:
public:
/**
* Build a string preference for the given parameter.
* @param pref Where to get the string from, and where to put it
* when it changes.
*/
ParamComboBoxEntry (ParamComboBox * pref, SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal) :
};
void changed (void);
};
/**
* Respond to the text box changing.
*
* This function responds to the box changing by grabbing the value
* from the text box and putting it in the parameter.
*/
void
{
if (_changeSignal != NULL) {
_changeSignal->emit();
}
}
/**
* Creates a combobox widget for an enumeration parameter.
*/
Gtk::Widget *ParamComboBox::get_widget(SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal)
{
if (_gui_hidden) {
return NULL;
}
// add choice strings:
}
}
}
}
} // 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 :