summaryrefslogtreecommitdiffabout
path: root/microkde/kdeui/ktoolbarbutton.h
Unidiff
Diffstat (limited to 'microkde/kdeui/ktoolbarbutton.h') (more/less context) (ignore whitespace changes)
-rw-r--r--microkde/kdeui/ktoolbarbutton.h17
1 files changed, 10 insertions, 7 deletions
diff --git a/microkde/kdeui/ktoolbarbutton.h b/microkde/kdeui/ktoolbarbutton.h
index 9aaa13c..ad02e4e 100644
--- a/microkde/kdeui/ktoolbarbutton.h
+++ b/microkde/kdeui/ktoolbarbutton.h
@@ -5,57 +5,60 @@
5 (C) 1997, 1998 Matthias Ettrich (ettrich@kde.org) 5 (C) 1997, 1998 Matthias Ettrich (ettrich@kde.org)
6 (C) 2000 Kurt Granroth (granroth@kde.org) 6 (C) 2000 Kurt Granroth (granroth@kde.org)
7 7
8 This library is free software; you can redistribute it and/or 8 This library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Library General Public 9 modify it under the terms of the GNU Library General Public
10 License version 2 as published by the Free Software Foundation. 10 License version 2 as published by the Free Software Foundation.
11 11
12 This library is distributed in the hope that it will be useful, 12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Library General Public License for more details. 15 Library General Public License for more details.
16 16
17 You should have received a copy of the GNU Library General Public License 17 You should have received a copy of the GNU Library General Public License
18 along with this library; see the file COPYING.LIB. If not, write to 18 along with this library; see the file COPYING.LIB. If not, write to
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. 20 Boston, MA 02111-1307, USA.
21*/ 21*/
22 22
23// $Id$ 23// $Id$
24#ifndef _KTOOLBARBUTTON_H 24#ifndef _KTOOLBARBUTTON_H
25#define _KTOOLBARBUTTON_H 25#define _KTOOLBARBUTTON_H
26 26
27#include <qpixmap.h> 27#include <qpixmap.h>
28#include <qtoolbutton.h> 28#include <qtoolbutton.h>
29#include <qintdict.h> 29#include <q3intdict.h>
30#include <qstring.h> 30#include <qstring.h>
31//Added by qt3to4:
32#include <QEvent>
33#include <Q3PopupMenu>
31#include <kglobal.h> 34#include <kglobal.h>
32 35
33class KToolBar; 36class KToolBar;
34class KToolBarButtonPrivate; 37class KToolBarButtonPrivate;
35//USclass KInstance; 38//USclass KInstance;
36class QEvent; 39class QEvent;
37class QPopupMenu; 40class Q3PopupMenu;
38class QPainter; 41class QPainter;
39 42
40/** 43/**
41 * A toolbar button. This is used internally by @ref KToolBar, use the 44 * A toolbar button. This is used internally by @ref KToolBar, use the
42 * KToolBar methods instead. 45 * KToolBar methods instead.
43 * @internal 46 * @internal
44 */ 47 */
45class KToolBarButton : public QToolButton 48class KToolBarButton : public QToolButton
46{ 49{
47 Q_OBJECT 50 Q_OBJECT
48 51
49public: 52public:
50 /** 53 /**
51 * Construct a button with an icon loaded by the button itself. 54 * Construct a button with an icon loaded by the button itself.
52 * This will trust the button to load the correct icon with the 55 * This will trust the button to load the correct icon with the
53 * correct size. 56 * correct size.
54 * 57 *
55 * @param icon Name of icon to load (may be absolute or relative) 58 * @param icon Name of icon to load (may be absolute or relative)
56 * @param id Id of this button 59 * @param id Id of this button
57 * @param parent This button's parent 60 * @param parent This button's parent
58 * @param name This button's internal name 61 * @param name This button's internal name
59 * @param txt This button's text (in a tooltip or otherwise) 62 * @param txt This button's text (in a tooltip or otherwise)
60 */ 63 */
61 KToolBarButton(const QString& icon, int id, QWidget *parent, 64 KToolBarButton(const QString& icon, int id, QWidget *parent,
@@ -129,49 +132,49 @@ public:
129 * tooltip (IconOnly) or will be along side the icon 132 * tooltip (IconOnly) or will be along side the icon
130 * 133 *
131 * @param text The button (or tooltip) text 134 * @param text The button (or tooltip) text
132 */ 135 */
133 virtual void setText(const QString &text); 136 virtual void setText(const QString &text);
134 137
135 /** 138 /**
136 * Set the icon for this button. The icon will be loaded internally 139 * Set the icon for this button. The icon will be loaded internally
137 * with the correct size. This function is preferred over @ref setIconSet 140 * with the correct size. This function is preferred over @ref setIconSet
138 * 141 *
139 * @param icon The name of the icon 142 * @param icon The name of the icon
140 */ 143 */
141 virtual void setIcon(const QString &icon); 144 virtual void setIcon(const QString &icon);
142 145
143 /// @since 3.1 146 /// @since 3.1
144 virtual void setIcon( const QPixmap &pixmap ) 147 virtual void setIcon( const QPixmap &pixmap )
145 { QToolButton::setIcon( pixmap ); } 148 { QToolButton::setIcon( pixmap ); }
146 149
147 /** 150 /**
148 * Set the pixmaps for this toolbar button from a QIconSet. 151 * Set the pixmaps for this toolbar button from a QIconSet.
149 * If you call this you don't need to call any of the other methods 152 * If you call this you don't need to call any of the other methods
150 * that set icons or pixmaps. 153 * that set icons or pixmaps.
151 * @param iconset The iconset to use 154 * @param iconset The iconset to use
152 */ 155 */
153 virtual void setIconSet( const QIconSet &iconset ); 156 virtual void setIconSet( const QIcon &iconset );
154 157
155#ifndef KDE_NO_COMPAT 158#ifndef KDE_NO_COMPAT
156 /** 159 /**
157 * @deprecated 160 * @deprecated
158 * Set the active icon for this button. The pixmap itself is loaded 161 * Set the active icon for this button. The pixmap itself is loaded
159 * internally based on the icon size... .. the disabled and default 162 * internally based on the icon size... .. the disabled and default
160 * pixmaps, however will only be constructed if @ref #generate is 163 * pixmaps, however will only be constructed if @ref #generate is
161 * true. This function is preferred over @ref setPixmap 164 * true. This function is preferred over @ref setPixmap
162 * 165 *
163 * @param icon The name of the active icon 166 * @param icon The name of the active icon
164 * @param generate If true, then the other icons are automagically 167 * @param generate If true, then the other icons are automagically
165 * generated from this one 168 * generated from this one
166 */ 169 */
167 void setIcon(const QString &icon, bool /*generate*/ ) { setIcon( icon ); } 170 void setIcon(const QString &icon, bool /*generate*/ ) { setIcon( icon ); }
168 171
169 /** 172 /**
170 * @deprecated 173 * @deprecated
171 * Force the button to use this icon as the default one rather 174 * Force the button to use this icon as the default one rather
172 * then generating it using effects. 175 * then generating it using effects.
173 * 176 *
174 * @param icon The icon to use as the default (normal) one 177 * @param icon The icon to use as the default (normal) one
175 */ 178 */
176 void setDefaultIcon(const QString& icon); 179 void setDefaultIcon(const QString& icon);
177 180
@@ -188,75 +191,75 @@ public:
188 /** 191 /**
189 * Turn this button on or off 192 * Turn this button on or off
190 * 193 *
191 * @param flag true or false 194 * @param flag true or false
192 */ 195 */
193 void on(bool flag = true); 196 void on(bool flag = true);
194 197
195 /** 198 /**
196 * Toggle this button 199 * Toggle this button
197 */ 200 */
198 void toggle(); 201 void toggle();
199 202
200 /** 203 /**
201 * Turn this button into a toggle button or disable the toggle 204 * Turn this button into a toggle button or disable the toggle
202 * aspects of it. This does not toggle the button itself. 205 * aspects of it. This does not toggle the button itself.
203 * Use @ref toggle() for that. 206 * Use @ref toggle() for that.
204 * 207 *
205 * @param toggle true or false 208 * @param toggle true or false
206 */ 209 */
207 void setToggle(bool toggle = true); 210 void setToggle(bool toggle = true);
208 211
209 /** 212 /**
210 * Return a pointer to this button's popup menu (if it exists) 213 * Return a pointer to this button's popup menu (if it exists)
211 */ 214 */
212 QPopupMenu *popup(); 215 QMenu *popup();
213 216
214 /** 217 /**
215 * Returns the button's id. 218 * Returns the button's id.
216 * @since 3.2 219 * @since 3.2
217 */ 220 */
218 int id() const; 221 int id() const;
219 222
220 /** 223 /**
221 * Give this button a popup menu. There will not be a delay when 224 * Give this button a popup menu. There will not be a delay when
222 * you press the button. Use @ref setDelayedPopup if you want that 225 * you press the button. Use @ref setDelayedPopup if you want that
223 * behavior. 226 * behavior.
224 * 227 *
225 * @param p The new popup menu 228 * @param p The new popup menu
226 */ 229 */
227 void setPopup (QPopupMenu *p, bool unused = false); 230 void setPopup (Q3PopupMenu *p, bool unused = false);
228 231
229 /** 232 /**
230 * Gives this button a delayed popup menu. 233 * Gives this button a delayed popup menu.
231 * 234 *
232 * This function allows you to add a delayed popup menu to the button. 235 * This function allows you to add a delayed popup menu to the button.
233 * The popup menu is then only displayed when the button is pressed and 236 * The popup menu is then only displayed when the button is pressed and
234 * held down for about half a second. 237 * held down for about half a second.
235 * 238 *
236 * @param p the new popup menu 239 * @param p the new popup menu
237 */ 240 */
238 void setDelayedPopup(QPopupMenu *p, bool unused = false); 241 void setDelayedPopup(Q3PopupMenu *p, bool unused = false);
239 242
240 /** 243 /**
241 * Turn this button into a radio button 244 * Turn this button into a radio button
242 * 245 *
243 * @param f true or false 246 * @param f true or false
244 */ 247 */
245 void setRadio(bool f = true); 248 void setRadio(bool f = true);
246 249
247 /** 250 /**
248 * Toolbar buttons naturally will assume the global styles 251 * Toolbar buttons naturally will assume the global styles
249 * concerning icons, icons sizes, etc. You can use this function to 252 * concerning icons, icons sizes, etc. You can use this function to
250 * explicitely turn this off, if you like. 253 * explicitely turn this off, if you like.
251 * 254 *
252 * @param no_style Will disable styles if true 255 * @param no_style Will disable styles if true
253 */ 256 */
254 void setNoStyle(bool no_style = true); 257 void setNoStyle(bool no_style = true);
255 258
256signals: 259signals:
257 void clicked(int); 260 void clicked(int);
258 void doubleClicked(int); 261 void doubleClicked(int);
259 void pressed(int); 262 void pressed(int);
260 void released(int); 263 void released(int);
261 void toggled(int); 264 void toggled(int);
262 void highlighted(int, bool); 265 void highlighted(int, bool);
@@ -282,32 +285,32 @@ protected:
282 bool isRaised() const; 285 bool isRaised() const;
283 /// @since 3.1 286 /// @since 3.1
284 bool isActive() const; 287 bool isActive() const;
285 /// @since 3.1 288 /// @since 3.1
286 int iconTextMode() const; 289 int iconTextMode() const;
287 290
288protected slots: 291protected slots:
289 void slotClicked(); 292 void slotClicked();
290 void slotPressed(); 293 void slotPressed();
291 void slotReleased(); 294 void slotReleased();
292 void slotToggled(); 295 void slotToggled();
293 void slotDelayTimeout(); 296 void slotDelayTimeout();
294 297
295protected: 298protected:
296 virtual void virtual_hook( int id, void* data ); 299 virtual void virtual_hook( int id, void* data );
297private: 300private:
298 KToolBarButtonPrivate *d; 301 KToolBarButtonPrivate *d;
299}; 302};
300 303
301/** 304/**
302* List of @ref KToolBarButton objects. 305* List of @ref KToolBarButton objects.
303* @internal 306* @internal
304* @version $Id$ 307* @version $Id$
305*/ 308*/
306class KToolBarButtonList : public QIntDict<KToolBarButton> 309class KToolBarButtonList : public Q3IntDict<KToolBarButton>
307{ 310{
308public: 311public:
309 KToolBarButtonList(); 312 KToolBarButtonList();
310 ~KToolBarButtonList() {} 313 ~KToolBarButtonList() {}
311}; 314};
312 315
313#endif 316#endif