]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/menu/item/dialog.c
Merge remote-tracking branch 'origin/terencehill/color_picker_carets'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / menu / item / dialog.c
index 800a12681e4eb3d8b95ba4c0206baf1691cf5f3a..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,6 +58,8 @@ 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)
@@ -124,7 +126,6 @@ void Dialog_TDempty(entity me, float colspan)
 
 void Dialog_configureDialog(entity me)
 {
-       entity closebutton;
        float absWidth, absHeight;
 
        me.frame = spawnBorderImage();
@@ -134,7 +135,7 @@ void Dialog_configureDialog(entity me)
        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;
@@ -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();
+               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)