#include <modularWidget.h>
Public Member Functions |
|
void | setWorkingDirFromFilename_ (String filename) |
virtual void | showHelp (const String &url) |
Constructors
|
|
ModularWidget (const char *name="<ModularWidget>") | |
Default Constructor. |
|
ModularWidget (const ModularWidget &widget) | |
Copy constructor. |
|
Destructors
|
|
virtual | ~ModularWidget () |
Destructor. |
|
virtual void | destroy () |
Explicit destructor. |
|
virtual void | clear () |
Explicit default initialization.
|
|
Management of menu and toolbar entries
|
|
virtual void | checkMenu (MainControl &main_control) |
Menu checking method. |
|
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) |
Set the hint for the last added menu
entry. |
|
void | setMenuHelp (const String &url) |
Set the help URL for the last added
menu entry. |
|
virtual void | registerForHelpSystem (const QObject *object, const String &url) |
Register an QObject for the help
system. |
|
virtual void | addToolBarEntries (QToolBar *main_tb) |
Add the widgets actions to the
(main) toolbar. |
|
void | setIcon (const String &filename, bool add_to_main_toolbar=true) |
Set the icon for the last added
QAction. |
|
Preferences handling
|
|
virtual void | initializePreferencesTab (Preferences &preferences) |
Initialize a preferences tab for the
widget (if needed). |
|
virtual void | finalizePreferencesTab (Preferences &preferences) |
Remove the preferences tab. |
|
virtual void | applyPreferences () |
Apply the preferences of the
specific tab. |
|
virtual void | fetchPreferences (INIFile &inifile) |
Fetch the widgets preferences from
the INIFile. |
|
virtual void | writePreferences (INIFile &inifile) |
Writes the widgets preferences to
the INIFile. |
|
Preferences handling
|
|
bool | lockComposites () |
Try to get an exclusive lock on the
Composites, so that they can not be altered by any other
ModularWidget. |
|
bool | unlockComposites () |
Unlock the Composites. |
|
Convenience methods
|
|
MainControl * | getMainControl () const |
Return the
MainControl of this
ModularWidget Implemented for convenience. |
|
virtual void | setStatusbarText (String text, bool important=false) |
Set the text of the statusbar of the
main application. |
|
String | getWorkingDir () |
Implemented for
convenience. |
|
void | setWorkingDir (const String &dir) |
Implemented for
convenience. |
|
FragmentDB & | getFragmentDB () const |
Return the FragmentDB.
|
|
Debugging and Diagnostics
|
|
virtual void | dump (std::ostream &s=std::cout, Size depth=0) const |
Internal state dump. |
|
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) |
Initialize the widget. |
|
virtual void | finalizeWidget (MainControl &main_control) |
Remove the widget custom items, e.g
all menu entries. |
|
virtual bool | canHandle (const String &) const |
Test if this
ModularWidget can handle a given file format. |
|
virtual bool | openFile (const String &) |
Tell this
ModularWidget to open a given file. |
|
static void | registerWidget (ModularWidget *mwidget) throw (Exception::NullPointer) |
Register the widget mwidget
to the
MainControl. |
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!
BALL::VIEW::ModularWidget::ModularWidget | ( | const char * | name =
"<ModularWidget>" |
) |
Default Constructor.
Set the name of this ModularWidget to name.
name | the name of this modularWidget |
virtual BALL::VIEW::ModularWidget::~ModularWidget | ( | ) | [virtual] |
Destructor.
If the ModularWidget was registered, it will call MainControl::removeModularWidget.
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::EditableScene, and BALL::VIEW::Scene.
virtual void BALL::VIEW::ModularWidget::applyPreferences | ( | ) | [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.
preferences | the Preferences dialog of the MainControl |
applyPreferencesTab
Reimplemented in BALL::VIEW::DisplayProperties, BALL::VIEW::ServerWidget, BALL::VIEW::EditableScene, BALL::VIEW::PyWidget, and BALL::VIEW::Scene.
virtual bool BALL::VIEW::ModularWidget::canHandle | ( | const String & | ) | const [virtual] |
Test if this ModularWidget can handle a given file format.
fileform | short string with the file extension (e.g. PDB) |
Reimplemented in BALL::VIEW::MolecularFileDialog, BALL::VIEW::DatasetControl, BALL::VIEW::PyWidget, and BALL::VIEW::TestFramework.
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).
main_control | the MainControl object whose menus should be checked |
Reimplemented in BALL::VIEW::DisplayProperties, BALL::VIEW::DownloadPDBFile, BALL::VIEW::LabelDialog, BALL::VIEW::MolecularFileDialog, BALL::VIEW::PubChemDialog, BALL::VIEW::DatasetControl, BALL::VIEW::DockingController, BALL::VIEW::EditableScene, BALL::VIEW::FileObserver, BALL::VIEW::GeometricControl, BALL::VIEW::MolecularControl, BALL::VIEW::MolecularStructure, BALL::VIEW::PyWidget, BALL::VIEW::Scene, and BALL::VIEW::TestFramework.
virtual void BALL::VIEW::ModularWidget::clear | ( | ) | [virtual] |
Explicit default initialization.
Currently does nothing.
Reimplemented from BALL::VIEW::ConnectionObject.
Reimplemented in BALL::VIEW::ServerWidget, BALL::VIEW::GeometricControl, BALL::VIEW::PyWidget, and BALL::VIEW::Scene.
virtual void BALL::VIEW::ModularWidget::destroy | ( | ) | [virtual] |
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.
s | output stream where to output the internal state | |
depth | the dumping depth |
Reimplemented from BALL::Embeddable.
Reimplemented in BALL::VIEW::ServerWidget, BALL::VIEW::PyWidget, and BALL::VIEW::Scene.
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.
inifile | the INIFile that contains the needed values |
Reimplemented in BALL::VIEW::DownloadPDBFile, BALL::VIEW::LabelDialog, BALL::VIEW::DockingController, BALL::VIEW::DockWidget, BALL::VIEW::MolecularControl, BALL::VIEW::MolecularStructure, BALL::VIEW::PyWidget, and BALL::VIEW::Scene.
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.
preferences | the Preferences dialog of the MainControl |
Reimplemented in BALL::VIEW::DisplayProperties, BALL::VIEW::ServerWidget, BALL::VIEW::EditableScene, BALL::VIEW::PyWidget, and BALL::VIEW::Scene.
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().
main_control | the MainControl object to be finalized with this ModularWidget |
Reimplemented in BALL::VIEW::PluginDialog, BALL::VIEW::ServerWidget, BALL::VIEW::EditFunctions, BALL::VIEW::LogView, and BALL::VIEW::PyWidget.
FragmentDB& BALL::VIEW::ModularWidget::getFragmentDB | ( | ) | const |
Return the FragmentDB.
Note: The ModularWidget must be registered to a MainControl. 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.
preferences | the Preferences dialog of the MainControl |
Reimplemented in BALL::VIEW::DisplayProperties, BALL::VIEW::ServerWidget, BALL::VIEW::EditableScene, BALL::VIEW::PyWidget, and BALL::VIEW::Scene.
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.
main_control | the MainControl object to be initialized with this ModularWidget |
Reimplemented in BALL::VIEW::AssignBondOrderConfigurationDialog, BALL::VIEW::AssignBondOrderResultsDialog, BALL::VIEW::DisplayProperties, BALL::VIEW::DownloadPDBFile, BALL::VIEW::LabelDialog, BALL::VIEW::MolecularFileDialog, BALL::VIEW::OpenBruker1DFile, BALL::VIEW::OpenBruker2DFile, BALL::VIEW::PluginDialog, BALL::VIEW::PubChemDialog, BALL::VIEW::ShortcutDialog, BALL::VIEW::StereoSettingsDialog, BALL::VIEW::ServerWidget, BALL::VIEW::DatasetControl, BALL::VIEW::DockingController, BALL::VIEW::DockWidget, BALL::VIEW::EditableScene, BALL::VIEW::EditFunctions, BALL::VIEW::FileObserver, BALL::VIEW::GenericControl, BALL::VIEW::GeometricControl, BALL::VIEW::HelpViewer, BALL::VIEW::LogView, BALL::VIEW::MolecularControl, BALL::VIEW::MolecularStructure, BALL::VIEW::PyWidget, BALL::VIEW::Scene, and BALL::VIEW::TestFramework.
virtual bool BALL::VIEW::ModularWidget::openFile | ( | const String & | ) | [virtual] |
Tell this ModularWidget to open a given file.
Reimplemented in BALL::VIEW::MolecularFileDialog, BALL::VIEW::DatasetControl, BALL::VIEW::PyWidget, and BALL::VIEW::TestFramework.
virtual void BALL::VIEW::ModularWidget::registerForHelpSystem | ( | const QObject * | object, | |
const String & | url | |||
) | [virtual] |
Register an QObject for the help system.
Reimplemented in BALL::VIEW::DockWidget, and BALL::VIEW::HelpViewer.
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.
mwidget | the 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.
void BALL::VIEW::ModularWidget::setMenuHint | ( | const String & | hint | ) |
Set the hint for the last added menu entry.
virtual void BALL::VIEW::ModularWidget::setStatusbarText | ( | 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::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.
inifile | the INIFile to contain the values |
Reimplemented in BALL::VIEW::DownloadPDBFile, BALL::VIEW::LabelDialog, BALL::VIEW::DockingController, BALL::VIEW::DockWidget, BALL::VIEW::MolecularControl, BALL::VIEW::MolecularStructure, BALL::VIEW::PyWidget, and BALL::VIEW::Scene.