Loading...
Searching...
No Matches
BALL::VIEW::ModularWidget Class Reference
Visualisation » Kernel » Widget connectivity and message queuing

`#include <BALL/VIEW/KERNEL/modularWidget.h>`

Inheritance diagram for BALL::VIEW::ModularWidget:

## Public Member Functions

Constructors
| ModularWidget (const char *name="<ModularWidget>")
| ModularWidget (const ModularWidget &widget)
Destructors
virtual | ~ModularWidget ()
virtual void | destroy ()
virtual void | clear ()
Management of menu and toolbar entries
virtual void | checkMenu (MainControl &main_control)
QAction * | insertMenuEntry (Position parent_id, const QString &name, const QObject *receiver=0, const char *slot=0, const String &description="", QKeySequence accel=QKeySequence(), const QString &menu_hint=QString(""), UIOperationMode::OperationMode minimal_mode=UIOperationMode::MODE_ALL)
BALL_DEPRECATED void | setMenuHelp (QAction *, const String &)
virtual BALL_DEPRECATED void | registerForHelpSystem (const QObject *, const String &)
virtual void | addToolBarEntries (QToolBar *main_tb)
void | setIcon (QAction *action, const String &filename, bool add_to_main_toolbar=true)
Preferences handling
virtual void | initializePreferencesTab (Preferences &preferences)
virtual void | finalizePreferencesTab (Preferences &preferences)
virtual void | applyPreferences ()
virtual void | fetchPreferences (INIFile &inifile)
virtual void | writePreferences (INIFile &inifile)
bool | lockComposites ()
bool | unlockComposites ()
| Unlock the Composites.
Convenience methods
MainControl * | getMainControl () const
virtual void | setStatusbarText (const String &text, bool important=false)
virtual void | setStatusbarText (const QString &text, bool important=false)
String | getWorkingDir ()
| Implemented for convenience.
void | setWorkingDir (const String &dir)
| Implemented for convenience.
FragmentDB & | getFragmentDB () const
Public Member Functions inherited from BALL::Embeddable
| Embeddable (const String &identifier="<Embeddable>")
| Embeddable (const Embeddable &embeddable)
virtual | ~Embeddable ()
void | setIdentifier (const String &identifier)
const String & | getIdentifier () const
void | unregisterThis ()
virtual void | registerThis ()
Public Member Functions inherited from BALL::VIEW::ConnectionObject
| ConnectionObject ()
virtual | ~ConnectionObject ()
void | registerConnectionObject (ConnectionObject &object)
void | unregisterConnectionObject (ConnectionObject &object)
bool | isConnectionObjectRegistered (const ConnectionObject &object)
ConnectionObject * | getParent () const
ConnectionObject * | getRoot ()
virtual void | onNotify (Message *message)
virtual bool | isValid () const

## Debugging and Diagnostics

QAction * | window_menu_entry_
bool | show_window_enty_
bool | default_visible_
QList< QAction * > | main_toolbar_actions_
virtual void | dump (std::ostream &s=std::cout, Size depth=0) const
void | setWorkingDirFromFilename_ (String filename)
virtual BALL_DEPRECATED void | showHelp (const String &)

## Registering

virtual void | initializeWidget (MainControl &main_control)
virtual void | finalizeWidget (MainControl &main_control)
virtual bool | canHandle (const String &) const
virtual bool | openFile (const String &)
static void | registerWidget (ModularWidget *mwidget)

## Additional Inherited Members

Public Types inherited from BALL::Embeddable
typedef std::vector< Embeddable * > | EmbeddableVector
void | notify_ (Message *message)
void | notify_ (Message &message)
void | onNotify_ (Message *message)
static void | registerInstance_ (const std::type_info &type, const Embeddable *instance)
static void | unregisterInstance_ (const Embeddable *instance)
static Size | countInstances_ (const std::type_info &type)
static Embeddable * | getInstance_ (const std::type_info &type, Position index)
static Embeddable * | getInstance_ (const std::type_info &type, const String &identifier)

## Detailed Description

ModularWidget is a base class for widely independent widget that realize one feature domain. The VIEW framework provides a simple mechanism for Rapid Application Prototyping based on modular widgets. Using these modular widgets and the MainControl class (or more precisely, classes derived from MainControl) applications can be developed in a plug&play style. Inserting an instance of one of these widgets automatically creates the required menus and menu entries in the menubar of the main window, sets up the required connections, and registers the class instance for usage from the embedded Python interpreter (if desired).
When implementing classes derived from ModularWidget and access to the class from Python is desired, please remember to include the BALL_EMBEDDABLE macro in the public section of your class declaration. Also make sure that the QT class you derive from (e.g. QWidget) is the first base class and ModularWidget second.
Remember: A ModularWidget is not notified by the Messages it sends itself!

