service_selector_cbe.h

00001
00002 /***************************************************************************
00003  *  service_selector_cbe.h - Manages list of discovered services of given type
00004  *
00005  *  Created: Mon Sep 29 17:34:58 2008
00006  *  Copyright  2008  Daniel Beck
00007  *             2008  Tim Niemueller [www.niemueller.de]
00008  *
00009  ****************************************************************************/
00010
00011 /*  This program is free software; you can redistribute it and/or modify
00012  *  it under the terms of the GNU General Public License as published by
00013  *  the Free Software Foundation; either version 2 of the License, or
00014  *  (at your option) any later version. A runtime exception applies to
00015  *  this software (see LICENSE.GPL_WRE file mentioned below for details).
00016  *
00017  *  This program is distributed in the hope that it will be useful,
00018  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00019  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020  *  GNU Library General Public License for more details.
00021  *
00022  *  Read the full text in the LICENSE.GPL_WRE file in the doc directory.
00023  */
00024
00025 #ifndef __LIBS_GUI_UTILS_SERVICE_SELECTOR_CBE_H_
00026 #define __LIBS_GUI_UTILS_SERVICE_SELECTOR_CBE_H_
00027 
00028 #include <netcomm/fawkes/client_handler.h>
00029
00030 #include <gtkmm.h>
00031 #include <libglademm/xml.h>
00032
00033 namespace fawkes {
00034 #if 0 /* just to make Emacs auto-indent happy */
00035 }
00036 #endif
00037 
00038 class FawkesNetworkClient;
00039 class ServiceModel;
00040 class ConnectionDispatcher;
00041
00042 class ServiceSelectorCBE
00043 {
00044  public:
00045   ServiceSelectorCBE( Gtk::ComboBoxEntry* services,
00046                       Gtk::Button* connect,
00047                       Gtk::Window* parent,
00048                       const char* service = "_fawkes._tcp" );
00049   ServiceSelectorCBE( Gtk::ComboBoxEntry* services,
00050                       Gtk::ToolButton* connect,
00051                       Gtk::Window* parent,
00052                       const char* service = "_fawkes._tcp" );
00053   ServiceSelectorCBE( Glib::RefPtr<Gnome::Glade::Xml> ref_xml,
00054                       const char* cbe_name = "cbeServices",
00055                       const char* btn_name = "btnConnect",
00056                       const char* wnd_name = "wndMain",
00057                       const char* service = "_fawkes._tcp" );
00058   virtual ~ServiceSelectorCBE();
00059
00060   FawkesNetworkClient* get_network_client();
00061   Glib::ustring get_hostname();
00062   Glib::ustring get_name();
00063   unsigned int get_port();
00064
00065   sigc::signal<void> signal_connected();
00066   sigc::signal<void> signal_disconnected();
00067
00068  protected:
00069   void initialize();
00070   void on_btn_connect_clicked();
00071   void on_service_selected();
00072   void on_connected();
00073   void on_disconnected();
00074
00075  protected:
00076   Gtk::ComboBoxEntry   *m_cbe_services;
00077   Gtk::Button          *m_btn_connect;
00078   Gtk::ToolButton      *m_tbtn_connect;
00079   Gtk::Window          *m_parent;
00080
00081   ConnectionDispatcher *m_dispatcher;
00082   ServiceModel         *m_service_model;
00083
00084  private:
00085    Glib::ustring  __hostname;
00086    Glib::ustring  __servicename;
00087    unsigned short __port;
00088 };
00089
00090 }
00091 #endif /* __LIBS_GUI_UTILS_SERVICE_SELECTOR_CBE_H_ */