void FormEdit::ViewBar(Bar& bar) { bar.Add(t_("Switch to as-is view..."), FormViewImg::ViewModeAsIs(), THISBACK1(SetViewMode, VIEW_MODE_AS_IS)) .Check(_ViewMode == VIEW_MODE_AS_IS).Enable(_View.IsLayout()) .Tip(t_("Switch to as-is view...")); bar.Add(t_("Switch to detailed view..."), FormViewImg::ViewModeInfo(), THISBACK1(SetViewMode, VIEW_MODE_INFO)) .Check(_ViewMode == VIEW_MODE_INFO).Enable(_View.IsLayout()) .Tip(t_("Switch to detailed view...")); bar.Add(t_("Switch to solid view..."), FormViewImg::ViewModeWireframe(), THISBACK1(SetViewMode, VIEW_MODE_WIREFRAME)) .Check(_ViewMode == VIEW_MODE_WIREFRAME).Enable(_View.IsLayout()) .Tip(t_("Switch to solid view...")); bar.Add(t_("Bind to grid..."), FormViewImg::GridBinding(), THISBACK2(ToggleFlag, "Grid.Binding", false)) .Check(GetFlag("Grid.Binding", false)).Enable(_View.IsLayout()) .Tip(t_("Bind to grid...")); bar.Add(t_("Coloring of the objects..."), FormEditImg::Coloring(), THISBACK(ToggleColoring)) .Check(GetFlag("View.Coloring", true)).Enable(_View.IsLayout()) .Tip(t_("Coloring of the objects...")); bar.Separator(); bar.Add(t_("Use system font..."), FormEditImg::FontZoom(), THISBACK(StdFontZoom)).Check(IsStandardZoom()) .Enable(_View.IsLayout()) .Tip(t_("Use system font...")); bar.Add(t_("Use larger font..."), FormEditImg::FontZoomStd(), THISBACK(SmallFontZoom)).Check(IsSmallZoom()) .Enable(_View.IsLayout()) .Tip(t_("Use larger font...")); bar.Add(t_("Use largest font..."), FormEditImg::FontZoomLarge(), THISBACK(LargeFontZoom)).Check(IsLargeZoom()) .Enable(_View.IsLayout()) .Tip(t_("Use largest font...")); }
void FormView::AddObjectMenu(Bar& bar, Point p) { bar.Add(t_("Button"), THISBACK2(CreateObject, p, "Button")); bar.Add(t_("EditField"), THISBACK2(CreateObject, p, "EditField")); bar.Add(t_("EditInt"), THISBACK2(CreateObject, p, "EditInt")); bar.Add(t_("DropDate"), THISBACK2(CreateObject, p, "DropDate")); bar.Separator(); bar.Add(t_("ProgressBar"), THISBACK2(CreateObject, p, "ProgressBar")); bar.Add(t_("Label"), THISBACK2(CreateObject, p, "Label")); bar.Separator(); bar.Add(t_("TabCtrl"), THISBACK2(CreateObject, p, "TabCtrl")); bar.Add(t_("GridCtrl"), THISBACK2(CreateObject, p, "GridCtrl")); bar.Separator(); bar.Add(t_("Form"), THISBACK2(CreateObject, p, "Form")); }
AutoHideBar::AutoHideBar() { ctrl = NULL; AutoHideMin(0).InactiveDisabled().AllowNullCursor().MinTabCount(0); popup.WhenEnter = THISBACK2(MouseEnter, Point(0, 0), 0); popup.WhenLeave = THISBACK(MouseLeave); DockTabBar::WhenHighlight = THISBACK(TabHighlight); WhenClose = THISBACK(TabClose); WhenDrag = THISBACK(TabDrag); }
void LRUList::operator()(Bar& bar, Callback1<const String&> WhenSelect) { if(bar.IsMenuBar() && !lru.IsEmpty()) { bar.Separator(); char n = '1'; for(int i = 0; i < lru.GetCount(); i++) { bar.Add(String("&") + n + ' ' + GetFileName(lru[i]), THISBACK2(Select, lru[i], WhenSelect)); n = n == '9' ? 'A' : n + 1; } } }
bool ClientHandler::OnProcessMessageReceived(CefRefPtr<CefBrowser> browser, CefProcessId source_process, CefRefPtr<CefProcessMessage> message) { if (message->GetName().ToString() == "show_keyboard"){ PostCallback(callback1(WhenKeyboard, true)); }else if (message->GetName().ToString() == "hide_keyboard"){ PostCallback(callback1(WhenKeyboard, false)); }else{ CefRefPtr<CefListValue> args = message->GetArgumentList(); Upp::Vector<Upp::Value> * par = new Upp::Vector<Upp::Value>; for (unsigned i = 0; i < args->GetSize(); i++){ CefValueType type = args->GetType(i); switch(type){ case VTYPE_BOOL: par->Add(args->GetBool(i)); break; case VTYPE_DOUBLE: par->Add(args->GetDouble(i)); break; case VTYPE_INT: par->Add(args->GetInt(i)); break; case VTYPE_STRING: par->Add(args->GetString(i).ToString().c_str()); break; default: par->Add("OnProcessMessageReceived: unsupported parameter type"); break; } } PostCallback(THISBACK2(WhenMessageWrapper, message->GetName().ToString(), par)); } return true; }
AutoHideBar::AutoHideBar() { internalname = "autohidebar"; ctrl = NULL; SetStyle(DockCtrlChStyle::StyleDefault()); HasScrollBar(false); HasButtons(false); HasIcons(true); Draggable(false); SetSize(0); childcount = 0; TabInterface::WhenHighlight = THISBACK(OnHighlight); TabInterface::WhenClose = THISBACK(OnClose); popup.WhenEnter = THISBACK2(MouseEnter, Point(0, 0), 0); popup.WhenLeave = THISBACK(MouseLeave); }
void FormEdit::CreateToolBar(Bar& bar) { Vector<int> sel = _View.GetSelected(); int count = _View.IsLayout() ? _View.GetObjects()->GetCount() : 0; dword first; bool align = true; bool valign = true; if (sel.GetCount() == 0) { count = 0; } else if (sel.GetCount() == 1) { _View.SetHAlign( (*_View.GetObjects())[ sel[0] ].GetHAlign() ); _View.SetVAlign( (*_View.GetObjects())[ sel[0] ].GetVAlign() ); } else { for (int i = 0; i < sel.GetCount(); ++i) { if (i == 0) first = (*_View.GetObjects())[ sel[i] ].GetHAlign(); if (first != (*_View.GetObjects())[ sel[i] ].GetHAlign()) { align = false; break; } } for (int i = 0; i < sel.GetCount(); ++i) { if (i == 0) first = (*_View.GetObjects())[ sel[i] ].GetVAlign(); if (first != (*_View.GetObjects())[ sel[i] ].GetVAlign()) { valign = false; break; } } } bar.Add(FormEditImg::New(), THISBACK(NewFile)).Tip(t_("Create new form...")); bar.Add(FormEditImg::Open(), THISBACK(OpenFile)).Tip(t_("Open form...")); bar.Add(FormEditImg::Save(), THISBACK(SaveFile)).Enable(!IsProjectSaved() && _View.IsLayout()) .Tip(t_("Save changes to file...")); bar.Add(FormEditImg::SaveAs(), THISBACK(SaveAsFile)).Enable(_View.IsLayout()) .Tip(t_("Save form to another file...")); bar.Separator(); bar.Add(FormViewImg::ViewModeAsIs(), THISBACK1(SetViewMode, VIEW_MODE_AS_IS)) .Check(_ViewMode == VIEW_MODE_AS_IS).Enable(_View.IsLayout()) .Tip(t_("Switch to as-is view...")); bar.Add(FormViewImg::ViewModeInfo(), THISBACK1(SetViewMode, VIEW_MODE_INFO)) .Check(_ViewMode == VIEW_MODE_INFO).Enable(_View.IsLayout()) .Tip(t_("Switch to detailed view...")); bar.Add(FormViewImg::ViewModeWireframe(), THISBACK1(SetViewMode, VIEW_MODE_WIREFRAME)) .Check(_ViewMode == VIEW_MODE_WIREFRAME).Enable(_View.IsLayout()) .Tip(t_("Switch to solid view...")); bar.Add(FormViewImg::GridBinding(), THISBACK2(ToggleFlag, "Grid.Binding", false)) .Check(GetFlag("Grid.Binding", false)).Enable(_View.IsLayout()) .Tip(t_("Bind to grid...")); bar.Add(FormEditImg::Coloring(), THISBACK(ToggleColoring)) .Check(GetFlag("View.Coloring", true)).Enable(_View.IsLayout()) .Tip(t_("Coloring of the objects...")); bar.Separator(); bar.Add(FormViewImg::LayoutProperties(), THISBACK(OpenLayoutProperties)) .Enable(_View.IsLayout()) .Tip(t_("Change form settings...")); bar.Add(FormViewImg::Layout(), THISBACK(TestLayout)) .Enable(_View.IsLayout()) .Tip(t_("Preview")); bar.Separator(); bar.Add(FormEditImg::FontZoom(), THISBACK(StdFontZoom)).Check(IsStandardZoom()) .Enable(_View.IsLayout()) .Tip(t_("Use system font...")); bar.Add(FormEditImg::FontZoomStd(), THISBACK(SmallFontZoom)).Check(IsSmallZoom()) .Enable(_View.IsLayout()) .Tip(t_("Use larger font...")); bar.Add(FormEditImg::FontZoomLarge(), THISBACK(LargeFontZoom)).Check(IsLargeZoom()) .Enable(_View.IsLayout()) .Tip(t_("Use largest font...")); bar.Separator(); bar.AddTool(_GUILayouts, _ToolSize); _GUILayouts.Enable(_GUILayouts.GetCount()); _GUILayouts.GetButton(2).Enable(_GUILayouts.GetCount() > 1 && (~_GUILayouts).ToString() != t_(" Default")); _GUILayouts.GetButton(3).Enable(_GUILayouts.GetCount()); bar.ToolBreak(); bar.Add(FormViewImg::SpringLeft(), THISBACK2(SetSprings, Ctrl::LEFT, -1)) .Check(_View.GetHAlign() == Ctrl::LEFT && align).Enable(count) .Tip(t_("Spring left side")); bar.Add(FormViewImg::SpringRight(), THISBACK2(SetSprings, Ctrl::RIGHT, -1)) .Check(_View.GetHAlign() == Ctrl::RIGHT && align).Enable(count) .Tip(t_("Spring right side")); bar.Add(FormViewImg::SpringHSize(), THISBACK2(SetSprings, Ctrl::SIZE, -1)) .Check(_View.GetHAlign() == Ctrl::SIZE && align).Enable(count) .Tip(t_("Spring both horizontal sides")); bar.Add(FormViewImg::SpringHCenter(), THISBACK2(SetSprings, Ctrl::CENTER, -1)) .Check(_View.GetHAlign() == Ctrl::CENTER && align).Enable(count) .Tip(t_("Horizontal center")); bar.Separator(); bar.Add(FormViewImg::SpringTop(), THISBACK2(SetSprings, -1, Ctrl::TOP)) .Check(_View.GetVAlign() == Ctrl::TOP && valign).Enable(count) .Tip(t_("Spring top side")); bar.Add(FormViewImg::SpringBottom(), THISBACK2(SetSprings, -1, Ctrl::BOTTOM)) .Check(_View.GetVAlign() == Ctrl::BOTTOM && valign).Enable(count) .Tip(t_("Spring bottom side")); bar.Add(FormViewImg::SpringVSize(), THISBACK2(SetSprings, -1, Ctrl::SIZE)) .Check(_View.GetVAlign() == Ctrl::SIZE && valign).Enable(count) .Tip(t_("Spring both vertical sides")); bar.Add(FormViewImg::SpringVCenter(), THISBACK2(SetSprings, -1, Ctrl::CENTER)) .Check(_View.GetVAlign() == Ctrl::CENTER && valign).Enable(count) .Tip(t_("Vertical center")); bar.Separator(); bar.Add(FormViewImg::SpringTopLeft(), THISBACK2(SetSprings, Ctrl::LEFT, Ctrl::TOP)) .Enable(count) .Check(_View.GetHAlign() == Ctrl::LEFT && _View.GetVAlign() == Ctrl::TOP && align && valign) .Tip(t_("Spring left-top corner")); bar.Add(FormViewImg::SpringBottomLeft(), THISBACK2(SetSprings, Ctrl::LEFT, Ctrl::BOTTOM)) .Enable(count) .Check(_View.GetHAlign() == Ctrl::LEFT && _View.GetVAlign() == Ctrl::BOTTOM && align && valign) .Tip(t_("Spring left-bottom corner")); bar.Add(FormViewImg::SpringBottomRight(), THISBACK2(SetSprings, Ctrl::RIGHT, Ctrl::BOTTOM)) .Enable(count) .Check(_View.GetHAlign() == Ctrl::RIGHT && _View.GetVAlign() == Ctrl::BOTTOM && align && valign) .Tip(t_("Spring right-bottom corner")); bar.Add(FormViewImg::SpringTopRight(), THISBACK2(SetSprings, Ctrl::RIGHT, Ctrl::TOP)) .Enable(count) .Check(_View.GetHAlign() == Ctrl::RIGHT && _View.GetVAlign() == Ctrl::TOP && align && valign) .Tip(t_("Spring right-top corner")); bar.Separator(); bar.Add(FormViewImg::SpringAuto(), THISBACK2(SetSprings, Ctrl::SIZE, Ctrl::SIZE)) .Enable(count) .Check(_View.GetHAlign() == Ctrl::SIZE && _View.GetVAlign() == Ctrl::SIZE && align && valign) .Tip(t_("Spring all sides")); bar.Add(FormViewImg::SpringSize(), THISBACK2(SetSprings, Ctrl::CENTER, Ctrl::CENTER)) .Enable(count) .Check(_View.GetHAlign() == Ctrl::CENTER && _View.GetVAlign() == Ctrl::CENTER && align && valign) .Tip(t_("Center object")); }
void FormEdit::ItemBar(Bar& bar) { Vector<int> sel = _View.GetSelected(); int count = _View.IsLayout() ? _View.GetObjects()->GetCount() : 0; dword first; bool align = true; bool valign = true; if (sel.GetCount() == 0) { count = 0; } else if (sel.GetCount() == 1) { _View.SetHAlign( (*_View.GetObjects())[ sel[0] ].GetHAlign() ); _View.SetVAlign( (*_View.GetObjects())[ sel[0] ].GetVAlign() ); } else { for (int i = 0; i < sel.GetCount(); ++i) { if (i == 0) first = (*_View.GetObjects())[ sel[i] ].GetHAlign(); if (first != (*_View.GetObjects())[ sel[i] ].GetHAlign()) { align = false; break; } } for (int i = 0; i < sel.GetCount(); ++i) { if (i == 0) first = (*_View.GetObjects())[ sel[i] ].GetVAlign(); if (first != (*_View.GetObjects())[ sel[i] ].GetVAlign()) { valign = false; break; } } } bar.Add(t_("Add object..."), THISBACK(CreateBar)); bar.Separator(); if (sel.GetCount() == 1) _View.CreateObjectMenu(bar, sel[0]); if (sel.GetCount()) { bar.Add(t_("Align selected"), THISBACK(AlignBar)); bar.Separator(); } bar.Add(t_("Spring left side"), FormViewImg::SpringLeft(), THISBACK2(SetSprings, Ctrl::LEFT, -1)) .Check(_View.GetHAlign() == Ctrl::LEFT && align).Enable(count) .Tip(t_("Spring left side")); bar.Add(t_("Spring right side"), FormViewImg::SpringRight(), THISBACK2(SetSprings, Ctrl::RIGHT, -1)) .Check(_View.GetHAlign() == Ctrl::RIGHT && align).Enable(count) .Tip(t_("Spring right side")); bar.Add(t_("Spring both horizontal sides"), FormViewImg::SpringHSize(), THISBACK2(SetSprings, Ctrl::SIZE, -1)) .Check(_View.GetHAlign() == Ctrl::SIZE && align).Enable(count) .Tip(t_("Spring both horizontal sides")); bar.Add(t_("Horizontal center"), FormViewImg::SpringHCenter(), THISBACK2(SetSprings, Ctrl::CENTER, -1)) .Check(_View.GetHAlign() == Ctrl::CENTER && align).Enable(count) .Tip(t_("Horizontal center")); bar.Separator(); bar.Add(t_("Spring top side"), FormViewImg::SpringTop(), THISBACK2(SetSprings, -1, Ctrl::TOP)) .Check(_View.GetVAlign() == Ctrl::TOP && valign).Enable(count) .Tip(t_("Spring top side")); bar.Add(t_("Spring bottom side"), FormViewImg::SpringBottom(), THISBACK2(SetSprings, -1, Ctrl::BOTTOM)) .Check(_View.GetVAlign() == Ctrl::BOTTOM && valign).Enable(count) .Tip(t_("Spring bottom side")); bar.Add(t_("Spring both vertical sides"), FormViewImg::SpringVSize(), THISBACK2(SetSprings, -1, Ctrl::SIZE)) .Check(_View.GetVAlign() == Ctrl::SIZE && valign).Enable(count) .Tip(t_("Spring both vertical sides")); bar.Add(t_("Vertical center"), FormViewImg::SpringVCenter(), THISBACK2(SetSprings, -1, Ctrl::CENTER)) .Check(_View.GetVAlign() == Ctrl::CENTER && valign).Enable(count) .Tip(t_("Vertical center")); bar.Separator(); bar.Add(t_("Spring left-top corner"), FormViewImg::SpringTopLeft(), THISBACK2(SetSprings, Ctrl::LEFT, Ctrl::TOP)) .Enable(count) .Check(_View.GetHAlign() == Ctrl::LEFT && _View.GetVAlign() == Ctrl::TOP && align && valign) .Tip(t_("Spring left-top corner")); bar.Add(t_("Spring left-bottom corner"), FormViewImg::SpringBottomLeft(), THISBACK2(SetSprings, Ctrl::LEFT, Ctrl::BOTTOM)) .Enable(count) .Check(_View.GetHAlign() == Ctrl::LEFT && _View.GetVAlign() == Ctrl::BOTTOM && align && valign) .Tip(t_("Spring left-bottom corner")); bar.Add(t_("Spring right-bottom corner"), FormViewImg::SpringBottomRight(), THISBACK2(SetSprings, Ctrl::RIGHT, Ctrl::BOTTOM)) .Enable(count) .Check(_View.GetHAlign() == Ctrl::RIGHT && _View.GetVAlign() == Ctrl::BOTTOM && align && valign) .Tip(t_("Spring right-bottom corner")); bar.Add(t_("Spring right-top corner"), FormViewImg::SpringTopRight(), THISBACK2(SetSprings, Ctrl::RIGHT, Ctrl::TOP)) .Enable(count) .Check(_View.GetHAlign() == Ctrl::RIGHT && _View.GetVAlign() == Ctrl::TOP && align && valign) .Tip(t_("Spring right-top corner")); bar.Separator(); bar.Add(t_("Spring all sides"), FormViewImg::SpringAuto(), THISBACK2(SetSprings, Ctrl::SIZE, Ctrl::SIZE)) .Enable(count) .Check(_View.GetHAlign() == Ctrl::SIZE && _View.GetVAlign() == Ctrl::SIZE && align && valign) .Tip(t_("Spring all sides")); bar.Add(t_("Center object"), FormViewImg::SpringSize(), THISBACK2(SetSprings, Ctrl::CENTER, Ctrl::CENTER)) .Enable(count) .Check(_View.GetHAlign() == Ctrl::CENTER && _View.GetVAlign() == Ctrl::CENTER && align && valign) .Tip(t_("Center object")); }