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 <gui_utils/interface_chooser_dialog.h>
27 
28 #include <list>
29 #include <set>
30 #include <string>
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 
42  static MultiInterfaceChooserDialog *create(Gtk::Window & parent,
43  BlackBoard * blackboard,
44  const char * type_pattern,
45  const char * id_pattern,
46  const TypeIdPairList &loaded_interfaces,
47  const Glib::ustring & title = DEFAULT_TITLE);
48 
50 
53 
54 protected:
56  {
57  public:
58  Record();
59  Gtk::TreeModelColumn<bool> load; /**< Load this interface? */
60  };
61 
62  MultiInterfaceChooserDialog(Gtk::Window & parent,
63  const TypeIdPairList &loaded_interfaces,
64  const Glib::ustring & title);
65 
66  virtual const Record &record() const;
67  virtual int init_columns();
68  virtual void init_row(Gtk::TreeModel::Row &row, const InterfaceInfo &ii);
69 
70 private:
71  /** Set of type and ID of an interface. */
72  typedef std::set<TypeIdPair> TypeIdPairSet;
73 
74  void on_load_toggled(const Glib::ustring &path);
75 
76  const Record *record_; /**< Should only be accessed by record(). */
77  TypeIdPairSet loaded_interfaces_;
78 };
79 
80 } // end of namespace fawkes
81 
82 #endif
fawkes::MultiInterfaceChooserDialog::create
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.
Definition: multi_interface_chooser_dialog.cpp:74
fawkes::MultiInterfaceChooserDialog::get_selected_interfaces
TypeIdPairList get_selected_interfaces() const
Get selected interface types and their respective IDs.
Definition: multi_interface_chooser_dialog.cpp:182
fawkes::MultiInterfaceChooserDialog::TypeIdPair
std::pair< Glib::ustring, Glib::ustring > TypeIdPair
Pair of type and IDs of interfaces.
Definition: multi_interface_chooser_dialog.h:38
fawkes::InterfaceChooserDialog::Record
Blackboard interface record.
Definition: interface_chooser_dialog.h:59
fawkes::MultiInterfaceChooserDialog::Record::Record
Record()
Constructor.
Definition: multi_interface_chooser_dialog.cpp:43
fawkes::MultiInterfaceChooserDialog::TypeIdPairList
std::list< TypeIdPair > TypeIdPairList
List of type and ID of an interface.
Definition: multi_interface_chooser_dialog.h:40
fawkes::BlackBoard
The BlackBoard abstract class.
Definition: blackboard.h:46
fawkes
Fawkes library namespace.
fawkes::InterfaceChooserDialog::DEFAULT_TITLE
static const char *const DEFAULT_TITLE
Default title of interface chooser dialogs.
Definition: interface_chooser_dialog.h:43
fawkes::InterfaceChooserDialog
Blackboard interface chooser dialog.
Definition: interface_chooser_dialog.h:41
fawkes::MultiInterfaceChooserDialog::init_columns
virtual int init_columns()
Initializes the columns GUI-wise.
Definition: multi_interface_chooser_dialog.cpp:145
fawkes::MultiInterfaceChooserDialog::~MultiInterfaceChooserDialog
virtual ~MultiInterfaceChooserDialog()
Destructor.
Definition: multi_interface_chooser_dialog.cpp:109
fawkes::MultiInterfaceChooserDialog::record
virtual const Record & record() const
Returns the Record of this chooser dialog.
Definition: multi_interface_chooser_dialog.cpp:128
fawkes::MultiInterfaceChooserDialog
Blackboard interface chooser dialog that supports multiple choices.
Definition: multi_interface_chooser_dialog.h:35
fawkes::MultiInterfaceChooserDialog::init_row
virtual void init_row(Gtk::TreeModel::Row &row, const InterfaceInfo &ii)
Initializes a row with the given interface.
Definition: multi_interface_chooser_dialog.cpp:171
fawkes::MultiInterfaceChooserDialog::Record::load
Gtk::TreeModelColumn< bool > load
Load this interface?
Definition: multi_interface_chooser_dialog.h:59
fawkes::MultiInterfaceChooserDialog::MultiInterfaceChooserDialog
MultiInterfaceChooserDialog(Gtk::Window &parent, const TypeIdPairList &loaded_interfaces, const Glib::ustring &title)
Constructor for subclasses.
Definition: multi_interface_chooser_dialog.cpp:95
fawkes::InterfaceInfo
Interface info.
Definition: interface_info.h:35
fawkes::MultiInterfaceChooserDialog::Record
Blackboard interface record.
Definition: multi_interface_chooser_dialog.h:56
fawkes::MultiInterfaceChooserDialog::get_newly_selected_interfaces
TypeIdPairList get_newly_selected_interfaces() const
Get selected interface types and their respective IDs.
Definition: multi_interface_chooser_dialog.cpp:204