Window
This page has been automatically translated using the Google Translate API services. We are working on improving texts. Thank you for your understanding and patience.
Functions
Window* | window_create (...) |
void | window_destroy (...) |
void | window_panel (...) |
void | window_OnClose (...) |
void | window_OnMoved (...) |
void | window_OnResize (...) |
void | window_title (...) |
void | window_show (...) |
void | window_hide (...) |
uint32_t | window_modal (...) |
void | window_stop_modal (...) |
void | window_update (...) |
void | window_origin (...) |
void | window_size (...) |
V2Df | window_get_origin (...) |
S2Df | window_get_size (...) |
S2Df | window_get_client_size (...) |
void | window_defbutton (...) |
void | window_cursor (...) |
Window objects are the highest level containers within the user interface (Figure 1). They are composed of the title bar, where the close, maximize and minimize buttons are located, the interior area and the frame. If the window supports resizing, this frame can be dragged with the mouse to change its size. The interior area or client area of the window is configured by a Panel passed as a constructor parameter.
- Use window_create to create a window.

1. Window size
In principle, the window size is automatically calculated based on the Natural sizing of its main panel, but it can be changed at any time.
- Use window_size to change the size of the main panel.
- Use ekWNRES flag to create a user resizable window.
The change in the dimensions of the client area implies a re-location and resizing of the internal controls. This is automatically managed by Layout objects depending on how its Cell expansion, which will be recursively propagated by all sublayouts. In Die you have an example of resizing a window (Figure 2).
2. Window closing.
TODO

window_create ()
Create a new window.
Window* window_create(const uint32_t flags);
flags | Combination of window_flag_t values. |
Return
The window.
window_destroy ()
Destroy the window and all its contents.
void window_destroy(Window **window);
window | The window. Will be set to |
Remarks
Panels, layouts and components will be recursively destroyed.
window_panel ()
Associate the main panel with a window.
void window_panel(Window *window, Panel *panel);
window | The window. |
panel | Main panel, which integrates all the content of the window (views, controls, etc). |
Remarks
The size of the window will be adjusted based on the Natural sizing of the main panel.
window_OnClose ()
Set an event handler for the window closing.
void window_OnClose(Window *window, Listener *listener);
1 2 3 4 5 6 7 8 9 10 11 |
static void i_OnClose(App *app, Event *e) { const EvWinClose *params = event_params(e, EvWinClose); if (can_close(app, params->origin) == FALSE) { bool_t *result = event_result(e, bool_t); *result = FALSE; } } ... window_OnClose(window, listener(app, i_OnClose, App)); |
window | The window. |
listener | Callback function to be called before closing a window. |
Remarks
If for any reason the window should not close, it must be returned FALSE
as a result of the event. See GUI Events.
window_OnMoved ()
Set an event handler for moving the window on the desktop.
void window_OnMoved(Window *window, Listener *listener);
window | The window. |
listener | Callback function to be called as the title bar is dragged and the window moves across the desktop. |
Remarks
See GUI Events.
window_OnResize ()
Set an event handler for window resizing.
void window_OnResize(Window *window, Listener *listener);
window | The window. |
listener | Callback function to be called as the outer edges of the window are dragged to resize. |
Remarks
The resizing and relocation of elements is done automatically based on the main Layout, so it is not usually necessary for the application to respond to this event. See GUI Events.
window_title ()
Set the text that will display the window in the title bar.
void window_title(Window *window, const char_t *text);
window | The window. |
text | UTF8 C-string terminated in null character |
window_show ()
Show the window. By default windows are created hidden. You have to show them explicitly.
void window_show(Window *window);
window | The window. |
window_hide ()
Hide the window.
void window_hide(Window *window);
window | The window. |
window_modal ()
Launch a window in modal mode.
uint32_t window_modal(Window *window, Window *parent);
window | The window. |
parent | The parent window. |
Return
Value returned by window_stop_modal.
Remarks
parent
stop receiving events until you call window_stop_modal.
window_stop_modal ()
Ends the modal cycle of a window.
void window_stop_modal(Window *window, const uint32_t return_value);
window | The window previously launched with window_modal. |
return_value | Value to be returned window_modal. |
window_update ()
Recalculate the position and size of the controls after modifying any Layout.
void window_update(Window *window);
window | The window. |
window_origin ()
Move the window to specific desktop coordinates.
void window_origin(Window *window, const V2Df origin);
window | The window. |
origin | Position |
window_size ()
Set the size of the client area of the window.
void window_size(Window *window, const S2Df size);
window | The window. |
size | Main panel size. |
Remarks
The final size will depend on the window frame and desktop theme settings. This measure only refers to the interior area.
window_get_origin ()
Get the window position.
V2Df window_get_origin(const Window *window);
window | The window. |
Return
Position (x,y)
from the upper-left corner of the window.
window_get_size ()
Get the total dimensions of the window.
S2Df window_get_size(const Window *window);
window | The window. |
Return
Window size.
Remarks
The frame and title bar are taken into account.
window_get_client_size ()
Get the dimensions of the client area of the window.
S2Df window_get_client_size(const Window *window);
window | The window. |
Return
Main panel size.
window_defbutton ()
Set the default window button. It will be activated when pressed [Intro]
.
void window_defbutton(Window *window, Button *button);
window | The window. |
button | The button. |
window_cursor ()
Change the mouse cursor.
void window_cursor(Window *window, const cursor_t cursor, const Image *image, const real32_t hot_x, const real32_t hot_y);
window | The window. |
cursor | Identifier of the new cursor. |
image | Custom image. Only valid in ekCUSER. |
hot_x | The x coordinate of the click point. Only valid in ekCUSER. |
hot_y | The y coordinate of the click point. Only valid in ekCUSER. |
Remarks
hot_x, hot_y
indicate the "sensitive" point within the image, which will indicate the exact position of the mouse.