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 #include <conexus-gtkmm/enums.h> 00026 00027 namespace Conexus 00028 { 00029 namespace Gtk 00030 { 00031 00037 class HostEntry : public ::Gtk::VBox 00038 { 00039 public: 00040 HostEntry( unsigned lookup = LOOKUP_IPV4|LOOKUP_IPV6 ); 00041 HostEntry( IPAddressInterface* addr, unsigned lookup = LOOKUP_IPV4|LOOKUP_IPV6 ); 00042 HostEntry( IPAddressInterface::pointer addr, unsigned lookup = LOOKUP_IPV4|LOOKUP_IPV6 ); 00043 HostEntry( IPv4::Address& address, unsigned lookup = LOOKUP_IPV4|LOOKUP_IPV6 ); 00044 HostEntry( IPv6::Address& address, unsigned lookup = LOOKUP_IPV4|LOOKUP_IPV6 ); 00045 00046 ~HostEntry(); 00047 00048 IPAddressInterface* address(); 00049 00050 void set_address( IPAddressInterface* addr, unsigned lookup = LOOKUP_IPV4 ); 00051 void set_address( IPAddressInterface::pointer addr, unsigned lookup = LOOKUP_IPV4 ); 00052 void set_address( IPv4::Address& addr, unsigned lookup = LOOKUP_IPV4 ); 00053 void set_address( IPv6::Address& addr, unsigned lookup = LOOKUP_IPV6 ); 00054 00055 void unset_address(); 00056 00057 ::Gtk::ComboBoxEntryText& host_widget(); 00058 ::Gtk::Image& good_host_image(); 00059 ::Gtk::Image& bad_host_image(); 00060 std::string host(); 00061 void set_host( const std::string& s ); 00062 00063 bool is_hostname_label_visible(); 00064 bool is_host_label_visible(); 00065 bool is_host_image_visible(); 00066 00067 void show_hostname_label ( bool show=true ); 00068 void show_host_label ( bool show=true ); 00069 void show_host_image ( bool show=true ); 00070 00071 ::Gtk::Button& apply_button(); 00072 00073 bool is_immediate_apply_enabled(); 00074 00075 void enable_immediate_apply( bool enable=true ); 00076 00077 void apply(); 00078 00079 protected: 00080 IPAddressInterface* m_address; 00081 00082 unsigned m_lookup; 00083 bool m_immediate_apply; 00084 00085 sigc::connection m_conn_address_host; 00086 00087 sigc::connection m_host_widget_connection; 00088 00089 ::Gtk::Label m_hostname_label; 00090 ::Gtk::Label m_host_label; 00091 ::Gtk::ComboBoxEntryText m_host_widget; 00092 ::Gtk::EventBox m_image_holder; 00093 ::Gtk::Image m_good_host_image; 00094 ::Gtk::Image m_bad_host_image; 00095 ::Gtk::Button m_apply_button; 00096 00097 virtual void on_controlled_host_changed(); 00098 00099 virtual void on_host_widget_changed(); 00100 00101 private: 00102 void setup_widget(); 00103 00104 }; 00105 00106 } 00107 00108 } 00109 00110 #endif