-rw-r--r-- | microkde/kdeui/ktoolbar.h | 68 |
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 | |||
@@ -23,33 +23,41 @@ | |||
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 | ||
46 | class QDomElement; | 54 | class QDomElement; |
47 | class QSize; | 55 | class QSize; |
48 | class QPixmap; | 56 | class QPixmap; |
49 | class QPopupMenu; | 57 | class Q3PopupMenu; |
50 | class QStringList; | 58 | class QStringList; |
51 | class QDomDocument; | 59 | class QDomDocument; |
52 | class QTimer; | 60 | class QTimer; |
53 | 61 | ||
54 | class KLineEdit; | 62 | class KLineEdit; |
55 | class KToolBar; | 63 | class KToolBar; |
@@ -60,28 +68,28 @@ class KToolBoxManager; | |||
60 | //US class KInstance; | 68 | //US class KInstance; |
61 | class KComboBox; | 69 | class KComboBox; |
62 | class KXMLGUIClient; | 70 | class KXMLGUIClient; |
63 | 71 | ||
64 | class KToolBarPrivate; | 72 | class KToolBarPrivate; |
65 | 73 | ||
66 | class KToolBarSeparator : public QFrame | 74 | class KToolBarSeparator : public Q3Frame |
67 | { | 75 | { |
68 | Q_OBJECT | 76 | Q_OBJECT |
69 | public: | 77 | public: |
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; } |
76 | public slots: | 84 | public slots: |
77 | void setOrientation( Orientation ); | 85 | void setOrientation( Qt::Orientation ); |
78 | protected: | 86 | protected: |
79 | void styleChange( QStyle& ); | 87 | void styleChange( QStyle& ); |
80 | private: | 88 | private: |
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. |
@@ -108,29 +116,29 @@ private: | |||
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 |
132 | public: | 140 | public: |
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 |
@@ -172,13 +180,13 @@ public: | |||
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 |
@@ -190,13 +198,13 @@ public: | |||
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 |
@@ -300,13 +308,13 @@ public: | |||
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 |
@@ -315,13 +323,13 @@ public: | |||
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 |
@@ -356,13 +364,13 @@ public: | |||
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() |
@@ -372,13 +380,13 @@ public: | |||
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 ); |
@@ -462,13 +470,13 @@ public: | |||
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 |
@@ -488,13 +496,13 @@ public: | |||
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. |
@@ -1057,13 +1065,13 @@ public: | |||
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 | ||
1061 | public slots: | 1069 | public 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 | ||
1066 | protected: | 1074 | protected: |
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 ); |
@@ -1074,35 +1082,35 @@ protected: | |||
1074 | 1082 | ||
1075 | private slots: | 1083 | private 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 | ||
1084 | private: | 1092 | private: |
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; |
1103 | protected: | 1111 | protected: |
1104 | virtual void virtual_hook( int id, void* data ); | 1112 | virtual void virtual_hook( int id, void* data ); |
1105 | private: | 1113 | private: |
1106 | KToolBarPrivate *d; | 1114 | KToolBarPrivate *d; |
1107 | bool inshutdownprocess; | 1115 | bool inshutdownprocess; |
1108 | }; | 1116 | }; |