Fawkes API  Fawkes Development Version
multi_interface_chooser_dialog.h
1 /***************************************************************************
2  * multi_interface_chooser_dialog.h - Dialog for choosing a blackboard interface
3  *
4  * Created: Mon Oct 17 21:01:30 2011
5  * Copyright 2011 Christoph Schwering
6  *
7  ****************************************************************************/
8 
9 /* This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version. A runtime exception applies to
13  * this software (see LICENSE.GPL_WRE file mentioned below for details).
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU Library General Public License for more details.
19  *
20  * Read the full text in the LICENSE.GPL_WRE file in the doc directory.
21  */
22 
23 #ifndef __LIBS_GUI_UTILS_MULTI_INTERFACE_CHOOSER_DIALOG_H_
24 #define __LIBS_GUI_UTILS_MULTI_INTERFACE_CHOOSER_DIALOG_H_
25 
26 #include <list>
27 #include <set>
28 #include <string>
29 
30 #include <gui_utils/interface_chooser_dialog.h>
31 
32 namespace fawkes {
33 
35 {
36  public:
37  /** Pair of type and IDs of interfaces. */
38  typedef std::pair<Glib::ustring, Glib::ustring> TypeIdPair;
39  /** List of type and ID of an interface. */
40  typedef std::list<TypeIdPair> TypeIdPairList;
41 
43  Gtk::Window &parent,
44  BlackBoard *blackboard,
45  const char *type_pattern,
46  const char *id_pattern,
47  const TypeIdPairList& loaded_interfaces,
48  const Glib::ustring& title = DEFAULT_TITLE);
49 
51 
52  TypeIdPairList get_selected_interfaces() const;
53  TypeIdPairList get_newly_selected_interfaces() const;
54 
55  protected:
57  {
58  public:
59  Record();
60  Gtk::TreeModelColumn<bool> load; /**< Load this interface? */
61  };
62 
63  MultiInterfaceChooserDialog(Gtk::Window &parent,
64  const TypeIdPairList& loaded_interfaces,
65  const Glib::ustring& title);
66 
67  virtual const Record& record() const;
68  virtual int init_columns();
69  virtual void init_row(Gtk::TreeModel::Row& row, const InterfaceInfo& ii);
70 
71  private:
72  /** Set of type and ID of an interface. */
73  typedef std::set<TypeIdPair> TypeIdPairSet;
74 
75  void on_load_toggled(const Glib::ustring& path);
76 
77  const Record* __record; /**< Should only be accessed by record(). */
78  TypeIdPairSet __loaded_interfaces;
79 };
80 
81 } // end of namespace fawkes
82 
83 #endif
Blackboard interface chooser dialog.
MultiInterfaceChooserDialog(Gtk::Window &parent, const TypeIdPairList &loaded_interfaces, const Glib::ustring &title)
Constructor for subclasses.
std::list< TypeIdPair > TypeIdPairList
List of type and ID of an interface.
Fawkes library namespace.
Gtk::TreeModelColumn< bool > load
Load this interface?
virtual int init_columns()
Initializes the columns GUI-wise.
static const char *const DEFAULT_TITLE
Default title of interface chooser dialogs.
Blackboard interface chooser dialog that supports multiple choices.
TypeIdPairList get_newly_selected_interfaces() const
Get selected interface types and their respective IDs.
std::pair< Glib::ustring, Glib::ustring > TypeIdPair
Pair of type and IDs of interfaces.
virtual void init_row(Gtk::TreeModel::Row &row, const InterfaceInfo &ii)
Initializes a row with the given interface.
TypeIdPairList get_selected_interfaces() const
Get selected interface types and their respective IDs.
virtual const Record & record() const
Returns the Record of this chooser dialog.
static MultiInterfaceChooserDialog * create(Gtk::Window &parent, BlackBoard *blackboard, const char *type_pattern, const char *id_pattern, const TypeIdPairList &loaded_interfaces, const Glib::ustring &title=DEFAULT_TITLE)
Factory method.
The BlackBoard abstract class.
Definition: blackboard.h:48
Interface info.