wesnoth-cvs-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Wesnoth-cvs-commits] wesnoth/src/widgets textbox.cpp textbox.hpp


From: Guillaume Melquiond
Subject: [Wesnoth-cvs-commits] wesnoth/src/widgets textbox.cpp textbox.hpp
Date: Sun, 31 Oct 2004 18:17:53 -0500

CVSROOT:        /cvsroot/wesnoth
Module name:    wesnoth
Branch:         
Changes by:     Guillaume Melquiond <address@hidden>    04/10/31 23:12:07

Modified files:
        src/widgets    : textbox.cpp textbox.hpp 

Log message:
        Fix textbox background refresh.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/textbox.cpp.diff?tr1=1.59&tr2=1.60&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/textbox.hpp.diff?tr1=1.32&tr2=1.33&r1=text&r2=text

Patches:
Index: wesnoth/src/widgets/textbox.cpp
diff -u wesnoth/src/widgets/textbox.cpp:1.59 
wesnoth/src/widgets/textbox.cpp:1.60
--- wesnoth/src/widgets/textbox.cpp:1.59        Sun Oct 31 20:50:13 2004
+++ wesnoth/src/widgets/textbox.cpp     Sun Oct 31 23:12:07 2004
@@ -1,4 +1,4 @@
-/* $Id: textbox.cpp,v 1.59 2004/10/31 20:50:13 silene Exp $ */
+/* $Id: textbox.cpp,v 1.60 2004/10/31 23:12:07 silene Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -36,14 +36,19 @@
             scrollbar_(d, *this, this),
             scroll_bottom_(false), wrap_(false), line_height_(0), yscroll_(0)
 {
-       static const SDL_Rect area = d.screen_area();
+       // static const SDL_Rect area = d.screen_area();
        // const int height = 
font::draw_text(NULL,area,font_size,font::NORMAL_COLOUR,"ABCD",0,0).h;
-       const int height = font::get_max_height(font_size);
-       const SDL_Rect starting_rect = {0,0,width,height};
-       set_location(starting_rect);
+       set_height(font::get_max_height(font_size));
+       set_width(width);
        update_text_cache(true);
 }
 
+void textbox::set_location(SDL_Rect const &rect)
+{
+       widget::set_location(rect);
+       register_rectangle(rect);
+}
+
 const std::string textbox::text() const
 {
        const std::string &ret = wstring_to_string(text_);
@@ -112,7 +117,7 @@
 
 void textbox::draw()
 {
-       if (location().x == 0 || !dirty())
+       if (hidden() || !dirty())
                return;
 
        bg_restore();
Index: wesnoth/src/widgets/textbox.hpp
diff -u wesnoth/src/widgets/textbox.hpp:1.32 
wesnoth/src/widgets/textbox.hpp:1.33
--- wesnoth/src/widgets/textbox.hpp:1.32        Sun Oct 31 20:50:13 2004
+++ wesnoth/src/widgets/textbox.hpp     Sun Oct 31 23:12:07 2004
@@ -1,4 +1,4 @@
-/* $Id: textbox.hpp,v 1.32 2004/10/31 20:50:13 silene Exp $ */
+/* $Id: textbox.hpp,v 1.33 2004/10/31 23:12:07 silene Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -46,6 +46,8 @@
        void set_wrap(bool val);
 
        void draw();
+       virtual void set_location(SDL_Rect const &);
+       using widget::set_location;
 
 private:
        size_t max_size_;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]