summaryrefslogtreecommitdiffstats
path: root/src/kvirc/ui/kvi_styled_controls.h
blob: 736d9d3dc610ad164ffaa25bf8be7a8bd6fe1185 (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
#ifndef _KVI_STYLED_CONTROLS_H_
#define _KVI_STYLED_CONTROLS_H_

///////////////////////////////////////////////////////////////////////////////
//
//   File : kvi_styled_controls.h
//   Creation date : 19  Jan 2006 GMT by Alexey Uzhva
//
//   This toolbar is part of the KVirc irc client distribution
//   Copyright (C) 2006 Alexey Uzhva
//
//   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 opinion) 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. ,51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
//
///////////////////////////////////////////////////////////////////////////////

#include "kvi_settings.h"

#ifdef COMPILE_USE_QT4
	// we use internal TQt4 styles for now
	#include <tqcheckbox.h>
	#include <tqtoolbutton.h>
	
	#define KviStyledCheckBox TQCheckBox
	#define KviStyledToolButton TQToolButton
#else

#include <tqcheckbox.h>
#include <tqtoolbutton.h>
#include <tqevent.h>
#include <tqtimer.h>
#include "kvi_heapobject.h"

class KviTalToolBar;

#define KVI_STYLE_NUM_STEPS  20
#define KVI_STYLE_COLOR_DIFF  60
#define KVI_STYLE_TIMER_STEP 18

class KviStyledControl;

class KVIRC_API KviStyledControlInternal : public TQObject
{
	TQ_OBJECT
  
public:
	KviStyledControlInternal( KviStyledControl* control );
	~KviStyledControlInternal();
public slots:
	virtual void paintTimerShot();
protected:
	bool eventFilter( TQObject *obj, TQEvent *ev );
protected:
	KviStyledControl*	m_pControl;
};

class KVIRC_API KviStyledControl
{
	friend class KviStyledControlInternal;
public:
	KviStyledControl(TQWidget*);
	~KviStyledControl();
protected:
	virtual void enterEvent ( TQEvent * );
	virtual void leaveEvent ( TQEvent * );
	
	int 				m_bMouseEnter;
	int 				m_iStepNumber;
	TQTimer*				m_pTimer;
	KviStyledControlInternal*	m_pInternal;
	TQWidget				*m_pWidget;
};

class KVIRC_API KviStyledCheckBox : public TQCheckBox, public KviStyledControl
{
	TQ_OBJECT
  
public:
	KviStyledCheckBox ( TQWidget * parent, const char * name = 0 );
	KviStyledCheckBox ( const TQString & text, TQWidget * parent, const char * name = 0 );
	~KviStyledCheckBox();
protected:
	virtual void paintEvent ( TQPaintEvent * );
};

class KVIRC_API KviStyledToolButton : public TQToolButton, public KviStyledControl
{
	TQ_OBJECT
  
private:
	bool bShowSubmenuIndicator;
public:
	KviStyledToolButton ( TQWidget * parent, const char * name = 0 );
	KviStyledToolButton ( const TQIconSet & iconSet, const TQString & textLabel, const TQString & grouptext, TQObject * receiver, const char * slot, KviTalToolBar * parent, const char * name = 0 );
	~KviStyledToolButton();
	
	void setShowSubmenuIndicator(bool bShow);
protected:
	virtual void paintEvent ( TQPaintEvent * );
	virtual void resizeEvent ( TQResizeEvent * ) ;
};

#endif

#endif