Xonotic
scrollpanel.qc
Go to the documentation of this file.
1 #include "scrollpanel.qh"
2 
3 METHOD(XonoticScrollPanel, drawListBoxItem, void(XonoticScrollPanel this, int i, vector absSize, bool isSelected, bool isFocused))
4 {
5  XonoticTab p = this.currentPanel;
6  p.draw(p);
7 }
8 
9 METHOD(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) \
22 METHOD(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 }
32 X(mouseMove)
33 X(mousePress)
34 X(mouseDrag)
35 X(mouseRelease)
36 #undef X
37 
38 #define X(keyFunc) \
39 METHOD(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 }
44 X(keyDown)
45 X(keyUp)
46 #undef X
Definition: tab.qh:4
#define METHOD(cname, name, prototype)
Definition: oo.qh:257
#define SUPER(cname)
Definition: oo.qh:219
float rows
Definition: tab.qh:13
vector(float skel, float bonenum) _skel_get_boneabs_hidden
#define X(mouseFunc)
Definition: scrollpanel.qc:21