Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
dialog_settings_game.qc
Go to the documentation of this file.
2
3METHOD(SettingSource, getEntry, entity(entity me, int i, void(string name, string icon) returns))
4{
5 Lazy l = REGISTRY_GET(Settings, i);
6 entity it = l.m_get();
7 if (returns)
8 returns(it.title, string_null);
9 return it;
10}
11METHOD(SettingSource, getEntryTooltip, entity(entity me, int i, void(string theTooltip) returns))
12{
13 Lazy l = REGISTRY_GET(Settings, i);
14 entity it = l.m_get();
15 if (returns)
16 returns(it.titleTooltip);
17 return it;
18}
19METHOD(SettingSource, reload, int(entity me, string filter))
20{
21 return REGISTRY_COUNT(Settings);
22}
23
34
35METHOD(XonoticRegisteredSettingsList, drawListBoxItem, void(entity me, int i, vector absSize, bool isSelected, bool isFocused))
36{
37 if (!me.source || !me.source.getEntry(me.source, i, XonoticRegisteredSettingsList_getNameIcon_cb))
38 return;
39 if (isSelected)
40 draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_SELECTED, SKINALPHA_LISTBOX_SELECTED);
41 else if (isFocused)
42 {
43 me.focusedItemAlpha = getFadedAlpha(me.focusedItemAlpha, SKINALPHA_LISTBOX_FOCUSED, SKINFADEALPHA_LISTBOX_FOCUSED);
44 draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_FOCUSED, me.focusedItemAlpha);
45 }
46 string s = draw_TextShortenToWidth(strdecolorize(XonoticRegisteredSettingsList_cb_name), 1, 0, me.realFontSize);
47 draw_Text(me.realUpperMargin * eY + (0.5 * me.realFontSize.x) * eX, s, me.realFontSize, '1 1 1', SKINALPHA_TEXT, 0);
48}
49
51{
52 if (me.focusedItem < 0 || !me.source)
53 {
54 clearTooltip(me);
55 return;
56 }
57 if (!me.source.getEntryTooltip(me, me.focusedItem, XonoticRegisteredSettingsList_getTooltip_cb))
58 {
59 clearTooltip(me);
60 return;
61 }
63 if (theTooltip != "")
64 setZonedTooltip(me, theTooltip, string_null);
65 else
66 clearTooltip(me);
67}
68
70{
71 if (!me.source)
72 {
73 me.nItems = 0;
74 return;
75 }
76 me.nItems = me.source.reload(me.source, me.stringFilter);
77}
78METHOD(XonoticRegisteredSettingsList, resizeNotify, void(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize))
79{
80 SUPER(XonoticRegisteredSettingsList).resizeNotify(me, relOrigin, relSize, absOrigin, absSize);
81
82 me.itemAbsSize = '0 0 0';
83 me.itemAbsSize.y = absSize.y * me.itemHeight;
84 me.itemAbsSize.x = absSize.x * (1 - me.controlWidth);
85 me.realFontSize.y = me.fontSize / me.itemAbsSize.y;
86 me.realFontSize.x = me.fontSize / me.itemAbsSize.x;
87 me.realUpperMargin = 0.5 * (1 - me.realFontSize.y);
88}
90{
91 SUPER(XonoticRegisteredSettingsList).setSelected(me, i);
92 me.onChange(me, me.onChangeEntity);
93}
94
95
97{
99 me.configureDialog(me);
100 return me;
101}
103{
104 entity s = NULL;
105 entity c = me.currentPanel;
106 if (c.classname == "XonoticScrollPanel")
107 {
108 s = me.currentPanel;
109 s.viewportHeight = 15.5;
110 c = s.currentPanel;
111 }
112
113 entity removing = me.currentItem;
114 DataSource data = me.topicList.source;
115 entity adding = data.getEntry(data, me.topicList.selectedItem, func_null);
116 if (removing == adding)
117 return;
118 if (removing)
119 {
120 me.currentItem = NULL;
121 c.removeItem(c, removing);
122 }
123 if (adding)
124 {
125 me.currentItem = adding;
126 adding.resizeNotify(adding, '0 0 0', c.size, '0 0 0', c.size);
127 c.addItem(c, adding, '0 0 0', '1 1 0', 1);
128 if (s)
129 s.resizeNotify(s, '0 0 0', s.size, '0 0 0', s.size);
130 }
131}
133{
134 entity topics = me.topicList;
135 topics.onChange = me.topicChangeNotify;
136 topics.onChangeEntity = me;
137
138 int col = 0;
139 int width = 1;
140 me.gotoRC(me, 0, col);
141 me.TD(me, me.rows, width, topics);
142
143 col += width;
144 width = me.columns - col;
145 me.gotoRC(me, 0, col); me.setFirstColumn(me, me.currentColumn);
146 me.TD(me, me.rows, width, me.currentPanel);
147
148 me.topicChangeNotify(topics, me);
149}
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
virtual void getEntry()
get entry i passing name and icon through returns if it is not null returns DataSource_false if out o...
Definition datasource.qh:11
Definition lazy.qh:7
virtual void getEntryTooltip()
virtual void reload()
reload all entries matching filter returning how many matches were found
virtual void getEntry()
get entry i passing name and icon through returns if it is not null returns DataSource_false if out o...
entity() spawn
entity makeXonoticGameSettingsTab()
void XonoticRegisteredSettingsList_getNameIcon_cb(string _name, string _icon)
void XonoticRegisteredSettingsList_getTooltip_cb(string _tooltip)
string XonoticRegisteredSettingsList_cb_tooltip
string XonoticRegisteredSettingsList_cb_name
void XonoticGameSettingsTab_fill(entity me)
string draw_TextShortenToWidth(string theText, float maxWidth, float ICanHasKallerz, vector SizeThxBye)
Definition draw.qc:378
void draw_Text(vector theOrigin, string theText, vector theSize, vector theColor, float theAlpha, float ICanHasKallerz)
Definition draw.qc:282
void draw_Fill(vector theOrigin, vector theSize, vector theColor, float theAlpha)
Definition draw.qc:97
float getFadedAlpha(float currentAlpha, float startAlpha, float targetAlpha)
Definition util.qc:824
void clearTooltip(entity e)
Definition util.qc:277
void setZonedTooltip(entity e, string theTooltip, string theCvar)
Definition util.qc:257
string name
Definition menu.qh:30
var void func_null()
string string_null
Definition nil.qh:9
#define NEW(cname,...)
Definition oo.qh:120
#define SUPER(cname)
Definition oo.qh:236
#define METHOD(cname, name, prototype)
Definition oo.qh:274
#define NULL
Definition post.qh:14
#define REGISTRY_COUNT(id)
Definition registry.qh:18
#define REGISTRY_GET(id, i)
Definition registry.qh:62
vector
Definition self.qh:96
const vector eY
Definition vector.qh:44
const vector eX
Definition vector.qh:43