summaryrefslogtreecommitdiffstats
path: root/src/ui_widgets.h
blob: a32eea3d6140e9339ed32ae77f5e25b76b4a94a4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
/*
 * function and data types for widgets
 *
 * Copyright (c) 2015 Ultimaker B.V.
 * Author: Olliver Schinagl <o.schinagl@ultimaker.com>
 *
 * SPDX-License-Identifier:	AGPL-3.0+
 */

#ifndef _WIDGET_DATA_H
#define _WIDGET_DATA_H

#include <Ecore.h>
#include <Eina.h>
#include <Evas.h>
#include <stdint.h>

#include "dbus_common.h"
#include "eulogium_item_list.h"

struct button_cb {
	void (*func)(void *data, Evas_Object *object, void *event_info);
	void *data;
	const char *info;
};

struct button_def {
	const char *text;
	struct button_cb cb;
	void *data;
};

struct dir_entry_def {
	void *data;
	char *path;
};

struct wifi_entry_def {
	void *data;
	char *ssid;
};

struct menu_entry_def {
	const char *icon;
	const char *label;
	struct list_item item;
	struct dbus_handle dbus;
	Eina_Bool *end; /* remove me */
	const char *footer; /* Primary footer */
	const char *footer_alt; /* Alternating footer */
	Ecore_Timer *toggle_timer;
	void (*func)(void *data, Evas_Object *object, void *event_info);
	void *data;
};

enum list_type {
	LIST_MENU,
	LIST_FILE,
	LIST_WIFI,
};

struct menu_def {
	const char *title;
	enum list_type type;
	void *data;
	struct dir_entry_def dir;
	struct wifi_entry_def wifi; /* TODO see if we can put this into a union somehow */
	struct menu_entry_def entry[];
};

struct settings_dial_data {
	const char *label;
	double step;
	double min;
	double max;
	double value;
	double value_actual;
	char *(*indicator_func)(double value);
	void (*free_func)(char *str);
	const char *format;
	Evas_Object *slider;
};

struct screen_def {
	const char *title;
	Evas_Object *widget;
	struct settings_dial_data screen[];
};

extern int INPUT_MOUSE_WHEEL_UP;
extern int INPUT_MOUSE_WHEEL_UP;

void eulogium_button_cb_set(struct button_def *button, struct button_cb *cb);
void eulogium_button_cb_data_set(struct button_def *button, void *data);
void eulogium_button_data_set(struct button_def *button, void *data);

#endif /* _WIDGET_DATA_H */