2014-05-11 20:22:13 +00:00
|
|
|
#include "gfx.h"
|
|
|
|
|
|
|
|
static GHandle ghContainer;
|
|
|
|
static GHandle ghButton;
|
|
|
|
|
|
|
|
static void createWidgets(void) {
|
|
|
|
GWidgetInit wi;
|
|
|
|
|
|
|
|
// Apply some default values for GWIN
|
|
|
|
gwinWidgetClearInit(&wi);
|
|
|
|
|
|
|
|
// Apply the container parameters
|
2018-06-23 03:02:07 +00:00
|
|
|
wi.g.show = gFalse;
|
2014-05-11 20:22:13 +00:00
|
|
|
wi.g.width = 200;
|
|
|
|
wi.g.height = 150;
|
|
|
|
wi.g.y = 10;
|
|
|
|
wi.g.x = 10;
|
|
|
|
wi.text = "Container";
|
|
|
|
ghContainer = gwinContainerCreate(0, &wi, GWIN_CONTAINER_BORDER);
|
2018-06-23 03:02:07 +00:00
|
|
|
wi.g.show = gTrue;
|
2014-05-11 20:22:13 +00:00
|
|
|
|
2014-09-26 06:30:53 +00:00
|
|
|
// Apply the button parameters
|
2014-05-11 20:22:13 +00:00
|
|
|
wi.g.width = 120;
|
|
|
|
wi.g.height = 30;
|
|
|
|
wi.g.y = 10;
|
|
|
|
wi.g.x = 10;
|
|
|
|
wi.text = "Button";
|
|
|
|
wi.g.parent = ghContainer;
|
|
|
|
ghButton = gwinButtonCreate(0, &wi);
|
|
|
|
|
|
|
|
// Make the container become visible - therefore all its children
|
|
|
|
// become visible as well
|
|
|
|
gwinShow(ghContainer);
|
|
|
|
}
|
|
|
|
|
|
|
|
int main(void) {
|
|
|
|
// Initialize the display
|
|
|
|
gfxInit();
|
|
|
|
|
|
|
|
// Set the widget defaults
|
|
|
|
gwinSetDefaultFont(gdispOpenFont("*"));
|
2018-06-23 03:02:07 +00:00
|
|
|
gwinSetDefaultStyle(&WhiteWidgetStyle, gFalse);
|
2018-03-10 10:36:12 +00:00
|
|
|
gdispClear(GFX_WHITE);
|
2014-05-11 20:22:13 +00:00
|
|
|
|
|
|
|
// Create the widget
|
|
|
|
createWidgets();
|
|
|
|
|
|
|
|
while(1) {
|
|
|
|
gfxSleepMilliseconds(1000);
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|