#include "hmiworks.h"
#pragma GCC diagnostic ignored "-Wunused-variable"

static tWidget *thisCanvas = (tWidget *)&CanvasFrame3;
static tContext globalContext;
static tContext *thisContext = &globalContext;

#pragma GCC diagnostic warning "-Wunused-variable"


static void ConnectWidgetVariable();
static void DisconnectWidgetVariable();
static const unsigned char pucImage_BitButton24[] = 
{
    IMAGE_FMT_4BPP_COMP,
    71, 0,
    24, 0,

    4,
    0x00, 0x00, 0x00,
    0x64, 0x6f, 0x71,
    0x99, 0xa8, 0xac,
    0xd8, 0xe9, 0xec,
    0xff, 0xff, 0xff,

    0x1f, 0x44, 0x44, 0x44, 0xe9, 0xd4, 0xa7, 0x5f, 0x13, 0x07, 0x10, 0x43,
    0x33, 0x33, 0x33, 0xe9, 0xd4, 0xa7, 0xc7, 0x5f, 0x11, 0x32, 0x10, 0x43,
    0x07, 0x07, 0x77, 0x8f, 0x2c, 0x32, 0x10, 0x43, 0x07, 0x07, 0x77, 0x2c,
    0x1e, 0x32, 0x10, 0x43, 0x07, 0x07, 0x77, 0x2c, 0x32, 0x3c, 0x10, 0x43,
    0x07, 0x07, 0x77, 0x2c, 0x32, 0x10, 0x78, 0x43, 0x07, 0x07, 0x77, 0x2c,
    0x32, 0x10, 0x43, 0xf1, 0x07, 0x07, 0x77, 0x2c, 0x32, 0x10, 0x43, 0x04,
    0x1c, 0x30, 0x00, 0x00, 0xbf, 0x06, 0x75, 0x32, 0x10, 0x49, 0x43, 0x86,
    0x30, 0x03, 0x23, 0x30, 0x03, 0xbd, 0xc7, 0x62, 0x23, 0x32, 0x10, 0x43,
    0x35, 0x0a, 0x5a, 0x40, 0x00, 0xa1, 0x30, 0x00, 0x03, 0x33, 0x00, 0x03,
    0x20, 0x30, 0x03, 0x82, 0x33, 0x33, 0x32, 0x10, 0x43, 0x98, 0xc3, 0x30,
    0x03, 0x0a, 0xd2, 0x00, 0x00, 0x00, 0x42, 0x33, 0x0a, 0x30, 0x03, 0x30,
    0x00, 0x5a, 0x33, 0x0f, 0x33, 0x32, 0x10, 0x43, 0xc3, 0x72, 0x51, 0x59,
    0x0b, 0x00, 0x33, 0x00, 0x33, 0x11, 0x00, 0x61, 0xe1, 0x8c, 0x1a, 0x32,
    0x10, 0x43, 0xbb, 0x11, 0x00, 0x30, 0x4e, 0x03, 0xd1, 0x33, 0x00, 0xba,
    0xd9, 0xb1, 0x00, 0xc7, 0x89, 0x11, 0x32, 0x10, 0x43, 0xc3, 0x11, 0x2b,
    0xf1, 0xbf, 0x92, 0x59, 0x1a, 0x32, 0x10, 0x43, 0xc3, 0x1b, 0x33, 0x00,
    0x00, 0x19, 0x61, 0x30, 0xb9, 0xe1, 0x8c, 0xc1, 0x33, 0x00, 0x30, 0x81,
    0x11, 0x32, 0x10, 0x7c, 0x43, 0xc3, 0x9b, 0xb7, 0x6f, 0x23, 0x32, 0x10,
    0x78, 0x43, 0x07, 0x07, 0x77, 0x2c, 0x32, 0x10, 0x43, 0xf1, 0x07, 0x07,
    0x77, 0x2c, 0x32, 0x10, 0x43, 0x07, 0xe3, 0x07, 0x77, 0x2c, 0x32, 0x10,
    0x43, 0x07, 0x07, 0xc7, 0x77, 0x2c, 0x32, 0x10, 0x43, 0x07, 0x07, 0x77,
    0x81, 0x2c, 0x32, 0x10, 0x42, 0x22, 0x22, 0x22, 0xe9, 0xf0, 0xd4, 0xa7,
    0x5f, 0x12, 0x10, 0x11, 0x11, 0x11, 0xf8, 0xe9, 0xd4, 0xa7, 0x5f, 0x13,
    0x10,
};
static const unsigned char pucImagePress_BitButton24[] = 
{
    IMAGE_FMT_4BPP_COMP,
    71, 0,
    24, 0,

    4,
    0x00, 0x00, 0x00,
    0x64, 0x6f, 0x71,
    0x99, 0xa8, 0xac,
    0xd8, 0xe9, 0xec,
    0xff, 0xff, 0xff,

    0x1f, 0x11, 0x11, 0x11, 0xe9, 0xd4, 0xa7, 0x5f, 0x13, 0x07, 0x40, 0x12,
    0x22, 0x22, 0x22, 0xe9, 0xd4, 0xa7, 0xc1, 0x5f, 0x12, 0x40, 0x12, 0x33,
    0x33, 0x33, 0xe9, 0xf3, 0xd4, 0xa7, 0x5f, 0x12, 0x40, 0x12, 0x07, 0x07,
    0xcf, 0x77, 0x2d, 0x40, 0x12, 0x07, 0x07, 0x77, 0x2d, 0x3c, 0x40, 0x12,
    0x07, 0x07, 0x77, 0x2d, 0x40, 0x12, 0xf3, 0x07, 0x07, 0x77, 0x2d, 0x40,
    0x12, 0x07, 0x07, 0xc8, 0x77, 0x2d, 0x40, 0x12, 0x04, 0x30, 0x00, 0x00,
    0xe4, 0xbf, 0x06, 0xbe, 0x40, 0x12, 0x86, 0x30, 0x03, 0x9c, 0x23, 0x30,
    0x03, 0xbd, 0x62, 0x24, 0x40, 0x12, 0xe8, 0x35, 0x0a, 0x5a, 0x00, 0xa1,
    0x30, 0x00, 0x03, 0x06, 0x33, 0x00, 0x03, 0x30, 0x03, 0x82, 0x09, 0x40,
    0x4c, 0x12, 0xc3, 0x30, 0x03, 0x0a, 0xd2, 0x00, 0x00, 0x21, 0x00, 0x33,
    0x0a, 0x30, 0x03, 0x30, 0x00, 0x5a, 0x9e, 0x09, 0x40, 0x12, 0xc3, 0x72,
    0x51, 0x59, 0x00, 0x17, 0x33, 0x00, 0x33, 0x11, 0x00, 0x61, 0xe1, 0x1b,
    0x31, 0x40, 0x12, 0xbb, 0x11, 0x00, 0x30, 0x03, 0xd1, 0x3b, 0x33, 0x00,
    0xba, 0xd9, 0xb1, 0x00, 0x89, 0x12, 0x3f, 0x40, 0x12, 0xc3, 0x11, 0x2b,
    0xbf, 0x92, 0x59, 0x93, 0x1b, 0x40, 0x12, 0xc4, 0x00, 0x00, 0x19, 0x61,
    0x71, 0x30, 0xb9, 0xe1, 0xc1, 0x33, 0x00, 0x30, 0x81, 0x9f, 0x12, 0x40,
    0x12, 0xc4, 0x94, 0xa7, 0x5f, 0x12, 0x3c, 0x40, 0x12, 0x07, 0x07, 0x77,
    0x2d, 0x40, 0x12, 0xf3, 0x07, 0x07, 0x77, 0x2d, 0x40, 0x12, 0x07, 0x07,
    0xcf, 0x77, 0x2d, 0x40, 0x12, 0x07, 0x07, 0x77, 0x2d, 0x3c, 0x40, 0x12,
    0x07, 0x07, 0x77, 0x2d, 0x40, 0x12, 0xf0, 0x07, 0x07, 0x77, 0x2d, 0x40,
    0x44, 0x44, 0x44, 0xf8, 0xe9, 0xd4, 0xa7, 0x5f, 0x13, 0x40,
};

