summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-06-01 23:16:44 +0300
committerAndrei Karas <akaras@inbox.ru>2011-06-01 23:16:44 +0300
commitd0d120837ccf0a20c6d43a1193f257cfaeb194f6 (patch)
tree7efe3d94117946437d52929e69dfc2f0f31737a5
parentec552e6430ac86b1234c9a7798bf4e028a3c78c0 (diff)
downloadmanaverse-d0d120837ccf0a20c6d43a1193f257cfaeb194f6.tar.gz
manaverse-d0d120837ccf0a20c6d43a1193f257cfaeb194f6.tar.bz2
manaverse-d0d120837ccf0a20c6d43a1193f257cfaeb194f6.tar.xz
manaverse-d0d120837ccf0a20c6d43a1193f257cfaeb194f6.zip
Change trade window font to secure font if need.
-rw-r--r--src/gui/tradewindow.cpp4
-rw-r--r--src/gui/widgets/window.cpp3
-rw-r--r--src/gui/widgets/window.h4
-rw-r--r--src/playerrelations.cpp3
4 files changed, 12 insertions, 2 deletions
diff --git a/src/gui/tradewindow.cpp b/src/gui/tradewindow.cpp
index 6ed09669a..e7e74fdbb 100644
--- a/src/gui/tradewindow.cpp
+++ b/src/gui/tradewindow.cpp
@@ -27,8 +27,10 @@
#include "item.h"
#include "localplayer.h"
#include "playerinfo.h"
+#include "playerrelations.h"
#include "units.h"
+#include "gui/gui.h"
#include "gui/inventorywindow.h"
#include "gui/itemamountwindow.h"
#include "gui/setup.h"
@@ -440,4 +442,6 @@ void TradeWindow::initTrade(std::string nick)
}
}
clear();
+ if (!player_relations.isGoodName(nick))
+ setCaptionFont(gui->getSecureFont());
}
diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp
index 2b6c4ef58..bdf3f5b7c 100644
--- a/src/gui/widgets/window.cpp
+++ b/src/gui/widgets/window.cpp
@@ -94,6 +94,7 @@ Window::Window(const std::string &caption, bool modal, Window *parent,
setVisible(false);
addWidgetListener(this);
+ mCaptionFont = getFont();
}
Window::~Window()
@@ -154,7 +155,7 @@ void Window::draw(gcn::Graphics *graphics)
if (mShowTitle)
{
g->setColor(Theme::getThemeColor(Theme::TEXT));
- g->setFont(getFont());
+ g->setFont(mCaptionFont);
g->drawText(getCaption(), 7, 5, gcn::Graphics::LEFT);
}
diff --git a/src/gui/widgets/window.h b/src/gui/widgets/window.h
index f455f1238..4e9a6d87b 100644
--- a/src/gui/widgets/window.h
+++ b/src/gui/widgets/window.h
@@ -384,6 +384,9 @@ class Window : public gcn::Window, gcn::WidgetListener
bool isResizeAllowed(gcn::MouseEvent &event);
+ void setCaptionFont(gcn::Font *font)
+ { mCaptionFont = font; }
+
private:
enum ResizeHandles
{
@@ -442,6 +445,7 @@ class Window : public gcn::Window, gcn::WidgetListener
static const unsigned resizeBorderWidth = 10;
GraphicsVertexes *mVertexes;
bool mRedraw;
+ gcn::Font *mCaptionFont;
};
#endif
diff --git a/src/playerrelations.cpp b/src/playerrelations.cpp
index 7ff410064..9a2da1cad 100644
--- a/src/playerrelations.cpp
+++ b/src/playerrelations.cpp
@@ -20,13 +20,14 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "playerrelations.h"
+
#include <algorithm>
#include "actorspritemanager.h"
#include "being.h"
#include "configuration.h"
#include "graphics.h"
-#include "playerrelations.h"
#include "utils/dtor.h"
#include "utils/gettext.h"