UniWidgets  1.0.0
UAPSJournal.h
00001 #ifndef _UAPSJOURNAL_H
00002 #define _UAPSJOURNAL_H
00003 // -------------------------------------------------------------------------
00004 #include <gtkmm.h>
00005 #include <uwidgets/UEventBox.h>
00006 #include <uniwidgets/CheckedSignal.h>
00007 #include <uniwidgets/USignals.h>
00008 #include <uwidgets/KineticScroll.h>
00009 #include <plugins.h>
00010 // -------------------------------------------------------------------------
00011 //struct msgItem;
00012 // -------------------------------------------------------------------------
00019 class UAPSJournal : public UEventBox{
00020 private:
00021     void ctor();
00022     sigc::connection blink_conn;
00023     UniSetTypes::ObjectId current_id;
00024 
00025     Glib::Property<Glib::ustring> property_pic_title;
00026     Glib::Property<Glib::ustring> property_time_title;
00027     Glib::Property<Glib::ustring> property_text_title;
00028     Glib::Property<Glib::ustring> property_confirm_title;
00029 
00030     Glib::Property<int> property_pic_width;
00031     Glib::Property<int> property_time_width;
00032     Glib::Property<int> property_text_width;
00033     Glib::Property<int> property_confirm_width;
00034 
00035     Glib::Property<std::string> property_info_pic;
00036     Glib::Property<std::string> property_warn_pic;
00037     Glib::Property<std::string> property_alarm_pic;
00038     Glib::Property<std::string> property_confirm1_pic;
00039     Glib::Property<std::string> property_confirm2_pic;
00040     Glib::Property<std::string> property_confirmed_pic;
00041 
00042     Glib::Property<Gdk::Color> property_info_color;
00043     Glib::Property<Gdk::Color> property_warn_color;
00044     Glib::Property<Gdk::Color> property_alarm_color;
00045 
00046     Glib::RefPtr<Gdk::Pixbuf> refPixInfo;
00047     Glib::RefPtr<Gdk::Pixbuf> refPixWarn;
00048     Glib::RefPtr<Gdk::Pixbuf> refPixAlarm;
00049     Glib::RefPtr<Gdk::Pixbuf> refPixConfirm1;
00050     Glib::RefPtr<Gdk::Pixbuf> refPixConfirm2;
00051     Glib::RefPtr<Gdk::Pixbuf> refPixConfirmed;
00052 
00053     void try_load_pic( Glib::RefPtr<Gdk::Pixbuf>& refPix, std::string pic );
00054     void value_out_proc(UMessages::MessageId, USignals::VConn* conn);
00055 
00056     bool on_search_noconfiredID(const Gtk::TreeIter& it,
00057                     const Gtk::TreeRow& row,
00058                     const UMessages::Message& message);
00059 
00060     bool on_search_noconfired(const Gtk::TreeIter& it);
00061 
00062     void on_foreach(const Gtk::TreeIter& it,const UMessages::MessageId& id,const time_t& sec);
00063 
00064     bool on_search_ID( const Gtk::TreeIter& it,
00065                const UMessages::MessageId& id);
00066 
00067     void on_blink_foreach(const Gtk::TreeIter& it,
00068                           const UMessages::MessageId& id,
00069                           const Glib::RefPtr<Gdk::Pixbuf>& pix);
00070 
00071     bool has_any_not_confirmed;
00072 
00073 public:
00074 
00075     UAPSJournal();
00076     explicit UAPSJournal(GtkmmBaseType::BaseObjectType* gobject);
00077     ~UAPSJournal();
00079     class ModelColumns : public Gtk::TreeModel::ColumnRecord
00080     {
00081     public:
00082 
00083         ModelColumns()
00084             {
00085                 add(icon);
00086                 add(timestring);
00087                 add(textmsg);
00088                 add(confirm_timestring);
00089                 add(time);
00090                 add(id);
00091                 add(wtype);
00092                 add(bgcolor);
00093                 add(fgcolor);
00094                 add(state);
00095                 add(checked);
00096             }
00097 
00098             Gtk::TreeModelColumn< Glib::RefPtr<Gdk::Pixbuf> >  icon;
00099             Gtk::TreeModelColumn<Glib::ustring> timestring;
00100             Gtk::TreeModelColumn<Glib::ustring> textmsg;
00101             Gtk::TreeModelColumn<Glib::ustring> confirm_timestring;
00102             Gtk::TreeModelColumn<time_t> time;
00103             Gtk::TreeModelColumn<UMessages::MessageId> id;
00104             Gtk::TreeModelColumn<int> wtype;
00105             Gtk::TreeModelColumn<Gdk::Color> bgcolor;
00106             Gtk::TreeModelColumn<Gdk::Color> fgcolor;
00107             Gtk::TreeModelColumn<bool> checked;
00108             Gtk::TreeModelColumn<int> state;
00109     };
00110 
00111     ModelColumns m_Columns;             
00113     Gtk::TreeIter current_row;          
00114     Gtk::ScrolledWindow scrolled_window_;       
00115     Gtk::TreeView tree_view_;           
00116     Glib::RefPtr<Gtk::ListStore> m_refTreeModel;    
00117     KineticScroll kscroll;              
00119     struct  msgItem
00120     {
00121         UniSetTypes::ObjectId node_id;
00122         bool checked;
00123         int character;
00124         int current_value;
00125         Glib::ustring msg;
00126     };
00127 
00128     typedef std::map<UniSetTypes::ObjectId, msgItem > MessagesList;
00129     MessagesList msgLst;
00130 
00131     CheckConnection ch_conn;
00132 
00133     virtual void sensorInfo(UniSetTypes::SensorMessage *sm);
00134     virtual void askSensors(UniversalIO::UIOCommand cmd);
00135 
00136     void confirm(UMessages::MessageId id, time_t sec);          
00137     void blink(bool blink_state,int time, UMessages::MessageId id);     
00139     void startup_init();
00141     void recieve_message( UMessages::MessageId id, int wtype, time_t sec, Glib::ustring msg);
00143     void connect_confirm( UMessages::MessageId id );
00145     void set_pointer( UMessages::MessageId id );
00147     void remove_messages(UMessages::MessageId id,Gtk::TreeIter& start);
00148 
00149     void on_pic_title_changed();
00150     void on_time_title_changed();
00151     void on_text_title_changed();
00152     void on_confirm_title_changed();
00153     void on_pic_width_changed();
00154     void on_time_width_changed();
00155     void on_confirm_width_changed();
00156     void on_info_pic_changed();
00157     void on_warn_pic_changed();
00158     void on_alarm_pic_changed();
00159     void on_confirm1_pic_changed();
00160     void on_confirm2_pic_changed();
00161     void on_confirmed_pic_changed();
00163     void process_message(const UMessages::Message& message);
00164 //  /*! установить новый коннектор */
00165     virtual void set_connector(const ConnectorRef& connector) throw();
00166 //  /*! обработчик события появления связи с SharedMemory */
00167     virtual void on_connect() throw();
00168 //  /*! обработчик события пропадания связи с SharedMemory */
00169     virtual void on_disconnect() throw();
00170 };
00171 #endif