Fawkes API
Fawkes Development Version
|
00001 /*************************************************************************** 00002 * interface_chooser_dialog.h - Dialog for choosing a blackboard interface 00003 * 00004 * Created: Sat Mar 19 12:18:43 2011 00005 * Copyright 2008-2011 Tim Niemueller [www.niemueller.de] 00006 * Copyright 2011 Christoph Schwering 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_INTERFACE_CHOOSER_DIALOG_H_ 00025 #define __LIBS_GUI_UTILS_INTERFACE_CHOOSER_DIALOG_H_ 00026 00027 #include <gtkmm/dialog.h> 00028 #include <gtkmm/treeview.h> 00029 #include <gtkmm/entry.h> 00030 #include <gtkmm/expander.h> 00031 #include <gtkmm/scrolledwindow.h> 00032 #include <gtkmm/liststore.h> 00033 00034 namespace fawkes { 00035 #if 0 /* just to make Emacs auto-indent happy */ 00036 } 00037 #endif 00038 00039 class Interface; 00040 class BlackBoard; 00041 class InterfaceInfo; 00042 00043 class InterfaceChooserDialog 00044 : public Gtk::Dialog 00045 { 00046 public: 00047 static const char* const DEFAULT_TITLE; 00048 00049 static InterfaceChooserDialog* create( 00050 Gtk::Window &parent, 00051 BlackBoard *blackboard, 00052 const char *type_pattern, 00053 const char *id_pattern, 00054 const Glib::ustring& title = DEFAULT_TITLE); 00055 00056 virtual ~InterfaceChooserDialog(); 00057 00058 void get_selected_interface(Glib::ustring &type, Glib::ustring &id); 00059 00060 fawkes::Interface * run_and_open_for_reading(); 00061 00062 protected: 00063 class Record : public Gtk::TreeModelColumnRecord 00064 { 00065 public: 00066 Record(); 00067 00068 Gtk::TreeModelColumn<Glib::ustring> type; /**< The type of the interface */ 00069 Gtk::TreeModelColumn<Glib::ustring> id; /**< The ID of the interface */ 00070 Gtk::TreeModelColumn<bool> has_writer; /**< Writer exists? */ 00071 Gtk::TreeModelColumn<unsigned int> num_readers; /**< Number of readers */ 00072 }; 00073 00074 InterfaceChooserDialog(Gtk::Window& parent, const Glib::ustring& title); 00075 00076 void init(BlackBoard* blackboard, 00077 const char* type_pattern, 00078 const char* id_pattern); 00079 00080 virtual const Record& record() const; 00081 virtual int init_columns(); 00082 virtual void init_row(Gtk::TreeModel::Row& row, const InterfaceInfo& ii); 00083 00084 Gtk::TreeView __treeview; /**< Tree widget for interfaces. */ 00085 Glib::RefPtr<Gtk::ListStore> __model; /**< Data model of the tree. */ 00086 00087 private: 00088 InterfaceChooserDialog(const InterfaceChooserDialog& obj); 00089 InterfaceChooserDialog& operator=(const InterfaceChooserDialog& obj); 00090 00091 BlackBoard *__bb; 00092 00093 Gtk::Window &__parent; 00094 Gtk::ScrolledWindow __scrollwin; 00095 00096 const Record* __record; /**< Should only be accessed by record(). */ 00097 }; 00098 00099 } // end of namespace fawkes 00100 00101 #endif