Top-level window class. More...

#include <display_window.h>

Public Member Functions

 DisplayWindow ()
 Constructs a null instance.
 
 DisplayWindow (const DisplayWindowDescription &description)
 Constructs a window.
 
 DisplayWindow (const std::string &title, float width, float height, bool start_fullscreen=false, bool allow_resize=false, int flipping_buffers=2)
 Constructs a window.
 
 DisplayWindow (DisplayWindowProvider *provider)
 Constructs a window.
 
 ~DisplayWindow ()
 
void bring_to_front ()
 Raises the window on top of other windows.
 
void capture_mouse (bool capture)
 Capture/Release the mouse.
 
Pointf client_to_screen (const Pointf &client)
 Convert from window client coordinates to screen coordinates.
 
void enable_alpha_channel (const Rectf &blur_rect)
 Enable alpha channel for this window.
 
void extend_frame_into_client_area (float left, float top, float right, float bottom)
 Exend the window frame into the client area.
 
void flip (int interval=-1)
 Flip back buffer to front, making changes visible on screen.
 
std::function< bool()> & func_minimize_clicked ()
 Callback called when a window is asked to minimize itself.
 
PixelBuffer get_clipboard_image () const
 Returns an image stored in the clipboard.
 
std::string get_clipboard_text () const
 Returns the text stored in the clipboard.
 
std::vector< InputDevice > & get_game_controllers ()
 Returns the game controller input device.
 
GraphicContextget_gc () const
 Return the graphic context for the window.
 
Rectf get_geometry () const
 Returns the position and size of the window frame.
 
DisplayWindowHandle get_handle () const
 
InputDeviceget_input_device (const std::string &device_name)
 Returns the input device with the given device name.
 
InputDeviceget_keyboard ()
 Returns the keyboard input device.
 
Sizef get_maximum_size (bool client_area=false)
 Returns the maximum size the window can be resized to by the application user.
 
Sizef get_minimum_size (bool client_area=false)
 Returns the minimum size the window can be resized to by the application user.
 
InputDeviceget_mouse ()
 Returns the mouse input device.
 
DisplayWindowProviderget_provider () const
 Returns the display window provider.
 
std::string get_title () const
 Returns the window title.
 
Rectf get_viewport () const
 Returns the drawable area of the window (excluding window frame).
 
bool has_focus () const
 Returns true if window has focus.
 
void hide ()
 Hides the window.
 
void hide_cursor ()
 Hides the mouse cursor.
 
bool is_clipboard_image_available () const
 Returns true if an image is available in the clipboard.
 
bool is_clipboard_text_available () const
 Returns true if text is available in the clipboard.
 
bool is_fullscreen () const
 Returns true if window is currently running fullscreen.
 
bool is_maximized () const
 Returns true if the window is maximized.
 
bool is_minimized () const
 Returns true if the window is minimized.
 
bool is_null () const
 Returns true if this object is invalid.
 
bool is_visible () const
 returns true if this display window is visible
 
void maximize ()
 Maximizes the window.
 
void minimize ()
 Minimizes the window.
 
 operator bool () const
 
void request_repaint ()
 Invalidates the screen, causing a repaint.
 
void restore ()
 Restores the window.
 
Pointf screen_to_client (const Pointf &screen)
 Convert from screen coordinates to client coordinates.
 
void set_clipboard_image (const PixelBuffer &buf)
 Stores an image in the clipboard.
 
void set_clipboard_text (const std::string &text)
 Stores text in the clipboard.
 
void set_cursor (const Cursor &cursor)
 Sets the current cursor icon.
 
void set_cursor (StandardCursor type)
 Set cursor.
 
void set_enabled (bool enable)
 Set enabled.
 
void set_large_icon (const PixelBuffer &image)
 Sets the large icon used for this window.
 
void set_maximum_size (float width, float height, bool client_area)
 Maximum size a window can be resized to by the application user.
 
void set_minimum_size (float width, float height, bool client_area)
 Minimum size a window can be resized to by the application user.
 
void set_position (const Rectf &pos, bool client_area)
 Set window position and size.
 
void set_position (float x, float y)
 Set window position.
 
void set_size (float width, float height, bool client_area)
 Resize window.
 
