FS#159 - Add sf::Window::SetTitle

git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/branches/sfml2@1502 4e206d99-4929-0410-ac5d-dfc041789085
This commit is contained in:
LaurentGom 2010-04-09 07:35:08 +00:00
parent a512479a42
commit ae2ae15e12
7 changed files with 55 additions and 1 deletions

View File

@ -310,6 +310,14 @@ public :
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
void SetSize(unsigned int width, unsigned int height); void SetSize(unsigned int width, unsigned int height);
////////////////////////////////////////////////////////////
/// \brief Change the title of the window
///
/// \param title New title
///
////////////////////////////////////////////////////////////
void SetTitle(const std::string& title);
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Show or hide the window /// \brief Show or hide the window
/// ///

View File

@ -156,7 +156,7 @@ myKeyRepeat (true)
} }
// Set the window's name // Set the window's name
XStoreName(myDisplay, myWindow, title.c_str()); SetTitle(title);
// Set the window's style (tell the windows manager to change our window's decorations and functions according to the requested style) // Set the window's style (tell the windows manager to change our window's decorations and functions according to the requested style)
if (!fullscreen) if (!fullscreen)
@ -340,6 +340,13 @@ void WindowImplX11::SetSize(unsigned int width, unsigned int height)
} }
////////////////////////////////////////////////////////////
void WindowImplX11::SetTitle(const std::string& title)
{
XStoreName(myDisplay, myWindow, title.c_str());
}
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
void WindowImplX11::Show(bool show) void WindowImplX11::Show(bool show)
{ {

View File

@ -134,6 +134,14 @@ private :
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
virtual void SetSize(unsigned int width, unsigned int height); virtual void SetSize(unsigned int width, unsigned int height);
////////////////////////////////////////////////////////////
/// \brief Change the title of the window
///
/// \param title New title
///
////////////////////////////////////////////////////////////
virtual void SetTitle(const std::string& title);
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Show or hide the window /// \brief Show or hide the window
/// ///

View File

@ -267,6 +267,13 @@ void WindowImplWin32::SetSize(unsigned int width, unsigned int height)
} }
////////////////////////////////////////////////////////////
void WindowImplWin32::SetTitle(const std::string& title)
{
SetWindowText(myHandle, title.c_str());
}
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
void WindowImplWin32::Show(bool show) void WindowImplWin32::Show(bool show)
{ {

View File

@ -123,6 +123,14 @@ private :
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
virtual void SetSize(unsigned int width, unsigned int height); virtual void SetSize(unsigned int width, unsigned int height);
////////////////////////////////////////////////////////////
/// \brief Change the title of the window
///
/// \param title New title
///
////////////////////////////////////////////////////////////
virtual void SetTitle(const std::string& title);
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Show or hide the window /// \brief Show or hide the window
/// ///

View File

@ -280,6 +280,14 @@ void Window::SetSize(unsigned int width, unsigned int height)
} }
////////////////////////////////////////////////////////////
void Window::SetTitle(const std::string& title)
{
if (myWindow)
myWindow->SetTitle(title);
}
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
void Window::Show(bool show) void Window::Show(bool show)
{ {

View File

@ -167,6 +167,14 @@ public :
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
virtual void SetSize(unsigned int width, unsigned int height) = 0; virtual void SetSize(unsigned int width, unsigned int height) = 0;
////////////////////////////////////////////////////////////
/// \brief Change the title of the window
///
/// \param title New title
///
////////////////////////////////////////////////////////////
virtual void SetTitle(const std::string& title) = 0;
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Show or hide the window /// \brief Show or hide the window
/// ///