Author: mordante
Date: Mon Sep 22 23:33:43 2008
New Revision: 29655
URL: http://svn.gna.org/viewcvs/wesnoth?rev=29655&view=rev
Log:
Add some files I forgot in my last commit.
Added:
trunk/src/gui/widgets/image.cpp (with props)
trunk/src/gui/widgets/image.hpp (with props)
Added: trunk/src/gui/widgets/image.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/widgets/image.cpp?rev=29655&view=auto
==============================================================================
--- trunk/src/gui/widgets/image.cpp (added)
+++ trunk/src/gui/widgets/image.cpp Mon Sep 22 23:33:43 2008
@@ -1,0 +1,56 @@
+/* $Id$ */
+/*
+ copyright (C) 2008 by mark de wever <[EMAIL PROTECTED]>
+ part of the battle for wesnoth project http://www.wesnoth.org/
+
+ this program is free software; you can redistribute it and/or modify
+ it under the terms of the gnu general public license version 2
+ or at your option any later version.
+ this program is distributed in the hope that it will be useful,
+ but without any warranty.
+
+ see the copying file for more details.
+*/
+
+#include "gui/widgets/image.hpp"
+
+#include "../../image.hpp"
+#include "log.hpp"
+
+#define DBG_G LOG_STREAM_INDENT(debug, gui)
+#define LOG_G LOG_STREAM_INDENT(info, gui)
+#define WRN_G LOG_STREAM_INDENT(warn, gui)
+#define ERR_G LOG_STREAM_INDENT(err, gui)
+
+#define DBG_G_D LOG_STREAM_INDENT(debug, gui_draw)
+#define LOG_G_D LOG_STREAM_INDENT(info, gui_draw)
+#define WRN_G_D LOG_STREAM_INDENT(warn, gui_draw)
+#define ERR_G_D LOG_STREAM_INDENT(err, gui_draw)
+
+#define DBG_G_E LOG_STREAM_INDENT(debug, gui_event)
+#define LOG_G_E LOG_STREAM_INDENT(info, gui_event)
+#define WRN_G_E LOG_STREAM_INDENT(warn, gui_event)
+#define ERR_G_E LOG_STREAM_INDENT(err, gui_event)
+
+#define DBG_G_P LOG_STREAM_INDENT(debug, gui_parse)
+#define LOG_G_P LOG_STREAM_INDENT(info, gui_parse)
+#define WRN_G_P LOG_STREAM_INDENT(warn, gui_parse)
+#define ERR_G_P LOG_STREAM_INDENT(err, gui_parse)
+
+
+namespace gui2 {
+
+tpoint timage::get_best_size() const
+{
+ surface image(get_image(image::locator(label())));
+
+ if(image) {
+ return tpoint(image->w, image->h);
+ }
+
+ return tpoint(0, 0);
+
+}
+
+} // namespace gui2
+
Propchange: trunk/src/gui/widgets/image.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: trunk/src/gui/widgets/image.cpp
------------------------------------------------------------------------------
svn:keywords = 'Author Date Id Revision'
Added: trunk/src/gui/widgets/image.hpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/widgets/image.hpp?rev=29655&view=auto
==============================================================================
--- trunk/src/gui/widgets/image.hpp (added)
+++ trunk/src/gui/widgets/image.hpp Mon Sep 22 23:33:43 2008
@@ -1,0 +1,70 @@
+/* $Id$ */
+/*
+ copyright (C) 2008 by mark de wever <[EMAIL PROTECTED]>
+ part of the battle for wesnoth project http://www.wesnoth.org/
+
+ this program is free software; you can redistribute it and/or modify
+ it under the terms of the gnu general public license version 2
+ or at your option any later version.
+ this program is distributed in the hope that it will be useful,
+ but without any warranty.
+
+ see the copying file for more details.
+*/
+
+#ifndef GUI_WIDGETS_IMAGE_HPP_INCLUDED
+#define GUI_WIDGETS_IMAGE_HPP_INCLUDED
+
+#include "gui/widgets/control.hpp"
+
+namespace gui2 {
+
+/** An image. */
+class timage : public tcontrol
+{
+public:
+
+ timage()
+ : tcontrol(COUNT)
+ {
+ }
+
+ /** Inherited from twidget. */
+ tpoint get_minimum_size() const { return get_best_size(); }
+
+ /** Inherited from twidget. */
+ tpoint get_best_size() const;
+
+ /** Import overloaded versions. */
+ using tcontrol::get_best_size;
+
+ /** Inherited from twidget. */
+ tpoint get_maximum_size() const { return get_best_size(); }
+
+ /** Inherited from tcontrol. */
+ void set_active(const bool /*active*/) {}
+
+ /** Inherited from tcontrol. */
+ bool get_active() const { return true; }
+
+ /** Inherited from tcontrol. */
+ unsigned get_state() const { return ENABLED; }
+
+private:
+
+ /**
+ * Possible states of the widget.
+ *
+ * Note the order of the states must be the same as defined in
settings.hpp.
+ */
+ enum tstate { ENABLED, COUNT };
+
+ /** Inherited from tcontrol. */
+ const std::string& get_control_type() const
+ { static const std::string type = "image"; return type; }
+};
+
+} // namespace gui2
+
+#endif
+
Propchange: trunk/src/gui/widgets/image.hpp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: trunk/src/gui/widgets/image.hpp
------------------------------------------------------------------------------
svn:keywords = 'Author Date Id Revision'
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits