summaryrefslogtreecommitdiffstats
path: root/src/kvirc/ui/kvi_optionswidget.h
blob: 0d07754457ae7e4bf30d077a00955ed8c343d134 (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
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
152
153
154
155
156
157
158
159
160
161
162
163
164
#ifndef _KVI_OPTIONSWIDGET_H_
#define _KVI_OPTIONSWIDGET_H_

//=============================================================================
//
//   File : kvi_optionswidget.h
//   Creation date : Mon Jun 10 2000 17:47:33 by Szymon Stefanek
//
//   This file is part of the KVirc irc client distribution
//   Copyright (C) 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 <tqframe.h>
#include <tqlayout.h>
#include "kvi_pointerlist.h"
#include <tqlineedit.h>
#include <kvi_tal_groupbox.h>
#include <tqtabwidget.h>
#include "kvi_tal_groupbox.h"
#include "kvi_selectors.h"

class KVIRC_API KviOptionsWidget : public TQFrame, public KviSelectorInterface
{
	Q_OBJECT
  
public:
	KviOptionsWidget(TQWidget * parent,const char * name = 0,bool bSunken = true);
	~KviOptionsWidget();
private:
	TQGridLayout                      * m_pLayout;
	TQTabWidget                       * m_pTabWidget;
	int                                m_iResetFlags;
	int                                m_iSelectors;
	KviPointerList<KviSelectorInterface> * m_pSelectorInterfaceList;
	static TQString                     m_szBasicTipStart;
	static TQString                     m_szBasicTipEnd;
public:
	void mergeResetFlag(int flag){ m_iResetFlags |= flag; };
	void createLayout(int rows,int columns);
	TQGridLayout * layout(){ return m_pLayout; };
protected:
	void commitSelectors();
	void commitOptionsReset();
public:
	void mergeTip(TQWidget * w,const TQString &tip);

	// tabbed page paradigm
	void createTabbedPage();
	void addOptionsWidget(const TQString &szText,const TQIconSet &iconSet,KviOptionsWidget * pWidget);
	TQTabWidget * tabWidget(){ return m_pTabWidget; };

	// non tabbed page paradigm
	KviBoolSelector       * addBoolSelector(int x1,int y1,int x2,int y2,const TQString & txt,bool * pOption,bool bEnabled = true);
	KviBoolSelector       * addBoolSelector(TQWidget * pParent,const TQString & txt,bool * pOption,bool bEnabled = true);
	KviBoolSelector       * addBoolSelector(int x1,int y1,int x2,int y2,const TQString & txt,int optId,bool bEnabled = true);
	KviBoolSelector       * addBoolSelector(TQWidget * pParnt,const TQString & txt,int optId,bool bEnabled = true);

	KviColorSelector      * addColorSelector(int x1,int y1,int x2,int y2,const TQString & txt,TQColor * pOption,bool bEnabled = true);
	KviColorSelector      * addColorSelector(TQWidget * pParent,const TQString & txt,TQColor * pOption,bool bEnabled = true);
	KviColorSelector      * addColorSelector(int x1,int y1,int x2,int y2,const TQString & txt,int optId,bool bEnabled = true);
	KviColorSelector      * addColorSelector(TQWidget * pParent,const TQString & txt,int optId,bool bEnabled = true);

	KviMircTextColorSelector * addMircTextColorSelector(int x1,int y1,int x2,int y2,const TQString & txt,unsigned int *uFore,unsigned int *uBack,bool bEnabled = true);
	KviMircTextColorSelector * addMircTextColorSelector(TQWidget * pParent,const TQString & txt,unsigned int *uFore,unsigned int *uBack,bool bEnabled = true);
	KviMircTextColorSelector * addMircTextColorSelector(int x1,int y1,int x2,int y2,const TQString & txt,int optForeId,int optBackId,bool bEnabled = true);
	KviMircTextColorSelector * addMircTextColorSelector(TQWidget * pParent,const TQString & txt,int optForeId,int optBackId,bool bEnabled = true);

	KviDirectorySelector  * addDirectorySelector(int x1,int y1,int x2,int y2,const TQString & txt,TQString * pOption,bool bEnabled = true);
	KviDirectorySelector  * addDirectorySelector(TQWidget * pParent,const TQString & txt,TQString * pOption,bool bEnabled = true);
	KviDirectorySelector  * addDirectorySelector(int x1,int y1,int x2,int y2,const TQString & txt,int optId,bool bEnabled = true);
	KviDirectorySelector  * addDirectorySelector(TQWidget * pParent,const TQString & txt,int optId,bool bEnabled = true);

	KviFileSelector       * addFileSelector(int x1,int y1,int x2,int y2,const TQString & txt,TQString * pOption,bool bEnabled = true);
	KviFileSelector       * addFileSelector(TQWidget * pParent,const TQString & txt,TQString * pOption,bool bEnabled = true);
	KviFileSelector       * addFileSelector(int x1,int y1,int x2,int y2,const TQString & txt,int optId,bool bEnabled = true);
	KviFileSelector       * addFileSelector(TQWidget * pParent,const TQString & txt,int optId,bool bEnabled = true);

	KviSoundSelector       * addSoundSelector(int x1,int y1,int x2,int y2,const TQString & txt,TQString * pOption,bool bEnabled = true);
	KviSoundSelector       * addSoundSelector(TQWidget * pParent,const TQString & txt,TQString * pOption,bool bEnabled = true);
	KviSoundSelector       * addSoundSelector(int x1,int y1,int x2,int y2,const TQString & txt,int optId,bool bEnabled = true);
	KviSoundSelector       * addSoundSelector(TQWidget * pParent,const TQString & txt,int optId,bool bEnabled = true);


	KviFontSelector       * addFontSelector(int x1,int y1,int x2,int y2,const TQString & txt,TQFont * pOption,bool bEnabled = true);
	KviFontSelector       * addFontSelector(TQWidget * pParent,const TQString & txt,TQFont * pOption,bool bEnabled = true);
	KviFontSelector       * addFontSelector(int x1,int y1,int x2,int y2,const TQString & txt,int optId,bool bEnabled = true);
	KviFontSelector       * addFontSelector(TQWidget * pParent,const TQString & txt,int optId,bool bEnabled = true);

	KviPasswordSelector   * addPasswordSelector(int x1,int y1,int x2,int y2,const TQString & txt,TQString * pOption,bool bEnabled = true);
	KviPasswordSelector   * addPasswordSelector(TQWidget * pParent,const TQString & txt,TQString * pOption,bool bEnabled = true);
	KviPasswordSelector   * addPasswordSelector(int x1,int y1,int x2,int y2,const TQString & txt,int optId,bool bEnabled = true);
	KviPasswordSelector   * addPasswordSelector(TQWidget * pParent,const TQString & txt,int optId,bool bEnabled = true);
	
	KviPixmapSelector     * addPixmapSelector(int x1,int y1,int x2,int y2,const TQString & txt,int optId,bool bEnabled = true);
	KviPixmapSelector     * addPixmapSelector(int x1,int y1,int x2,int y2,const TQString & txt,KviPixmap * pOption,bool bEnabled = true);

	KviStringListSelector * addStringListSelector(int x1,int y1,int x2,int y2,const TQString & txt,TQStringList * pOption,bool bEnabled = true);
	KviStringListSelector * addStringListSelector(int x1,int y1,int x2,int y2,const TQString & txt,int optId,bool bEnabled = true);

	KviStringSelector     * addStringSelector(int x1,int y1,int x2,int y2,const TQString & txt,TQString * pOption,bool bEnabled = true);
	KviStringSelector     * addStringSelector(TQWidget * pParent,const TQString & txt,TQString * pOption,bool bEnabled = true);
	KviStringSelector     * addStringSelector(int x1,int y1,int x2,int y2,const TQString & txt,int optId,bool bEnabled = true);
	KviStringSelector     * addStringSelector(TQWidget * pParent,const TQString & txt,int optId,bool bEnabled = true);

	KviUIntSelector       * addUIntSelector(int x1,int y1,int x2,int y2,const TQString & txt,unsigned int * pOption,
								unsigned int uLowBound,unsigned int uHighBound,unsigned int uDefault,bool bEnabled = true);
	KviUIntSelector       * addUIntSelector(TQWidget * pParent,const TQString & txt,unsigned int * pOption,
								unsigned int uLowBound,unsigned int uHighBound,unsigned int uDefault,bool bEnabled = true);
	KviUIntSelector       * addUIntSelector(int x1,int y1,int x2,int y2,const TQString & txt,int optId,
				unsigned int uLowBound,unsigned int uHighBound,unsigned int uDefault,bool bEnabled = true);
	KviUIntSelector       * addUIntSelector(TQWidget * pParent,const TQString & txt,int optId,
				unsigned int uLowBound,unsigned int uHighBound,unsigned int uDefault,bool bEnabled = true);


	KviUIntSelector       * addUShortIntSelector(int x1,int y1,int x2,int y2,const TQString & txt,unsigned short int * pOption,
							unsigned int uLowBound,unsigned int uHighBound,unsigned int uDefault,bool bEnabled = true);

	TQLabel * addLabel(int x1,int y1,int x2,int y2,const TQString & text,bool bEnabled = true);
	TQLabel * addLabel(TQWidget * pParent,const TQString & text,bool bEnabled = true);
	TQLineEdit * addLineEdit(int x1,int y1,int x2,int y2,bool bEnabled = true);
#ifdef COMPILE_USE_QT4
	KviTalGroupBox * addGroupBox(int x1,int y1,int x2,int y2,int nStrips,Qt::Orientation o,const TQString &txt,bool bEnabled = true);
#else
	KviTalGroupBox * addGroupBox(int x1,int y1,int x2,int y2,int nStrips,KviTalGroupBox::Orientation o,const TQString &txt,bool bEnabled = true);
#endif
	TQFrame * addSeparator(int x1,int y1,int x2,int y2);
	void addRowSpacer(int x1,int y1,int x2,int y2);

	void addWidgetToLayout(TQWidget * w,int x1,int y1,int x2,int y2);

	// this does NOT add the advanced button if this page is not inside a KviGeneralOptionsDialog
	// this is because nobody listens to the "switchToAdvancedPage" requests....
	void addAdvancedButton(int x1,int y1,int x2,int y2);

	virtual void commit();
protected slots:
	// this is internal to the options dialog (options module)
	// it attempts to show all the hidden subitems (usually the "Advanced...") page
	// and switch to the first of them
	void switchToAdvancedPage();
signals:
	// internal signal used for the stuff above
	void wantToSwitchToAdvancedPage(KviOptionsWidget *);
};


#endif //!_KVI_OPTIONSWIDGET_H_