BALL  1.4.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Member Functions | Protected Attributes | List of all members
BALL::VIEW::ModularWidget Class Reference

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

Inheritance diagram for BALL::VIEW::ModularWidget:
BALL::Embeddable BALL::VIEW::ConnectionObject BALL::VIEW::AssignBondOrderConfigurationDialog BALL::VIEW::AssignBondOrderResultsDialog BALL::VIEW::DemoTutorialDialog BALL::VIEW::DisplayProperties BALL::VIEW::DockingController BALL::VIEW::DockWidget BALL::VIEW::DownloadElectronDensity BALL::VIEW::DownloadPDBFile BALL::VIEW::EditOperationDialog BALL::VIEW::FDPBDialog BALL::VIEW::LabelDialog BALL::VIEW::ModifyRepresentationDialog BALL::VIEW::MolecularFileDialog BALL::VIEW::MolecularStructure BALL::VIEW::OpenBruker1DFile BALL::VIEW::OpenBruker2DFile BALL::VIEW::PluginDialog BALL::VIEW::PubChemDialog BALL::VIEW::RaytraceableContourSurfaceDialog BALL::VIEW::RegularData1DWidget BALL::VIEW::RegularData2DWidget BALL::VIEW::Scene BALL::VIEW::ServerWidget BALL::VIEW::ShortcutDialog BALL::VIEW::SnapshotVisualisationDialog BALL::VIEW::StereoSettingsDialog BALL::VIEW::TestFramework BALL::VIEW::UndoManagerDialog

Public Member Functions

void setWorkingDirFromFilename_ (String filename)
 
virtual void showHelp (const String &url)
 
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 String &name, const QObject *receiver=0, const char *slot=0, const String &description="", QKeySequence accel=QKeySequence())
 
void setMenuHint (const String &hint)
 
void setMenuHelp (const String &url)
 
virtual void registerForHelpSystem (const QObject *object, const String &url)
 
virtual void addToolBarEntries (QToolBar *main_tb)
 
void setIcon (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. More...
 
Convenience methods
MainControlgetMainControl () const
 
virtual void setStatusbarText (const String &text, bool important=false)
 
virtual void setStatusbarText (const QString &text, bool important=false)
  More...
 
String getWorkingDir ()
 Implemented for convenience. More...
 
void setWorkingDir (const String &dir)
 Implemented for convenience. More...
 
FragmentDBgetFragmentDB () const
 
Debugging and Diagnostics
virtual void dump (std::ostream &s=std::cout, Size depth=0) 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 StringgetIdentifier () 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)
 
ConnectionObjectgetParent () const
 
ConnectionObjectgetRoot ()
 
virtual void onNotify (Message *message)
 
virtual bool isValid () const
 

Protected Attributes

QAction * window_menu_entry_
 
bool show_window_enty_
 
bool default_visible_
 
QAction * last_action_
 
QList< QAction * > main_toolbar_actions_
 

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) throw (Exception::NullPointer)
 

Additional Inherited Members

- Public Types inherited from BALL::Embeddable
typedef std::vector< Embeddable * > EmbeddableVector
 
- Protected Member Functions inherited from BALL::VIEW::ConnectionObject
void onNotify_ (Message *message)
 
void notify_ (Message *message)
 
void notify_ (Message &message)
 
- Static Protected Member Functions inherited from BALL::Embeddable
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 EmbeddablegetInstance_ (const std::type_info &type, Position index)
 
static EmbeddablegetInstance_ (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
PyWidget

Definition at line 57 of file modularWidget.h.

Constructor & Destructor Documentation

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

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

Parameters
namethe name of this modularWidget
BALL::VIEW::ModularWidget::ModularWidget ( const ModularWidget widget)

Copy constructor.

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

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

Member Function Documentation

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, and BALL::VIEW::EditableScene.

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

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
preferencesthe Preferences dialog of the MainControl
See Also
initializePreferencesTab
finalizePreferencesTab
applyPreferencesTab

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

Definition at line 221 of file modularWidget.h.

virtual bool BALL::VIEW::ModularWidget::canHandle ( const String ) const
inlinevirtual

Test if this ModularWidget can handle a given file format

Parameters
fileformshort string with the file extension (e.g. PDB)
See Also
openFile
MainControl::openFile

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

Definition at line 137 of file modularWidget.h.

virtual void BALL::VIEW::ModularWidget::checkMenu ( MainControl main_control)
virtual
virtual void BALL::VIEW::ModularWidget::clear ( )
virtual

Explicit default initialization. Currently does nothing.

Reimplemented from BALL::VIEW::ConnectionObject.

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

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

Explicit destructor. Calls clear

See Also
clear

Reimplemented from BALL::VIEW::ConnectionObject.

Definition at line 91 of file modularWidget.h.

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
soutput stream where to output the internal state
depththe dumping depth

Reimplemented from BALL::Embeddable.

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

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
inifilethe INIFile that contains the needed values
See Also
writePreferences

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

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
preferencesthe Preferences dialog of the MainControl

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

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_controlthe MainControl object to be finalized with this ModularWidget
See Also
initializeWidget

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

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

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

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

Return the MainControl of this ModularWidget Implemented for convenience.

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

Implemented for convenience.

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
preferencesthe Preferences dialog of the MainControl

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

virtual void BALL::VIEW::ModularWidget::initializeWidget ( MainControl main_control)
virtual
QAction* BALL::VIEW::ModularWidget::insertMenuEntry ( Position  parent_id,
const String name,
const QObject receiver = 0,
const char *  slot = 0,
const String description = "",
QKeySequence  accel = QKeySequence() 
)
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.

virtual bool BALL::VIEW::ModularWidget::openFile ( const String )
inlinevirtual
virtual void BALL::VIEW::ModularWidget::registerForHelpSystem ( const QObject object,
const String url 
)
virtual

Register an QObject for the help system.

See Also
HelpViewer

Reimplemented in BALL::VIEW::HelpViewer, and BALL::VIEW::DockWidget.

static void BALL::VIEW::ModularWidget::registerWidget ( ModularWidget mwidget) throw (Exception::NullPointer)
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
mwidgetthe ModularWidget to be registered to the MainControl
void BALL::VIEW::ModularWidget::setIcon ( const String filename,
bool  add_to_main_toolbar = true 
)

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

void BALL::VIEW::ModularWidget::setMenuHelp ( const String url)

Set the help URL for the last added menu entry

See Also
insertMenuEntry
HelpViewer
void BALL::VIEW::ModularWidget::setMenuHint ( const String hint)

Set the hint for the last added menu entry

See Also
insertMenuEntry
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.

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.

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

Implemented for convenience.

void BALL::VIEW::ModularWidget::setWorkingDirFromFilename_ ( String  filename)
virtual void BALL::VIEW::ModularWidget::showHelp ( const String url)
virtual

Reimplemented in BALL::VIEW::HelpViewer.

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

Unlock the Composites.

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
inifilethe INIFile to contain the values
See Also
fetchPreferences

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

Member Data Documentation

bool BALL::VIEW::ModularWidget::default_visible_
protected

Definition at line 310 of file modularWidget.h.

QAction* BALL::VIEW::ModularWidget::last_action_
protected

Definition at line 312 of file modularWidget.h.

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

Definition at line 313 of file modularWidget.h.

bool BALL::VIEW::ModularWidget::show_window_enty_
protected

Definition at line 307 of file modularWidget.h.

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

Definition at line 304 of file modularWidget.h.