void AddGUILayout() { String name; TopWindow dlg; dlg.Title(t_("New layout")); dlg.SetRect( GetWorkArea().CenterRect(300, 80) ); EditString s; Button ok, cancel; ok.SetLabel(t_("Add")); ok <<= dlg.Acceptor(IDOK); cancel <<= dlg.Rejector(IDCANCEL); cancel.SetLabel(t_("Cancel")); dlg.ToolWindow(); dlg.Add( s.HSizePosZ(8, 8).TopPosZ(8, 18) ); dlg.Add( ok.RightPosZ(80, 65).BottomPosZ(8, 25) ); dlg.Add( cancel.RightPosZ(8, 65).BottomPosZ(8, 25) ); if (dlg.Execute() == IDCANCEL) return; name = (~s).ToString(); if (name.IsEmpty()) name = t_("User Interface"); name = " " + name; SaveLayout(name); DeleteFile(ConfigFile("Layouts.bin")); StoreToFile(*this, ConfigFile("Layouts.bin")); LoadGUILayouts(); _GUILayouts <<= _GUILayouts.GetKey( _GUILayouts.GetCount() - 1 ); UpdateTools(); }
bool GuiPackageResolver(const String& error, const String& path, int line) { prompt: switch(Prompt(Ctrl::GetAppName(), CtrlImg::exclamation(), error + "&while parsing package " + DeQtf(path), "Edit \\& Retry", "Ignore", "Stop")) { case 0: if(!PromptYesNo("Ignoring will damage package. Everything past the " "point of error will be lost.&Do you want to continue ?")) goto prompt; return false; case 1: { TopWindow win; LineEdit edit; edit.Set(LoadFile(path)); edit.SetCursor(edit.GetPos(line)); win.Title(path); win.Add(edit.SizePos()); win.Run(); SaveFile(path, edit.Get()); } return true;; case -1: exit(1); } return false; }
void Action() { int rowind = GetCurrentRow(); uint64 bit = (int64)Get(2); if(bit == 0) { TopWindow tw; tw.Title("~~~~~"); Image img = Images::hat; ImageCtrl ic; ic.SetImage(img).SetRect(0, 0, img.GetWidth(), img.GetHeight()); tw.Add(ic); tw.SetRect(::GetMousePos().x - 20, GetMousePos().y - 20, img.GetWidth(), img.GetHeight()); tw.RunAppModal(); return; } bool on = ((Option*)GetList().GetCtrl(0))->Get() == 1; uint64 bits = GetWindowLong((HWND)hwnd, (rowind>3+sizeof(stylesbits)/sizeof(stylesbits[0])) ? GWL_EXSTYLE : GWL_STYLE); if(on) SetBit(bits, bit); else ClearBit(bits, bit); SetWindowLong((HWND)hwnd, (rowind > 3 + sizeof(stylesbits)/sizeof(stylesbits[0])) ? GWL_EXSTYLE : GWL_STYLE, (LONG)bits); RedrawWindow(GetDesktopWindow(), 0, 0, RDW_INVALIDATE|RDW_ALLCHILDREN|RDW_FRAME|RDW_ERASE); RedrawWindow((HWND)hwnd, 0, 0, RDW_INVALIDATE|RDW_ALLCHILDREN|RDW_FRAME|RDW_ERASE); }