BALL
1.4.79
|
#include <BALL/VIEW/KERNEL/modularWidget.h>
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 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) |
void | setMenuHelp (QAction *action, const String &url) |
virtual void | registerForHelpSystem (const QObject *object, const String &url) |
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. More... | |
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. More... | |
void | setWorkingDir (const String &dir) |
Implemented for convenience. More... | |
FragmentDB & | getFragmentDB () 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 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 |
Protected Attributes | |
QAction * | window_menu_entry_ |
bool | show_window_enty_ |
bool | default_visible_ |
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 Embeddable * | getInstance_ (const std::type_info &type, Position index) |
static Embeddable * | getInstance_ (const std::type_info &type, const String &identifier) |
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!
Definition at line 61 of file modularWidget.h.
BALL::VIEW::ModularWidget::ModularWidget | ( | const char * | name = "<ModularWidget>" | ) |
Default Constructor. Set the name of this ModularWidget to name.
name | the name of this modularWidget |
BALL::VIEW::ModularWidget::ModularWidget | ( | const ModularWidget & | widget | ) |
Copy constructor.
|
virtual |
Destructor. If the ModularWidget was registered, it will call MainControl::removeModularWidget.
|
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.
|
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.
preferences | the Preferences dialog of the MainControl |
Reimplemented in BALL::VIEW::Scene, BALL::VIEW::ServerWidget, BALL::VIEW::PyWidget, and BALL::VIEW::DisplayProperties.
Definition at line 227 of file modularWidget.h.
Test if this ModularWidget can handle a given file format
fileform | short string with the file extension (e.g. PDB) |
Reimplemented in BALL::VIEW::PyWidget, BALL::VIEW::TestFramework, BALL::VIEW::DatasetControl, and BALL::VIEW::MolecularFileDialog.
Definition at line 141 of file modularWidget.h.
|
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::PyWidget, BALL::VIEW::Scene, BALL::VIEW::MolecularFileDialog, BALL::VIEW::MolecularStructure, BALL::VIEW::MolecularControl, BALL::VIEW::DisplayProperties, BALL::VIEW::DockingController, BALL::VIEW::GeometricControl, BALL::VIEW::TestFramework, BALL::VIEW::DownloadElectronDensity, BALL::VIEW::DownloadPDBFile, BALL::VIEW::DatasetControl, BALL::VIEW::PubChemDialog, BALL::VIEW::FileObserver, and BALL::VIEW::UndoManagerDialog.
|
virtual |
Explicit default initialization. Currently does nothing.
Reimplemented from BALL::VIEW::ConnectionObject.
Reimplemented in BALL::VIEW::Scene, BALL::VIEW::ServerWidget, and BALL::VIEW::GeometricControl.
|
inlinevirtual |
Explicit destructor. Calls clear
Reimplemented from BALL::VIEW::ConnectionObject.
Definition at line 95 of file modularWidget.h.
|
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::Scene, BALL::VIEW::ServerWidget, and BALL::VIEW::PyWidget.
|
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::PyWidget, BALL::VIEW::Scene, BALL::VIEW::MolecularStructure, BALL::VIEW::MolecularControl, BALL::VIEW::DockingController, BALL::VIEW::LabelDialog, BALL::VIEW::DownloadElectronDensity, BALL::VIEW::DownloadPDBFile, and BALL::VIEW::DockWidget.
|
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::Scene, BALL::VIEW::ServerWidget, BALL::VIEW::PyWidget, and BALL::VIEW::DisplayProperties.
|
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::ServerWidget, BALL::VIEW::PyWidget, BALL::VIEW::PluginDialog, BALL::VIEW::LogView, 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 |
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::Scene, BALL::VIEW::ServerWidget, BALL::VIEW::PyWidget, and BALL::VIEW::DisplayProperties.
|
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::Scene, BALL::VIEW::ServerWidget, BALL::VIEW::PyWidget, BALL::VIEW::MolecularControl, BALL::VIEW::MolecularStructure, BALL::VIEW::DisplayProperties, BALL::VIEW::LabelDialog, BALL::VIEW::GenericControl, BALL::VIEW::PluginDialog, BALL::VIEW::DockingController, BALL::VIEW::TestFramework, BALL::VIEW::LogView, BALL::VIEW::HelpViewer, BALL::VIEW::GeometricControl, BALL::VIEW::MolecularFileDialog, BALL::VIEW::DatasetControl, BALL::VIEW::PubChemDialog, BALL::VIEW::OpenBruker1DFile, BALL::VIEW::OpenBruker2DFile, BALL::VIEW::AssignBondOrderConfigurationDialog, BALL::VIEW::ShortcutDialog, BALL::VIEW::DownloadElectronDensity, BALL::VIEW::DownloadPDBFile, BALL::VIEW::DemoTutorialDialog, BALL::VIEW::FileObserver, BALL::VIEW::AssignBondOrderResultsDialog, BALL::VIEW::UndoManagerDialog, BALL::VIEW::DockWidget, BALL::VIEW::EditFunctions, and BALL::VIEW::StereoSettingsDialog.
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 |
||
) |
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.
Tell this ModularWidget to open a given file.
Reimplemented in BALL::VIEW::PyWidget, BALL::VIEW::TestFramework, BALL::VIEW::DatasetControl, and BALL::VIEW::MolecularFileDialog.
Definition at line 147 of file modularWidget.h.
|
virtual |
Register an QObject for the help system.
Reimplemented in BALL::VIEW::HelpViewer, and BALL::VIEW::DockWidget.
|
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 | ( | 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.
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 |
void BALL::VIEW::ModularWidget::setMenuHelp | ( | QAction * | action, |
const String & | url | ||
) |
Set the help URL for the given action
action | the action to process (it is safe to pass a null pointer) |
url | the url to add |
|
virtual |
Set the text of the statusbar of the main application. Note: The ModularWidget must be registered to a MainControl. Implemented for convenience.
|
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 |
Reimplemented in BALL::VIEW::HelpViewer.
bool BALL::VIEW::ModularWidget::unlockComposites | ( | ) |
Unlock the Composites.
|
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::PyWidget, BALL::VIEW::Scene, BALL::VIEW::MolecularStructure, BALL::VIEW::MolecularControl, BALL::VIEW::DockingController, BALL::VIEW::LabelDialog, BALL::VIEW::DownloadElectronDensity, BALL::VIEW::DockWidget, and BALL::VIEW::DownloadPDBFile.
|
protected |
Definition at line 316 of file modularWidget.h.
|
protected |
Definition at line 318 of file modularWidget.h.
|
protected |
Definition at line 313 of file modularWidget.h.
|
protected |
Definition at line 310 of file modularWidget.h.