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