UniWidgets  1.0.0
UJournal.h
00001 #ifndef _UJOURNAL_H
00002 #define _UJOURNAL_H
00003 // -------------------------------------------------------------------------
00004 #include <gtkmm.h>
00005 #include <time.h>
00006 #include <uwidgets/UEventBox.h>
00007 #include <uniwidgets/USignals.h>
00008 #include <uwidgets/KineticScroll.h>
00009 #include <plugins.h>
00010 // -------------------------------------------------------------------------
00011 class msgItem;
00013 class JournalColumnRecord : public Gtk::TreeModel::ColumnRecord
00014     {
00015     public:
00016 
00017         JournalColumnRecord()
00018         {
00019             add(icon);
00020             add(time_string);
00021             add(text_message);
00022             add(confirm_time);
00023             add(id);
00024             add(time);
00025             add(bgcolor);
00026             add(fgcolor);
00027             add(wtype);
00028         }
00029 
00030         Gtk::TreeModelColumn< Glib::RefPtr<Gdk::Pixbuf> > icon;
00031         Gtk::TreeModelColumn<Glib::ustring> time_string;
00032         Gtk::TreeModelColumn<Glib::ustring> text_message;
00033         Gtk::TreeModelColumn<Glib::ustring> confirm_time;
00034         Gtk::TreeModelColumn<UMessages::MessageId> id;
00035         Gtk::TreeModelColumn<time_t> time;
00036         Gtk::TreeModelColumn<Gdk::Color> bgcolor;
00037         Gtk::TreeModelColumn<Gdk::Color> fgcolor;
00038         Gtk::TreeModelColumn<int> wtype;
00039     };
00040 // -------------------------------------------------------------------------
00053 class UJournal : public UEventBox
00054 {
00055 public:
00056     UJournal();
00057     explicit UJournal(GtkmmBaseType::BaseObjectType* gobject);
00058     virtual ~UJournal();
00059 
00060     virtual void set_connector(const ConnectorRef& connector) throw();
00061     virtual void on_connect() throw();
00062     virtual void on_disconnect() throw();
00064     sigc::signal< bool , Glib::ustring > print_;
00065 protected:
00067     virtual void process_message(const UMessages::Message& message);
00069     void enable_cleaner();
00071     bool removeOldEntries();
00073     bool removeFirst();
00075     void recieve_message(UMessages::MessageId id, int wtype, time_t sec, Glib::ustring msg);
00076     void process_confirm(UMessages::MessageId id, time_t);
00078     void confirm(UMessages::MessageId id, time_t sec);
00080     void blink(bool blink_state, int time, UMessages::MessageId id);
00082     void connect_confirm( UMessages::MessageId id );
00084     void set_pointer( UMessages::MessageId id );
00085 
00086     sigc::connection cleaner_connection_;
00087     sigc::connection blink_connection_;
00088 
00089     typedef std::map<UniSetTypes::ObjectId, msgItem> MessagesList;
00090     MessagesList msg_list_;
00091 
00092     Gtk::TreeView tree_view_;               
00093     Glib::RefPtr<Gtk::ListStore> tree_model_ref_;       
00094     /*Properties*/
00095     Glib::Property<Glib::ustring> property_pic_title;   
00096     Glib::Property<Glib::ustring> property_time_title;  
00097     Glib::Property<Glib::ustring> property_text_title;  
00098     Glib::Property<Glib::ustring> property_confirm_title;   
00100     Glib::Property<int> property_pic_width;         
00101     Glib::Property<int> property_time_width;        
00102     Glib::Property<int> property_text_width;        
00103     Glib::Property<int> property_confirm_width;     
00105     Glib::Property<std::string> property_info_pic;      
00106     Glib::Property<std::string> property_warn_pic;      
00107     Glib::Property<std::string> property_alarm_pic;     
00108     Glib::Property<std::string> property_attention_pic; 
00109     Glib::Property<std::string> property_confirm1_pic;  
00110     Glib::Property<std::string> property_confirm2_pic;  
00111     Glib::Property<std::string> property_confirmed_pic; 
00113     Glib::Property<Gdk::Color> property_info_color;     
00114     Glib::Property<Gdk::Color> property_warn_color;     
00115     Glib::Property<Gdk::Color> property_alarm_color;    
00116     Glib::Property<Gdk::Color> property_attention_color;    
00118     Glib::Property<double> max_life_time;           
00119     Glib::Property<double> property_max_items;      
00120     Glib::Property<bool> print_info_message;        
00121     Glib::Property<bool> property_dbserver_on;      
00123     Glib::RefPtr<Gdk::Pixbuf> refPixInfo;           
00124     Glib::RefPtr<Gdk::Pixbuf> refPixWarn;           
00125     Glib::RefPtr<Gdk::Pixbuf> refPixAlarm;          
00126     Glib::RefPtr<Gdk::Pixbuf> refPixAttention;      
00127     Glib::RefPtr<Gdk::Pixbuf> refPixConfirm1;       
00128     Glib::RefPtr<Gdk::Pixbuf> refPixConfirm2;       
00129     Glib::RefPtr<Gdk::Pixbuf> refPixConfirmed;      
00131     JournalColumnRecord columns_;               
00133     Gtk::ScrolledWindow scrolled_window_;           
00135     KineticScroll kscroll;                  
00137 private:
00138     void ctor();
00139 
00140     bool on_search_noconfiredID(const Gtk::TreeIter& it,
00141                     const Gtk::TreeRow& row,
00142                     const UMessages::Message& message);
00143 
00144     bool on_search_noconfired(const Gtk::TreeIter& it);
00145 
00146     void on_foreach(const Gtk::TreeIter& it,const UMessages::MessageId& id,const time_t& sec);
00147 
00148     void on_blink_foreach(const Gtk::TreeIter& it,
00149                           const UMessages::MessageId& id,
00150                           const Glib::RefPtr<Gdk::Pixbuf>& pix);
00151     bool has_any_not_confirmed;
00152 
00153     void on_pic_title_changed();
00154     void on_time_title_changed();
00155     void on_text_title_changed();
00156     void on_confirm_title_changed();
00157     void on_pic_width_changed();
00158     void on_time_width_changed();
00159     void on_confirm_width_changed();
00160     void on_info_pic_changed();
00161     void on_warn_pic_changed();
00162     void on_alarm_pic_changed();
00163     void on_attention_pic_changed();
00164     void on_confirm1_pic_changed();
00165     void on_confirm2_pic_changed();
00166     void on_confirmed_pic_changed();
00167 
00168     void try_load_pic( Glib::RefPtr<Gdk::Pixbuf>& refPix, std::string pic );
00169 
00170 };
00171 #endif