Implements actions group for menu Windows with standard operations, like "Split vertical", "Split horizontal", etc.
#include <QtxWorkstackAction.h>
Public Types | |
enum | { SplitVertical = 0x0001, SplitHorizontal = 0x0002, Windows = 0x0010, Split = SplitVertical | SplitHorizontal, Standard = Split | Windows } |
Actions (menu items) ID. More... | |
Public Member Functions | |
QtxWorkstackAction (QtxWorkstack *, QObject *=0) | |
Constructor. More... | |
virtual | ~QtxWorkstackAction () |
Destructor. More... | |
QtxWorkstack * | workstack () const |
Get workstack. More... | |
QAction * | getArrangeViewsAction () |
Get arrange views action. More... | |
int | menuActions () const |
Get menu actions which are currently visible in the menu bar. More... | |
void | setMenuActions (const int) |
Set actions to be visible in the menu. More... | |
QIcon | icon (const int) const |
Get icon for the specified action. More... | |
QString | text (const int) const |
Get menu item text for the specified action. More... | |
int | accel (const int) const |
Get keyboard accelerator for the specified action. More... | |
QString | statusTip (const int) const |
Get status bar tip for the specified action. More... | |
void | setAccel (const int, const int) |
Set keyboard accelerator for the specified action. More... | |
void | setIcon (const int, const QIcon &) |
Set menu item icon for the specified action. More... | |
void | setText (const int, const QString &) |
Set menu item text for the specified action. More... | |
void | setStatusTip (const int, const QString &) |
Set menu item status bar tip for the specified action. More... | |
void | perform (const int) |
Process action activated by the user. More... | |
Public Member Functions inherited from QtxActionSet | |
QtxActionSet (QObject *=0) | |
Constructor. More... | |
virtual | ~QtxActionSet () |
Destructor. More... | |
QList< QAction * > | actions () const |
Get list of child actions. More... | |
void | setActions (const QList< QAction * > &) |
Assign child actions. More... | |
void | insertActions (const QList< QAction * > &, const int=-1) |
Insert actions at the specified position. More... | |
int | insertAction (QAction *, const int id=-1, const int=-1) |
Insert action at the specified position. More... | |
int | insertAction (const QString &, const int id=-1, const int=-1) |
Insert action at the specified position. More... | |
int | insertAction (const QString &, const QIcon &, const int id=-1, const int=-1) |
Insert action at the specified position. More... | |
void | removeAction (QAction *) |
Remove specified action. More... | |
void | removeAction (const int) |
Remove specified action. More... | |
void | clear () |
Remove all actions. More... | |
Public Member Functions inherited from QtxAction | |
QtxAction (QObject *=0, bool=false, const QString &=QString()) | |
Constructor. More... | |
QtxAction (const QString &, const QString &, int, QObject *, bool=false, const QString &=QString()) | |
Constructor. More... | |
QtxAction (const QString &, const QString &, const QKeySequence &, QObject *, bool=false, const QString &=QString()) | |
Constructor. More... | |
QtxAction (const QString &, const QIcon &, const QString &, int, QObject *, bool=false, const QString &=QString()) | |
Constructor. More... | |
QtxAction (const QString &, const QIcon &, const QString &, const QKeySequence &, QObject *, bool=false, const QString &=QString()) | |
Constructor. More... | |
virtual | ~QtxAction () |
Destructor. More... | |
virtual bool | eventFilter (QObject *, QEvent *) |
Customize action events. More... | |
QString | shortcutActionName () const |
Return shortcut action name for the action. More... | |
void | setShortcutActionName (const QString &) |
Set shortcut action name to the action. More... | |
Protected Member Functions | |
virtual void | addedTo (QWidget *) |
Called when action is added to the menu bar. More... | |
virtual void | removedFrom (QWidget *) |
Called when action is removed from the menu bar. More... | |
Protected Member Functions inherited from QtxActionSet | |
virtual void | actionAdded (QAction *) |
Notify that action was added. More... | |
virtual void | actionRemoved (QAction *) |
Notify that action was removed. More... | |
QAction * | action (int) const |
Get action by specified identifier. More... | |
int | actionId (QAction *) const |
Get action identifier for the action. More... | |
void | setActionId (QAction *, const int) |
Set action identifier for the action. More... | |
virtual bool | isEmptyAction () const |
Check if the action itself should be invisible (only child action are shown) More... | |
virtual void | updateAction () |
Update action set. More... | |
virtual void | updateAction (QWidget *) |
Update action set for the specified widget. More... | |
Protected Member Functions inherited from QtxAction | |
virtual void | customEvent (QEvent *) |
Process notification events. More... | |
Private Slots | |
void | onAboutToShow () |
Called when parent menu is about to show. More... | |
void | onTriggered (int) |
Called when menu item is activated by the user. More... | |
Private Member Functions | |
void | updateContent () |
Update all menu action state. More... | |
void | updateWindows () |
Update actions which refer to the opened child windows. More... | |
void | splitVertical () |
Split the window area in the workstack in the vertical direction. More... | |
void | splitHorizontal () |
Split the window area in the workstack in the horizontal direction. More... | |
void | activateItem (const int) |
Called when menu item corresponding to some child window is activated. More... | |
Private Attributes | |
QtxWorkstack * | myWorkstack |
parent workstack More... | |
bool | myWindowsFlag |
"show child windows items" flag More... | |
QAction * | myArrangeViewsAction |
Additional Inherited Members | |
Signals inherited from QtxActionSet | |
void | triggered (int) |
Emitted when some child action is activated by the user. More... | |
void | triggered (QAction *) |
Emitted when some child action is activated by the user. More... | |
anonymous enum |
QtxWorkstackAction::QtxWorkstackAction | ( | QtxWorkstack * | ws, |
QObject * | parent = 0 |
||
) |
ws | workstack |
parent | parent object (owner of the action) |
References QtxWorkstack::action(), QtxActionSet::insertAction(), myArrangeViewsAction, myWorkstack, onTriggered(), QtxAction::QtxAction(), setMenuActions(), SplitHorizontal, QtxWorkstack::SplitHorizontal, SplitVertical, QtxWorkstack::SplitVertical, Standard, and QtxActionSet::triggered().
|
virtual |
int QtxWorkstackAction::accel | ( | const int | id | ) | const |
id | menu action ID |
References QtxActionSet::action().
|
private |
Activates correposponding child window.
idx | menu item index |
References QtxWorkstack::windowList(), and workstack().
|
protectedvirtual |
w | menu bar widget this action is being added to |
Reimplemented from QtxActionSet.
References QtxActionSet::addedTo(), and onAboutToShow().
QAction * QtxWorkstackAction::getArrangeViewsAction | ( | ) |
References myArrangeViewsAction.
QIcon QtxWorkstackAction::icon | ( | const int | id | ) | const |
If id is invalid, null icon is returned.
id | menu action ID |
References QtxActionSet::action().
int QtxWorkstackAction::menuActions | ( | ) | const |
References QtxActionSet::action(), myWindowsFlag, SplitHorizontal, SplitVertical, and Windows.
|
privateslot |
Updates all menu items.
References updateContent().
|
privateslot |
Perform the corresponding action.
id | menu item identifier |
References activateItem(), perform(), and Windows.
void QtxWorkstackAction::perform | ( | const int | type | ) |
type | action ID |
|
protectedvirtual |
w | menu bar widget this action is being removed from |
Reimplemented from QtxActionSet.
References onAboutToShow(), and QtxActionSet::removedFrom().
id | menu action ID |
a | new keyboard accelerator |
References QtxActionSet::action().
id | menu action ID |
ico | new menu item icon |
References QtxActionSet::action().
void QtxWorkstackAction::setMenuActions | ( | const int | flags | ) |
Actions, which IDs are set in flags parameter, will be shown in the menu bar. Other actions will not be shown.
flags | ORed together actions flags |
References QtxActionSet::action(), myWindowsFlag, SplitHorizontal, SplitVertical, and Windows.
id | menu action ID |
txt | new menu item status bar tip |
References QtxActionSet::action().
id | menu action ID |
txt | new menu item text |
References QtxActionSet::action().
|
private |
References QtxWorkstack::splitHorizontal(), and workstack().
|
private |
References QtxWorkstack::splitVertical(), and workstack().
QString QtxWorkstackAction::statusTip | ( | const int | id | ) | const |
id | menu action ID |
References QtxActionSet::action().
QString QtxWorkstackAction::text | ( | const int | id | ) | const |
id | menu action ID |
References QtxActionSet::action().
|
private |
|
private |
References QtxActionSet::action(), QtxActionSet::actionId(), QtxActionSet::actions(), QtxWorkstack::activeWindow(), QtxActionSet::insertActions(), menuActions(), QtxAction::QtxAction(), QtxActionSet::removeAction(), QtxActionSet::setActionId(), SplitHorizontal, SplitVertical, QtxWorkstack::windowList(), Windows, and workstack().
QtxWorkstack * QtxWorkstackAction::workstack | ( | ) | const |
References myWorkstack.
|
private |
|
private |
|
private |