forked from FIPress/GoUI
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbridge.c
More file actions
74 lines (58 loc) · 1.27 KB
/
bridge.c
File metadata and controls
74 lines (58 loc) · 1.27 KB
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
#ifndef _BRIDGE_
#define _BRIDGE_
#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
typedef enum MenuType {
container, //just a container item for sub items
custom,
standard,
separator
} MenuType;
typedef struct WindowSettings{
const char* title;
const char* webDir;
//const char* absPath;
const char* index;
const char* url;
int left;
int top;
int width;
int height;
int resizable;
int debug;
} WindowSettings;
typedef struct MenuDef{
const char* title;
const char* action;
const char* key;
struct MenuDef* children;
int childrenCount;
MenuType menuType;
} MenuDef;
static MenuDef* allocMenuDefArray(int count) {
if(count == 0) {
return NULL;
}
return (MenuDef*)malloc(sizeof(MenuDef)*count);
}
static void addChildMenu(MenuDef* children, MenuDef child, int index) {
children[index] = child;
}
extern void goLog(const char *s);
static const int bufSize = 512;
static void logging(const char *format, ...) {
char buf[bufSize];
va_list args;
va_start(args,format);
int len = vsnprintf(buf,bufSize, format,args);
if(len < bufSize) {
goLog(buf);
} else {
char tempBuf[len+1];
vsnprintf(tempBuf,len+1, format,args);
goLog(tempBuf);
}
va_end(args);
}
#endif