summaryrefslogtreecommitdiffstats
path: root/src/kvirc/ui/kvi_mdicaption.h
blob: 6bec4051c7624235e827d91246aed0a13756e2fc (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
#ifndef _KVI_MDICAPTION_H_
#define _KVI_MDICAPTION_H_
//=================================================================================================
//
//   File : kvi_mdicaption.h
//   Creation date : Tue Sep 2 2003 02:35:45 by Szymon Stefanek
//
//   This file is part of the KVirc irc client distribution
//   Copyright (C) 2003 Szymon Stefanek (pragma at kvirc dot net)
//
//   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"

#include <qtoolbutton.h>
#include <qlabel.h>
#include "kvi_styled_controls.h"

class KviMdiManager;
class KviMdiChild;


class KVIRC_API KviMdiCaptionButton : public QToolButton
{
	Q_OBJECT
public:
	KviMdiCaptionButton(const QPixmap &pix,QWidget * parent,const char * name);
	~KviMdiCaptionButton();
protected:
	virtual void drawButton(QPainter * p);
#ifdef COMPILE_USE_QT4
	virtual void paintEvent(QPaintEvent *e);
#endif
};


class KviMenuBarToolButton : public KviStyledToolButton
{
	Q_OBJECT
public:
	KviMenuBarToolButton(QWidget * par,const QPixmap &img, const char * name);
	~KviMenuBarToolButton();
public:
	virtual QSize sizeHint() const;
};


class KVIRC_API KviMdiCaption : public QWidget
{
	friend class KviMdiChild;
	Q_OBJECT
public:
	KviMdiCaption(KviMdiChild * parent,const char * name);
	~KviMdiCaption();
protected:
	QPoint                m_lastMousePos;
	bool                  m_bMouseGrabbed;
	int                   m_iLineSpacing;
	bool                  m_bActive;
	KviMdiCaptionButton * m_pSystemButton;
	KviMdiCaptionButton * m_pMinimizeButton;
	KviMdiCaptionButton * m_pMaximizeButton;
	KviMdiCaptionButton * m_pCloseButton;
	QPixmap               m_pixSystemIcon;
public:
	int heightHint();
	void setActive(bool bActive);
	bool active(){ return m_bActive; };
	void setSystemIcon(const QPixmap &pix){ m_pSystemButton->setPixmap(pix); m_pixSystemIcon = pix; };
	const QPixmap * systemIcon(){ return &m_pixSystemIcon; };
	void enableClose(bool bEnable){ m_pCloseButton->setEnabled(bEnable); };
	bool closeEnabled(){ return m_pCloseButton->isEnabled(); };
	virtual void setFocusProxy(QWidget * w);
protected:
	void calcLineSpacing();
	virtual void fontChange(const QFont &old);
	virtual void mousePressEvent(QMouseEvent *e);
	virtual void mouseDoubleClickEvent(QMouseEvent *e);
	virtual void mouseMoveEvent(QMouseEvent *e);
	virtual void mouseReleaseEvent(QMouseEvent *e);
	virtual void paintEvent(QPaintEvent * e);
	virtual void resizeEvent(QResizeEvent * e);
	void reloadImages();
};


#endif //_KVI_MDICAPTION_H_