summaryrefslogtreecommitdiffstats
path: root/src/roundbutton.h
diff options
context:
space:
mode:
authorMichele Calgaro <[email protected]>2023-07-22 23:28:14 +0900
committerMichele Calgaro <[email protected]>2023-07-22 23:28:14 +0900
commit33b26938657c9790eff9389ac23d9eb0205c9378 (patch)
treecb8d19c7532304dd5b1193a6f4e985f63e893ca3 /src/roundbutton.h
downloadkommando-33b26938657c9790eff9389ac23d9eb0205c9378.tar.gz
kommando-33b26938657c9790eff9389ac23d9eb0205c9378.zip
Initial import from https://snapshot.debian.org/package/kommando/0.5.1-2. Code available under GPL2 license.
Signed-off-by: Michele Calgaro <[email protected]>
Diffstat (limited to 'src/roundbutton.h')
-rw-r--r--src/roundbutton.h72
1 files changed, 72 insertions, 0 deletions
diff --git a/src/roundbutton.h b/src/roundbutton.h
new file mode 100644
index 0000000..52432d4
--- /dev/null
+++ b/src/roundbutton.h
@@ -0,0 +1,72 @@
+/***************************************************************************
+ * Copyright (C) 2005 by Daniel Stöckel *
+ * daniel@Docter *
+ * *
+ * 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. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+#ifndef ROUNDBUTTON_H
+#define ROUNDBUTTON_H
+
+#include <qbutton.h>
+#include <qpainter.h>
+#include <kiconeffect.h>
+#include <kpixmap.h>
+#include <cassert>
+
+class Menu;
+
+class RoundButton : public QButton //well, there were round buttons in the begining at least *g*
+{
+ Q_OBJECT
+ public:
+ enum Type {Round, Commando, Submenu};
+ RoundButton( QWidget* parent=0, unsigned short rad= 32, const char* name= 0, WFlags f = 0);
+
+ ~RoundButton();
+
+ virtual void setRadius(int rad);
+ virtual void setIcon(const QString& path);
+ virtual void setActive(bool mode);
+
+ //This method should not be called on a RoundButton instance. Childclasses have to implement it.
+ virtual Menu* execute(){ assert(0); return 0; }
+ virtual Type type() const { return Round; }
+
+
+ public slots:
+ virtual void move(int x, int y);
+ virtual void show();
+
+ signals:
+ void mouseIn(RoundButton* emitter);
+ void mouseOut(RoundButton* emitter);
+
+
+ protected:
+ int radius;
+ QPixmap icon;
+ QString mIconPath;
+ KPixmap background;
+ KIconEffect mEffect;
+
+ virtual void keyPressEvent(QKeyEvent* evt);
+
+ virtual void drawButtonLabel(QPainter*);
+ virtual void drawButton(QPainter*);
+ virtual bool event(QEvent* evt);
+};
+
+#endif