
/*

Sample program for icon window. Copy the files sylt.bmp and
watten.bmp into your working directory.

*/


#include"gui/iconwin.h"
#include"ui/dialog.h"


#define ID 200


UI_MenuItemDescriptor DscMnu  [] =
{
	 {"Menuentry" , ID + 1 , NULL},
	 {NULL        , 0  , NULL}
};



class MyIconWin : public IconWindow
{
  public:

	MyIconWin() : IconWindow(NULL,UI_Rectangle(50, 50, 700, 600),ID,10)
	{
	  Title() = "Test the icon window";
	  New = new Icon(this,UI_Vector(60,90),20,ID+2,"watten.bmp","New",NULL);
     typedef UI_EventBinding0<MyIconWin> IconBind;
	  IconBind bd(this,&MyIconWin::createIcon);
	  New->AddEventDependent(Event_LButtonDblClk,bd);
	  cnt = 3;
	  IconMenu  = new UI_PopupMenu(this,DscMnu);
	};

  protected:

	 bool createIcon()
		{
		  cnt++;
		  Icon* Icn = new Icon(this,UI_Vector(60,90),20,
									  ID+cnt,"sylt.bmp","Another",NULL);
		  Icn->mnu() = IconMenu;
		  return TRUE;
		};

	 unsigned      cnt;
	 UI_PopupMenu* IconMenu;
	 Icon*         New;
};


