METHOD(ListBox, mousePress, float(entity, vector))
METHOD(ListBox, mouseDrag, float(entity, vector))
METHOD(ListBox, mouseRelease, float(entity, vector))
METHOD(ListBox, mousePress, float(entity, vector))
METHOD(ListBox, mouseDrag, float(entity, vector))
METHOD(ListBox, mouseRelease, float(entity, vector))
ATTRIB(ListBox, focusable, float, 1)
ATTRIB(ListBox, selectedItem, float, 0)
ATTRIB(ListBox, size, vector, '0 0 0')
ATTRIB(ListBox, focusable, float, 1)
ATTRIB(ListBox, selectedItem, float, 0)
ATTRIB(ListBox, size, vector, '0 0 0')
-void resizeNotifyListBox(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
+void ListBox_resizeNotify(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
{
SUPER(ListBox).resizeNotify(me, relOrigin, relSize, absOrigin, absSize);
me.controlWidth = me.scrollbarWidth / absSize_x;
}
{
SUPER(ListBox).resizeNotify(me, relOrigin, relSize, absOrigin, absSize);
me.controlWidth = me.scrollbarWidth / absSize_x;
}
-float keyDownListBox(entity me, float key, float ascii, float shift)
+float ListBox_keyDown(entity me, float key, float ascii, float shift)
me.scrollPos = min(me.scrollPos + 0.5, me.nItems * me.itemHeight - 1);
me.setSelected(me, max(me.selectedItem, ceil(me.scrollPos / me.itemHeight)));
}
me.scrollPos = min(me.scrollPos + 0.5, me.nItems * me.itemHeight - 1);
me.setSelected(me, max(me.selectedItem, ceil(me.scrollPos / me.itemHeight)));
}
{
me.scrollPos = max(0, me.nItems * me.itemHeight - 1);
me.setSelected(me, me.nItems - 1);
{
me.scrollPos = max(0, me.nItems * me.itemHeight - 1);
me.setSelected(me, me.nItems - 1);
-void updateControlTopBottomListBox(entity me)
+void ListBox_focusLeave(entity me)
+{
+ // Reset the var pressed in case listbox loses focus
+ // by a mouse click on an item of the list
+ // for example showing a dialog on right click
+ me.pressed = 0;
+}
+void ListBox_updateControlTopBottom(entity me)
me.drawListBoxItem(me, i, absSize, (me.selectedItem == i));
}
draw_ClearClip();
me.drawListBoxItem(me, i, absSize, (me.selectedItem == i));
}
draw_ClearClip();
-void drawListBoxItemListBox(entity me, float i, vector absSize, float selected)
+void ListBox_drawListBoxItem(entity me, float i, vector absSize, float selected)
- draw_Text('0 0 0', strcat("Item ", ftos(i)), eX * (8 / absSize_x) + eY * (8 / absSize_y), (selected ? '0 1 0' : '1 1 1'), 1, 0);
+ draw_Text('0 0 0', sprintf(_("Item %d"), i), eX * (8 / absSize_x) + eY * (8 / absSize_y), (selected ? '0 1 0' : '1 1 1'), 1, 0);