#include "__frame3.h"

Canvas(LabelWidget16, WIDGET_ROOT, 0, 0,
       HMI_DISPLAY_DRIVER_PTR, 0, 0, 240, 58,
       CANVAS_STYLE_TEXT | CANVAS_STYLE_FILL | CANVAS_STYLE_OUTLINE | CANVAS_STYLE_TEXT_OPAQUE
, 0x000000, 0x000000, 0xFFFFFF,
       &g_sFontCm22b, "TextPushButton Demo",
       0, 0);
Canvas(LabelWidget17, WIDGET_ROOT, 0, 0,
       HMI_DISPLAY_DRIVER_PTR, -1, 58, 242, 39,
       CANVAS_STYLE_TEXT | CANVAS_STYLE_FILL | CANVAS_STYLE_OUTLINE | CANVAS_STYLE_TEXT_OPAQUE
, 0x808080, 0x000000, 0xFFFFFF,
       &g_sFontCm18b, "To Change the Title",
       0, 0);
Canvas(LabelWidget18, WIDGET_ROOT, 0, 0,
       HMI_DISPLAY_DRIVER_PTR, -1, 95, 242, 226,
       CANVAS_STYLE_TEXT | CANVAS_STYLE_FILL | CANVAS_STYLE_OUTLINE | CANVAS_STYLE_TEXT_OPAQUE
, 0xC0C0C0, 0x000000, 0x000000,
       &g_sFontCm14, "",
       0, 0);
