Fawkes API Fawkes Development Version

service_chooser_dialog.h

00001 
00002 /***************************************************************************
00003  *  service_chooser_dialog.cpp - Dialog for choosing a network service
00004  *
00005  *  Created: Sun Oct 12 17:06:06 2008 (split from lasergui_hildon.cpp)
00006  *  Copyright  2008  Tim Niemueller [www.niemueller.de]
00007  *
00008  ****************************************************************************/
00009 
00010 /*  This program is free software; you can redistribute it and/or modify
00011  *  it under the terms of the GNU General Public License as published by
00012  *  the Free Software Foundation; either version 2 of the License, or
00013  *  (at your option) any later version. A runtime exception applies to
00014  *  this software (see LICENSE.GPL_WRE file mentioned below for details).
00015  *
00016  *  This program is distributed in the hope that it will be useful,
00017  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019  *  GNU Library General Public License for more details.
00020  *
00021  *  Read the full text in the LICENSE.GPL_WRE file in the doc directory.
00022  */
00023 
00024 #ifndef __LIBS_GUI_UTILS_SERVICE_CHOOSER_DIALOG_H_
00025 #define __LIBS_GUI_UTILS_SERVICE_CHOOSER_DIALOG_H_
00026 
00027 #include <gui_utils/service_model.h>
00028 
00029 #include <gtkmm/dialog.h>
00030 #include <gtkmm/treeview.h>
00031 #include <gtkmm/entry.h>
00032 #include <gtkmm/expander.h>
00033 #include <gtkmm/scrolledwindow.h>
00034 
00035 #include <sys/types.h>
00036 #include <sys/socket.h>
00037 
00038 namespace fawkes {
00039 
00040 class FawkesNetworkClient;
00041 class ServiceModel;
00042 
00043 class ServiceChooserDialog
00044   : public Gtk::Dialog
00045 {
00046  public:
00047   ServiceChooserDialog(Gtk::Window &parent,
00048                        FawkesNetworkClient *client,
00049                        Glib::ustring title = "Select Service",
00050                        const char *service = "_fawkes._tcp");
00051 
00052   ServiceChooserDialog(Gtk::Window &parent,
00053                        Glib::ustring title = "Select Service",
00054                        const char *service = "_fawkes._tcp");
00055 
00056   virtual ~ServiceChooserDialog();
00057 
00058   void get_selected_service(Glib::ustring &name, Glib::ustring &hostname,
00059                             Glib::ustring &ipaddr, unsigned short int &port);
00060   void get_raw_address(struct sockaddr *addr, socklen_t addr_size);
00061 
00062   void run_and_connect();
00063 
00064  protected:
00065   virtual void on_expander_changed();
00066 
00067  private:
00068   void ctor();
00069   fawkes::FawkesNetworkClient *__client;
00070 
00071   Gtk::Window         &__parent;
00072   Gtk::TreeView        __treeview;
00073   Gtk::Entry           __entry;
00074   Gtk::Expander        __expander;
00075   Gtk::ScrolledWindow  __scrollwin;
00076 
00077   ServiceModel *__service_model;
00078 };
00079 
00080 } // end of namespace fawkes
00081 
00082 #endif
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends