/********************************************************************* * * _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); }
/********************************************************************* * * _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); }
/********************************************************************* * * _Delete */ static void _Delete(TEXT_Obj* pObj) { /* Delete attached objects (if any) */ GUI_DEBUG_LOG("TEXT: Delete() Deleting attached items"); _FreeAttached(pObj); }
/********************************************************************* * * _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); }
/********************************************************************* * * 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); }