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 #ifdef HAVE_GLADEMM
00032 #  include <libglademm/xml.h>
00033 #endif
00034 
00035 namespace fawkes {
00036 #if 0 /* just to make Emacs auto-indent happy */
00037 }
00038 #endif
00039 
00040 class FawkesNetworkClient;
00041 class ServiceModel;
00042 class ConnectionDispatcher;
00043 
00044 class ServiceSelectorCBE
00045 {
00046  public:
00047   ServiceSelectorCBE( Gtk::ComboBoxEntry* services,
00048                       Gtk::Button* connect,
00049                       Gtk::Window* parent,
00050                       const char* service = "_fawkes._tcp" );
00051   ServiceSelectorCBE( Gtk::ComboBoxEntry* services,
00052                       Gtk::ToolButton* connect,
00053                       Gtk::Window* parent,
00054                       const char* service = "_fawkes._tcp" );
00055 #ifdef HAVE_GLADEMM
00056   ServiceSelectorCBE( Glib::RefPtr<Gnome::Glade::Xml> ref_xml,
00057                       const char* cbe_name = "cbeServices",
00058                       const char* btn_name = "btnConnect",
00059                       const char* wnd_name = "wndMain",
00060                       const char* service = "_fawkes._tcp" );
00061 #endif
00062   virtual ~ServiceSelectorCBE();
00063 
00064   FawkesNetworkClient* get_network_client();
00065   Glib::ustring get_hostname();
00066   Glib::ustring get_name();
00067   unsigned int get_port();
00068 
00069   sigc::signal<void> signal_connected();
00070   sigc::signal<void> signal_disconnected();
00071 
00072  protected:
00073   void initialize();
00074   void on_btn_connect_clicked();
00075   void on_service_selected();
00076   void on_connected();
00077   void on_disconnected();
00078 
00079  protected:
00080   Gtk::ComboBoxEntry   *m_cbe_services;
00081   Gtk::Button          *m_btn_connect;
00082   Gtk::ToolButton      *m_tbtn_connect;
00083   Gtk::Window          *m_parent;
00084 
00085   ConnectionDispatcher *m_dispatcher;
00086   ServiceModel         *m_service_model;
00087 
00088  private:
00089    Glib::ustring  __hostname;
00090    Glib::ustring  __servicename;
00091    unsigned short __port;
00092 };
00093 
00094 }
00095 #endif /* __LIBS_GUI_UTILS_SERVICE_SELECTOR_CBE_H_ */

Generated on Tue Feb 22 13:32:27 2011 for Fawkes API by  doxygen 1.4.7