UJournal.h
00001 #ifndef _UJOURNAL_H
00002 #define _UJOURNAL_H
00003
00004 #include <gtkmm.h>
00005 #include <time.h>
00006 #include "UEventBox.h"
00007 #include "USignals.h"
00008 #include "KineticScroll.h"
00009 #include <global_macros.h>
00010 #include <plugins.h>
00011
00012 class msgItem;
00014 class JournalColumnRecord : public Gtk::TreeModel::ColumnRecord
00015 {
00016 public:
00017
00018 JournalColumnRecord()
00019 {
00020 add(icon);
00021 add(time_string);
00022 add(text_message);
00023 add(confirm_time);
00024 add(id);
00025 add(time);
00026 add(bgcolor);
00027 add(fgcolor);
00028 add(wtype);
00029 }
00030
00031 Gtk::TreeModelColumn< Glib::RefPtr<Gdk::Pixbuf> > icon;
00032 Gtk::TreeModelColumn<Glib::ustring> time_string;
00033 Gtk::TreeModelColumn<Glib::ustring> text_message;
00034 Gtk::TreeModelColumn<Glib::ustring> confirm_time;
00035 Gtk::TreeModelColumn<UMessages::MessageId> id;
00036 Gtk::TreeModelColumn<time_t> time;
00037 Gtk::TreeModelColumn<Gdk::Color> bgcolor;
00038 Gtk::TreeModelColumn<Gdk::Color> fgcolor;
00039 Gtk::TreeModelColumn<int> wtype;
00040 };
00041
00054 class UJournal : public UEventBox
00055 {
00056 public:
00057 UJournal();
00058 explicit UJournal(GtkmmBaseType::BaseObjectType* gobject);
00059 virtual ~UJournal();
00060
00061 virtual void set_connector(const ConnectorRef& connector) throw();
00062 virtual void on_connect() throw();
00063 virtual void on_disconnect() throw();
00065 sigc::signal< bool , Glib::ustring > print_;
00066
00067 static std::string timeToString(time_t tm=time(0), std::string brk="");
00068 static std::string dateToString(time_t tm=time(0), std::string brk="");
00069 static bool createDir( const std::string dir );
00070 void timeToInt(long time,int &hour, int &min, int &sec, time_t tm=time(0));
00072 protected:
00074 virtual void process_message(const UMessages::Message& message);
00076 void enable_cleaner();
00078 bool removeOldEntries();
00080 bool removeFirst();
00082 void recieve_message(UMessages::MessageId id, int wtype, time_t sec, Glib::ustring msg);
00083 void process_confirm(UMessages::MessageId id, time_t);
00085 void confirm(UMessages::MessageId id, time_t sec);
00087 void blink(bool blink_state, int time, UMessages::MessageId id);
00089 void connect_confirm( UMessages::MessageId id );
00091 void set_pointer( UMessages::MessageId id );
00092
00093 virtual void on_realize();
00094 sigc::connection cleaner_connection_;
00095 sigc::connection blink_connection_;
00096
00097 typedef std::map<UniSetTypes::ObjectId, msgItem> MessagesList;
00098 MessagesList msg_list_;
00099
00100 Gtk::TreeView tree_view_;
00101 Glib::RefPtr<Gtk::ListStore> tree_model_ref_;
00102
00103 ADD_PROPERTY( prop_enableHisory, bool )
00104 ADD_PROPERTY( prop_history_code_page, Glib::ustring )
00105 ADD_PROPERTY( prop_dir, Glib::ustring )
00106 Glib::Property<Glib::ustring> property_pic_title;
00107 Glib::Property<Glib::ustring> property_time_title;
00108 Glib::Property<Glib::ustring> property_text_title;
00109 Glib::Property<Glib::ustring> property_confirm_title;
00111 Glib::Property<int> property_pic_width;
00112 Glib::Property<int> property_time_width;
00113 Glib::Property<int> property_text_width;
00114 Glib::Property<int> property_confirm_width;
00116 Glib::Property<std::string> property_info_pic;
00117 Glib::Property<std::string> property_warn_pic;
00118 Glib::Property<std::string> property_alarm_pic;
00119 Glib::Property<std::string> property_attention_pic;
00120 Glib::Property<std::string> property_confirm1_pic;
00121 Glib::Property<std::string> property_confirm2_pic;
00122 Glib::Property<std::string> property_confirmed_pic;
00124 Glib::Property<Gdk::Color> property_info_color;
00125 Glib::Property<Gdk::Color> property_warn_color;
00126 Glib::Property<Gdk::Color> property_alarm_color;
00127 Glib::Property<Gdk::Color> property_attention_color;
00128 ADD_PROPERTY(property_bg_first_color, Gdk::Color)
00129 ADD_PROPERTY(property_bg_second_color, Gdk::Color)
00131 Glib::Property<double> max_life_time;
00132 Glib::Property<double> property_max_items;
00133 Glib::Property<bool> print_info_message;
00134 Glib::Property<bool> property_dbserver_on;
00136 Glib::RefPtr<Gdk::Pixbuf> refPixInfo;
00137 Glib::RefPtr<Gdk::Pixbuf> refPixWarn;
00138 Glib::RefPtr<Gdk::Pixbuf> refPixAlarm;
00139 Glib::RefPtr<Gdk::Pixbuf> refPixAttention;
00140 Glib::RefPtr<Gdk::Pixbuf> refPixConfirm1;
00141 Glib::RefPtr<Gdk::Pixbuf> refPixConfirm2;
00142 Glib::RefPtr<Gdk::Pixbuf> refPixConfirmed;
00144 JournalColumnRecord columns_;
00146 Gtk::ScrolledWindow scrolled_window_;
00148 KineticScroll kscroll;
00150 std::string history_file_fullname;
00151 Gtk::CheckButton*butHistory;
00152 void butHistory_clicked();
00153
00154 private:
00155 void ctor();
00156
00157 bool on_search_noconfiredID(const Gtk::TreeIter& it,
00158 const Gtk::TreeRow& row,
00159 const UMessages::Message& message);
00160
00161 bool on_search_noconfired(const Gtk::TreeIter& it);
00162
00163 void on_foreach(const Gtk::TreeIter& it,const UMessages::MessageId& id,const time_t& sec);
00164
00165 void on_blink_foreach(const Gtk::TreeIter& it,
00166 const UMessages::MessageId& id,
00167 const Glib::RefPtr<Gdk::Pixbuf>& pix);
00168 bool has_any_not_confirmed;
00169
00170 void on_history_enable_changed();
00171 void on_history_dir_changed();
00172 void on_pic_title_changed();
00173 void on_time_title_changed();
00174 void on_text_title_changed();
00175 void on_confirm_title_changed();
00176 void on_pic_width_changed();
00177 void on_time_width_changed();
00178 void on_confirm_width_changed();
00179 void on_info_pic_changed();
00180 void on_warn_pic_changed();
00181 void on_alarm_pic_changed();
00182 void on_attention_pic_changed();
00183 void on_confirm1_pic_changed();
00184 void on_confirm2_pic_changed();
00185 void on_confirmed_pic_changed();
00186
00187 void try_load_pic( Glib::RefPtr<Gdk::Pixbuf>& refPix, std::string pic );
00188
00189 };
00190 #endif