Push.c
资源名称:MenuList.rar [点击查看]
上传用户:duwei1288
上传日期:2009-12-27
资源大小:451k
文件大小:3k
源码类别:
BREW编程
开发平台:
Visual C++
- #include "Push.h"
- #include "AEEAppGen.h"
- #include "WindowStack.h"
- #include "MenuList_res.h"
- /////////////////////////Static Function//////////////////////
- #define MENU_X 7 //3级菜单正文区起始横坐标
- #define MENU_Y (32) //3级菜单正文区起始纵坐标
- #define MENU_W (SCREEN_W-7-8) //161,3级菜单正文区宽度
- #define MENU_SK_2LINE_H (SCREEN_H-32-9-22-16) //123,3级菜单(有2行softkey)中MENU控件高度
- #define MENU_SK_1LINE_H (SCREEN_H-32-9-22)
- //#define INPUT_TEXT_X_START 2
- //#define INPUT_TEXT_Y_START 0
- //#define INPUT_TEXT_MAX_SIZE 150
- //窗口的控件
- typedef enum
- {
- INPUT_SOFTKEYCTL=0,
- INPUT_MENUCTL
- }TPushWinCtlType;
- //软键控件的ItemId定义
- typedef enum
- {
- INPUT_SOFTKEY_ITEM = 1,
- INPUT_SOFTKEY_ITEM_GOTO,
- INPUT_SOFTKEY_ITEM_DEL
- }TPushWinItems;
- //按键事件的处理
- //static boolean IINPUTWINDOW_HandleKeyEvent(IInputWin* pWin,uint16 wParam);
- //软键菜单的处理
- //static boolean IINPUTWINDOW_HandleCommandEvent(IInputWin* pWin,uint16 wParam);
- //设置窗口中控件的激活状态
- //static boolean IINPUTWINDOW_SetActiveCtl(IInputWin* pWin,TInputCtlType nTextCtl);
- /////////////////////////Public Function//////////////////////
- boolean PushDlg()
- {
- AEEApplet* pApp=(AEEApplet*)GETAPPINSTANCE();
- AEERect MenuRect;
- AEERect SoftRect;
- IPushWin *ptPushWin = (IPushWin *)MALLOC(sizeof(IPushWin));
- //AEERect m_rc;
- if (NULL == ptPushWin)
- return FALSE;
- ISHELL_CreateInstance(pApp->m_pIShell, AEECLSID_MENUCTL, (void **)&(ptPushWin->m_pMenuCtl));
- if(SUCCESS!=ISHELL_CreateInstance(pApp->m_pIShell,AEECLSID_SOFTKEYCTL,(void **)&(ptPushWin->m_pSoftKeyCtl)))
- {
- PUSHWIN_Release(pApp->m_pIShell,&ptPushWin);
- return FALSE;
- }
- if(SUCCESS!=ISHELL_CreateInstance(pApp->m_pIShell,AEECLSID_SOFTKEYCTL,(void **)&(ptPushWin->m_pSoftKeyCtl)))
- {
- PUSHWIN_Release(pApp->m_pIShell,&ptPushWin);
- return FALSE;
- }
- IMENUCTL_AddItem(ptPushWin->m_pSoftKeyCtl, MENULIST_RES_FILE, IDS_GOTO,INPUT_SOFTKEY_ITEM_GOTO, NULL, 0);
- IMENUCTL_AddItem(ptPushWin->m_pSoftKeyCtl, MENULIST_RES_FILE, IDS_DEL,INPUT_SOFTKEY_ITEM_DEL, NULL, 0);
- IMENUCTL_GetRect(ptPushWin->m_pMenuCtl, &MenuRect);
- IMENUCTL_GetRect(ptPushWin->m_pSoftKeyCtl, &SoftRect);
- //IMENUCTL_SetActive(ptBookmarkWin->m_pMenuCtl,TRUE);
- IMENUCTL_SetActive(ptPushWin->m_pSoftKeyCtl,TRUE);
- return IWINSTACK_OpenWindow(WAPWINID_PUSH, ptPushWin);
- }
- void* PUSHWIN_Create(IShell* pShell,void* pParam)
- {
- pShell=pShell;
- return pParam;
- }
- boolean PUSHWIN_Release(IShell* pShell,void** pWin)
- {
- IPushWin* pInputWin=*pWin;
- if(pInputWin)
- {
- if(pInputWin->m_pSoftKeyCtl)
- IMENUCTL_Release(pInputWin->m_pSoftKeyCtl);
- if(pInputWin->m_pMenuCtl)
- IMENUCTL_Release(pInputWin->m_pMenuCtl);
- FREEIF(*pWin);
- }
- return TRUE;
- }
- boolean PUSHWIN_Redraw(IShell* pShell,void* pWin)
- {
- IPushWin* pInputWin=pWin;
- AEEApplet* pApp=(AEEApplet*)GETAPPINSTANCE();
- if(pInputWin&&pApp)
- {
- IDISPLAY_ClearScreen(pApp->m_pIDisplay);
- if(pInputWin->m_pMenuCtl)
- IMENUCTL_Redraw(pInputWin->m_pMenuCtl);
- if(pInputWin->m_pSoftKeyCtl)
- IMENUCTL_Redraw(pInputWin->m_pSoftKeyCtl);
- IDISPLAY_Update(pApp->m_pIDisplay);
- }
- return TRUE;
- }