| 1 | /*
|
|---|
| 2 | * SPDX-FileCopyrightText: 2022 Jiri Svoboda
|
|---|
| 3 | *
|
|---|
| 4 | * SPDX-License-Identifier: BSD-3-Clause
|
|---|
| 5 | */
|
|---|
| 6 |
|
|---|
| 7 | /** @addtogroup libui
|
|---|
| 8 | * @{
|
|---|
| 9 | */
|
|---|
| 10 | /**
|
|---|
| 11 | * @file Window structure
|
|---|
| 12 | *
|
|---|
| 13 | */
|
|---|
| 14 |
|
|---|
| 15 | #ifndef _UI_PRIVATE_WINDOW_H
|
|---|
| 16 | #define _UI_PRIVATE_WINDOW_H
|
|---|
| 17 |
|
|---|
| 18 | #include <adt/list.h>
|
|---|
| 19 | #include <errno.h>
|
|---|
| 20 | #include <congfx/console.h>
|
|---|
| 21 | #include <display.h>
|
|---|
| 22 | #include <gfx/context.h>
|
|---|
| 23 | #include <io/kbd_event.h>
|
|---|
| 24 | #include <io/pos_event.h>
|
|---|
| 25 | #include <memgfx/memgc.h>
|
|---|
| 26 | #include <memgfx/xlategc.h>
|
|---|
| 27 | #include <types/ui/cursor.h>
|
|---|
| 28 | #include <types/ui/window.h>
|
|---|
| 29 |
|
|---|
| 30 | /** Actual structure of window.
|
|---|
| 31 | *
|
|---|
| 32 | * This is private to libui.
|
|---|
| 33 | */
|
|---|
| 34 | struct ui_window {
|
|---|
| 35 | /** Containing user interface */
|
|---|
| 36 | struct ui *ui;
|
|---|
| 37 | /** Link to @c ui->windows */
|
|---|
| 38 | link_t lwindows;
|
|---|
| 39 | /** Callbacks */
|
|---|
| 40 | struct ui_window_cb *cb;
|
|---|
| 41 | /** Callback argument */
|
|---|
| 42 | void *arg;
|
|---|
| 43 | /** Display window */
|
|---|
| 44 | display_window_t *dwindow;
|
|---|
| 45 | /** Window GC */
|
|---|
| 46 | gfx_context_t *gc;
|
|---|
| 47 | /** Window bitmap (if client-side rendering) */
|
|---|
| 48 | gfx_bitmap_t *bmp;
|
|---|
| 49 | /** Window memory GC (if client-side rendering) */
|
|---|
| 50 | mem_gc_t *mgc;
|
|---|
| 51 | /** Translating GC (if full screen & server-side rendering) */
|
|---|
| 52 | xlate_gc_t *xgc;
|
|---|
| 53 | /** Real window GC (if client-side rendering) */
|
|---|
| 54 | gfx_context_t *realgc;
|
|---|
| 55 | /** Window rectangle */
|
|---|
| 56 | gfx_rect_t rect;
|
|---|
| 57 | /** Normal window rectangle (when not maximized) */
|
|---|
| 58 | gfx_rect_t normal_rect;
|
|---|
| 59 | /** Display position (if fullscreen mode) */
|
|---|
| 60 | gfx_coord2_t dpos;
|
|---|
| 61 | /** Application area bitmap */
|
|---|
| 62 | gfx_bitmap_t *app_bmp;
|
|---|
| 63 | /** Application area memory GC */
|
|---|
| 64 | mem_gc_t *app_mgc;
|
|---|
| 65 | /** Application area GC */
|
|---|
| 66 | gfx_context_t *app_gc;
|
|---|
| 67 | /** Dirty rectangle */
|
|---|
| 68 | gfx_rect_t dirty_rect;
|
|---|
| 69 | /** UI resource. Ideally this would be in ui_t. */
|
|---|
| 70 | struct ui_resource *res;
|
|---|
| 71 | /** Window decoration */
|
|---|
| 72 | struct ui_wdecor *wdecor;
|
|---|
| 73 | /** Top-level control in the application area */
|
|---|
| 74 | struct ui_control *control;
|
|---|
| 75 | /** Current cursor */
|
|---|
| 76 | ui_stock_cursor_t cursor;
|
|---|
| 77 | /** Window placement */
|
|---|
| 78 | ui_wnd_placement_t placement;
|
|---|
| 79 | };
|
|---|
| 80 |
|
|---|
| 81 | /** Size change operation */
|
|---|
| 82 | typedef enum {
|
|---|
| 83 | /** Resize window */
|
|---|
| 84 | ui_wsc_resize,
|
|---|
| 85 | /** Maximize window */
|
|---|
| 86 | ui_wsc_maximize,
|
|---|
| 87 | /** Unmaximize window */
|
|---|
| 88 | ui_wsc_unmaximize
|
|---|
| 89 | } ui_wnd_sc_op_t;
|
|---|
| 90 |
|
|---|
| 91 | extern display_stock_cursor_t wnd_dcursor_from_cursor(ui_stock_cursor_t);
|
|---|
| 92 | extern void ui_window_send_maximize(ui_window_t *);
|
|---|
| 93 | extern void ui_window_send_unmaximize(ui_window_t *);
|
|---|
| 94 | extern void ui_window_send_close(ui_window_t *);
|
|---|
| 95 | extern void ui_window_send_focus(ui_window_t *);
|
|---|
| 96 | extern void ui_window_send_kbd(ui_window_t *, kbd_event_t *);
|
|---|
| 97 | extern errno_t ui_window_send_paint(ui_window_t *);
|
|---|
| 98 | extern void ui_window_send_pos(ui_window_t *, pos_event_t *);
|
|---|
| 99 | extern void ui_window_send_unfocus(ui_window_t *);
|
|---|
| 100 | extern errno_t ui_window_size_change(ui_window_t *, gfx_rect_t *,
|
|---|
| 101 | ui_wnd_sc_op_t);
|
|---|
| 102 |
|
|---|
| 103 | #endif
|
|---|
| 104 |
|
|---|
| 105 | /** @}
|
|---|
| 106 | */
|
|---|