summaryrefslogtreecommitdiffstats
path: root/kicker/libkicker
diff options
context:
space:
mode:
Diffstat (limited to 'kicker/libkicker')
-rw-r--r--kicker/libkicker/panelbutton.cpp2
-rw-r--r--kicker/libkicker/simplebutton.cpp53
-rw-r--r--kicker/libkicker/simplebutton.h6
3 files changed, 47 insertions, 14 deletions
diff --git a/kicker/libkicker/panelbutton.cpp b/kicker/libkicker/panelbutton.cpp
index 1e4edaf7b..f5e35a2ad 100644
--- a/kicker/libkicker/panelbutton.cpp
+++ b/kicker/libkicker/panelbutton.cpp
@@ -326,7 +326,7 @@ int PanelButton::heightForWidth(int width) const
const TQPixmap& PanelButton::labelIcon() const
{
- if (m_disableHighlighting)
+ if (m_disableHighlighting || (!KickerSettings::showMouseOverEffects()))
return m_icon;
else
return m_highlight ? m_iconh : m_icon;
diff --git a/kicker/libkicker/simplebutton.cpp b/kicker/libkicker/simplebutton.cpp
index aafbc4316..4aa0b9ff3 100644
--- a/kicker/libkicker/simplebutton.cpp
+++ b/kicker/libkicker/simplebutton.cpp
@@ -32,12 +32,18 @@
#include <kipc.h>
#include <kstandarddirs.h>
+#include "kickerSettings.h"
+
#define BUTTON_MARGIN KDialog::spacingHint()
-SimpleButton::SimpleButton(TQWidget *parent, const char *name)
+// For now link these two
+#define m_disableHighlighting m_forceStandardCursor
+
+SimpleButton::SimpleButton(TQWidget *parent, const char *name, bool forceStandardCursor)
: TQButton(parent, name),
m_highlight(false),
- m_orientation(Qt::Horizontal)
+ m_orientation(Qt::Horizontal),
+ m_forceStandardCursor(forceStandardCursor)
{
setBackgroundOrigin( AncestorOrigin );
@@ -87,6 +93,16 @@ TQSize SimpleButton::tqminimumSizeHint() const
void SimpleButton::drawButton( TQPainter *p )
{
+ TQRect r(0, 0, width(), height());
+
+ if (m_disableHighlighting == TRUE) {
+ if (m_highlight || isDown() || isOn()) {
+ int flags = TQStyle::Style_Default | TQStyle::Style_Enabled;
+ if (isDown() || isOn()) flags |= TQStyle::Style_Down;
+ tqstyle().tqdrawPrimitive(TQStyle::PE_ButtonTool, p, r, tqcolorGroup(), flags);
+ }
+ }
+
drawButtonLabel(p);
}
@@ -97,14 +113,19 @@ void SimpleButton::drawButtonLabel( TQPainter *p )
return;
}
- TQPixmap pix = isEnabled() ? (m_highlight? m_activeIcon : m_normalIcon) : m_disabledIcon;
+ TQPixmap pix = isEnabled() ? ((m_highlight&&(!m_disableHighlighting))? m_activeIcon : m_normalIcon) : m_disabledIcon;
- if (isOn() || isDown())
+ if ((isOn() || isDown()) && (m_disableHighlighting == FALSE))
{
pix = TQImage(pix.convertToImage()).smoothScale(pix.width() - 2,
pix.height() - 2);
}
+ if (m_disableHighlighting == TRUE) {
+ pix = TQImage(pix.convertToImage()).smoothScale(pix.width() - 4,
+ pix.height() - 4);
+ }
+
int h = height();
int w = width();
int ph = pix.height();
@@ -149,7 +170,11 @@ void SimpleButton::slotSettingsChanged(int category)
return;
}
- bool changeCursor = KGlobalSettings::changeCursorOverIcon();
+ bool changeCursor;
+ if (m_forceStandardCursor == FALSE)
+ changeCursor = KGlobalSettings::changeCursorOverIcon();
+ else
+ changeCursor = FALSE;
if (changeCursor)
{
@@ -174,7 +199,8 @@ void SimpleButton::slotIconChanged( int group )
void SimpleButton::enterEvent( TQEvent *e )
{
- m_highlight = true;
+ if (KickerSettings::showMouseOverEffects())
+ m_highlight = true;
tqrepaint( false );
TQButton::enterEvent( e );
@@ -194,8 +220,9 @@ void SimpleButton::resizeEvent( TQResizeEvent * )
}
-SimpleArrowButton::SimpleArrowButton(TQWidget *parent, Qt::ArrowType arrow, const char *name)
- : SimpleButton(parent, name)
+SimpleArrowButton::SimpleArrowButton(TQWidget *parent, Qt::ArrowType arrow, const char *name, bool forceStandardCursor)
+ : SimpleButton(parent, name, forceStandardCursor),
+ m_forceStandardCursor(forceStandardCursor)
{
setBackgroundOrigin(AncestorOrigin);
_arrow = arrow;
@@ -224,7 +251,7 @@ Qt::ArrowType SimpleArrowButton::arrowType() const
void SimpleArrowButton::drawButton( TQPainter *p )
{
TQRect r(1, 1, width() - 2, height() - 2);
-
+
TQStyle::PrimitiveElement pe = TQStyle::PE_ArrowLeft;
switch (_arrow)
{
@@ -233,10 +260,14 @@ void SimpleArrowButton::drawButton( TQPainter *p )
case Qt::UpArrow: pe = TQStyle::PE_ArrowUp; break;
case Qt::DownArrow: pe = TQStyle::PE_ArrowDown; break;
}
-
+
int flags = TQStyle::Style_Default | TQStyle::Style_Enabled;
if (isDown() || isOn()) flags |= TQStyle::Style_Down;
tqstyle().tqdrawPrimitive(pe, p, r, tqcolorGroup(), flags);
+
+ if (m_forceStandardCursor) {
+ SimpleButton::drawButton(p);
+ }
}
void SimpleArrowButton::enterEvent( TQEvent *e )
@@ -249,7 +280,7 @@ void SimpleArrowButton::enterEvent( TQEvent *e )
void SimpleArrowButton::leaveEvent( TQEvent *e )
{
_inside = false;
- SimpleButton::enterEvent( e );
+ SimpleButton::leaveEvent( e );
update();
}
diff --git a/kicker/libkicker/simplebutton.h b/kicker/libkicker/simplebutton.h
index e6416236f..8e4c13896 100644
--- a/kicker/libkicker/simplebutton.h
+++ b/kicker/libkicker/simplebutton.h
@@ -31,7 +31,7 @@ class KDE_EXPORT SimpleButton : public TQButton
Q_OBJECT
public:
- SimpleButton(TQWidget *parent, const char *name = 0);
+ SimpleButton(TQWidget *parent, const char *name = 0, bool forceStandardCursor = FALSE);
void setPixmap(const TQPixmap &pix);
void setOrientation(Qt::Orientation orientaton);
TQSize tqsizeHint() const;
@@ -56,6 +56,7 @@ class KDE_EXPORT SimpleButton : public TQButton
TQPixmap m_activeIcon;
TQPixmap m_disabledIcon;
Qt::Orientation m_orientation;
+ bool m_forceStandardCursor;
class SimpleButtonPrivate;
SimpleButtonPrivate* d;
};
@@ -65,7 +66,7 @@ class KDE_EXPORT SimpleArrowButton: public SimpleButton
Q_OBJECT
public:
- SimpleArrowButton(TQWidget *parent = 0, Qt::ArrowType arrow = Qt::UpArrow, const char *name = 0);
+ SimpleArrowButton(TQWidget *parent = 0, Qt::ArrowType arrow = Qt::UpArrow, const char *name = 0, bool forceStandardCursor = FALSE);
virtual ~SimpleArrowButton() {};
TQSize tqsizeHint() const;
@@ -80,6 +81,7 @@ class KDE_EXPORT SimpleArrowButton: public SimpleButton
private:
Qt::ArrowType _arrow;
+ bool m_forceStandardCursor;
bool _inside;
};