AD.h
00001 #ifndef _AD_H
00002 #define _AD_H
00003
00005
00006 #include <gtkmm.h>
00007 #include <iomanip>
00008 #include <plugins.h>
00009 #include <UDefaultFunctions.h>
00010 #include <SensorProp.h>
00011 #include <global_macros.h>
00012
00013 namespace UniWidgets
00014 {
00019 struct sects
00020 {
00021 int startBorder;
00022 int endBorder;
00023 double red;
00024 double green;
00025 double blue;
00026 double alfa;
00027 bool solid;
00028 };
00037 class AD : public Gtk::DrawingArea
00038 {
00039
00040 public:
00041
00042 AD();
00043 explicit AD(Gtk::DrawingArea::BaseObjectType* gobject);
00044 virtual ~AD();
00045
00046 void setValue(int val);
00047 void setScale(int minp, int maxp, float step);
00048 void setScaleMarksNumber(int num);
00050 void setFacialString(std::string newFacial);
00051 void setInerc(float inerciya);
00053 void setRedrawTime(int rTime);
00054 void addSect(int startBorder,int endBorder,
00055 double red,double green,
00056 double blue,double alfa, bool solid);
00057 void cleanSect();
00058 void delLastSect();
00059 void setMarksFontSize(int num);
00060 void setDigitFontSize(int num);
00061 void setLabelFontSize(int num);
00062 void setScaleMarkWidth(int pix);
00063 void setColorLineWidth(int pix);
00064 void setGLO(bool _glo){glo = _glo;}
00066 protected:
00067
00068 void GoDynamics(void);
00069 bool Redraw(void);
00070 bool on_expose_event(GdkEventExpose* event);
00071 void on_settings_changed();
00072 void on_size_allocate(Gtk::Allocation& allocation);
00073
00074
00075 virtual void ScaleInit(Cairo::RefPtr<Cairo::Context>& cr);
00076 virtual void ColorizeSectors(Cairo::RefPtr<Cairo::Context>& cr);
00077 virtual void ArrowDrawing(Cairo::RefPtr<Cairo::Context>& cr);
00078 virtual void GlassDrawing(Cairo::RefPtr<Cairo::Context>& cr);
00079 virtual void BlickDrawing(Cairo::RefPtr<Cairo::Context>& cr);
00081 int value;
00082 float prevValue,dValue,aValue;
00083 float x_pos,y_pos;
00084 std::string facial, devName, myFont;
00086 int minp,maxp;
00087 float step;
00089 float sIndex;
00090 float squareside,width,height;
00092 int redrawTime;
00093 float inerc;
00094 bool gg,overshoot,redr,glo;
00096 sigc::connection tmrConn;
00099 Cairo::RefPtr< Cairo::Pattern > scalePatt, glassPatt;
00100
00101 Cairo::RefPtr< Cairo::RadialGradient> radgrad;
00102
00103
00104 int secCnt;
00106 std::list<sects* > sectList;
00107 typedef std::list<sects* >::iterator sectListIterator;
00109 Pango::FontDescription pFont;
00110
00111 int SMALL_SCALEMARKS_NUMBER;
00112 int SCALEMARKS_FONTSIZE;
00113 int DIGITVAL_FONTSIZE;
00114 int LABEL_FONTSIZE ;
00115 int SCALEMARK_WIDTH ;
00116 int COLORLINE_WIDTH ;
00117 private:
00118 void constructor();
00119
00120
00121
00122 DISALLOW_COPY_AND_ASSIGN(AD);
00123 ADD_PROPERTY( name_device, Glib::ustring )
00124 ADD_PROPERTY( min_value, long )
00125 ADD_PROPERTY( max_value, long )
00126 ADD_PROPERTY( step_value, long )
00127 ADD_PROPERTY( lag, long )
00128 };
00129
00130 }
00131 #endif