RectangularButton(TextPushButton20, WIDGET_ROOT, 0,
                  0, HMI_DISPLAY_DRIVER_PTR, 
                  7, 130, 224, 26,
                  (PB_STYLE_RELEASE_NOTIFY|PB_STYLE_OUTLINE | PB_STYLE_TEXT_OPAQUE | PB_STYLE_TEXT |
                   PB_STYLE_FILL), 0x808080, 0xFF0000, 0x000000, 0x000000,
                   &g_sFontCm16b, "ICPDAS", 0, 0, 0, 0, OnTextPushButton20Click);
RectangularButton(TextPushButton21, WIDGET_ROOT, 0,
                  0, HMI_DISPLAY_DRIVER_PTR, 
                  7, 164, 224, 26,
                  (PB_STYLE_RELEASE_NOTIFY|PB_STYLE_OUTLINE | PB_STYLE_TEXT_OPAQUE | PB_STYLE_TEXT |
                   PB_STYLE_FILL), 0x808080, 0xFF0000, 0x000000, 0x000000,
                   &g_sFontCm16b, "TouchPad", 0, 0, 0, 0, OnTextPushButton21Click);
RectangularButton(TextPushButton22, WIDGET_ROOT, 0,
                  0, HMI_DISPLAY_DRIVER_PTR, 
                  7, 198, 224, 26,
                  (PB_STYLE_RELEASE_NOTIFY|PB_STYLE_OUTLINE | PB_STYLE_TEXT_OPAQUE | PB_STYLE_TEXT |
                   PB_STYLE_FILL), 0x808080, 0xFF0000, 0x000000, 0x000000,
                   &g_sFontCm16b, "Hi~ICPDAS", 0, 0, 0, 0, OnTextPushButton22Click);
RectangularButton(TextPushButton23, WIDGET_ROOT, 0,
                  0, HMI_DISPLAY_DRIVER_PTR, 
                  7, 232, 224, 26,
                  (PB_STYLE_RELEASE_NOTIFY|PB_STYLE_OUTLINE | PB_STYLE_TEXT_OPAQUE | PB_STYLE_TEXT |
                   PB_STYLE_FILL), 0x808080, 0xFF0000, 0x000000, 0x000000,
                   &g_sFontCm16b, "ICPDAS Product", 0, 0, 0, 0, OnTextPushButton23Click);
