void ddTextTableItemFigure::createMenu(wxMenu &mnu)
{
	wxMenu *submenu;
	wxMenuItem *item;

	mnu.Append(MNU_DDADDCOLUMN, _("Add a column..."));
	item = mnu.Append(MNU_DELCOLUMN, _("Delete the selected column..."));
	if(getOwnerColumn()->isGeneratedForeignKey())
		item->Enable(false);
	mnu.Append(MNU_RENAMECOLUMN, _("Rename the selected column..."));
	if(getOwnerColumn()->isGeneratedForeignKey() && !getOwnerColumn()->isFkNameGenerated())
		mnu.Append(MNU_AUTONAMCOLUMN, _("Activate fk auto-naming..."));
	mnu.AppendSeparator();
	item = mnu.AppendCheckItem(MNU_NOTNULL, _("Not NULL constraint"));
	if(getOwnerColumn()->isNotNull())
		item->Check(true);
	if(getOwnerColumn()->isGeneratedForeignKey())
		item->Enable(false);
	mnu.AppendSeparator();
	item = mnu.AppendCheckItem(MNU_PKEY, _("Primary Key"));
	if(getOwnerColumn()->isPrimaryKey())
		item->Check(true);
	if(getOwnerColumn()->isGeneratedForeignKey())
		item->Enable(false);
	item = mnu.AppendCheckItem(MNU_UKEY, _("Unique Key"));
	if(getOwnerColumn()->isUniqueKey())
		item->Check(true);
	mnu.AppendSeparator();
	submenu = new wxMenu();
	item = mnu.AppendSubMenu(submenu, _("Column datatype"));
	if(getOwnerColumn()->isGeneratedForeignKey())
		item->Enable(false);
	item = submenu->AppendCheckItem(MNU_TYPESERIAL, _("serial"));
	item->Check(columnType == dt_bigint);
	item = submenu->AppendCheckItem(MNU_TYPEBOOLEAN, _("boolean"));
	item->Check(columnType == dt_boolean);
	item = submenu->AppendCheckItem(MNU_TYPEINTEGER, _("integer"));
	item->Check(columnType == dt_integer);
	item = submenu->AppendCheckItem(MNU_TYPEMONEY, _("money"));
	item->Check(columnType == dt_money);
	item = submenu->AppendCheckItem(MNU_TYPEVARCHAR, _("varchar(n)"));
	item->Check(columnType == dt_varchar);
	item = submenu->Append(MNU_TYPEOTHER, _("Choose another datatype..."));
	mnu.AppendSeparator();
	mnu.Append(MNU_TYPEPKEY_CONSTRAINTNAME, _("Primary Key Constraint name..."));
	mnu.Append(MNU_TYPEUKEY_CONSTRAINTNAME, _("Unique Key Constraint name..."));
	mnu.AppendSeparator();
	mnu.Append(MNU_DELTABLE, _("Delete table..."));
};
//Hack to allow use (events) of wxmenu inside a tool like simpletexttool
void ddDrawingView::setTextPopUpList(wxArrayString &strings, wxMenu &mnu)
{
	//DD-TODO: choose a better id for event
	mnu.Disconnect(wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)(wxEventFunction) (wxCommandEventFunction) &ddDrawingView::OnTextPopupClick,NULL,this);
	int sz = strings.size();  //to avoid warning
	wxMenuItem *item = NULL;
	wxMenu *submenu = NULL;
	bool isSubItem;
	bool subItemsDisable=false;
	for(int i=0 ; i < sz ; i++){
			//DD-TODO: only create options for what I need, this can be improved later
			//String "--submenu##menu item**sub menu title" and "--subitem--" create and add items to last created submenu
			isSubItem=false;
			item=NULL;
			if(strings[i].Contains(wxT("--submenu"))) 
			{
				if(strings[i].Contains(wxT("--disable"))) 
					subItemsDisable=true;
				else
					subItemsDisable=false;
				submenu = new wxMenu(strings[i].SubString(strings[i].find(wxT("**"))+2,strings[i].length())); 
				mnu.AppendSubMenu(submenu,strings[i].SubString(strings[i].find(wxT("##"))+2,strings[i].find(wxT("**"))-1));
			}
			else if(strings[i].Contains(wxT("--subitem")))
			{
				isSubItem=true;
				if(submenu)
				{
					if(strings[i].Contains(wxT("--checked")))
					{
						item=submenu->AppendCheckItem(i,strings[i].SubString(strings[i].find(wxT("**"))+2,strings[i].length()));
					}
					else
					{
						item=submenu->Append(i,strings[i].SubString(strings[i].find(wxT("**"))+2,strings[i].length()));
					}
				}
				else
				{
					wxMessageDialog *error = new wxMessageDialog(NULL, wxT("Error setting text popup strings list"), wxT("Error!"), wxOK | wxICON_ERROR);
					error->ShowModal();
					delete error;
				}
			}
			else if(strings[i].Contains(wxT("--separator--")))
			{
				mnu.AppendSeparator();
			}
			else if(strings[i].Contains(wxT("--checked")))
			{
				item = mnu.AppendCheckItem(i, strings[i].SubString(strings[i].find(wxT("**"))+2,strings[i].length()));
			}
			else if(strings[i].Contains(wxT("**")))
			{
				item = mnu.Append(i, strings[i].SubString(strings[i].find(wxT("**"))+2,strings[i].length()));
			}
			else 
			{
				item = mnu.Append(i, strings[i]);
			}

			if(item && strings[i].Contains(wxT("--checked")))
			{
				item->Check(true);
			}
			if(   item &&  ( strings[i].Contains(wxT("--disable")) || (submenu && isSubItem && subItemsDisable) )   )
			{
				item->Enable(false);
			}

		}
//DD-TODO: create a better version of this hack
	mnu.Connect(wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)(wxEventFunction) (wxCommandEventFunction) &ddDrawingView::OnTextPopupClick,NULL,this);
}