summaryrefslogtreecommitdiff
path: root/src/bdm.h
blob: 604491d8587e17546801fd71335f95cf3d4be7ca (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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
#include <string.h>
#include <gtk/gtk.h>
#include <gdk/gdk.h>
#include <gdk/gdkx.h>
#include <gdk/gdkprivate.h>
#include <cairo/cairo.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

//quinn was here
#define NEW(a,b) a * b ;\
	b = malloc(sizeof(a));\
	memset((b),0,sizeof(a));

#define TEXT_STYLE_NORMAL		(1 << 0)
#define TEXT_STYLE_BOLD			(1 << 1)
#define TEXT_STYLE_ITALIC		(1 << 2)

typedef enum
{
	WALLPAPER_TYPE_PIXBUF,
	WALLPAPER_TYPE_COUNT
} WallpaperType;

typedef struct _PixbufWallpaper
{
	GdkPixbuf * source;
	int width;
	int height;
} PixbufWallpaper;

typedef union _WallUnion
{
	PixbufWallpaper pixbuf;
} WallUnion;

typedef struct _Wallpaper
{
	WallpaperType type;
	WallUnion data;
} Wallpaper;

typedef struct _ScreenArea
{
	int width;
	int height;
	Wallpaper * wallpaper;
	GtkWidget * window;
	float  alpha;
} ScreenArea;


//Widget engine

/*
* Let me provide an explanation of how this is supposed to work:
*	Each widget will be a library, and will have the functions defined in bdm-widget.h.
*
* At load time init is called at which point a widget should make a BDMImage for each image it plans to render, likewise for text objects. At
* that point BDM will then call getNumImages, getImages, likewise for text. At each paint the following happens:
	For each widget paint each BDMImage and BDMText based on it's current BDMPaintAttribs
	Call (*widget)->update() which will modify the BDMPaintAttribs of it's components based on information it gathers or has gathered through whatever interesting means it has of doing so.
*/

typedef struct _BDMPaintAttribs
{
	int width;
	int height;
	
	int x;
	int y;
	
	double xrot;
	
	int alpha;

	int needsPainting;
} BDMPaintAttribs;

typedef struct _BDMImage BDMImage;
typedef struct _BDMWidget BDMWidget;
struct _BDMImage
{
	BDMPaintAttribs * attrib;
	BDMImage * next;
	BDMImage * prev;
	
	GdkPixbuf * pixbuf;
	BDMWidget * widget;
	int pixW;
	int pixH;
} ;

typedef struct _BDMText BDMText;

struct _BDMText
{
	BDMPaintAttribs * attrib;
	BDMText *next;
	BDMText *prev;
	
	char * text;
	BDMWidget * widget;

	char *family;
	int size;
	unsigned short color[4];
	unsigned int style;
} ;

typedef struct _BDMEvent
{
	GdkEvent * event;
	// Add more useful stuff
} BDMEvent;

typedef int (*BDMWidgetInitProc) (void);
typedef int (*BDMWidgetFiniProc) (void);
typedef int (*BDMWidgetUpdateProc) (void);

typedef int (*BDMWidgetNumImagesProc) (void);
typedef BDMImage * (*BDMWidgetGetImagesProc) (void);

typedef int (*BDMWidgetNumTextProc) (void);
typedef BDMText * (*BDMWidgetGetTextProc) (void);

typedef int (*BDMWidgetHandleEventProc) (BDMEvent *event);

typedef void (*BDMWidgetSetBDMWidgetProc) (BDMWidget * widget);

struct _BDMWidget
{
	BDMPaintAttribs * attrib;
	BDMImage * images;
	BDMText * text;
	BDMWidget * next;
	BDMWidget * prev;
	
	BDMWidgetInitProc initWidget;
	BDMWidgetFiniProc finiWidget;
	BDMWidgetUpdateProc updateWidget;
	
	BDMWidgetNumImagesProc numImages;
	BDMWidgetGetImagesProc getImages;
	
	BDMWidgetNumTextProc numText;
	BDMWidgetGetTextProc getText;
	
	BDMWidgetHandleEventProc handleEvent;
	BDMWidgetSetBDMWidgetProc setBDMWidget;
	
};

typedef struct _BDMWidgetList
{
	BDMWidget * head;
	BDMWidget * tail;
	BDMWidget * next;
	BDMWidget * prev;
} BDMWidgetList;



GSList * Wallpapers=NULL;