00001 /*************************************************************************** 00002 * Copyright (C) 2001 by Rick L. Vinyard, Jr. * 00003 * rvinyard@cs.nmsu.edu * 00004 * * 00005 * This program is free software; you can redistribute it and/or modify * 00006 * it under the terms of the GNU Lesser General Public License as * 00007 * published by the Free Software Foundation version 2.1. * 00008 * * 00009 * This program is distributed in the hope that it will be useful, * 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00012 * GNU General Public License for more details. * 00013 * * 00014 * You should have received a copy of the GNU Lesser General Public * 00015 * License along with this library; if not, write to the * 00016 * Free Software Foundation, Inc., * 00017 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * 00018 ***************************************************************************/ 00019 #ifndef CONEXUSMMENDPOINTSTOPBUTTON_H 00020 #define CONEXUSMMENDPOINTSTOPBUTTON_H 00021 00022 #include <map> 00023 #include <gtkmm.h> 00024 00025 #include <conexus/endpoint.h> 00026 00027 namespace ConexusGtk 00028 { 00029 00037 class EndpointStopButton : public Gtk::CheckButton 00038 { 00039 public: 00040 00045 EndpointStopButton( bool show_text = true, bool show_image = true ); 00046 00048 ~EndpointStopButton(); 00049 00056 void connect( Conexus::Endpoint& io, bool control_read = true, bool control_write = true ); 00057 00061 void disconnect( Conexus::Endpoint& io ); 00062 00064 const Glib::ustring& start_text(); 00065 00067 const Glib::ustring& stop_text(); 00068 00073 void set_start_text( const Glib::ustring& text ); 00074 00078 void set_start_text_to_default(); 00079 00084 void set_stop_text( const Glib::ustring& text ); 00085 00089 void set_stop_text_to_default(); 00090 00092 bool is_text_visible(); 00093 00095 void show_text( ); 00096 00098 void hide_text(); 00099 00101 const Gtk::Image& start_image(); 00102 00104 const Gtk::Image& stop_image(); 00105 00107 void set_start_image( Gtk::Image& image ); 00108 00110 void set_start_image_to_default(); 00111 00113 void set_stop_image( Gtk::Image& image ); 00114 00116 void set_stop_image_to_default(); 00117 00119 bool is_image_visible(); 00120 00122 void show_image( ); 00123 00125 void hide_image( ); 00126 00127 protected: 00129 Gtk::HBox m_hbox; 00130 00132 Gtk::EventBox m_imagebox; 00133 00135 Gtk::Label m_text; 00136 00138 Glib::ustring m_start_text; 00139 00141 Glib::ustring m_stop_text; 00142 00144 Gtk::Image* m_start_image; 00145 00147 Gtk::Image m_default_start_image; 00148 00150 Gtk::Image* m_stop_image; 00151 00153 Gtk::Image m_default_stop_image; 00154 00156 typedef std::set<Conexus::Endpoint*> Controlled; 00157 00159 Controlled m_read_control; 00160 00162 Controlled m_write_control; 00163 00165 void on_button_toggled(); 00166 00168 void update_display( ); 00169 00170 }; 00171 00172 } 00173 00174 #endif