MCPcopy Create free account
hub / github.com/JACoders/OpenJK / Item_ListBox_OverLB

Function Item_ListBox_OverLB

code/ui/ui_shared.cpp:8953–9028  ·  view source on GitHub ↗

================= Item_ListBox_OverLB ================= */

Source from the content-addressed store, hash-verified

8951=================
8952*/
8953int Item_ListBox_OverLB(itemDef_t *item, float x, float y)
8954{
8955 rectDef_t r;
8956 int thumbstart;
8957
8958 if (item->window.flags & WINDOW_HORIZONTAL)
8959 {
8960 // check if on left arrow
8961 r.x = item->window.rect.x;
8962 r.y = item->window.rect.y + item->window.rect.h - SCROLLBAR_SIZE;
8963 r.h = r.w = SCROLLBAR_SIZE;
8964 if (Rect_ContainsPoint(&r, x, y))
8965 {
8966 return WINDOW_LB_LEFTARROW;
8967 }
8968 // check if on right arrow
8969 r.x = item->window.rect.x + item->window.rect.w - SCROLLBAR_SIZE;
8970 if (Rect_ContainsPoint(&r, x, y))
8971 {
8972 return WINDOW_LB_RIGHTARROW;
8973 }
8974 // check if on thumb
8975 thumbstart = Item_ListBox_ThumbPosition(item);
8976 r.x = thumbstart;
8977 if (Rect_ContainsPoint(&r, x, y))
8978 {
8979 return WINDOW_LB_THUMB;
8980 }
8981 r.x = item->window.rect.x + SCROLLBAR_SIZE;
8982 r.w = thumbstart - r.x;
8983 if (Rect_ContainsPoint(&r, x, y))
8984 {
8985 return WINDOW_LB_PGUP;
8986 }
8987 r.x = thumbstart + SCROLLBAR_SIZE;
8988 r.w = item->window.rect.x + item->window.rect.w - SCROLLBAR_SIZE;
8989 if (Rect_ContainsPoint(&r, x, y))
8990 {
8991 return WINDOW_LB_PGDN;
8992 }
8993 }
8994 else
8995 {
8996 r.x = item->window.rect.x + item->window.rect.w - SCROLLBAR_SIZE;
8997 r.y = item->window.rect.y;
8998 r.h = r.w = SCROLLBAR_SIZE;
8999 if (Rect_ContainsPoint(&r, x, y))
9000 {
9001 return WINDOW_LB_LEFTARROW;
9002 }
9003 r.y = item->window.rect.y + item->window.rect.h - SCROLLBAR_SIZE;
9004 if (Rect_ContainsPoint(&r, x, y))
9005 {
9006 return WINDOW_LB_RIGHTARROW;
9007 }
9008 thumbstart = Item_ListBox_ThumbPosition(item);
9009 r.y = thumbstart;
9010 if (Rect_ContainsPoint(&r, x, y))

Callers 2

Item_ListBox_MouseEnterFunction · 0.70
Item_StartCaptureFunction · 0.70

Calls 2

Rect_ContainsPointFunction · 0.70

Tested by

no test coverage detected