void ddColumnOptionIcon::createMenu(wxMenu &mnu) { wxMenuItem *item; item = mnu.AppendCheckItem(MNU_COLNULL, _("NULL")); item->Check(colOption == null); item->Enable(!getOwnerColumn()->isGeneratedForeignKey()); item = mnu.AppendCheckItem(MNU_COLNOTNULL, _("Not NULL")); item->Check(colOption == notnull); item->Enable(!getOwnerColumn()->isGeneratedForeignKey()); }
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...")); };
void CompilerMessages::AppendAdditionalMenuItems(wxMenu &menu) { menu.Append(idMenuFit, _("Fit text"), _("Makes the whole text visible")); menu.AppendCheckItem(idMenuAutoFit, _("Fit automatically"), _("Automatically makes the whole text visible during compilation")); menu.Check(idMenuAutoFit, m_autoFit); }
void DebuggerMenuHandler::AppendWindowMenuItems(wxMenu &menu) { std::map<wxString, long> sortedNames; for (WindowMenuItemsMap::iterator it = m_windowMenuItems.begin(); it != m_windowMenuItems.end(); ++it) sortedNames[it->second.name] = it->first; for (std::map<wxString, long>::iterator it = sortedNames.begin(); it != sortedNames.end(); ++it) menu.AppendCheckItem(it->second, it->first, m_windowMenuItems[it->second].help); }
void wxHeaderCtrlBase::AddColumnsItems(wxMenu& menu, int idColumnsBase) { const unsigned count = GetColumnCount(); for ( unsigned n = 0; n < count; n++ ) { const wxHeaderColumn& col = GetColumn(n); menu.AppendCheckItem(idColumnsBase + n, col.GetTitle()); if ( col.IsShown() ) menu.Check(n, true); } }
void Scrubber::PopulateMenu(wxMenu &menu) { int id = CMD_ID; auto cm = mProject->GetCommandManager(); const MenuItem *checkedItem = HasStartedScrubbing() ? &FindMenuItem(mSmoothScrollingScrub, mAlwaysSeeking) : nullptr; for (const auto &item : menuItems) { if (cm->GetEnabled(item.name)) { #ifdef CHECKABLE_SCRUB_MENU_ITEMS menu.AppendCheckItem(id, item.label); if(&item == checkedItem) menu.FindItem(id)->Check(); #else menu.Append(id, item.label); #endif } ++id; } }
void AudioKaraoke::AddMenuItem(wxMenu &menu, std::string const& tag, wxString const& help, std::string const& selected) { wxMenuItem *item = menu.AppendCheckItem(-1, to_wx(tag), help); menu.Bind(wxEVT_COMMAND_MENU_SELECTED, std::bind(&AudioKaraoke::SetTagType, this, tag), item->GetId()); item->Check(tag == selected); }
void hdDrawingView::createViewMenu(wxMenu &mnu) { wxMenuItem *item; item = mnu.AppendCheckItem(1000, _("Sample Item")); item->Check(true); }
//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); }