author | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
commit | a08aff328d4393031d5ba7d622c2b05705a89d73 (patch) (unidiff) | |
tree | 8ee90d686081c52e7c69b5ce946e9b1a7d690001 /microkde/kdeui/kaction.h | |
parent | 11edc920afe4f274c0964436633aa632c8288a40 (diff) | |
download | kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.zip kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.gz kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.bz2 |
initial public commit of qt4 portp1
-rw-r--r-- | microkde/kdeui/kaction.h | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/microkde/kdeui/kaction.h b/microkde/kdeui/kaction.h index 13e2e1e..5c690ec 100644 --- a/microkde/kdeui/kaction.h +++ b/microkde/kdeui/kaction.h | |||
@@ -8,63 +8,65 @@ | |||
8 | (C) 2002 Ellis Whitehead <ellis@kde.org> | 8 | (C) 2002 Ellis Whitehead <ellis@kde.org> |
9 | 9 | ||
10 | This library is free software; you can redistribute it and/or | 10 | This library is free software; you can redistribute it and/or |
11 | modify it under the terms of the GNU Library General Public | 11 | modify it under the terms of the GNU Library General Public |
12 | License version 2 as published by the Free Software Foundation. | 12 | License version 2 as published by the Free Software Foundation. |
13 | 13 | ||
14 | This library is distributed in the hope that it will be useful, | 14 | This library is distributed in the hope that it will be useful, |
15 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
17 | Library General Public License for more details. | 17 | Library General Public License for more details. |
18 | 18 | ||
19 | You should have received a copy of the GNU Library General Public License | 19 | You should have received a copy of the GNU Library General Public License |
20 | along with this library; see the file COPYING.LIB. If not, write to | 20 | along with this library; see the file COPYING.LIB. If not, write to |
21 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 21 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
22 | Boston, MA 02111-1307, USA. | 22 | Boston, MA 02111-1307, USA. |
23 | */ | 23 | */ |
24 | //$Id$ | 24 | //$Id$ |
25 | 25 | ||
26 | #ifndef __kaction_h__ | 26 | #ifndef __kaction_h__ |
27 | #define __kaction_h__ | 27 | #define __kaction_h__ |
28 | 28 | ||
29 | 29 | ||
30 | //US #include <qkeysequence.h> | 30 | //US #include <qkeysequence.h> |
31 | #include <qobject.h> | 31 | #include <qobject.h> |
32 | #include <qvaluelist.h> | 32 | #include <q3valuelist.h> |
33 | #include <qguardedptr.h> | 33 | #include <qpointer.h> |
34 | //Added by qt3to4: | ||
35 | #include <Q3PopupMenu> | ||
34 | #include <kguiitem.h> | 36 | #include <kguiitem.h> |
35 | #include <kshortcut.h> | 37 | #include <kshortcut.h> |
36 | #include <kstdaction.h> | 38 | #include <kstdaction.h> |
37 | //US#include <kicontheme.h> | 39 | //US#include <kicontheme.h> |
38 | 40 | ||
39 | //US added the following files | 41 | //US added the following files |
40 | #include <kiconloader.h> | 42 | #include <kiconloader.h> |
41 | 43 | ||
42 | class QMenuBar; | 44 | class QMenuBar; |
43 | class QPopupMenu; | 45 | class Q3PopupMenu; |
44 | //USclass QComboBox; | 46 | //USclass QComboBox; |
45 | //USclass QPoint; | 47 | //USclass QPoint; |
46 | class QIconSet; | 48 | class QIcon; |
47 | class QString; | 49 | class QString; |
48 | class KToolBar; | 50 | class KToolBar; |
49 | 51 | ||
50 | class KAccel; | 52 | class KAccel; |
51 | //USclass KAccelActions; | 53 | //USclass KAccelActions; |
52 | //USclass KConfig; | 54 | //USclass KConfig; |
53 | //USclass KConfigBase; | 55 | //USclass KConfigBase; |
54 | //USclass KURL; | 56 | //USclass KURL; |
55 | //USclass KInstance; | 57 | //USclass KInstance; |
56 | //USclass KToolBar; | 58 | //USclass KToolBar; |
57 | class KActionCollection; | 59 | class KActionCollection; |
58 | //USclass KPopupMenu; | 60 | //USclass KPopupMenu; |
59 | class KMainWindow; | 61 | class KMainWindow; |
60 | 62 | ||
61 | /** | 63 | /** |
62 | * The KAction class (and derived and super classes) provides a way to | 64 | * The KAction class (and derived and super classes) provides a way to |
63 | * easily encapsulate a "real" user-selected action or event in your | 65 | * easily encapsulate a "real" user-selected action or event in your |
64 | * program. | 66 | * program. |
65 | * | 67 | * |
66 | * For instance, a user may want to @p paste the contents of | 68 | * For instance, a user may want to @p paste the contents of |
67 | * the clipboard or @p scroll @p down a document or @p quit the | 69 | * the clipboard or @p scroll @p down a document or @p quit the |
68 | * application. These are all @p actions -- events that the | 70 | * application. These are all @p actions -- events that the |
69 | * user causes to happen. The KAction class allows the developer to | 71 | * user causes to happen. The KAction class allows the developer to |
70 | * deal with these actions in an easy and intuitive manner. | 72 | * deal with these actions in an easy and intuitive manner. |
@@ -238,108 +240,108 @@ public: | |||
238 | */ | 240 | */ |
239 | KAction( const QString& text, const KShortcut& cut, | 241 | KAction( const QString& text, const KShortcut& cut, |
240 | const QObject* receiver, const char* slot, | 242 | const QObject* receiver, const char* slot, |
241 | KActionCollection* parent, const char* name ); | 243 | KActionCollection* parent, const char* name ); |
242 | /** | 244 | /** |
243 | * Constructs an action with text, icon, potential keyboard | 245 | * Constructs an action with text, icon, potential keyboard |
244 | * shortcut, and a SLOT to call when this action is invoked by | 246 | * shortcut, and a SLOT to call when this action is invoked by |
245 | * the user. | 247 | * the user. |
246 | * | 248 | * |
247 | * If you do not want or have a keyboard shortcut, set the | 249 | * If you do not want or have a keyboard shortcut, set the |
248 | * @p cut param to 0. | 250 | * @p cut param to 0. |
249 | * | 251 | * |
250 | * This is the other common KAction used. Use it when you | 252 | * This is the other common KAction used. Use it when you |
251 | * @p do have a corresponding icon. | 253 | * @p do have a corresponding icon. |
252 | * | 254 | * |
253 | * @param text The text that will be displayed. | 255 | * @param text The text that will be displayed. |
254 | * @param pix The icon to display. | 256 | * @param pix The icon to display. |
255 | * @param cut The corresponding keyboard shortcut. | 257 | * @param cut The corresponding keyboard shortcut. |
256 | * @param receiver The SLOT's parent. | 258 | * @param receiver The SLOT's parent. |
257 | * @param slot The SLOT to invoke to execute this action. | 259 | * @param slot The SLOT to invoke to execute this action. |
258 | * @param parent This action's parent. | 260 | * @param parent This action's parent. |
259 | * @param name An internal name for this action. | 261 | * @param name An internal name for this action. |
260 | */ | 262 | */ |
261 | 263 | ||
262 | KAction( const QString& text, const QIconSet& pix, const KShortcut& cut, | 264 | KAction( const QString& text, const QIcon& pix, const KShortcut& cut, |
263 | const QObject* receiver, const char* slot, | 265 | const QObject* receiver, const char* slot, |
264 | KActionCollection* parent, const char* name ); | 266 | KActionCollection* parent, const char* name ); |
265 | 267 | ||
266 | /** | 268 | /** |
267 | * Constructs an action with text, icon, potential keyboard | 269 | * Constructs an action with text, icon, potential keyboard |
268 | * shortcut, and a SLOT to call when this action is invoked by | 270 | * shortcut, and a SLOT to call when this action is invoked by |
269 | * the user. The icon is loaded on demand later based on where it | 271 | * the user. The icon is loaded on demand later based on where it |
270 | * is plugged in. | 272 | * is plugged in. |
271 | * | 273 | * |
272 | * If you do not want or have a keyboard shortcut, set the | 274 | * If you do not want or have a keyboard shortcut, set the |
273 | * @p cut param to 0. | 275 | * @p cut param to 0. |
274 | * | 276 | * |
275 | * This is the other common KAction used. Use it when you | 277 | * This is the other common KAction used. Use it when you |
276 | * @p do have a corresponding icon. | 278 | * @p do have a corresponding icon. |
277 | * | 279 | * |
278 | * @param text The text that will be displayed. | 280 | * @param text The text that will be displayed. |
279 | * @param pix The icon to display. | 281 | * @param pix The icon to display. |
280 | * @param cut The corresponding keyboard shortcut (shortcut). | 282 | * @param cut The corresponding keyboard shortcut (shortcut). |
281 | * @param receiver The SLOT's parent. | 283 | * @param receiver The SLOT's parent. |
282 | * @param slot The SLOT to invoke to execute this action. | 284 | * @param slot The SLOT to invoke to execute this action. |
283 | * @param parent This action's parent. | 285 | * @param parent This action's parent. |
284 | * @param name An internal name for this action. | 286 | * @param name An internal name for this action. |
285 | */ | 287 | */ |
286 | KAction( const QString& text, const QString& pix, const KShortcut& cut, | 288 | KAction( const QString& text, const QString& pix, const KShortcut& cut, |
287 | const QObject* receiver, const char* slot, | 289 | const QObject* receiver, const char* slot, |
288 | KActionCollection* parent, const char* name ); | 290 | KActionCollection* parent, const char* name ); |
289 | 291 | ||
290 | /** | 292 | /** |
291 | * The same as the above constructor, but with a KGuiItem providing | 293 | * The same as the above constructor, but with a KGuiItem providing |
292 | * the text and icon. | 294 | * the text and icon. |
293 | * | 295 | * |
294 | * @param item The KGuiItem with the label and (optional) icon. | 296 | * @param item The KGuiItem with the label and (optional) icon. |
295 | */ | 297 | */ |
296 | KAction( const KGuiItem& item, const KShortcut& cut, | 298 | KAction( const KGuiItem& item, const KShortcut& cut, |
297 | const QObject* receiver, const char* slot, | 299 | const QObject* receiver, const char* slot, |
298 | KActionCollection* parent, const char* name ); | 300 | KActionCollection* parent, const char* name ); |
299 | /** | 301 | /** |
300 | * @obsolete | 302 | * @obsolete |
301 | */ | 303 | */ |
302 | KAction( const QString& text, const KShortcut& cut = KShortcut(), QObject* parent = 0, const char* name = 0 ); | 304 | KAction( const QString& text, const KShortcut& cut = KShortcut(), QObject* parent = 0, const char* name = 0 ); |
303 | /** | 305 | /** |
304 | * @obsolete | 306 | * @obsolete |
305 | */ | 307 | */ |
306 | KAction( const QString& text, const KShortcut& cut, | 308 | KAction( const QString& text, const KShortcut& cut, |
307 | const QObject* receiver, const char* slot, QObject* parent, const char* name = 0 ); | 309 | const QObject* receiver, const char* slot, QObject* parent, const char* name = 0 ); |
308 | /** | 310 | /** |
309 | * @obsolete | 311 | * @obsolete |
310 | */ | 312 | */ |
311 | KAction( const QString& text, const QIconSet& pix, const KShortcut& cut = KShortcut(), | 313 | KAction( const QString& text, const QIcon& pix, const KShortcut& cut = KShortcut(), |
312 | QObject* parent = 0, const char* name = 0 ); | 314 | QObject* parent = 0, const char* name = 0 ); |
313 | /** | 315 | /** |
314 | * @obsolete | 316 | * @obsolete |
315 | */ | 317 | */ |
316 | KAction( const QString& text, const QString& pix, const KShortcut& cut = KShortcut(), | 318 | KAction( const QString& text, const QString& pix, const KShortcut& cut = KShortcut(), |
317 | QObject* parent = 0, const char* name = 0 ); | 319 | QObject* parent = 0, const char* name = 0 ); |
318 | /** | 320 | /** |
319 | * @obsolete | 321 | * @obsolete |
320 | */ | 322 | */ |
321 | KAction( const QString& text, const QIconSet& pix, const KShortcut& cut, | 323 | KAction( const QString& text, const QIcon& pix, const KShortcut& cut, |
322 | const QObject* receiver, const char* slot, QObject* parent, const char* name = 0 ); | 324 | const QObject* receiver, const char* slot, QObject* parent, const char* name = 0 ); |
323 | /** | 325 | /** |
324 | * @obsolete | 326 | * @obsolete |
325 | */ | 327 | */ |
326 | KAction( const QString& text, const QString& pix, const KShortcut& cut, | 328 | KAction( const QString& text, const QString& pix, const KShortcut& cut, |
327 | const QObject* receiver, const char* slot, QObject* parent, | 329 | const QObject* receiver, const char* slot, QObject* parent, |
328 | const char* name = 0 ); | 330 | const char* name = 0 ); |
329 | /** | 331 | /** |
330 | * @obsolete | 332 | * @obsolete |
331 | */ | 333 | */ |
332 | KAction( QObject* parent = 0, const char* name = 0 ); | 334 | KAction( QObject* parent = 0, const char* name = 0 ); |
333 | 335 | ||
334 | /** | 336 | /** |
335 | * Standard destructor | 337 | * Standard destructor |
336 | */ | 338 | */ |
337 | virtual ~KAction(); | 339 | virtual ~KAction(); |
338 | 340 | ||
339 | /** | 341 | /** |
340 | * "Plug" or insert this action into a given widget. | 342 | * "Plug" or insert this action into a given widget. |
341 | * | 343 | * |
342 | * This will | 344 | * This will |
343 | * typically be a menu or a toolbar. From this point on, you will | 345 | * typically be a menu or a toolbar. From this point on, you will |
344 | * never need to directly manipulate the item in the menu or | 346 | * never need to directly manipulate the item in the menu or |
345 | * toolbar. You do all enabling/disabling/manipulation directly | 347 | * toolbar. You do all enabling/disabling/manipulation directly |
@@ -440,52 +442,52 @@ public: | |||
440 | */ | 442 | */ |
441 | virtual bool isEnabled() const; | 443 | virtual bool isEnabled() const; |
442 | 444 | ||
443 | /** | 445 | /** |
444 | * Returns true if this action's shortcut is configurable. | 446 | * Returns true if this action's shortcut is configurable. |
445 | */ | 447 | */ |
446 | virtual bool isShortcutConfigurable() const; | 448 | virtual bool isShortcutConfigurable() const; |
447 | 449 | ||
448 | virtual QString group() const; | 450 | virtual QString group() const; |
449 | 451 | ||
450 | /** | 452 | /** |
451 | * Get the What's this text for the action. | 453 | * Get the What's this text for the action. |
452 | */ | 454 | */ |
453 | virtual QString whatsThis() const; | 455 | virtual QString whatsThis() const; |
454 | 456 | ||
455 | /** | 457 | /** |
456 | * Get the tooltip text for the action. | 458 | * Get the tooltip text for the action. |
457 | */ | 459 | */ |
458 | virtual QString toolTip() const; | 460 | virtual QString toolTip() const; |
459 | 461 | ||
460 | /** | 462 | /** |
461 | * Get the QIconSet from which the icons used to display this action will | 463 | * Get the QIconSet from which the icons used to display this action will |
462 | * be chosen. | 464 | * be chosen. |
463 | */ | 465 | */ |
464 | virtual QIconSet iconSet( KIcon::Group group, int size=0 ) const; | 466 | virtual QIcon iconSet( KIcon::Group group, int size=0 ) const; |
465 | 467 | ||
466 | #ifndef KDE_NO_COMPAT | 468 | #ifndef KDE_NO_COMPAT |
467 | QIconSet iconSet() const | 469 | QIcon iconSet() const |
468 | { | 470 | { |
469 | return iconSet( KIcon::Small ); | 471 | return iconSet( KIcon::Small ); |
470 | } | 472 | } |
471 | #endif | 473 | #endif |
472 | 474 | ||
473 | virtual QString icon() const; | 475 | virtual QString icon() const; |
474 | 476 | ||
475 | KActionCollection *parentCollection() const; | 477 | KActionCollection *parentCollection() const; |
476 | 478 | ||
477 | /** | 479 | /** |
478 | * @internal | 480 | * @internal |
479 | * Generate a toolbar button id. Made public for reimplementations. | 481 | * Generate a toolbar button id. Made public for reimplementations. |
480 | */ | 482 | */ |
481 | static int getToolButtonID(); | 483 | static int getToolButtonID(); |
482 | 484 | ||
483 | 485 | ||
484 | void unplugAll(); | 486 | void unplugAll(); |
485 | 487 | ||
486 | public slots: | 488 | public slots: |
487 | /** | 489 | /** |
488 | * Sets the text associated with this action. The text is used for menu | 490 | * Sets the text associated with this action. The text is used for menu |
489 | * and toolbar labels etc. | 491 | * and toolbar labels etc. |
490 | */ | 492 | */ |
491 | virtual void setText(const QString &text); | 493 | virtual void setText(const QString &text); |
@@ -497,86 +499,86 @@ public slots: | |||
497 | 499 | ||
498 | virtual void setGroup( const QString& ); | 500 | virtual void setGroup( const QString& ); |
499 | 501 | ||
500 | /** | 502 | /** |
501 | * Sets the What's this text for the action. This text will be displayed when | 503 | * Sets the What's this text for the action. This text will be displayed when |
502 | * a widget that has been created by plugging this action into a container | 504 | * a widget that has been created by plugging this action into a container |
503 | * is clicked on in What's this mode. | 505 | * is clicked on in What's this mode. |
504 | * | 506 | * |
505 | * The What's this text can include QML markup as well as raw text. | 507 | * The What's this text can include QML markup as well as raw text. |
506 | */ | 508 | */ |
507 | virtual void setWhatsThis( const QString& text ); | 509 | virtual void setWhatsThis( const QString& text ); |
508 | 510 | ||
509 | /** | 511 | /** |
510 | * Sets the tooltip text for the action. | 512 | * Sets the tooltip text for the action. |
511 | * This will be used as a tooltip for a toolbar button, as a | 513 | * This will be used as a tooltip for a toolbar button, as a |
512 | * statusbar help-text for a menu item, and it also appears | 514 | * statusbar help-text for a menu item, and it also appears |
513 | * in the toolbar editor, to describe the action. | 515 | * in the toolbar editor, to describe the action. |
514 | */ | 516 | */ |
515 | virtual void setToolTip( const QString& ); | 517 | virtual void setToolTip( const QString& ); |
516 | 518 | ||
517 | /** | 519 | /** |
518 | * Sets the QIconSet from which the icons used to display this action will | 520 | * Sets the QIconSet from which the icons used to display this action will |
519 | * be chosen. | 521 | * be chosen. |
520 | */ | 522 | */ |
521 | virtual void setIconSet( const QIconSet &iconSet ); | 523 | virtual void setIconSet( const QIcon &iconSet ); |
522 | 524 | ||
523 | virtual void setIcon( const QString& icon ); | 525 | virtual void setIcon( const QString& icon ); |
524 | 526 | ||
525 | /** | 527 | /** |
526 | * Enables or disables this action. All uses of this action (eg. in menus | 528 | * Enables or disables this action. All uses of this action (eg. in menus |
527 | * or toolbars) will be updated to reflect the state of the action. | 529 | * or toolbars) will be updated to reflect the state of the action. |
528 | */ | 530 | */ |
529 | virtual void setEnabled(bool enable); | 531 | virtual void setEnabled(bool enable); |
530 | 532 | ||
531 | /** | 533 | /** |
532 | * Indicate whether the user may configure the action's shortcut. | 534 | * Indicate whether the user may configure the action's shortcut. |
533 | */ | 535 | */ |
534 | virtual void setShortcutConfigurable( bool ); | 536 | virtual void setShortcutConfigurable( bool ); |
535 | 537 | ||
536 | /** | 538 | /** |
537 | * Emulate user's interaction programmatically, by activating the action. | 539 | * Emulate user's interaction programmatically, by activating the action. |
538 | * The implementation simply emits activated(). | 540 | * The implementation simply emits activated(). |
539 | */ | 541 | */ |
540 | virtual void activate(); | 542 | virtual void activate(); |
541 | 543 | ||
542 | protected slots: | 544 | protected slots: |
543 | virtual void slotDestroyed(); | 545 | virtual void slotDestroyed(); |
544 | virtual void slotKeycodeChanged(); | 546 | virtual void slotKeycodeChanged(); |
545 | virtual void slotActivated(); | 547 | virtual void slotActivated(); |
546 | 548 | ||
547 | protected: | 549 | protected: |
548 | KToolBar* toolBar( int index ) const; | 550 | KToolBar* toolBar( int index ) const; |
549 | QPopupMenu* popupMenu( int index ) const; | 551 | Q3PopupMenu* popupMenu( int index ) const; |
550 | void removeContainer( int index ); | 552 | void removeContainer( int index ); |
551 | int findContainer( const QWidget* widget ) const; | 553 | int findContainer( const QWidget* widget ) const; |
552 | void plugMainWindowAccel( QWidget *w ); | 554 | void plugMainWindowAccel( QWidget *w ); |
553 | 555 | ||
554 | void addContainer( QWidget* parent, int id ); | 556 | void addContainer( QWidget* parent, int id ); |
555 | void addContainer( QWidget* parent, QWidget* representative ); | 557 | void addContainer( QWidget* parent, QWidget* representative ); |
556 | 558 | ||
557 | virtual void updateShortcut( int i ); | 559 | virtual void updateShortcut( int i ); |
558 | virtual void updateShortcut( QPopupMenu* menu, int id ); | 560 | virtual void updateShortcut( Q3PopupMenu* menu, int id ); |
559 | virtual void updateGroup( int id ); | 561 | virtual void updateGroup( int id ); |
560 | virtual void updateText(int i ); | 562 | virtual void updateText(int i ); |
561 | virtual void updateEnabled(int i); | 563 | virtual void updateEnabled(int i); |
562 | virtual void updateIconSet(int i); | 564 | virtual void updateIconSet(int i); |
563 | virtual void updateIcon( int i); | 565 | virtual void updateIcon( int i); |
564 | virtual void updateToolTip( int id ); | 566 | virtual void updateToolTip( int id ); |
565 | virtual void updateWhatsThis( int i ); | 567 | virtual void updateWhatsThis( int i ); |
566 | 568 | ||
567 | KActionCollection *m_parentCollection; | 569 | KActionCollection *m_parentCollection; |
568 | QString whatsThisWithIcon() const; | 570 | QString whatsThisWithIcon() const; |
569 | 571 | ||
570 | signals: | 572 | signals: |
571 | void activated(); | 573 | void activated(); |
572 | void enabled( bool ); | 574 | void enabled( bool ); |
573 | 575 | ||
574 | private: | 576 | private: |
575 | void initPrivate( const QString& text, const KShortcut& cut, | 577 | void initPrivate( const QString& text, const KShortcut& cut, |
576 | const QObject* receiver, const char* slot ); | 578 | const QObject* receiver, const char* slot ); |
577 | KAccel* kaccelCurrent(); | 579 | KAccel* kaccelCurrent(); |
578 | bool initShortcut( const KShortcut& ); | 580 | bool initShortcut( const KShortcut& ); |
579 | void plugShortcut(); | 581 | void plugShortcut(); |
580 | bool updateKAccelShortcut( KAccel* kaccel ); | 582 | bool updateKAccelShortcut( KAccel* kaccel ); |
581 | void insertKAccel( KAccel* ); | 583 | void insertKAccel( KAccel* ); |
582 | /** @internal To be used exclusively by KActionCollection::removeWidget(). */ | 584 | /** @internal To be used exclusively by KActionCollection::removeWidget(). */ |