summaryrefslogtreecommitdiffabout
path: root/microkde/kdeui/ktoolbar.h
Unidiff
Diffstat (limited to 'microkde/kdeui/ktoolbar.h') (more/less context) (show whitespace changes)
-rw-r--r--microkde/kdeui/ktoolbar.h68
1 files changed, 38 insertions, 30 deletions
diff --git a/microkde/kdeui/ktoolbar.h b/microkde/kdeui/ktoolbar.h
index 3319fa8..4e00abd 100644
--- a/microkde/kdeui/ktoolbar.h
+++ b/microkde/kdeui/ktoolbar.h
@@ -1,244 +1,252 @@
1/* This file is part of the KDE libraries 1/* This file is part of the KDE libraries
2 Copyright (C) 2000 Reginald Stadlbauer (reggie@kde.org) 2 Copyright (C) 2000 Reginald Stadlbauer (reggie@kde.org)
3 (C) 1997, 1998 Stephan Kulow (coolo@kde.org) 3 (C) 1997, 1998 Stephan Kulow (coolo@kde.org)
4 (C) 1997, 1998 Sven Radej (radej@kde.org) 4 (C) 1997, 1998 Sven Radej (radej@kde.org)
5 (C) 1997, 1998 Mark Donohoe (donohoe@kde.org) 5 (C) 1997, 1998 Mark Donohoe (donohoe@kde.org)
6 (C) 1997, 1998 Matthias Ettrich (ettrich@kde.org) 6 (C) 1997, 1998 Matthias Ettrich (ettrich@kde.org)
7 (C) 1999, 2000 Kurt Granroth (granroth@kde.org) 7 (C) 1999, 2000 Kurt Granroth (granroth@kde.org)
8 8
9 This library is free software; you can redistribute it and/or 9 This library is free software; you can redistribute it and/or
10 modify it under the terms of the GNU Library General Public 10 modify it under the terms of the GNU Library General Public
11 License version 2 as published by the Free Software Foundation. 11 License version 2 as published by the Free Software Foundation.
12 12
13 This library is distributed in the hope that it will be useful, 13 This library is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of 14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Library General Public License for more details. 16 Library General Public License for more details.
17 17
18 You should have received a copy of the GNU Library General Public License 18 You should have received a copy of the GNU Library General Public License
19 along with this library; see the file COPYING.LIB. If not, write to 19 along with this library; see the file COPYING.LIB. If not, write to
20 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 20 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21 Boston, MA 02111-1307, USA. 21 Boston, MA 02111-1307, USA.
22 */ 22 */
23 23
24#ifndef KTOOLBAR_H 24#ifndef KTOOLBAR_H
25#define KTOOLBAR_H 25#define KTOOLBAR_H
26 26
27#ifndef DESKTOP_VERSION 27#ifndef DESKTOP_VERSION
28#define private public 28#define private public
29#include <qtoolbar.h> 29#include <q3toolbar.h>
30#undef private 30#undef private
31#include <qpe/qpetoolbar.h> 31#include <qpe/qpetoolbar.h>
32#else 32#else
33#include <qtoolbar.h> 33#include <q3toolbar.h>
34#endif 34#endif
35 35
36 36
37#include <qmainwindow.h> 37#include <q3mainwindow.h>
38#include <qcombobox.h> 38#include <qcombobox.h>
39#include <qmap.h> 39#include <qmap.h>
40#include <qptrlist.h> 40#include <q3ptrlist.h>
41//Added by qt3to4:
42#include <QPixmap>
43#include <QResizeEvent>
44#include <Q3PopupMenu>
45#include <QMouseEvent>
46#include <QChildEvent>
47#include <QEvent>
48#include <QShowEvent>
41#include <kglobal.h> 49#include <kglobal.h>
42#include <qguardedptr.h> 50#include <qpointer.h>
43#include <qframe.h> 51#include <q3frame.h>
44#include <qiconset.h> 52#include <qicon.h>
45 53
46class QDomElement; 54class QDomElement;
47class QSize; 55class QSize;
48class QPixmap; 56class QPixmap;
49class QPopupMenu; 57class Q3PopupMenu;
50class QStringList; 58class QStringList;
51class QDomDocument; 59class QDomDocument;
52class QTimer; 60class QTimer;
53 61
54class KLineEdit; 62class KLineEdit;
55class KToolBar; 63class KToolBar;
56class KToolBarButton; 64class KToolBarButton;
57class KToolBoxManager; 65class KToolBoxManager;
58//US class KAnimWidget; 66//US class KAnimWidget;
59//US class KPopupMenu; 67//US class KPopupMenu;
60//US class KInstance; 68//US class KInstance;
61class KComboBox; 69class KComboBox;
62class KXMLGUIClient; 70class KXMLGUIClient;
63 71
64class KToolBarPrivate; 72class KToolBarPrivate;
65 73
66class KToolBarSeparator : public QFrame 74class KToolBarSeparator : public Q3Frame
67{ 75{
68 Q_OBJECT 76 Q_OBJECT
69public: 77public:
70 KToolBarSeparator( Orientation, bool l, QToolBar *parent, const char* name=0 ); 78 KToolBarSeparator( Qt::Orientation, bool l, Q3ToolBar *parent, const char* name=0 );
71 79
72 QSize sizeHint() const; 80 QSize sizeHint() const;
73 Orientation orientation() const { return orient; } 81 Qt::Orientation orientation() const { return orient; }
74 QSizePolicy sizePolicy() const; 82 QSizePolicy sizePolicy() const;
75 bool showLine() const { return line; } 83 bool showLine() const { return line; }
76public slots: 84public slots:
77 void setOrientation( Orientation ); 85 void setOrientation( Qt::Orientation );
78protected: 86protected:
79 void styleChange( QStyle& ); 87 void styleChange( QStyle& );
80private: 88private:
81 Orientation orient; 89 Qt::Orientation orient;
82 bool line; 90 bool line;
83}; 91};
84 92
85 93
86 /** 94 /**
87 * A KDE-style toolbar. 95 * A KDE-style toolbar.
88 * 96 *
89 * KToolBar can be dragged around in and between different docks. 97 * KToolBar can be dragged around in and between different docks.
90 * 98 *
91 * A KToolBar can contain all sorts of widgets. 99 * A KToolBar can contain all sorts of widgets.
92 * 100 *
93 * KToolBar can be used as a standalone widget, but @ref KMainWindow 101 * KToolBar can be used as a standalone widget, but @ref KMainWindow
94 * provides easy factories and management of one or more toolbars. 102 * provides easy factories and management of one or more toolbars.
95 * Once you have a KToolBar object, you can insert items into it with the 103 * Once you have a KToolBar object, you can insert items into it with the
96 * insert... methods, or remove them with the @ref removeItem() method. This 104 * insert... methods, or remove them with the @ref removeItem() method. This
97 * can be done at any time; the toolbar will be automatically updated. 105 * can be done at any time; the toolbar will be automatically updated.
98 * There are also many methods to set per-child properties like alignment 106 * There are also many methods to set per-child properties like alignment
99 * and toggle behaviour. 107 * and toggle behaviour.
100 * 108 *
101 * KToolBar uses a global config group to load toolbar settings on 109 * KToolBar uses a global config group to load toolbar settings on
102 * construction. It will reread this config group on a 110 * construction. It will reread this config group on a
103 * @ref KApplication::appearanceChanged() signal. 111 * @ref KApplication::appearanceChanged() signal.
104 * 112 *
105 * @short Floatable toolbar with auto resize. 113 * @short Floatable toolbar with auto resize.
106 * @version $Id$ 114 * @version $Id$
107 * @author Reginald Stadlbauer <reggie@kde.org>, Stephan Kulow <coolo@kde.org>, Sven Radej <radej@kde.org>. 115 * @author Reginald Stadlbauer <reggie@kde.org>, Stephan Kulow <coolo@kde.org>, Sven Radej <radej@kde.org>.
108 */ 116 */
109 117
110// strange things are happening ... so I have to use strange define methods ... 118// strange things are happening ... so I have to use strange define methods ...
111// porting KToolBar back to Qt2 really needs some strange hacks 119// porting KToolBar back to Qt2 really needs some strange hacks
112 120
113#ifndef DESKTOP_VERSION 121#ifndef DESKTOP_VERSION
114#define QToolBar QPEToolBar 122#define Q3ToolBar QPEToolBar
115#endif 123#endif
116 124
117 class KToolBar : public QToolBar 125 class KToolBar : public Q3ToolBar
118{ 126{
119 Q_OBJECT 127 Q_OBJECT
120 128
121 129
122 Q_ENUMS( IconText BarPosition ) 130 Q_ENUMS( IconText BarPosition )
123 131
124 Q_PROPERTY( IconText iconText READ iconText WRITE setIconText ) 132 Q_PROPERTY( IconText iconText READ iconText WRITE setIconText )
125 Q_PROPERTY( BarPosition barPos READ barPos WRITE setBarPos ) 133 Q_PROPERTY( BarPosition barPos READ barPos WRITE setBarPos )
126 Q_PROPERTY( bool fullSize READ fullSize WRITE setFullSize ) 134 Q_PROPERTY( bool fullSize READ fullSize WRITE setFullSize )
127 Q_PROPERTY( int iconSize READ iconSize WRITE setIconSize ) 135 Q_PROPERTY( int iconSize READ iconSize WRITE setIconSize )
128 Q_PROPERTY( QString text READ text WRITE setText ) 136 Q_PROPERTY( QString text READ text WRITE setText )
129#ifndef DESKTOP_VERSION 137#ifndef DESKTOP_VERSION
130#undef QToolBar 138#undef Q3ToolBar
131#endif 139#endif
132public: 140public:
133 enum IconText{IconOnly = 0, IconTextRight, TextOnly, IconTextBottom}; 141 enum IconText{IconOnly = 0, IconTextRight, TextOnly, IconTextBottom};
134 /** 142 /**
135 * The state of the status bar. 143 * The state of the status bar.
136 * @deprecated 144 * @deprecated
137 **/ 145 **/
138 enum BarStatus{Toggle, Show, Hide}; 146 enum BarStatus{Toggle, Show, Hide};
139 /** 147 /**
140 * Possible bar positions. 148 * Possible bar positions.
141 **/ 149 **/
142 enum BarPosition{ Unmanaged, Floating, Top, Bottom, Right, Left, Flat}; 150 enum BarPosition{ Unmanaged, Floating, Top, Bottom, Right, Left, Flat};
143 151
144 /** 152 /**
145 * Constructor. 153 * Constructor.
146 * This constructor is used by the XML-GUI. If you use it, you need 154 * This constructor is used by the XML-GUI. If you use it, you need
147 * to call QMainWindow::addToolBar to specify the position of the toolbar. 155 * to call QMainWindow::addToolBar to specify the position of the toolbar.
148 * So it's simpler to use the other constructor. 156 * So it's simpler to use the other constructor.
149 * 157 *
150 * The toolbar will read in various global config settings for 158 * The toolbar will read in various global config settings for
151 * things like icon size and text position, etc. However, some of 159 * things like icon size and text position, etc. However, some of
152 * the settings will be honored only if @ref #_honor_mode is set to 160 * the settings will be honored only if @ref #_honor_mode is set to
153 * true. All other toolbars will be IconOnly and use Medium icons. 161 * true. All other toolbars will be IconOnly and use Medium icons.
154 * 162 *
155 * @param parent The standard toolbar parent (usually a 163 * @param parent The standard toolbar parent (usually a
156 * @ref KMainWindow) 164 * @ref KMainWindow)
157 * @param name The standard internal name 165 * @param name The standard internal name
158 * @param honor_style If true, then global settings for IconSize and IconText will be honored 166 * @param honor_style If true, then global settings for IconSize and IconText will be honored
159 * @param readConfig whether to apply the configuration (global and application-specific) 167 * @param readConfig whether to apply the configuration (global and application-specific)
160 */ 168 */
161 KToolBar( QWidget *parent, const char *name = 0, bool honor_style = FALSE, bool readConfig = TRUE ); 169 KToolBar( QWidget *parent, const char *name = 0, bool honor_style = FALSE, bool readConfig = TRUE );
162 170
163 /** 171 /**
164 * Constructor for non-XML-GUI applications. 172 * Constructor for non-XML-GUI applications.
165 * 173 *
166 * The toolbar will read in various global config settings for 174 * The toolbar will read in various global config settings for
167 * things like icon size and text position, etc. However, some of 175 * things like icon size and text position, etc. However, some of
168 * the settings will be honored only if @ref #_honor_mode is set to 176 * the settings will be honored only if @ref #_honor_mode is set to
169 * true. All other toolbars will be IconOnly and use Medium icons. 177 * true. All other toolbars will be IconOnly and use Medium icons.
170 * 178 *
171 * @param parentWindow The window that should be the parent of this toolbar 179 * @param parentWindow The window that should be the parent of this toolbar
172 * @param dock The position of the toolbar. Usually QMainWindow::Top. 180 * @param dock The position of the toolbar. Usually QMainWindow::Top.
173 * @param newLine If true, start a new line in the dock for this toolbar. 181 * @param newLine If true, start a new line in the dock for this toolbar.
174 * @param name The standard internal name 182 * @param name The standard internal name
175 * @param honor_style If true, then global settings for IconSize and IconText will be honored 183 * @param honor_style If true, then global settings for IconSize and IconText will be honored
176 * @param readConfig whether to apply the configuration (global and application-specific) 184 * @param readConfig whether to apply the configuration (global and application-specific)
177 */ 185 */
178 KToolBar( QMainWindow *parentWindow, QMainWindow::ToolBarDock dock /*= QMainWindow::Top*/, bool newLine = false, 186 KToolBar( Q3MainWindow *parentWindow, Qt::ToolBarDock dock /*= QMainWindow::Top*/, bool newLine = false,
179 const char *name = 0, bool honor_style = FALSE, bool readConfig = TRUE ); 187 const char *name = 0, bool honor_style = FALSE, bool readConfig = TRUE );
180 188
181 /** 189 /**
182 * Constructor for non-XML-GUI applications. 190 * Constructor for non-XML-GUI applications.
183 * 191 *
184 * The toolbar will read in various global config settings for 192 * The toolbar will read in various global config settings for
185 * things like icon size and text position, etc. However, some of 193 * things like icon size and text position, etc. However, some of
186 * the settings will be honored only if @ref #_honor_mode is set to 194 * the settings will be honored only if @ref #_honor_mode is set to
187 * true. All other toolbars will be IconOnly and use Medium icons. 195 * true. All other toolbars will be IconOnly and use Medium icons.
188 * 196 *
189 * @param parentWindow The window that should be the parent of this toolbar 197 * @param parentWindow The window that should be the parent of this toolbar
190 * @param dock Another widget than the mainwindow to dock toolbar to. 198 * @param dock Another widget than the mainwindow to dock toolbar to.
191 * @param newLine If true, start a new line in the dock for this toolbar. 199 * @param newLine If true, start a new line in the dock for this toolbar.
192 * @param name The standard internal name 200 * @param name The standard internal name
193 * @param honor_style If true, then global settings for IconSize and IconText will be honored 201 * @param honor_style If true, then global settings for IconSize and IconText will be honored
194 * @param readConfig whether to apply the configuration (global and application-specific) 202 * @param readConfig whether to apply the configuration (global and application-specific)
195 */ 203 */
196 KToolBar( QMainWindow *parentWindow, QWidget *dock, bool newLine = false, 204 KToolBar( Q3MainWindow *parentWindow, QWidget *dock, bool newLine = false,
197 const char *name = 0, bool honor_style = FALSE, bool readConfig = TRUE ); 205 const char *name = 0, bool honor_style = FALSE, bool readConfig = TRUE );
198 206
199 virtual ~KToolBar(); 207 virtual ~KToolBar();
200 208
201 /** 209 /**
202 * Insert a button (a @ref KToolBarButton) with a pixmap. The 210 * Insert a button (a @ref KToolBarButton) with a pixmap. The
203 * pixmap is loaded by the button itself based on the global icon 211 * pixmap is loaded by the button itself based on the global icon
204 * settings. 212 * settings.
205 * 213 *
206 * You should connect to one or more signals in KToolBar: 214 * You should connect to one or more signals in KToolBar:
207 * @ref clicked() , @ref pressed() , @ref released() , or 215 * @ref clicked() , @ref pressed() , @ref released() , or
208 * @ref highlighted() and if the button is a toggle button 216 * @ref highlighted() and if the button is a toggle button
209 * (@ref setToggle() ) @ref toggled() . Those signals have @p id 217 * (@ref setToggle() ) @ref toggled() . Those signals have @p id
210 * of a button that caused the signal. If you want to bind a popup 218 * of a button that caused the signal. If you want to bind a popup
211 * to button, see @ref setButton(). 219 * to button, see @ref setButton().
212 * 220 *
213 * @param icon The name of the icon to use as the active pixmap 221 * @param icon The name of the icon to use as the active pixmap
214 * @param id The id of this button 222 * @param id The id of this button
215 * @param enabled Enable or disable the button at startup 223 * @param enabled Enable or disable the button at startup
216 * @param text The tooltip or toolbar text (depending on state) 224 * @param text The tooltip or toolbar text (depending on state)
217 * @param index The position of the button. (-1 = at end). 225 * @param index The position of the button. (-1 = at end).
218 * 226 *
219 * @return The item index. 227 * @return The item index.
220 */ 228 */
221 int insertButton(const QString& icon, int id, bool enabled = true, 229 int insertButton(const QString& icon, int id, bool enabled = true,
222 const QString& text = QString::null, int index=-1/*US , 230 const QString& text = QString::null, int index=-1/*US ,
223 KInstance *_instance = KGlobal::instance()*/); 231 KInstance *_instance = KGlobal::instance()*/);
224 232
225 /** 233 /**
226 * This is the same as above, but with specified signals and 234 * This is the same as above, but with specified signals and
227 * slots to which this button will be connected. 235 * slots to which this button will be connected.
228 * 236 *
229 * You can add more signals with @ref addConnection(). 237 * You can add more signals with @ref addConnection().
230 * 238 *
231 * @param icon The name of the icon to use as the active pixmap 239 * @param icon The name of the icon to use as the active pixmap
232 * @param id The id of this button 240 * @param id The id of this button
233 * @param signal The signal to connect to 241 * @param signal The signal to connect to
234 * @param receiver The slot's parent 242 * @param receiver The slot's parent
235 * @param enabled Enable or disable the button at startup 243 * @param enabled Enable or disable the button at startup
236 * @param text The tooltip or toolbar text (depending on state) 244 * @param text The tooltip or toolbar text (depending on state)
237 * @param index The position of the button. (-1 = at end). 245 * @param index The position of the button. (-1 = at end).
238 * 246 *
239 * @return The item index. 247 * @return The item index.
240 */ 248 */
241 int insertButton(const QString& icon, int id, const char *signal, 249 int insertButton(const QString& icon, int id, const char *signal,
242 const QObject *receiver, const char *slot, 250 const QObject *receiver, const char *slot,
243 bool enabled = true, const QString& text = QString::null, 251 bool enabled = true, const QString& text = QString::null,
244 int index=-1/*US, KInstance *_instance = KGlobal::instance()*/ ); 252 int index=-1/*US, KInstance *_instance = KGlobal::instance()*/ );
@@ -258,285 +266,285 @@ public:
258 * (@ref setToggle() ) @ref toggled() . Those signals have @p id 266 * (@ref setToggle() ) @ref toggled() . Those signals have @p id
259 * of a button that caused the signal. If you want to bind a popup 267 * of a button that caused the signal. If you want to bind a popup
260 * to button, see @ref setButton(). 268 * to button, see @ref setButton().
261 * 269 *
262 * @param pixmap The active pixmap 270 * @param pixmap The active pixmap
263 * @param id The id of this button 271 * @param id The id of this button
264 * @param enabled Enable or disable the button at startup 272 * @param enabled Enable or disable the button at startup
265 * @param text The tooltip or toolbar text (depending on state) 273 * @param text The tooltip or toolbar text (depending on state)
266 * @param index The position of the button. (-1 = at end). 274 * @param index The position of the button. (-1 = at end).
267 * 275 *
268 * @return The item index. 276 * @return The item index.
269 */ 277 */
270 int insertButton(const QPixmap& pixmap, int id, bool enabled = true, 278 int insertButton(const QPixmap& pixmap, int id, bool enabled = true,
271 const QString& text = QString::null, int index=-1 ); 279 const QString& text = QString::null, int index=-1 );
272 280
273 /** 281 /**
274 * This is the same as above, but with specified signals and 282 * This is the same as above, but with specified signals and
275 * slots to which this button will be connected. 283 * slots to which this button will be connected.
276 * 284 *
277 * You can add more signals with @ref addConnection(). 285 * You can add more signals with @ref addConnection().
278 * 286 *
279 * @param icon The name of the icon to use as the active pixmap 287 * @param icon The name of the icon to use as the active pixmap
280 * @param id The id of this button 288 * @param id The id of this button
281 * @param signal The signal to connect to 289 * @param signal The signal to connect to
282 * @param receiver The slot's parent 290 * @param receiver The slot's parent
283 * @param enabled Enable or disable the button at startup 291 * @param enabled Enable or disable the button at startup
284 * @param text The tooltip or toolbar text (depending on state) 292 * @param text The tooltip or toolbar text (depending on state)
285 * @param index The position of the button. (-1 = at end). 293 * @param index The position of the button. (-1 = at end).
286 * 294 *
287 * @return The item index. 295 * @return The item index.
288 */ 296 */
289 int insertButton(const QPixmap& pixmap, int id, const char *signal, 297 int insertButton(const QPixmap& pixmap, int id, const char *signal,
290 const QObject *receiver, const char *slot, 298 const QObject *receiver, const char *slot,
291 bool enabled = true, const QString& text = QString::null, 299 bool enabled = true, const QString& text = QString::null,
292 int index=-1 ); 300 int index=-1 );
293 301
294 /** 302 /**
295 * Inserts a button with popupmenu. 303 * Inserts a button with popupmenu.
296 * 304 *
297 * Button will have small 305 * Button will have small
298 * triangle. You have to connect to popup's signals. The 306 * triangle. You have to connect to popup's signals. The
299 * signals @ref KButton::pressed(), @ref KButton::released(), 307 * signals @ref KButton::pressed(), @ref KButton::released(),
300 * @ref KButton::clicked() or @ref KButton::doubleClicked() are @p not 308 * @ref KButton::clicked() or @ref KButton::doubleClicked() are @p not
301 * emmited by 309 * emmited by
302 * this button (see @ref setDelayedPopup() for that). 310 * this button (see @ref setDelayedPopup() for that).
303 * You can add custom popups which inherit @ref QPopupMenu to get popups 311 * You can add custom popups which inherit @ref QPopupMenu to get popups
304 * with tables, drawings etc. Just don't fiddle with events there. 312 * with tables, drawings etc. Just don't fiddle with events there.
305 */ 313 */
306 int insertButton(const QString& icon, int id, QPopupMenu *popup, 314 int insertButton(const QString& icon, int id, Q3PopupMenu *popup,
307 bool enabled, const QString&_text, int index=-1); 315 bool enabled, const QString&_text, int index=-1);
308 316
309 /** 317 /**
310 * Inserts a button with popupmenu. 318 * Inserts a button with popupmenu.
311 * 319 *
312 * Button will have small 320 * Button will have small
313 * triangle. You have to connect to popup's signals. The 321 * triangle. You have to connect to popup's signals. The
314 * signals @ref KButton::pressed(), @ref KButton::released(), 322 * signals @ref KButton::pressed(), @ref KButton::released(),
315 * @ref KButton::clicked() or @ref KButton::doubleClicked() are @p not 323 * @ref KButton::clicked() or @ref KButton::doubleClicked() are @p not
316 * emmited by 324 * emmited by
317 * this button (see @ref setDelayedPopup() for that). 325 * this button (see @ref setDelayedPopup() for that).
318 * You can add custom popups which inherit @ref QPopupMenu to get popups 326 * You can add custom popups which inherit @ref QPopupMenu to get popups
319 * with tables, drawings etc. Just don't fiddle with events there. 327 * with tables, drawings etc. Just don't fiddle with events there.
320 */ 328 */
321 int insertButton(const QPixmap& pixmap, int id, QPopupMenu *popup, 329 int insertButton(const QPixmap& pixmap, int id, Q3PopupMenu *popup,
322 bool enabled, const QString&_text, int index=-1); 330 bool enabled, const QString&_text, int index=-1);
323 331
324 /** 332 /**
325 * Inserts a @ref KLineEdit. You have to specify signals and slots to 333 * Inserts a @ref KLineEdit. You have to specify signals and slots to
326 * which KLineEdit will be connected. KLineEdit has all slots QLineEdit 334 * which KLineEdit will be connected. KLineEdit has all slots QLineEdit
327 * has, plus signals @ref KLineEdit::completion and @ref KLineEdit::textRotation 335 * has, plus signals @ref KLineEdit::completion and @ref KLineEdit::textRotation
328 * KLineEdit can be set to autoresize itself to full free width 336 * KLineEdit can be set to autoresize itself to full free width
329 * in toolbar, that is to last right aligned item. For that, 337 * in toolbar, that is to last right aligned item. For that,
330 * toolbar must be set to full width (which it is by default). 338 * toolbar must be set to full width (which it is by default).
331 * @see setFullWidth() 339 * @see setFullWidth()
332 * @see setItemAutoSized() 340 * @see setItemAutoSized()
333 * @see KLineEdit 341 * @see KLineEdit
334 * @return Item index. 342 * @return Item index.
335 */ 343 */
336 int insertLined (const QString& text, int id, 344 int insertLined (const QString& text, int id,
337 const char *signal, 345 const char *signal,
338 const QObject *receiver, const char *slot, 346 const QObject *receiver, const char *slot,
339 bool enabled = true, 347 bool enabled = true,
340 const QString& toolTipText = QString::null, 348 const QString& toolTipText = QString::null,
341 int size = 70, int index =-1); 349 int size = 70, int index =-1);
342 350
343 /** 351 /**
344 * Inserts a @ref KComboBox with list. 352 * Inserts a @ref KComboBox with list.
345 * 353 *
346 * Can be writable, but cannot contain 354 * Can be writable, but cannot contain
347 * pixmaps. By default inserting policy is AtBottom, i.e. typed items 355 * pixmaps. By default inserting policy is AtBottom, i.e. typed items
348 * are placed at the bottom of the list. Can be autosized. If the size 356 * are placed at the bottom of the list. Can be autosized. If the size
349 * argument is specified as -1, the width of the combobox is automatically 357 * argument is specified as -1, the width of the combobox is automatically
350 * computed. 358 * computed.
351 * 359 *
352 * @see setFullWidth() 360 * @see setFullWidth()
353 * @see setItemAutoSized() 361 * @see setItemAutoSized()
354 * @see KComboBox 362 * @see KComboBox
355 * @return Item index. 363 * @return Item index.
356 */ 364 */
357 int insertCombo (const QStringList &list, int id, bool writable, 365 int insertCombo (const QStringList &list, int id, bool writable,
358 const char *signal, const QObject *receiver, 366 const char *signal, const QObject *receiver,
359 const char *slot, bool enabled=true, 367 const char *slot, bool enabled=true,
360 const QString& tooltiptext=QString::null, 368 const QString& tooltiptext=QString::null,
361 int size=70, int index=-1, 369 int size=70, int index=-1,
362 QComboBox::Policy policy = QComboBox::AtBottom); 370 QComboBox::Policy policy = QComboBox::InsertAtBottom);
363 371
364 /** 372 /**
365 * Insert a @ref KComboBox with text. 373 * Insert a @ref KComboBox with text.
366 * 374 *
367 * The rest is the same as above. 375 * The rest is the same as above.
368 * @see setItemAutoSized() 376 * @see setItemAutoSized()
369 * 377 *
370 * @see KComboBox 378 * @see KComboBox
371 * @return Item index. 379 * @return Item index.
372 */ 380 */
373 int insertCombo (const QString& text, int id, bool writable, 381 int insertCombo (const QString& text, int id, bool writable,
374 const char *signal, QObject *recevier, 382 const char *signal, QObject *recevier,
375 const char *slot, bool enabled=true, 383 const char *slot, bool enabled=true,
376 const QString& tooltiptext=QString::null, 384 const QString& tooltiptext=QString::null,
377 int size=70, int index=-1, 385 int size=70, int index=-1,
378 QComboBox::Policy policy = QComboBox::AtBottom); 386 QComboBox::Policy policy = QComboBox::InsertAtBottom);
379 387
380 /** 388 /**
381 * Inserts a separator into the toolbar with the given id. 389 * Inserts a separator into the toolbar with the given id.
382 * Returns the separator's index 390 * Returns the separator's index
383 */ 391 */
384 int insertSeparator( int index = -1, int id = -1 ); 392 int insertSeparator( int index = -1, int id = -1 );
385 393
386 /** 394 /**
387 * Inserts a line separator into the toolbar with the given id. 395 * Inserts a line separator into the toolbar with the given id.
388 * Returns the separator's index 396 * Returns the separator's index
389 */ 397 */
390 int insertLineSeparator( int index = -1, int id = -1 ); 398 int insertLineSeparator( int index = -1, int id = -1 );
391 399
392 /** 400 /**
393 * Inserts a user-defined widget. The widget @p must have this 401 * Inserts a user-defined widget. The widget @p must have this
394 * toolbar as its parent. 402 * toolbar as its parent.
395 * 403 *
396 * Widget must have a QWidget for base class. Widget can be 404 * Widget must have a QWidget for base class. Widget can be
397 * autosized to full width. If you forget about it, you can get a 405 * autosized to full width. If you forget about it, you can get a
398 * pointer to this widget with @ref getWidget(). 406 * pointer to this widget with @ref getWidget().
399 * @see setItemAutoSized() 407 * @see setItemAutoSized()
400 * @return Item index. 408 * @return Item index.
401 */ 409 */
402 int insertWidget(int id, int width, QWidget *_widget, int index=-1); 410 int insertWidget(int id, int width, QWidget *_widget, int index=-1);
403 411
404 /** 412 /**
405 * Inserts an animated widget. A @ref KAnimWidget will be created 413 * Inserts an animated widget. A @ref KAnimWidget will be created
406 * internally using the icon name you provide. 414 * internally using the icon name you provide.
407 * This will emit a signal (clicked()) whenever the 415 * This will emit a signal (clicked()) whenever the
408 * animation widget is clicked. 416 * animation widget is clicked.
409 * 417 *
410 * @see animatedWidget() 418 * @see animatedWidget()
411 * 419 *
412 * @param id The id for this toolbar item 420 * @param id The id for this toolbar item
413 * @param receiver The parent of your slot 421 * @param receiver The parent of your slot
414 * @param slot The slot to receive the clicked() signal 422 * @param slot The slot to receive the clicked() signal
415 * @param icons The name of the animation icon group to use 423 * @param icons The name of the animation icon group to use
416 * @param index The item index 424 * @param index The item index
417 * 425 *
418 * @return The item index 426 * @return The item index
419 */ 427 */
420/*US 428/*US
421 int insertAnimatedWidget(int id, QObject *receiver, const char *slot, 429 int insertAnimatedWidget(int id, QObject *receiver, const char *slot,
422 const QString& icons, int index = -1); 430 const QString& icons, int index = -1);
423*/ 431*/
424 /** 432 /**
425 * This will return a pointer to the given animated widget, if it 433 * This will return a pointer to the given animated widget, if it
426 * exists. 434 * exists.
427 * 435 *
428 * @see insertAnimatedWidget 436 * @see insertAnimatedWidget
429 * 437 *
430 * @param id The id for the widget you want to get a pointer to 438 * @param id The id for the widget you want to get a pointer to
431 * 439 *
432 * @return A pointer to the current animated widget or 0L 440 * @return A pointer to the current animated widget or 0L
433 */ 441 */
434//US KAnimWidget *animatedWidget( int id ); 442//US KAnimWidget *animatedWidget( int id );
435 443
436 /** 444 /**
437 * Adds connections to items. 445 * Adds connections to items.
438 * 446 *
439 * It is important that you 447 * It is important that you
440 * know the @p id of particular item. Nothing happens if you forget @p id. 448 * know the @p id of particular item. Nothing happens if you forget @p id.
441 */ 449 */
442 void addConnection (int id, const char *signal, 450 void addConnection (int id, const char *signal,
443 const QObject *receiver, const char *slot); 451 const QObject *receiver, const char *slot);
444 /** 452 /**
445 * Enables/disables item. 453 * Enables/disables item.
446 */ 454 */
447 void setItemEnabled( int id, bool enabled ); 455 void setItemEnabled( int id, bool enabled );
448 456
449 /** 457 /**
450 * Sets the icon for a button. 458 * Sets the icon for a button.
451 * 459 *
452 * Can be used while button is visible. 460 * Can be used while button is visible.
453 */ 461 */
454 void setButtonIcon( int id, const QString& _icon ); 462 void setButtonIcon( int id, const QString& _icon );
455 463
456 /** 464 /**
457 * Sets button pixmap. 465 * Sets button pixmap.
458 * 466 *
459 * Can be used while button is visible. 467 * Can be used while button is visible.
460 */ 468 */
461 void setButtonPixmap( int id, const QPixmap& _pixmap ); 469 void setButtonPixmap( int id, const QPixmap& _pixmap );
462 470
463 /** 471 /**
464 * Sets a button icon from a QIconSet. 472 * Sets a button icon from a QIconSet.
465 * 473 *
466 * Can be used while button is visible. 474 * Can be used while button is visible.
467 */ 475 */
468 void setButtonIconSet( int id, const QIconSet& iconset ); 476 void setButtonIconSet( int id, const QIcon& iconset );
469 477
470 /** 478 /**
471 * Sets a delayed popup for a button. 479 * Sets a delayed popup for a button.
472 * 480 *
473 * Delayed popup is what you see in 481 * Delayed popup is what you see in
474 * Netscape Navigator's Previous and Next buttons: If you click them you 482 * Netscape Navigator's Previous and Next buttons: If you click them you
475 * go back 483 * go back
476 * or forth. If you press them long enough, you get a history-menu. 484 * or forth. If you press them long enough, you get a history-menu.
477 * This is exactly what we do here. 485 * This is exactly what we do here.
478 * 486 *
479 * You will insert normal a button with connection (or use signals from 487 * You will insert normal a button with connection (or use signals from
480 * toolbar): 488 * toolbar):
481 * <pre> 489 * <pre>
482 * bar->insertButton(icon, id, SIGNAL(clicked ()), this, 490 * bar->insertButton(icon, id, SIGNAL(clicked ()), this,
483 * SLOT (slotClick()), true, "click or wait for popup"); 491 * SLOT (slotClick()), true, "click or wait for popup");
484 * </pre> And then add a delayed popup: 492 * </pre> And then add a delayed popup:
485 * <pre> 493 * <pre>
486 * bar->setDelayedPopup (id, historyPopup); </pre> 494 * bar->setDelayedPopup (id, historyPopup); </pre>
487 * 495 *
488 * Don't add delayed popups to buttons which have normal popups. 496 * Don't add delayed popups to buttons which have normal popups.
489 * 497 *
490 * You may add popups which are derived from @ref QPopupMenu. You may 498 * You may add popups which are derived from @ref QPopupMenu. You may
491 * add popups that are already in the menu bar or are submenus of 499 * add popups that are already in the menu bar or are submenus of
492 * other popups. 500 * other popups.
493 */ 501 */
494 void setDelayedPopup (int id , QPopupMenu *_popup, bool toggle = false); 502 void setDelayedPopup (int id , Q3PopupMenu *_popup, bool toggle = false);
495 503
496 /** 504 /**
497 * Turns a button into an autorepeat button. 505 * Turns a button into an autorepeat button.
498 * 506 *
499 * Toggle buttons, buttons with menus, or 507 * Toggle buttons, buttons with menus, or
500 * buttons with delayed menus cannot be made into autorepeat buttons. 508 * buttons with delayed menus cannot be made into autorepeat buttons.
501 * Moreover, you can and will receive 509 * Moreover, you can and will receive
502 * only the signal clicked(), but not pressed() or released(). 510 * only the signal clicked(), but not pressed() or released().
503 * When the user presses this button, you will receive the signal clicked(), 511 * When the user presses this button, you will receive the signal clicked(),
504 * and if the button is still pressed after some time, 512 * and if the button is still pressed after some time,
505 * you will receive more clicked() signals separated by regular 513 * you will receive more clicked() signals separated by regular
506 * intervals. Since this uses @ref QButton::setAutoRepeat() , 514 * intervals. Since this uses @ref QButton::setAutoRepeat() ,
507 * I can't quantify 'some'. 515 * I can't quantify 'some'.
508 */ 516 */
509 void setAutoRepeat (int id, bool flag=true); 517 void setAutoRepeat (int id, bool flag=true);
510 518
511 519
512 /** 520 /**
513 * Turns button into a toggle button if @p flag is true. 521 * Turns button into a toggle button if @p flag is true.
514 */ 522 */
515 void setToggle (int id, bool flag = true); 523 void setToggle (int id, bool flag = true);
516 524
517 /** 525 /**
518 * Toggles a togglebutton. 526 * Toggles a togglebutton.
519 * 527 *
520 * If the button is a toggle button (see @ref setToggle()) 528 * If the button is a toggle button (see @ref setToggle())
521 * the button state will be toggled. This will also cause the toolbar to 529 * the button state will be toggled. This will also cause the toolbar to
522 * emit the signal @ref KButton::toggled() with parameter @p id. You must connect to 530 * emit the signal @ref KButton::toggled() with parameter @p id. You must connect to
523 * this signal, or use @ref addConnection() to connect directly to the 531 * this signal, or use @ref addConnection() to connect directly to the
524 * button signal @ref KButton::toggled(). 532 * button signal @ref KButton::toggled().
525 */ 533 */
526 void toggleButton (int id); 534 void toggleButton (int id);
527 535
528 /** 536 /**
529 * Sets a toggle button state. 537 * Sets a toggle button state.
530 * 538 *
531 * If the button is a toggle button (see @ref setToggle()) 539 * If the button is a toggle button (see @ref setToggle())
532 * this will set its state flag. This will also emit the signal 540 * this will set its state flag. This will also emit the signal
533 * @ref KButton::toggled(). 541 * @ref KButton::toggled().
534 * 542 *
535 * @see setToggle() 543 * @see setToggle()
536 */ 544 */
537 void setButton (int id, bool flag); 545 void setButton (int id, bool flag);
538 546
539 /** 547 /**
540 * @return @p true if button is on, @p false if button is off or if the 548 * @return @p true if button is on, @p false if button is off or if the
541 * button is not a toggle button. 549 * button is not a toggle button.
542 * @see setToggle() 550 * @see setToggle()
@@ -1015,96 +1023,96 @@ signals:
1015 /** 1023 /**
1016 * Emitted when toolbar changes position, or when 1024 * Emitted when toolbar changes position, or when
1017 * an item is removed from toolbar. 1025 * an item is removed from toolbar.
1018 * 1026 *
1019 * If you subclass @ref KMainWindow and reimplement 1027 * If you subclass @ref KMainWindow and reimplement
1020 * @ref KMainWindow::resizeEvent() be sure to connect to 1028 * @ref KMainWindow::resizeEvent() be sure to connect to
1021 * this signal. Note: You can connect this signal to a slot that 1029 * this signal. Note: You can connect this signal to a slot that
1022 * doesn't take parameter. 1030 * doesn't take parameter.
1023 */ 1031 */
1024 void moved( BarPosition ); 1032 void moved( BarPosition );
1025 1033
1026 /** 1034 /**
1027 * @internal 1035 * @internal
1028 * This signal is emitted when toolbar detects changing of 1036 * This signal is emitted when toolbar detects changing of
1029 * following parameters: 1037 * following parameters:
1030 * highlighting, button-size, button-mode. This signal is 1038 * highlighting, button-size, button-mode. This signal is
1031 * internal, aimed to buttons. 1039 * internal, aimed to buttons.
1032 */ 1040 */
1033 void modechange (); 1041 void modechange ();
1034 1042
1035 /** 1043 /**
1036 * This signal is emitted when the toolbar is getting deleted, 1044 * This signal is emitted when the toolbar is getting deleted,
1037 * and before ~KToolbar finishes (so it's still time to remove 1045 * and before ~KToolbar finishes (so it's still time to remove
1038 * widgets from the toolbar). 1046 * widgets from the toolbar).
1039 * Used by KWidgetAction. 1047 * Used by KWidgetAction.
1040 * @since 3.2 1048 * @since 3.2
1041 */ 1049 */
1042 void toolbarDestroyed(); 1050 void toolbarDestroyed();
1043 1051
1044public: 1052public:
1045 /** 1053 /**
1046 * @return global setting for "Highlight buttons under mouse" 1054 * @return global setting for "Highlight buttons under mouse"
1047 */ 1055 */
1048 void repaintMe(); 1056 void repaintMe();
1049 static bool highlightSetting(); 1057 static bool highlightSetting();
1050 1058
1051 /** 1059 /**
1052 * @return global setting for "Toolbars transparent when moving" 1060 * @return global setting for "Toolbars transparent when moving"
1053 */ 1061 */
1054 static bool transparentSetting(); 1062 static bool transparentSetting();
1055 1063
1056 /** 1064 /**
1057 * @return global setting for "Icon Text" 1065 * @return global setting for "Icon Text"
1058 */ 1066 */
1059 static IconText iconTextSetting(); 1067 static IconText iconTextSetting();
1060 1068
1061public slots: 1069public slots:
1062 virtual void setIconText( const QString &txt ) 1070 virtual void setIconText( const QString &txt )
1063 { QToolBar::setIconText( txt ); } 1071 { Q3ToolBar::setIconText( txt ); }
1064 void slotRepaint(); 1072 void slotRepaint();
1065 1073
1066protected: 1074protected:
1067 void mousePressEvent( QMouseEvent * ); 1075 void mousePressEvent( QMouseEvent * );
1068 void childEvent( QChildEvent *e ); 1076 void childEvent( QChildEvent *e );
1069 void showEvent( QShowEvent *e ); 1077 void showEvent( QShowEvent *e );
1070 void resizeEvent( QResizeEvent *e ); 1078 void resizeEvent( QResizeEvent *e );
1071 bool event( QEvent *e ); 1079 bool event( QEvent *e );
1072 void applyAppearanceSettings(KConfig *config, const QString &_configGroup, bool forceGlobal = false); 1080 void applyAppearanceSettings(KConfig *config, const QString &_configGroup, bool forceGlobal = false);
1073 QString settingsGroup(); 1081 QString settingsGroup();
1074 1082
1075private slots: 1083private slots:
1076 void rebuildLayout(); 1084 void rebuildLayout();
1077 void slotReadConfig (); 1085 void slotReadConfig ();
1078 void slotAppearanceChanged(); 1086 void slotAppearanceChanged();
1079 void slotIconChanged(int); 1087 void slotIconChanged(int);
1080 void toolBarPosChanged( QToolBar *tb ); 1088 void toolBarPosChanged( Q3ToolBar *tb );
1081 void slotContextAboutToShow(); 1089 void slotContextAboutToShow();
1082 void widgetDestroyed(); 1090 void widgetDestroyed();
1083 1091
1084private: 1092private:
1085 int sizeHintW; 1093 int sizeHintW;
1086 int sizeHintH; 1094 int sizeHintH;
1087 void init( bool readConfig = true, bool honorStyle = false ); 1095 void init( bool readConfig = true, bool honorStyle = false );
1088 void doConnections( KToolBarButton *button ); 1096 void doConnections( KToolBarButton *button );
1089 void insertWidgetInternal( QWidget *w, int &index, int id ); 1097 void insertWidgetInternal( QWidget *w, int &index, int id );
1090 void removeWidgetInternal( QWidget *w ); 1098 void removeWidgetInternal( QWidget *w );
1091 void getAttributes( QString &position, QString &icontext, int &index ); 1099 void getAttributes( QString &position, QString &icontext, int &index );
1092//US KPopupMenu *contextMenu(); 1100//US KPopupMenu *contextMenu();
1093 QPopupMenu *contextMenu(); 1101 Q3PopupMenu *contextMenu();
1094 1102
1095 QMap<QWidget*, int > widget2id; 1103 QMap<QWidget*, int > widget2id;
1096 typedef QMap<int, QWidget* > Id2WidgetMap; 1104 typedef QMap<int, QWidget* > Id2WidgetMap;
1097 Id2WidgetMap id2widget; 1105 Id2WidgetMap id2widget;
1098//US KPopupMenu *context; 1106//US KPopupMenu *context;
1099 QPopupMenu *context; 1107 Q3PopupMenu *context;
1100 QPtrList<QWidget> widgets; 1108 Q3PtrList<QWidget> widgets;
1101 QTimer *layoutTimer; 1109 QTimer *layoutTimer;
1102 QGuardedPtr<QWidget> stretchableWidget, rightAligned; 1110 QPointer<QWidget> stretchableWidget, rightAligned;
1103protected: 1111protected:
1104 virtual void virtual_hook( int id, void* data ); 1112 virtual void virtual_hook( int id, void* data );
1105private: 1113private:
1106 KToolBarPrivate *d; 1114 KToolBarPrivate *d;
1107 bool inshutdownprocess; 1115 bool inshutdownprocess;
1108}; 1116};
1109 1117
1110#endif 1118#endif