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. | |
GraphicContext & | get_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 |
InputDevice & | get_input_device (const std::string &device_name) |
Returns the input device with the given device name. | |
InputDevice & | get_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. | |
InputDevice & | get_mouse () |
Returns the mouse input device. | |
DisplayWindowProvider * | get_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. | |
Top-level window class.
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.
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.
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.
provider | = Display target implementation object. |
clan::DisplayWindow::~DisplayWindow | ( | ) |
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.
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)
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.
interval | = See note |
std::function< bool()> & clan::DisplayWindow::func_minimize_clicked | ( | ) |
Callback called when a window is asked to minimize itself.
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.
|
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.
|
inlineexplicit |
void clan::DisplayWindow::request_repaint | ( | ) |
Invalidates the screen, causing a repaint.
void clan::DisplayWindow::restore | ( | ) |
Restores the window.
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.
type | = Standard Cursor |
void clan::DisplayWindow::set_enabled | ( | bool | enable | ) |
Set enabled.
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.
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.
x | Window x position on desktop. |
y | Window y position on desktop. |
void clan::DisplayWindow::set_size | ( | float | width, |
float | height, | ||
bool | client_area ) |
Resize window.
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.
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(float, float)> & clan::DisplayWindow::sig_resize | ( | ) |
Signal emitted when window is resized.
Signal< void()> & clan::DisplayWindow::sig_window_destroy | ( | ) |
Signal emitted when window is destroyed.
Signal< void()> & clan::DisplayWindow::sig_window_flip | ( | ) |
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
std::function< void(Rectf &)> clan::DisplayWindow::func_window_resize) () |
Callback called when a window is being resized.