移除 NIM 源码及主题依赖,加入 Win32、Direct2D、DirectWrite UI 静态库。迁移主页面、添加任务及外观设置,完善虚拟列表、统一窗口透明度和首次显示初始化。增加 Windows 7 API 回退与回归测试,在 AGENTS.md 记录后续控件体系和布局系统计划。
64 lines
2.0 KiB
C++
64 lines
2.0 KiB
C++
#pragma once
|
|
#include "ttui/window.h"
|
|
#include "ttui/virtual_list.h"
|
|
#include "download_engine.h"
|
|
#include "skin_settings.h"
|
|
#include <shellapi.h>
|
|
#include <memory>
|
|
#include <unordered_map>
|
|
class SettingsForm;
|
|
class AddTaskForm;
|
|
class DownloaderForm final : public ttui::Window {
|
|
public:
|
|
DownloaderForm();
|
|
~DownloaderForm() override;
|
|
static const std::wstring kClassName;
|
|
static constexpr UINT kTrayIconMessage=WM_APP+1;
|
|
static constexpr UINT kShowMainWindowMessage=WM_APP+2;
|
|
private:
|
|
struct TaskRow { TaskInfo info; double speed=0; };
|
|
void OnCreate() override;
|
|
void OnLayout() override;
|
|
void OnPaint(ttui::Canvas&) override;
|
|
void OnCommand(int) override;
|
|
std::optional<LRESULT> OnMessage(UINT,WPARAM,LPARAM) override;
|
|
void StopEngine();
|
|
void ShowAddTaskForm();
|
|
void PauseSelectedTask();
|
|
void StartSelectedTask();
|
|
void DeleteSelectedTask();
|
|
void HandleEngineEvent(const EngineEvent&);
|
|
void PrepareFileDrag(LPARAM);
|
|
int HitTestRow(const POINT&) const;
|
|
void ShowTaskMenu(LPARAM);
|
|
void OpenSelectedLocation();
|
|
void OpenSelectedFile();
|
|
int FindRowIndex(int64_t) const;
|
|
void UpdateSummary(const std::wstring& tip=L"");
|
|
void UpdateSelectedInfo();
|
|
void UpdateViewport();
|
|
void AddTrayIcon();
|
|
void RemoveTrayIcon();
|
|
void ShowTrayMenu();
|
|
void ShowSettingsForm();
|
|
void ApplySkinSettings();
|
|
void LoadSkinSettings();
|
|
void SaveSkinSettings();
|
|
NOTIFYICONDATAW tray_icon_{};
|
|
UINT taskbar_created_message_=0;
|
|
HWND scrollbar_=nullptr;
|
|
ttui::Rect list_rect_{};
|
|
ttui::VirtualList list_;
|
|
SkinSettings skin_;
|
|
std::unique_ptr<SettingsForm> settings_form_;
|
|
std::unique_ptr<AddTaskForm> add_task_form_;
|
|
std::wstring summary_, selected_text_;
|
|
std::vector<TaskRow> rows_;
|
|
std::unordered_map<int64_t,int> indices_;
|
|
std::unique_ptr<DownloadEngine> engine_;
|
|
bool engine_failed_=false;
|
|
bool drag_pending_=false;
|
|
POINT drag_origin_{};
|
|
std::wstring drag_path_;
|
|
};
|