Author: mordante
Date: Wed Apr 30 14:31:51 2008
New Revision: 26253
URL: http://svn.gna.org/viewcvs/wesnoth?rev=26253&view=rev
Log:
Only allow set_size() to modify the size of a widget.
Modified:
trunk/src/gui/widgets/control.cpp
trunk/src/gui/widgets/control.hpp
trunk/src/gui/widgets/grid.cpp
trunk/src/gui/widgets/widget.hpp
trunk/src/gui/widgets/window.cpp
Modified: trunk/src/gui/widgets/control.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/widgets/control.cpp?rev=26253&r1=26252&r2=26253&view=diff
==============================================================================
--- trunk/src/gui/widgets/control.cpp (original)
+++ trunk/src/gui/widgets/control.cpp Wed Apr 30 14:31:51 2008
@@ -67,28 +67,6 @@
{
DBG_G_E << "Control: help key.\n";
event.show_help_popup(help_message_, 0); //FIXME timout should be a
parameter
-}
-
-void tcontrol::set_width(const unsigned width)
-{
- // resize canvasses
- foreach(tcanvas& canvas, canvas_) {
- canvas.set_width(width);
- }
-
- // inherited
- twidget::set_width(width);
-}
-
-void tcontrol::set_height(const unsigned height)
-{
- // resize canvasses
- foreach(tcanvas& canvas, canvas_) {
- canvas.set_height(height);
- }
-
- // inherited
- twidget::set_height(height);
}
void tcontrol::set_size(const SDL_Rect& rect)
Modified: trunk/src/gui/widgets/control.hpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/widgets/control.hpp?rev=26253&r1=26252&r2=26253&view=diff
==============================================================================
--- trunk/src/gui/widgets/control.hpp (original)
+++ trunk/src/gui/widgets/control.hpp Wed Apr 30 14:31:51 2008
@@ -37,12 +37,6 @@
//! Inherted from twidget.
void help_key(tevent_handler& event);
-
- //! Inherited from twidget.
- void set_width(const unsigned width);
-
- //! Inherited from twidget.
- void set_height(const unsigned height);
//! Inherited from twidget.
void set_size(const SDL_Rect& rect);
Modified: trunk/src/gui/widgets/grid.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/widgets/grid.cpp?rev=26253&r1=26252&r2=26253&view=diff
==============================================================================
--- trunk/src/gui/widgets/grid.cpp (original)
+++ trunk/src/gui/widgets/grid.cpp Wed Apr 30 14:31:51 2008
@@ -218,6 +218,10 @@
twidget::set_size(rect);
+ if(!rows_ || !cols_) {
+ return;
+ }
+
const tpoint orig(rect.x, rect.y);
const tpoint size(rect.w, rect.h);
Modified: trunk/src/gui/widgets/widget.hpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/widgets/widget.hpp?rev=26253&r1=26252&r2=26253&view=diff
==============================================================================
--- trunk/src/gui/widgets/widget.hpp (original)
+++ trunk/src/gui/widgets/widget.hpp Wed Apr 30 14:31:51 2008
@@ -150,20 +150,9 @@
// virtual bool does_hit(const int x, const int y) const { return
false; }
-// virtual void handle_event(const SDL_Event& event) { std::cerr << "x\n";}
- // moving an object doesn't dirty it, it should dirty the parent
container...
- virtual void set_x(const int x) { x_ = x; }
int get_x() const { return x_; }
-
- virtual void set_y(const int y) { y_ = y; }
int get_y() const { return y_; }
-
- // resizing an object dirties it
- // note most items should not be resized manually but with a sizer
- virtual void set_width(const unsigned width) { w_ = width; set_dirty();
}
unsigned get_width() const { return w_; }
-
- virtual void set_height(const unsigned height) { h_ = height;
set_dirty(); }
unsigned get_height() const { return h_; }
//! Is the widget dirty?
Modified: trunk/src/gui/widgets/window.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/widgets/window.cpp?rev=26253&r1=26252&r2=26253&view=diff
==============================================================================
--- trunk/src/gui/widgets/window.cpp (original)
+++ trunk/src/gui/widgets/window.cpp Wed Apr 30 14:31:51 2008
@@ -60,17 +60,12 @@
retval_(0),
need_layout_(true),
restorer_(),
-// canvas_background_(),
-// canvas_foreground_(),
tooltip_(),
help_popup_()
{
load_config();
- set_x(x);
- set_y(y);
- set_width(w);
- set_height(h);
+ set_size(::create_rect(x, y, w, h));
tooltip_.set_definition("default");
tooltip_.set_visible(false);
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits