基于MiniGUI的嵌入式媒體播放器設(shè)計與實現(xiàn)
3.3 主要函數(shù)及具體實現(xiàn)
⑴ 播放控制事件回調(diào)函數(shù)
static int main_event_cb (HWND hwnd, skin_item_t* item, int event, void* data)
{ …
if (event==SIE_BUTTON_CLICKED) {
switch (item->id) {
case SIID_PLAY:
…
case SIID_PAUSE:
…
case SIID_STOP:
…
case SIID_CLOSE:
…
}
}
else if (event==SIE_SLIDER_CHANGED item->id!=SIID_VOLUME) {
…
}
return 1;
}
⑵ 列表事件處理函數(shù)
void playlist_handle_event(PEvent *event, void *data)
{
…
switch(event->type) {
case ButtonPress:
…
case ButtonRelease:
…
case KeyPress:
if(!playlist)
return;
mykeyevent = event->xkey;
LockDisplay(gGui->display);
len=LookupString(mykeyevent, kbuf, sizeof(kbuf), mykey, NULL);
UnlockDisplay(gGui->display);
switch (mykey) {
case K_Down:
case K_Next:
browser_step_up(playlist->playlist, NULL);
break;
case K_Up:
case K_Prior:
browser_step_down(playlist->playlist, NULL);
break;
default:
gui_handle_event(event, data);
break;
}
評論