/********************************************************************* * * _SCROLLBAR_Callback */ static void _SCROLLBAR_Callback (WM_MESSAGE *pMsg) { SCROLLBAR_Handle hObj; SCROLLBAR_Obj* pObj; hObj = pMsg->hWin; pObj = SCROLLBAR_H2P(hObj); /* Let widget handle the standard messages */ if (WIDGET_HandleActive(hObj, pMsg) == 0) { return; } switch (pMsg->MsgId) { case WM_DELETE: SCROLLBAR__InvalidatePartner(hObj); break; case WM_PAINT: GUI_DEBUG_LOG("SCROLLBAR: _Callback(WM_PAINT)\n"); _Paint(pObj); return; case WM_TOUCH: _OnTouch(hObj, pObj, pMsg); break; case WM_KEY: _OnKey(hObj, pMsg); break; case WM_SET_SCROLL_STATE: _OnSetScrollState(hObj, pObj, (const WM_SCROLL_STATE*)pMsg->Data.p); break; case WM_GET_SCROLL_STATE: ((WM_SCROLL_STATE*)pMsg->Data.p)->NumItems = pObj->NumItems; ((WM_SCROLL_STATE*)pMsg->Data.p)->PageSize = pObj->PageSize; ((WM_SCROLL_STATE*)pMsg->Data.p)->v = pObj->v; break; } WM_DefaultProc(pMsg); }
/********************************************************************* * * _RADIO_Callback */ static void _RADIO_Callback (WM_MESSAGE* pMsg) { RADIO_Handle hObj; RADIO_Obj* pObj; hObj = pMsg->hWin; pObj = RADIO_H2P(hObj); /* Let widget handle the standard messages */ if (WIDGET_HandleActive(hObj, pMsg) == 0) { return; } switch (pMsg->MsgId) { case WM_PAINT: GUI_DEBUG_LOG("RADIO: _Callback(WM_PAINT)\n"); _OnPaint(hObj, pObj); return; case WM_GET_RADIOGROUP: pMsg->Data.v = pObj->GroupId; return; case WM_TOUCH: _OnTouch(hObj, pObj, pMsg); break; case WM_KEY: _OnKey(hObj, pMsg); break; case WM_DELETE: GUI_ARRAY_Delete(&pObj->TextArray); break; } WM_DefaultProc(pMsg); }
/********************************************************************* * * CHECKBOX_Callback */ void CHECKBOX_Callback (WM_MESSAGE *pMsg) { CHECKBOX_Handle hObj; CHECKBOX_Obj* pObj; hObj = pMsg->hWin; pObj = (CHECKBOX_Obj *)GUI_ALLOC_h2p(hObj); /* Don't use use WIDGET_H2P because WIDGET_INIT_ID() has not be called at this point */ /* Let widget handle the standard messages */ if (WIDGET_HandleActive(hObj, pMsg) == 0) { return; } switch (pMsg->MsgId) { case WM_KEY: _OnKey(hObj, pObj, pMsg); break; case WM_PAINT: GUI_DEBUG_LOG("CHECKBOX: _Callback(WM_PAINT)\n"); _Paint(pObj, hObj); return; case WM_TOUCH: _OnTouch(hObj, pObj, pMsg); break; case WM_DELETE: GUI_DEBUG_LOG("CHECKBOX: _Callback(WM_DELETE)\n"); _Delete(pObj); break; /* No return here ... WM_DefaultProc needs to be called */ } WM_DefaultProc(pMsg); }
/********************************************************************* * * _DROPDOWN_Callback */ static void _DROPDOWN_Callback (WM_MESSAGE*pMsg) { DROPDOWN_Handle hObj = pMsg->hWin; DROPDOWN_Obj* pObj = DROPDOWN_H2P(hObj); char IsExpandedBeforeMsg; IsExpandedBeforeMsg = pObj->hListWin ? 1 : 0; /* Let widget handle the standard messages */ if (WIDGET_HandleActive(hObj, pMsg) == 0) { return; } switch (pMsg->MsgId) { case WM_NOTIFY_PARENT: switch (pMsg->Data.v) { case WM_NOTIFICATION_SCROLL_CHANGED: WM_NotifyParent(hObj, WM_NOTIFICATION_SCROLL_CHANGED); break; case WM_NOTIFICATION_CLICKED: DROPDOWN_SetSel(hObj, LISTBOX_GetSel(pObj->hListWin)); WM_SetFocus(hObj); break; case LISTBOX_NOTIFICATION_LOST_FOCUS: DROPDOWN_Collapse(hObj); break; } break; case WM_PID_STATE_CHANGED: if (IsExpandedBeforeMsg == 0) { /* Make sure we do not react a second time */ const WM_PID_STATE_CHANGED_INFO * pInfo = (const WM_PID_STATE_CHANGED_INFO*)pMsg->Data.p; if (pInfo->State) { DROPDOWN_Expand(hObj); } } break; case WM_TOUCH: if (_OnTouch(hObj, pMsg) == 0) { return; } break; case WM_PAINT: _Paint(hObj); break; case WM_DELETE: _FreeAttached(pObj); break; /* No return here ... WM_DefaultProc needs to be called */ case WM_KEY: if ( ((const WM_KEY_INFO*)(pMsg->Data.p))->PressedCnt >0) { int Key = ((const WM_KEY_INFO*)(pMsg->Data.p))->Key; switch (Key) { case GUI_KEY_TAB: break; /* Send to parent by not doing anything */ default: DROPDOWN_AddKey(hObj, Key); return; } } break; } WM_DefaultProc(pMsg); }
/********************************************************************* * * BUTTON_Callback */ void BUTTON_Callback(WM_MESSAGE *pMsg) { BUTTON_Handle hObj = pMsg->hWin; BUTTON_Obj* pObj = BUTTON_H2P(hObj); /* Let widget handle the standard messages */ if (WIDGET_HandleActive(hObj, pMsg) == 0) { return; } switch (pMsg->MsgId) { #if BUTTON_REACT_ON_LEVEL case WM_PID_STATE_CHANGED: _OnPidStateChange(hObj, pObj, pMsg); return; /* Message handled. Do not call WM_DefaultProc, because the window may have been destroyed */ #endif case WM_TOUCH: _OnTouch(hObj, pObj, pMsg); return; /* Message handled. Do not call WM_DefaultProc, because the window may have been destroyed */ case WM_PAINT: GUI_DEBUG_LOG("BUTTON: _BUTTON_Callback(WM_PAINT)\n"); _Paint(pObj, hObj); return; case WM_DELETE: GUI_DEBUG_LOG("BUTTON: _BUTTON_Callback(WM_DELETE)\n"); _Delete(pObj); break; /* No return here ... WM_DefaultProc needs to be called */ #if 0 /* TBD: Button should react to space & Enter */ case WM_KEY: { int PressedCnt = ((WM_KEY_INFO*)(pMsg->Data.p))->PressedCnt; int Key = ((WM_KEY_INFO*)(pMsg->Data.p))->Key; if (PressedCnt > 0) { /* Key pressed? */ switch (Key) { case ' ': _ButtonPressed(hObj, pObj); return; } } else { switch (Key) { case ' ': _ButtonReleased(hObj, pObj, WM_NOTIFICATION_RELEASED); return; } } } break; #endif } WM_DefaultProc(pMsg); }
/********************************************************************* * * BUTTON_Callback */ void BUTTON_Callback(WM_MESSAGE *pMsg) { int PressedCnt, Key; BUTTON_Handle hObj = pMsg->hWin; BUTTON_Obj * pObj = (BUTTON_Obj *)GUI_ALLOC_h2p(hObj); /* Don't use use WIDGET_H2P because WIDGET_INIT_ID() has not be called at this point */ /* Let widget handle the standard messages */ if (WIDGET_HandleActive(hObj, pMsg) == 0) { return; } switch (pMsg->MsgId) { #if BUTTON_REACT_ON_LEVEL case WM_PID_STATE_CHANGED: _OnPidStateChange(hObj, pObj, pMsg); return; /* Message handled. Do not call WM_DefaultProc, because the window may have been destroyed */ #endif case WM_TOUCH: _OnTouch(hObj, pObj, pMsg); return; /* Message handled. Do not call WM_DefaultProc, because the window may have been destroyed */ case WM_PAINT: GUI_DEBUG_LOG("BUTTON: _BUTTON_Callback(WM_PAINT)\n"); _Paint(pObj, hObj); return; case WM_DELETE: GUI_DEBUG_LOG("BUTTON: _BUTTON_Callback(WM_DELETE)\n"); _Delete(pObj); break; /* No return here ... WM_DefaultProc needs to be called */ case WM_KEY: PressedCnt = ((WM_KEY_INFO*)(pMsg->Data.p))->PressedCnt; Key = ((WM_KEY_INFO*)(pMsg->Data.p))->Key; switch (Key) { case GUI_KEY_ENTER: if (PressedCnt > 0) { _OnButtonPressed(hObj, pObj); _OnButtonReleased(hObj, pObj, WM_NOTIFICATION_RELEASED); return; } break; case GUI_KEY_SPACE: if (PressedCnt > 0) { _OnButtonPressed(hObj, pObj); } else { _OnButtonReleased(hObj, pObj, WM_NOTIFICATION_RELEASED); } return; } } WM_DefaultProc(pMsg); }
/********************************************************************* * * EDIT_Callback */ void EDIT_Callback (WM_MESSAGE * pMsg) { int IsEnabled; EDIT_Handle hObj; EDIT_Obj* pObj; hObj = (EDIT_Handle) pMsg->hWin; pObj = (EDIT_Obj *)GUI_ALLOC_h2p(hObj); /* Don't use use WIDGET_H2P because WIDGET_INIT_ID() has not be called at this point */ IsEnabled = WM__IsEnabled(hObj); /* Let widget handle the standard messages */ if (WIDGET_HandleActive(hObj, pMsg) == 0) { return; } switch (pMsg->MsgId) { case WM_TOUCH: _OnTouch(hObj, pObj, pMsg); break; case WM_PAINT: GUI_DEBUG_LOG("EDIT: _Callback(WM_PAINT)\n"); _Paint(pObj, hObj); return; case WM_DELETE: GUI_DEBUG_LOG("EDIT: _Callback(WM_DELETE)\n"); _Delete(pObj); break; /* No return here ... WM_DefaultProc needs to be called */ case WM_KEY: if (IsEnabled) { if ( ((const WM_KEY_INFO*)(pMsg->Data.p))->PressedCnt >0) { int Key = ((const WM_KEY_INFO*)(pMsg->Data.p))->Key; switch (Key) { case GUI_KEY_ENTER: case GUI_KEY_ESCAPE: case GUI_KEY_TAB: case GUI_KEY_BACKTAB: break; /* Send to parent by not doing anything */ default: EDIT_AddKey(hObj, Key); return; } } } break; } WM_DefaultProc(pMsg); }
/********************************************************************* * * _cbFrameWin */ static void _cbFrameWin(WM_MESSAGE* pMsg) { switch(pMsg->MsgId) { case WM_TOUCH: if (FRAMEWIN_IsMinimized(pMsg->hWin) == 0) { if (_OnTouch(pMsg->hWin, pMsg)) { return; } } break; case WM_DELETE: _hFrame = 0; _hClient = 0; _hMEdit = 0; _hWrapButton = 0; break; } if (_pcbFrameWin) { (*_pcbFrameWin)(pMsg); } }
/********************************************************************* * * Callback */ static void _LISTBOX_Callback (WM_MESSAGE*pMsg) { LISTBOX_Handle hObj = pMsg->hWin; LISTBOX_Obj* pObj = LISTBOX_H2P(hObj); WM_SCROLL_STATE ScrollState; /* Let widget handle the standard messages */ if (WIDGET_HandleActive(hObj, pMsg) == 0) { return; } switch (pMsg->MsgId) { case WM_NOTIFY_PARENT: if (pMsg->Data.v == WM_NOTIFICATION_VALUE_CHANGED) { WM_GetScrollState(pMsg->hWinSrc, &ScrollState); } pObj->ScrollState.v = ScrollState.v; WM_InvalidateWindow(hObj); break; case WM_ADD_SCROLLBAR: _SetScrollState(hObj); break; case WM_PAINT: _Paint(hObj); break; case WM_TOUCH: if (_OnTouch(hObj, pObj, pMsg) == 0) return; break; case WM_KEY: if ( ((WM_KEY_INFO*)(pMsg->Data.p))->PressedCnt >0) { int Key = ((WM_KEY_INFO*)(pMsg->Data.p))->Key; switch (Key) { case GUI_KEY_TAB: break; /* Send to parent by not doing anything */ default: LISTBOX_AddKey(hObj, Key); return; } } break; } WM_DefaultProc(pMsg); }
/********************************************************************* * * Callback */ static void EDIT__Callback (WM_MESSAGE * pMsg) { int IsEnabled; EDIT_Handle hObj = (EDIT_Handle)pMsg->hWin; EDIT_Obj* pObj = (EDIT_Obj*)WM_HMEM2Ptr(hObj); IsEnabled = WIDGET__IsEnabled(&pObj->Widget); /* Let widget handle the standard messages */ if (WIDGET_HandleActive(hObj, pMsg) == 0) { return; } switch (pMsg->MsgId) { case WM_TOUCH: if (IsEnabled) { _OnTouch(hObj, pObj, pMsg); } break; case WM_PAINT: GUI_DEBUG_LOG("EDIT: _Callback(WM_PAINT)\n"); _Paint(pObj); return; case WM_DELETE: GUI_DEBUG_LOG("EDIT: _Callback(WM_DELETE)\n"); _Delete(pObj); break; /* No return here ... WM_DefaultProc needs to be called */ case WM_KEY: if (IsEnabled) { if ( ((WM_KEY_INFO*)(pMsg->Data.p))->PressedCnt >0) { int Key = ((WM_KEY_INFO*)(pMsg->Data.p))->Key; switch (Key) { case GUI_KEY_TAB: break; /* Send to parent by not doing anything */ default: EDIT_AddKey(hObj, Key); return; } } } break; } WM_DefaultProc(pMsg); }
/********************************************************************* * * Callback */ static void _BUTTON_Callback(WM_MESSAGE *pMsg) { BUTTON_Handle hObj = pMsg->hWin; BUTTON_Obj* pObj = BUTTON_H2P(hObj); /* Let widget handle the standard messages */ if (WIDGET_HandleActive(hObj, pMsg) == 0) { return; } switch (pMsg->MsgId) { case WM_TOUCH: _OnTouch(hObj, pObj, pMsg); break; case WM_PAINT: GUI_DEBUG_LOG("BUTTON: _BUTTON_Callback(WM_PAINT)\n"); _Paint(pObj); return; case WM_DELETE: GUI_DEBUG_LOG("BUTTON: _BUTTON_Callback(WM_DELETE)\n"); _Delete(pObj); break; /* No return here ... WM_DefaultProc needs to be called */ } WM_DefaultProc(pMsg); }
/********************************************************************* * * Framewin Callback */ static void _FRAMEWIN_Callback (WM_MESSAGE *pMsg) { FRAMEWIN_Handle hWin = (FRAMEWIN_Handle)(pMsg->hWin); FRAMEWIN_Obj* pObj = FRAMEWIN_H2P(hWin); GUI_RECT* pRect = (GUI_RECT*)(pMsg->Data.p); switch (pMsg->MsgId) { case WM_PAINT: _Paint(pObj); break; case WM_TOUCH: _OnTouch(hWin, pObj, pMsg); return; /* Return here ... Message handled */ case WM_GETCLIENTRECT: *pRect = pObj->rClient; return; /* Return here ... Message handled */ case WM_GETCLIENTRECT_ABS: /* Do not seperate from WM_GETCLIENTRECT !!! */ *pRect = pObj->rClient; GUI_MoveRect(pRect, pObj->Widget.Win.Rect.x0, pObj->Widget.Win.Rect.y0); return; /* Return here ... Message handled */ case WM_GET_CLIENT_WINDOW: /* return handle to client window. For most windows, there is no seperate client window, so it is the same handle */ pMsg->Data.v = pObj->hClient; return; /* Return here ... Message handled */ case WM_GET_FOCUSSED_CHILD: pMsg->Data.v = pObj->hFocussedChild; return; /* Return here ... Message handled */ case WM_SET_FOCUS: if (pMsg->Data.v == 1) { WM_SetFocus(pObj->hFocussedChild); } else { WM_SetFocus(0); } return; } /* Let widget handle the standard messages */ if (WIDGET_HandleActive(hWin, pMsg) == 0) { return; } WM_DefaultProc(pMsg); }
/********************************************************************* * * _SLIDER_Callback */ static void _SLIDER_Callback (WM_MESSAGE *pMsg) { SLIDER_Handle hObj; SLIDER_Obj* pObj; hObj = pMsg->hWin; pObj = SLIDER_H2P(hObj); /* Let widget handle the standard messages */ if (WIDGET_HandleActive(hObj, pMsg) == 0) { return; } switch (pMsg->MsgId) { case WM_PAINT: GUI_DEBUG_LOG("SLIDER: _Callback(WM_PAINT)\n"); _Paint(pObj); return; case WM_TOUCH: _OnTouch(hObj, pObj, pMsg); break; case WM_KEY: _OnKey(hObj, pMsg); break; } WM_DefaultProc(pMsg); }
/********************************************************************* * * SLIDER_Callback */ void SLIDER_Callback (WM_MESSAGE *pMsg) { SLIDER_Handle hObj; SLIDER_Obj* pObj; hObj = pMsg->hWin; pObj = (SLIDER_Obj *)GUI_ALLOC_h2p(hObj); /* Don't use use WIDGET_H2P because WIDGET_INIT_ID() has not be called at this point */ /* Let widget handle the standard messages */ if (WIDGET_HandleActive(hObj, pMsg) == 0) { return; } switch (pMsg->MsgId) { case WM_PAINT: GUI_DEBUG_LOG("SLIDER: _Callback(WM_PAINT)\n"); _Paint(pObj, hObj); return; case WM_TOUCH: _OnTouch(hObj, pObj, pMsg); break; case WM_KEY: _OnKey(hObj, pMsg); break; } WM_DefaultProc(pMsg); }
/********************************************************************* * * _HOOKFUNC_Resizeable */ static int _HOOKFUNC_Resizeable(WM_MESSAGE* pMsg) { WM_HWIN hWin = pMsg->hWin; if (WM_HasCaptured(hWin) && (_CaptureFlags == 0)) { return 0; } if (FRAMEWIN_IsMinimized(hWin) || FRAMEWIN_IsMaximized(hWin)) { return 0; } switch(pMsg->MsgId) { case WM_TOUCH: return _OnTouch(hWin, pMsg); #if (GUI_SUPPORT_MOUSE & GUI_SUPPORT_CURSOR) case WM_MOUSEOVER: return _OnMouseOver(hWin, pMsg); #endif case WM_CAPTURE_RELEASED: #if GUI_SUPPORT_CURSOR _SetResizeCursor(0); #endif _CaptureFlags = 0; return 1; } return 0; }
/********************************************************************* * * _LISTVIEW_Callback */ static void _LISTVIEW_Callback (WM_MESSAGE *pMsg) { LISTVIEW_Handle hObj; LISTVIEW_Obj* pObj; WM_SCROLL_STATE ScrollState; hObj = pMsg->hWin; /* Let widget handle the standard messages */ if (WIDGET_HandleActive(hObj, pMsg) == 0) { return; } pObj = LISTVIEW_H2P(hObj); switch (pMsg->MsgId) { case WM_NOTIFY_CLIENTCHANGE: case WM_SIZE: LISTVIEW__UpdateScrollParas(hObj, pObj); return; case WM_NOTIFY_PARENT: switch (pMsg->Data.v) { case WM_NOTIFICATION_CHILD_DELETED: /* make sure we do not send any messages to the header child once it has been deleted */ if (pMsg->hWinSrc == pObj->hHeader) { pObj->hHeader = 0; } break; case WM_NOTIFICATION_VALUE_CHANGED: if (pMsg->hWinSrc == WM_GetScrollbarV(hObj)) { WM_GetScrollState(pMsg->hWinSrc, &ScrollState); pObj->ScrollStateV.v = ScrollState.v; LISTVIEW__InvalidateInsideArea(hObj, pObj); _NotifyOwner(hObj, WM_NOTIFICATION_SCROLL_CHANGED); } else if (pMsg->hWinSrc == WM_GetScrollbarH(hObj)) { WM_GetScrollState(pMsg->hWinSrc, &ScrollState); pObj->ScrollStateH.v = ScrollState.v; LISTVIEW__UpdateScrollParas(hObj, pObj); HEADER_SetScrollPos(pObj->hHeader, pObj->ScrollStateH.v); _NotifyOwner(hObj, WM_NOTIFICATION_SCROLL_CHANGED); } break; case WM_NOTIFICATION_SCROLLBAR_ADDED: LISTVIEW__UpdateScrollParas(hObj, pObj); break; } return; case WM_PAINT: _Paint(hObj, pObj, pMsg); return; case WM_TOUCH: _OnTouch(hObj, pObj, pMsg); return; /* Important: message handled ! */ case WM_KEY: if (((const WM_KEY_INFO*)(pMsg->Data.p))->PressedCnt > 0) { int Key; Key = ((const WM_KEY_INFO*)(pMsg->Data.p))->Key; if (_AddKey(hObj, Key)) { return; } } break; /* No return here ... WM_DefaultProc needs to be called */ case WM_DELETE: _FreeAttached(pObj); break; /* No return here ... WM_DefaultProc needs to be called */ } WM_DefaultProc(pMsg); }
/********************************************************************* * * LISTVIEW_Callback */ void LISTVIEW_Callback (WM_MESSAGE *pMsg) { LISTVIEW_Handle hObj; LISTVIEW_Obj* pObj; WM_SCROLL_STATE ScrollState; hObj = pMsg->hWin; /* Let widget handle the standard messages */ if (WIDGET_HandleActive(hObj, pMsg) == 0) { return; } pObj = (LISTVIEW_Obj *)GUI_ALLOC_h2p(hObj); /* Don't use use WIDGET_H2P because WIDGET_INIT_ID() has not be called at this point */ switch (pMsg->MsgId) { case WM_NOTIFY_CLIENTCHANGE: case WM_SIZE: if (pMsg->hWinSrc && (pMsg->hWinSrc == pObj->hHeader)) { LISTVIEW__UpdateScrollParas(hObj, pObj); } return; case WM_NOTIFY_PARENT: switch (pMsg->Data.v) { case WM_NOTIFICATION_CHILD_DELETED: /* make sure we do not send any messages to the header child once it has been deleted */ if (pMsg->hWinSrc == pObj->hHeader) { pObj->hHeader = 0; } break; case WM_NOTIFICATION_VALUE_CHANGED: if (pMsg->hWinSrc == WM_GetScrollbarV(hObj)) { WM_GetScrollState(pMsg->hWinSrc, &ScrollState); pObj->ScrollStateV.v = ScrollState.v; LISTVIEW__InvalidateInsideArea(hObj, pObj); _NotifyOwner(hObj, WM_NOTIFICATION_SCROLL_CHANGED); } else if (pMsg->hWinSrc == WM_GetScrollbarH(hObj)) { WM_GetScrollState(pMsg->hWinSrc, &ScrollState); pObj->ScrollStateH.v = ScrollState.v; LISTVIEW__UpdateScrollParas(hObj, pObj); HEADER_SetScrollPos(pObj->hHeader, pObj->ScrollStateH.v); _NotifyOwner(hObj, WM_NOTIFICATION_SCROLL_CHANGED); } break; case WM_NOTIFICATION_SCROLLBAR_ADDED: #if WIDGET_USE_PARENT_EFFECT WIDGET_SetEffect(pMsg->hWinSrc, pObj->Widget.pEffect); #endif LISTVIEW__UpdateScrollParas(hObj, pObj); break; case WM_NOTIFICATION_RELEASED: if ((pMsg->hWinSrc == pObj->hHeader) && (pObj->hSort)) { int Column; LISTVIEW_SORT * pSort; LISTVIEW_COLUMN * pColumn; WM_SetFocus(hObj); Column = HEADER_GetSel(pObj->hHeader); if (Column >= 0) { pColumn = (LISTVIEW_COLUMN *)GUI_ARRAY_GetpItem(&pObj->ColumnArray, Column); if (pColumn->fpCompare) { pSort = (LISTVIEW_SORT *)GUI_ALLOC_h2p(pObj->hSort); if (pSort) { // ReverseSort if (pObj->SortIndex == Column) { pSort->Reverse ^= 1; pObj->ReverseSort = 1; pObj->IsSorted = 0; } else { pSort->Reverse = 0; pObj->SortIndex = Column; pObj->IsPresorted = 0; } /* if (pObj->SortIndex == Column) { pSort->Reverse ^= 1; } else { pSort->Reverse = 0; pObj->SortIndex = Column; } pObj->IsPresorted = 0; */ LISTVIEW__InvalidateInsideArea(hObj, pObj); } } } } break; } return; case WM_PAINT: _Paint(hObj, pObj, pMsg); return; case WM_TOUCH: _OnTouch(hObj, pObj, pMsg); return; /* Important: message handled ! */ case WM_KEY: if (((const WM_KEY_INFO*)(pMsg->Data.p))->PressedCnt > 0) { int Key; Key = ((const WM_KEY_INFO*)(pMsg->Data.p))->Key; if (_AddKey(hObj, pObj, Key)) { return; } } break; /* No return here ... WM_DefaultProc needs to be called */ case WM_DELETE: _FreeAttached(pObj); break; /* No return here ... WM_DefaultProc needs to be called */ } WM_DefaultProc(pMsg); }
/********************************************************************* * * _LISTBOX_Callback */ static void _LISTBOX_Callback(WM_MESSAGE*pMsg) { LISTBOX_Handle hObj = pMsg->hWin; LISTBOX_Obj* pObj = LISTBOX_H2P(hObj); WM_SCROLL_STATE ScrollState; /* Let widget handle the standard messages */ if (WIDGET_HandleActive(hObj, pMsg) == 0) { /* Owner needs to be informed about focus change */ if (pMsg->MsgId == WM_SET_FOCUS) { if (pMsg->Data.v == 0) { /* Lost focus ? */ _NotifyOwner(hObj, LISTBOX_NOTIFICATION_LOST_FOCUS); } } return; } switch (pMsg->MsgId) { case WM_NOTIFY_PARENT: switch (pMsg->Data.v) { case WM_NOTIFICATION_VALUE_CHANGED: if (pMsg->hWinSrc == WM_GetScrollbarV(hObj)) { WM_GetScrollState(pMsg->hWinSrc, &ScrollState); pObj->ScrollStateV.v = ScrollState.v; LISTBOX__InvalidateInsideArea(hObj); _NotifyOwner(hObj, WM_NOTIFICATION_SCROLL_CHANGED); } else if (pMsg->hWinSrc == WM_GetScrollbarH(hObj)) { WM_GetScrollState(pMsg->hWinSrc, &ScrollState); pObj->ScrollStateH.v = ScrollState.v; LISTBOX__InvalidateInsideArea(hObj); _NotifyOwner(hObj, WM_NOTIFICATION_SCROLL_CHANGED); } break; case WM_NOTIFICATION_SCROLLBAR_ADDED: LISTBOX_UpdateScrollers(hObj); break; } break; case WM_PAINT: _OnPaint(hObj, pObj, pMsg); break; case WM_PID_STATE_CHANGED: { const WM_PID_STATE_CHANGED_INFO* pInfo = (const WM_PID_STATE_CHANGED_INFO*)pMsg->Data.p; if (pInfo->State) { int Sel; Sel = _GetItemFromPos(hObj, pObj, pInfo->x, pInfo->y); if (Sel >= 0) { _ToggleMultiSel(hObj, pObj, Sel); LISTBOX_SetSel(hObj, Sel); } _NotifyOwner(hObj, WM_NOTIFICATION_CLICKED); return; } } break; case WM_TOUCH: _OnTouch(hObj, pMsg); return; #if GUI_SUPPORT_MOUSE case WM_MOUSEOVER: if (_OnMouseOver(hObj, pObj, pMsg) == 0) return; break; #endif case WM_DELETE: _FreeAttached(pObj); break; /* No return here ... WM_DefaultProc needs to be called */ case WM_KEY: if (((const WM_KEY_INFO*)(pMsg->Data.p))->PressedCnt > 0) { int Key; Key = ((const WM_KEY_INFO*)(pMsg->Data.p))->Key; if (LISTBOX_AddKey(hObj, Key)) { return; } } break; case WM_SIZE: LISTBOX_UpdateScrollers(hObj); WM_InvalidateWindow(hObj); break; } WM_DefaultProc(pMsg); }