#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_BitButton37[] = 
{
    IMAGE_FMT_4BPP_COMP,
    102, 0,
    35, 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, 0x17, 0x80, 0x07, 0x44,
    0x44, 0x41, 0x43, 0x33, 0x33, 0x33, 0xfc, 0xe9, 0xd4, 0xa7, 0x5f, 0x17,
    0x07, 0x33, 0x21, 0x7e, 0x43, 0x07, 0x07, 0x77, 0x2f, 0x07, 0x02, 0x21,
    0x7e, 0x43, 0x07, 0x07, 0x77, 0x2f, 0x07, 0x02, 0x21, 0x7e, 0x43, 0x07,
    0x07, 0x77, 0x2f, 0x07, 0x02, 0x21, 0x7e, 0x43, 0x07, 0x07, 0x77, 0x2f,
    0x07, 0x02, 0x21, 0x7e, 0x43, 0x07, 0x07, 0x77, 0x2f, 0x07, 0x02, 0x21,
    0x7e, 0x43, 0x07, 0x07, 0x77, 0x2f, 0x07, 0x02, 0x21, 0x7e, 0x43, 0x07,
    0x07, 0x77, 0x2f, 0x07, 0x02, 0x21, 0x7e, 0x43, 0x07, 0x07, 0x77, 0x2f,
    0x07, 0x02, 0x21, 0x7e, 0x43, 0x07, 0x07, 0x77, 0x2f, 0x07, 0x02, 0x21,
    0x7e, 0x43, 0x07, 0x07, 0x77, 0x2f, 0x07, 0x02, 0x21, 0x7e, 0x43, 0x07,
    0x07, 0x77, 0x2f, 0x07, 0x02, 0x21, 0x7e, 0x43, 0x07, 0x07, 0x77, 0x2f,
    0x07, 0x02, 0x21, 0x63, 0x43, 0x07, 0x03, 0x00, 0x00, 0x03, 0xbf, 0x35,
    0x66, 0x30, 0xbe, 0x85, 0x21, 0x43, 0x87, 0x0d, 0x00, 0xbc, 0x04, 0x00,
    0xbe, 0x62, 0x07, 0x22, 0x21, 0x43, 0xd0, 0x87, 0x02, 0x00, 0xdb, 0x03,
    0x33, 0x33, 0x30, 0x43, 0x03, 0xa1, 0x00, 0x00, 0x33, 0x30, 0xd1, 0xa1,
    0xcd, 0x06, 0x0a, 0x21, 0x43, 0x8f, 0x42, 0x00, 0x19, 0x20, 0x30, 0x03,
    0xd1, 0x30, 0x00, 0x00, 0x03, 0x30, 0x2e, 0x33, 0x00, 0xa2, 0x00, 0x5a,
    0x05, 0xb2, 0x21, 0x61, 0x43, 0x87, 0x3a, 0x00, 0x33, 0x00, 0x03, 0xe1,
    0x00, 0x33, 0x33, 0x30, 0x03, 0x30, 0x03, 0x33, 0x00, 0x79, 0x00, 0xd9,
    0x71, 0x07, 0xbb, 0x21, 0x43, 0x87, 0x83, 0x3a, 0x00, 0x33, 0x30, 0x03,
    0x00, 0xd1, 0xc9, 0xc7, 0xb9, 0xda, 0x33, 0x30, 0x00, 0x89, 0x06, 0xb2,
    0x30, 0x21, 0x43, 0x87, 0x3a, 0x00, 0x33, 0x30, 0x03, 0x1b, 0x00, 0x30,
    0x03, 0xbf, 0x93, 0x00, 0x07, 0xbb, 0x31, 0x21, 0x43, 0x87, 0x3a, 0x30,
    0x00, 0x00, 0xe1, 0xa0, 0x01, 0x00, 0xb9, 0x00, 0x00, 0x03, 0x33, 0x00,
    0x1c, 0x03, 0x30, 0x03, 0x82, 0x05, 0xb2, 0x21, 0x43, 0xfc, 0x87, 0x3f,
    0x77, 0x2f, 0x07, 0x02, 0x21, 0x43, 0xfc, 0x07, 0x07, 0x77, 0x2f, 0x07,
    0x02, 0x21, 0x43, 0xfc, 0x07, 0x07, 0x77, 0x2f, 0x07, 0x02, 0x21, 0x43,
    0xfc, 0x07, 0x07, 0x77, 0x2f, 0x07, 0x02, 0x21, 0x43, 0xfc, 0x07, 0x07,
    0x77, 0x2f, 0x07, 0x02, 0x21, 0x43, 0xfc, 0x07, 0x07, 0x77, 0x2f, 0x07,
    0x02, 0x21, 0x43, 0xfc, 0x07, 0x07, 0x77, 0x2f, 0x07, 0x02, 0x21, 0x43,
    0xfc, 0x07, 0x07, 0x77, 0x2f, 0x07, 0x02, 0x21, 0x43, 0xfc, 0x07, 0x07,
    0x77, 0x2f, 0x07, 0x02, 0x21, 0x43, 0xfc, 0x07, 0x07, 0x77, 0x2f, 0x07,
    0x02, 0x21, 0x43, 0xfc, 0x07, 0x07, 0x77, 0x2f, 0x07, 0x02, 0x21, 0x42,
    0x1f, 0x22, 0x22, 0x22, 0xe9, 0xd4, 0xa7, 0x5f, 0x17, 0x83, 0x07, 0x22,
    0x21, 0x11, 0x11, 0x11, 0xe9, 0xd4, 0xf8, 0xa7, 0x5f, 0x17, 0x07, 0x01,
};
static const unsigned char pucImagePress_BitButton37[] = 
{
    IMAGE_FMT_4BPP_COMP,
    102, 0,
    35, 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, 0x17, 0x80, 0x07, 0x11,
    0x11, 0x14, 0x12, 0x22, 0x22, 0x22, 0xfc, 0xe9, 0xd4, 0xa7, 0x5f, 0x17,
    0x07, 0x22, 0x24, 0x0f, 0x12, 0x33, 0x33, 0x33, 0xe9, 0xd4, 0xa7, 0x5f,
    0xc7, 0x17, 0x07, 0x33, 0x34, 0x12, 0x07, 0x07, 0x77, 0xe7, 0x2f, 0x07,
    0x02, 0x34, 0x12, 0x07, 0x07, 0x77, 0xe7, 0x2f, 0x07, 0x02, 0x34, 0x12,
    0x07, 0x07, 0x77, 0xe7, 0x2f, 0x07, 0x02, 0x34, 0x12, 0x07, 0x07, 0x77,
    0xe7, 0x2f, 0x07, 0x02, 0x34, 0x12, 0x07, 0x07, 0x77, 0xe7, 0x2f, 0x07,
    0x02, 0x34, 0x12, 0x07, 0x07, 0x77, 0xe7, 0x2f, 0x07, 0x02, 0x34, 0x12,
    0x07, 0x07, 0x77, 0xe7, 0x2f, 0x07, 0x02, 0x34, 0x12, 0x07, 0x07, 0x77,
    0xe7, 0x2f, 0x07, 0x02, 0x34, 0x12, 0x07, 0x07, 0x77, 0xe7, 0x2f, 0x07,
    0x02, 0x34, 0x12, 0x07, 0x07, 0x77, 0xe7, 0x2f, 0x07, 0x02, 0x34, 0x12,
    0x07, 0x07, 0x77, 0xe6, 0x2f, 0x07, 0x02, 0x34, 0x12, 0x07, 0x03, 0x00,
    0x36, 0x00, 0x03, 0xbf, 0x35, 0x30, 0xbe, 0x85, 0x34, 0x6b, 0x12, 0x87,
    0x0d, 0x00, 0x04, 0x00, 0xbe, 0x62, 0xcd, 0x07, 0x22, 0x34, 0x12, 0x87,
    0x02, 0x00, 0xdb, 0x04, 0x03, 0x33, 0x33, 0x30, 0x03, 0xa1, 0x00, 0x00,
    0x3c, 0x33, 0x30, 0xd1, 0xa1, 0x06, 0x0a, 0x34, 0x12, 0xd2, 0x8f, 0x42,
    0x00, 0x19, 0x30, 0x03, 0xd1, 0x30, 0x02, 0x00, 0x00, 0x03, 0x30, 0x33,
    0x00, 0xa2, 0x00, 0xe6, 0x5a, 0x05, 0xb2, 0x34, 0x12, 0x87, 0x3a, 0x00,
    0x10, 0x33, 0x00, 0x03, 0xe1, 0x33, 0x33, 0x30, 0x03, 0x07, 0x30, 0x03,
    0x33, 0x00, 0x00, 0xd9, 0x71, 0x07, 0x98, 0xbb, 0x34, 0x12, 0x87, 0x3a,
    0x00, 0x33, 0x30, 0x3c, 0x03, 0x00, 0xd1, 0xc9, 0xb9, 0xda, 0x33, 0x30,
    0x73, 0x00, 0x89, 0x06, 0xb2, 0x34, 0x12, 0x87, 0x3a, 0x01, 0x00, 0x33,
    0x30, 0x03, 0x00, 0x30, 0x03, 0xbf, 0xb3, 0x93, 0x00, 0x07, 0xbb, 0x34,
    0x12, 0x87, 0x3a, 0x1a, 0x30, 0x00, 0x00, 0xe1, 0x01, 0x00, 0xb9, 0x00,
    0x01, 0x00, 0x03, 0x33, 0x00, 0x03, 0x30, 0x03, 0x82, 0xcf, 0x05, 0xb2,
    0x34, 0x12, 0x87, 0x3f, 0x77, 0x2f, 0xcf, 0x07, 0x02, 0x34, 0x12, 0x07,
    0x07, 0x77, 0x2f, 0xcf, 0x07, 0x02, 0x34, 0x12, 0x07, 0x07, 0x77, 0x2f,
    0xcf, 0x07, 0x02, 0x34, 0x12, 0x07, 0x07, 0x77, 0x2f, 0xcf, 0x07, 0x02,
    0x34, 0x12, 0x07, 0x07, 0x77, 0x2f, 0xcf, 0x07, 0x02, 0x34, 0x12, 0x07,
    0x07, 0x77, 0x2f, 0xcf, 0x07, 0x02, 0x34, 0x12, 0x07, 0x07, 0x77, 0x2f,
    0xcf, 0x07, 0x02, 0x34, 0x12, 0x07, 0x07, 0x77, 0x2f, 0xcf, 0x07, 0x02,
    0x34, 0x12, 0x07, 0x07, 0x77, 0x2f, 0xcf, 0x07, 0x02, 0x34, 0x12, 0x07,
    0x07, 0x77, 0x2f, 0xcf, 0x07, 0x02, 0x34, 0x12, 0x07, 0x07, 0x77, 0x2f,
    0xcf, 0x07, 0x02, 0x34, 0x12, 0x07, 0x07, 0x77, 0x2f, 0xc3, 0x07, 0x02,
    0x34, 0x44, 0x44, 0x44, 0xe9, 0xd4, 0xf8, 0xa7, 0x5f, 0x17, 0x07, 0x01,
};

