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());
}
Exemple #2
0
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());
}
Exemple #3
0
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPreInstance, LPSTR lpCmdLine, int nCmdShow) {
    HWND activeWindow;
    MSG msg;
	HACCEL hAccelTable = 0;
	wchar_t appName[256];
	HWND statusHandle;

	INITCOMMONCONTROLSEX commonCtrlEx;
	commonCtrlEx.dwSize = sizeof(commonCtrlEx);
	commonCtrlEx.dwICC = ICC_BAR_CLASSES;	//trackbar in this class
	::InitCommonControlsEx(&commonCtrlEx);

	//get App name from resource file
	::LoadString(hInstance, IDS_APP_NAME, appName, 256);

	Win::ControllerMain ctrlMain;
	Win::Window windowMain(hInstance, appName, 0, &ctrlMain);

	windowMain.setMenuName(MAKEINTRESOURCE(IDR_MAIN_MENU));
	windowMain.setSize(800, 650);
	windowMain.setWindowStyleEx(WS_EX_WINDOWEDGE);
	windowMain.create();

	ModelGL modelGL;

	//Register GL window class
	Win::ViewGL viewGL(hInstance, windowMain.getHandle(), L"MyGLWindow", 800, 500, CS_HREDRAW | CS_VREDRAW | CS_OWNDC,
		WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, 3, 1);
	Win::GLController controllerGL(&modelGL, &viewGL);
	Win::ConsoleView consoleView;

	//Create GL window and init OpenGL
	controllerGL.init();

	Win::ConsolePaneController consolePaneCtrl(&modelGL, &consoleView);

	Win::DialogWindow dlgConsole(hInstance, IDD_CONSOLE, windowMain.getHandle(), &consolePaneCtrl);
	dlgConsole.create();

	statusHandle = ::CreateWindowEx(0, STATUSCLASSNAME, 0, WS_CHILD | WS_VISIBLE | SBARS_SIZEGRIP,
		0, 0, 0, 0, windowMain.getHandle(), (HMENU)IDC_STATUSBAR, ::GetModuleHandle(0), 0);

	if(statusHandle) {
        ::SendMessage(statusHandle, SB_SETTEXT, 0, (LPARAM)L"Ready");
	}

	ctrlMain.setGLHandle(viewGL.getHandle());
	ctrlMain.setConsoleHandle(dlgConsole.getHandle());

	viewGL.show();
	dlgConsole.show();
	windowMain.show();

    while(::GetMessage(&msg, NULL, 0, 0) > 0) {
		activeWindow = ::GetActiveWindow();

		if(!::TranslateAccelerator(msg.hwnd, hAccelTable, &msg)) {
			TranslateMessage(&msg);
			DispatchMessage(&msg);
		}
    }

    return (int)msg.wParam;
}