You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
kommando/src/roundbutton.h

73 lines
2.6 KiB

/***************************************************************************
* 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