ConfigEditorPlugin Class Reference

Base class for plugins for the Fawkes config editor. More...

#include <tools/config_editor/config_editor_plugin.h>

Inheritance diagram for ConfigEditorPlugin:

[legend]
List of all members.

Public Member Functions

 ConfigEditorPlugin (std::string config_path, std::string glade_file)
 Constructor.
virtual ~ConfigEditorPlugin ()
 Destructor.
void initialize ()
 Initialize the plugin.
void run ()
 Run the plugin.
std::string get_config_path () const
 Get the config prefix specified for this config editor plugin.
void set_config (fawkes::Configuration *config)
 Set the configuration for the plugin to work on.

Protected Member Functions

virtual void pre_run ()=0
 Config editor plugins need to implement this function.
virtual void post_run (int response)=0
 This method is called after the dialog is closed.
virtual Gtk::Dialog * load_dialog ()=0
 In this function the (custom) dialog of the plugin needs to be initialized.

Protected Attributes

Gtk::Dialog * m_dialog
 The (main-) dialog of the plugin.
Glib::RefPtr< Gnome::Glade::Xml > m_ref_xml
 Glade XML object created from the Glade file of the plugin.
std::string m_config_path
 The config prefix the plugin is attached to.
fawkes::Configurationm_config
 The fawkes::Configuration.

Detailed Description

Base class for plugins for the Fawkes config editor.

A plugin allows to manipulate a certain part of the configuration, most often this is intended to be the config options for a Fawkes plugin.

Author:
Daniel Beck

Definition at line 35 of file config_editor_plugin.h.


Constructor & Destructor Documentation

ConfigEditorPlugin::ConfigEditorPlugin ( std::string  config_path,
std::string  glade_file 
)

Constructor.

Parameters:
config_path the prefix of the part that can be configured with this plugin
glade_file a Glade file which contains the definition the plugin's GUI components

Definition at line 78 of file config_editor_plugin.cpp.

References m_config_path, and m_ref_xml.

ConfigEditorPlugin::~ConfigEditorPlugin (  )  [virtual]

Destructor.

Definition at line 86 of file config_editor_plugin.cpp.


Member Function Documentation

std::string ConfigEditorPlugin::get_config_path (  )  const

Get the config prefix specified for this config editor plugin.

Returns:
the config prefix

Definition at line 94 of file config_editor_plugin.cpp.

References m_config_path.

Referenced by ConfigTreeView::register_plugin().

void ConfigEditorPlugin::initialize (  ) 

Initialize the plugin.

This method needs to be called before the plugin can be used.

Definition at line 112 of file config_editor_plugin.cpp.

References load_dialog(), and m_dialog.

Referenced by ConfigTreeView::register_plugin().

Gtk::Dialog * ConfigEditorPlugin::load_dialog (  )  [protected, pure virtual]

In this function the (custom) dialog of the plugin needs to be initialized.

Returns:
pointer to the loaded dialog

Implemented in NaoStiffnessConfigPlugin, and RetrieverConfigPlugin.

Referenced by initialize().

void ConfigEditorPlugin::post_run ( int  response  )  [protected, pure virtual]

This method is called after the dialog is closed.

Here, the input the user has made needs to be handled.

Parameters:
response the response obtained from the run() method of the dialog (Gtk::RESPONSE_OK or Gtk::RESPONSE_CANCEL)

Implemented in NaoStiffnessConfigPlugin, and RetrieverConfigPlugin.

Referenced by run().

void ConfigEditorPlugin::pre_run (  )  [protected, pure virtual]

Config editor plugins need to implement this function.

It is called before the actual dialog is opened. Ususally, plugins want to parse the configuration, here, and initialize the GUI elements of the dialog.

Implemented in NaoStiffnessConfigPlugin, and RetrieverConfigPlugin.

Referenced by run().

void ConfigEditorPlugin::run (  ) 

Run the plugin.

Usually, this means opening a dialog where config values can be manipulated and on closing these are written to the config.

Definition at line 122 of file config_editor_plugin.cpp.

References m_dialog, post_run(), and pre_run().

void ConfigEditorPlugin::set_config ( fawkes::Configuration config  ) 

Set the configuration for the plugin to work on.

Parameters:
config the configuration

Definition at line 103 of file config_editor_plugin.cpp.

References m_config.


Member Data Documentation

ConfigEditorPlugin::m_config [protected]

The fawkes::Configuration.

Definition at line 59 of file config_editor_plugin.h.

Referenced by RetrieverConfigPlugin::post_run(), RetrieverConfigPlugin::pre_run(), and set_config().

ConfigEditorPlugin::m_config_path [protected]

The config prefix the plugin is attached to.

Definition at line 58 of file config_editor_plugin.h.

Referenced by ConfigEditorPlugin(), get_config_path(), RetrieverConfigPlugin::post_run(), and RetrieverConfigPlugin::pre_run().

ConfigEditorPlugin::m_dialog [protected]

The (main-) dialog of the plugin.

Definition at line 55 of file config_editor_plugin.h.

Referenced by initialize(), RetrieverConfigPlugin::post_run(), RetrieverConfigPlugin::pre_run(), and run().

ConfigEditorPlugin::m_ref_xml [protected]

Glade XML object created from the Glade file of the plugin.

Definition at line 56 of file config_editor_plugin.h.

Referenced by ConfigEditorPlugin(), RetrieverConfigPlugin::load_dialog(), and NaoStiffnessConfigPlugin::load_dialog().


The documentation for this class was generated from the following files:
Generated on Tue Feb 22 13:31:32 2011 for Fawkes API by  doxygen 1.4.7