RectangularButton(BitButton24, WIDGET_ROOT, 0, 0, HMI_DISPLAY_DRIVER_PTR,
80, 281, 71, 24, PB_STYLE_RELEASE_NOTIFY|PB_STYLE_FILL|PB_STYLE_IMG|PB_STYLE_TEXT, ClrSilver, ClrSilver, 0, ClrSilver,
&g_sFontCm20, "", pucImage_BitButton24, pucImagePress_BitButton24, 0, 0,
OnBitButton24Click);


Canvas(CanvasFrame3, WIDGET_ROOT, 0, 0, HMI_DISPLAY_DRIVER_PTR, 0, 0,
       240, 320, CANVAS_STYLE_APP_DRAWN, 0, 0, 0, 0, 0, 0, OnFrame38Paint);


void renderFrame38Vector(tContext *pContext, int ox, int oy) {
}
void OnFrame38Paint(tWidget *pWidget, tContext *pContext)
{
hmi_SetForeground(pContext, 0xFFFFFF);
hmi_FillRect(pContext, 0, 0, 240, 320);
renderFrame38Vector(pContext, 0, 0);
}


static void InitGlobalContext()
{
  GrContextInit(thisContext, thisCanvas->pDisplay);
  GrContextClipRegionSet(thisContext, &(thisCanvas->sPosition));
}
void InitWidget3()
{
    WidgetAdd(WIDGET_ROOT, (tWidget *)(&CanvasFrame3));
    WidgetAdd(WIDGET_ROOT, (tWidget *)&LabelWidget16);
    WidgetAdd(WIDGET_ROOT, (tWidget *)&LabelWidget17);
    WidgetAdd(WIDGET_ROOT, (tWidget *)&LabelWidget18);
    WidgetAdd(WIDGET_ROOT, (tWidget *)&TextPushButton20);
    WidgetAdd(WIDGET_ROOT, (tWidget *)&TextPushButton21);
    WidgetAdd(WIDGET_ROOT, (tWidget *)&TextPushButton22);
    WidgetAdd(WIDGET_ROOT, (tWidget *)&TextPushButton23);
    WidgetAdd(WIDGET_ROOT, (tWidget *)&BitButton24);
    InitGlobalContext();
    WidgetPaint(WIDGET_ROOT);
    ConnectWidgetVariable();
}

void FreeWidget3()
{
    DisconnectWidgetVariable();
    WidgetRemove((tWidget *)(&CanvasFrame3));
    WidgetRemove((tWidget *)(&LabelWidget16));
    WidgetRemove((tWidget *)(&LabelWidget17));
    WidgetRemove((tWidget *)(&LabelWidget18));
    WidgetRemove((tWidget *)(&TextPushButton20));
    WidgetRemove((tWidget *)(&TextPushButton21));
    WidgetRemove((tWidget *)(&TextPushButton22));
    WidgetRemove((tWidget *)(&TextPushButton23));
    WidgetRemove((tWidget *)(&BitButton24));
}


void OnTextPushButton20Click(tWidget *pWidget)
{
  hmi_PushButtonNormal(pWidget);
  TextPushButton20OnClick(pWidget);
}


void OnTextPushButton21Click(tWidget *pWidget)
{
  hmi_PushButtonNormal(pWidget);
  TextPushButton21OnClick(pWidget);
}


void OnTextPushButton22Click(tWidget *pWidget)
{
  hmi_PushButtonNormal(pWidget);
  TextPushButton22OnClick(pWidget);
}


void OnTextPushButton23Click(tWidget *pWidget)
{
  hmi_PushButtonNormal(pWidget);
  TextPushButton23OnClick(pWidget);
}


void OnBitButton24Click(tWidget *pWidget) 
{
  BitButton24OnClick(pWidget);
}


static void ConnectWidgetVariable()
{
  WidgetMessageQueueProcessEx(WIDGET_MSG_PAINT);
  if (_CurrentFrame != 3) return;
}

static void DisconnectWidgetVariable()
{
}

void _frame3()
{
  var_table_init();
  FreeCurrentFrame();
  _CurrentFrame = 3;
  InitWidget3();
}

