Implement Window::SetIcon

This commit is contained in:
Dmitry Marakasov 2015-01-21 23:13:24 +03:00
parent f9435a520e
commit 50a73c1377
2 changed files with 20 additions and 0 deletions

View File

@ -22,6 +22,7 @@
#include <SDL2/SDL.h> #include <SDL2/SDL.h>
#include <SDL2pp/Window.hh> #include <SDL2pp/Window.hh>
#include <SDL2pp/Surface.hh>
#include <SDL2pp/Exception.hh> #include <SDL2pp/Exception.hh>
namespace SDL2pp { namespace SDL2pp {
@ -213,4 +214,9 @@ Uint32 Window::GetFlags() const {
return SDL_GetWindowFlags(window_); return SDL_GetWindowFlags(window_);
} }
Window& Window::SetIcon(const Surface& icon) {
SDL_SetWindowIcon(window_, icon.Get());
return *this;
}
} }

View File

@ -33,6 +33,8 @@ struct SDL_Window;
namespace SDL2pp { namespace SDL2pp {
class Surface;
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief GUI window object /// \brief GUI window object
/// ///
@ -474,6 +476,18 @@ public:
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
Uint32 GetFlags() const; 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);
}; };
} }