The following commit has been merged in the master branch:
commit f7f2e26b8f039a5e369b038d9d4c0c1b3ed06941
Author: andrei zavada <[email protected]>
Date: Thu Oct 11 19:41:00 2012 +0300
new class aghui::SUIVar
diff --git a/src/ui/ui.hh b/src/ui/ui.hh
index 49610c6..02464f5 100644
--- a/src/ui/ui.hh
+++ b/src/ui/ui.hh
@@ -203,6 +203,73 @@ class SBusyBlock {
+template <typename Tw, typename Tv>
+class SUIVar {
+ DELETE_DEFAULT_METHODS (SUIVar);
+
+ private:
+ Tw *w;
+ Tv& v;
+
+ public:
+ SUIVar (Tw w_, Tv& v_)
+ : w (w_), v (v_)
+ {}
+ void down();
+ void up();
+};
+
+
+template <>
+inline void
+SUIVar<GtkSpinButton, double>::up()
+{
+ gtk_spin_button_set_value( w, v);
+}
+
+template <>
+inline void
+SUIVar<GtkSpinButton, double>::down()
+{
+ v = gtk_spin_button_get_value( w);
+}
+
+
+template <>
+inline void
+SUIVar<GtkCheckButton, bool>::up()
+{
+ gtk_toggle_button_set_active( (GtkToggleButton*)w, v);
+}
+
+template <>
+inline void
+SUIVar<GtkCheckButton, bool>::down()
+{
+ v = gtk_toggle_button_get_active( (GtkToggleButton*)w);
+}
+
+
+template <>
+inline void
+SUIVar<GtkEntry, string>::up()
+{
+ gtk_entry_set_text( w, v.c_str());
+}
+
+template <>
+inline void
+SUIVar<GtkEntry, string>::down()
+{
+ const char *tmp = gtk_entry_get_text( w);
+ v.assign(tmp);
+ g_free( (void*)tmp);
+}
+
+
+
+
+
#define AGH_GBGETOBJ(Type, A) \
(A = (Type*)(gtk_builder_get_object( builder, #A)))
--
Sleep experiment manager
_______________________________________________
debian-med-commit mailing list
[email protected]
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/debian-med-commit