void set_small_icon (const PixelBuffer &image)
 Sets the small icon used for this window.
 
void set_title (const std::string &title)
 Change window title.
 
void set_visible (bool visible, bool activate)
 Set visible.
 
void show (bool activate=true)
 Displays the window in its current size and position.
 
void show_cursor ()
 Shows the mouse cursor.
 
Signal< void()> & sig_got_focus ()
 Signal emitted when window gain focus.
 
Signal< void()> & sig_lost_focus ()
 Signal emitted when window lost focus.
 
Signal< void()> & sig_paint ()
 Signal emitted when the window is invalidated.
 
Signal< void(float, float)> & sig_resize ()
 Signal emitted when window is resized.
 
Signal< void()> & sig_window_close ()
 Signal emitted when window is closed.
 
Signal< void()> & sig_window_destroy ()
 Signal emitted when window is destroyed.
 
Signal< void()> & sig_window_flip ()
 Signal emitted when window flip() was called.
 
Signal< void()> & sig_window_maximized ()
 Signal emitted when window is maximized.
 
Signal< void()> & sig_window_minimized ()
 Signal emitted when window is minimized.
 
Signal< void()> & sig_window_moved ()
 Signal emitted after a window has been moved.
 
Signal< void()> & sig_window_restored ()
 Signal emitted when window is restored.
 
void throw_if_null () const
 Throw an exception if this object is invalid.
 
void toggle_fullscreen ()
 

Public Attributes

std::function< void(Rectf &)> func_window_resize )()
 Callback called when a window is being resized.
 

Detailed Description

Top-level window class.

Constructor & Destructor Documentation

◆ DisplayWindow() [1/4]

clan::DisplayWindow::DisplayWindow ( )

Constructs a null instance.

◆ DisplayWindow() [2/4]

clan::DisplayWindow::DisplayWindow ( const std::string & title,
float width,
float height,
bool start_fullscreen = false,
bool allow_resize = false,
int flipping_buffers = 2 )

Constructs a window.

Parameters
title= Titlebar text.
width= Width in pixels of window.
height= Height in pixels of window.
start_fullscreen= If true, window will go fullscreen.
allow_resize= If true, window will have resize grabbers and can be resized.
flipping_buffers= Number of flipping buffers in system. Default is that there is a front buffer and a back buffer.
target= Display target used to create the window.

◆ DisplayWindow() [3/4]

clan::DisplayWindow::DisplayWindow ( const DisplayWindowDescription & description)

Constructs a window.

Parameters
description= Structure that describes how to create the display window.
target= Display target used to create the window.

◆ DisplayWindow() [4/4]

clan::DisplayWindow::DisplayWindow ( DisplayWindowProvider * provider)

Constructs a window.

Parameters
provider= Display target implementation object.

◆ ~DisplayWindow()

clan::DisplayWindow::~DisplayWindow ( )

Member Function Documentation

◆ bring_to_front()

void clan::DisplayWindow::bring_to_front ( )

Raises the window on top of other windows.

◆ capture_mouse()

void clan::DisplayWindow::capture_mouse ( bool capture)

Capture/Release the mouse.

◆ client_to_screen()

Pointf clan::DisplayWindow::client_to_screen ( const Pointf & client)

Convert from window client coordinates to screen coordinates.

◆ enable_alpha_channel()

void clan::DisplayWindow::enable_alpha_channel ( const Rectf & blur_rect)

Enable alpha channel for this window.

This is only supported on Windows Vista and above (Else use Layered windows instead)

Parameters
blur_rect= Blur rectangle. If size = 0, then the entire window is used

◆ extend_frame_into_client_area()

void clan::DisplayWindow::extend_frame_into_client_area ( float left,
float top,
float right,
float bottom )

Exend the window frame into the client area.

Only implemented on win32

◆ flip()

void clan::DisplayWindow::flip ( int interval = -1)

Flip back buffer to front, making changes visible on screen.

The parameter interval specifies the minimum number of video frames that are displayed before a buffer swap will occur.

If interval is set to a value of 0, buffer swaps are not synchronized to a video frame.

If interval is set to a value of -1 (the default), then it will use the buffer swap used for previous flip. If its the first flip, it will use the system default.

Parameters
interval= See note

