From: Mikko Rasa Date: Mon, 10 Mar 2008 10:57:51 +0000 (+0000) Subject: Add set_source method to Control X-Git-Tag: 0.9~6 X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=b453da0696b24cc02a7fcf5127afcd7baef9c801;p=libs%2Fgui.git Add set_source method to Control --- diff --git a/source/input/control.cpp b/source/input/control.cpp index 8ddcdd7..0519d8f 100644 --- a/source/input/control.cpp +++ b/source/input/control.cpp @@ -87,6 +87,18 @@ void Control::cancel_capture() connect_signals(); } +void Control::set_source(Device &d, ControlSrcType t, unsigned i) +{ + set_source(ControlSource(d, t, i)); +} + +void Control::set_source(const ControlSource &s) +{ + notify_callbacks(); + src=s; + connect_signals(); +} + void Control::connect_signals() { switch(src.type) diff --git a/source/input/control.h b/source/input/control.h index f7146b4..1ee21c8 100644 --- a/source/input/control.h +++ b/source/input/control.h @@ -67,6 +67,8 @@ public: void capture(Device &); void cancel_capture(); + void set_source(Device &, ControlSrcType, unsigned); + void set_source(const ControlSource &); const ControlSource &get_source() const { return src; } protected: virtual void on_press() =0;