summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/listbox.cpp1
-rw-r--r--src/gui/menuwindow.cpp9
-rw-r--r--src/gui/ministatus.cpp1
-rw-r--r--src/gui/shoplistbox.cpp1
-rw-r--r--src/gui/trade.cpp2
-rw-r--r--src/gui/window.cpp15
-rw-r--r--src/gui/window.h7
7 files changed, 19 insertions, 17 deletions
diff --git a/src/gui/listbox.cpp b/src/gui/listbox.cpp
index a7f6df8d..94e8b38c 100644
--- a/src/gui/listbox.cpp
+++ b/src/gui/listbox.cpp
@@ -52,6 +52,7 @@ void ListBox::draw(gcn::Graphics *graphics)
}
// Draw the list elements
+ graphics->setColor(gcn::Color(0, 0, 0));
for (int i = 0, y = 0;
i < mListModel->getNumberOfElements();
++i, y += fontHeight)
diff --git a/src/gui/menuwindow.cpp b/src/gui/menuwindow.cpp
index e6b35f5a..2043b7d1 100644
--- a/src/gui/menuwindow.cpp
+++ b/src/gui/menuwindow.cpp
@@ -66,22 +66,19 @@ MenuWindow::MenuWindow():
"Setup",
0
};
- int x = 0, y = 3, h = 0;
+ int x = 0, h = 0;
for (const char **curBtn = buttonNames; *curBtn; curBtn++)
{
gcn::Button *btn = new Button(*curBtn, *curBtn, &listener);
- btn->setPosition(x, y);
+ btn->setPosition(x, 0);
add(btn);
x += btn->getWidth() + 3;
h = btn->getHeight();
}
+ setPosition(windowContainer->getWidth() - x - 3, 3);
setContentSize(x - 3, h);
- setDefaultSize(windowContainer->getWidth() - getWidth() - 1,
- 0,
- x - 3,
- y + h);
}
void MenuWindow::draw(gcn::Graphics *graphics)
diff --git a/src/gui/ministatus.cpp b/src/gui/ministatus.cpp
index 694a6f32..8f121368 100644
--- a/src/gui/ministatus.cpp
+++ b/src/gui/ministatus.cpp
@@ -78,6 +78,7 @@ MiniStatusWindow::MiniStatusWindow():
setDefaultSize(0, 0, mXpBar->getX() + mXpBar->getWidth(),
mXpBar->getY() + mXpBar->getHeight());
+ loadWindowState();
}
void MiniStatusWindow::update()
diff --git a/src/gui/shoplistbox.cpp b/src/gui/shoplistbox.cpp
index 4efd6e64..610ad76c 100644
--- a/src/gui/shoplistbox.cpp
+++ b/src/gui/shoplistbox.cpp
@@ -95,6 +95,7 @@ void ShopListBox::draw(gcn::Graphics *gcnGraphics)
graphics->drawImage(icon, 1, y);
}
}
+ graphics->setColor(gcn::Color(0, 0, 0));
graphics->drawText(mListModel->getElementAt(i), ITEM_ICON_SIZE + 5,
y + (ITEM_ICON_SIZE - getFont()->getHeight()) / 2);
}
diff --git a/src/gui/trade.cpp b/src/gui/trade.cpp
index 06daf3ef..744afe1e 100644
--- a/src/gui/trade.cpp
+++ b/src/gui/trade.cpp
@@ -99,6 +99,8 @@ TradeWindow::TradeWindow(Network *network):
add(mMoneyField);
add(mMoneyLabel);
+ loadWindowState();
+
gcn::Rectangle area = getChildrenArea();
int width = area.width;
int height = area.height;
diff --git a/src/gui/window.cpp b/src/gui/window.cpp
index 8317684a..90031545 100644
--- a/src/gui/window.cpp
+++ b/src/gui/window.cpp
@@ -526,17 +526,21 @@ Window::loadWindowState()
{
const std::string &name = mWindowName;
- setPosition((int) config.getValue(name + "WinX", getX()),
- (int) config.getValue(name + "WinY", getY()));
+ setPosition((int) config.getValue(name + "WinX", mDefaultX),
+ (int) config.getValue(name + "WinY", mDefaultY));
if (mGrip)
{
- setSize((int) config.getValue(name + "WinWidth", getWidth()),
- (int) config.getValue(name + "WinHeight", getHeight()));
+ setSize((int) config.getValue(name + "WinWidth", mDefaultWidth),
+ (int) config.getValue(name + "WinHeight", mDefaultHeight));
const gcn::Rectangle area = getChildrenArea();
mChrome->setSize(area.width, area.height);
}
+ else
+ {
+ setContentSize(mDefaultWidth, mDefaultHeight);
+ }
}
void Window::setDefaultSize(int defaultX, int defaultY,
@@ -546,9 +550,6 @@ void Window::setDefaultSize(int defaultX, int defaultY,
mDefaultY = defaultY;
mDefaultWidth = defaultWidth;
mDefaultHeight = defaultHeight;
-
- setPosition(mDefaultX, mDefaultY);
- setContentSize(mDefaultWidth, mDefaultHeight);
}
void Window::resetToDefaultSize()
diff --git a/src/gui/window.h b/src/gui/window.h
index 8e3fdef9..18f97cec 100644
--- a/src/gui/window.h
+++ b/src/gui/window.h
@@ -255,10 +255,9 @@ class Window : public gcn::Window
getWindowName() { return mWindowName; }
/**
- * Read the x, y, and width and height for resizables in the config
- * based on the name of the window.
- * That function let the values set with set{X, Y, Height, width}()
- * if no config value is found.
+ * Reads the position (and the size for resizable windows) in the
+ * configuration based on the given string.
+ * Uses the default values when config values are missing.
* Don't forget to set these default values and resizable before
* calling this function.
*/