kexi
KoMacro::Manager Class Reference
#include <manager.h>
Detailed Description
The Manager class acts as window-wide manager for macros.Example how KoMacro could be used.
// We have a class that inheritates from QObject and // implements some public signals and slots that will // be accessible by Macros once a class-instance // got published. class PublishedObject : public QObject {}; // Somewhere we have our KMainWindow. KMainWindow* mainwindow = new KMainWindow(); // Create a new KoMacro::Manager instance to access the // Macro-framework. KoMacro::Manager* manager = new KoMacro::Manager( mainwindow ); // Now we like to publish a QObject PublishedObject* publishedobject = new PublishedObject(); manager->publishObject(publishedobject); // ... here we are able to use manager->createAction() to // create Action instances on the fly and work with them. // Finally free the publishedobject instance we created. We // need to free it manualy cause PublishedObject doesn't // got a QObject parent as argument. delete publishedobject; // Finally free the manager-instance. It's always needed // to free the instance by yourself! delete manager;
Definition at line 75 of file manager.h.
Public Member Functions | |
KXMLGUIClient * | guiClient () const |
bool | hasMacro (const QString ¯oname) |
KSharedPtr< Macro > | getMacro (const QString ¯oname) |
void | addMacro (const QString ¯oname, KSharedPtr< Macro > macro) |
void | removeMacro (const QString ¯oname) |
KSharedPtr< Macro > | createMacro (const QString ¯oname) |
KSharedPtr< Action > | action (const QString &name) const |
QMap< QString, KSharedPtr < Action > > | actions () const |
QStringList | actionNames () const |
void | publishAction (KSharedPtr< Action > action) |
void | publishObject (const QString &name, QObject *object) |
QGuardedPtr< QObject > | object (const QString &name) const |
QMap< QString, QGuardedPtr < QObject > > | objects () const |
Static Public Member Functions | |
static void | init (KXMLGUIClient *xmlguiclient) |
static Manager * | self () |
Friends | |
class | KStaticDeleter< ::KoMacro::Manager > |
Member Function Documentation
void Manager::init | ( | KXMLGUIClient * | xmlguiclient | ) | [static] |
Initialize this Manager singleton.
This function needs to be called exactly once to initialize the Manager singleton before self() got used.
Definition at line 65 of file manager.cpp.
Manager * Manager::self | ( | ) | [static] |
- Returns:
- a pointer to a Manager singleton-instance. The static method init() needs to be called exactly once before calling this method else we may return NULL .
Definition at line 76 of file manager.cpp.
KXMLGUIClient * Manager::guiClient | ( | ) | const |
- Returns:
- the KXMLGUIClient instance this Manager is associated with.
Definition at line 101 of file manager.cpp.
bool Manager::hasMacro | ( | const QString & | macroname | ) |
- Returns:
- true if we carry a Macro with the defined
macroname
.
Definition at line 106 of file manager.cpp.
KSharedPtr< Macro > Manager::getMacro | ( | const QString & | macroname | ) |
Definition at line 111 of file manager.cpp.
void Manager::addMacro | ( | const QString & | macroname, | |
KSharedPtr< Macro > | macro | |||
) |
void Manager::removeMacro | ( | const QString & | macroname | ) |
Remove the Macro defined with macroname
.
If we don't know about a Macro with that macroname
nothing happens.
Definition at line 121 of file manager.cpp.
KSharedPtr< Macro > Manager::createMacro | ( | const QString & | macroname | ) |
KSharedPtr< Action > Manager::action | ( | const QString & | name | ) | const |
- Returns:
- the Action which was published under the name
name
or returns an empty KSharedPtr<Action> object if there was no such Action published.
Definition at line 132 of file manager.cpp.
Action::Map Manager::actions | ( | ) | const |
QStringList Manager::actionNames | ( | ) | const |
void Manager::publishAction | ( | KSharedPtr< Action > | action | ) |
Publish the Action action
.
The published Action will be accessible via it's unique name.
Definition at line 147 of file manager.cpp.
void Manager::publishObject | ( | const QString & | name, | |
QObject * | object | |||
) |
Publish the passed QObject object
.
Those object will provide it's slots as callable functions.
Definition at line 156 of file manager.cpp.
QGuardedPtr< QObject > Manager::object | ( | const QString & | name | ) | const |
- Returns:
- the publish QObject defined with name
name
or NULL if there exists no such object.
Definition at line 162 of file manager.cpp.
QMap< QString, QGuardedPtr< QObject > > Manager::objects | ( | ) | const |
The documentation for this class was generated from the following files: