summaryrefslogtreecommitdiffstats
path: root/src/roundbutton.h
blob: 4b31172fb0bd86e01b471d5b99893fe1bd6cd7ef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
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 <tqbutton.h>
#include <tqpainter.h>
#include <kiconeffect.h>
#include <kpixmap.h>
#include <cassert>

class Menu;

class KDE_EXPORT RoundButton : public TQButton  //well, there were round buttons in the begining at least *g*
{
	TQ_OBJECT
	public:
        enum Type {Round, Commando, Submenu};
        RoundButton( TQWidget* parent=0, unsigned short rad= 32, const char* name= 0, WFlags f = 0);

        ~RoundButton();

		virtual void setRadius(int rad);
		virtual void setIcon(const TQString& 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;
		TQPixmap icon;
		TQString mIconPath;
		KPixmap background;
		TDEIconEffect mEffect;

		virtual void keyPressEvent(TQKeyEvent* evt);

		virtual void drawButtonLabel(TQPainter*);
		virtual void drawButton(TQPainter*);
		virtual bool event(TQEvent* evt);
};

#endif