#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
{
	TQ_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);
	KviTalGroupBox * addGroupBox(int x1,int y1,int x2,int y2,int nStrips,KviTalGroupBox::Orientation o,const TQString &txt,bool bEnabled = true);
	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_
