(svn r9090) [cpp_gui] -Add: min/step/max sizes added to the widget (still not set/used) cpp_gui
authorKUDr
Sat, 10 Mar 2007 04:52:01 +0000
branchcpp_gui
changeset 6294 6c74bf9cc5a4
parent 6293 59b7305f9a8b
child 6295 a88d8c2cff6e
(svn r9090) [cpp_gui] -Add: min/step/max sizes added to the widget (still not set/used)
-Codechange: order of some includes changed (solved min/max macro conflict with stl)
src/misc/autoptr.hpp
src/misc/rect.hpp
src/network/network_client.cpp
src/network/network_gui.cpp
src/stdafx.h
src/video/win32_v.cpp
src/widget/widget.h
--- a/src/misc/autoptr.hpp	Sat Mar 10 02:39:51 2007 +0000
+++ b/src/misc/autoptr.hpp	Sat Mar 10 04:52:01 2007 +0000
@@ -1,4 +1,4 @@
-/* $Id:$ */
+/* $Id$ */
 
 #ifndef AUTOPTR_HPP
 #define AUTOPTR_HPP
--- a/src/misc/rect.hpp	Sat Mar 10 02:39:51 2007 +0000
+++ b/src/misc/rect.hpp	Sat Mar 10 04:52:01 2007 +0000
@@ -92,6 +92,31 @@
 	{
 		return PointT(PointRaw::x / coef, PointRaw::y / coef);
 	}
+
+	static const PointT& min()
+	{
+		static PointT val(std::numeric_limits<T>::min(), std::numeric_limits<T>::min());
+		return val;
+	}
+
+	static const PointT& zero()
+	{
+		static PointT val(0, 0);
+		return val;
+	}
+
+	static const PointT& one()
+	{
+		static PointT val(1, 1);
+		return val;
+	}
+
+	static const PointT& max()
+	{
+		static PointT val(std::numeric_limits<T>::max(), std::numeric_limits<T>::max());
+		return val;
+	}
+
 };
 
 
--- a/src/network/network_client.cpp	Sat Mar 10 02:39:51 2007 +0000
+++ b/src/network/network_client.cpp	Sat Mar 10 04:52:01 2007 +0000
@@ -6,14 +6,9 @@
 #include "../debug.h"
 #include "../string.h"
 #include "../strings.h"
-#include "network_data.h"
-#include "core/tcp.h"
 #include "../date.h"
 #include "table/strings.h"
 #include "../functions.h"
-#include "network_client.h"
-#include "network_gamelist.h"
-#include "network_gui.h"
 #include "../saveload.h"
 #include "../command.h"
 #include "../window.h"
@@ -22,6 +17,12 @@
 #include "../ai/ai.h"
 #include "../helpers.hpp"
 
+#include "core/tcp.h"
+#include "network_data.h"
+#include "network_client.h"
+#include "network_gamelist.h"
+#include "network_gui.h"
+
 // This file handles all the client-commands
 
 
--- a/src/network/network_gui.cpp	Sat Mar 10 02:39:51 2007 +0000
+++ b/src/network/network_gui.cpp	Sat Mar 10 04:52:01 2007 +0000
@@ -6,28 +6,28 @@
 #include "../string.h"
 #include "../strings.h"
 #include "../table/sprites.h"
-#include "network.h"
 #include "../date.h"
-
-#include "../fios.h"
 #include "table/strings.h"
 #include "../functions.h"
-#include "network_data.h"
-#include "network_client.h"
-#include "network_gui.h"
-#include "network_gamelist.h"
 #include "../window.h"
 #include "../gui.h"
 #include "../gfx.h"
 #include "../command.h"
 #include "../variables.h"
-#include "network_server.h"
-#include "network_udp.h"
 #include "../settings.h"
 #include "../string.h"
 #include "../town.h"
 #include "../newgrf.h"
 #include "../helpers.hpp"
+#include "../fios.h"
+
+#include "network.h"
+#include "network_data.h"
+#include "network_client.h"
+#include "network_gui.h"
+#include "network_gamelist.h"
+#include "network_server.h"
+#include "network_udp.h"
 
 #define BGC 5
 #define BTC 15
--- a/src/stdafx.h	Sat Mar 10 02:39:51 2007 +0000
+++ b/src/stdafx.h	Sat Mar 10 04:52:01 2007 +0000
@@ -14,6 +14,8 @@
 # define INT64_MAX 9223372036854775807LL
 #endif
 
+#include <limits>
+
 #include <cstdio>
 #include <cstddef>
 #include <cstring>
--- a/src/video/win32_v.cpp	Sat Mar 10 02:39:51 2007 +0000
+++ b/src/video/win32_v.cpp	Sat Mar 10 04:52:01 2007 +0000
@@ -7,8 +7,8 @@
 #include "../macros.h"
 #include "../network/network.h"
 #include "../variables.h"
+#include "../window.h"
 #include "../win32.h"
-#include "../window.h"
 #include "win32_v.h"
 #include <windows.h>
 #include <tchar.h>
--- a/src/widget/widget.h	Sat Mar 10 02:39:51 2007 +0000
+++ b/src/widget/widget.h	Sat Mar 10 04:52:01 2007 +0000
@@ -75,11 +75,15 @@
 	bool            m_dont_clip : 1;    ///< should not be clipped by parent (container)
 	StringID        m_tooltips;         ///< Tooltips that are shown when right clicking on a widget
 	Anchors         m_anchors;          ///< Resize/move when container resizes?
+	Point16         m_min_size;         ///< Minimum size
+	Point16         m_max_size;         ///< Maximum size
+	Point16         m_size_step;        ///< When resizing, what step is the best
 	Handlers        m_handlers;         ///< dynamically registered event handlers
 
 	Widget()
 		: m_container(NULL), m_id(0), m_rect(), m_data(0), m_feature_flags(FF_NONE), m_color(0)
 		, m_is_closing(false), m_tooltips(0), m_anchors(PIN_NONE)
+		, m_max_size(Point16::max()), m_size_step(1, 1)
 	{}
 
 	Widget(CompositeWidget *container, WidgetId id, FeatureFlags feature_flags, byte color, const Rect16 &rect, StringID tooltips)
@@ -93,6 +97,8 @@
 		, m_dont_clip(false)
 		, m_tooltips(tooltips)
 		, m_anchors(PIN_NONE)
+		, m_max_size(Point16::max())
+		, m_size_step(1, 1)
 	{}
 
 	int16 Left() const;