UniOscilChannel.h
00001 #ifndef _UNIOSCILCHANNEL_H
00002 #define _UNIOSCILCHANNEL_H
00003
00004 #include <gdkmm.h>
00005 #include <sigc++/sigc++.h>
00006 #include "ConfirmSignal.h"
00007 #include "USignals.h"
00008 #include "UEventBox.h"
00009 #include "global_macros.h"
00010
00011 class UniOscilChannel : public UEventBox{
00012 public:
00013 UniOscilChannel();
00014 UniOscilChannel(const Glib::ustring& image0_path, const Glib::ustring& image1_path);
00015 explicit UniOscilChannel(GtkmmBaseType::BaseObjectType* gobject);
00016 ~UniOscilChannel();
00017
00018 SensorProp* get_ai() { return &sensor_prop_ai_; }
00019 inline long get_value() { return current_value; }
00020 inline long get_last_value() { return last_value; }
00021 inline float get_fvalue() { return ((float)current_value)/pow10(prop_precision); }
00022 inline float get_last_fvalue() { return ((float)last_value)/pow10(prop_precision); }
00023 inline void equate_value() { last_value = current_value; }
00024 inline Glib::ustring get_channelname() { return prop_channelname.get_value(); }
00025 inline Gdk::Color get_channelcolor() { return prop_channelcolor.get_value(); }
00026 inline void set_channelcolor(Gdk::Color color) { return prop_channelcolor.set_value(color); }
00027
00028 Glib::PropertyProxy<Glib::ustring> property_channelname();
00029 Glib::PropertyProxy_ReadOnly<Glib::ustring> property_channelname() const;
00030 Glib::PropertyProxy<Glib::ustring> property_channelcolor();
00031 Glib::PropertyProxy_ReadOnly<Glib::ustring> property_channelcolor() const;
00032 Glib::PropertyProxy<bool> property_randcolor();
00033 Glib::PropertyProxy_ReadOnly<bool> property_randcolor() const;
00034
00035 virtual void init_widget();
00036
00037 virtual void set_connector(const ConnectorRef& connector) throw();
00038 virtual void on_connect() throw();
00039 virtual void on_disconnect() throw();
00040 virtual void on_realize();
00041
00042 protected:
00043 virtual bool on_expose_event(GdkEventExpose*);
00044 void process_sensor(UniSetTypes::ObjectId,UniSetTypes::ObjectId,long);
00045
00046 private:
00047 void ctor();
00048 void on_value_changed();
00049 void on_gradient_transparent_changed();
00050
00051 USignals::Connection sensor_connection_;
00052
00053 long current_value;
00054 long last_value;
00055
00056 int own_number;
00057
00058 SensorProp sensor_prop_ai_;
00059 ADD_PROPERTY( prop_visible, bool )
00060 ADD_PROPERTY( prop_precision, int )
00061 ADD_PROPERTY( prop_value, double )
00062 ADD_PROPERTY( prop_channelname, Glib::ustring )
00063 ADD_PROPERTY( prop_channelcolor, Gdk::Color )
00064 ADD_PROPERTY( prop_fill, bool )
00065 ADD_PROPERTY( prop_gradient, bool )
00066 ADD_PROPERTY( prop_gradientcolor, Gdk::Color )
00067 ADD_PROPERTY( prop_gradientTransparent, double )
00068 ADD_PROPERTY( prop_randcolor, bool )
00070 DISALLOW_COPY_AND_ASSIGN(UniOscilChannel);
00071 };
00072
00073 inline Glib::PropertyProxy<Glib::ustring> UniOscilChannel::property_channelname()
00074 {
00075 return prop_channelname.get_proxy();
00076 }
00077
00078 inline Glib::PropertyProxy_ReadOnly<Glib::ustring> UniOscilChannel::property_channelname() const
00079 {
00080 return Glib::PropertyProxy_ReadOnly<Glib::ustring>(this,"chanel-name");
00081 }
00082
00083 inline Glib::PropertyProxy<Glib::ustring> UniOscilChannel::property_channelcolor()
00084 {
00085 return prop_channelname.get_proxy();
00086 }
00087
00088 inline Glib::PropertyProxy_ReadOnly<Glib::ustring> UniOscilChannel::property_channelcolor() const
00089 {
00090 return Glib::PropertyProxy_ReadOnly<Glib::ustring>(this,"chanel-color");
00091 }
00092
00093 inline Glib::PropertyProxy<bool> UniOscilChannel::property_randcolor()
00094 {
00095 return prop_randcolor.get_proxy();
00096 }
00097
00098 inline Glib::PropertyProxy_ReadOnly<bool> UniOscilChannel::property_randcolor() const
00099 {
00100 return Glib::PropertyProxy_ReadOnly<bool>(this,"random-color");
00101 }
00102
00103 #endif