中级会员
积分 271
金钱 271
注册时间 2015-5-6
在线时间 110 小时
1 金钱
WIN_PARA WinPara; //用户使用的窗口额外数据
//app图标描述结构体
typedef struct{
const GUI_BITMAP *pBitmap; //app图标
const char *pText; //app图标名字
}BITMAP_ITEM;
//ICONVIEW显示的APP图标
static const BITMAP_ITEM BitmapItemTab1[]={
{&bmbag, "Bag"},
{&bmbook, "Book"},
{&bmbookshelf, "Booksh"},
{&bmbrowser, "Brower"},
{&bmcalendar, "Calendar"},
{&bmclipboard, "Clipboard"},
{&bmcompass, "Compass"},
{&bmcompose, "Cmpose"},
};
//桌面窗口WM_HBKWIN回调函数
void cb_BkWindow(WM_MESSAGE *pMsg)
{
int Id;
int NCode;
static int Iconview0_Sel;
char text_buffer[20];
WM_HWIN hText;
switch(pMsg->MsgId)
{
case WM_PAINT:
GUI_SetBkColor(GUI_BLACK); //设置当前背景色
GUI_Clear(); //清除活动窗口
// GUI_DrawBitmap(&bmguia1,0,0); //绘制背景图片
hText = WM_GetDialogItem(pMsg->hWin, GUI_ID_TEXT1);
/* 转换rtc值至北京时间 */
RTC_TimeCovr(&systmtime);
/* 转换成字符串 */
sprintf(text_buffer,"%02d:%02d:%02d",systmtime.tm_hour,systmtime.tm_min,systmtime.tm_sec);
/* 输出时间 */
TEXT_SetText(hText,text_buffer);
case WM_NOTIFY_PARENT:
Id=WM_GetId(pMsg->hWinSrc);
NCode=pMsg->Data.v;
switch(Id)
{
case ID_ICONVIEW_0: //ICONVIEW0控件
switch(NCode) //通知代码
{
case WM_NOTIFICATION_CLICKED:
break;
case WM_NOTIFICATION_RELEASED:
Iconview0_Sel=ICONVIEW_GetSel(pMsg->hWinSrc);
switch(Iconview0_Sel)
{
case 0: //APP0
if(BagAPPWin==NULL)CreateBagAPP(); //创建BagAPP
break;
case 1: //APP1
if(BookAPPWin==NULL)CreateBookAPP(); //创建BookAPP
break;
case 2: //APP2
if(BookshAPPWin==NULL)CreateBookshAPP(); //创建BookshAPP
break;
case 3: //APP3
if(BrowerAPPWin==NULL)CreateBrowerAPP(); //创建BrowerAPP
break;
}
break;
case WM_NOTIFICATION_SEL_CHANGED:
break;
}
}
}
}
//ICONVIEW演示例程
void iconviewdemo(void)
{
int i;
//设置换肤
PROGBAR_SetDefaultSkin(PROGBAR_SKIN_FLEX);
FRAMEWIN_SetDefaultSkin(FRAMEWIN_SKIN_FLEX);
PROGBAR_SetDefaultSkin(PROGBAR_SKIN_FLEX);
BUTTON_SetDefaultSkin(BUTTON_SKIN_FLEX);
CHECKBOX_SetDefaultSkin(CHECKBOX_SKIN_FLEX);
DROPDOWN_SetDefaultSkin(DROPDOWN_SKIN_FLEX);
SCROLLBAR_SetDefaultSkin(SCROLLBAR_SKIN_FLEX);
SLIDER_SetDefaultSkin(SLIDER_SKIN_FLEX);
HEADER_SetDefaultSkin(HEADER_SKIN_FLEX);
RADIO_SetDefaultSkin(RADIO_SKIN_FLEX);
MULTIPAGE_SetDefaultSkin(MULTIPAGE_SKIN_FLEX);
WM_SetCallback(WM_HBKWIN,cb_BkWindow); //设置桌面窗口WM_HBKWIN的回调函数
//建立一个ICONVIEW作为主界面
WinPara.hWinStatus=ICONVIEW_CreateEx( 0,0, //左上角坐标
320,240, //小工具的水平和垂直尺寸
WM_HBKWIN, //父窗口为背景窗口
WM_CF_SHOW|WM_CF_HASTRANS,
ICONVIEW_CF_AUTOSCROLLBAR_V, //自动增加垂直滚动条
ID_ICONVIEW_0, //小工具ID
100, //图标的水平尺寸为100
100); //图标的垂直尺寸为100
ICONVIEW_SetFont(WinPara.hWinStatus,&GUI_Font16_ASCII); //图标标签的字体
ICONVIEW_SetBkColor(WinPara.hWinStatus,ICONVIEW_CI_SEL,GUI_WHITE|0X70000000); //设置小工具的背景色
ICONVIEW_SetSpace(WinPara.hWinStatus,GUI_COORD_X,15); //设置图标在 x 或 y 方向上的间距
ICONVIEW_SetSpace(WinPara.hWinStatus,GUI_COORD_Y,15);
ICONVIEW_SetIconAlign(WinPara.hWinStatus,ICONVIEW_IA_HCENTER|ICONVIEW_IA_VCENTER); //设置图标对齐
for(i=0;i<(GUI_COUNTOF(BitmapItemTab1));i++)
{
ICONVIEW_AddBitmapItem(WinPara.hWinStatus,BitmapItemTab1[i].pBitmap,BitmapItemTab1[i].pText);
}
//年月日显示窗口
WinPara.hTextl = TEXT_CreateEx( 0, 0, 80, 20,
WinPara.hWinStatus,WM_CF_SHOW,TEXT_CF_LEFT,GUI_ID_TEXT1,"");
TEXT_SetBkColor(WinPara.hTextl,GUI_INVALID_COLOR); //背景色
TEXT_SetTextColor(WinPara.hTextl,GUI_BLUE); //文本颜色
TEXT_SetFont(WinPara.hTextl,&GUI_FontHZ16); //字体
while(1)
{
GUI_Delay(20);
}
}
我来回答