#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <minigui/common.h>
#include <minigui/minigui.h>
#include <minigui/gdi.h>
#include <minigui/window.h>
#include <minigui/control.h>
#include <minigui/mgext.h>
#include <minigui/skin.h>
#include "project.h"
#define SIID_TIMER 499
#define SIID_TIMER1 500
#define SIID_CLOSE 498
#define SIID_BACK 400
#define SIID_NUM1 401
#define SIID_NUM2 402
#define SIID_NUM3 403
#define SIID_NUM4 404
#define SIID_NUM5 405
#define SIID_NUM6 406
#define SIID_NUM7 407
#define SIID_NUM8 408
#define SIID_NUM9 409
#define SIID_NUM10 410
#define SIID_NUM11 411
#define SIID_NUM12 412
#define SIID_NUM13 413
#define SIID_NUM14 414
#define DEF_WIDTH 320
#define DEF_HEIGHT 240
#define ID_TIME 100
char buf[12]="";
char buf1[12]="";
/* 定义皮肤元素特定属性 */
static si_bmplabel_t timer = { "","1234567890*#" };
static si_bmplabel_t timer1 = { "","1234567890*#" };
/* 定义皮肤元素数组 */
static skin_item_t skin_main_items [] =
{
{SIID_NUM1, SI_TYPE_CHKBUTTON | SI_TEST_SHAPE_RECT | SI_STATUS_VISIBLE,
46, 95, {}, 1, ""},
{SIID_NUM2, SI_TYPE_CHKBUTTON | SI_TEST_SHAPE_RECT | SI_STATUS_VISIBLE,
86, 95, {}, 2, ""},
{SIID_NUM3, SI_TYPE_CHKBUTTON | SI_TEST_SHAPE_RECT | SI_STATUS_VISIBLE,
126, 95, {}, 3, ""},
{SIID_NUM4, SI_TYPE_CHKBUTTON | SI_TEST_SHAPE_RECT | SI_STATUS_VISIBLE,
46, 125, {}, 4, ""},
{SIID_NUM5, SI_TYPE_CHKBUTTON | SI_TEST_SHAPE_RECT | SI_STATUS_VISIBLE,
86, 125, {}, 5, ""},
{SIID_NUM6, SI_TYPE_CHKBUTTON | SI_TEST_SHAPE_RECT | SI_STATUS_VISIBLE,
126, 125, {}, 6, ""},
{SIID_NUM7, SI_TYPE_CHKBUTTON | SI_TEST_SHAPE_RECT | SI_STATUS_VISIBLE,
46, 155, {}, 7, ""},
{SIID_NUM8, SI_TYPE_CHKBUTTON | SI_TEST_SHAPE_RECT | SI_STATUS_VISIBLE,
86, 155, {}, 8, ""},
{SIID_NUM9, SI_TYPE_CHKBUTTON | SI_TEST_SHAPE_RECT | SI_STATUS_VISIBLE,
126, 155, {}, 9, ""},
{SIID_NUM10, SI_TYPE_CHKBUTTON | SI_TEST_SHAPE_RECT | SI_STATUS_VISIBLE,
86, 185, {}, 10, ""},
{SIID_NUM11, SI_TYPE_CHKBUTTON | SI_TEST_SHAPE_RECT | SI_STATUS_VISIBLE,
46, 185, {}, 11, ""},
{SIID_NUM12, SI_TYPE_CHKBUTTON | SI_TEST_SHAPE_RECT | SI_STATUS_VISIBLE,
126, 185, {}, 12, ""},
{SIID_NUM13, SI_TYPE_CHKBUTTON | SI_TEST_SHAPE_RECT | SI_STATUS_VISIBLE,
220, 110, {}, 13, ""},
{SIID_NUM14, SI_TYPE_CHKBUTTON | SI_TEST_SHAPE_RECT | SI_STATUS_VISIBLE,
220, 150, {}, 14, ""},
{SIID_CLOSE, SI_TYPE_CHKBUTTON | SI_TEST_SHAPE_RECT | SI_STATUS_VISIBLE,
245, 190, {}, 15, ""},
{SIID_TIMER, SI_TYPE_BMPLABEL | SI_TEST_SHAPE_RECT | SI_STATUS_VISIBLE,
30, 33, {}, 16, "",0,&timer},
{SIID_TIMER1, SI_TYPE_BMPLABEL | SI_TEST_SHAPE_RECT | SI_STATUS_VISIBLE,
30, 58, {}, 17, "",0,&timer1},
{SIID_BACK, SI_TYPE_CHKBUTTON | SI_TEST_SHAPE_RECT | SI_STATUS_VISIBLE,
220, 70, {}, 18, ""},
};
/* 定义皮肤 */
skin_head_t main2_skin =
{
" ",
SKIN_STYLE_TOOLTIP, NULL, NULL,
0,18, skin_main_items, FALSE
};
/* 位图数组 */
const char *bmp2_name[] = {
"./call/main.jpg","./call/1.jpg" ,"./call/2.jpg","./call/3.jpg","./call/4.jpg","./call/5.jpg","./call/6.jpg","./call/7.jpg","./call/8.jpg","./call/9.jpg","./call/10.jpg","./call/11.jpg","./call/12.jpg",
"./call/13.jpg","./call/14.jpg","./call/close.jpg","./call/shuzi.jpg","./call/shuzi1.jpg","./call/back.jpg"
};
/* 位图资源装/卸载函数 */
void load2_skin_bmps ( skin_head_t *skin, BOOL load )
{
int i, bmp_num = sizeof(bmp2_name)/sizeof(char *);
/* 如果load为真,则将位图装载到skin的bmps数组,否则卸载bmps数组中的位图 */
if ( load )
skin->bmps = (BITMAP* )calloc ( bmp_num, sizeof(BITMAP) );
for ( i = 0 ; i < bmp_num ; i++ ){
if ( load )
LoadBitmapFromFile ( HDC_SCREEN, (PBITMAP)&(skin->bmps[i]), bmp2_name[i] );
else
UnloadBitmap ((PBITMAP)&(skin->bmps[i]));
}
if ( !load )
free ( (void*)skin->bmps);
}
/* 皮肤事件回调函数 */
static int main2_event_cb (HWND hwnd, skin_item_t* item, int event, void* data)
{
int size_buf;
int size_buf1;
if (event == SIE_GAIN_FOCUS)
{ switch (item->id)
{
}
}
else if (event == SIE_LOST_FOCUS)
{
switch (item->id)
{
}
}
else if (event == SIE_BUTTON_CLICKED) {
switch (item->id) {
case SIID_NUM1:
skin_set_check_status (item->hostskin, SIID_NUM1,FALSE );
// skin_set_check_status (item->hostskin, SIID_PLAY,TRUE );
if(strlen(buf)>11)
{
strcat(buf1,"1");
printf("%s\n",buf1);
skin_set_item_label(item->hostskin, SIID_TIMER1,buf1);
}
else
{
strcat(buf,"1");
printf("%s\n",buf);
skin_set_item_label(item->hostskin, SIID_TIMER,buf);
}
break;
case SIID_NUM2:
skin_set_check_status (item->hostskin, SIID_NUM2,FALSE );
if(strlen(buf)>11)
{
strcat(buf1,"2");
printf("%s\n",buf1);
skin_set_item_label(item->hostskin, SIID_TIMER1,buf1);
}
else{
printf("%d\n",strlen(buf));
printf("%d\n",strlen(buf1));
strcat(buf,"2");
printf("%s\n",buf);
skin_set_item_label(item->hostskin, SIID_TIMER,buf);
}
break;
case SIID_NUM3:
skin_set_check_status (item->hostskin, SIID_NUM3,FALSE );
if(strlen(buf)>11)
{
strcat(buf1,"3");
printf("%s\n",buf1);
skin_set_item_label(item->hostskin, SIID_TIMER1,buf1);
}
else{
printf("%d\n",strlen(buf));
printf("%d\n",strlen(buf1));
strcat(buf,"3");
printf("%s\n",buf);
skin_set_item_label(item->hostskin, SIID_TIMER,buf);}
break;
case SIID_NUM4:
skin_set_check_status (item->hostskin, SIID_NUM4,FALSE );
if(strlen(buf)>11)
{
strcat(buf1,"4");
printf("%s\n",buf1);
skin_set_item_label(item->hostskin, SIID_TIMER1,buf1);
}
else{
strcat(buf,"4");
printf("%s\n",buf);
skin_set_item_label(item->hostskin, SIID_TIMER,buf);}
break;
case SIID_NUM5:
skin_set_check_status (item->hostskin, SIID_NUM5,FALSE );
if(strlen(buf)>11)
{
strcat(buf1,"5");
printf("%s\n",buf1);
skin_set_item_label(item->hostskin, SIID_TIMER1,buf1);
}
else{
strcat(buf,"5");
printf("%s\n",buf);
skin_set_item_label(item->hostskin, SIID_TIMER,buf);}
break;
case SIID_NUM6:
skin_set_check_status (item->hostskin, SIID_NUM6,FALSE );
if(strlen(buf)>11)
{
strcat(buf1,"6");
printf("%s\n",buf1);
skin_set_item_label(item->hostskin, SIID_TIMER1,buf1);
}
else{
strcat(buf,"6");
printf("%s\n",buf);
skin_set_item_label(item->hostskin, SIID_TIMER,buf);}
break;
case SIID_NUM7:
skin_set_check_status (item->hostskin, SIID_NUM7,FALSE );
if(strlen(buf)>11)
{
strcat(buf1,"7");
printf("%s\n",buf1);
skin_set_item_label(item->hostskin, SIID_TIMER1,buf1);
}
else{
strcat(buf,"7");
prin