#include "__frame3.h"

Canvas(LabelWidget31, 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(LabelWidget32, 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, "Change the Title Color",
       0, 0);
RectangularButton(TextPushButton33, WIDGET_ROOT, 0,
                  0, HMI_DISPLAY_DRIVER_PTR, 
                  8, 255, 102, 35,
                  (PB_STYLE_RELEASE_NOTIFY|PB_STYLE_OUTLINE | PB_STYLE_TEXT_OPAQUE | PB_STYLE_TEXT |
                   PB_STYLE_FILL), 0x008000, 0xFF0000, 0x000000, 0xFFFFFF,
                   &g_sFontCm18b, "Green", 0, 0, 0, 0, OnTextPushButton33Click);
RectangularButton(TextPushButton34, WIDGET_ROOT, 0,
                  0, HMI_DISPLAY_DRIVER_PTR, 
                  8, 213, 102, 35,
                  (PB_STYLE_RELEASE_NOTIFY|PB_STYLE_OUTLINE | PB_STYLE_TEXT_OPAQUE | PB_STYLE_TEXT |
                   PB_STYLE_FILL), 0xFFF211, 0xFF0000, 0x000000, 0xFFFFFF,
                   &g_sFontCm18b, "Blue", 0, 0, 0, 0, OnTextPushButton34Click);
RectangularButton(TextPushButton35, WIDGET_ROOT, 0,
                  0, HMI_DISPLAY_DRIVER_PTR, 
                  8, 170, 102, 35,
                  (PB_STYLE_RELEASE_NOTIFY|PB_STYLE_OUTLINE | PB_STYLE_TEXT_OPAQUE | PB_STYLE_TEXT |
                   PB_STYLE_FILL), 0xEE5900, 0xFF0000, 0x000000, 0xFFFFFF,
                   &g_sFontCm18b, "Orange", 0, 0, 0, 0, OnTextPushButton35Click);
RectangularButton(TextPushButton36, WIDGET_ROOT, 0,
                  0, HMI_DISPLAY_DRIVER_PTR, 
                  130, 213, 102, 35,
                  (PB_STYLE_RELEASE_NOTIFY|PB_STYLE_OUTLINE | PB_STYLE_TEXT_OPAQUE | PB_STYLE_TEXT |
                   PB_STYLE_FILL), 0x400080, 0xFF0000, 0x000000, 0xFFFFFF,
                   &g_sFontCm18b, "Purple", 0, 0, 0, 0, OnTextPushButton36Click);
RectangularButton(BitButton37, WIDGET_ROOT, 0, 0, HMI_DISPLAY_DRIVER_PTR,
130, 256, 102, 35, PB_STYLE_RELEASE_NOTIFY|PB_STYLE_FILL|PB_STYLE_IMG|PB_STYLE_TEXT, ClrSilver, ClrSilver, 0, ClrSilver,
&g_sFontCm20, "", pucImage_BitButton37, pucImagePress_BitButton37, 0, 0,
OnBitButton37Click);
RectangularButton(TextPushButton38, WIDGET_ROOT, 0,
                  0, HMI_DISPLAY_DRIVER_PTR, 
                  8, 126, 102, 35,
                  (PB_STYLE_RELEASE_NOTIFY|PB_STYLE_OUTLINE | PB_STYLE_TEXT_OPAQUE | PB_STYLE_TEXT |
                   PB_STYLE_FILL), 0xFF0000, 0xFF0000, 0x000000, 0xFFFFFF,
                   &g_sFontCm18b, "Red", 0, 0, 0, 0, OnTextPushButton38Click);
RectangularButton(TextPushButton39, WIDGET_ROOT, 0,
                  0, HMI_DISPLAY_DRIVER_PTR, 
                  130, 127, 102, 35,
                  (PB_STYLE_RELEASE_NOTIFY|PB_STYLE_OUTLINE | PB_STYLE_TEXT_OPAQUE | PB_STYLE_TEXT |
                   PB_STYLE_FILL), 0x0000FF, 0xFF0000, 0x000000, 0xFFFFFF,
                   &g_sFontCm18b, "Blue", 0, 0, 0, 0, OnTextPushButton39Click);
RectangularButton(TextPushButton41, WIDGET_ROOT, 0,
                  0, HMI_DISPLAY_DRIVER_PTR, 
                  130, 170, 102, 35,
                  (PB_STYLE_RELEASE_NOTIFY|PB_STYLE_OUTLINE | PB_STYLE_TEXT_OPAQUE | PB_STYLE_TEXT |
                   PB_STYLE_FILL), 0x8000FF, 0xFF0000, 0x000000, 0xFFFFFF,
                   &g_sFontCm18b, "Indigo", 0, 0, 0, 0, OnTextPushButton41Click);


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


void renderFrame315Vector(tContext *pContext, int ox, int oy) {
}
void OnFrame315Paint(tWidget *pWidget, tContext *pContext)
{
hmi_SetForeground(pContext, 0x000000);
hmi_FillRect(pContext, 0, 0, 240, 320);
renderFrame315Vector(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 *)&LabelWidget31);
    WidgetAdd(WIDGET_ROOT, (tWidget *)&LabelWidget32);
    WidgetAdd(WIDGET_ROOT, (tWidget *)&TextPushButton33);
    WidgetAdd(WIDGET_ROOT, (tWidget *)&TextPushButton34);
    WidgetAdd(WIDGET_ROOT, (tWidget *)&TextPushButton35);
    WidgetAdd(WIDGET_ROOT, (tWidget *)&TextPushButton36);
    WidgetAdd(WIDGET_ROOT, (tWidget *)&BitButton37);
    WidgetAdd(WIDGET_ROOT, (tWidget *)&TextPushButton38);
    WidgetAdd(WIDGET_ROOT, (tWidget *)&TextPushButton39);
    WidgetAdd(WIDGET_ROOT, (tWidget *)&TextPushButton41);
    InitGlobalContext();
    WidgetPaint(WIDGET_ROOT);
    ConnectWidgetVariable();
}

