source: mainline/uspace/lib/ui/include/types/ui/wdecor.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.2 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 decoration
34 */
35
36#ifndef _UI_TYPES_WDECOR_H
37#define _UI_TYPES_WDECOR_H
38
39#include <gfx/coord.h>
40#include <types/common.h>
41#include <types/ui/cursor.h>
42
43struct ui_wdecor;
44typedef struct ui_wdecor ui_wdecor_t;
45
46/** Window decoration style */
47typedef enum {
48 /** No style bits */
49 ui_wds_none = 0x0,
50 /** Window has a frame */
51 ui_wds_frame = 0x1,
52 /** Window has a title bar */
53 ui_wds_titlebar = 0x2,
54 /** Window has a system menu */
55 ui_wds_sysmenu = 0x4,
56 /** Window has a minimize button */
57 ui_wds_minimize_btn = 0x8,
58 /** Window has a maximize button */
59 ui_wds_maximize_btn = 0x10,
60 /** Window has a close button */
61 ui_wds_close_btn = 0x20,
62 /** Window is resizable */
63 ui_wds_resizable = 0x40,
64 /** Window is decorated (default decoration) */
65 ui_wds_decorated = ui_wds_frame | ui_wds_titlebar | ui_wds_sysmenu |
66 ui_wds_minimize_btn | ui_wds_close_btn
67} ui_wdecor_style_t;
68
69/** Window resize type */
70typedef enum {
71 ui_wr_none = 0,
72
73 ui_wr_top = 0x1,
74 ui_wr_left = 0x2,
75 ui_wr_bottom = 0x4,
76 ui_wr_right = 0x8,
77
78 ui_wr_top_left = ui_wr_top | ui_wr_left,
79 ui_wr_bottom_left = ui_wr_bottom | ui_wr_left,
80 ui_wr_bottom_right = ui_wr_bottom | ui_wr_right,
81 ui_wr_top_right = ui_wr_top | ui_wr_right
82} ui_wdecor_rsztype_t;
83
84/** Window decoration callbacks */
85typedef struct ui_wdecor_cb {
86 void (*sysmenu)(ui_wdecor_t *, void *, sysarg_t);
87 void (*minimize)(ui_wdecor_t *, void *);
88 void (*maximize)(ui_wdecor_t *, void *);
89 void (*unmaximize)(ui_wdecor_t *, void *);
90 void (*close)(ui_wdecor_t *, void *);
91 void (*move)(ui_wdecor_t *, void *, gfx_coord2_t *, sysarg_t);
92 void (*resize)(ui_wdecor_t *, void *, ui_wdecor_rsztype_t,
93 gfx_coord2_t *, sysarg_t);
94 void (*set_cursor)(ui_wdecor_t *, void *, ui_stock_cursor_t);
95} ui_wdecor_cb_t;
96
97#endif
98
99/** @}
100 */
Note: See TracBrowser for help on using the repository browser.