KoToolBox.h
1/*
2 Copyright (c) 2005 Boudewijn Rempt <boud@valdyas.org>
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301, USA.
18 */
19#ifndef _KO_TOOLBOX_H_
20#define _KO_TOOLBOX_H_
21
22#include <tqtoolbutton.h>
23#include <tqptrvector.h>
24#include <tqtoolbar.h>
25#include <koffice_export.h>
26#include <tdetoolbar.h>
27
28class TQWidget;
29class TDEAction;
30class TDEMainWindow;
32class TQGridLayout;
33class ToolArea;
34
35
45class KOFFICEUI_EXPORT KoToolBox : public TDEToolBar {
46
47 TQ_OBJECT
48
49
50public:
51
52 KoToolBox( TDEMainWindow *mainWin, const char* name, TDEInstance* instance, int numberOfTooltypes);
53 virtual ~KoToolBox();
54
55 // Called by the toolcontroller for each tool. For every category,
56 // there is a separate list, and the tool is categorized correctly.
57 // The tool is not yet added to the widgets; call setupTools()
58 // to do that. We don't store the tool.
59 void registerTool(TDEAction * tool, int toolType, TQ_UINT32 priority);
60
61 // Called when all tools have been added by the tool controller
62 void setupTools();
63
64public slots:
65
66 virtual void setOrientation ( TQt::Orientation o );
67 void slotButtonPressed( int id );
68 void slotPressButton( int id );
69
70 // Enables or disables all buttons and the corresponding actions.
71 void enableTools(bool enable);
72
73 void slotSetTool(const TQString & toolname);
74
75private:
76
77 TQToolButton * createButton(TQWidget * parent, const char* iconName, TQString tooltip);
78
79
80private:
81 TQ_UINT32 m_numberOfButtons;
82
83 TQButtonGroup * m_buttonGroup; // The invisible group of all toolbuttons, so only one can be active at a given time
84
85 TQPtrList<ToolArea> m_toolBoxes; // For every ToolArea
86
87 typedef TQMap< int, TDEAction*> ToolList; // The priority ordered list of tools for a certain tooltype
88
89 TQPtrList<ToolList> m_tools;
90 TQPtrList<TDEAction> m_idToActionMap; // Map the buttongroup id's to actions for easy activating.
91 TDEInstance* m_instance;
92};
93
94
95class ToolArea : public TQWidget {
96
97public:
98 ToolArea(TQWidget *parent);
99 ~ToolArea();
100
101 void setOrientation ( TQt::Orientation o );
102 void add(TQWidget *button);
103
104 TQWidget* getNextParent();
105
106private:
107 TQPtrList<TQWidget> m_children;
108 TQBoxLayout *m_layout;
109
110 TQWidget *m_leftRow;
111 TQBoxLayout *m_leftLayout;
112
113 TQWidget *m_rightRow;
114 TQBoxLayout *m_rightLayout;
115
116 bool m_left;
117};
118
119
120#endif // _KO_TOOLBOX_H_
TDEActionBox is a kind of super-specialized toolbox that can order tools according to type and priori...
Definition KoToolBox.h:45