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

Last change on this file was 8d1bcd7, checked in by Jiri Svoboda <jiri@…>, 2 years ago

Handover between system menu and menu bar

We can move between them using Left and Right keys in either closed
or open state. One can now open system menu with F10, Left, Down in
a window with menu bar, or just F10 in a window without menu bar.

  • Property mode set to 100644
File size: 3.4 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 handle */
55 ui_wds_sysmenu_hdl = 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_hdl |
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_open)(ui_wdecor_t *, void *, sysarg_t);
87 void (*sysmenu_left)(ui_wdecor_t *, void *, sysarg_t);
88 void (*sysmenu_right)(ui_wdecor_t *, void *, sysarg_t);
89 void (*sysmenu_accel)(ui_wdecor_t *, void *, char32_t, sysarg_t);
90 void (*minimize)(ui_wdecor_t *, void *);
91 void (*maximize)(ui_wdecor_t *, void *);
92 void (*unmaximize)(ui_wdecor_t *, void *);
93 void (*close)(ui_wdecor_t *, void *);
94 void (*move)(ui_wdecor_t *, void *, gfx_coord2_t *, sysarg_t);
95 void (*resize)(ui_wdecor_t *, void *, ui_wdecor_rsztype_t,
96 gfx_coord2_t *, sysarg_t);
97 void (*set_cursor)(ui_wdecor_t *, void *, ui_stock_cursor_t);
98} ui_wdecor_cb_t;
99
100#endif
101
102/** @}
103 */
Note: See TracBrowser for help on using the repository browser.