summaryrefslogtreecommitdiffstats
path: root/src/kbfxplasmacanvasitem.h
blob: d243363de9b64314f99f73d2725b05fd0e175a7f (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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
/*
 *   Copyright (C) 2006
 *   Siraj Razick <siraj@kdemail.net>
 *   PhobosK <phobosk@mail.kbfx.org>
 *   see Also AUTHORS
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU Library General Public License version 2 as
 *   published by the Free Software Foundation
 *
 *   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 Library General Public
 *   License along with this program; if not, write to the
 *   Free Software Foundation, Inc.,
 *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 */

#ifndef KBFX_PLASMA_CANVAS_ITEM_H
#define KBFX_PLASMA_CANVAS_ITEM_H

#include <tqcanvas.h>
#include <tqfont.h>
#include <tqfontinfo.h>
#include <tqimage.h>

#include <kapplication.h>
#include <kdebug.h>
#include <kdesktopfile.h>

#include <kbfxconfig.h>
#include <kbfxplasmapixmapprovider.h>

#include "kbfxplasmacanvasabstractitem.h"


class KbfxPlasmaCanvasItem:public KbfxPlasmaCanvasAbstractItem
{

		Q_OBJECT
  

	public:

//		typedef enum {EXECUTABLE=0,SEPARATOR,INDEX,OTHER} Type;
		typedef enum {RASTER=0,VECTOR,NATIVE} SkinMode;


		KbfxPlasmaCanvasItem ( TQCanvasPixmapArray * a, TQCanvas * canvas );
		KbfxPlasmaCanvasItem ( const KbfxPlasmaCanvasItem &t );
		KbfxPlasmaCanvasItem &operator = ( const KbfxPlasmaCanvasItem &t );
		virtual ~KbfxPlasmaCanvasItem ();

		bool itemMode();
		void setItemMode ( bool mode=true );
		void setType ( Type );
		void setCurrent ( bool );
		void setExec ( TQString desktopfile );
		TQString name() {return m_labelText;};
		TQString desktopFile() { return m_desktopFilePath;}


		KbfxDataSource * source() { return m_source;}
		void setSource ( KbfxDataSource src );
		void setCommand ( TQString cmd );
		void setComment ( TQString comment );
		void setIcon ( TQPixmap pixmap );
		void setIconPath ( TQString path );
		bool isCurrent();
		int height() { return m_height;}
		int width() { return m_width;}
		Type type() { return m_type;}
		bool lookup ( TQString str );
		virtual void advance ( int phase );
		virtual int  rtti() const { return CANVASITEM;}
		virtual void draw ( TQPainter & pe );
		virtual void drawContent ( TQPainter * pe );
		virtual TQPixmap dragPixmap();

//		virtual void drawText(TQPainter  *pe,TQString str);
		virtual void drawBackDrop ( TQPainter * pe,TQRect & rect );

		/* Event Handling */
		virtual void mousePressEvent ( TQMouseEvent * e );
		virtual void mouseMoveEvent ( TQMouseEvent * e );
		virtual void enterEvent ( TQEvent * e );
		virtual void mouseReleaseEvent ( TQMouseEvent * e );


		void setLabelText ( TQString s );

	public slots:
		void updateAngle() {}
		void hideit();
		void exec();
	signals:
		void leave();
		void selected ( KbfxPlasmaCanvasItem* );

	private:


		void drawStar ( TQPainter * pe );

		int m_frameCount;
		int m_textWidth;
		TQString m_exec;
		TQString m_desktopFilePath;
		TQString m_labelText;
		TQString m_commentText;
		TQPixmap m_icon;
		TQString m_iconPath;
		KDesktopFile  * m_desktopFile;
		KbfxDataSource * m_source;

		/* Theming stuff */
		TQColor m_fontAppNameColor;
		TQFont m_fontAppNameFont;
		TQColor m_commentColor;
		TQFont m_commentFont;
		TQColor m_lineColor;
		TQFont m_sepNameFont;
		bool m_boldFonts;
		bool m_skined;
		bool m_restricted ; //KDE kiosk
		Type  m_type;
		bool m_hidden;
		TQString m_error;
		bool m_isCurrent;
		bool m_noComments;
		int m_margin;
		int m_height;
		int m_width;
		int m_iconSize;
}
;//C.G

#endif //M.I.G