Fawkes API  Fawkes Development Version
service_selector_cbe.h
1 
2 /***************************************************************************
3  * service_selector_cbe.h - Manages list of discovered services of given type
4  *
5  * Created: Mon Sep 29 17:34:58 2008
6  * Copyright 2008 Daniel Beck
7  * 2008 Tim Niemueller [www.niemueller.de]
8  *
9  ****************************************************************************/
10 
11 /* This program is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation; either version 2 of the License, or
14  * (at your option) any later version. A runtime exception applies to
15  * this software (see LICENSE.GPL_WRE file mentioned below for details).
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU Library General Public License for more details.
21  *
22  * Read the full text in the LICENSE.GPL_WRE file in the doc directory.
23  */
24 
25 #ifndef _LIBS_GUI_UTILS_SERVICE_SELECTOR_CBE_H_
26 #define _LIBS_GUI_UTILS_SERVICE_SELECTOR_CBE_H_
27 
28 #include <netcomm/fawkes/client_handler.h>
29 
30 #include <gtkmm.h>
31 #ifdef HAVE_GLADEMM
32 # include <libglademm/xml.h>
33 #endif
34 
35 namespace fawkes {
36 
37 class FawkesNetworkClient;
38 class ServiceModel;
39 class ConnectionDispatcher;
40 
41 class ServiceSelectorCBE
42 {
43 public:
44 #if GTK_VERSION_GE(3, 0)
45  ServiceSelectorCBE(Gtk::ComboBox *services,
46  Gtk::Button * connect,
47  Gtk::Window * parent,
48  const char * service = "_fawkes._tcp");
49  ServiceSelectorCBE(Gtk::ComboBox * services,
50  Gtk::ToolButton *connect,
51  Gtk::Window * parent,
52  const char * service = "_fawkes._tcp");
53 #else
54  ServiceSelectorCBE(Gtk::ComboBoxEntry *services,
55  Gtk::Button * connect,
56  Gtk::Window * parent,
57  const char * service = "_fawkes._tcp");
58  ServiceSelectorCBE(Gtk::ComboBoxEntry *services,
59  Gtk::ToolButton * connect,
60  Gtk::Window * parent,
61  const char * service = "_fawkes._tcp");
62 #endif
63  ServiceSelectorCBE(Glib::RefPtr<Gtk::Builder> builder,
64  const char * cbe_name = "cbeServices",
65  const char * btn_name = "btnConnect",
66  const char * wnd_name = "wndMain",
67  const char * service = "_fawkes._tcp");
68  virtual ~ServiceSelectorCBE();
69 
71  Glib::ustring get_hostname();
72  Glib::ustring get_name();
73  unsigned int get_port();
74 
75  sigc::signal<void> signal_connected();
76  sigc::signal<void> signal_disconnected();
77 
78 protected:
79  void initialize();
81  void on_service_selected();
82  void on_connected();
83  void on_disconnected();
84 
85 protected:
86 #if GTK_VERSION_GE(3, 0)
87  Gtk::ComboBox *m_cbe_services;
88 #else
89  Gtk::ComboBoxEntry *m_cbe_services;
90 #endif
91  Gtk::Button * m_btn_connect;
92  Gtk::ToolButton *m_tbtn_connect;
93  Gtk::Window * m_parent;
94 
97 
98 private:
99  Glib::ustring hostname_;
100  Glib::ustring servicename_;
101  unsigned short port_;
102 };
103 
104 } // namespace fawkes
105 #endif /* LIBS_GUI_UTILS_SERVICE_SELECTOR_CBE_H__ */
fawkes::ServiceSelectorCBE::~ServiceSelectorCBE
virtual ~ServiceSelectorCBE()
Destructor.
Definition: service_selector_cbe.cpp:190
fawkes::ServiceSelectorCBE::on_disconnected
void on_disconnected()
Signal handler for the connection terminated signal.
Definition: service_selector_cbe.cpp:360
fawkes::ServiceSelectorCBE::signal_disconnected
sigc::signal< void > signal_disconnected()
This signal is emitted whenever a network connection is terminated.
Definition: service_selector_cbe.cpp:248
fawkes::ServiceSelectorCBE::on_btn_connect_clicked
void on_btn_connect_clicked()
Signal handler that is called whenever the connect button is clicked or an entry in the combo box is ...
Definition: service_selector_cbe.cpp:257
fawkes::ServiceSelectorCBE::m_parent
Gtk::Window * m_parent
Definition: service_selector_cbe.h:100
fawkes::ServiceSelectorCBE::m_service_model
ServiceModel * m_service_model
Definition: service_selector_cbe.h:103
fawkes::ServiceSelectorCBE::get_name
Glib::ustring get_name()
Returns the currently selected service name (after connect)
Definition: service_selector_cbe.cpp:220
fawkes::ServiceSelectorCBE::on_service_selected
void on_service_selected()
Signal handler that is called whenever an entry is selected from the combo box.
Definition: service_selector_cbe.cpp:315
fawkes::ServiceSelectorCBE::get_hostname
Glib::ustring get_hostname()
Returns the currently selected hostname (after connect)
Definition: service_selector_cbe.cpp:210
fawkes::ServiceModel
Definition: service_model.h:41
fawkes::ServiceSelectorCBE::initialize
void initialize()
Initializer method.
Definition: service_selector_cbe.cpp:141
fawkes::ServiceSelectorCBE::get_port
unsigned int get_port()
Returns the currently used port (after connect)
Definition: service_selector_cbe.cpp:230
fawkes::ConnectionDispatcher
Definition: connection_dispatcher.h:44
fawkes
fawkes::ServiceSelectorCBE::ServiceSelectorCBE
ServiceSelectorCBE(Gtk::ComboBoxEntry *services, Gtk::Button *connect, Gtk::Window *parent, const char *service="_fawkes._tcp")
Construtor.
Definition: service_selector_cbe.cpp:76
fawkes::ServiceSelectorCBE::m_cbe_services
Gtk::ComboBoxEntry * m_cbe_services
Definition: service_selector_cbe.h:96
fawkes::ServiceSelectorCBE::m_dispatcher
ConnectionDispatcher * m_dispatcher
Definition: service_selector_cbe.h:102
fawkes::ServiceSelectorCBE::m_btn_connect
Gtk::Button * m_btn_connect
Definition: service_selector_cbe.h:98
fawkes::ServiceSelectorCBE::get_network_client
FawkesNetworkClient * get_network_client()
Access the current network client.
Definition: service_selector_cbe.cpp:200
fawkes::ServiceSelectorCBE::signal_connected
sigc::signal< void > signal_connected()
This signal is emitted whenever a network connection is established.
Definition: service_selector_cbe.cpp:239
fawkes::ServiceSelectorCBE::m_tbtn_connect
Gtk::ToolButton * m_tbtn_connect
Definition: service_selector_cbe.h:99
fawkes::FawkesNetworkClient
Definition: client.h:57
fawkes::ServiceSelectorCBE::on_connected
void on_connected()
Signal handler for the connection established signal.
Definition: service_selector_cbe.cpp:349