void DockCont::WindowMenu() { MenuBar bar; DockContMenu menu(base); menu.ContainerMenu(bar, this, true); bar.Execute(); }
virtual void RightDown(Point p, dword keyflags) { int result = Null; MenuBar menu; for(int i = 0; i < 10; i++) menu.Add(AsString(i), [=, &result] { result = i; }); menu.Execute(); if(IsNull(result)) PromptOK("Menu was cancelled"); else PromptOK("You have selected " + AsString((int)result)); }
void Ide::FindStdDir() { String n = GetFileFolder(editfile); MenuBar menu; if(!IsNull(n)) menu.Add(n, THISBACK1(FindSetStdDir, n)); Vector<String> d = GetUppDirs(); for(int i = 0; i < d.GetCount(); i++) menu.Add(d[i], THISBACK1(FindSetStdDir, d[i])); menu.Execute(&ff.folder, ff.folder.GetPushScreenRect().BottomLeft()); }
void RightDown(Point, dword) { CallbackArgTarget<int> result; MenuBar menu; for(int i = 0; i < 10; i++) menu.Add(AsString(i), result[i]); menu.Separator(); menu.Add("Exit", THISBACK(Exit)); menu.Execute(); if(!IsNull(result)) PromptOK("You have selected " + AsString((int)result)); }
void RichEdit::RightDown(Point p, dword flags) { useraction = true; NextUndo(); MenuBar menu; int l, h; Rect ocr = GetCaretRect(); int fieldpos = -1; Id field; String ofieldparam; RichObject o; bar_object.Clear(); bar_fieldparam = Null; if(!GetSelection(l, h)) { LeftDown(p, flags); if(objectpos >= 0) o = bar_object = GetObject(); else { RichPos p = cursorp; field = p.field; bar_fieldparam = p.fieldparam; RichPara::FieldType *ft = RichPara::fieldtype().Get(field, NULL); if(ft) { ofieldparam = bar_fieldparam; fieldpos = cursor; } } } WhenBar(menu); Rect r = GetCaretRect(); Refresh(r); Refresh(ocr); paintcarect = true; menu.Execute(); paintcarect = false; Refresh(r); if(bar_object && o && o.GetSerialId() != bar_object.GetSerialId()) ReplaceObject(bar_object); if(fieldpos >= 0 && bar_fieldparam != ofieldparam) { RichText::FormatInfo f = text.GetFormatInfo(fieldpos, 1); Remove(fieldpos, 1); RichPara p; p.Cat(field, bar_fieldparam, f); RichText clip; clip.Cat(p); Insert(fieldpos, clip, false); Finish(); } bar_object.Clear(); bar_fieldparam = Null; }
void DockCont::TabContext(int ix) { MenuBar bar; DockContMenu menu(base); DockMenu tabmenu(base); Value v = tabbar.Get(ix); if (IsDockCont(v)) menu.ContainerMenu(bar, ContCast(v), false); else tabmenu.WindowMenuNoClose(bar, DockCast(v)); bar.Separator(); tabbar.ContextMenu(bar); bar.Execute(); }
void RichTextView::RightDown(Point p, dword keyflags) { MenuBar b; b.Add(CtrlImg::copy(), t_("Copy"), THISBACK(Copy)).Key(K_CTRL_C); b.Execute(); }
void MenuBar::Execute(Ctrl *owner, Event<Bar&> proc, Point p) { MenuBar bar; proc(bar); bar.Execute(owner, p); }
void MenuBug::RightDown(Point pt, dword keyflags) { MenuBar menu; menu.Add("Pokus", Callback()); menu.Execute(pt + GetScreenView().TopLeft()); }