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

ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since 1af103e was 1af103e, checked in by Jiri Svoboda <jiri@…>, 2 years ago

System menu (WIP)

The system menu provides browsable, keyboard-accessible access to window
management functions (such as closing, minimizing, maximizing, resizing,
moving).

  • Property mode set to 100644
File size: 3.6 KB
Line 
1/*
2 * Copyright (c) 2023 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 accross the entire screen */
61 ui_wnd_place_full_screen,
62 /** Place window as a popup window adjacent to rectangle */
63 ui_wnd_place_popup
64} ui_wnd_placement_t;
65
66/** Window flags */
67typedef enum {
68 /** Popup window */
69 ui_wndf_popup = 0x1,
70 /** Topmost window */
71 ui_wndf_topmost = 0x2,
72 /** Special system window */
73 ui_wndf_system = 0x4,
74 /** Maximized windows should avoid this window */
75 ui_wndf_avoid = 0x8
76} ui_wnd_flags_t;
77
78/** Window parameters */
79typedef struct {
80 /** Window rectangle */
81 gfx_rect_t rect;
82 /** Window caption */
83 const char *caption;
84 /** Window decoration style */
85 ui_wdecor_style_t style;
86 /** Window placement */
87 ui_wnd_placement_t placement;
88 /** Window flags */
89 ui_wnd_flags_t flags;
90 /** Parent rectangle for popup windows */
91 gfx_rect_t prect;
92 /** Input device associated with the window's seat */
93 sysarg_t idev_id;
94} ui_wnd_params_t;
95
96/** Window callbacks */
97typedef struct ui_window_cb {
98 void (*sysmenu)(ui_window_t *, void *, sysarg_t);
99 void (*minimize)(ui_window_t *, void *);
100 void (*maximize)(ui_window_t *, void *);
101 void (*unmaximize)(ui_window_t *, void *);
102 void (*close)(ui_window_t *, void *);
103 void (*focus)(ui_window_t *, void *, unsigned);
104 void (*kbd)(ui_window_t *, void *, kbd_event_t *);
105 errno_t (*paint)(ui_window_t *, void *);
106 void (*pos)(ui_window_t *, void *, pos_event_t *);
107 void (*unfocus)(ui_window_t *, void *, unsigned);
108} ui_window_cb_t;
109
110#endif
111
112/** @}
113 */
Note: See TracBrowser for help on using the repository browser.