ToolBar Class Reference

A widget containing buttons and other widgets to invoke custom processes. More...

#include <ToolBar.h>

Inheritance diagram for ToolBar:

Inheritance graph

List of all members.

Public Member Functions

virtual MenuBargetMenuBar () const =0
virtual void addButton (QAction *pAction, QAction *pBefore=NULL)=0
virtual void addButton (QAction *pAction, const std::string &shortcutContext, QAction *pBefore=NULL)=0
virtual QAction * insertWidget (QWidget *pWidget, QAction *pBefore=NULL)=0
virtual QAction * addSeparator (QAction *pBefore=NULL)=0
virtual std::vector< QAction * > getItems () const =0
virtual void removeItem (QAction *pAction)=0
virtual void show ()=0
virtual void hide ()=0
virtual bool isShown () const =0

Static Public Member Functions

static const std::string & signalShown ()
static const std::string & signalHidden ()

Protected Member Functions

virtual ~ToolBar ()


Detailed Description

A widget containing buttons and other widgets to invoke custom processes.

Each toolbar contains a menu bar as the first widget in the toolbar in which command actions can be added that relate to the other widgets and buttons on the toolbar.

This class provides a means for objects to add and remove buttons and other widgets from toolbars displayed in the main application window. The location of the button or widget can also be specified relative to the other buttons and widgets on the toolbar.

This subclass of Subject will notify upon the following conditions:

See also:
Window

Definition at line 41 of file ToolBar.h.


Constructor & Destructor Documentation

virtual ToolBar::~ToolBar (  )  [protected, virtual]

This should be destroyed by calling DesktopServices::deleteWindow.

Definition at line 228 of file ToolBar.h.


Member Function Documentation

static const std::string& ToolBar::signalShown (  )  [static]

Emitted when the toolbar is shown.

Definition at line 47 of file ToolBar.h.

static const std::string& ToolBar::signalHidden (  )  [static]

Emitted when the toolbar is hidden.

Definition at line 52 of file ToolBar.h.

virtual MenuBar* ToolBar::getMenuBar (  )  const [pure virtual]

Returns the menu bar associated with this toolbar.

Returns:
A pointer to the toolbar's menu bar.

virtual void ToolBar::addButton ( QAction *  pAction,
QAction *  pBefore = NULL 
) [pure virtual]

Adds the button to the toolbar.

This method adds a button to the toolbar based on the given action. The object calling this method is responsible for setting the icon and any other associated properties with the action and also any necessary connections to slot methods.

The button is added directly to the toolbar and the user will not be able to edit and save a keyboard shortcut in the user-defined configuration settings. To allow the user to edit the keyboard shortcut, call the overloaded addButton(QAction*, const std::string&, QAction*) method or call DesktopServices::initializeAction() prior to calling this method.

Parameters:
pAction The action to add to the toolbar as a button.
pBefore The button or widget that should immediately follow the added button. The button is added at the end of the toolbar if NULL is passed in or if the given action does not exist on the toolbar.
Subject Notifications:
This method will notify Subject::signalModified if the action was successfully added to the toolbar.
See also:
addSeparator()

virtual void ToolBar::addButton ( QAction *  pAction,
const std::string &  shortcutContext,
QAction *  pBefore = NULL 
) [pure virtual]

Adds the button to the toolbar.

This method adds a button to the toolbar based on the given action and allows the user to edit and save a keyboard shortcut based on the given context. If the user should not be able to edit the shortcut, call the overloaded addButton(QAction*, QAction*) method instead.

The object calling this method is responsible for setting the icon and any other associated properties with the action and also any necessary connections to slot methods.

Parameters:
pAction The action to add to the toolbar as a button.
shortcutContext The context name for the keyboard shortcut of the action. When the user edits keyboard shortcuts, the shortcuts are grouped according to their context string. Contexts can be nested by using a slash (/) between context levels. If the top-level context name is the same as a plug-in name, the shortcut is grouped under a single Plug-Ins context. Passing in an empty string indicates that the user should not be able to edit the keyboard shortcut of the command, which is the same as calling the overloaded addButton(QAction*, QAction*) method.
pBefore The button or widget that should immediately follow the added button. The button is added at the end of the toolbar if NULL is passed in or if the given action does not exist on the toolbar.
Subject Notifications:
This method will notify Subject::signalModified if the action was successfully added to the toolbar.
See also:
addSeparator()

virtual QAction* ToolBar::insertWidget ( QWidget *  pWidget,
QAction *  pBefore = NULL 
) [pure virtual]

Adds an existing widget to the toolbar.

Parameters:
pWidget The widget to add to the toolbar.
pBefore The button or widget that should immediately follow the added widget. The separator is added at the end of the toolbar if NULL is passed in or if the given action does not exist on the toolbar.
Returns:
A pointer to the Qt action for the widget created by the toolbar.
Subject Notifications:
This method will notify Subject::signalModified if the widget was successfully added to the toolbar.

virtual QAction* ToolBar::addSeparator ( QAction *  pBefore = NULL  )  [pure virtual]

Adds a separator to the toolbar.

This method creates a separator widget on the toolbar to separate buttons into groups.

Parameters:
pBefore The button or widget that should immediately follow the added separator. The separator is added at the end of the toolbar if NULL is passed in or if the given action does not exist on the toolbar.
Returns:
A pointer to the Qt action for the separator created by the toolbar.
Subject Notifications:
This method will notify Subject::signalModified if the separator was successfully added to the toolbar.

virtual std::vector<QAction*> ToolBar::getItems (  )  const [pure virtual]

Returns all buttons and widgets on the toolbar as actions.

Returns:
A vector of actions defining all buttons and widgets on the toolbar.

virtual void ToolBar::removeItem ( QAction *  pAction  )  [pure virtual]

Removes a button or widget from the toolbar.

This method removes the button or widget defined by the given action from the toolbar. The action is not deleted.

Parameters:
pAction The action defining the button or widget to remove from the toolbar.
Subject Notifications:
This method will notify Subject::signalModified if the action was successfully removed from the toolbar.

virtual void ToolBar::show (  )  [pure virtual]

Shows the toolbar.

This method will display the toolbar only if it's hidden. If the toolbar already shown, this method will do nothing.

Subject Notifications:
This method will notify signalShown() if the window was successfully displayed from a previously hidden state.
See also:
hide()

virtual void ToolBar::hide (  )  [pure virtual]

Hides the toolbar.

This method will hide the toolbar only if it's shown. If the toolbar already hidden, this method will do nothing.

Subject Notifications:
This method will notify signalHidden() if the window was successfully hidden from a previously visible state.
See also:
show()

virtual bool ToolBar::isShown (  )  const [pure virtual]

This method will return the current visiblity state of the toolbar.

Returns:
Returns true if the toolbar is shown or false if the toolbar is hidden.


Software Development Kit - Opticks 4.9.0 Build 16218