QtxActionToolMgr Class Reference

#include <QtxActionToolMgr.h>

Inheritance diagram for QtxActionToolMgr:

Inheritance graph

Public Member Functions

 QtxActionToolMgr (QMainWindow *)
virtual ~QtxActionToolMgr ()
QMainWindowmainWindow () const
int createToolBar (const QString &, int=-1)
void removeToolBar (const QString &)
void removeToolBar (const int)
int insert (const int, const int, const int=-1)
int insert (QAction *, const int, const int=-1)
int insert (const int, const QString &, const int=-1)
int insert (QAction *, const QString &, const int=-1)
int append (const int, const int)
int append (QAction *, const int)
int append (const int, const QString &)
int append (QAction *, const QString &)
int prepend (const int, const int)
int prepend (QAction *, const int)
int prepend (const int, const QString &)
int prepend (QAction *, const QString &)
virtual bool isVisible (const int, const int) const
virtual void setVisible (const int, const int, const bool)
void show (const int)
void hide (const int)
bool isShown (const int) const
void setShown (const int, const bool)
void remove (const int, const int)
void remove (const int, const QString &)
QToolBartoolBar (const int) const
QToolBartoolBar (const QString &) const
bool hasToolBar (const int) const
bool hasToolBar (const QString &) const
bool containsAction (const int, const int=-1) const
virtual bool load (const QString &, QtxActionMgr::Reader &)
virtual int registerAction (QAction *, const int=-1)
virtual void unRegisterAction (const int)
QActionaction (const int) const
int actionId (const QAction *) const
bool contains (const int) const
int count () const
bool isEmpty () const
void idList (QIntList &) const
bool isUpdatesEnabled () const
virtual void setUpdatesEnabled (const bool)
void update ()
virtual bool isEnabled (const int) const
virtual void setEnabled (const int, const bool)

Static Public Member Functions

static QActionseparator (const bool=false)

Protected Slots

void onToolBarDestroyed ()

Protected Member Functions

int find (QToolBar *) const
int find (const QString &) const
QToolBarfind (const QString &, QMainWindow *) const
virtual void internalUpdate ()
void updateToolBar (const int)
int generateId () const

Private Types

typedef QValueList< ToolNodeNodeList
typedef QMap< int, ToolBarInfoToolBarMap

Private Member Functions

void simplifySeparators (QToolBar *)

Private Attributes

ToolBarMap myToolBars
QMainWindowmyMainWindow

Data Structures

struct  ToolBarInfo
class  ToolCreator
class  ToolNode

Detailed Description

Allows to use set of action to automatically build set of toolbars. With help of methods insert/append/remove it is possible to describe toolbars and its internal structure. This manager is able to attune toolbar by removing excess separators


Member Typedef Documentation

typedef QValueList<ToolNode> QtxActionToolMgr.NodeList [private]
 

typedef QMap<int, ToolBarInfo> QtxActionToolMgr.ToolBarMap [private]
 


Constructor & Destructor Documentation

QtxActionToolMgr::QtxActionToolMgr QMainWindow p  ) 
 

Constructor

QtxActionToolMgr::~QtxActionToolMgr  )  [virtual]
 

Destructor


Member Function Documentation

QMainWindow * QtxActionToolMgr::mainWindow  )  const
 

Returns:
desktop

int QtxActionToolMgr::createToolBar const QString &  name,
int  tid = -1
 

Creates toolbar

Returns:
id of just created toolbar
Parameters:
name - name of toolbar
tid - proposed id (if such id is used already, then it will be returned without creation)

void QtxActionToolMgr::removeToolBar const QString &  tname  ) 
 

Removes toolbar

Parameters:
tname - toolbar name

void QtxActionToolMgr::removeToolBar const   int  ) 
 

Removes toolbar

Parameters:
tid - toolbar id

int QtxActionToolMgr::insert const   int,
const   int,
const   int = -1
 

Insert action into toolbar