void FreeWidget3()
{
    DisconnectWidgetVariable();
    WidgetRemove((tWidget *)(&CanvasFrame3));
    WidgetRemove((tWidget *)(&LabelWidget31));
    WidgetRemove((tWidget *)(&LabelWidget32));
    WidgetRemove((tWidget *)(&TextPushButton33));
    WidgetRemove((tWidget *)(&TextPushButton34));
    WidgetRemove((tWidget *)(&TextPushButton35));
    WidgetRemove((tWidget *)(&TextPushButton36));
    WidgetRemove((tWidget *)(&BitButton37));
    WidgetRemove((tWidget *)(&TextPushButton38));
    WidgetRemove((tWidget *)(&TextPushButton39));
    WidgetRemove((tWidget *)(&TextPushButton41));
}


void OnTextPushButton33Click(tWidget *pWidget)
{
  hmi_PushButtonNormal(pWidget);
  TextPushButton8OnClick(pWidget);
}


void OnTextPushButton34Click(tWidget *pWidget)
{
  hmi_PushButtonNormal(pWidget);
  TextPushButton10OnClick(pWidget);
}


void OnTextPushButton35Click(tWidget *pWidget)
{
  hmi_PushButtonNormal(pWidget);
  TextPushButton11OnClick(pWidget);
}


void OnTextPushButton36Click(tWidget *pWidget)
{
  hmi_PushButtonNormal(pWidget);
  TextPushButton12OnClick(pWidget);
}


void OnBitButton37Click(tWidget *pWidget) 
{
  hmi_GotoFrameByName("Frame2");
}


void OnTextPushButton38Click(tWidget *pWidget)
{
  hmi_PushButtonNormal(pWidget);
  TextPushButton27OnClick(pWidget);
}


void OnTextPushButton39Click(tWidget *pWidget)
{
  hmi_PushButtonNormal(pWidget);
  TextPushButton28OnClick(pWidget);
}


void OnTextPushButton41Click(tWidget *pWidget)
{
  hmi_PushButtonNormal(pWidget);
  TextPushButton30OnClick(pWidget);
}


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

static void DisconnectWidgetVariable()
{
}

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

