From 50a73c1377438984ac3f0b87dd8d9061df05cadf Mon Sep 17 00:00:00 2001 From: Dmitry Marakasov Date: Wed, 21 Jan 2015 23:13:24 +0300 Subject: [PATCH] Implement Window::SetIcon --- SDL2pp/Window.cc | 6 ++++++ SDL2pp/Window.hh | 14 ++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/SDL2pp/Window.cc b/SDL2pp/Window.cc index 98e5c1a..9f77d7c 100644 --- a/SDL2pp/Window.cc +++ b/SDL2pp/Window.cc @@ -22,6 +22,7 @@ #include #include +#include #include namespace SDL2pp { @@ -213,4 +214,9 @@ Uint32 Window::GetFlags() const { return SDL_GetWindowFlags(window_); } +Window& Window::SetIcon(const Surface& icon) { + SDL_SetWindowIcon(window_, icon.Get()); + return *this; +} + } diff --git a/SDL2pp/Window.hh b/SDL2pp/Window.hh index 8ddb5d8..7506920 100644 --- a/SDL2pp/Window.hh +++ b/SDL2pp/Window.hh @@ -33,6 +33,8 @@ struct SDL_Window; namespace SDL2pp { +class Surface; + //////////////////////////////////////////////////////////// /// \brief GUI window object /// @@ -474,6 +476,18 @@ public: /// //////////////////////////////////////////////////////////// Uint32 GetFlags() const; + + //////////////////////////////////////////////////////////// + /// \brief Set the icon for a window + /// + /// \param[in] icon Surface containing the icon for the window + /// + /// \see http://wiki.libsdl.org/SDL_SetWindowIcon + /// + /// Icon surface may be destroyed after calling this function + /// + //////////////////////////////////////////////////////////// + Window& SetIcon(const Surface& icon); }; }