void DlgSettingsMain::CreateSettingsTree() { CRect rect; CWindow wndPlaceholder(GetDlgItem(IDC_CHILD_PLACEHOLDER)); wndPlaceholder.GetWindowRect(&rect); ScreenToClient(&rect); // create console settings dialog std::shared_ptr<DlgSettingsBase> dlgConsole(new DlgSettingsConsole(m_pSettingsRoot)); AddDialogToTree(L"Console", dlgConsole, rect); // create appearance settings dialog std::shared_ptr<DlgSettingsBase> dlgAppearance(new DlgSettingsAppearance(m_pSettingsRoot)); HTREEITEM htiAppearance = AddDialogToTree(L"Appearance", dlgAppearance, rect); // create styles settings dialog std::shared_ptr<DlgSettingsBase> dlgStyles(new DlgSettingsStyles(m_pSettingsRoot)); AddDialogToTree(L"Styles", dlgStyles, rect, htiAppearance); // create styles settings dialog std::shared_ptr<DlgSettingsBase> dlgFont(new DlgSettingsFont(m_pSettingsRoot)); AddDialogToTree(L"Font", dlgFont, rect, htiAppearance); // create full screen settings dialog std::shared_ptr<DlgSettingsBase> dlgFullScreen(new DlgSettingsFullScreen(m_pSettingsRoot)); AddDialogToTree(L"Full screen", dlgFullScreen, rect, htiAppearance); // create behavior settings dialog std::shared_ptr<DlgSettingsBase> dlgBehavior(new DlgSettingsBehavior(m_pSettingsRoot)); HTREEITEM htiBehavior = AddDialogToTree(L"Behavior", dlgBehavior, rect); std::shared_ptr<DlgSettingsBase> dlgBehavior2(new DlgSettingsBehavior2(m_pSettingsRoot)); AddDialogToTree(L"More...", dlgBehavior2, rect, htiBehavior); // create hotkeys settings dialog std::shared_ptr<DlgSettingsBase> dlgHotKeys(new DlgSettingsHotkeys(m_pSettingsRoot)); HTREEITEM htiHotkeys = AddDialogToTree(L"Hotkeys", dlgHotKeys, rect); // create mouse commands settings dialog std::shared_ptr<DlgSettingsBase> dlgMouseCmds(new DlgSettingsMouse(m_pSettingsRoot)); AddDialogToTree(L"Mouse", dlgMouseCmds, rect, htiHotkeys); // create tabs settings dialog shared_ptr<DlgSettingsBase> dlgTabs(new DlgSettingsTabs(m_pSettingsRoot, dynamic_cast<DlgSettingsConsole*>(dlgConsole.get())->m_consoleSettings)); AddDialogToTree(L"Tabs", dlgTabs, rect); m_treeCtrl.Expand(htiAppearance); m_treeCtrl.Expand(htiBehavior); m_treeCtrl.Expand(htiHotkeys); m_treeCtrl.SelectItem(m_treeCtrl.GetRootItem()); }
void DlgSettingsMain::CreateSettingsTree() { CRect rect; CWindow wndPlaceholder(GetDlgItem(IDC_CHILD_PLACEHOLDER)); wndPlaceholder.GetWindowRect(&rect); ScreenToClient(&rect); // create console settings dialog DlgSettingsConsole *consoleSettings = new DlgSettingsConsole(m_pSettingsRoot); std::shared_ptr<DlgSettingsBase> dlgConsole(dynamic_cast<DlgSettingsBase*>(new DlgSettingsConsole(m_pSettingsRoot))); AddDialogToTree(IDS_SETTINGS_CONSOLE, dlgConsole, rect); // create appearance settings dialog std::shared_ptr<DlgSettingsBase> dlgAppearance(dynamic_cast<DlgSettingsBase*>(new DlgSettingsAppearance(m_pSettingsRoot))); HTREEITEM htiAppearance = AddDialogToTree(IDS_SETTINGS_APPEARANCE, dlgAppearance, rect); // create styles settings dialog std::shared_ptr<DlgSettingsBase> dlgStyles(dynamic_cast<DlgSettingsBase*>(new DlgSettingsStyles(m_pSettingsRoot))); AddDialogToTree(IDS_SETTINGS_MORE, dlgStyles, rect, htiAppearance); // create behavior settings dialog std::shared_ptr<DlgSettingsBase> dlgBehavior(dynamic_cast<DlgSettingsBase*>(new DlgSettingsBehavior(m_pSettingsRoot))); AddDialogToTree(IDS_SETTINGS_BEHAVIOR, dlgBehavior, rect); // create hotkeys settings dialog std::shared_ptr<DlgSettingsBase> dlgHotKeys(dynamic_cast<DlgSettingsBase*>(new DlgSettingsHotkeys(m_pSettingsRoot))); HTREEITEM htiHotkeys = AddDialogToTree(IDS_SETTINGS_HOTKEYS, dlgHotKeys, rect); // create mouse commands settings dialog std::shared_ptr<DlgSettingsBase> dlgMouseCmds(dynamic_cast<DlgSettingsBase*>(new DlgSettingsMouse(m_pSettingsRoot))); AddDialogToTree(IDS_SETTINGS_MOUSE, dlgMouseCmds, rect, htiHotkeys); // create tabs settings dialog std::shared_ptr<DlgSettingsBase> dlgTabs(dynamic_cast<DlgSettingsBase*>(new DlgSettingsTabs(m_pSettingsRoot, consoleSettings->m_consoleSettings))); AddDialogToTree(IDS_SETTINGS_TABS, dlgTabs, rect); m_treeCtrl.Expand(htiAppearance); m_treeCtrl.Expand(htiHotkeys); m_treeCtrl.SelectItem(m_treeCtrl.GetRootItem()); }