libxputty  0.1
A damn tiny abstraction Layer to create X11 window/widgets with cairo surfaces
xlistbox.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 XLISTBOX_H_
24 #define XLISTBOX_H_
25 
26 #include "xputty.h"
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
32 
33 /**
34  * @brief listbox_set_active_entry - set the active listbox entry
35  * @param *w_ - void pointer to the Widget_t listbox
36  * @param active - the active entry (int)
37  * @return void
38  */
39 
40 void listbox_set_active_entry(Widget_t *w, int active);
41 
42 /**
43  * @brief create_listbox_viewport - create a viewport on a listbox to a Widget_t
44  * @param *parent - pointer to the Widget_t the listbox 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_listbox_viewport(Widget_t *parent, int elem, int width, int height);
51 
52 /**
53  * @brief add_label - add a listbox to a Widget_t
54  * @param *parent - pointer to the Widget_t request the label
55  * @param *label - Label to show on the button
56  * @param x,y,width,height - the position/geometry to create the label
57  * @return Widget_t* - pointer to the Widget_t label struct
58  */
59 
60 Widget_t* add_listbox(Widget_t *parent, const char * label,
61  int x, int y, int width, int height);
62 
63 /**
64  * @brief listbox_add_entry - add a item to listbox
65  * @param *listbox - pointer to the Widget_t listbox
66  * @param *label - Label to show on the listbox
67  * @return Widget_t* - pointer to the Widget_t listbox_item struct
68  */
69 
70 Widget_t* listbox_add_entry(Widget_t *listbox, const char * label);
71 
72 #ifdef __cplusplus
73 }
74 #endif
75 
76 #endif //XLISTBOX_H_
xputty.h
create_listbox_viewport
Widget_t * create_listbox_viewport(Widget_t *parent, int elem, int width, int height)
create_listbox_viewport - create a viewport on a listbox to a Widget_t
Definition: xlistbox.c:33
listbox_set_active_entry
void listbox_set_active_entry(Widget_t *w, int active)
listbox_set_active_entry - set the active listbox entry
Definition: xlistbox.c:26
Widget_t
Widget_t - struct to hold the basic Widget_t info.
Definition: xwidget.h:298
listbox_add_entry
Widget_t * listbox_add_entry(Widget_t *listbox, const char *label)
listbox_add_entry - add a item to listbox
Definition: xlistbox.c:60
add_listbox
Widget_t * add_listbox(Widget_t *parent, const char *label, int x, int y, int width, int height)
add_label - add a listbox to a Widget_t
Definition: xlistbox.c:46