summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: dc04c2a)
raw | patch | inline | side by side (parent: dc04c2a)
author | johanengelen <johanengelen@users.sourceforge.net> | |
Sat, 24 Jan 2009 01:15:07 +0000 (01:15 +0000) | ||
committer | johanengelen <johanengelen@users.sourceforge.net> | |
Sat, 24 Jan 2009 01:15:07 +0000 (01:15 +0000) |
src/ui/widget/combo-enums.h | patch | blob | history |
index c418ea28ba74a7f5a4f54f87646a57011fdbc499..917fa8d921ce56f2060d3152d8262d16776ee332 100644 (file)
template<typename E> class ComboBoxEnum : public Gtk::ComboBox, public AttrWidget
{
+private:
+ int on_sort_compare( const Gtk::TreeModel::iterator & a, const Gtk::TreeModel::iterator & b)
+ {
+ Glib::ustring an=(*a)[_columns.label];
+ Glib::ustring bn=(*b)[_columns.label];
+ g_message("%s - %s", an.c_str(), bn.c_str());
+ return an.compare(bn);
+ }
+
public:
ComboBoxEnum(E default_value, const Util::EnumDataConverter<E>& c, const SPAttributeEnum a = SP_ATTR_INVALID)
: AttrWidget(a, (unsigned int)default_value), setProgrammatically(false), _converter(c)
row[_columns.label] = _( _converter.get_label(data->id).c_str() );
}
set_active_by_id(default_value);
+
+ // Sort the list
+ _model->set_default_sort_func(sigc::mem_fun(*this, &ComboBoxEnum<E>::on_sort_compare));
+ _model->set_sort_column(_columns.label, Gtk::SORT_ASCENDING);
}
ComboBoxEnum(const Util::EnumDataConverter<E>& c, const SPAttributeEnum a = SP_ATTR_INVALID)
row[_columns.label] = _( _converter.get_label(data->id).c_str() );
}
set_active(0);
+
+ // Sort the list
+ _model->set_default_sort_func(sigc::mem_fun(*this, &ComboBoxEnum<E>::on_sort_compare));
+ _model->set_sort_column(_columns.label, Gtk::SORT_ASCENDING);
}
virtual Glib::ustring get_as_attribute() const