clan::DisplayWindow Class Reference

Top-level window class. More...

#include <display_window.h>

Public Member Functions

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

Detailed Description

Top-level window class.

Constructor & Destructor Documentation

clan::DisplayWindow::DisplayWindow ( )

Constructs a null instance.

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.
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.
clan::DisplayWindow::DisplayWindow ( DisplayWindowProvider provider)

Constructs a window.

Parameters
provider= Display target implementation object.
clan::DisplayWindow::~DisplayWindow ( )

Member Function Documentation

void clan::DisplayWindow::bring_to_front ( )

Raises the window on top of other windows.

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

Capture/Release the mouse.

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

Convert from window client coordinates to screen coordinates.

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
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

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
std::function<bool()>& clan::DisplayWindow::func_minimize_clicked ( )

Callback called when a window is asked to minimize itself.

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

Callback called when a window is being resized.

PixelBuffer clan::DisplayWindow::get_clipboard_image ( ) const

Returns an image stored in the clipboard.

Returns a null pixelbuffer if no image is available.

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

Returns the text stored in the clipboard.

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

Returns the game controller input device.

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

Return the graphic context for the window.

Rectf clan::DisplayWindow::get_geometry ( ) const

Returns the position and size of the window frame.

DisplayWindowHandle clan::DisplayWindow::get_handle ( ) const

Returns an platform-specific internal display window handle object.

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

Returns the input device with the given device name.

InputDevice& clan::DisplayWindow::get_keyboard ( )

Returns the keyboard input device.

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

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

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

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

InputDevice& clan::DisplayWindow::get_mouse ( )

Returns the mouse input device.

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

Returns the display window provider.

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

Returns the window title.

Rectf clan::DisplayWindow::get_viewport ( ) const

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

bool clan::DisplayWindow::has_focus ( ) const

Returns true if window has focus.

void clan::DisplayWindow::hide ( )

Hides the window.

void clan::DisplayWindow::hide_cursor ( )

Hides the mouse cursor.

bool clan::DisplayWindow::is_clipboard_image_available ( ) const

Returns true if an image is available in the clipboard.

bool clan::DisplayWindow::is_clipboard_text_available ( ) const

Returns true if text is available in the clipboard.

bool clan::DisplayWindow::is_fullscreen ( ) const

Returns true if window is currently running fullscreen.

bool clan::DisplayWindow::is_maximized ( ) const

Returns true if the window is maximized.

bool clan::DisplayWindow::is_minimized ( ) const

Returns true if the window is minimized.

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

Returns true if this object is invalid.

bool clan::DisplayWindow::is_visible ( ) const

returns true if this display window is visible

void clan::DisplayWindow::maximize ( )

Maximizes the window.

void clan::DisplayWindow::minimize ( )

Minimizes the window.

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

Invalidates the screen, causing a repaint.

void clan::DisplayWindow::restore ( )

Restores the window.

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

Convert from screen coordinates to client coordinates.

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

Stores an image in the clipboard.

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

Stores text in the clipboard.

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

Sets the current cursor icon.

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

Set cursor.

Parameters
type= Standard Cursor
void clan::DisplayWindow::set_enabled ( bool  enable)

Set enabled.

Parameters
enable= bool
void clan::DisplayWindow::set_large_icon ( const PixelBuffer image)

Sets the large icon used for this window.

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.

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.

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
void clan::DisplayWindow::set_position ( float  x,
float  y 
)

Set window position.

Parameters
xWindow x position on desktop.
yWindow y position on desktop.
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
void clan::DisplayWindow::set_small_icon ( const PixelBuffer image)

Sets the small icon used for this window.

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

Change window title.

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

Set visible.

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

Displays the window in its current size and position.

void clan::DisplayWindow::show_cursor ( )

Shows the mouse cursor.

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

Signal emitted when window gain focus.

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

Signal emitted when window lost focus.

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

Signal emitted when the window is invalidated.

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

Signal emitted when window is resized.

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

Signal emitted when window is closed.

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

Signal emitted when window is destroyed.

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

Signal emitted when window flip() was called.

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

Signal emitted when window is maximized.

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

Signal emitted when window is minimized.

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

Signal emitted after a window has been moved.

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

Signal emitted when window is restored.

void clan::DisplayWindow::throw_if_null ( ) const

Throw an exception if this object is invalid.

void clan::DisplayWindow::toggle_fullscreen ( )

Toggle fullscreen Only Win32 implementation for now


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