PatchworkOS
Loading...
Searching...
No Matches
window.h
Go to the documentation of this file.
1#ifndef PATCHWORK_WIN_H
2#define PATCHWORK_WIN_H 1
3
4#include "display.h"
5#include "pixel.h"
6#include "procedure.h"
7#include "surface.h"
8
9#if defined(__cplusplus)
10extern "C"
11{
12#endif
13
37typedef struct window window_t;
38
43typedef enum window_flags
44{
46 WINDOW_DECO = 1 << 0,
48 WINDOW_NO_CONTROLS = 1 << 2
50
63window_t* window_new(display_t* disp, const char* name, const rect_t* rect, surface_type_t type, window_flags_t flags,
64 procedure_t procedure, void* private);
65
71void window_free(window_t* win);
72
82
92
100
108
116
127
135uint64_t window_move(window_t* win, const rect_t* rect);
136
149
160void window_invalidate(window_t* win, const rect_t* rect);
161
171
184uint64_t window_dispatch(window_t* win, const event_t* event);
185
195
207uint64_t window_set_visible(window_t* win, bool isVisible);
208
211#if defined(__cplusplus)
212}
213#endif
214
215#endif
timer_flags_t
Definition cmd.h:75
surface_type_t
Surface types.
Definition surface.h:33
uint64_t surface_id_t
Definition surface.h:53
uint64_t window_set_visible(window_t *win, bool isVisible)
Set the visibility of the window.
Definition window.c:692
rect_t window_get_rect(window_t *win)
Get the window's rectangle in screen coordinates.
Definition window.c:447
uint64_t window_move(window_t *win, const rect_t *rect)
Move and/or resize the window.
Definition window.c:507
uint64_t window_set_focus(window_t *win)
Set the focus to the window.
Definition window.c:673
surface_id_t window_get_id(window_t *win)
Get the surface ID of the window.
Definition window.c:477
rect_t window_content_rect(window_t *win)
Get the window's rectangle in local coordinates.
window_flags_t
Window flags.
Definition window.h:44
uint64_t window_invalidate_flush(window_t *win)
Flush invalidated rectangles to the DWM.
Definition window.c:570
surface_type_t window_get_type(window_t *win)
Get the surface type of the window.
Definition window.c:487
uint64_t window_set_timer(window_t *win, timer_flags_t flags, clock_t timeout)
Set the window timer.
Definition window.c:533
uint64_t window_dispatch(window_t *win, const event_t *event)
Dispatch an event to the window's elements.
Definition window.c:598
window_t * window_new(display_t *disp, const char *name, const rect_t *rect, surface_type_t type, window_flags_t flags, procedure_t procedure, void *private)
Allocate and initialize a new window.
Definition window.c:301
element_t * window_get_client_element(window_t *win)
Get the client element of the window.
Definition window.c:497
void window_free(window_t *win)
Free a window.
Definition window.c:415
display_t * window_get_display(window_t *win)
Get the display associated with the window.
Definition window.c:467
void window_invalidate(window_t *win, const rect_t *rect)
Invalidate a rectangle of the window.
Definition window.c:553
@ WINDOW_NONE
Definition window.h:45
@ WINDOW_RESIZABLE
Allows window_move() to resize the window. TODO: Implement resize handles.
Definition window.h:47
@ WINDOW_NO_CONTROLS
Disable controls (close/minimize buttons), only applies if WINDOW_DECO is set.
Definition window.h:48
@ WINDOW_DECO
Enable decorations (titlebar, close/minimize buttons, etc).
Definition window.h:46
__UINT64_TYPE__ clock_t
A nanosecond time.
Definition clock_t.h:13
uint64_t(* procedure_t)(window_t *, element_t *, const event_t *)
Definition procedure.h:15
static uint64_t procedure(window_t *win, element_t *elem, const event_t *event)
Definition main.c:46
__UINT64_TYPE__ uint64_t
Definition stdint.h:17
Opaque display structure.
Definition internal.h:61
Opaque element structure.
Definition internal.h:23
Event structure.
Definition event.h:271
Definition rect.h:13
Opaque window structure.
Definition internal.h:44