◆ func_minimize_clicked()

std::function< bool()> & clan::DisplayWindow::func_minimize_clicked ( )

Callback called when a window is asked to minimize itself.

◆ get_clipboard_image()

PixelBuffer clan::DisplayWindow::get_clipboard_image ( ) const

Returns an image stored in the clipboard.

Returns a null pixelbuffer if no image is available.

◆ get_clipboard_text()

std::string clan::DisplayWindow::get_clipboard_text ( ) const

Returns the text stored in the clipboard.

◆ get_game_controllers()

std::vector< InputDevice > & clan::DisplayWindow::get_game_controllers ( )

Returns the game controller input device.

◆ get_gc()

GraphicContext & clan::DisplayWindow::get_gc ( ) const

Return the graphic context for the window.

◆ get_geometry()

Rectf clan::DisplayWindow::get_geometry ( ) const

Returns the position and size of the window frame.

◆ get_handle()

DisplayWindowHandle clan::DisplayWindow::get_handle ( ) const

Returns an platform-specific internal display window handle object.

◆ get_input_device()

InputDevice & clan::DisplayWindow::get_input_device ( const std::string & device_name)

Returns the input device with the given device name.

◆ get_keyboard()

InputDevice & clan::DisplayWindow::get_keyboard ( )

Returns the keyboard input device.

◆ get_maximum_size()

Sizef clan::DisplayWindow::get_maximum_size ( bool client_area = false)

Returns the maximum size the window can be resized to by the application user.

◆ get_minimum_size()

Sizef clan::DisplayWindow::get_minimum_size ( bool client_area = false)

Returns the minimum size the window can be resized to by the application user.

◆ get_mouse()

InputDevice & clan::DisplayWindow::get_mouse ( )

Returns the mouse input device.

◆ get_provider()

DisplayWindowProvider * clan::DisplayWindow::get_provider ( ) const

Returns the display window provider.

◆ get_title()

std::string clan::DisplayWindow::get_title ( ) const

Returns the window title.

◆ get_viewport()

Rectf clan::DisplayWindow::get_viewport ( ) const

Returns the drawable area of the window (excluding window frame).

◆ has_focus()

bool clan::DisplayWindow::has_focus ( ) const

Returns true if window has focus.

◆ hide()

void clan::DisplayWindow::hide ( )

Hides the window.

◆ hide_cursor()

void clan::DisplayWindow::hide_cursor ( )

Hides the mouse cursor.

◆ is_clipboard_image_available()

bool clan::DisplayWindow::is_clipboard_image_available ( ) const

Returns true if an image is available in the clipboard.

◆ is_clipboard_text_available()

bool clan::DisplayWindow::is_clipboard_text_available ( ) const

Returns true if text is available in the clipboard.

◆ is_fullscreen()

bool clan::DisplayWindow::is_fullscreen ( ) const

Returns true if window is currently running fullscreen.

◆ is_maximized()

bool clan::DisplayWindow::is_maximized ( ) const

Returns true if the window is maximized.

◆ is_minimized()

bool clan::DisplayWindow::is_minimized ( ) const

Returns true if the window is minimized.

◆ is_null()

bool clan::DisplayWindow::is_null ( ) const
inline

Returns true if this object is invalid.

◆ is_visible()

bool clan::DisplayWindow::is_visible ( ) const

returns true if this display window is visible

◆ maximize()

void clan::DisplayWindow::maximize ( )

Maximizes the window.

◆ minimize()

void clan::DisplayWindow::minimize ( )

Minimizes the window.

◆ operator bool()

clan::DisplayWindow::operator bool ( ) const
inlineexplicit

◆ request_repaint()

void clan::DisplayWindow::request_repaint ( )

Invalidates the screen, causing a repaint.

◆ restore()

void clan::DisplayWindow::restore ( )

Restores the window.

◆ screen_to_client()

Pointf clan::DisplayWindow::screen_to_client ( const Pointf & screen)

Convert from screen coordinates to client coordinates.

◆ set_clipboard_image()

void clan::DisplayWindow::set_clipboard_image ( const PixelBuffer & buf)

Stores an image in the clipboard.

◆ set_clipboard_text()

void clan::DisplayWindow::set_clipboard_text ( const std::string & text)

