summaryrefslogtreecommitdiffstats
path: root/src/widget_data.h
blob: bc50900f6800581600703414658429cc98ba0687 (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
/*
 * 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_handlers.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[];
};

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 */