diff options
| author | Pierre Ossman <ossman@cendio.se> | 2014-06-16 11:39:32 +0000 |
|---|---|---|
| committer | Pierre Ossman <ossman@cendio.se> | 2014-06-16 11:39:32 +0000 |
| commit | f58b1a91b37e5ad758b3d0a3d9be950e8feb5d0c (patch) | |
| tree | ca7ebd90423d4d9267da62703e282f79a9793131 /FL | |
| parent | 332dc1b7acfedbf80b71cc6f538a14f24d435df3 (diff) | |
Add ability to set custom icons for windows. STR #2816.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10197 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'FL')
| -rw-r--r-- | FL/Fl_Window.H | 30 | ||||
| -rw-r--r-- | FL/mac.H | 3 | ||||
| -rw-r--r-- | FL/win32.H | 3 | ||||
| -rw-r--r-- | FL/x.H | 2 |
4 files changed, 37 insertions, 1 deletions
diff --git a/FL/Fl_Window.H b/FL/Fl_Window.H index c26f474d2..92e76676f 100644 --- a/FL/Fl_Window.H +++ b/FL/Fl_Window.H @@ -22,6 +22,10 @@ #ifndef Fl_Window_H #define Fl_Window_H +#ifdef WIN32 +#include <windows.h> +#endif + #include "Fl_Group.H" #define FL_WINDOW 0xF0 ///< window type id all subclasses have type() >= this @@ -89,9 +93,19 @@ class FL_EXPORT Fl_Window : public Fl_Group { friend class Fl_X; Fl_X *i; // points at the system-specific stuff + struct icon_data { + const void *legacy_icon; + Fl_RGB_Image **icons; + int count; +#ifdef WIN32 + HICON big_icon; + HICON small_icon; +#endif + }; + const char* iconlabel_; char* xclass_; - const void* icon_; + struct icon_data *icon_; // size_range stuff: int minw, minh, maxw, maxh; int dw, dh, aspect; @@ -141,6 +155,8 @@ protected: */ int force_position() const { return ((flags() & FORCE_POSITION)?1:0); } + void free_icons(); + public: /** @@ -370,6 +386,18 @@ public: static const char *default_xclass(); const char* xclass() const; void xclass(const char* c); + + static void default_icon(const Fl_RGB_Image*); + static void default_icons(const Fl_RGB_Image*[], int); + void icon(const Fl_RGB_Image*); + void icons(const Fl_RGB_Image*[], int); + +#ifdef WIN32 + static void default_icons(HICON big_icon, HICON small_icon); + void icons(HICON big_icon, HICON small_icon); +#endif + + /* for legacy compatibility */ const void* icon() const; void icon(const void * ic); @@ -142,6 +142,9 @@ public: void collapse(void); WindowRef window_ref(void); void set_key_window(void); + // OS X doesn't have per window icons + static void set_default_icons(const Fl_RGB_Image*[], int) {}; + void set_icons() {}; int set_cursor(Fl_Cursor); int set_cursor(const Fl_RGB_Image*, int, int); static CGImageRef CGImage_from_window_rect(Fl_Window *win, int x, int y, int w, int h); diff --git a/FL/win32.H b/FL/win32.H index 3ecdad79e..8ae8c8c8d 100644 --- a/FL/win32.H +++ b/FL/win32.H @@ -85,6 +85,9 @@ public: void flush() {w->flush();} void set_minmax(LPMINMAXINFO minmax); void mapraise(); + static void set_default_icons(const Fl_RGB_Image*[], int); + static void set_default_icons(HICON, HICON); + void set_icons(); int set_cursor(Fl_Cursor); int set_cursor(const Fl_RGB_Image*, int, int); static Fl_X* make(Fl_Window*); @@ -150,6 +150,8 @@ public: static Fl_X* i(const Fl_Window* wi) {return wi->i;} void setwindow(Fl_Window* wi) {w=wi; wi->i=this;} void sendxjunk(); + static void set_default_icons(const Fl_RGB_Image*[], int); + void set_icons(); int set_cursor(Fl_Cursor); int set_cursor(const Fl_RGB_Image*, int, int); static void make_xid(Fl_Window*,XVisualInfo* =fl_visual, Colormap=fl_colormap); |
