UniImageButton.h
00001 #ifndef _UniImageButton_H_
00002 #define _UniImageButton_H_
00003
00004 #include "GeneralUI.h"
00005
00006 namespace UniSetGraphics
00007 {
00008
00009 class UniImageButton: public GeneralUI
00010 {
00011 public:
00012 UniImageButton(string pictireFile, string name = "", bool toggle = true, string font_descr = "Arial Bold 12",
00013 guint x_pad = 0, guint y_pad = 0,
00014 Gtk::AttachOptions x_opt = Gtk::FILL|Gtk::EXPAND,
00015 Gtk::AttachOptions y_opt = Gtk::FILL|Gtk::EXPAND );
00016
00017 UniImageButton(bool use_eventbox, string pictireFile, string name = "", bool toggle = true, string font_descr = "Arial Bold 12",
00018 guint x_pad = 0, guint y_pad = 0,
00019 Gtk::AttachOptions x_opt = Gtk::FILL|Gtk::EXPAND,
00020 Gtk::AttachOptions y_opt = Gtk::FILL|Gtk::EXPAND );
00021
00022 UniImageButton();
00023 virtual ~UniImageButton(){};
00024
00025 virtual void on();
00026 virtual void off();
00027 virtual void blink(int timeout = 300);
00028 virtual bool blink_handler();
00029 virtual void button_out(){};
00030
00031 void set_images_path(string path){this->path = path;}
00032 void set_on_state(string on_state);
00033 void set_off_state(string off_state);
00034 void blink(string on_state, string off_state, int timeout = 300);
00035 void set_state(string state);
00036 string get_state();
00037 Gtk::Button *get_button(){return btn;}
00038 Gtk::Image *get_image(){return img;}
00039 Gtk::ToggleButton *get_button_as_toggle(){return static_cast<Gtk::ToggleButton*>(btn);}
00040 Gtk::Fixed* get_place(){return fixed;}
00041 Gtk::EventBox* get_eventbox(){return ebox;}
00042 bool is_toggled(){return toggle;}
00043
00044 protected:
00045
00046 private:
00047 Gtk::Image *img;
00048 Gtk::Button *btn;
00049 Gtk::Fixed *fixed;
00050 Gtk::EventBox *ebox;
00051
00052 string state;
00053 string off_state;
00054 string on_state;
00055 string path;
00056 bool toggle;
00057 };
00058
00059 }
00060
00061 #endif // _UniImageButton_H_