aboutsummaryrefslogtreecommitdiff
path: root/lib/gui/decoration.h
blob: 4a5e4eec2e8653f6d9b7539356320d8951c362a8 (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
#ifndef __lib_gui_decoration_h
#define __lib_gui_decoration_h

#include <lib/gdi/erect.h>
#include <lib/base/estring.h>
#include <lib/gui/ewidget.h>
class gPixmap;
class gPainter;

class eDecoration
{
	ePtr<gPixmap> iTopLeft, iTop,
			iTopRight, iLeft, iRight, 
			iBottomLeft, iBottom, iBottomRight;

	eString	basename;
public:
	operator bool() { return iTopLeft || iTop || iTopRight || iLeft || iRight || iBottomLeft || iBottom || iBottomRight; }
	
	eDecoration();
  
	bool load(const eString& basename);

	void drawDecoration(gPainter *target, ePoint size );
	int borderTop, borderLeft, borderBottom, borderRight;
};

class eDecoWidget:public eWidget
{
protected:
	eString strDeco;
	eRect crect, crect_selected;
	eDecoration deco, deco_selected;
	int setProperty( const eString &prop, const eString &value);
	int eventFilter( const eWidgetEvent &evt);
public:
	void setDeco( const char* deco )
	{
		strDeco = deco;
	}
	void loadDeco();
	eDecoWidget( eWidget* parent=0, int takefocus=0, const char* deco="" )
	:eWidget(parent, takefocus), strDeco( deco )
	{	}	
	const eDecoration& getDeco()	{ return deco; }
	const eDecoration& getDecoSelected()	{ return deco_selected; }
};

#endif