Parameters:
id - identificator of action
tId - identificator of toolbar
idx - position inside toolbar

int QtxActionToolMgr::insert QAction act,
const   int,
const   int = -1
 

Insert action into toolbar

Parameters:
act - action
tId - identificator of toolbar
pos - position inside toolbar

int QtxActionToolMgr::insert const   int,
const QString &  tname,
const   int = -1
 

Insert action into toolbar

Parameters:
id - identificator of action
tname - name of toolbar
pos - position inside toolbar

int QtxActionToolMgr::insert QAction act,
const QString &  tname,
const   int = -1
 

Insert action into toolbar

Parameters:
act - action
tname - name of toolbar
pos - position inside toolbar

int QtxActionToolMgr::append const   int,
const   int
 

Append action into toolbar as last toolbutton

Parameters:
id - identificator of action
tId - identificator of toolbar

int QtxActionToolMgr::append QAction act,
const   int
 

Append action into toolbar as last toolbutton

Parameters:
act - action
tId - identificator of toolbar

int QtxActionToolMgr::append const   int,
const QString &  tname
 

Append action into toolbar as last toolbutton

Parameters:
id - identificator of action
tname - toolbar name

int QtxActionToolMgr::append QAction act,
const QString &  tname
 

Append action into toolbar as last toolbutton

Parameters:
act - action
tname - toolbar name

int QtxActionToolMgr::prepend const   int,
const   int
 

Append action into toolbar as first toolbutton

Parameters:
id - identificator of action
tId - identificator of toolbar

int QtxActionToolMgr::prepend QAction act,
const   int
 

Append action into toolbar as first toolbutton

Parameters:
act - action
tId - identificator of toolbar

int QtxActionToolMgr::prepend const   int,
const QString &  tname
 

Append action into toolbar as first toolbutton

Parameters:
id - identificator of action
tname - toolbar name

int QtxActionToolMgr::prepend QAction act,
const QString &  tname
 

Append action into toolbar as first toolbutton

Parameters:
act - action
tname - toolbar name

bool QtxActionToolMgr::isVisible const   int,
const   int
const [virtual]
 

Returns:
shown status of action in toolbar
Parameters:
id - action id
tId - toolbar id

Reimplemented from QtxActionMgr.

void QtxActionToolMgr::setVisible const   int,
const   int,
const   bool
[virtual]
 

Changes action shown status in certain toolbar

Parameters:
id - action id
tId - toolbar id
on - new shown status

Reimplemented from QtxActionMgr.

void QtxActionToolMgr::show const   int  ) 
 

Shows action in all toolbars

Parameters:
actId - action id

void QtxActionToolMgr::hide const   int  ) 
 

Hides action in all toolbars

Parameters:
actId - action id

bool QtxActionToolMgr::isShown const   int  )  const
 

Returns:
true if action is shown in all toolbars
Parameters:
id - action id

void QtxActionToolMgr::setShown const   int,
const   bool
 

Changes shown status of action in all toolbars

Parameters:
id - action id
on - new shown status

void QtxActionToolMgr::remove const   int,
const   int
 

Remove action from toolbar

Parameters:
id - identificator of action
tId - identificator of toolbar

void QtxActionToolMgr::remove const   int,
const QString &  tname
 

Remove action from toolbar

Parameters:
id - identificator of action
tname - name of toolbar

QToolBar * QtxActionToolMgr::toolBar const   int  )  const
 

Returns:
toolbar by it's id
Parameters:
tId - identificator of toolbar

QToolBar * QtxActionToolMgr::toolBar const QString &  tname  )  const
 

Returns:
toolbar by it's name
Parameters:
tname - name of toolbar

bool QtxActionToolMgr::hasToolBar const   int  )  const
 

Returns:
true if manager contains toolbar with such id
Parameters:
tId - identificator of toolbar

bool QtxActionToolMgr::hasToolBar const QString &  tname  )  const
 

