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