Stores text in the clipboard.

◆ set_cursor() [1/2]

void clan::DisplayWindow::set_cursor ( const Cursor & cursor)

Sets the current cursor icon.

◆ set_cursor() [2/2]

void clan::DisplayWindow::set_cursor ( StandardCursor type)

Set cursor.

Parameters
type= Standard Cursor

◆ set_enabled()

void clan::DisplayWindow::set_enabled ( bool enable)

Set enabled.

Parameters
enable= bool

◆ set_large_icon()

void clan::DisplayWindow::set_large_icon ( const PixelBuffer & image)

Sets the large icon used for this window.

◆ set_maximum_size()

void clan::DisplayWindow::set_maximum_size ( float width,
float height,
bool client_area )

Maximum size a window can be resized to by the application user.

◆ set_minimum_size()

void clan::DisplayWindow::set_minimum_size ( float width,
float height,
bool client_area )

Minimum size a window can be resized to by the application user.

◆ set_position() [1/2]

void clan::DisplayWindow::set_position ( const Rectf & pos,
bool client_area )

Set window position and size.

Parameters
pos= Window position and size.
client_area= true - Position relative to window client area

◆ set_position() [2/2]

void clan::DisplayWindow::set_position ( float x,
float y )

Set window position.

Parameters
xWindow x position on desktop.
yWindow y position on desktop.

◆ set_size()

void clan::DisplayWindow::set_size ( float width,
float height,
bool client_area )

Resize window.

Parameters
width= New width of window in pixels.
height= New height of window in pixels.
client_area= true - relative to the window client area

◆ set_small_icon()

void clan::DisplayWindow::set_small_icon ( const PixelBuffer & image)

Sets the small icon used for this window.

◆ set_title()

void clan::DisplayWindow::set_title ( const std::string & title)

Change window title.

◆ set_visible()

void clan::DisplayWindow::set_visible ( bool visible,
bool activate )

Set visible.

Parameters
visible= bool
activate= bool

◆ show()

void clan::DisplayWindow::show ( bool activate = true)

Displays the window in its current size and position.

◆ show_cursor()

void clan::DisplayWindow::show_cursor ( )

Shows the mouse cursor.

◆ sig_got_focus()

Signal< void()> & clan::DisplayWindow::sig_got_focus ( )

Signal emitted when window gain focus.

◆ sig_lost_focus()

Signal< void()> & clan::DisplayWindow::sig_lost_focus ( )

Signal emitted when window lost focus.

◆ sig_paint()

Signal< void()> & clan::DisplayWindow::sig_paint ( )

Signal emitted when the window is invalidated.

◆ sig_resize()

Signal< void(float, float)> & clan::DisplayWindow::sig_resize ( )

Signal emitted when window is resized.

◆ sig_window_close()

Signal< void()> & clan::DisplayWindow::sig_window_close ( )

Signal emitted when window is closed.

◆ sig_window_destroy()

Signal< void()> & clan::DisplayWindow::sig_window_destroy ( )

Signal emitted when window is destroyed.

◆ sig_window_flip()

Signal< void()> & clan::DisplayWindow::sig_window_flip ( )

Signal emitted when window flip() was called.

◆ sig_window_maximized()

Signal< void()> & clan::DisplayWindow::sig_window_maximized ( )

Signal emitted when window is maximized.

◆ sig_window_minimized()

Signal< void()> & clan::DisplayWindow::sig_window_minimized ( )

Signal emitted when window is minimized.

◆ sig_window_moved()

Signal< void()> & clan::DisplayWindow::sig_window_moved ( )

Signal emitted after a window has been moved.

◆ sig_window_restored()

Signal< void()> & clan::DisplayWindow::sig_window_restored ( )

Signal emitted when window is restored.

◆ throw_if_null()

void clan::DisplayWindow::throw_if_null ( ) const

Throw an exception if this object is invalid.

◆ toggle_fullscreen()

void clan::DisplayWindow::toggle_fullscreen ( )

Toggle fullscreen Only Win32 implementation for now

Member Data Documentation

◆ func_window_resize

std::function< void(Rectf &)> clan::DisplayWindow::func_window_resize) ()

Callback called when a window is being resized.


The documentation for this class was generated from the following file: