source: mainline/uspace/lib/ui/include/types/ui/window.h

Last change on this file was 0d00e53, checked in by Jiri Svoboda <jiri@…>, 15 months ago

Shut down dialog

  • Property mode set to 100644
File size: 3.8 KB
Line 
1/*
2 * Copyright (c) 2024 Jiri Svoboda
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * - Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * - Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * - The name of the author may not be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29/** @addtogroup libui
30 * @{
31 */
32/**
33 * @file Window
34 */
35
36#ifndef _UI_TYPES_WINDOW_H
37#define _UI_TYPES_WINDOW_H
38
39#include <errno.h>
40#include <io/kbd_event.h>
41#include <io/pos_event.h>
42#include <types/common.h>
43#include <types/ui/wdecor.h>
44
45struct ui_window;
46typedef struct ui_window ui_window_t;
47
48/** Window placement hint */
49typedef enum {
50 /** Use default (automatic) placement */
51 ui_wnd_place_default = 0,
52 /** Place window to the top-left corner of the screen */
53 ui_wnd_place_top_left,
54 /** Place window to the top-right corner of the screen */
55 ui_wnd_place_top_right,
56 /** Place window to the bottom-left corner of the screen */
57 ui_wnd_place_bottom_left,
58 /** Place window to the bottom-right corner of the screen */
59 ui_wnd_place_bottom_right,
60 /** Place window to the center of the screen */
61 ui_wnd_place_center,
62 /** Place window accross the entire screen */
63 ui_wnd_place_full_screen,
64 /** Place window as a popup window adjacent to rectangle */
65 ui_wnd_place_popup
66} ui_wnd_placement_t;
67
68/** Window flags */
69typedef enum {
70 /** Popup window */
71 ui_wndf_popup = 0x1,
72 /** Window does not receive focus */
73 ui_wndf_nofocus = 0x2,
74 /** Topmost window */
75 ui_wndf_topmost = 0x4,
76 /** Special system window */
77 ui_wndf_system = 0x8,
78 /** Maximized windows should avoid this window */
79 ui_wndf_avoid = 0x10
80} ui_wnd_flags_t;
81
82/** Window parameters */
83typedef struct {
84 /** Window rectangle */
85 gfx_rect_t rect;
86 /** Minimum size to which window can be resized */
87 gfx_coord2_t min_size;
88 /** Window caption */
89 const char *caption;
90 /** Window decoration style */
91 ui_wdecor_style_t style;
92 /** Window placement */
93 ui_wnd_placement_t placement;
94 /** Window flags */
95 ui_wnd_flags_t flags;
96 /** Parent rectangle for popup windows */
97 gfx_rect_t prect;
98 /** Input device associated with the window's seat */
99 sysarg_t idev_id;
100} ui_wnd_params_t;
101
102/** Window callbacks */
103typedef struct ui_window_cb {
104 void (*sysmenu)(ui_window_t *, void *, sysarg_t);
105 void (*minimize)(ui_window_t *, void *);
106 void (*maximize)(ui_window_t *, void *);
107 void (*unmaximize)(ui_window_t *, void *);
108 void (*resize)(ui_window_t *, void *);
109 void (*close)(ui_window_t *, void *);
110 void (*focus)(ui_window_t *, void *, unsigned);
111 void (*kbd)(ui_window_t *, void *, kbd_event_t *);
112 errno_t (*paint)(ui_window_t *, void *);
113 void (*pos)(ui_window_t *, void *, pos_event_t *);
114 void (*unfocus)(ui_window_t *, void *, unsigned);
115} ui_window_cb_t;
116
117#endif
118
119/** @}
120 */
Note: See TracBrowser for help on using the repository browser.