libxputty
0.1
A damn tiny abstraction Layer to create X11 window/widgets with cairo surfaces
xmenu.h
Go to the documentation of this file.
1
/*
2
* 0BSD
3
*
4
* BSD Zero Clause License
5
*
6
* Copyright (c) 2019 Hermann Meyer
7
*
8
* Permission to use, copy, modify, and/or distribute this software for any
9
* purpose with or without fee is hereby granted.
10
11
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
12
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
13
* AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
14
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
15
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
16
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17
* PERFORMANCE OF THIS SOFTWARE.
18
*
19
*/
20
21
#pragma once
22
23
#ifndef XMENU_H_
24
#define XMENU_H_
25
26
#include "
xputty.h
"
27
28
#ifdef __cplusplus
29
extern
"C"
{
30
#endif
31
32
33
/**
34
* @brief pop_menu_show - pop up a menu to a Widget_t
35
* @param *parent - pointer to the Widget_t the menu should pop over
36
* @param *menu - the menu to show
37
* @return void
38
*/
39
40
void
pop_menu_show
(
Widget_t
*parent,
Widget_t
*menu,
int
elem,
bool
above);
41
42
/**
43
* @brief create_viewport - create a viewport on a menu to a Widget_t
44
* @param *parent - pointer to the Widget_t the menu should pop over
45
* @param width - define the width of the viewport
46
* @param height - define the height of the viewport
47
* @return Widget_t* - pointer to the Widget_t viewport
48
*/
49
50
Widget_t
*
create_viewport
(
Widget_t
*parent,
int
width,
int
height);
51
52
/**
53
* @brief add_menu - add a menu to a Widget_t
54
* @param *parent - pointer to the Widget_t the menu should pop over
55
* @param *label - the label of the menu
56
* @param x,y,width,height - the position/geometry to create the menu
57
* @return Widget_t* - pointer to the Widget_t button struct
58
*/
59
60
Widget_t
*
add_menu
(
Widget_t
*parent,
const
char
* label,
61
int
x,
int
y,
int
width,
int
height);
62
63
/**
64
* @brief menu_add_entry - add a entry to menu
65
* @param *wid - pointer to the Widget_t menu
66
* @param *label - Label to show on the menu
67
* @return Widget_t* - pointer to the Widget_t menu_item struct
68
*/
69
70
Widget_t
*
menu_add_entry
(
Widget_t
*wid,
const
char
* label);
71
72
/**
73
* @brief menu_add_radio_entry- add a radio entry to menu
74
* @param *wid - pointer to the Widget_t menu
75
* @param *label - Label to show on the menu
76
* @return Widget_t* - pointer to the Widget_t menu_item struct
77
*/
78
79
Widget_t
*
menu_add_radio_entry
(
Widget_t
*wid,
const
char
* label);
80
81
/**
82
* @brief create_menu - create a menu to a Widget_t
83
* @param *parent - pointer to the Widget_t the menu should pop over
84
* @param height - define the height of a single menu item
85
* @return Widget_t* - pointer to the Widget_t button struct
86
*/
87
88
Widget_t
*
create_menu
(
Widget_t
*parent,
int
height);
89
90
/**
91
* @brief menu_add_item - add a item to menu
92
* @param *menu - pointer to the Widget_t menu
93
* @param *label - Label to show on the menu
94
* @return Widget_t* - pointer to the Widget_t menu_item struct
95
*/
96
97
Widget_t
*
menu_add_item
(
Widget_t
*menu,
const
char
* label);
98
99
/**
100
* @brief menu_add_accel_item - add a accel item to menu
101
* @param *menu - pointer to the Widget_t menu
102
* @param *label - Label to show on the menu
103
* @return Widget_t* - pointer to the Widget_t menu_item struct
104
*/
105
106
Widget_t
*
menu_add_accel_item
(
Widget_t
*menu,
const
char
* label);
107
108
/**
109
* @brief menu_add_check_item - add a item to menu
110
* @param *menu - pointer to the Widget_t menu
111
* @param *label - Label to show on the menu
112
* @return Widget_t* - pointer to the Widget_t menu_item struct
113
*/
114
115
Widget_t
*
menu_add_check_item
(
Widget_t
*menu,
const
char
* label);
116
117
/**
118
* @brief radio_item_set_active - activate selected radio item
119
* @param *w - the Widget_t to activate
120
* @return void
121
*/
122
123
void
radio_item_set_active
(
Widget_t
*w);
124
125
/**
126
* @brief menu_add_radio_item - add a radio item to menu
127
* @param *menu - pointer to the Widget_t menu
128
* @param *label - Label to show on the menu
129
* @return Widget_t* - pointer to the Widget_t menu_item struct
130
*/
131
132
Widget_t
*
menu_add_radio_item
(
Widget_t
*menu,
const
char
* label);
133
134
/**
135
* @brief menu_add_numeric_items - add numeric items from imin to imax to menu
136
* @param *menu - pointer to the Widget_t menu
137
* @param *imin - the low number of the numeric items
138
* @param *imax - the high number of the numeric items
139
* @return void
140
*/
141
142
void
menu_add_numeric_items
(
Widget_t
*menu,
int
*imin,
int
*imax);
143
144
#ifdef __cplusplus
145
}
146
#endif
147
148
#endif //XMENU_H_
menu_add_radio_item
Widget_t * menu_add_radio_item(Widget_t *menu, const char *label)
menu_add_radio_item - add a radio item to menu
Definition:
xmenu.c:183
menu_add_item
Widget_t * menu_add_item(Widget_t *menu, const char *label)
menu_add_item - add a item to menu
Definition:
xmenu.c:137
create_viewport
Widget_t * create_viewport(Widget_t *parent, int width, int height)
create_viewport - create a viewport on a menu to a Widget_t
Definition:
xmenu.c:40
xputty.h
menu_add_accel_item
Widget_t * menu_add_accel_item(Widget_t *menu, const char *label)
menu_add_accel_item - add a accel item to menu
Definition:
xmenu.c:156
menu_add_radio_entry
Widget_t * menu_add_radio_entry(Widget_t *wid, const char *label)
menu_add_radio_entry- add a radio entry to menu
Definition:
xmenu.c:98
menu_add_entry
Widget_t * menu_add_entry(Widget_t *wid, const char *label)
menu_add_entry - add a entry to menu
Definition:
xmenu.c:89
Widget_t
Widget_t - struct to hold the basic Widget_t info.
Definition:
xwidget.h:298
radio_item_set_active
void radio_item_set_active(Widget_t *w)
radio_item_set_active - activate selected radio item
Definition:
xmenu.c:171
add_menu
Widget_t * add_menu(Widget_t *parent, const char *label, int x, int y, int width, int height)
add_menu - add a menu to a Widget_t
Definition:
xmenu.c:69
pop_menu_show
void pop_menu_show(Widget_t *parent, Widget_t *menu, int elem, bool above)
pop_menu_show - pop up a menu to a Widget_t
Definition:
xmenu.c:26
menu_add_check_item
Widget_t * menu_add_check_item(Widget_t *menu, const char *label)
menu_add_check_item - add a item to menu
Definition:
xmenu.c:162
menu_add_numeric_items
void menu_add_numeric_items(Widget_t *menu, int *imin, int *imax)
menu_add_numeric_items - add numeric items from imin to imax to menu
Definition:
xmenu.c:193
create_menu
Widget_t * create_menu(Widget_t *parent, int height)
create_menu - create a menu to a Widget_t
Definition:
xmenu.c:107
libxputty
xputty
header
widgets
xmenu.h
Generated by
1.8.17