BOOL PresetHotkeyGroup::OnInitDialog() { CDialogEx::OnInitDialog(); const CPoint buttonSize = CPoint(200, 20); hotkeyButton.reset(new HotkeyButton(key, caption)); hotkeyButton->Create(caption, WS_VISIBLE | WS_CHILD, CRect(CPoint(), buttonSize), this, 0); CRect buttonRect; hotkeyButton->GetWindowRect(buttonRect); hotkeyButton->OnClick = [&] { Global::ts3Functions.requestHotkeyInputDialog(Global::pluginID, key, 0, qParentWidget); hotkeyButton->UpdateCaption(); }; hotkeyButton->UpdateCaption(); this->ScreenToClient(buttonRect); CPoint editOffset(buttonRect.right + 20, buttonRect.top); const CPoint editSize = CPoint(300, 20); pathEdit.Create(WS_VISIBLE | WS_CHILD, CRect(editOffset, editOffset + editSize), this, 0); pathEdit.EnableWindow(FALSE); pathEdit.SetWindowText(Global::config.Get(CString(key), L"")); CRect editRect; pathEdit.GetWindowRect(editRect); this->ScreenToClient(editRect); CPoint buttonOffset(editRect.right + 20, editRect.top); const CPoint browseButtonSize = CPoint(100, 20); browseButton.Create(L"Browse", WS_VISIBLE | WS_CHILD, CRect(buttonOffset, buttonOffset + browseButtonSize), this, 0); browseButton.OnClick = [=] { CFileDialog dialog(TRUE); if (IDOK == dialog.DoModal()) { CString path = dialog.GetPathName(); Global::config.Add(CString(key), path); Global::config.Save(); pathEdit.SetWindowText(Global::config.Get(CString(key), L"")); } }; ResizeToContent(); return 0; }
int CzUIWrapPanel::LoadFromXoml(IzXomlResource* parent, bool load_children, CzXmlNode* node) { if (parent->getClassTypeHash() != CzHashes::Scene_Hash && parent->getClassTypeHash() != CzHashes::Actor_Hash) { CzDebug::Log(CZ_DEBUG_CHANNEL_ERROR, "WrapPanel - Needs to be declared inside a scene or an actor - ", DebugInfo.c_str()); return 0; } // Load main actor attributes int ret = CzUIBase::LoadFromXoml(parent, false, node); if (ret <= 0) return ret; // Process StackPanel specific attributes for (CzXmlNode::_AttribIterator it = node->attribs_begin(); it != node->attribs_end(); it++) { unsigned int name_hash = (*it)->getName().getHash(); if (name_hash == CzHashes::Orientation_Hash) { unsigned int hash = (*it)->getValue().getHash(); if (hash == CzHashes::Vertical_Hash) Orientation = Orientation_Vertical; } } // Process inner tags if (load_children) { if (!CZ_XOML->Process(this, node)) return 0; } ResizeToContent(); return 1; }