ATTRIB(ListBox, controlBottom, float, 0)
ATTRIB(ListBox, controlWidth, float, 0)
ATTRIB(ListBox, dragScrollPos, vector, '0 0 0')
+ ATTRIB(ListBox, selectionDoesntMatter, bool, false) // improves scrolling by keys for lists that don't need to show an active selection
ATTRIB(ListBox, src, string, string_null) // scrollbar
ATTRIB(ListBox, color, vector, '1 1 1')
}
else if(key == K_PGUP || key == K_KP_PGUP)
{
+ if(me.selectionDoesntMatter)
+ {
+ me.scrollPosTarget = max(me.scrollPosTarget - 0.5, 0);
+ return 1;
+ }
+
float i = me.selectedItem;
float a = me.getItemHeight(me, i);
for (;;)
}
else if(key == K_PGDN || key == K_KP_PGDN)
{
+ if(me.selectionDoesntMatter)
+ {
+ me.scrollPosTarget = min(me.scrollPosTarget + 0.5, me.nItems * me.itemHeight - 1);
+ return 1;
+ }
+
float i = me.selectedItem;
float a = me.getItemHeight(me, i);
for (;;)
me.setSelected(me, i - 1);
}
else if(key == K_UPARROW || key == K_KP_UPARROW)
+ {
+ if(me.selectionDoesntMatter)
+ {
+ me.scrollPosTarget = max(me.scrollPosTarget - me.itemHeight, 0);
+ return 1;
+ }
+
me.setSelected(me, me.selectedItem - 1);
+ }
else if(key == K_DOWNARROW || key == K_KP_DOWNARROW)
+ {
+ if(me.selectionDoesntMatter)
+ {
+ me.scrollPosTarget = min(me.scrollPosTarget + me.itemHeight, me.nItems * me.itemHeight - 1);
+ return 1;
+ }
+
me.setSelected(me, me.selectedItem + 1);
+ }
else if(key == K_HOME || key == K_KP_HOME)
me.setSelected(me, 0);
else if(key == K_END || key == K_KP_END)
METHOD(XonoticCreditsList, resizeNotify, void(entity, vector, vector, vector, vector))
METHOD(XonoticCreditsList, keyDown, float(entity, float, float, float))
METHOD(XonoticCreditsList, destroy, void(entity))
+ ATTRIB(XonoticCreditsList, selectionDoesntMatter, bool, true)
ATTRIB(XonoticCreditsList, realFontSize, vector, '0 0 0')
ATTRIB(XonoticCreditsList, realUpperMargin, float, 0)
float XonoticCreditsList_keyDown(entity me, float key, float ascii, float shift)
{
- me.dragScrollTimer = time;
me.scrolling = 0;
- if(key == K_PGUP || key == K_KP_PGUP)
- me.scrollPosTarget = max(me.scrollPosTarget - 0.5, 0);
- else if(key == K_PGDN || key == K_KP_PGDN)
- me.scrollPosTarget = min(me.scrollPosTarget + 0.5, me.nItems * me.itemHeight - 1);
- else if(key == K_UPARROW || key == K_KP_UPARROW)
- me.scrollPosTarget = max(me.scrollPosTarget - me.itemHeight, 0);
- else if(key == K_DOWNARROW || key == K_KP_DOWNARROW)
- me.scrollPosTarget = min(me.scrollPosTarget + me.itemHeight, me.nItems * me.itemHeight - 1);
- else
- return SUPER(XonoticCreditsList).keyDown(me, key, ascii, shift);
-
- return 1;
+ return SUPER(XonoticCreditsList).keyDown(me, key, ascii, shift);
}
#endif
METHOD(XonoticStatsList, keyDown, float(entity, float, float, float))
METHOD(XonoticStatsList, destroy, void(entity))
METHOD(XonoticStatsList, showNotify, void(entity))
+ ATTRIB(XonoticStatsList, selectionDoesntMatter, bool, true)
ATTRIB(XonoticStatsList, listStats, float, -1)
ATTRIB(XonoticStatsList, realFontSize, vector, '0 0 0')
void XonoticStatsList_drawListBoxItem(entity me, int i, vector absSize, bool isSelected, bool isFocused)
{
- if(isSelected)
- draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_SELECTED, SKINALPHA_LISTBOX_SELECTED);
- else if(isFocused)
+ if(isFocused)
{
me.focusedItemAlpha = getFadedAlpha(me.focusedItemAlpha, SKINALPHA_LISTBOX_FOCUSED, SKINFADEALPHA_LISTBOX_FOCUSED);
draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_FOCUSED, me.focusedItemAlpha);