+template <typename U, typename V>
+V caster (U x)
+{
+ return static_cast<V> (x);
+}
+
+template <class S>
+class ContentSpinCtrl : public ContentWidget<S, wxSpinCtrl, int, int>
+{
+public:
+ ContentSpinCtrl (
+ wxWindow* parent,
+ wxSpinCtrl* wrapped,
+ int property,
+ boost::function<int (S*)> getter,
+ boost::function<void (S*, int)> setter
+ )
+ : ContentWidget<S, wxSpinCtrl, int, int> (
+ parent,
+ wrapped,
+ property,
+ getter, setter,
+ &caster<int, int>,
+ &caster<int, int>
+ )
+ {
+ wrapped->Bind (wxEVT_COMMAND_SPINCTRL_UPDATED, boost::bind (&ContentWidget<S, wxSpinCtrl, int, int>::view_changed, this));
+ }
+};
+
+template <class S>
+class ContentSpinCtrlDouble : public ContentWidget<S, wxSpinCtrlDouble, double, double>
+{
+public:
+ ContentSpinCtrlDouble (
+ wxWindow* parent,
+ wxSpinCtrlDouble* wrapped,
+ int property,
+ boost::function<double (S*)> getter,
+ boost::function<void (S*, double)> setter
+ )
+ : ContentWidget<S, wxSpinCtrlDouble, double, double> (
+ parent,
+ wrapped,
+ property,
+ getter, setter,
+ &caster<double, double>,
+ &caster<double, double>
+ )
+ {
+ wrapped->Bind (wxEVT_COMMAND_SPINCTRLDOUBLE_UPDATED, boost::bind (&ContentWidget<S, wxSpinCtrlDouble, double, double>::view_changed, this));
+ }
+};
+
+template <class S, class U>
+class ContentChoice : public ContentWidget<S, wxChoice, U, int>
+{
+public:
+ ContentChoice (
+ wxWindow* parent,
+ wxChoice* wrapped,
+ int property,
+ boost::function<U (S*)> getter,
+ boost::function<void (S*, U)> setter,
+ boost::function<U (int)> view_to_model,
+ boost::function<int (U)> model_to_view
+ )
+ : ContentWidget<S, wxChoice, U, int> (
+ parent,
+ wrapped,
+ property,
+ getter,
+ setter,
+ view_to_model,
+ model_to_view
+ )
+ {
+ wrapped->Bind (wxEVT_COMMAND_CHOICE_SELECTED, boost::bind (&ContentWidget<S, wxChoice, U, int>::view_changed, this));
+ }
+
+};
+