Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
scrollpanel.qc
Go to the documentation of this file.
1#include "scrollpanel.qh"
2
3METHOD(XonoticScrollPanel, drawListBoxItem, void(XonoticScrollPanel this, int i, vector absSize, bool isSelected, bool isFocused))
4{
6 p.draw(p);
7}
8
9METHOD(XonoticScrollPanel, resizeNotify, void(XonoticScrollPanel this, vector relOrigin, vector relSize, vector absOrigin, vector absSize))
10{
11 SUPER(XonoticScrollPanel).resizeNotify(this, relOrigin, relSize, absOrigin, absSize);
12 this.scrollToItem(this, 0);
13 XonoticTab p = this.currentPanel;
14 float m = p.firstChild.rows / this.viewportHeight;
15 this.itemHeight = m;
16 relSize.y *= m;
17 absSize.y *= m;
18 p.resizeNotify(p, relOrigin, relSize, absOrigin, absSize);
19}
20
21#define X(mouseFunc) \
22METHOD(XonoticScrollPanel, mouseFunc, bool(XonoticScrollPanel this, vector pos)) \
23{ \
24 SUPER(XonoticScrollPanel).mouseFunc(this, pos); \
25 XonoticTab p = this.currentPanel; \
26 this.setFocus(this, p); \
27 \
28 vector o = -eY * this.scrollPos; \
29 vector s = eX * (1 - this.controlWidth) + eY * this.itemHeight; \
30 return p.mouseFunc(p, globalToBox(pos, o, s)); \
31}
32X(mouseMove)
33X(mousePress)
34X(mouseDrag)
35X(mouseRelease)
36#undef X
37
38#define X(keyFunc) \
39METHOD(XonoticScrollPanel, keyFunc, bool(XonoticScrollPanel this, int key, int ascii, bool shift)) \
40{ \
41 XonoticTab p = this.currentPanel; \
42 return p.keyFunc(p, key, ascii, shift) || SUPER(XonoticScrollPanel).keyFunc(this, key, ascii, shift); \
43}
44X(keyDown)
45X(keyUp)
46#undef X
virtual void draw()
virtual void resizeNotify()
virtual void scrollToItem()
float rows
Definition tab.qh:12
virtual void resizeNotify()
Definition scrollpanel.qc:9
float viewportHeight
number of rows to show at once
virtual void drawListBoxItem()
Definition scrollpanel.qc:3
entity currentPanel
container for single child panel
Definition scrollpanel.qh:7
#define SUPER(cname)
Definition oo.qh:231
#define METHOD(cname, name, prototype)
Definition oo.qh:269
#define X(mouseFunc)
vector
Definition self.qh:92