CLASS(SettingSource, DataSource)
METHOD(SettingSource, getEntry, entity(entity this, int i, void(string name, string icon) returns))
{
- Lazy l = SETTINGS[i];
+ Lazy l = Settings_from(i);
entity it = l.m_get();
if (returns) returns(it.title, string_null);
return it;
}
- METHOD(SettingSource, reload, int(entity this, string filter)) { return SETTINGS_COUNT; }
+ METHOD(SettingSource, getEntryTooltip, entity(entity this, int i, void(string theTooltip) returns))
+ {
+ Lazy l = Settings_from(i);
+ entity it = l.m_get();
+ if (returns) returns(it.tooltip);
+ return it;
+ }
+ METHOD(SettingSource, reload, int(entity this, string filter)) { return Settings_COUNT; }
ENDCLASS(SettingSource)
#include "listbox.qc"
ATTRIB(XonoticRegisteredSettingsList, source, DataSource, NULL)
ATTRIB(XonoticRegisteredSettingsList, onChange, void(entity, entity), func_null)
ATTRIB(XonoticRegisteredSettingsList, onChangeEntity, entity, NULL)
+ METHOD(XonoticRegisteredSettingsList, focusedItemChangeNotify, void(entity));
+
string XonoticRegisteredSettingsList_cb_name;
- void XonoticRegisteredSettingsList_cb(string _name, string _icon)
+ string XonoticRegisteredSettingsList_cb_tooltip;
+ void XonoticRegisteredSettingsList_getNameIcon_cb(string _name, string _icon)
{
XonoticRegisteredSettingsList_cb_name = _name;
}
+ void XonoticRegisteredSettingsList_getTooltip_cb(string _tooltip)
+ {
+ XonoticRegisteredSettingsList_cb_tooltip = _tooltip;
+ }
+
METHOD(XonoticRegisteredSettingsList, drawListBoxItem, void(entity this, int i, vector absSize, bool isSelected, bool isFocused))
{
if (!this.source) return;
- if (!this.source.getEntry(this.source, i, XonoticRegisteredSettingsList_cb)) return;
+ if (!this.source.getEntry(this.source, i, XonoticRegisteredSettingsList_getNameIcon_cb)) return;
string name = XonoticRegisteredSettingsList_cb_name;
if (isSelected) {
draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_SELECTED, SKINALPHA_LISTBOX_SELECTED);
string s = draw_TextShortenToWidth(strdecolorize(name), 1, 0, this.realFontSize);
draw_Text(this.realUpperMargin * eY + (0.5 * this.realFontSize.x) * eX, s, this.realFontSize, '1 1 1', SKINALPHA_TEXT, 0);
}
+
+ METHOD(XonoticRegisteredSettingsList, focusedItemChangeNotify, void(entity this))
+ {
+ if (this.focusedItem == -1 || !this.source)
+ {
+ clearTooltip(this);
+ return;
+ }
+ if (!this.source.getEntryTooltip(this, this.focusedItem, XonoticRegisteredSettingsList_getTooltip_cb))
+ {
+ clearTooltip(this);
+ return;
+ }
+ string theTooltip = XonoticRegisteredSettingsList_cb_tooltip;
+ if(theTooltip != "")
+ setZonedTooltip(this, theTooltip, string_null);
+ else
+ clearTooltip(this);
+ }
+
METHOD(XonoticRegisteredSettingsList, refilter, void(entity this))
{
if (!this.source) {
}
METHOD(XonoticRegisteredSettingsList, resizeNotify, void(entity this, vector relOrigin, vector relSize, vector absOrigin, vector absSize))
{
- super.resizeNotify(this, relOrigin, relSize, absOrigin, absSize);
+ SUPER(XonoticRegisteredSettingsList).resizeNotify(this, relOrigin, relSize, absOrigin, absSize);
this.itemAbsSize = '0 0 0';
this.realFontSize_y = this.fontSize / (this.itemAbsSize_y = (absSize.y * this.itemHeight));
}
METHOD(XonoticRegisteredSettingsList, setSelected, void(entity this, int i))
{
- super.setSelected(this, i);
+ SUPER(XonoticRegisteredSettingsList).setSelected(this, i);
this.onChange(this, this.onChangeEntity);
}
CONSTRUCTOR(XonoticRegisteredSettingsList, DataSource _source) {
topics.onChangeEntity = this;
int
- col = 0, width = 1.5;
+ col = 0, width = 1;
this.gotoRC(this, 0, col);
this.TD(this, this.rows, width, topics);