]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/menu/item/dialog.c
Merge remote-tracking branch 'origin/samual/serverlist'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / menu / item / dialog.c
index 8202fbbb67e4c358989d96c20bae9eb2dd002cec..383578781544e96b900cca383fc702c377945de8 100644 (file)
@@ -4,7 +4,7 @@
 // - closable is 0
 // - rootDialog is 0
 // - title is ""
-// - marginTop is 
+// - marginTop is
 // - intendedHeight ends up to be the tab's actual height, or at least close
 // - titleFontSize is 0
 // - marginTop cancels out as much of titleHeight as needed (that is, it should be actualMarginTop - titleHeight)
@@ -58,7 +58,10 @@ CLASS(Dialog) EXTENDS(InputContainer)
        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, backgroundImage, string, string_null)
+       ATTRIB(Dialog, borderLines, float, 1)
        ATTRIB(Dialog, closeButtonImage, string, string_null)
 
        ATTRIB(Dialog, frame, entity, NULL)
@@ -77,7 +80,6 @@ void Dialog_fill(entity me)
 
 void Dialog_addItemSimple(entity me, float row, float col, float rowspan, float colspan, entity e, vector v)
 {
-       //print(vtos(me.itemSpacing), " ", vtos(me.itemSize), "\n");
        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);
@@ -124,23 +126,22 @@ void Dialog_TDempty(entity me, float colspan)
 
 void Dialog_configureDialog(entity me)
 {
-       entity closebutton;
        float absWidth, absHeight;
 
        me.frame = spawnBorderImage();
-       me.frame.configureBorderImage(me.frame, me.title, me.titleFontSize, me.color, me.backgroundImage, me.titleHeight);
+       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 not(me.titleFontSize)
+       if (!me.titleFontSize)
                me.titleHeight = 0; // no title bar
 
        absWidth = me.intendedWidth * conwidth;
-       absHeight = me.titleHeight + me.marginTop + me.rows * me.rowHeight + (me.rows - 1) * me.rowSpacing + me.marginBottom;
+       absHeight = me.borderLines * me.titleHeight + me.marginTop + me.rows * me.rowHeight + (me.rows - 1) * me.rowSpacing + me.marginBottom;
        me.itemOrigin  = eX * (me.marginLeft / absWidth)
-                      + eY * ((me.titleHeight + me.marginTop) / absHeight);
+                      + eY * ((me.borderLines * me.titleHeight + me.marginTop) / absHeight);
        me.itemSize    = eX * ((1 - (me.marginLeft + me.marginRight + me.columnSpacing * (me.columns - 1)) / absWidth) / me.columns)
                       + eY * (me.rowHeight / absHeight);
        me.itemSpacing = me.itemSize
@@ -152,16 +153,15 @@ void Dialog_configureDialog(entity me)
 
        me.fill(me);
 
-       if(me.closable)
+       if(me.closable && me.borderLines > 0)
        {
-               closebutton = me.closeButton = spawnButton();
-               closebutton.configureButton(closebutton, "Close", 0, me.closeButtonImage);
+               entity closebutton;
+               closebutton = me.closeButton = me.frame.closeButton = spawnButton();
+               closebutton.configureButton(closebutton, "", 0, me.closeButtonImage);
                closebutton.onClick = Dialog_Close; closebutton.onClickEntity = me;
                closebutton.srcMulti = 0;
                me.addItem(me, closebutton, '0 0 0', '1 1 0', 1); // put it as LAST
        }
-
-       me.frame.closeButton = closebutton;
 }
 
 void Dialog_close(entity me)