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
35namespace fawkes {
36
37class FawkesNetworkClient;
38class ServiceModel;
39class ConnectionDispatcher;
40
42{
43public:
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
78protected:
79 void initialize();
82 void on_connected();
83 void on_disconnected();
84
85protected:
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
98private:
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__ */
Watches network client events and dispatches them as signals.
Simple Fawkes network client.
Definition: client.h:52
Abstract base class for widgets that allow to view the detected services of a certain type.
Definition: service_model.h:36
This widget consists of a Gtk::ComboBox and a Gtk::Button.
void on_btn_connect_clicked()
Signal handler that is called whenever the connect button is clicked or an entry in the combo box is ...
void initialize()
Initializer method.
Glib::ustring get_name()
Returns the currently selected service name (after connect)
void on_disconnected()
Signal handler for the connection terminated signal.
Gtk::Window * m_parent
The parent Gtk::Window.
void on_connected()
Signal handler for the connection established signal.
Gtk::ToolButton * m_tbtn_connect
A Gtk::ToolButton that triggers the connection.
Gtk::Button * m_btn_connect
A Gtk::Button that triggers the connection.
ServiceSelectorCBE(Gtk::ComboBoxEntry *services, Gtk::Button *connect, Gtk::Window *parent, const char *service="_fawkes._tcp")
Construtor.
unsigned int get_port()
Returns the currently used port (after connect)
sigc::signal< void > signal_connected()
This signal is emitted whenever a network connection is established.
ServiceModel * m_service_model
A liststore which contains information about detected services.
Gtk::ComboBoxEntry * m_cbe_services
A Gtk::ComboBox that lists all available services.
ConnectionDispatcher * m_dispatcher
A ConnectionDispatcher which dispatches connection signals.
void on_service_selected()
Signal handler that is called whenever an entry is selected from the combo box.
FawkesNetworkClient * get_network_client()
Access the current network client.
sigc::signal< void > signal_disconnected()
This signal is emitted whenever a network connection is terminated.
Glib::ustring get_hostname()
Returns the currently selected hostname (after connect)
virtual ~ServiceSelectorCBE()
Destructor.
Fawkes library namespace.