Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
dialog.qc File Reference
#include "dialog.qh"
#include "borderimage.qh"
#include "button.qh"
#include "nexposee.qh"
Include dependency graph for dialog.qc:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void Dialog_addItemSimple (entity me, float row, float col, float rowspan, float colspan, entity e, vector v)
void Dialog_Close (entity button, entity me)
void Dialog_close (entity me)
void Dialog_configureDialog (entity me)
void Dialog_fill (entity me)
void Dialog_gotoRC (entity me, float row, float col)
float Dialog_keyDown (entity me, float key, float ascii, float shift)
void Dialog_setFirstColumn (entity me, float col)
void Dialog_TD (entity me, float rowspan, float colspan, entity e)
void Dialog_TDempty (entity me, float colspan)
void Dialog_TDNoMargin (entity me, float rowspan, float colspan, entity e, vector v)
void Dialog_TR (entity me)

Function Documentation

◆ Dialog_addItemSimple()

void Dialog_addItemSimple ( entity me,
float row,
float col,
float rowspan,
float colspan,
entity e,
vector v )

Definition at line 15 of file dialog.qc.

16 {
17 vector o, s;
18 o = me.itemOrigin + eX * (col * me.itemSpacing.x) + eY * (row * me.itemSpacing.y);
19 s = me.itemSize + eX * ((colspan - 1) * me.itemSpacing.x) + eY * ((rowspan - 1) * me.itemSpacing.y);
20 o.x -= 0.5 * (me.itemSpacing.x - me.itemSize.x) * v.x;
21 s.x += (me.itemSpacing.x - me.itemSize.x) * v.x;
22 o.y -= 0.5 * (me.itemSpacing.y - me.itemSize.y) * v.y;
23 s.y += (me.itemSpacing.y - me.itemSize.y) * v.y;
24 me.addItem(me, e, o, s, 1);
25 }
vector
Definition self.qh:92
const vector eY
Definition vector.qh:45
const vector eX
Definition vector.qh:44

References entity(), eX, eY, and vector.

◆ Dialog_Close()

◆ Dialog_close()

void Dialog_close ( entity me)

Definition at line 104 of file dialog.qc.

105 {
106 bool closed = false;
107 if (me.parent.instanceOfNexposee)
108 {
109 ExposeeCloseButton_Click(me, me.parent);
110 closed = true;
111 }
112 else if (me.parent.instanceOfModalController)
113 {
115 closed = true;
116 }
117
118 if (closed && me.hideMenuOnClose)
119 m_goto(string_null, false);
120 me.hideMenuOnClose = false; // reset it regardless
121 }
void ExposeeCloseButton_Click(entity button, entity other)
Definition nexposee.qc:8
void m_goto(string itemname, bool hide_menu_on_close)
Definition menu.qc:1051
void DialogCloseButton_Click(entity button, entity tab)
string string_null
Definition nil.qh:9

References DialogCloseButton_Click(), entity(), ExposeeCloseButton_Click(), m_goto(), and string_null.

◆ Dialog_configureDialog()

void Dialog_configureDialog ( entity me)

Definition at line 61 of file dialog.qc.

