summaryrefslogtreecommitdiffstats
path: root/src/kvirc/ui/kvi_mdichild.h
blob: 8964456c56eca1954efe0946b091bd1b9d201cea (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
#ifndef _KVI_MDICHILD_H_
#define _KVI_MDICHILD_H_
//=================================================================================================
//
//   File : kvi_mdichild.h
//   Creation date : Wed Jun 21 2000 17:35:04 by Szymon Stefanek
//
//   This file is part of the KVirc irc client distribution
//   Copyright (C) 1999-2000 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 "kvi_string.h"

#include <tqframe.h>
#include <tqtoolbutton.h>
#include <tqlabel.h>


class KviMdiManager;
class KviMdiChild;
class KviMdiCaption;

class TQCursor;



class KVIRC_API KviMdiChild : public TQFrame
{
	friend class KviMdiManager;
	friend class KviMdiCaption;
	TQ_OBJECT
  
public:
	KviMdiChild(KviMdiManager* par,const char * name = 0);
	~KviMdiChild();
public:
	enum MdiChildState { Maximized , Minimized , Normal };
protected:
	KviMdiManager              * m_pManager;
	KviMdiCaption              * m_pCaption;
private:
	int                          m_iResizeCorner;
	int                          m_iLastCursorCorner;
	bool                         m_bResizeMode;
	TQWidget                    * m_pClient;
	MdiChildState                m_state;
	TQRect                        m_restoredGeometry;

	TQString                      m_szXmlActiveCaption;
	TQString                      m_szXmlInactiveCaption;
	TQString                      m_szPlainCaption;
public:
	TQRect restoredGeometry();
	void setRestoredGeometry(const TQRect &r){ m_restoredGeometry = r; };
	void setClient(TQWidget * w);
	TQWidget * client(){ return m_pClient; };
	void unsetClient();
	KviMdiCaption * captionLabel(){ return m_pCaption; };
	MdiChildState state(){ return m_state; };
	const TQString & plainCaption(){ return m_szPlainCaption; };
	const TQString & xmlActiveCaption(){ return m_szXmlActiveCaption; };
	const TQString & xmlInactiveCaption(){ return m_szXmlInactiveCaption; };
	void setCaption(const TQString & plain,const TQString & xmlActive,const TQString & xmlInactive);
	virtual TQSize sizeHint();
	void setIcon(const TQPixmap &pix);
	const TQPixmap * icon();
	void enableClose(bool bEnable);
	bool closeEnabled();
	KviMdiManager * manager(){ return m_pManager; };
	void activate(bool bSetFocus);
	void reloadImages();
public slots:
	void maximize();
	void minimize();
	void restore();
	void systemPopupSlot();
	void closeRequest();
signals:
	void systemPopupRequest(const TQPoint & pnt);
protected:
#ifdef COMPILE_USE_QT4
	virtual void setBackgroundRole(TQPalette::ColorRole);
#else
	virtual void setBackgroundMode(TQWidget::BackgroundMode bgmd);
#endif
	virtual void resizeEvent(TQResizeEvent *e);
	virtual void mousePressEvent(TQMouseEvent *e);
	virtual void mouseMoveEvent(TQMouseEvent *e);
	virtual void mouseReleaseEvent(TQMouseEvent *e);
	virtual void leaveEvent(TQEvent *e);
	virtual void focusInEvent(TQFocusEvent *);
	virtual void moveEvent(TQMoveEvent *e);
//	bool eventFilter(TQObject *o,TQEvent *e);
	void emitSystemPopupRequest(const TQPoint & pnt){ emit systemPopupRequest(pnt); };
private:
//	void linkChildren(TQWidget *w);
//	void unlinkChildren(TQWidget *w);
	TQCursor getResizeCursor(int resizeCorner);
	void resizeWindowOpaque(int resizeCorner);
	int getResizeCorner(int ax,int ay);
	void calculateMinimumSize(int &minWidth,int &minHeight);
	void setResizeCursor(int resizeCorner);
	void calculateResizeRect(int resizeCorner,TQPoint mousePos,TQRect &resizeRect,int minWidth,int minHeight);
};


#endif //_KVI_MDICHILD_H_