endpointstopbutton.h

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 
00054       void connect( Conexus::Endpoint& io );
00055       
00059       void disconnect( Conexus::Endpoint& io );
00060 
00062       const Glib::ustring& start_text();
00063       
00065       const Glib::ustring& stop_text();
00066 
00071       void set_start_text( const Glib::ustring& text );
00072       
00076       void set_start_text_to_default();
00077 
00082       void set_stop_text( const Glib::ustring& text );
00083       
00087       void set_stop_text_to_default();
00088 
00090       bool is_text_visible();
00091       
00093       void show_text( );
00094       
00096       void hide_text();
00097 
00099       const Gtk::Image& start_image();
00100       
00102       const Gtk::Image& stop_image();
00103 
00105       void set_start_image( Gtk::Image& image );
00106       
00108       void set_start_image_to_default();
00109 
00111       void set_stop_image( Gtk::Image& image );
00112       
00114       void set_stop_image_to_default();
00115 
00117       bool is_image_visible();
00118       
00120       void show_image( );
00121       
00123       void hide_image( );
00124 
00125     protected:
00127       Gtk::HBox m_hbox;
00128       
00130       Gtk::EventBox m_imagebox;
00131 
00133       Gtk::Label m_text;
00134 
00136       Glib::ustring m_start_text;
00137       
00139       Glib::ustring m_stop_text;
00140       
00142       Gtk::Image* m_start_image;
00143       
00145       Gtk::Image m_default_start_image;
00146       
00148       Gtk::Image* m_stop_image;
00149       
00151       Gtk::Image m_default_stop_image;
00152 
00154       typedef std::set<Conexus::Endpoint*> Controlled;
00155       
00157       Controlled m_controlled;
00158       
00160       void on_button_toggled();
00161 
00163       void update_display( );
00164 
00165   };
00166 
00167 }
00168 
00169 #endif

Generated on Sun Mar 11 10:01:08 2007 by  doxygen 1.5.1