aboutsummaryrefslogtreecommitdiff
path: root/src/button.c
blob: 2f279d49ea404351043d7fd11ec54b5d13a224e1 (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
#include <glib.h>

#include "button.h"

Button *button_create(const char *text, PangoAlignment align)
{
	Button *btn = g_malloc0(sizeof(Button));
	btn->text = g_strdup(text);
	btn->align = align;
	return btn;
}

void button_set_colors(Button *btn, Color background, Color foreground, Color stroke)
{
	btn->background = background;
	btn->foreground = foreground;
	btn->stroke = stroke;
}

void button_set_action(Button *btn, ButtonAction action, gpointer data)
{
	btn->action = action;
	btn->action_data = data;
}

void button_destroy(Button *btn)
{
	g_free(btn->text);
	g_free(btn);
}