summaryrefslogtreecommitdiffstats
path: root/src/modules/options/optw_texticons.h
blob: 652c7da9636623ad7e136bc9349c4cc7c919f31b (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
#ifndef _OPTW_TEXTICONS_H_
#define _OPTW_TEXTICONS_H_

//
//   File : optw_texticons.h
//   Creation date : Fri May 24 2002 00:14:02 CEST by Szymon Stefanek
//
//   This file is part of the KVirc irc client distribution
//   Copyright (C) 2002 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_optionswidget.h"
#include "kvi_texticonmanager.h"
#define KVI_OPTIONS_WIDGET_ICON_KviTextIconsOptionsWidget KVI_SMALLICON_BIGGRIN
#define KVI_OPTIONS_WIDGET_NAME_KviTextIconsOptionsWidget __tr2qs_no_lookup("Text icons")
#define KVI_OPTIONS_WIDGET_PARENT_KviTextIconsOptionsWidget KviToolsOptionsWidget
#define KVI_OPTIONS_WIDGET_KEYWORDS_KviTextIconsOptionsWidget __tr2qs_no_lookup("smileys,emoticons")



#include <qtoolbutton.h>
#include "kvi_tal_popupmenu.h"
#include "kvi_tal_hbox.h" 

#ifdef COMPILE_USE_QT4
#include <q3table.h>
#define KviTalTable Q3Table
#define KviTalTableItem Q3TableItem
#else
#include <qtable.h>
#define KviTalTable QTable
#define KviTalTableItem QTableItem
#endif

class KviTextIconTableItem;

class KviTextIconEditor : public KviTalHBox
{
	Q_OBJECT
public:
	KviTextIconEditor(QWidget * par,KviTextIcon * icon,KviTextIconTableItem* item);
	~KviTextIconEditor();
protected:
	KviTextIconTableItem *m_pTableItem;
	KviTextIcon     *m_pIcon;
	KviTalPopupMenu      *m_pPopup;
	QToolButton     *m_pIconButton;
	QToolButton     *m_pBrowseButton;
public:
	void updateIcon();
	KviTextIcon*	icon() { return m_pIcon; };
protected slots:
	void iconSelected(int);
	void doPopup();
	void chooseFromFile();
};

class KviTextIconTableItem : public KviTalTableItem
{
	friend class KviTextIconsOptionsWidget;
public:
	KviTextIconTableItem(KviTalTable * t,KviTextIcon * icon);
	~KviTextIconTableItem();
protected:
	KviTextIcon * m_pIcon;
public:
	KviTextIcon * icon() { return m_pIcon; };
	void setId(int id);
	virtual QWidget * createEditor() const;
	virtual void setContentFromEditor(QWidget * w);
};

class KviTextIconsOptionsWidget : public KviOptionsWidget
{
	Q_OBJECT
public:
	KviTextIconsOptionsWidget(QWidget * parent);
	~KviTextIconsOptionsWidget();
protected:
	KviTalTable     * m_pTable;
	QPushButton * m_pAdd;
	QPushButton * m_pDel;
public:
    virtual void commit();
protected slots:
	void selectionChanged();
	void addClicked();
	void delClicked();
};

#endif //!_OPTW_TEXTICONS_H_