mirror of https://github.com/fltk/fltk
rename method
This commit is contained in:
parent
2ae692cc1f
commit
345e304bff
|
@ -343,6 +343,7 @@ public:
|
|||
|
||||
static void default_icon(const Fl_RGB_Image*);
|
||||
static void default_icons(const Fl_RGB_Image*[], int);
|
||||
static void use_default_icon();
|
||||
void icon(const Fl_RGB_Image*);
|
||||
void icons(const Fl_RGB_Image*[], int);
|
||||
|
||||
|
@ -351,7 +352,6 @@ public:
|
|||
// These 2 member functions break the driver model but are kept for back compatibility.
|
||||
// They are implemented in Fl_win32.cxx
|
||||
static void default_icons(HICON big_icon, HICON small_icon);
|
||||
static void default_icons();
|
||||
void icons(HICON big_icon, HICON small_icon);
|
||||
#endif
|
||||
|
||||
|
|
|
@ -322,6 +322,44 @@ void Fl_Window::default_icons(const Fl_RGB_Image *icons[], int count) {
|
|||
Fl::screen_driver()->default_icons(icons, count);
|
||||
}
|
||||
|
||||
/** Use default icons associated to the executable.
|
||||
|
||||
Right now only for Windows where it picks the default icon from the
|
||||
exe's resources.
|
||||
|
||||
To do: pick default icon from inside a .app bundle on macOS.
|
||||
*/
|
||||
void Fl_Window::use_default_icon() {
|
||||
#ifdef _WIN32
|
||||
HICON *pbig, *psmall, big_icons[1], small_icons[1];
|
||||
wchar_t path[FL_PATH_MAX];
|
||||
|
||||
big_icons[0] = NULL;
|
||||
small_icons[0] = NULL;
|
||||
pbig = big_icons;
|
||||
psmall = small_icons;
|
||||
|
||||
if (default_big_icon != NULL)
|
||||
DestroyIcon(default_big_icon);
|
||||
if (default_small_icon != NULL)
|
||||
DestroyIcon(default_small_icon);
|
||||
|
||||
// use exe's/module's icon resource to set window default icons
|
||||
if (GetModuleFileNameW(NULL, path, FL_PATH_MAX) == 0)
|
||||
return;
|
||||
if (ExtractIconExW(path, 0, pbig, psmall, 1) == 0)
|
||||
return;
|
||||
|
||||
default_big_icon = NULL;
|
||||
default_small_icon = NULL;
|
||||
|
||||
if (big_icons[0] != NULL)
|
||||
default_big_icon = big_icons[0];
|
||||
if (small_icons[0] != NULL)
|
||||
default_small_icon = small_icons[0];
|
||||
#endif
|
||||
}
|
||||
|
||||
/** Sets or resets a single window icon.
|
||||
|
||||
A window icon \e can be changed while the window is shown, but this
|
||||
|
|
|
@ -2430,35 +2430,6 @@ void Fl_Window::default_icons(HICON big_icon, HICON small_icon) {
|
|||
default_small_icon = CopyIcon(small_icon);
|
||||
}
|
||||
|
||||
void Fl_Window::default_icons() {
|
||||
HICON *pbig, *psmall, big_icons[1], small_icons[1];
|
||||
wchar_t path[FL_PATH_MAX];
|
||||
|
||||
big_icons[0] = NULL;
|
||||
small_icons[0] = NULL;
|
||||
pbig = big_icons;
|
||||
psmall = small_icons;
|
||||
|
||||
if (default_big_icon != NULL)
|
||||
DestroyIcon(default_big_icon);
|
||||
if (default_small_icon != NULL)
|
||||
DestroyIcon(default_small_icon);
|
||||
|
||||
// use exe's/module's icon resource to set window default icons
|
||||
if (GetModuleFileNameW(NULL, path, FL_PATH_MAX) == 0)
|
||||
return;
|
||||
if (ExtractIconExW(path, 0, pbig, psmall, 1) == 0)
|
||||
return;
|
||||
|
||||
default_big_icon = NULL;
|
||||
default_small_icon = NULL;
|
||||
|
||||
if (big_icons[0] != NULL)
|
||||
default_big_icon = big_icons[0];
|
||||
if (small_icons[0] != NULL)
|
||||
default_small_icon = small_icons[0];
|
||||
}
|
||||
|
||||
void Fl_WinAPI_Window_Driver::set_icons() {
|
||||
HICON big_icon, small_icon;
|
||||
|
||||
|
|
|
@ -704,7 +704,7 @@ Sudoku::Sudoku()
|
|||
|
||||
// Set icon for window
|
||||
#ifdef _WIN32
|
||||
Fl_Window::default_icons();
|
||||
Fl_Window::use_default_icon();
|
||||
#else
|
||||
Fl_Bitmap bm(sudoku_bits, sudoku_width, sudoku_height);
|
||||
Fl_Image_Surface surf(sudoku_width, sudoku_height, 1);
|
||||
|
|
Loading…
Reference in New Issue