aboutsummaryrefslogtreecommitdiffstats
path: root/src/modules/notifier/NotifierWindowTab.h
blob: 550d3dd60346de4b89435eee937b6eb4dcc7d5c7 (about) (plain) (blame)
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
#ifndef _KVINOTIFIERWINDOWTAB_H_
#define _KVINOTIFIERWINDOWTAB_H_
//=============================================================================
//
//   File : NotifierWindowTab.h
//   Creation date : Tue 07 Jul 2009 10:28 by Fabio Bas
//
//   This file is part of the KVIrc distribution
//   Copyright (C) 2009 Fabio Bas < ctrlaltca at gmail dot com >
//
//   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 option) 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.
//
//=============================================================================

/**
* \file NotifierWindowTab.h
* \author Fabio Bas
* \brief Defines the tab page for the notifier object
*/

#include "NotifierMessage.h"

#include "kvi_settings.h"

#include <QScrollArea>

class KviWindow;
class QPainter;
class QTabWidget;
class QVBoxLayout;
class QWidget;

/**
* \class NotifierWindowTab
* \brief Defines an object for every single tab about the tabs area
*/
class NotifierWindowTab : public QScrollArea
{
	Q_OBJECT
public:
	/**
	* \brief Creates the tab object
	* \param pWnd The name of the window represented by the tab
	* \param pParent The parent area container
	* \return NotifierWindowTab
	*/
	NotifierWindowTab(KviWindow * pWnd, QTabWidget * pParent);

	/**
	* \brief Destroys the tab object
	*/
	~NotifierWindowTab();

private:
	QString m_szLabel;
	KviWindow * m_pWnd = nullptr;
	QTabWidget * m_pParent = nullptr;
	QVBoxLayout * m_pVBox = nullptr;
	QWidget * m_pVWidget = nullptr;

public:
	/**
	* \brief Appends the given message to the window
	* \param pMessage The message received to append
	* \return void
	*/
	void appendMessage(NotifierMessage * pMessage);

	/**
	* \brief Updates the GUI
	* \return void
	*/
	void updateGui();

	/**
	* \brief Returns the name of the current window
	* \return QString
	*/
	QString label() const { return m_szLabel; }

	/**
	* \brief Returns the pointer of the current window
	* \return KviWindow *
	*/
	KviWindow * wnd() const { return m_pWnd; }
protected:
	void mouseDoubleClickEvent(QMouseEvent * e) override;
	void resizeEvent(QResizeEvent * e) override;
	void paintEvent(QPaintEvent * e) override;
private slots:
	/**
	* \brief Emitted when the scrollbar range is changed
	* \return void
	*/
	void scrollRangeChanged(int, int);

	/**
	* \brief Emitted when the window changes its name
	* \return void
	*/
	void labelChanged();

	/**
	* \brief Emitted when the window is being destroyed
	* \return void
	*/
	void closeMe();
};

#endif //!_KVINOTIFIERWINDOWTAB_H_