Path: blob/master/src/updater/win32_progress_callback.h
7437 views
// SPDX-FileCopyrightText: 2019-2025 Connor McLaughlin <[email protected]>1// SPDX-License-Identifier: CC-BY-NC-ND-4.023#pragma once45#include "updater_progress_callback.h"67#include "common/windows_headers.h"89class Win32ProgressCallback final : public UpdaterProgressCallback10{11public:12Win32ProgressCallback(HWND parent_hwnd = nullptr);13~Win32ProgressCallback() override;1415void PushState() override;16void PopState() override;1718void SetCancellable(bool cancellable) override;19void SetTitle(const std::string_view title) override;20void SetStatusText(const std::string_view text) override;21void SetProgressRange(u32 range) override;22void SetProgressValue(u32 value) override;2324void DisplayError(const std::string_view message) override;25void DisplayWarning(const std::string_view message) override;26void DisplayInformation(const std::string_view message) override;27void DisplayDebugMessage(const std::string_view message) override;2829void ModalError(const std::string_view message) override;30bool ModalConfirmation(const std::string_view message) override;31void ModalInformation(const std::string_view message) override;3233private:34enum : int35{36WINDOW_MARGIN = 10,37STATUS_TEXT_HEIGHT = 16,38PROGRESS_BAR_HEIGHT = 20,39LIST_BOX_HEIGHT = 170,40CONTROL_SPACING = 10,41WINDOW_WIDTH = 600,42WINDOW_HEIGHT = WINDOW_MARGIN * 2 + STATUS_TEXT_HEIGHT + CONTROL_SPACING + PROGRESS_BAR_HEIGHT + CONTROL_SPACING +43LIST_BOX_HEIGHT,44};4546bool Create();47void Destroy();48void Redraw(bool force);49void PumpMessages();5051static LRESULT CALLBACK WndProcThunk(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam);52LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam);5354int Scale(int value) const;5556HWND m_parent_hwnd = nullptr;57HWND m_window_hwnd = nullptr;58HWND m_text_hwnd = nullptr;59HWND m_progress_hwnd = nullptr;60HWND m_list_box_hwnd = nullptr;6162HFONT m_font = nullptr;63UINT m_dpi = 96;6465int m_last_progress_percent = -1;66};676869