UniWidgets  1.0.0
QueueLogic.h
00001 #ifndef _QUEUELOGIC_H
00002 #define _QUEUELOGIC_H
00003 // -------------------------------------------------------------------------
00004 #include <gtkmm.h>
00005 #include <gdkmm.h>
00006 #include <objects/AbstractLogic.h>
00007 #include <uniwidgets/SBlinker.h>
00008 #include <uniwidgets/USignals.h>
00009 #include <uniwidgets/ConfirmSignal.h>
00010 #include <components/Indicator.h>
00011 #include <global_macros.h>
00012 // -------------------------------------------------------------------------
00013 namespace UniWidgets
00014 {
00015 
00016 struct Indinfo
00017 {
00018     bool is_show_;
00019     bool blinking_;
00020     /*"1" - high level
00021       "0" - low level*/
00022     int type_;
00023 };
00033 class QueueLogic : public AbstractLogic
00034 {
00035 public:
00036     QueueLogic();
00037     explicit QueueLogic(Gtk::EventBox::BaseObjectType* gobject);
00038     ~QueueLogic() {}
00039     
00040     /*Types*/
00041     typedef std::map<long , std::vector<Indinfo*>, std::greater<long> > Modes;  
00043     virtual void stop_blink(){};                            
00044     virtual void start_blink(){};                           
00045     virtual void set_state(bool newstate_){};                   
00046     virtual bool is_blinking(){return false;}                   
00047     virtual void set_mode(long mode) = 0;                       
00048     virtual long get_state_obj() = 0;                       
00049     void confirm(long mode, int type);                      
00050     void on_set_mode(const long mode, const int type,bool blink=true);      
00051     void off_set_mode(const long mode, const int type);             
00052     bool is_show(const long mode, const int type);                  
00053     bool is_blinking_mode(const long mode, const int type);             
00054 protected:
00055     /* Methods */
00056     virtual void on_init(){};
00057     long current_mode_;                             
00058 private:
00059     /* Variables */
00060     Modes on_modes_;                                
00061     int current_type_;                              
00063     /* Methods */
00064     long get_max_mode();                                
00065     Indinfo* set_info(bool show, bool blink,int type);              
00066     Indinfo* find_type(const long mode, const int type);                
00067     void erase_mode(const long mode, const int type);               
00069     void constructor();
00070     DISALLOW_COPY_AND_ASSIGN(QueueLogic);
00071 };
00072 
00073 }
00074 #endif