summaryrefslogtreecommitdiffstats
path: root/src/k3bminibutton.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-02-03 02:15:56 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-02-03 02:15:56 +0000
commit50b48aec6ddd451a6d1709c0942477b503457663 (patch)
treea9ece53ec06fd0a2819de7a2a6de997193566626 /src/k3bminibutton.cpp
downloadk3b-50b48aec6ddd451a6d1709c0942477b503457663.tar.gz
k3b-50b48aec6ddd451a6d1709c0942477b503457663.zip
Added abandoned KDE3 version of K3B
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/k3b@1084400 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/k3bminibutton.cpp')
-rw-r--r--src/k3bminibutton.cpp77
1 files changed, 77 insertions, 0 deletions
diff --git a/src/k3bminibutton.cpp b/src/k3bminibutton.cpp
new file mode 100644
index 0000000..0d0a1db
--- /dev/null
+++ b/src/k3bminibutton.cpp
@@ -0,0 +1,77 @@
+/*
+ *
+ * $Id: sourceheader 511311 2006-02-19 14:51:05Z trueg $
+ * Copyright (C) 2006 Sebastian Trueg <[email protected]>
+ *
+ * This file is part of the K3b project.
+ * Copyright (C) 1998-2007 Sebastian Trueg <[email protected]>
+ *
+ * K3bMiniButton is based on KDockButton_Private
+ * Copyright (C) 2000 Max Judin <[email protected]>
+ * Copyright (C) 2002,2003 Joseph Wenninger <[email protected]>
+ * Copyright (C) 2005 Dominik Haumann <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ * See the file "COPYING" for the exact licensing terms.
+ */
+
+#include "k3bminibutton.h"
+
+#include <qpainter.h>
+
+
+K3bMiniButton::K3bMiniButton( QWidget *parent, const char * name )
+ :QPushButton( parent, name ),
+ m_mouseOver( false )
+{
+ setFocusPolicy( NoFocus );
+}
+
+K3bMiniButton::~K3bMiniButton()
+{
+}
+
+
+void K3bMiniButton::drawButton( QPainter* p )
+{
+ p->fillRect( 0,0, width(), height(), QBrush(colorGroup().brush(QColorGroup::Background)) );
+ p->drawPixmap( (width() - pixmap()->width()) / 2, (height() - pixmap()->height()) / 2, *pixmap() );
+ if( m_mouseOver && !isDown() ){
+ p->setPen( white );
+ p->moveTo( 0, height() - 1 );
+ p->lineTo( 0, 0 );
+ p->lineTo( width() - 1, 0 );
+
+ p->setPen( colorGroup().dark() );
+ p->lineTo( width() - 1, height() - 1 );
+ p->lineTo( 0, height() - 1 );
+ }
+ if( isOn() || isDown() ){
+ p->setPen( colorGroup().dark() );
+ p->moveTo( 0, height() - 1 );
+ p->lineTo( 0, 0 );
+ p->lineTo( width() - 1, 0 );
+
+ p->setPen( white );
+ p->lineTo( width() - 1, height() - 1 );
+ p->lineTo( 0, height() - 1 );
+ }
+}
+
+void K3bMiniButton::enterEvent( QEvent * )
+{
+ m_mouseOver = true;
+ repaint();
+}
+
+
+void K3bMiniButton::leaveEvent( QEvent * )
+{
+ m_mouseOver = false;
+ repaint();
+}
+
+#include "k3bminibutton.moc"