aboutsummaryrefslogtreecommitdiffstats
path: root/src/modules/objects/KvsObject_widget.h
blob: 888aae80a8e5743990eb74a936b10cbce630fa9f (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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
#ifndef _CLASS_WIDGET_H_
#define _CLASS_WIDGET_H_
//=============================================================================
//
//   File : KvsObject_widget.h
//   Creation date : Mon Sep 11 16:35:32 CET 2000 by Krzysztof Godlewski
//
//   This file is part of the KVIrc IRC client distribution
//   Copyright (C) 2000 Krzysztof Godlewski
//   Copyright (C) 2000-2010 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 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.
//
//=============================================================================

#include "kvi_settings.h"
#include "KviCString.h"
#include "KviTalToolTip.h"
#include "object_macros.h"

#include <QGraphicsEffect>

#ifdef COMPILE_WEBKIT_SUPPORT
#include <QtWebKitWidgets/QWebView>
#endif

class KvsObject_widget : public KviKvsObject
{
	Q_OBJECT
public:
	KVSO_DECLARE_OBJECT(KvsObject_widget)

public:
	QWidget * widget() { return (QWidget *)object(); };

protected:
	virtual bool init(KviKvsRunTimeContext * pContext, KviKvsVariantList * pParams);

#ifdef COMPILE_WEBKIT_SUPPORT
	QWebView * m_pWebview;
#endif
	virtual bool eventFilter(QObject * o, QEvent * e);
	KviKvsRunTimeContext * m_pContext;
	QGraphicsDropShadowEffect * pGraphicsEffect;
	// ok, it is clear that we're messing with the naming conventions for the
	// object classes :D
	// let's try to use this one:
	// isEnabled
	// setEnabled..
	// ... etc
	// so the name of the C++ function matches exactly the name of the KVS function at this point

	// let's also try to keep alphabetic order for the functions here.. so one can find them quickly

	bool addWidgetToWrappedLayout(KviKvsObjectFunctionCall * c);
	bool backgroundColor(KviKvsObjectFunctionCall * c);
	bool centerToScreen(KviKvsObjectFunctionCall * c);
	bool colorPalette(KviKvsObjectFunctionCall * c);
	bool fontAscent(KviKvsObjectFunctionCall * c);
	bool fontDescent(KviKvsObjectFunctionCall * c);
	bool fontMetricsHeight(KviKvsObjectFunctionCall * c);
	bool fontMetricsWidth(KviKvsObjectFunctionCall * c);
	bool fontMetricsLineSpacing(KviKvsObjectFunctionCall * c);
	bool foregroundColor(KviKvsObjectFunctionCall * c);
	bool geometry(KviKvsObjectFunctionCall * c);
	bool globalCursorX(KviKvsObjectFunctionCall * c);
	bool globalCursorY(KviKvsObjectFunctionCall * c);
	bool hasFocus(KviKvsObjectFunctionCall * c);
	bool height(KviKvsObjectFunctionCall *);
	bool hide(KviKvsObjectFunctionCall *);
	bool isEnabled(KviKvsObjectFunctionCall * c);
	bool isTopLevel(KviKvsObjectFunctionCall * c);
	bool isVisible(KviKvsObjectFunctionCall * c);
	bool loadInterface(KviKvsObjectFunctionCall * c);
	bool lower(KviKvsObjectFunctionCall *);
	bool mapFromGlobal(KviKvsObjectFunctionCall * c);
	bool mapToGlobal(KviKvsObjectFunctionCall * c);
	bool move(KviKvsObjectFunctionCall * c);
	bool parentWidget(KviKvsObjectFunctionCall * c);
	bool raise(KviKvsObjectFunctionCall *);
	bool repaint(KviKvsObjectFunctionCall * c);
	bool insertIntoStatusBar(KviKvsObjectFunctionCall * c);
	bool removeFromStatusBar(KviKvsObjectFunctionCall * c);
	bool setParent(KviKvsObjectFunctionCall * c);
	bool resize(KviKvsObjectFunctionCall * c);
	bool screenResolution(KviKvsObjectFunctionCall * c);
	bool setAttribute(KviKvsObjectFunctionCall * c);
	bool setBackgroundColor(KviKvsObjectFunctionCall * c);
	bool setBackgroundImage(KviKvsObjectFunctionCall * c);
	bool setEnabled(KviKvsObjectFunctionCall * c);
	bool setFocus(KviKvsObjectFunctionCall * c);
	bool setFocusPolicy(KviKvsObjectFunctionCall * c);
	bool setFont(KviKvsObjectFunctionCall * c);
	bool setGeometry(KviKvsObjectFunctionCall * c);
	bool setKeyShortcut(KviKvsObjectFunctionCall * c);
	bool setMask(KviKvsObjectFunctionCall * c);
	bool setMaximumHeight(KviKvsObjectFunctionCall * c);
	bool setMaximumWidth(KviKvsObjectFunctionCall * c);
	bool setMinimumHeight(KviKvsObjectFunctionCall * c);
	bool setMinimumWidth(KviKvsObjectFunctionCall * c);
	bool setMouseTracking(KviKvsObjectFunctionCall * c);
	bool setForegroundColor(KviKvsObjectFunctionCall * c);
	bool setStyleSheet(KviKvsObjectFunctionCall * c);
	bool setToolTip(KviKvsObjectFunctionCall *);
	bool setWindowIcon(KviKvsObjectFunctionCall * c);
	bool setWindowTitle(KviKvsObjectFunctionCall * c);
	bool setWFlags(KviKvsObjectFunctionCall * c);
	bool show(KviKvsObjectFunctionCall * c);
	bool sizeHint(KviKvsObjectFunctionCall * c);
	bool update(KviKvsObjectFunctionCall * c);
	bool width(KviKvsObjectFunctionCall *);
	bool windowTitle(KviKvsObjectFunctionCall * c);
	bool x(KviKvsObjectFunctionCall *);
	bool y(KviKvsObjectFunctionCall *);

	bool grab(KviKvsObjectFunctionCall *);
#ifdef COMPILE_WEBKIT_SUPPORT
	bool setWebView(KviKvsObjectFunctionCall * c);
#endif

signals:
	void aboutToDie();
};

class KviKvsWidget : public QWidget
{
	Q_OBJECT
	Q_PROPERTY(QSize sizeHint READ sizeHint)
public:
	KviKvsWidget(KvsObject_widget * ob, QWidget * par);
	virtual ~KviKvsWidget();

protected:
	KvsObject_widget * m_pObject;

public:
	QSize sizeHint() const;
};
#endif //_CLASS_WIDGET_H_