aboutsummaryrefslogtreecommitdiffstats
path: root/demos/modules/gwin/frame/main.c
blob: ebfeaa6ed786218a32e9226dc733502133ea5172 (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
#include "gfx.h"

static GListener    gl;
static GHandle      ghFrame1;

static void createWidgets(void) {
    GWidgetInit wi;

    // Apply some default values for GWIN
    gwinWidgetClearInit(&wi);
    wi.g.show = TRUE;

    // Apply the frame parameters    
    wi.g.width = 400;
    wi.g.height = 300;
    wi.g.y = 10;
    wi.g.x = 10;
    wi.text = "Frame 1";

    ghFrame1 = gwinFrameCreate(0, &wi, GWIN_FRAME_BORDER | GWIN_FRAME_CLOSE_BTN | GWIN_FRAME_MINMAX_BTN);
}

int main(void) {
    // Initialize the display
    gfxInit();

    // Attach the mouse input
    gwinAttachMouse(0);

    // Set the widget defaults
    gwinSetDefaultFont(gdispOpenFont("*"));
    gwinSetDefaultStyle(&WhiteWidgetStyle, FALSE);
    gdispClear(White);

    // create the widget
    createWidgets();

    // We want to listen for widget events
    geventListenerInit(&gl);
    gwinAttachListener(&gl);

    while(1) {
    	gfxSleepMilliseconds(1000);
    }

    return 0;
}