62 {
63 float absWidth, absHeight;
64
65 if (me.isTabRoot)
66 {
67 me.frame = NEW(BorderImage);
68 me.frame.configureBorderImage(me.frame, me.title, me.titleFontSize, me.color, me.backgroundImage, me.borderLines * me.titleHeight);
69 me.frame.zoomedOutTitleBarPosition = me.zoomedOutTitleBarPosition;
70 me.frame.zoomedOutTitleBar = me.zoomedOutTitleBar;
71 me.frame.alpha = me.alpha;
72 me.addItem(me, me.frame, '0 0 0', '1 1 0', 1);
73 }
74
75 if (!me.titleFontSize) me.titleHeight = 0; // no title bar
76
77 absWidth = me.intendedWidth * conwidth;
78 absHeight = me.borderLines * me.titleHeight + me.marginTop + me.rows * me.rowHeight + (me.rows - 1) * me.rowSpacing + me.marginBottom;
79 me.itemOrigin = eX * (me.marginLeft / absWidth)
80 + eY * ((me.borderLines * me.titleHeight + me.marginTop) / absHeight);
81 me.itemSize = eX * ((1 - (me.marginLeft + me.marginRight + me.columnSpacing * (me.columns - 1)) / absWidth) / me.columns)
82 + eY * (me.rowHeight / absHeight);
83 me.itemSpacing = me.itemSize
84 + eX * (me.columnSpacing / absWidth)
85 + eY * (me.rowSpacing / absHeight);
86 me.intendedHeight = absHeight / conheight;
87 me.currentRow = -1;
88 me.currentColumn = -1;
89
90 me.fill(me);
91
92 if (me.isTabRoot && me.closable && me.borderLines > 0)
93 {
94 entity closebutton;
95 closebutton = me.closeButton = me.frame.closeButton = NEW(Button);
96 closebutton.configureButton(closebutton, "", 0, me.closeButtonImage);
97 closebutton.onClick = Dialog_Close;
98 closebutton.onClickEntity = me;
99 closebutton.srcMulti = 0;
100 me.addItem(me, closebutton, '0 0 0', '1 1 0', 1); // put it as LAST
101 }
102 }
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
void Dialog_Close(entity button, entity me)
Definition dialog.qc:7
float conwidth
Definition menu.qh:36
float conheight
Definition menu.qh:36
#define NEW(cname,...)
Definition oo.qh:117

References conheight, conwidth, Dialog_Close(), entity(), eX, eY, and NEW.

◆ Dialog_fill()

void Dialog_fill ( entity me)

Definition at line 12 of file dialog.qc.

13 {}

References entity().

◆ Dialog_gotoRC()

void Dialog_gotoRC ( entity me,
float row,
float col )

Definition at line 27 of file dialog.qc.

28 {
29 me.currentRow = row;
30 me.currentColumn = col;
31 }

References entity().

◆ Dialog_keyDown()

float Dialog_keyDown ( entity me,
float key,
float ascii,
float shift )

Definition at line 123 of file dialog.qc.

124 {
125 if (me.closable)
126 {
127 if (key == K_ESCAPE)
128 {
130 me.close(me);
131 return 1;
132 }
133 }
134 float r = SUPER(Dialog).keyDown(me, key, ascii, shift);
135 if (!me.closable && key == K_ESCAPE)
136 return 1;
137 return r;
138 }
float K_ESCAPE
Definition keycodes.qc:9
void m_play_click_sound(string soundfile)
Definition menu.qc:1106
const string MENU_SOUND_CLOSE
Definition menu.qh:50
#define SUPER(cname)
Definition oo.qh:231

References entity(), K_ESCAPE, m_play_click_sound(), MENU_SOUND_CLOSE, and SUPER.

◆ Dialog_setFirstColumn()

void Dialog_setFirstColumn ( entity me,
float col )

Definition at line 51 of file dialog.qc.

52 {
53 me.firstColumn = col;
54 }

References entity().

◆ Dialog_TD()

void Dialog_TD ( entity me,
float rowspan,
float colspan,
entity e )

Definition at line 39 of file dialog.qc.

40 {
41 me.addItemSimple(me, me.currentRow, me.currentColumn, rowspan, colspan, e, '0 0 0');
42 me.currentColumn += colspan;
43 }

References entity().

◆ Dialog_TDempty()

void Dialog_TDempty ( entity me,
float colspan )

Definition at line 56 of file dialog.qc.

57 {
58 me.currentColumn += colspan;
59 }

References entity().

◆ Dialog_TDNoMargin()

void Dialog_TDNoMargin ( entity me,
float rowspan,
float colspan,
entity e,
vector v )

Definition at line 45 of file dialog.qc.

46 {
47 me.addItemSimple(me, me.currentRow, me.currentColumn, rowspan, colspan, e, v);
48 me.currentColumn += colspan;
49 }

References entity(), and vector.

◆ Dialog_TR()

void Dialog_TR ( entity me)

Definition at line 33 of file dialog.qc.

34 {
35 ++me.currentRow;
36 me.currentColumn = me.firstColumn;
37 }

References entity().