Add Windows app icon resource & load it
Add Windows resource files and load the app icon in the window class. Introduce resources/nebula.rc and resources/resource.h (defines IDI_APPICON referencing assets/images/branding/Nebula-Favicon.ico). Include resource.h in nebula_window_win.cpp and set window_class.hIcon/hIconSm via LoadImageW. Update CMakeLists.txt to compile the .rc and add the resources include directory for Windows.
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
#include <algorithm>
|
||||
#include <string_view>
|
||||
|
||||
#include "resource.h"
|
||||
#include "ui/paths.h"
|
||||
|
||||
namespace nebula::window {
|
||||
@@ -426,6 +427,20 @@ void nebula::window::NebulaWindowImpl::RegisterClass(HINSTANCE instance_handle)
|
||||
window_class.lpfnWndProc = StaticWndProc;
|
||||
window_class.hInstance = instance_handle;
|
||||
window_class.hCursor = LoadCursor(nullptr, IDC_ARROW);
|
||||
window_class.hIcon = static_cast<HICON>(LoadImageW(
|
||||
instance_handle,
|
||||
MAKEINTRESOURCEW(IDI_APPICON),
|
||||
IMAGE_ICON,
|
||||
GetSystemMetrics(SM_CXICON),
|
||||
GetSystemMetrics(SM_CYICON),
|
||||
LR_DEFAULTCOLOR));
|
||||
window_class.hIconSm = static_cast<HICON>(LoadImageW(
|
||||
instance_handle,
|
||||
MAKEINTRESOURCEW(IDI_APPICON),
|
||||
IMAGE_ICON,
|
||||
GetSystemMetrics(SM_CXSMICON),
|
||||
GetSystemMetrics(SM_CYSMICON),
|
||||
LR_DEFAULTCOLOR));
|
||||
window_class.lpszClassName = WindowClassName();
|
||||
|
||||
RegisterClassExW(&window_class);
|
||||
|
||||
Reference in New Issue
Block a user