diff options
Diffstat (limited to 'common/fltk/src/Fl_Window.cxx')
-rw-r--r-- | common/fltk/src/Fl_Window.cxx | 60 |
1 files changed, 57 insertions, 3 deletions
diff --git a/common/fltk/src/Fl_Window.cxx b/common/fltk/src/Fl_Window.cxx index 1ece624c..fe872ec7 100644 --- a/common/fltk/src/Fl_Window.cxx +++ b/common/fltk/src/Fl_Window.cxx @@ -32,6 +32,7 @@ #include <config.h> #include <FL/Fl.H> #include <FL/x.H> +#include <FL/Fl_RGB_Image.H> #include <FL/Fl_Window.H> #include <stdlib.h> #include "flstring.h" @@ -54,7 +55,8 @@ void Fl_Window::_Fl_Window() { } i = 0; xclass_ = 0; - icon_ = 0; + icon_ = new icon_data; + memset(icon_, 0, sizeof(*icon_)); iconlabel_ = 0; resizable(0); size_range_set = 0; @@ -277,16 +279,68 @@ const char *Fl_Window::xclass() const } } +void Fl_Window::default_icon(const Fl_RGB_Image *icon) { + default_icons(&icon, 1); +} + +void Fl_Window::default_icons(const Fl_RGB_Image **icons, int count) { + Fl_X::set_default_icons(icons, count); +} + +void Fl_Window::icon(const Fl_RGB_Image *icon) { + icons(&icon, 1); +} + +void Fl_Window::icons(const Fl_RGB_Image **icons, int count) { + free_icons(); + + if (count > 0) { + icon_->icons = new Fl_RGB_Image*[count]; + icon_->count = count; + // FIXME: Fl_RGB_Image lacks const modifiers on methods + for (int i = 0;i < count;i++) + icon_->icons[i] = (Fl_RGB_Image*)((Fl_RGB_Image*)icons[i])->copy(); + } + + if (i) + i->set_icons(); +} + /** Gets the current icon window target dependent data. */ const void *Fl_Window::icon() const { - return icon_; + return icon_->legacy_icon; } /** Sets the current icon window target dependent data. */ void Fl_Window::icon(const void * ic) { - icon_ = ic; + free_icons(); + icon_->legacy_icon = ic; } +void Fl_Window::free_icons() { + int i; + + icon_->legacy_icon = 0L; + + if (icon_->icons) { + for (i = 0;i < icon_->count;i++) + delete icon_->icons[i]; + delete [] icon_->icons; + icon_->icons = 0L; + } + + icon_->count = 0; + +#ifdef WIN32 + if (icon_->big_icon) + DestroyIcon(icon_->big_icon); + if (icon_->small_icon) + DestroyIcon(icon_->small_icon); + + icon_->big_icon = NULL; + icon_->small_icon = NULL; +#endif +} // // End of "$Id: Fl_Window.cxx 8472 2011-02-25 08:44:47Z AlbrechtS $". |