EasyGUI
gui_dropdown.h
1 
6 /*
7  * Copyright (c) 2019 Tilen MAJERLE
8  *
9  * Permission is hereby granted, free of charge, to any person
10  * obtaining a copy of this software and associated documentation
11  * files (the "Software"), to deal in the Software without restriction,
12  * including without limitation the rights to use, copy, modify, merge,
13  * publish, distribute, sublicense, and/or sell copies of the Software,
14  * and to permit persons to whom the Software is furnished to do so,
15  * subject to the following conditions:
16  *
17  * The above copyright notice and this permission notice shall be
18  * included in all copies or substantial portions of the Software.
19  *
20  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
22  * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
23  * AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
24  * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
25  * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27  * OTHER DEALINGS IN THE SOFTWARE.
28  *
29  * This file is part of EasyGUI library.
30  *
31  * Author: Tilen Majerle <tilen@majerle.eu>
32  */
33 #ifndef GUI_HDR_DROPDOWN_H
34 #define GUI_HDR_DROPDOWN_H
35 
36 /* C++ detection */
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
40 
45 #include "gui_widget.h"
46 
56 typedef enum {
64 
68 typedef enum {
72 
73 gui_handle_p gui_dropdown_create(gui_id_t id, float x, float y, float width, float height, gui_handle_p parent, gui_widget_evt_fn evt_fn, uint16_t flags);
74 uint8_t gui_dropdown_setcolor(gui_handle_p h, gui_dropdown_color_t index, gui_color_t color);
75 uint8_t gui_dropdown_addstring(gui_handle_p h, const gui_char* text);
76 uint8_t gui_dropdown_deletefirststring(gui_handle_p h);
77 uint8_t gui_dropdown_deletelaststring(gui_handle_p h);
78 uint8_t gui_dropdown_deletestring(gui_handle_p h, uint16_t index);
79 uint8_t gui_dropdown_setstring(gui_handle_p h, uint16_t index, const gui_char* text);
80 uint8_t gui_dropdown_setselection(gui_handle_p h, int16_t selection);
81 int16_t gui_dropdown_getselection(gui_handle_p h);
82 uint8_t gui_dropdown_setsliderauto(gui_handle_p h, uint8_t autoMode);
83 uint8_t gui_dropdown_setslidervisibility(gui_handle_p h, uint8_t visible);
84 uint8_t gui_dropdown_scroll(gui_handle_p h, int16_t step);
85 uint8_t gui_dropdown_setopendirection(gui_handle_p h, gui_dropdown_opendir_t dir);
86 
95 /* C++ detection */
96 #ifdef __cplusplus
97 }
98 #endif
99 
100 #endif /* GUI_HDR_DROPDOWN_H */
gui_handle_p gui_dropdown_create(gui_id_t id, float x, float y, float width, float height, gui_handle_p parent, gui_widget_evt_fn evt_fn, uint16_t flags)
Create new dropdown widget.
Definition: gui_dropdown.c:509
uint8_t gui_dropdown_addstring(gui_handle_p h, const gui_char *text)
Add a new string to list box.
Definition: gui_dropdown.c:532
Definition: gui_dropdown.h:61
uint8_t(* gui_widget_evt_fn)(gui_handle_p h, gui_widget_evt_t evt, gui_evt_param_t *const param, gui_evt_result_t *const result)
Callback function for widget.
Definition: gui_defs.h:1103
Definition: gui_dropdown.h:59
uint8_t gui_dropdown_setcolor(gui_handle_p h, gui_dropdown_color_t index, gui_color_t color)
Set color to DROPDOWN.
Definition: gui_dropdown.c:521
uint8_t gui_dropdown_deletelaststring(gui_handle_p h)
Delete last string from list.
Definition: gui_dropdown.c:620
uint8_t gui_char
Definition: gui_defs.h:212
uint32_t gui_color_t
Definition: gui_defs.h:210
Definition: gui_dropdown.h:60
uint8_t gui_dropdown_setselection(gui_handle_p h, int16_t selection)
Set selected value.
Definition: gui_dropdown.c:660
uint8_t gui_dropdown_scroll(gui_handle_p h, int16_t step)
Scroll list if possible.
Definition: gui_dropdown.c:645
int16_t gui_dropdown_getselection(gui_handle_p h)
Get selected value.
Definition: gui_dropdown.c:678
Definition: gui_dropdown.h:70
uint8_t gui_dropdown_setstring(gui_handle_p h, uint16_t index, const gui_char *text)
Set string value to already added string index.
Definition: gui_dropdown.c:587
Definition: gui_dropdown.h:57
Definition: gui_dropdown.h:58
gui_dropdown_color_t
List of dropdown colors.
Definition: gui_dropdown.h:56
uint8_t gui_dropdown_deletefirststring(gui_handle_p h)
Delete first string from list.
Definition: gui_dropdown.c:609
uint8_t gui_dropdown_deletestring(gui_handle_p h, uint16_t index)
Delete specific entry from list.
Definition: gui_dropdown.c:633
gui_dropdown_opendir_t
Dropdown open direction.
Definition: gui_dropdown.h:68
Definition: gui_dropdown.h:62
uint8_t gui_dropdown_setopendirection(gui_handle_p h, gui_dropdown_opendir_t dir)
Set opening direction for dropdown list.
Definition: gui_dropdown.c:559
uint32_t gui_id_t
Definition: gui_defs.h:209
Definition: gui_dropdown.h:69