lib

kopalettemanager.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 version 2, as published by the Free Software Foundation.
7
8 This library is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 Library General Public License for more details.
12
13 You should have received a copy of the GNU Library General Public License
14 along with this library; see the file COPYING.LIB. If not, write to
15 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 */
17
18#ifndef _KO_PALETTE_MANAGER_
19#define _KO_PALETTE_MANAGER_
20
21#include <tqobject.h>
22#include <tqdockwindow.h>
23#include <tqstring.h>
24#include <tqmap.h>
25#include <tqdict.h>
26#include <tqvaluestack.h>
27#include <tqwidget.h>
28#include <tqsignalmapper.h>
29#include <tqstringlist.h>
30
31#include <koffice_export.h>
32
33#include <KoView.h>
34
35class KoPalette;
36class TDEActionMenu;
37class TDEAction;
39class TDEToggleAction;
40
41enum enumKoDockability {
42 DOCK_ENABLED = 0, // It's possible to dock the dockers
43 DOCK_DISABLED = 1, // The dockers cannot be docked
44 DOCK_SMART = 2 // On small screens, don't dock, else dock, initially
45};
46
47enum enumKoPaletteStyle {
48 PALETTE_DOCKER, // TQDockWindow based docker with tabs
49 PALETTE_TOOLBOX // TQDockWindow based docker with a TQToolBox
50};
51
52
53namespace {
54 struct DockerRecord {
55 int position;
56 int x;
57 int y;
58 int w;
59 int h;
60 };
61}
62
85class KOPALETTE_EXPORT KoPaletteManager : public TQObject {
86
87 TQ_OBJECT
88
89
90
91public:
92
93 KoPaletteManager(KoView * view, TDEActionCollection * ac, const char * name);
94 virtual ~KoPaletteManager();
95
96public:
97
116 virtual void addWidget(TQWidget * widget, const TQString & name, const TQString & paletteName, int position = -1,
117 enumKoPaletteStyle style = PALETTE_DOCKER, bool shown = true);
118
119
123 virtual TQWidget * widget(const TQString & name);
124
128 virtual void showWidget(const TQString & name);
129
133 virtual void hideWidget(const TQString & name);
134
141 virtual void removeWidget(const TQString & name);
142
143
148 virtual KoPalette * createPalette(const TQString & name, const TQString & caption, enumKoPaletteStyle style = PALETTE_DOCKER);
149
155 virtual void placePalette(const TQString & name, Dock location = DockRight);
156
161 virtual void addPalette(KoPalette * palette, const TQString & name, Dock location = DockRight);
162
166 virtual void setFixedWidth(int w);
167
168public slots:
169
170 void slotTogglePalette(int paletteIndex);
171 void slotToggleAllPalettes();
172 void showAllPalettes(bool shown);
173
178 virtual void slotReset();
179
183 virtual void slotResetFont();
184
185
186protected:
187
188 bool eventFilter( TQObject *o, TQEvent *e );
189
190private:
191
192
196 virtual void save();
197
198
199private:
200
201 KoView * m_view;
202 TDEActionCollection * m_actionCollection;
203 TDEActionMenu * m_viewActionMenu;
204 TDEToggleAction * m_toggleShowHidePalettes;
205 enumKoDockability m_dockability;
206
207 TQStringList * m_widgetNames;
208
209 TQDict<TQWidget> * m_widgets;
210 TQDict<KoPalette> * m_palettes;
211 TQValueStack<TQString> m_hiddenWidgets; // names of widgets actively hidden by hide all
212 TQDict<TDEToggleAction> * m_actions;
213 TQSignalMapper * m_mapper;
214
215 TQMap<TQString, TQString> * m_defaultMapping; // widget to docker
216 TQStringList m_defaultPaletteOrder; // Order of palette creation
217 TQStringList m_defaultWidgetOrder; // Order of widget addition
218 TQMap<TQString, TQString> * m_currentMapping; // widget to docker
219
220 bool m_setFixedWidth;
221 int m_fixedWidth;
222};
223
224#endif
virtual KoPalette * createPalette(const TQString &name, const TQString &caption, enumKoPaletteStyle style=PALETTE_DOCKER)
Create an empty palette in the given style.
virtual void addPalette(KoPalette *palette, const TQString &name, Dock location=DockRight)
Add a palette; this can be used to add palettes other than those in the two default styles.
virtual TQWidget * widget(const TQString &name)
Get a certain widget by name.
virtual void slotReset()
Restores the palette configuration to the default layout, i.e, the layout preferred by each docker.
virtual void addWidget(TQWidget *widget, const TQString &name, const TQString &paletteName, int position=-1, enumKoPaletteStyle style=PALETTE_DOCKER, bool shown=true)
Add a new tab with the given name an description to the specified palette.
virtual void slotResetFont()
Reset the font for all palettes.
virtual void removeWidget(const TQString &name)
Remove the widget with the specified name from whichever palette it is currently in.
virtual void hideWidget(const TQString &name)
hide the specified widget
virtual void showWidget(const TQString &name)
Show a the specified palette wherever it currently is.
virtual void placePalette(const TQString &name, Dock location=DockRight)
Move the specified palette to the specified location.
virtual void setFixedWidth(int w)
Sets all palettes to the specified fixed width.
A floating palette that allows the adding and removing of widgets to its organzing principle.
Definition kopalette.h:39
This class is used to display a KoDocument.
Definition KoView.h:58