See also
  MainControl
  Embeddable

Definition at line 60 of file modularWidget.h.

## Constructor & Destructor Documentation

## ModularWidget() [1/2]

BALL::VIEW::ModularWidget::ModularWidget | ( | const char * | name = "<ModularWidget>" | ) |

Default Constructor. Set the name of this ModularWidget to name.

Parameters

  name | the name of this modularWidget

## ModularWidget() [2/2]

BALL::VIEW::ModularWidget::ModularWidget | ( | const ModularWidget & | widget | ) |

Copy constructor.

## ~ModularWidget()

virtual BALL::VIEW::ModularWidget::~ModularWidget | ( |  | ) |

virtual

Destructor. If the ModularWidget was registered, it will call MainControl::removeModularWidget.

## Member Function Documentation

## addToolBarEntries()

virtual void BALL::VIEW::ModularWidget::addToolBarEntries | ( | QToolBar * | main_tb | ) |

virtual

Add the widgets actions to the (main) toolbar. This method is needed to enable ordering the entries. It is called in Mainframe.

Reimplemented in BALL::VIEW::Scene.

## applyPreferences()

virtual void BALL::VIEW::ModularWidget::applyPreferences | ( |  | ) |

inline virtual

Apply the preferences of the specific tab. In this method the widget can extract any changed values from its preferences tab (if required). This method is called automatically by the applyPreferencesTab from the MainControl object if the apply button in the Preferences dialog is pressed.

Parameters

  preferences | the Preferences dialog of the MainControl

See also
  initializePreferencesTab
  finalizePreferencesTab
  applyPreferencesTab

Reimplemented in BALL::VIEW::DisplayProperties, BALL::VIEW::PyWidget, BALL::VIEW::Scene, and BALL::VIEW::ServerWidget.

Definition at line 223 of file modularWidget.h.

## canHandle()

virtual bool BALL::VIEW::ModularWidget::canHandle | ( | const String & |  | ) | const

inline virtual

Test if this ModularWidget can handle a given file format

Parameters

  fileform | short string with the file extension (e.g. PDB)

See also
  openFile
  MainControl::openFile

Reimplemented in BALL::VIEW::DatasetControl, BALL::VIEW::MolecularFileDialog, BALL::VIEW::PyWidget, and BALL::VIEW::TestFramework.

Definition at line 140 of file modularWidget.h.

## checkMenu()

virtual void BALL::VIEW::ModularWidget::checkMenu | ( | MainControl & | main_control | ) |

virtual

Menu checking method. This method is called MainControl::checkMenus before a popup menu is shown. It should be used to update the state of menu entries (e.g. disable or enable entries).

Parameters

  main_control | the MainControl object whose menus should be checked

Reimplemented in BALL::VIEW::DatasetControl, BALL::VIEW::DisplayProperties, BALL::VIEW::DockingController, BALL::VIEW::DownloadElectronDensity, BALL::VIEW::DownloadPDBFile, BALL::VIEW::FileObserver, BALL::VIEW::GeometricControl, BALL::VIEW::MolecularControl, BALL::VIEW::MolecularFileDialog, BALL::VIEW::MolecularStructure, BALL::VIEW::PubChemDialog, BALL::VIEW::PyWidget, BALL::VIEW::Scene, BALL::VIEW::TestFramework, and BALL::VIEW::UndoManagerDialog.

## clear()

virtual void BALL::VIEW::ModularWidget::clear | ( |  | ) |

virtual

Explicit default initialization. Currently does nothing.

Reimplemented from BALL::VIEW::ConnectionObject.

Reimplemented in BALL::VIEW::GeometricControl, BALL::VIEW::Scene, and BALL::VIEW::ServerWidget.

## destroy()

virtual void BALL::VIEW::ModularWidget::destroy | ( |  | ) |

inline virtual

Explicit destructor. Calls clear

See also
  clear

Reimplemented from BALL::VIEW::ConnectionObject.

Definition at line 94 of file modularWidget.h.

## dump()

virtual void BALL::VIEW::ModularWidget::dump | ( | std::ostream & | s = std::cout,
|  | Size | depth = 0 ) const

virtual

Internal state dump. Dump the current internal state of this mainControl to the output ostream s with dumping depth depth. Calls ConnectionObject::dump.

Parameters

  s | output stream where to output the internal state
  depth | the dumping depth

Reimplemented from BALL::Embeddable.

Reimplemented in BALL::VIEW::PyWidget, BALL::VIEW::Scene, and BALL::VIEW::ServerWidget.

## fetchPreferences()

virtual void BALL::VIEW::ModularWidget::fetchPreferences | ( | INIFile & | inifile | ) |

virtual

Fetch the widgets preferences from the INIFile. This method is called automatically by MainControl::show() at the start of the application.

Parameters

  inifile | the INIFile that contains the needed values

