diff options
| author | Manolo Gouy <Manolo> | 2016-03-22 13:27:22 +0000 |
|---|---|---|
| committer | Manolo Gouy <Manolo> | 2016-03-22 13:27:22 +0000 |
| commit | 6302b3da00f8116e1bf62629c6d3ab0f719d1a33 (patch) | |
| tree | da164eb125131ccefcbcbd1010e70db09a3ae132 /src/drivers/WinAPI | |
| parent | b8e6c430e8bb1b4cec2f309f2835d7b81240749a (diff) | |
Move all icon-support data to the platform-specific Fl_XXX_Window_Driver class
because these data are platform-specific.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11399 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/drivers/WinAPI')
| -rw-r--r-- | src/drivers/WinAPI/Fl_WinAPI_Window_Driver.H | 17 | ||||
| -rw-r--r-- | src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx | 49 |
2 files changed, 51 insertions, 15 deletions
diff --git a/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.H b/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.H index d5abdd54e..051a86300 100644 --- a/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.H +++ b/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.H @@ -43,13 +43,6 @@ ? where do we handle the interface between OpenGL/DirectX and Cocoa/WIN32/Glx? */ -struct Fl_Window_Driver::icon_data { - const void *legacy_icon; - Fl_RGB_Image **icons; - int count; - HICON big_icon; - HICON small_icon; -}; struct Fl_Window_Driver::shape_data_type { int lw_; ///< width of shape image @@ -60,6 +53,14 @@ struct Fl_Window_Driver::shape_data_type { class FL_EXPORT Fl_WinAPI_Window_Driver : public Fl_Window_Driver { + friend class Fl_Window; + struct icon_data { + const void *legacy_icon; + Fl_RGB_Image **icons; + int count; + HICON big_icon; + HICON small_icon; + }; private: RECT border_width_title_bar_height(int &bx, int &by, int &bt); void shape_bitmap_(Fl_Image* b); @@ -68,6 +69,7 @@ public: Fl_WinAPI_Window_Driver(Fl_Window*); ~Fl_WinAPI_Window_Driver(); + struct icon_data *icon_; // --- window data virtual int decorated_w(); virtual int decorated_h(); @@ -84,7 +86,6 @@ public: virtual const void *icon() const; virtual void icon(const void * ic); virtual void free_icons(); - void icons(HICON big_icon, HICON small_icon); // this one is implemented in Fl_win32.cxx virtual void capture_titlebar_and_borders(Fl_Shared_Image*& top, Fl_Shared_Image*& left, Fl_Shared_Image*& bottom, Fl_Shared_Image*& right); virtual void wait_for_expose(); diff --git a/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx b/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx index a0a4e57c0..976fbd606 100644 --- a/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx +++ b/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx @@ -43,8 +43,8 @@ Fl_Window_Driver *Fl_Window_Driver::newWindowDriver(Fl_Window *w) Fl_WinAPI_Window_Driver::Fl_WinAPI_Window_Driver(Fl_Window *win) : Fl_Window_Driver(win) { - icon_ = new Fl_Window_Driver::icon_data; - memset(icon_, 0, sizeof(Fl_Window_Driver::icon_data)); + icon_ = new icon_data; + memset(icon_, 0, sizeof(icon_data)); } @@ -54,6 +54,7 @@ Fl_WinAPI_Window_Driver::~Fl_WinAPI_Window_Driver() delete shape_data_->todelete_; delete shape_data_; } + delete icon_; } @@ -358,19 +359,53 @@ void Fl_WinAPI_Window_Driver::free_icons() { icon_->small_icon = NULL; } -void Fl_WinAPI_Window_Driver::icons(HICON big_icon, HICON small_icon) + +/** Sets the window icons using Windows' native HICON icon handles. + + The given icons are copied. You can free the icons immediately after + this call. + + \param[in] big_icon large window icon + \param[in] small_icon small window icon + */ +void Fl_Window::icons(HICON big_icon, HICON small_icon) { free_icons(); if (big_icon != NULL) - icon_->big_icon = CopyIcon(big_icon); + ((Fl_WinAPI_Window_Driver*)pWindowDriver)->icon_->big_icon = CopyIcon(big_icon); if (small_icon != NULL) - icon_->small_icon = CopyIcon(small_icon); + ((Fl_WinAPI_Window_Driver*)pWindowDriver)->icon_->small_icon = CopyIcon(small_icon); - if (Fl_X::i(pWindow)) - Fl_X::i(pWindow)->set_icons(); + if (Fl_X::i(this)) + Fl_X::i(this)->set_icons(); } + +/** Sets the default window icons. + + Convenience function to set the default icons using Windows' + native HICON icon handles. + + The given icons are copied. You can free the icons immediately after + this call. + + \param[in] big_icon default large icon for all windows + subsequently created + \param[in] small_icon default small icon for all windows + subsequently created + + \see Fl_Window::default_icon(const Fl_RGB_Image *) + \see Fl_Window::default_icons(const Fl_RGB_Image *[], int) + \see Fl_Window::icon(const Fl_RGB_Image *) + \see Fl_Window::icons(const Fl_RGB_Image *[], int) + \see Fl_Window::icons(HICON, HICON) + */ +void Fl_Window::default_icons(HICON big_icon, HICON small_icon) { + Fl_X::set_default_icons(big_icon, small_icon); +} + + void Fl_WinAPI_Window_Driver::wait_for_expose() { if (!pWindow->shown()) return; Fl_X *i = Fl_X::i(pWindow); |
