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 CONEXUSGTKMMPORTENTRY_H 00020 #define CONEXUSGTKMMPORTENTRY_H 00021 00022 #include <gtkmm.h> 00023 #include <conexus.h> 00024 00025 #include <conexus-gtkmm/addresscontainer.h> 00026 00027 namespace Conexus 00028 { 00029 namespace Gtk 00030 { 00031 00036 class PortEntry : public AddressContainer, public ::Gtk::VBox 00037 { 00038 public: 00039 PortEntry ( unsigned validate = IPV4|IPV6 ); 00040 PortEntry ( Conexus::IPv4::Address& addr, unsigned validate = IPV4 ); 00041 PortEntry ( Conexus::IPv6::Address& addr, unsigned validate = IPV6 ); 00042 00043 ~PortEntry(); 00044 00045 ::Gtk::SpinButton& get_port_button(); 00046 ::Gtk::Adjustment& get_port_adjustment(); 00047 00048 uint32_t get_port(); 00049 void set_port ( uint32_t p ); 00050 00051 sigc::signal<void> signal_port_changed(); 00052 00053 bool get_show_servicename_label(); 00054 00055 void set_show_servicename_label ( bool show=true ); 00056 00057 protected: 00058 sigc::signal<void> m_signal_port_changed; 00059 00060 ::Gtk::SpinButton m_port; 00061 ::Gtk::Adjustment m_port_adjustment; 00062 ::Gtk::Label m_servicename_label; 00063 00064 virtual void on_port_changed(); 00065 00066 void on_spinbutton_text_entry ( const Glib::ustring & text, int * position ); 00067 void on_spinbutton_text_delete ( int start, int end ); 00068 00069 virtual void on_connect ( Conexus::IPv4::Address& address ); 00070 virtual void on_connect ( Conexus::IPv6::Address& address ); 00071 00072 virtual void on_validate_type_changed(); 00073 00074 private: 00075 void setup_widget(); 00076 00077 }; 00078 00079 } 00080 00081 } 00082 00083 #endif