See also
  writePreferences

Reimplemented in BALL::VIEW::DockingController, BALL::VIEW::DockWidget, BALL::VIEW::DownloadElectronDensity, BALL::VIEW::DownloadPDBFile, BALL::VIEW::LabelDialog, BALL::VIEW::MolecularControl, BALL::VIEW::MolecularStructure, BALL::VIEW::PyWidget, and BALL::VIEW::Scene.

## finalizePreferencesTab()

virtual void BALL::VIEW::ModularWidget::finalizePreferencesTab | ( | Preferences & | preferences | ) |

virtual

Remove the preferences tab. This method can remove a preferences widget (if created in initializePreferencesTab) from the Preferences dialog of the MainControl. This method is called automatically by MainControl::aboutToExit() at the end of the application.

Parameters

  preferences | the Preferences dialog of the MainControl

Reimplemented in BALL::VIEW::DisplayProperties, BALL::VIEW::PyWidget, BALL::VIEW::Scene, and BALL::VIEW::ServerWidget.

## finalizeWidget()

virtual void BALL::VIEW::ModularWidget::finalizeWidget | ( | MainControl & | main_control | ) |

virtual

Remove the widget custom items, e.g all menu entries. This method should reverse all actions performed in initializeWidget (remove menu entries and connections of this ModularWidget). Call this method also in derived classes finalizeWidget to remove the menu entries. This method will be called by MainControl::aboutToExit().

Parameters

  main_control | the MainControl object to be finalized with this ModularWidget

See also
  initializeWidget

Reimplemented in BALL::VIEW::LogView, BALL::VIEW::PluginDialog, BALL::VIEW::PyWidget, and BALL::VIEW::ServerWidget.

## getFragmentDB()

FragmentDB & BALL::VIEW::ModularWidget::getFragmentDB | ( |  | ) | const

Return the FragmentDB. Note: The ModularWidget must be registered to a MainControl. Implemented for convenience.

## getMainControl()

MainControl * BALL::VIEW::ModularWidget::getMainControl | ( |  | ) | const

Return the MainControl of this ModularWidget Implemented for convenience.

## getWorkingDir()

String BALL::VIEW::ModularWidget::getWorkingDir | ( |  | ) |

Implemented for convenience.

## initializePreferencesTab()

virtual void BALL::VIEW::ModularWidget::initializePreferencesTab | ( | Preferences & | preferences | ) |

virtual

Initialize a preferences tab for the widget (if needed). This method can be used to create preferences widgets that can be inserted into the Preferences dialog with the method insertTab. This method is called automatically by MainControl::show at the start of the application.

Parameters

  preferences | the Preferences dialog of the MainControl

Reimplemented in BALL::VIEW::DisplayProperties, BALL::VIEW::PyWidget, BALL::VIEW::Scene, and BALL::VIEW::ServerWidget.

## initializeWidget()

virtual void BALL::VIEW::ModularWidget::initializeWidget | ( | MainControl & | main_control | ) |

virtual

Initialize the widget. This method is called automatically immediately before the main application is started. It should add the widget's menu entries and connections (if required). This method will be called by MainControl::show.

Parameters

  main_control | the MainControl object to be initialized with this ModularWidget

See also
  finalizeWidget()

Reimplemented in BALL::VIEW::AssignBondOrderConfigurationDialog, BALL::VIEW::AssignBondOrderResultsDialog, BALL::VIEW::DatasetControl, BALL::VIEW::DisplayProperties, BALL::VIEW::DockingController, BALL::VIEW::DockWidget, BALL::VIEW::DownloadElectronDensity, BALL::VIEW::DownloadPDBFile, BALL::VIEW::FileObserver, BALL::VIEW::GenericControl, BALL::VIEW::GeometricControl, BALL::VIEW::HelpViewer, BALL::VIEW::LabelDialog, BALL::VIEW::LogView, BALL::VIEW::MolecularControl, BALL::VIEW::MolecularFileDialog, BALL::VIEW::MolecularStructure, BALL::VIEW::PluginDialog, BALL::VIEW::PubChemDialog, BALL::VIEW::PyWidget, BALL::VIEW::Scene, BALL::VIEW::ServerWidget, BALL::VIEW::ShortcutDialog, BALL::VIEW::StereoSettingsDialog, BALL::VIEW::TestFramework, and BALL::VIEW::UndoManagerDialog.

## insertMenuEntry()

QAction * BALL::VIEW::ModularWidget::insertMenuEntry | ( | Position | parent_id,
|  | const QString & | name,
|  | const QObject * | receiver = 0,
|  | const char * | slot = 0,
|  | const String & | description = "",
|  | QKeySequence | accel = QKeySequence(),
|  | const QString & | menu_hint = QString(""),
|  | UIOperationMode::OperationMode | minimal_mode = UIOperationMode::MODE_ALL )

