From 16472132ada3393ede71e1c6d648c80841608ebb Mon Sep 17 00:00:00 2001
From: Stijn Buys <ingar@telenet.be>
Date: Sun, 21 Nov 2021 17:29:50 +0100
Subject: Small cleanup of the load/save menu layout.

---
 src/client/savegamemenu.cc | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/src/client/savegamemenu.cc b/src/client/savegamemenu.cc
index d7b8293..aa43087 100644
--- a/src/client/savegamemenu.cc
+++ b/src/client/savegamemenu.cc
@@ -81,14 +81,14 @@ SaveGameMenu::SaveGameMenu(ui::Widget *parent, const char *label, const Mode mod
 	savegamemenu_descrlabel->set_background(true);
 	savegamemenu_descrlabel->set_border(true);
 	
+	// delete button is a child of description label
+	savegamemenu_deletebutton = new ui::IconButton(savegamemenu_descrlabel, "bitmaps/icons/button_delete", "Delete");
+	savegamemenu_deletebutton->set_label("delete");
+	
 	// save button
 	savegamemenu_savebutton = new ui::Button(this, "Save");
 	savegamemenu_savebutton->set_label("save");
 	
-	// delete button
-	savegamemenu_deletebutton = new ui::IconButton(this, "bitmaps/icons/button_delete", "Delete");
-	savegamemenu_deletebutton->set_label("delete");
-	
 	// cancel save/load/overwrite button
 	savegamemenu_cancelbutton = new ui::Button(this, "Cancel");
 	savegamemenu_cancelbutton->set_label("cancel");
@@ -114,7 +114,7 @@ SaveGameMenu::~SaveGameMenu()
 void SaveGameMenu::resize()
 {
 	const float padding =  ui::UI::padding;
-	const float icon_size = 24.0f; // small icons
+	const float icon_size = ui::UI::icon_small;
 	
 	// resize title label
 	savegamemenu_titlelabel->set_size(width() - padding * 2.0f, savegamemenu_titlelabel->font()->height());	
@@ -127,20 +127,13 @@ void SaveGameMenu::resize()
 	// resize files listview
 	savegamemenu_filelistview->set_size(
 		ui::UI::elementsize.width(), 
-		height() - icon_size - padding * 3.0f - savegamemenu_titlelabel->bottom()
+		height() - 2.0f * padding - savegamemenu_titlelabel->bottom()
 	);
 	savegamemenu_filelistview->set_location(
 		padding, 
 		savegamemenu_titlelabel->bottom() + padding
 	);
 	
-	// resize delete button
-	savegamemenu_deletebutton->set_size(icon_size, icon_size);
-	savegamemenu_deletebutton->set_location(
-		savegamemenu_filelistview->left(), 
-		savegamemenu_filelistview->bottom() + padding
-	);
-		
 	// resize description title
 	savegamemenu_descrtitle->set_size(
 		width() - savegamemenu_filelistview->right() - 2.0f * padding,
@@ -154,13 +147,20 @@ void SaveGameMenu::resize()
 	// resize description label
 	savegamemenu_descrlabel->set_size(
 		savegamemenu_descrtitle->width(),
-		savegamemenu_filelistview->bottom() - savegamemenu_descrtitle->bottom() - padding
+		savegamemenu_filelistview->bottom() - savegamemenu_descrtitle->bottom() - 2.0f * padding - ui::UI::elementsize.height()
 	);
 	savegamemenu_descrlabel->set_location(
 		savegamemenu_filelistview->right() + padding, 
 		savegamemenu_descrtitle->bottom() + padding
 	);
 	
+	// resize delete button
+	savegamemenu_deletebutton->set_size(icon_size, icon_size);
+	savegamemenu_deletebutton->set_location(
+		savegamemenu_descrtitle->width() - savegamemenu_deletebutton->width() - padding,
+		padding
+	);
+	
 	// resize screenshot
 	const model::Material *screenshotmaterial = model::Material::find("ui/screenshot");
 	if (screenshotmaterial) {
-- 
cgit v1.2.3