Returns:
true if manager contains toolbar with such name
Parameters:
tname - name of toolbar

bool QtxActionToolMgr::containsAction const   int,
const   int = -1
const
 

Returns:
true if toolbar contains action
Parameters:
id - identificator of action
tId - identificator of toolbar

bool QtxActionToolMgr::load const QString &  fname,
QtxActionMgr::Reader r
[virtual]
 

Loads toolbar content from file

Parameters:
fname - file name
r - reader

void QtxActionToolMgr::onToolBarDestroyed  )  [protected, slot]
 

SLOT: called when toolbar is destroyed, removes just destroyed toolbar from map

int QtxActionToolMgr::find QToolBar t  )  const [protected]
 

Returns:
id of toolbar
Parameters:
t - toolbar

int QtxActionToolMgr::find const QString &  tname  )  const [protected]
 

Returns:
id of toolbar by it's name
Parameters:
tname - name of toolbar

QToolBar * QtxActionToolMgr::find const QString &  label,
QMainWindow mw
const [protected]
 

Returns:
toolbar by title
Parameters:
label - toolbar title
mw - desktop

void QtxActionToolMgr::internalUpdate  )  [protected, virtual]
 

Updates all toolbars

Reimplemented from QtxActionMgr.

void QtxActionToolMgr::updateToolBar const   int  )  [protected]
 

Updates toolbar

Parameters:
tId - toolbar id

void QtxActionToolMgr::simplifySeparators QToolBar t  )  [private]
 

Removes excess separators from toolbar

int QtxActionMgr::registerAction QAction a,
const   int = -1
[virtual, inherited]
 

Stores action in internal map If action with such id is registered already, then it will be unregistered

Parameters:
a - action to be registered
userId - proposed id (if it is less than 0, then id will be generated automatically)

void QtxActionMgr::unRegisterAction const   int  )  [virtual, inherited]
 

Removes action from internal map

Parameters:
id - action id

Reimplemented in QtxPopupMgr.

QAction * QtxActionMgr::action const   int  )  const [inherited]
 

Returns:
action by id
Parameters:
id - action id

int QtxActionMgr::actionId const QAction a  )  const [inherited]
 

Returns:
id by action
Parameters:
a - action

bool QtxActionMgr::contains const   int  )  const [inherited]
 

Returns:
true if internal map contains such id
Parameters:
id - action id

int QtxActionMgr::count  )  const [inherited]
 

Returns:
count of actions in internal map

bool QtxActionMgr::isEmpty  )  const [inherited]
 

Returns:
true if internal map is empty

void QtxActionMgr::idList QIntList lst  )  const [inherited]
 

Fills list with ids of registered actions

bool QtxActionMgr::isUpdatesEnabled  )  const [inherited]
 

Returns:
true if updates are enabled

void QtxActionMgr::setUpdatesEnabled const   bool  )  [virtual, inherited]
 

Enables/disables updates

Parameters:
upd - new state

void QtxActionMgr::update  )  [inherited]
 

Updates actions, check isUpdatesEnabled() and call internalUpdate()

See also:
isUpdatesEnabled(), internalUpdate()

bool QtxActionMgr::isEnabled const   int  )  const [virtual, inherited]
 

Returns:
true if action is enabled
Parameters:
id - action id

void QtxActionMgr::setEnabled const   int,
const   bool
[virtual, inherited]
 

Enables/disables action

Parameters:
id - action id
en - new state

QAction * QtxActionMgr::separator const   bool = false  )  [static, inherited]
 

Returns:
action for separator If this action doesn't exist, then it will be created
Parameters:
individual - if it is false, then action will be shared, otherwise it will be created on every call

int QtxActionMgr::generateId  )  const [protected, inherited]
 

Returns:
global free id


Field Documentation

ToolBarMap QtxActionToolMgr.myToolBars [private]
 

QMainWindow* QtxActionToolMgr.myMainWindow [private]