Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
stenzek
GitHub Repository: stenzek/duckstation
Path: blob/master/src/installer/installer_ui.h
7197 views
1
// SPDX-FileCopyrightText: 2019-2025 Connor McLaughlin <[email protected]>
2
// SPDX-License-Identifier: CC-BY-NC-ND-4.0
3
4
#pragma once
5
6
#include "common/windows_headers.h"
7
8
#include <string>
9
10
class InstallerUI
11
{
12
public:
13
InstallerUI();
14
~InstallerUI();
15
16
bool Execute();
17
18
private:
19
enum : int
20
{
21
WINDOW_MARGIN = 20,
22
WINDOW_WIDTH = 500,
23
WINDOW_HEIGHT = 300,
24
25
LOGO_SIZE = 32,
26
HEADING_HEIGHT = 24,
27
INFO_TEXT_HEIGHT = 40,
28
EDIT_HEIGHT = 24,
29
BUTTON_WIDTH = 80,
30
BUTTON_HEIGHT = 28,
31
CHECKBOX_HEIGHT = 20,
32
CONTROL_SPACING = 10,
33
};
34
35
enum : int
36
{
37
IDC_DESTINATION_EDIT = 1001,
38
IDC_BROWSE_BUTTON = 1002,
39
IDC_START_MENU_CHECKBOX = 1003,
40
IDC_DESKTOP_CHECKBOX = 1004,
41
IDC_INSTALL_BUTTON = 1005,
42
IDC_CANCEL_BUTTON = 1006,
43
};
44
45
bool Create();
46
void Destroy();
47
48
void OnBrowseClicked();
49
void OnInstallClicked();
50
void OnCancelClicked();
51
void OnDestinationDirectoryChanged();
52
53
bool DoInstall(const std::string& destination_directory_utf8);
54
55
static LRESULT CALLBACK WndProcThunk(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam);
56
LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam);
57
58
int Scale(int value) const;
59
60
std::wstring GetDefaultInstallDirectory() const;
61
62
HWND m_window_hwnd = nullptr;
63
HWND m_logo_hwnd = nullptr;
64
HWND m_heading_hwnd = nullptr;
65
HWND m_info_text_hwnd = nullptr;
66
HWND m_destination_label_hwnd = nullptr;
67
HWND m_destination_edit_hwnd = nullptr;
68
HWND m_browse_button_hwnd = nullptr;
69
HWND m_start_menu_checkbox_hwnd = nullptr;
70
HWND m_desktop_checkbox_hwnd = nullptr;
71
HWND m_install_button_hwnd = nullptr;
72
HWND m_cancel_button_hwnd = nullptr;
73
74
HFONT m_font = nullptr;
75
HFONT m_heading_font = nullptr;
76
HICON m_logo_icon = nullptr;
77
HBRUSH m_background_brush = nullptr;
78
UINT m_dpi = 96;
79
80
bool m_running = false;
81
};
82
83