blob: 51f935a0cd1ddbc506ac93600ea5572f870f29e7 (
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
|
#include <stdlib.h>
#include <assert.h>
#include <stdlib.h>
#include "main.h"
#include "image.h"
#include "interface.h"
#include "font.h"
#include "widget.h"
#include "widget_image.h"
widget_t *wid_image_new(int x, int y, image_t *image)
{
widget_image_t *new;
new = malloc(sizeof(widget_image_t));
new->image = image;
return widget_new(WIDGET_TYPE_IMAGE, x, y, image->w, image->h, new);
}
void wid_image_draw(widget_t *widget)
{
widget_image_t *p;
assert(widget != NULL);
assert(widget->type == WIDGET_TYPE_IMAGE);
p = (widget_image_t *) widget->private_data;
image_draw(p->image, widget->x, widget->y, 0, 0, p->image->w, p->image->h);
}
void wid_image_event(widget_t *widget)
{
assert(widget != NULL);
assert(widget->type == WIDGET_TYPE_IMAGE);
}
void wid_image_destroy(widget_t *widget)
{
widget_image_t *p;
assert(widget != NULL);
assert(widget->type == WIDGET_TYPE_IMAGE);
p = (widget_image_t *) widget->private_data;
free(p);
widget_destroy(widget);
}
|