本文整理汇总了C++中WM_DefaultProc函数的典型用法代码示例。如果您正苦于以下问题:C++ WM_DefaultProc函数的具体用法?C++ WM_DefaultProc怎么用?C++ WM_DefaultProc使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了WM_DefaultProc函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _cbDialog
//.........这里部分代码省略.........
// USER END
switch (pMsg->MsgId)
{
case USER_MSG_LANGUAGE:
InfoSel(0,1);
break;
case WM_PAINT:
GUI_SetBkColor(GUI_WHITE);
GUI_Clear();
GUI_SetColor(GUI_BLACK);
GUI_AA_DrawLine(190,0,220,60);
GUI_AA_DrawLine(220,60,800,60);
// if (Language == 0)
// {
// GUI_DispStringAt("所处 页/共 页",560,435);
// }
// else
// {
// GUI_DispStringAt (pLanguage->Page,560,435);
// }
// GUI_DispDecAt(thispage,605,435,3);
// GUI_DispDecAt(pageNum,700,435,3);
//GUI_DispStringAt("高电压警告",230,28);
GUI_PNG_Draw(&acPOWER,sizeof(acPOWER),755,35);
break;
case WM_INIT_DIALOG:
pLanguage = &Lgumainwin[Language];
hButton = WM_GetDialogItem (hWin,ID_BUTTON_0);
BUTTON_SetBkColor (hButton,BUTTON_CI_UNPRESSED,GUI_WHITE);
BUTTON_SetTextColor (hButton,BUTTON_CI_UNPRESSED,GUI_BLACK);
BUTTON_SetTextAlign (hButton,GUI_TA_HCENTER|GUI_TA_VCENTER);
BUTTON_SetText(hButton,pLanguage->ButtonInfo[0]);
BUTTON_SetFocusColor (hButton,GUI_WHITE);
WIDGET_SetEffect (hButton,&WIDGET_Effect_None);
WM_SetCallback (hButton,&mybutton);
WM_SetFocus (hButton);
hListview = WM_GetDialogItem (hWin,ID_LV_0);
hListhead = LISTVIEW_GetHeader(hListview);
LISTVIEW_SetFont(hListview,&GUI_Font30);
LISTVIEW_SetRowHeight(hListview,40);
LISTVIEW_SetHeaderHeight(hListview,30);
LISTVIEW_SetBkColor (hListview,LISTVIEW_CI_SELFOCUS,GUI_GRAY);
LISTVIEW_SetBkColor (hListview,LISTVIEW_CI_SEL,GUI_WHITE);
LISTVIEW_SetTextColor (hListview,LISTVIEW_CI_SEL,GUI_BLACK);
LISTVIEW_SetTextColor(hListview,LISTVIEW_CI_SELFOCUS,GUI_WHITE);
WIDGET_SetEffect(hListhead,&WIDGET_Effect_3D);
HEADER_SetBkColor (hListhead,GUI_BLACK);
HEADER_SetTextColor(hListhead,GUI_WHITE);
HEADER_SetFont(hListhead,&GUI_Font24);
LISTVIEW_AddColumn(hListview,80,"序号",GUI_TA_HCENTER|GUI_TA_VCENTER);
LISTVIEW_AddColumn(hListview,100,"信息编码",GUI_TA_HCENTER|GUI_TA_VCENTER);
LISTVIEW_AddColumn(hListview,130,"yyy/mm/dd",GUI_TA_HCENTER|GUI_TA_VCENTER);
LISTVIEW_AddColumn(hListview,90,"hh:mm",GUI_TA_HCENTER|GUI_TA_VCENTER);
LISTVIEW_AddColumn(hListview,120,"频道",GUI_TA_HCENTER|GUI_TA_VCENTER);
LISTVIEW_AddColumn(hListview,100,"信息类型",GUI_TA_HCENTER|GUI_TA_VCENTER);
LISTVIEW_AddColumn(hListview,100,"信息状态",GUI_TA_HCENTER|GUI_TA_VCENTER);
LISTVIEW_SetTextAlign(hListview,6,GUI_TA_LEFT|GUI_TA_VCENTER);
// WM_HWIN - TEXT
mainwinText[0] = WM_GetDialogItem(hWin,ID_TEXT_3); //高压警告
mainwinText[1] = WM_GetDialogItem(hWin,ID_TEXT_0); //INT
mainwinText[2] = WM_GetDialogItem(hWin,ID_TEXT_1); //loc1,loc2,chs
mainwinText[3] = WM_GetDialogItem(hWin,ID_TEXT_2); //time
mainwinText[4] = WM_GetDialogItem(hWin,ID_TEXT_4); //page
WM_SetCallback(mainwinText[1],&mytext);
WM_SetCallback(mainwinText[2],&mytext);
TEXT_SetText(mainwinText[0],"");
TEXT_SetFont(mainwinText[4],&GUI_Font30);
TEXT_SetTextAlign(mainwinText[4],TEXT_CF_RIGHT);
TEXT_SetText(mainwinText[4],"所处 01页/共 02页");
//time
TEXT_SetTextAlign(mainwinText[3],TEXT_CF_VCENTER);
TEXT_SetFont(mainwinText[3],&GUI_Font30);
TEXT_SetText(mainwinText[3],"UTC 2015.10.24 17:30");
for (i=0; i<16; i++)
{
INFO_add(&TESTDATA[i]);
}
if (rowNum < 8)
pageNum = 1;
else if (rowNum%8 == 0)
pageNum = rowNum/8;
else pageNum = rowNum/8+1;
InfoSel(0,1);
//DisPage();
WM_SetCallback (hListview,&mylistview);
break;
default:
WM_DefaultProc(pMsg);
break;
}
}
示例2: _cbDialog
//.........这里部分代码省略.........
case WM_NOTIFICATION_CLICKED:
// USER START (Optionally insert code for reacting on notification message)
// USER END
break;
case WM_NOTIFICATION_RELEASED:
{
CreateMojeokno2();
hItem=WM_GetDialogItem(pMsg->hWin,ID_PROGBAR_0);
PROGBAR_SetValue(hItem,il++);
break;
}
}
break;
case ID_BUTTON_1: // Notifications sent by 'Button'
switch(NCode)
{
case WM_NOTIFICATION_CLICKED:
{
break;
}
case WM_NOTIFICATION_RELEASED:
{
CreateGraph();
// WM_DeleteWindow(hBox);
// hBox = MESSAGEBOX_Create("Release the BUTTON !","ERROR", GUI_MESSAGEBOX_CF_MOVEABLE);
// WM_DeleteWindow(hBox);
break;
}
}
break;
case ID_LISTWHEEL_0: // Notifications sent by 'Listwheel'
switch(NCode) {
case WM_NOTIFICATION_CLICKED:
// USER START (Optionally insert code for reacting on notification message)
// USER END
break;
case WM_NOTIFICATION_RELEASED:
// USER START (Optionally insert code for reacting on notification message)
// USER END
break;
case WM_NOTIFICATION_SEL_CHANGED:
// USER START (Optionally insert code for reacting on notification message)
// USER END
break;
// USER START (Optionally insert additional code for further notification handling)
// USER END
}
break;
case ID_CHECKBOX_0: // Notifications sent by 'Checkbox'
switch(NCode) {
case WM_NOTIFICATION_CLICKED:
// USER START (Optionally insert code for reacting on notification message)
// USER END
break;
case WM_NOTIFICATION_RELEASED:
// USER START (Optionally insert code for reacting on notification message)
// USER END
break;
case WM_NOTIFICATION_VALUE_CHANGED:
// USER START (Optionally insert code for reacting on notification message)
// USER END
break;
// USER START (Optionally insert additional code for further notification handling)
// USER END
}
break;
case ID_CHECKBOX_1: // Notifications sent by 'Checkbox'
switch(NCode) {
case WM_NOTIFICATION_CLICKED:
// USER START (Optionally insert code for reacting on notification message)
// USER END
break;
case WM_NOTIFICATION_RELEASED:
// USER START (Optionally insert code for reacting on notification message)
// USER END
break;
case WM_NOTIFICATION_VALUE_CHANGED:
// USER START (Optionally insert code for reacting on notification message)
// USER END
break;
// USER START (Optionally insert additional code for further notification handling)
// USER END
}
break;
// USER START (Optionally insert additional code for further Ids)
// USER END
}
break;
// USER START (Optionally insert additional message handling)
// USER END
default:
WM_DefaultProc(pMsg);
break;
}
}
示例3: _cbFileInfoDialog
/**
* @brief Callback routine of Info dialog
* @param pMsg: pointer to data structure of type WM_MESSAGE
* @retval None
*/
static void _cbFileInfoDialog(WM_MESSAGE * pMsg) {
WM_HWIN hItem;
int NCode;
int Id;
FILINFO fno;
#if _USE_LFN
static char lfn[_MAX_LFN];
#endif
switch (pMsg->MsgId) {
case WM_INIT_DIALOG:
hItem = pMsg->hWin;
FRAMEWIN_SetClientColor(hItem, GUI_WHITE);
hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_FILENAME);
FILEMGR_GetFileOnly(str, SelectedFileName);
TEXT_SetText(hItem, str);
hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_LOCATION);
if(SelectedFileName[0] == '0')
{
TEXT_SetText(hItem, "[USB Disk]");
}
else if(SelectedFileName[0] == '1')
{
TEXT_SetText(hItem, "[microSD]");
}
#if _USE_LFN
fno.lfname = lfn;
fno.lfsize = sizeof(lfn);
#endif
f_stat (SelectedFileName, &fno);
if(fno.fdate == 0)
{
fno.fdate = (1 << 5) | 1; /* Set January, 1st */
}
sprintf(str, "%02hu/%02hu/%hu %02hu:%02hu:%02hu", ( fno.fdate) & 0x1F,
((fno.fdate) >> 5) & 0x0F,
(((fno.fdate) >> 9) & 0x3F) + 1980,
((fno.ftime) >> 11) & 0x1F,
((fno.ftime) >> 5) & 0x3F,
(fno.ftime) & 0x1F);
hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_CREATION);
TEXT_SetText(hItem, str);
if (fno.fsize < 1024)
{
sprintf(str, "%lu Byte(s)", fno.fsize);
}
else if (fno.fsize < (1024 * 1024))
{
sprintf(str, "%lu KByte(s)", fno.fsize/ 1024);
}
else
{
sprintf(str, "%lu MByte(s)", fno.fsize/ 1024 / 1024);
}
hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_FILESIZE);
TEXT_SetText(hItem, str);
break;
case WM_NOTIFY_PARENT:
Id = WM_GetId(pMsg->hWinSrc);
NCode = pMsg->Data.v;
switch(Id) {
/* Notifications sent by 'OK' */
case ID_BUTTON_OK_FILEINFO:
switch(NCode) {
case WM_NOTIFICATION_RELEASED:
GUI_EndDialog(pMsg->hWin, 0);
hFileInfo = 0;
break;
}
break;
}
break;
default:
WM_DefaultProc(pMsg);
break;
}
}
示例4: _cbCallback
/*********************************************************************
*
* _cbCallback
*/
static void _cbCallback(WM_MESSAGE * pMsg) {
int Sel, NCode, Id;
WM_HWIN hDlg, hItem;
GUI_PID_STATE * pState;
hDlg = pMsg->hWin;
switch (pMsg->MsgId) {
case WM_INIT_DIALOG:
hItem = WM_GetDialogItem(hDlg, GUI_ID_EDIT0);
EDIT_SetDecMode(hItem, 30, 0, 999, 0, 0); /* Select decimal mode */
WM_DisableWindow(hItem);
break;
case WM_KEY:
switch (((WM_KEY_INFO*)(pMsg->Data.p))->Key) {
case GUI_KEY_ESCAPE:
GUI_EndDialog(hDlg, 1);
break;
case GUI_KEY_ENTER:
GUI_EndDialog(hDlg, 0);
break;
}
break;
case WM_TOUCH_CHILD:
Id = WM_GetId(pMsg->hWinSrc); /* Id of widget */
switch (Id) {
case GUI_ID_TEXT0:
case GUI_ID_TEXT1:
case GUI_ID_TEXT2:
pState = (GUI_PID_STATE *)((WM_MESSAGE *)pMsg->Data.p)->Data.p;
if (pState) {
if (pState->Pressed) {
WM_HWIN hRadio = WM_GetDialogItem(hDlg, GUI_ID_RADIO0);
RADIO_SetValue(hRadio, Id - GUI_ID_TEXT0); /* Use the text beside the radio button to
set the value of the radio button */
}
}
break;
}
break;
case WM_NOTIFY_PARENT:
Id = WM_GetId(pMsg->hWinSrc); /* Id of widget */
NCode = pMsg->Data.v; /* Notification code */
switch (NCode) {
case WM_NOTIFICATION_RELEASED: /* React only if released */
switch (Id) {
case GUI_ID_OK:
GUI_EndDialog(hDlg, 0);
break;
case GUI_ID_CANCEL:
GUI_EndDialog(hDlg, 1);
break;
}
break;
case WM_NOTIFICATION_VALUE_CHANGED:
hItem = WM_GetDialogItem(hDlg, GUI_ID_RADIO0);
Sel = RADIO_GetValue(hItem);
hItem = WM_GetDialogItem(hDlg, GUI_ID_EDIT0);
WM_SetEnableState(hItem, Sel == 2);
break;
}
break;
default:
WM_DefaultProc(pMsg);
}
}
示例5: _cbDialog
/**
* @brief Callback routine of the Benchmark dialog
* @param pMsg: pointer to data structure of type WM_MESSAGE
* @retval None
*/
static void _cbDialog(WM_MESSAGE * pMsg) {
WM_HWIN hItem;
int Id, NCode;
WM_HWIN hGraph;
int cpu_speed = 0;
RTC_TimeTypeDef RTC_Time;
uint8_t sec, min, hour;
char temp[50];
WM_CALLBACK *_cb;
switch (pMsg->MsgId) {
case WM_INIT_DIALOG:
hItem = pMsg->hWin;
FRAMEWIN_AddCloseButton(hItem, FRAMEWIN_BUTTON_RIGHT, 0);
/* Initialization of 'CPU' */
hItem = TEXT_CreateEx(20, 30, 100, 25, pMsg->hWin, WM_CF_SHOW,0, 0x123,"");
TEXT_SetFont(hItem, GUI_FONT_13B_1);
TEXT_SetTextColor(hItem, 0x00804000);
TEXT_SetText(hItem, "CPU Usage %:");
hItem = WM_GetDialogItem(pMsg->hWin, ID_BENCH_CPU);
TEXT_SetFont(hItem, GUI_FONT_16B_ASCII);
TEXT_SetTextColor(hItem, GUI_DARKRED);
hItem = WM_GetDialogItem(pMsg->hWin, ID_CPU_GRAPH);
FRAMEWIN_SetBarColor(hItem, 0, GUI_DARKGRAY);
FRAMEWIN_SetBarColor(hItem, 1, GUI_DARKGRAY);
hGraph = GRAPH_CreateEx(10, 45, 220, 110, pMsg->hWin, WM_CF_SHOW, 0, GUI_ID_GRAPH0);
hData = GRAPH_DATA_YT_Create(GUI_LIGHTGREEN, 500, 0, 20);
GRAPH_SetGridVis(hGraph, 1);
GRAPH_SetBorder(hGraph, 20, 4, 5, 4);
GRAPH_AttachData(hGraph, hData);
hScale = GRAPH_SCALE_Create(20, GUI_TA_RIGHT, GRAPH_SCALE_CF_VERTICAL, 25);
GRAPH_AttachScale(hGraph, hScale);
GRAPH_SCALE_SetTextColor(hScale, GUI_YELLOW);
GRAPH_SetGridDistX(hGraph, 25);
GRAPH_SetGridDistY(hGraph, 25);
WM_CreateWindowAsChild(80, 45, 354, 23, pMsg->hWin, WM_CF_SHOW | WM_CF_HASTRANS, _cbCpuWindow , 0);
break;
case WM_NOTIFY_PARENT:
Id = WM_GetId(pMsg->hWinSrc); /* Id of widget */
NCode = pMsg->Data.v; /* Notification code */
switch (NCode) {
case WM_NOTIFICATION_RELEASED: /* React only if released */
switch (Id) {
case ID_BENCH_CPU:
Stop_Test = 0;
WM_HideWindow(pMsg->hWin);
_cb = WM_GetCallback(WM_HBKWIN);
WM_SetCallback(WM_HBKWIN, _ClearDesktop);
cpu_speed = Run_SpeedTest();
hItem = WM_GetDialogItem(pMsg->hWin, ID_IMAGE_LIST);
k_GetTime(&RTC_Time);
sec = RTC_Time.Seconds;
min = RTC_Time.Minutes;
hour = RTC_Time.Hours;
sprintf(temp,"[%02d:%02d:%02d]: %d Pix/s ", hour , min, sec, cpu_speed);
LISTBOX_AddString(hItem, temp);
WM_ShowWindow(pMsg->hWin);
hItem = WM_GetDialogItem(pMsg->hWin, ID_BENCH_CPU);
sprintf (temp, "%d Pixels/s ", cpu_speed);
TEXT_SetText(hItem, temp);
WM_SetCallback(WM_HBKWIN, _cb);
hItem = WM_GetDialogItem(WM_HBKWIN, ID_BUTTON_BKGND);
WM_InvalidateWindow(hItem);
WM_InvalidateWindow(WM_HBKWIN);
WM_Paint(WM_HBKWIN);
break;
}
break;
case WM_NOTIFICATION_CHILD_DELETED:
Stop_Test = 1;
break;
}
break;
default:
WM_DefaultProc(pMsg);
break;
//.........这里部分代码省略.........
示例6: _cbplaybackwin
//.........这里部分代码省略.........
_StartPlay(&hvideo, (char *)VideoList.file[Video_FilePos].name, &Video_File, 0, 0);
VideoPlayer_State = VIDEO_PLAY;
}
else
{
_StartPlay(&hvideo, (char *)VideoList.file[Video_FilePos].name, &Video_File, 0, 0);
_StopPlay(&hvideo, &Video_File);
}
break;
}
break;
/* Notifications sent by 'progress' Slider */
case ID_SLIDER_DURATION:
if(NCode == WM_NOTIFICATION_CLICKED)
{
hItem = WM_GetDialogItem(pMsg->hWin, ID_SLIDER_DURATION);
int32_t newpos;
if(VideoPlayer_State == VIDEO_PLAY)
{
GUI_MOVIE_Pause(hvideo);
hItem = WM_GetDialogItem(pMsg->hWin, ID_SLIDER_DURATION);
newpos = (SLIDER_GetValue(hItem) * Video_Info.NumFrames)/100;
GUI_MOVIE_GotoFrame(hvideo, newpos);
GUI_MOVIE_Play(hvideo);
elapsed_time = (Video_Info.msPerFrame * newpos)/ 1000;
hItem = WM_GetDialogItem(playbackwin, ID_ELAPSED_TIME);
sprintf((char *)tmp , "%02lu:%02lu", elapsed_time/60, elapsed_time%60 );
TEXT_SetText(hItem, tmp);
WM_InvalidateWindow(hItem);
WM_Paint(hItem);
}
}
break;
case ID_BUTTON_BACK:
switch(NCode) {
case WM_NOTIFICATION_RELEASED:
if(Video_FilePos > 0)
{
Video_FilePos--;
}
else
{
Video_FilePos = VideoList.ptr - 1;
}
if((VideoPlayer_State == VIDEO_PLAY) ||
(VideoPlayer_State == VIDEO_PAUSE))
{
_StopPlay(&hvideo, &Video_File);
_StartPlay(&hvideo, (char *)VideoList.file[Video_FilePos].name, &Video_File, 0, 0);
VideoPlayer_State = VIDEO_PLAY;
}
else
{
_StartPlay(&hvideo, (char *)VideoList.file[Video_FilePos].name, &Video_File, 0, 0);
_StopPlay(&hvideo, &Video_File);
}
break;
}
break;
case PLAY_VIDEO_ID:
switch(NCode) {
case WM_NOTIFICATION_RELEASED:
if((VideoPlayer_State == VIDEO_IDLE) || (VideoPlayer_State == VIDEO_PAUSE))
{
hTimer = WM_CreateTimer(playbackwin, ID_TIMER_PROCESS, 1000, 0);
GUI_MOVIE_Play(hvideo);
VideoPlayer_State = VIDEO_PLAY;
}
else if(VideoPlayer_State == VIDEO_STOP)
{
_StartPlay(&hvideo, (char *)VideoList.file[Video_FilePos].name, &Video_File, 0, 0);
VideoPlayer_State = VIDEO_PLAY;
}
else
{
GUI_MOVIE_Pause(hvideo);
VideoPlayer_State = VIDEO_PAUSE;
if(hTimer != 0)
{
WM_DeleteTimer(hTimer);
hTimer = 0;
}
}
break;
}
break;
}
break;
default:
WM_DefaultProc(pMsg);
break;
}
}
示例7: _cbClockWindow
/**
* @brief Callback function of the Clock window
* @param pMsg: pointer to a data structure of type WM_MESSAGE
* @retval None
*/
static void _cbClockWindow(WM_MESSAGE * pMsg) {
WM_HWIN hItem;
static WM_HTIMER hTimerTime;
RTC_TimeTypeDef RTC_TimeStructure;
RTC_DateTypeDef RTC_DateStructure;
uint8_t sec, min, hour, day, month;
uint16_t year;
static uint8_t TempStr[50];
static CALENDAR_DATE current_date;
switch (pMsg->MsgId)
{
case WM_CREATE:
RTC_GetDate(RTC_Format_BIN, &RTC_DateStructure);
current_date.Year = RTC_DateStructure.RTC_Year + 2000;
current_date.Month = RTC_DateStructure.RTC_Month;
current_date.Day = RTC_DateStructure.RTC_Date;
/* Create timer */
hTimerTime = WM_CreateTimer(pMsg->hWin, 0, 1000, 0);
break;
case WM_TIMER:
/* Write date and clock */
RTC_GetTime(RTC_Format_BIN, &RTC_TimeStructure);
sec = RTC_TimeStructure.RTC_Seconds;
min = RTC_TimeStructure.RTC_Minutes;
hour = RTC_TimeStructure.RTC_Hours;
RTC_GetDate(RTC_Format_BIN, &RTC_DateStructure);
year = RTC_DateStructure.RTC_Year + 2000;
month = RTC_DateStructure.RTC_Month;
day = RTC_DateStructure.RTC_Date;
if((current_date.Day != day) ||(current_date.Month != month)
||(current_date.Year != year))
{
current_date.Year = year = RTC_DateStructure.RTC_Year + 2000;
current_date.Month = month = RTC_DateStructure.RTC_Month;
current_date.Day = day = RTC_DateStructure.RTC_Date;
hItem = WM_GetDialogItem(WM_GetParent(pMsg->hWin), ID_TEXT_DATE);
sprintf((char *)TempStr, "%02d, %s, %04d",day , strMonth[month-1], year);
TEXT_SetText(hItem, (char *)TempStr);
hItem = WM_GetDialogItem(WM_GetParent(pMsg->hWin), ID_CALENDAR);
CALENDAR_SetDate(hItem, ¤t_date);
CALENDAR_SetSel(hItem, ¤t_date);
WM_InvalidateWindow(hItem);
}
hItem = WM_GetDialogItem(WM_GetParent(pMsg->hWin), ID_TEXT_CLOCK);
sprintf((char *)TempStr, "%02d:%02d:%02d",hour , min, sec);
TEXT_SetText(hItem, (char *)TempStr);
WM_InvalidateWindow(pMsg->hWin);
WM_RestartTimer(pMsg->Data.v, 0);
break;
case WM_DELETE:
WM_DeleteTimer(hTimerTime);
break;
default:
WM_DefaultProc(pMsg);
}
}
示例8: _cbDialog
//.........这里部分代码省略.........
case ID_PREVIOUS_BUTTON:
if(NCode == WM_NOTIFICATION_RELEASED)
{
if( pWavList->ptr > 0)
{
if(file_pos > 0)
{
file_pos--;
LISTVIEW_DecSel(WM_GetDialogItem(AUDIOPLAYER_hWin, ID_WAVFILE_LIST));
}
else if(PlayerSettings.b.repeat == REPEAT_ALL)
{
file_pos = (pWavList->ptr - 1);
LISTVIEW_SetSel(WM_GetDialogItem(AUDIOPLAYER_hWin, ID_WAVFILE_LIST), file_pos);
}
if(AUDIOPLAYER_GetState() == AUDIOPLAYER_PLAY)
{
if(PlayerSettings.b.pause == PAUSE_ACTIVE)
{
PlayerSettings.b.pause = PLAY_ACTIVE;
hItem = WM_GetDialogItem(pMsg->hWin, ID_PLAY_BUTTON);
WM_InvalidateWindow(hItem);
WM_Update(hItem);
}
AUDIOPLAYER_Stop();
_PlayFile((char *)pWavList->file[file_pos].name);
}
}
}
break;
/* Notifications sent by 'Open' Button */
case ID_OPEN_BUTTON:
switch(NCode) {
case WM_NOTIFICATION_CLICKED:
break;
case WM_NOTIFICATION_RELEASED:
pFileInfo->pfGetData = k_GetData;
pFileInfo->pMask = acMask_dir;
hItem = CHOOSEFILE_Create(pMsg->hWin, 20, 20, 200, 150, apDrives, GUI_COUNTOF(apDrives), 0, "Add a folder", 0, pFileInfo);
WM_MakeModal(hItem);
result = GUI_ExecCreatedDialog(hItem);
if (result == 0)
{
_AddEntireFolder(pFileInfo->pRoot);
}
break;
}
break;
/* Notifications sent by 'Add' Button */
case ID_ADD_BUTTON:
switch(NCode) {
case WM_NOTIFICATION_RELEASED:
pFileInfo->pfGetData = k_GetData;
pFileInfo->pMask = acMask_audio;
hItem = CHOOSEFILE_Create(pMsg->hWin, 20, 20, 200, 150, apDrives, GUI_COUNTOF(apDrives), 0, "Add to playlist", 0, pFileInfo);
WM_MakeModal(hItem);
result = GUI_ExecCreatedDialog(hItem);
if (result == 0)
{
if((strstr(pFileInfo->pRoot, ".wav")) || (strstr(pFileInfo->pRoot, ".WAV")))
{
if(pWavList->ptr < FILEMGR_LIST_DEPDTH)
{
strcpy((char *)pWavList->file[pWavList->ptr].name, pFileInfo->pRoot);
FILEMGR_GetFileOnly (tmp, pFileInfo->pRoot);
hItem = WM_GetDialogItem(pMsg->hWin, ID_WAVFILE_LIST);
if(AUDIOPLAYER_GetFileInfo(pFileInfo->pRoot, &WavInfo) == 0)
{
LISTVIEW_AddRow(hItem, NULL);
LISTVIEW_SetItemText(hItem, 0, pWavList->ptr, tmp);
duration = WavInfo.FileSize / WavInfo.ByteRate;
sprintf((char *)tmp , "%02d:%02d", duration/60, duration%60 );
LISTVIEW_SetItemText(hItem, 1, pWavList->ptr, tmp);
pWavList->ptr++;
}
}
}
}
break;
}
break;
}
break;
default:
WM_DefaultProc(pMsg);
break;
}
}
示例9: _cbDialog
//.........这里部分代码省略.........
}
else //sel>=1
{
DROPDOWN_SetSel(hItem,1);
}
store_dev=DROPDOWN_GetSel(hItem);
WT_TestFolder_Init();
hItem = WM_GetDialogItem(pMsg->hWin, ID_LISTBOX_0);
items = LISTBOX_GetNumItems(hItem);
for(i=0;i<items;i++)
{
LISTBOX_DeleteItem(hItem,0);
}
for(i=0;i<TestFolder.number_TotalFile;i++)
{
LISTBOX_AddString(hItem, (char *)TestFolder.FilesName[i]);
}
}
break;
case MY_MESSAGE_CANCEL://取消
GUI_EndDialog(pMsg->hWin,0);
break;
case MY_MESSAGE_OK:
hIteminfo = WM_GetDialogItem(pMsg->hWin, ID_TEXT_1);
TEXT_SetText(hIteminfo, (char *)"打开文件中……");
WM_ShowWindow(hIteminfo);
GUI_Exec();
hItem = WM_GetDialogItem(pMsg->hWin, ID_LISTBOX_0);
TestFolder.number_CurrentFile=LISTBOX_GetSel(hItem);
hItem = WM_GetDialogItem(pMsg->hWin, ID_DROPDOWN_0);
store_dev=DROPDOWN_GetSel(hItem);
WT_TestItem_Init((char *)TestFolder.FilesName[TestFolder.number_CurrentFile]);
//WT_TestFile_Write2Flash((char *)TestFolder.FilesName[TestFolder.number_CurrentFile]);//将文件内容复制到Flash
//WT_TestFiles_Write2card((char *)TestFolder.FilesName[TestFolder.number_CurrentFile]);//将文件内容复制到SD card
if(TestFile.file_status == 1)//文件读取OK
{
Msg.MsgId = MY_MESSAGE_BUTTONOK;
WM_SendMessage(pMsg->hWinSrc,&Msg);
GUI_EndDialog(pMsg->hWin,0);
}
else
{
TEXT_SetText(hIteminfo, (char *)"读取文件错误!");
WM_ShowWindow(hIteminfo);
}
Msg.MsgId = MY_MESSAGE_BUTTONOK;
WM_SendMessage(pMsg->hWinSrc,&Msg);
GUI_EndDialog(pMsg->hWin,0);
break;
case MY_MESSAGE_BUTTONDELETE:
hItem = WM_GetDialogItem(pMsg->hWin, ID_DROPDOWN_0);
store_dev=DROPDOWN_GetSel(hItem);
if(store_dev==0) //usb
strcpy(filename,path_testfile);
//f_opendir(&dir, path_testfile);
if(store_dev==1) //sd
strcpy(filename,path_testfile_sd);
//f_opendir(&dir, path_testfile_sd);
//res = f_opendir(&dir, "1:/LZY_WireTester/Test Files");
hItem = WM_GetDialogItem(pMsg->hWin, ID_LISTBOX_0);
strcat(filename,"/");
sel = LISTBOX_GetSel(hItem);
if(sel < 0) break;
strcat(filename,(char *)TestFolder.FilesName[LISTBOX_GetSel(hItem)]);
res=f_unlink((const TCHAR*)filename);
if(res == FR_OK)
{
hItem = WM_GetDialogItem(pMsg->hWin, ID_DROPDOWN_0);
store_dev=DROPDOWN_GetSel(hItem);
WT_TestFolder_Init();
hItem = WM_GetDialogItem(pMsg->hWin, ID_LISTBOX_0);
items = LISTBOX_GetNumItems(hItem);
for(i=0;i<items;i++)
{
LISTBOX_DeleteItem(hItem,0);
}
for(i=0;i<TestFolder.number_TotalFile;i++)
{
LISTBOX_AddString(hItem, (char *)TestFolder.FilesName[i]);
}
WM_SetFocus(hItem);
if(sel > 0) LISTBOX_SetSel(hItem,sel - 1);
else LISTBOX_SetSel(hItem,0);
}
break;
case WM_PAINT://绘制标题栏
GUI_SetColor(GUI_DARKBLUE);
GUI_FillRect(0,0,380,22);
GUI_SetColor(GUI_DARKGRAY);
GUI_SetPenSize(8);
GUI_DrawRect(0,0,378,220);
break;
default:
WM_DefaultProc(pMsg);
break;
}
}
示例10: _cbAudioProcess
/**
* @brief callback for audio process
* @param pMsg: pointer to data structure of type WM_MESSAGE
* @retval None
*/
static void _cbAudioProcess(WM_MESSAGE * pMsg) {
uint32_t Id;
WM_HWIN hItem;
char tmp[] = "00:00";
long progress;
uint32_t duration;
switch (pMsg->MsgId)
{
case WM_CREATE:
hProcessTimer = WM_CreateTimer(pMsg->hWin, ID_PROCESS_TIMER, 1000, 0);
break;
case WM_TIMER:
Id = WM_GetTimerId(pMsg->Data.v);
if(Id == ID_PROCESS_TIMER)
{
if(AUDIOPLAYER_GetState() == AUDIOPLAYER_PLAY)
{
progress = AUDIOPLAYER_GetProgress();
/*Set elapsed time */
duration = progress / WavInfo.ByteRate;
sprintf((char *)tmp , "%02lu:%02lu", duration/60, duration%60 );
hItem = WM_GetDialogItem(AUDIOPLAYER_hWin, ID_ELAPSED_TIME);
TEXT_SetText(hItem, tmp);
/* Set progress slider position */
hItem = WM_GetDialogItem(AUDIOPLAYER_hWin, ID_DURATION_SLIDER);
progress = (long)(progress/(WavInfo.FileSize/100));
SLIDER_SetValue(hItem, progress);
WM_Update(hItem);
}
AUDIOPLAYER_Process();
WM_RestartTimer(pMsg->Data.v, 1000);
}
else if (Id == ID_PLAYLIST_TIMER)
{
playlist_select = 0;
}
break;
case WM_DELETE:
WM_DeleteTimer(hProcessTimer);
if(hPlaylistTimer)
{
WM_DeleteTimer(hPlaylistTimer);
hPlaylistTimer = 0;
}
break;
default:
WM_DefaultProc(pMsg);
}
}
示例11: _cbMediaConnection
/**
* @brief Callback function of the media connection status
* @param pMsg: pointer to data structure of type WM_MESSAGE
* @retval None
*/
static void _cbMediaConnection(WM_MESSAGE * pMsg)
{
WM_HWIN hItem;
static WM_HTIMER hStatusTimer;
static uint8_t prev_sd_status = 0;
static uint8_t prev_usb_status = 0;
switch (pMsg->MsgId)
{
case WM_CREATE:
prev_sd_status = k_StorageGetStatus(MSD_DISK_UNIT);
prev_usb_status = k_StorageGetStatus(USB_DISK_UNIT);
hStatusTimer = WM_CreateTimer(pMsg->hWin, 0, 500, 0);
break;
case WM_TIMER:
if(prev_sd_status != k_StorageGetStatus(MSD_DISK_UNIT))
{
prev_sd_status = k_StorageGetStatus(MSD_DISK_UNIT);
if(pWavList->file[file_pos].name[0] == '1')
{
if(PlayerSettings.b.pause == PAUSE_ACTIVE)
{
PlayerSettings.b.pause = PLAY_ACTIVE;
}
AUDIOPLAYER_Stop();
hItem = WM_GetDialogItem(AUDIOPLAYER_hWin, ID_ELAPSED_TIME);
TEXT_SetText(hItem, "00:00");
hItem = WM_GetDialogItem(AUDIOPLAYER_hWin, ID_PLAY_BUTTON);
WM_InvalidateWindow(hItem);
WM_Update(hItem);
}
}
else if(prev_usb_status != k_StorageGetStatus(USB_DISK_UNIT))
{
prev_usb_status = k_StorageGetStatus(USB_DISK_UNIT);
if(pWavList->file[file_pos].name[0] == '0')
{
if(PlayerSettings.b.pause == PAUSE_ACTIVE)
{
PlayerSettings.b.pause = PLAY_ACTIVE;
}
AUDIOPLAYER_Stop();
hItem = WM_GetDialogItem(AUDIOPLAYER_hWin, ID_ELAPSED_TIME);
TEXT_SetText(hItem, "00:00");
hItem = WM_GetDialogItem(AUDIOPLAYER_hWin, ID_PLAY_BUTTON);
WM_InvalidateWindow(hItem);
WM_Update(hItem);
}
}
WM_RestartTimer(pMsg->Data.v, 500);
break;
case WM_DELETE:
if(hStatusTimer != 0)
{
WM_DeleteTimer(hStatusTimer);
hStatusTimer = 0;
}
break;
default:
WM_DefaultProc(pMsg);
}
}
示例12: _cbStatus
//.........这里部分代码省略.........
static uint8_t TempStr[50];
static WM_HTIMER hTimerTime;
RTC_TimeTypeDef RTC_Time;
RTC_DateTypeDef RTC_DateStructure;
uint8_t sec, min, hour, day, month;
uint16_t year;
WM_HWIN hWin;
hWin = pMsg->hWin;
switch (pMsg->MsgId)
{
case WM_CREATE:
hTimerTime = WM_CreateTimer(hWin, ID_TIMER_TIME, 1000, 0);
break;
case WM_DELETE:
WM_DeleteTimer(hTimerTime);
break;
case WM_TIMER:
if( WM_GetTimerId(pMsg->Data.v) == ID_TIMER_TIME)
{
WM_InvalidateWindow(hStatusWin);
WM_RestartTimer(pMsg->Data.v, 1000);
}
break;
case WM_PAINT:
xSize = WM_GetWindowSizeX(hWin);
ySize = WM_GetWindowSizeY(hWin);
/* Draw background */
GUI_SetColor(0x00E6B26C);
GUI_FillRect(0, 0, xSize , ySize - 3);
GUI_SetColor(0x00FFB26C);
GUI_DrawHLine(ySize - 2, 0, xSize );
GUI_SetColor(0x00FFB26C);
GUI_DrawHLine(ySize - 1, 0, xSize );
/* Draw time & Date */
GUI_SetTextMode(GUI_TM_TRANS);
GUI_SetColor(GUI_WHITE);
GUI_SetFont(GUI_FONT_13B_ASCII);
k_GetTime(&RTC_Time);
sec = RTC_Time.Seconds;
min = RTC_Time.Minutes;
hour = RTC_Time.Hours;
k_GetDate(&RTC_DateStructure);
sprintf((char *)TempStr, "%02d:%02d:%02d", hour , min, sec);
GUI_DispStringAt((char *)TempStr, xSize - 50, 4);
year = RTC_DateStructure.Year + 2015;
month = RTC_DateStructure.Month;
day = RTC_DateStructure.Date;
if((day > 0) && (day <= 31) &&
(month > 0)&& (month <= 12) &&
(year >= 1900))
{
sprintf((char *)TempStr, "%02d, %s, %04d", day , strMonth[month-1], year);
}
else
{
sprintf((char *)TempStr, "01, Jan, 2015");
}
GUI_DispStringHCenterAt((char *)TempStr, (xSize / 2), 4);
/* USB */
if(k_StorageGetStatus(USB_DISK_UNIT))
{
GUI_DrawBitmap(&bmusbdisk, xSize - 80, 0);
}
/* MSD */
if(k_StorageGetStatus(MSD_DISK_UNIT))
{
GUI_DrawBitmap(&bmmicrosd, xSize - 80 - 30 * k_StorageGetStatus(USB_DISK_UNIT) , 0);
}
sprintf((char *)TempStr, "CPU : %d %%", osGetCPUUsage());
if(osGetCPUUsage() > 95 )
{
/* waiting for user input when using dialog box*/
sprintf((char *)TempStr, "CPU : 95 %%");
}
GUI_DispStringAt( (char *)TempStr, 50, 4);
break;
default:
WM_DefaultProc(pMsg);
}
}
示例13: _cbBk
//.........这里部分代码省略.........
FRAMEWIN_CF_MOVEABLE | WM_CF_FGND | WM_CF_STAYONTOP,
50);
}
else
{
WM_ShowWindow(hProcess);
WM_BringToTop(hProcess);
}
break;
case ID_MENU_PERF:
if(hPerformance == 0)
{
hPerformance = GUI_CreateDialogBox(_aPerformanceDialogCreate,
GUI_COUNTOF(_aPerformanceDialogCreate),
_cbPerformanceDialog,
pMsg->hWin,
FRAMEWIN_CF_MOVEABLE | WM_CF_FGND | WM_CF_STAYONTOP,
50);
}
else
{
WM_ShowWindow(hPerformance);
WM_BringToTop(hPerformance);
}
break;
case ID_MENU_EXIT:
break;
}
}
break;
case WM_PAINT:
GUI_SetBkColor(GUI_WHITE);
GUI_Clear();
if(hIcon)
{
WM_BringToBottom(hIcon);
}
break;
case WM_NOTIFY_PARENT:
Id = WM_GetId(pMsg->hWinSrc);
NCode = pMsg->Data.v;
switch (NCode)
{
case WM_NOTIFICATION_CLICKED:
if (Id == ID_ICONVIEW_MENU)
{
sel = ICONVIEW_GetSel(pMsg->hWinSrc);
if(hPerformance != 0)
{
WM_HideWindow(hPerformance);
}
if(sel < k_ModuleGetNumber())
{
if(sel < 8)
{
ICONVIEW_SetSel(pMsg->hWinSrc, -1);
}
else
{
ICONVIEW_SetSel(pMsg->hWinSrc, k_ModuleGetNumber() + 1);
}
}
}
break;
case WM_NOTIFICATION_RELEASED:
if (Id == ID_ICONVIEW_MENU)
{
if(sel < k_ModuleGetNumber())
{
module_prop[sel].module->startup(pMsg->hWin, 0, 25);
sel = 0;
}
}
else if (Id == ID_BUTTON_BKGND)
{
/* Create popup menu after touching the display */
_OpenPopup(WM_HBKWIN, _aMenuItems, GUI_COUNTOF(_aMenuItems),0 , 25);
}
break;
default:
break;
}
break;
default:
WM_DefaultProc(pMsg);
}
}
示例14: _cbProcessManagerDialog
/**
* @brief Callback function of the process manager dialog
* @param pMsg: pointer to data structure of type WM_MESSAGE
* @retval None
*/
static void _cbProcessManagerDialog(WM_MESSAGE * pMsg) {
WM_HWIN hItem;
int NCode;
int Id, Idx;
switch (pMsg->MsgId) {
case WM_INIT_DIALOG:
hItem = pMsg->hWin;
FRAMEWIN_SetTitleVis(hItem, 0);
hItem = WM_GetDialogItem(pMsg->hWin, ID_LISTVIEW_PROCESSMANAGER);
LISTVIEW_AddColumn(hItem, 100, "Tasks", GUI_TA_HCENTER | GUI_TA_VCENTER);
LISTVIEW_AddColumn(hItem, 60, "Priority", GUI_TA_HCENTER | GUI_TA_VCENTER);
LISTVIEW_AddColumn(hItem, 60, "State", GUI_TA_HCENTER | GUI_TA_VCENTER);
LISTVIEW_SetGridVis(hItem, 1);
LISTVIEW_SetTextAlign(hItem, 0, GUI_TA_LEFT);
LISTVIEW_SetTextAlign(hItem, 1, GUI_TA_HCENTER);
LISTVIEW_SetTextAlign(hItem, 2, GUI_TA_HCENTER);
HEADER_SetDragLimit(LISTVIEW_GetHeader(hItem), 1);
LISTVIEW_SetCompareFunc(hItem, 1, LISTVIEW_CompareDec);
LISTVIEW_SetTextColor(hItem, LISTVIEW_CI_SELFOCUS, GUI_LIGHTBLUE);
for (Idx = 0; Idx < 16; Idx ++)
{
LISTVIEW_AddRow(hItem, NULL);
}
_UpdateProcessManagerView(hItem);
WM_CreateWindowAsChild(470, 0, 10, 10, pMsg->hWin, WM_CF_SHOW | WM_CF_HASTRANS, _cbTaskWindow , 0);
break;
case WM_PAINT:
hItem = WM_GetDialogItem(pMsg->hWin, ID_LISTVIEW_PROCESSMANAGER);
_UpdateProcessManagerView(hItem);
break;
case WM_NOTIFY_PARENT:
Id = WM_GetId(pMsg->hWinSrc);
NCode = pMsg->Data.v;
switch(Id) {
case ID_BUTTON_CANCEL_PROCESSMANAGER: /* Notifications sent by 'Cancel' button */
switch(NCode) {
case WM_NOTIFICATION_RELEASED:
GUI_EndDialog(pMsg->hWin, 0);
hProcess = 0;
break;
}
break;
case ID_LISTVIEW_PROCESSMANAGER: /* Notifications sent by 'Listview' */
switch(NCode) {
case WM_NOTIFICATION_CLICKED:
break;
case WM_NOTIFICATION_RELEASED:
break;
case WM_NOTIFICATION_SEL_CHANGED:
break;
}
break;
}
break;
default:
WM_DefaultProc(pMsg);
break;
}
}
示例15: _cbDialog
//.........这里部分代码省略.........
ST_AnimatedIconView_AddIcon(hItem, add_video, 0, "Open playlist");
break;
case WM_PAINT:
GUI_SetColor(GUI_BLACK);
GUI_DrawLine(479, 0, 479, 272);
break;
case WM_NOTIFY_PARENT:
Id = WM_GetId(pMsg->hWinSrc); /* Id of widget */
NCode = pMsg->Data.v; /* Notification code */
switch(Id) {
case ID_BUTTON_EXIT:
switch(NCode) {
case WM_NOTIFICATION_CLICKED:
/* avoid icon view animation */
hItem = WM_GetDialogItem(pMsg->hWin, ID_ICONVIEW_SUBMENU);
WM_HideWindow(hItem);
break;
case WM_NOTIFICATION_MOVED_OUT:
hItem = WM_GetDialogItem(pMsg->hWin, ID_ICONVIEW_SUBMENU);
WM_ShowWindow(hItem);
break;
case WM_NOTIFICATION_RELEASED:
GUI_EndDialog(pMsg->hWin, 0);
break;
}
break;
case ID_ICONVIEW_SUBMENU:
switch(NCode) {
case WM_NOTIFICATION_RELEASED:
sel = ST_AnimatedIconView_GetSel(pMsg->hWinSrc);
if(sel == 0)
{
if(VNC_IsRunning() == 0)
{
/* Playlist not empty, so start play first item */
if(VideoList.ptr > 0)
{
GUI_SetLayerVisEx (1, 1);
GUI_SelectLayer(1);
playbackwin = WM_CreateWindowAsChild(-1, 0, 480, 272, WM_GetDesktopWindowEx(1), WM_CF_SHOW, _cbplaybackwin , 0);
WM_CreateWindowAsChild(0, 70, 480, 140, WM_GetDesktopWindowEx(1), WM_CF_SHOW | WM_CF_HASTRANS, _cbTouch , 0);
GUI_SelectLayer(0);
_StartPlay(&hvideo, (char *)VideoList.file[0].name, &Video_File, 0, 0);
VideoPlayer_State = VIDEO_PLAY;
hFrame = WM_CreateWindowAsChild(-1, 0, 480, 272,pMsg->hWin, WM_CF_SHOW, _cbVideoWindow , 0);
GUI_SelectLayer(1);
}
else
{/* There is no item yet in the playlist: Show hint message */
hItem = GUI_CreateDialogBox(_aFileInfoDialogCreate,
GUI_COUNTOF(_aFileInfoDialogCreate),
_cbFileInfoDialog,
pMsg->hWin,
75,
30);
WM_MakeModal(hItem);
}
}
else
{
hItem = GUI_CreateDialogBox(_aFileErrorDialogCreate,
GUI_COUNTOF(_aFileErrorDialogCreate),
_cbFileInfoDialog,
pMsg->hWin,
75,
30);
WM_MakeModal(hItem);
}
}
else if(sel == 1)
{
hPlaylistWin = GUI_CreateDialogBox(_aPlaylistDialogCreate,
GUI_COUNTOF(_aPlaylistDialogCreate),
_cbPlaylistDialog,
pMsg->hWin,
60,
40);
WM_MakeModal(hPlaylistWin);
}
break;
}
break;
}
break;
default:
WM_DefaultProc(pMsg);
break;
}
}