Push.c
上传用户:duwei1288
上传日期:2009-12-27
资源大小:451k
文件大小:3k
源码类别:

BREW编程

开发平台:

Visual C++

  1. #include "Push.h"
  2. #include "AEEAppGen.h"
  3. #include "WindowStack.h"
  4. #include "MenuList.brh"
  5. /////////////////////////Static Function//////////////////////
  6. #define MENU_X 7 //3级菜单正文区起始横坐标
  7. #define MENU_Y (32) //3级菜单正文区起始纵坐标
  8. #define MENU_W (SCREEN_W-7-8) //161,3级菜单正文区宽度
  9. #define MENU_SK_2LINE_H (SCREEN_H-32-9-22-16) //123,3级菜单(有2行softkey)中MENU控件高度
  10. #define MENU_SK_1LINE_H (SCREEN_H-32-9-22)
  11. //#define INPUT_TEXT_X_START 2
  12. //#define INPUT_TEXT_Y_START 0
  13. //#define INPUT_TEXT_MAX_SIZE 150
  14. //窗口的控件
  15. typedef enum
  16. {
  17.     INPUT_SOFTKEYCTL=0,
  18.     INPUT_MENUCTL
  19. }TPushWinCtlType;
  20. //软键控件的ItemId定义
  21. typedef enum
  22. {
  23.   INPUT_SOFTKEY_ITEM = 1,
  24.   INPUT_SOFTKEY_ITEM_GOTO,
  25.   INPUT_SOFTKEY_ITEM_DEL
  26. }TPushWinItems;
  27. //按键事件的处理
  28. //static boolean IINPUTWINDOW_HandleKeyEvent(IInputWin* pWin,uint16 wParam);
  29. //软键菜单的处理
  30. //static boolean IINPUTWINDOW_HandleCommandEvent(IInputWin* pWin,uint16 wParam);
  31. //设置窗口中控件的激活状态
  32. //static boolean IINPUTWINDOW_SetActiveCtl(IInputWin* pWin,TInputCtlType nTextCtl);
  33. /////////////////////////Public Function//////////////////////
  34. boolean PushDlg()
  35. {
  36. AEEApplet* pApp=(AEEApplet*)GETAPPINSTANCE();
  37. AEERect MenuRect;
  38. AEERect SoftRect;
  39. IPushWin *ptPushWin = (IPushWin *)MALLOC(sizeof(IPushWin));
  40. //AEERect m_rc;
  41. if (NULL == ptPushWin)
  42. return FALSE;
  43. ISHELL_CreateInstance(pApp->m_pIShell, AEECLSID_MENUCTL, (void **)&(ptPushWin->m_pMenuCtl));
  44. if(SUCCESS!=ISHELL_CreateInstance(pApp->m_pIShell,AEECLSID_SOFTKEYCTL,(void **)&(ptPushWin->m_pSoftKeyCtl)))
  45. {
  46. PUSHWIN_Release(pApp->m_pIShell,&ptPushWin);
  47. return FALSE;
  48. }
  49. if(SUCCESS!=ISHELL_CreateInstance(pApp->m_pIShell,AEECLSID_SOFTKEYCTL,(void **)&(ptPushWin->m_pSoftKeyCtl)))
  50. {
  51. PUSHWIN_Release(pApp->m_pIShell,&ptPushWin);
  52. return FALSE;
  53. }
  54. IMENUCTL_AddItem(ptPushWin->m_pSoftKeyCtl, MENULIST_RES_FILE, IDS_GOTO,INPUT_SOFTKEY_ITEM_GOTO, NULL, 0);
  55. IMENUCTL_AddItem(ptPushWin->m_pSoftKeyCtl, MENULIST_RES_FILE, IDS_DEL,INPUT_SOFTKEY_ITEM_DEL, NULL, 0);
  56. IMENUCTL_GetRect(ptPushWin->m_pMenuCtl, &MenuRect);
  57. IMENUCTL_GetRect(ptPushWin->m_pSoftKeyCtl, &SoftRect);
  58. //IMENUCTL_SetActive(ptBookmarkWin->m_pMenuCtl,TRUE);
  59. IMENUCTL_SetActive(ptPushWin->m_pSoftKeyCtl,TRUE);
  60. return IWINSTACK_OpenWindow(WAPWINID_PUSH, ptPushWin);
  61. }
  62. void*   PUSHWIN_Create(IShell* pShell,void* pParam)
  63. {
  64. pShell=pShell;
  65. return pParam;
  66. }
  67. boolean PUSHWIN_Release(IShell* pShell,void** pWin)
  68. {
  69. IPushWin* pInputWin=*pWin;
  70. if(pInputWin)
  71. {
  72. if(pInputWin->m_pSoftKeyCtl)
  73. IMENUCTL_Release(pInputWin->m_pSoftKeyCtl);
  74. if(pInputWin->m_pMenuCtl)
  75. IMENUCTL_Release(pInputWin->m_pMenuCtl);
  76. FREEIF(*pWin);
  77. }
  78. return TRUE;
  79. }
  80. boolean PUSHWIN_Redraw(IShell* pShell,void* pWin)
  81. {
  82. IPushWin* pInputWin=pWin;
  83. AEEApplet* pApp=(AEEApplet*)GETAPPINSTANCE();
  84. if(pInputWin&&pApp)
  85. {
  86. IDISPLAY_ClearScreen(pApp->m_pIDisplay);
  87. if(pInputWin->m_pMenuCtl)
  88. IMENUCTL_Redraw(pInputWin->m_pMenuCtl);
  89. if(pInputWin->m_pSoftKeyCtl)
  90. IMENUCTL_Redraw(pInputWin->m_pSoftKeyCtl);
  91. IDISPLAY_Update(pApp->m_pIDisplay);
  92. }
  93. return TRUE;
  94. }