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
32namespace fawkes {
33
35{
36public:
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
54protected:
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
70private:
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
The BlackBoard abstract class.
Definition: blackboard.h:46
Blackboard interface chooser dialog.
static const char *const DEFAULT_TITLE
Default title of interface chooser dialogs.
Interface info.
Gtk::TreeModelColumn< bool > load
Load this interface?
Blackboard interface chooser dialog that supports multiple choices.
virtual int init_columns()
Initializes the columns GUI-wise.
std::list< TypeIdPair > TypeIdPairList
List of type and ID of an interface.
TypeIdPairList get_selected_interfaces() const
Get selected interface types and their respective IDs.
TypeIdPairList get_newly_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.
virtual void init_row(Gtk::TreeModel::Row &row, const InterfaceInfo &ii)
Initializes a row with the given interface.
std::pair< Glib::ustring, Glib::ustring > TypeIdPair
Pair of type and IDs of interfaces.
MultiInterfaceChooserDialog(Gtk::Window &parent, const TypeIdPairList &loaded_interfaces, const Glib::ustring &title)
Constructor for subclasses.
Fawkes library namespace.