class toTool

# class toTool | Abstract baseclass for tools. More...
Contains pure virtuals
Definition | `#include <totool.h>`
Inherits | QObject (qt) [public ]
Inherited by | toHelpTool
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

#### Public Methods

- QCString name () const
- QCString key () const
- int priority () const
- ~toTool ()
- toTool (int priority,const char *name)
- virtual const QPixmap * toolbarImage ()
- virtual const char * menuItem ()
- virtual const char * toolbarTip ()
- virtual bool canHandle (toConnection &conn)
- virtual void customSetup (int toolid)
- virtual QWidget * toolWindow (QWidget *parent,toConnection &connection)
- virtual QWidget * configurationTab (QWidget *parent)
- virtual void about (QWidget *parent)
- virtual bool hasAbout (void)
- const QString & config (const QCString &tag,const QCString &def)
- void setConfig (const QCString &tag,const QString &value)
- void eraseConfig (const QCString &tag)

#### Public Slots

- void createWindow (void)

#### Public Static Methods

- static std::map<QCString,toTool *> & tools (void)
- static toTool * tool (const QCString &key)
- static void saveConfig (void)
- static const QString & globalConfig (const QCString &tag,const QCString &def)
- static void globalSetConfig (const QCString &tag,const QString &value)
- static void globalEraseConfig (const QCString &tag)
- static void loadMap (const QString &filename,std::map<QCString,QString> &map)
- static bool saveMap (const QString &filename,std::map<QCString,QString> &map)

#### Protected Methods

- virtual const char ** pictureXPM (void)

## Detailed Description

Abstract baseclass for tools.

This class is the baseclass of all classes defining tools. It contains functions for defining the priority and name of the tool, as well as virtual functions to define it's place in the user interface. Further it contains methods to access configuration settings.

To use this class you create a child which is then instantiated once which inserts that tool in the global tool map (See tools). You should never delete a tool unless on exit. Usually tools are instantiated statically in the global scope.

const char ** pictureXPM (void) | ### pictureXPM

[protected virtual]

Should return the xpm used to create the ButtonPicture.

QCString name () | ### name

[const]

Get the name.

Returns: Name of tool.

QCString key () | ### key

[const]

Get the name.

Returns: Name of tool.

int priority () | ### priority

[const]

Get the priority.

Returns: Priority of tool.

~toTool () | ### ~toTool

This should never be called, but if it is. Erases the tool from the list of available tools. WARNING: It will not remove any of it's open tools.

toTool (int priority,const char *name) | ### toTool

Create a tool. Remember that usually the main window is not created here.

Parameters:

priority | Priority of the created tool.
name | Name of tool.

const QPixmap * toolbarImage () | ### toolbarImage

[virtual]

Get the image to display in the toolbar.

Returns: Pointer to image in toolbar or NULL if no image should be displayed.

const char * menuItem () | ### menuItem

[virtual]

Get the name of the menuitem to be displayed in the menu.

Returns: A string containing the name of the menuentry or NULL if no menuentry should be created.

const char * toolbarTip () | ### toolbarTip

[virtual]

Get toolbar tip of the toolbar button. Defaults to same as menuItem.

Returns: Toolbar tip string.

bool canHandle (toConnection &conn) | ### canHandle

[virtual]

Check if the tool can handle a specific connection. Default is to only handle connections from the provider Oracle.

Returns: True if connection can be handled.

void customSetup (int toolid) | ### customSetup

[virtual]

This function is called as a last step after the main widget is created. It could be used to insert the tool pretty much anywhere in the user interface if the toolmenu, toolbar is not sufficient.

Parameters:

toolid | The tool menu id that should be used if it inserts a custom menu entry.

QWidget * toolWindow (QWidget *parent,toConnection &connection) | ### toolWindow

[pure virtual]

Create a new tool window.

Parameters:

parent | Parent window, which is the worksheet of the main window.
connection | The database connection that this tool should operate on.

QWidget * configurationTab (QWidget *parent) | ### configurationTab

[virtual]

Create and return configuration tab for this tool. The returned widget should also be a childclass of toSettingTab.

Returns: A pointer to the widget containing the setup tab for this tool or NULL of no settings are available.

void about (QWidget *parent) | ### about

[virtual]

Display an about dialog for this tool.

Parameters:

parent | The parent widget of the about dialog.

bool hasAbout (void) | ### hasAbout

[virtual]

Indicate whether or not this tool has an about dialog.

std::map<QCString,toTool *> & tools (void) | ### tools

[static]

Get access to the map of tools. Don't modify it. Observe that the index string is not the name of the tool but an internal key used to get tools sorted in the correct priority order.

Returns: A reference to the tool map.

See also: Tools

toTool * tool (const QCString &key) | ### tool

[static]

Get a pointer to the tool with a specified key.

Returns: A pointer to the tool or NULL if tool doesn't exist.

See also: Tools

void saveConfig (void) | ### saveConfig

[static]

Save configuration to file.

const QString & globalConfig (const QCString &tag,const QCString &def) | ### globalConfig

[static]

Get value of a setting.

Setting names are hierachical separated by ':' instead of '/' usually used in filenames. As an example all settings for the tool 'Example' would be under the 'Example:{settingname}' name.

Parameters:

tag | The name of the configuration setting.
def | Default value of the setting, if it is not available.

void globalSetConfig (const QCString &tag,const QString &value) | ### globalSetConfig

[static]

Change a setting. Depending on the implementation this can change the contents on disk or not.

Setting names are hierachical separated by ':' instead of '/' usually used in filenames. As an example all settings for the tool 'Example' would be under the 'Example:{settingname}' name.

Parameters:

tag | The name of the configuration setting.
def | Contents of this setting.

void globalEraseConfig (const QCString &tag) | ### globalEraseConfig

[static]

Remove a setting. Can be usefull for removing sensetive information.

Parameters:

tag | The name of the configuration setting to remove.

const QString & config (const QCString &tag,const QCString &def) | ### config

Get tool specific settings.

Setting names are hierachical separated by ':' instead of '/' usually used in filenames. As an example all settings for the tool 'Example' would be under the 'Example:{settingname}' name.

Parameters:

tag | The name of the configuration setting.
def | Contents of this setting.

void setConfig (const QCString &tag,const QString &value) | ### setConfig

Change toolspecific setting. Depending on the implementation this can change the contents on disk or not.

Setting names are hierachical separated by ':' instead of '/' usually used in filenames. As an example all settings for the tool 'Example' would be under the 'Example:{settingname}' name.

Parameters:

tag | The name of the configuration setting.
def | Default value of the setting, if it is not available.

void eraseConfig (const QCString &tag) | ### eraseConfig

Remove a toolspecific setting. Can be usefull for removing sensetive information.

Parameters:

tag | The name of the configuration setting to remove.

void loadMap (const QString &filename,std::map<QCString,QString> &map) | ### loadMap

[static]

Load a string to string map from file saved by the saveMap function.

Parameters:

filename | Filename to load
map | Reference to the map to fill with the new values.

bool saveMap (const QString &filename,std::map<QCString,QString> &map) | ### saveMap

[static]

Save a string to string map to file.

Parameters:

filename | Filename to load
map | Reference to the map to fill with the new values.

See also: loadMap

void createWindow (void) | ### createWindow

[slot]

Create a window of the current tool. This function sets up a toolwindow for this tool. It calls the toolWindow function to get widget and sets it up properly.

Generated by: nneul on skyhawk on Wed Feb 23 19:49:58 2005, using kdoc 2.0a54.