================= Item_ListBox_MouseEnter ================= */
| 9033 | ================= |
| 9034 | */ |
| 9035 | void Item_ListBox_MouseEnter(itemDef_t *item, float x, float y) |
| 9036 | { |
| 9037 | rectDef_t r; |
| 9038 | listBoxDef_t *listPtr = (listBoxDef_t*)item->typeData; |
| 9039 | |
| 9040 | item->window.flags &= ~(WINDOW_LB_LEFTARROW | WINDOW_LB_RIGHTARROW | WINDOW_LB_THUMB | WINDOW_LB_PGUP | WINDOW_LB_PGDN); |
| 9041 | item->window.flags |= Item_ListBox_OverLB(item, x, y); |
| 9042 | |
| 9043 | if (item->window.flags & WINDOW_HORIZONTAL) |
| 9044 | { |
| 9045 | if (!(item->window.flags & (WINDOW_LB_LEFTARROW | WINDOW_LB_RIGHTARROW | WINDOW_LB_THUMB | WINDOW_LB_PGUP | WINDOW_LB_PGDN))) |
| 9046 | { |
| 9047 | // check for selection hit as we have exausted buttons and thumb |
| 9048 | if (listPtr->elementStyle == LISTBOX_IMAGE) |
| 9049 | { |
| 9050 | r.x = item->window.rect.x; |
| 9051 | r.y = item->window.rect.y; |
| 9052 | r.h = item->window.rect.h - SCROLLBAR_SIZE; |
| 9053 | r.w = item->window.rect.w - listPtr->drawPadding; |
| 9054 | if (Rect_ContainsPoint(&r, x, y)) |
| 9055 | { |
| 9056 | listPtr->cursorPos = (int)((x - r.x) / listPtr->elementWidth) + listPtr->startPos; |
| 9057 | if (listPtr->cursorPos > listPtr->endPos) |
| 9058 | { |
| 9059 | listPtr->cursorPos = listPtr->endPos; |
| 9060 | } |
| 9061 | } |
| 9062 | } |
| 9063 | else |
| 9064 | { |
| 9065 | // text hit.. |
| 9066 | } |
| 9067 | } |
| 9068 | } |
| 9069 | else if (!(item->window.flags & (WINDOW_LB_LEFTARROW | WINDOW_LB_RIGHTARROW | WINDOW_LB_THUMB | WINDOW_LB_PGUP | WINDOW_LB_PGDN))) |
| 9070 | { |
| 9071 | r.x = item->window.rect.x; |
| 9072 | r.y = item->window.rect.y; |
| 9073 | r.w = item->window.rect.w - SCROLLBAR_SIZE; |
| 9074 | r.h = item->window.rect.h - listPtr->drawPadding; |
| 9075 | if (Rect_ContainsPoint(&r, x, y)) |
| 9076 | { |
| 9077 | listPtr->cursorPos = (int)((y - 2 - r.y) / listPtr->elementHeight) + listPtr->startPos; |
| 9078 | if (listPtr->cursorPos > listPtr->endPos) |
| 9079 | { |
| 9080 | listPtr->cursorPos = listPtr->endPos; |
| 9081 | } |
| 9082 | } |
| 9083 | } |
| 9084 | } |
| 9085 | |
| 9086 | /* |
| 9087 | ================= |
no test coverage detected