00001 /*************************************************************************** 00002 * Copyright (C) 2001 by Rick L. Vinyard, Jr. * 00003 * rvinyard@cs.nmsu.edu * 00004 * * 00005 * This file is part of the conexus library. * 00006 * * 00007 * The conexus library is free software; you can redistribute it and/or * 00008 * modify it under the terms of the GNU General Public License * 00009 * version 3 as published by the Free Software Foundation. * 00010 * * 00011 * The conexus library is distributed in the hope that it will be * 00012 * useful, but WITHOUT ANY WARRANTY; without even the implied warranty * 00013 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 00014 * General Public License for more details. * 00015 * * 00016 * You should have received a copy of the GNU General Public License * 00017 * along with this software. If not see <http://www.gnu.org/licenses/>. * 00018 ***************************************************************************/ 00019 #ifndef CONEXUSGTKMMHOSTENTRY_H 00020 #define CONEXUSGTKMMHOSTENTRY_H 00021 00022 #include <string> 00023 #include <gtkmm.h> 00024 #include <conexus.h> 00025 00026 #include <conexus-gtkmm/addresscontainer.h> 00027 00028 namespace Conexus 00029 { 00030 namespace Gtk 00031 { 00032 00038 class HostEntry : public AddressContainer, public ::Gtk::VBox 00039 { 00040 public: 00041 HostEntry ( unsigned validate = IPV4|IPV6 ); 00042 HostEntry ( Conexus::IPv4::Address& address, unsigned validate = IPV4 ); 00043 HostEntry ( Conexus::IPv6::Address& address, unsigned validate = IPV6 ); 00044 00045 ~HostEntry(); 00046 00047 void set_hostname ( std::string s ); 00048 00049 ::Gtk::ComboBoxEntryText& get_hostname_box(); 00050 ::Gtk::Image& get_good_hostname_image(); 00051 ::Gtk::Image& get_bad_hostname_image(); 00052 00053 std::string get_hostname(); 00054 sigc::signal<void, bool> signal_host_changed(); 00055 00056 bool get_show_hostname_label(); 00057 bool get_show_address_label(); 00058 bool get_show_host_image(); 00059 00060 void set_show_hostname_label ( bool show=true ); 00061 void set_show_address_label ( bool show=true ); 00062 void set_show_host_image ( bool show=true ); 00063 00064 protected: 00065 bool m_change_lock; 00066 std::set<std::string> m_host_names; 00067 sigc::connection m_address_connection; 00068 00069 ::Gtk::Label m_hostname_label; 00070 ::Gtk::Label m_address_label; 00071 ::Gtk::ComboBoxEntryText m_host; 00072 ::Gtk::EventBox m_image_holder; 00073 ::Gtk::Image m_good_host_image; 00074 ::Gtk::Image m_bad_host_image; 00075 00076 sigc::signal<void, bool> m_signal_host_changed; 00077 00078 virtual void on_hostname_changed(); 00079 00080 virtual void on_connect ( Conexus::IPv4::Address& address ); 00081 virtual void on_connect ( Conexus::IPv6::Address& address ); 00082 00083 virtual void on_validate_type_changed(); 00084 00085 00086 private: 00087 void setup_widget(); 00088 00089 }; 00090 00091 } 00092 00093 } 00094 00095 #endif