enum.cpp revision f489848c707c95a528d91cf1a0c029ed76249dbb
/** \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:
{}
};
ParamComboBox::ParamComboBox (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) :
{
// Read XML tree to add enumeration items:
// printf("Extension Constructor: ");
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
const char * defaultval = NULL;
}
}
}
if (defaultval != NULL) {
}
}
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;
}
void
ParamComboBox::changed (void) {
}
{
}
/** A special category of Gtk::Entry to handle string parameteres. */
private:
SPDocument * _doc;
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
ParamComboBoxEntry::changed (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:
#if WITH_GTKMM_2_24
#else
#endif
}
}
}
}
} // 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 :