#ifndef _FRMLIST_H_
#define _FRMLIST_H_

#include "../tk/gui/gui.h"
#include "designer.h"

#include <list>
#include <iostream>

using namespace std;

class Designer;

/**
 * \brief Represent editable form's list.
 * 
 * \date 01-29-2006
 *
 * \author Ondrej Svejdar
 *
 * \todo 
 *
 * \bug 
 *
 */
class FrmList:public ButtonPressListener
{
	Designer* designer;
	Ptr<TclInterp> interp;

	Ptr<TkTopLevel> window;
	Ptr<TkListbox> lstForms;

	Ptr<TkButton> butOpen;
	Ptr<TkButton> butDel;
public:
	static const char* type;
	const char* getType() const
	{
		return type;
	}
	/**
	 * \brief ctor
	 * \param interp interpret
	 * \param designer designer
	 */
	FrmList(Ptr<TclInterp>& interp,Designer* designer);
	
	/**
	 * \brief insert new (but already existing) toplevel into editation list
	 * \param topLevel toplevel widget
	 */
	void newTopLevel(TkTopLevel* topLevel)
	{
		lstForms->getDefaultVariable()->push_back(topLevel->getName());
	}
	
	void onButtonPress(EHeader& header,int button,const string& state,int x,int y,int x_root,int y_root);
	
	/**
	 * \brief re-synchronize editable form's list with system form's list (TkGui)
	 */
	void reloadList();

	/**
	 * \brief make window visible/hidden
	 * \param value visiblity
	 */
	void setVisible(bool value);
};

#endif/*_FRMLIST_H_*/