## lockComposites()

bool BALL::VIEW::ModularWidget::lockComposites | ( |  | ) |

Try to get an exclusive lock on the Composites, so that they can not be altered by any other ModularWidget.

## openFile()

virtual bool BALL::VIEW::ModularWidget::openFile | ( | const String & |  | ) |

inline virtual

Tell this ModularWidget to open a given file.

See also
  canHandle
  MainControl::openFile

Reimplemented in BALL::VIEW::DatasetControl, BALL::VIEW::MolecularFileDialog, BALL::VIEW::PyWidget, and BALL::VIEW::TestFramework.

Definition at line 146 of file modularWidget.h.

## registerForHelpSystem()

virtual BALL_DEPRECATED void BALL::VIEW::ModularWidget::registerForHelpSystem | ( | const QObject * | ,
|  | const String & | )

virtual

Register an QObject for the help system.

Deprecated
  Help system has been removed. This function will also be removed in the next release.

Reimplemented in BALL::VIEW::HelpViewer.

## registerWidget()

void BALL::VIEW::ModularWidget::registerWidget | ( | ModularWidget * | mwidget | ) |

static

Register the widget mwidget to the MainControl. ModularWidget objects must always be created with MainControl as parent and must have this method in their constructors. This method connects them to the MainControl object.

Parameters

  mwidget | the ModularWidget to be registered to the MainControl

Exceptions

  BALL::Exception::NullPointer |

## setIcon()

void BALL::VIEW::ModularWidget::setIcon | ( | QAction * | action,
|  | const String & | filename,
|  | bool | add_to_main_toolbar = true )

Set the icon for the given QAction. The file is searched in BALL/data/graphics.

Parameters

  action | the action to process (it is safe to pass a null pointer)
  filename | the name of the icon file
  add_to_main_toolbar | add the icon to the main toolbar

## setMenuHelp()

BALL_DEPRECATED void BALL::VIEW::ModularWidget::setMenuHelp | ( | QAction * | ,
|  | const String & | )

Set the help URL for the given action

Deprecated
  Help system has been removed. This function will also be removed in the next release.

## setStatusbarText() [1/2]

virtual void BALL::VIEW::ModularWidget::setStatusbarText | ( | const QString & | text,
|  | bool | important = false )

virtual

Set the text of the statusbar of the main application. Note: The ModularWidget must be registered to a MainControl. Implemented for convenience.

## setStatusbarText() [2/2]

virtual void BALL::VIEW::ModularWidget::setStatusbarText | ( | const String & | text,
|  | bool | important = false )

virtual

Set the text of the statusbar of the main application. Note: The ModularWidget must be registered to a MainControl. Implemented for convenience.

## setWorkingDir()

void BALL::VIEW::ModularWidget::setWorkingDir | ( | const String & | dir | ) |

Implemented for convenience.

## setWorkingDirFromFilename_()

void BALL::VIEW::ModularWidget::setWorkingDirFromFilename_ | ( | String | filename | ) |

## showHelp()

virtual BALL_DEPRECATED void BALL::VIEW::ModularWidget::showHelp | ( | const String & |  | ) |

virtual

Deprecated
  Help system has been removed. This function will also be removed in the next release.

Reimplemented in BALL::VIEW::HelpViewer.

## unlockComposites()

bool BALL::VIEW::ModularWidget::unlockComposites | ( |  | ) |

Unlock the Composites.

## writePreferences()

virtual void BALL::VIEW::ModularWidget::writePreferences | ( | INIFile & | inifile | ) |

virtual

Writes the widgets preferences to the INIFile. This method is called automatically by MainControl::aboutToExit at the end of the application.

Parameters

  inifile | the INIFile to contain the values

See also
  fetchPreferences

Reimplemented in BALL::VIEW::DockingController, BALL::VIEW::DockWidget, BALL::VIEW::DownloadElectronDensity, BALL::VIEW::DownloadPDBFile, BALL::VIEW::LabelDialog, BALL::VIEW::MolecularControl, BALL::VIEW::MolecularStructure, BALL::VIEW::PyWidget, and BALL::VIEW::Scene.

## Member Data Documentation

## default_visible_

bool BALL::VIEW::ModularWidget::default_visible_

protected

Definition at line 315 of file modularWidget.h.

## main_toolbar_actions_

QList<QAction*> BALL::VIEW::ModularWidget::main_toolbar_actions_

protected

Definition at line 317 of file modularWidget.h.

## show_window_enty_

bool BALL::VIEW::ModularWidget::show_window_enty_

protected

Definition at line 312 of file modularWidget.h.

## window_menu_entry_

QAction* BALL::VIEW::ModularWidget::window_menu_entry_

protected

Definition at line 309 of file modularWidget.h.