1 // File: QtxActionToolMgr.h
2 // Author: Alexander SOLOVYEV, Sergey TELKOV
4 #ifndef QTXACTIONTOOLMGR_H
5 #define QTXACTIONTOOLMGR_H
11 #include "QtxActionMgr.h"
17 #pragma warning( disable:4251 )
20 class QTX_EXPORT QtxActionToolMgr : public QtxActionMgr
27 ToolNode() : id( -1 ), visible( true ) {};
33 typedef QValueList<ToolNode> NodeList;
39 QtxActionToolMgr( QMainWindow* );
40 virtual ~QtxActionToolMgr();
42 QMainWindow* mainWindow() const;
44 int createToolBar( const QString&, int = -1 );
45 void removeToolBar( const QString& );
46 void removeToolBar( const int );
48 int insert( const int, const int, const int = -1 );
49 int insert( QAction*, const int, const int = -1 );
50 int insert( const int, const QString&, const int = -1 );
51 int insert( QAction*, const QString&, const int = -1 );
53 int append( const int, const int );
54 int append( QAction*, const int );
55 int append( const int, const QString& );
56 int append( QAction*, const QString& );
58 int prepend( const int, const int );
59 int prepend( QAction*, const int );
60 int prepend( const int, const QString& );
61 int prepend( QAction*, const QString& );
63 virtual bool isVisible( const int, const int ) const;
64 virtual void setVisible( const int, const int, const bool );
66 void show( const int );
67 void hide( const int );
68 bool isShown( const int ) const;
69 void setShown( const int, const bool );
71 void remove( const int, const int );
72 void remove( const int, const QString& );
74 QToolBar* toolBar( const int ) const;
75 QToolBar* toolBar( const QString& ) const;
77 bool hasToolBar( const int ) const;
78 bool hasToolBar( const QString& ) const;
80 virtual bool load( const QString&, QtxActionMgr::Reader& );
83 void onToolBarDestroyed();
86 int find( QToolBar* ) const;
87 int find( const QString& ) const;
88 QToolBar* find( const QString&, QMainWindow* ) const;
90 virtual void internalUpdate();
91 void updateToolBar( const int );
94 void simplifySeparators( QToolBar* );
97 typedef struct { NodeList nodes; QToolBar* toolBar; } ToolBarInfo;
98 typedef QMap<int, ToolBarInfo> ToolBarMap;
101 ToolBarMap myToolBars;
102 QMainWindow* myMainWindow;
105 class QtxActionToolMgr::ToolCreator : public QtxActionMgr::Creator
108 ToolCreator( QtxActionMgr::Reader*, QtxActionToolMgr* );
109 virtual ~ToolCreator();
111 virtual int append( const QString&, const bool,
112 const ItemAttributes&, const int );
115 QtxActionToolMgr* myMgr;