//
// a subclass may help with using this as a tab
-#ifdef INTERFACE
-CLASS(Dialog) EXTENDS(InputContainer)
- METHOD(Dialog, configureDialog, void(entity)) // no runtime configuration, all parameters are given in the code!
- METHOD(Dialog, fill, void(entity)) // to be overridden by user to fill the dialog with controls
- METHOD(Dialog, keyDown, float(entity, float, float, float))
- METHOD(Dialog, close, void(entity))
- METHOD(Dialog, addItemSimple, void(entity, float, float, float, float, entity, vector))
-
- METHOD(Dialog, TD, void(entity, float, float, entity))
- METHOD(Dialog, TDNoMargin, void(entity, float, float, entity, vector))
- METHOD(Dialog, TDempty, void(entity, float))
- METHOD(Dialog, setFirstColumn, void(entity, float))
- METHOD(Dialog, TR, void(entity))
- METHOD(Dialog, gotoRC, void(entity, float, float))
+#ifndef ITEM_DIALOG_H
+#define ITEM_DIALOG_H
+#include "inputcontainer.qc"
+CLASS(Dialog, InputContainer)
+ METHOD(Dialog, configureDialog, void(entity)); // no runtime configuration, all parameters are given in the code!
+ METHOD(Dialog, fill, void(entity)); // to be overridden by user to fill the dialog with controls
+ METHOD(Dialog, keyDown, float(entity, float, float, float));
+ METHOD(Dialog, close, void(entity));
+ METHOD(Dialog, addItemSimple, void(entity, float, float, float, float, entity, vector));
+
+ METHOD(Dialog, TD, void(entity, float, float, entity));
+ METHOD(Dialog, TDNoMargin, void(entity, float, float, entity, vector));
+ METHOD(Dialog, TDempty, void(entity, float));
+ METHOD(Dialog, setFirstColumn, void(entity, float));
+ METHOD(Dialog, TR, void(entity));
+ METHOD(Dialog, gotoRC, void(entity, float, float));
ATTRIB(Dialog, isTabRoot, float, 1)
ATTRIB(Dialog, closeButton, entity, NULL)
ATTRIB(Dialog, zoomedOutTitleBarPosition, float, 0)
ATTRIB(Dialog, zoomedOutTitleBar, float, 0)
- ATTRIB(Dialog, requiresConnection, float, 0) // set to TRUE if the dialog requires a connection to be opened
+ ATTRIB(Dialog, requiresConnection, float, 0) // set to true if the dialog requires a connection to be opened
ATTRIB(Dialog, backgroundImage, string, string_null)
ATTRIB(Dialog, borderLines, float, 1)
void Dialog_addItemSimple(entity me, float row, float col, float rowspan, float colspan, entity e, vector v)
{
vector o, s;
- o = me.itemOrigin + eX * ( col * me.itemSpacing_x) + eY * ( row * me.itemSpacing_y);
- s = me.itemSize + eX * ((colspan - 1) * me.itemSpacing_x) + eY * ((rowspan - 1) * me.itemSpacing_y);
- o_x -= 0.5 * (me.itemSpacing_x - me.itemSize_x) * v_x;
- s_x += (me.itemSpacing_x - me.itemSize_x) * v_x;
- o_y -= 0.5 * (me.itemSpacing_y - me.itemSize_y) * v_y;
- s_y += (me.itemSpacing_y - me.itemSize_y) * v_y;
+ o = me.itemOrigin + eX * ( col * me.itemSpacing.x) + eY * ( row * me.itemSpacing.y);
+ s = me.itemSize + eX * ((colspan - 1) * me.itemSpacing.x) + eY * ((rowspan - 1) * me.itemSpacing.y);
+ o.x -= 0.5 * (me.itemSpacing.x - me.itemSize.x) * v.x;
+ s.x += (me.itemSpacing.x - me.itemSize.x) * v.x;
+ o.y -= 0.5 * (me.itemSpacing.y - me.itemSize.y) * v.y;
+ s.y += (me.itemSpacing.y - me.itemSize.y) * v.y;
me.addItem(me, e, o, s, 1);
}
{
float absWidth, absHeight;
- me.frame = spawnBorderImage();
- me.frame.configureBorderImage(me.frame, me.title, me.titleFontSize, me.color, me.backgroundImage, me.borderLines * me.titleHeight);
- me.frame.zoomedOutTitleBarPosition = me.zoomedOutTitleBarPosition;
- me.frame.zoomedOutTitleBar = me.zoomedOutTitleBar;
- me.frame.alpha = me.alpha;
- me.addItem(me, me.frame, '0 0 0', '1 1 0', 1);
+ if(me.isTabRoot)
+ {
+ me.frame = NEW(BorderImage);
+ me.frame.configureBorderImage(me.frame, me.title, me.titleFontSize, me.color, me.backgroundImage, me.borderLines * me.titleHeight);
+ me.frame.zoomedOutTitleBarPosition = me.zoomedOutTitleBarPosition;
+ me.frame.zoomedOutTitleBar = me.zoomedOutTitleBar;
+ me.frame.alpha = me.alpha;
+ me.addItem(me, me.frame, '0 0 0', '1 1 0', 1);
+ }
if (!me.titleFontSize)
me.titleHeight = 0; // no title bar
me.fill(me);
- if(me.closable && me.borderLines > 0)
+ if(me.isTabRoot && me.closable && me.borderLines > 0)
{
entity closebutton;
- closebutton = me.closeButton = me.frame.closeButton = spawnButton();
+ closebutton = me.closeButton = me.frame.closeButton = NEW(Button);
closebutton.configureButton(closebutton, "", 0, me.closeButtonImage);
closebutton.onClick = Dialog_Close; closebutton.onClickEntity = me;
closebutton.srcMulti = 0;
{
if(key == K_ESCAPE)
{
+ m_play_click_sound(MENU_SOUND_CLOSE);
me.close(me);
return 1;
}