use kDebug
[kdegraphics.git] / kolourpaint / tools / kpToolAction.h
blob055c3e8d6a54ecb40dc97d6873d254818ce3543b
2 /*
3 Copyright (c) 2003-2007 Clarence Dang <dang@kde.org>
4 All rights reserved.
6 Redistribution and use in source and binary forms, with or without
7 modification, are permitted provided that the following conditions
8 are met:
10 1. Redistributions of source code must retain the above copyright
11 notice, this list of conditions and the following disclaimer.
12 2. Redistributions in binary form must reproduce the above copyright
13 notice, this list of conditions and the following disclaimer in the
14 documentation and/or other materials provided with the distribution.
16 THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 #ifndef KP_TOOL_ACTION_H
30 #define KP_TOOL_ACTION_H
33 #include <ktoggleaction.h>
36 class KActionCollection;
39 // Same as KToggleAction but shows the first single key trigger in the tooltip.
40 // REFACTOR: Either push into kdelibs 4.x or make setText() and setShortcut()
41 // virtual in KDE 5.x, to allow us to remove updateAllActionsToolTips()
42 // hack.
43 class kpToolAction : public KToggleAction
45 Q_OBJECT
47 public:
48 kpToolAction (const QString &text,
49 const QString &pic, const KShortcut &shortcut,
50 const QObject *receiver, const char *slot,
51 KActionCollection *ac, const QString &name);
52 virtual ~kpToolAction ();
55 signals:
56 // Not emitted when toolTip is manually overridden by setToolTip()
57 void toolTipChanged (const QString &string);
59 protected:
60 void updateToolTip ();
62 public:
63 // For all kpToolAction's in <ac>, calls updateToolTip().
65 // Call this e.g. after shortcuts have been changed but
66 // kpToolAction::setShortcut() did not find out (since it's not
67 // virtual).
68 static void updateAllActionsToolTips (KActionCollection *ac);
72 // KToggleAction overrides
75 // WARNING: The KToggleAction base does not have these as virtual.
76 public:
77 void setText (const QString &text);
78 void setShortcut (const KShortcut &shortcut);
82 #endif // KP_TOOL_ACTION_H