Author: mordante
Date: Wed Apr  9 18:08:36 2008
New Revision: 25710

URL: http://svn.gna.org/viewcvs/wesnoth?rev=25710&view=rev
Log:
Make the full_draw flag work for all controls.

Modified:
    trunk/src/gui/widgets/button.hpp
    trunk/src/gui/widgets/control.cpp
    trunk/src/gui/widgets/control.hpp
    trunk/src/gui/widgets/label.cpp
    trunk/src/gui/widgets/label.hpp
    trunk/src/gui/widgets/text_box.cpp
    trunk/src/gui/widgets/text_box.hpp

Modified: trunk/src/gui/widgets/button.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/widgets/button.hpp?rev=25710&r1=25709&r2=25710&view=diff
==============================================================================
--- trunk/src/gui/widgets/button.hpp (original)
+++ trunk/src/gui/widgets/button.hpp Wed Apr  9 18:08:36 2008
@@ -62,7 +62,6 @@
        void set_active(const bool active);
        bool get_active() const;
        unsigned get_state() const { return state_; }
-       bool full_redraw() const { return false; /* FIXME IMPLEMENT */ }
 
        //! Inherited from twidget.
        void load_config();

Modified: trunk/src/gui/widgets/control.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/widgets/control.cpp?rev=25710&r1=25709&r2=25710&view=diff
==============================================================================
--- trunk/src/gui/widgets/control.cpp (original)
+++ trunk/src/gui/widgets/control.cpp Wed Apr  9 18:08:36 2008
@@ -113,6 +113,12 @@
        return tpoint(config_->max_width, config_->max_height);
 }
 
+//! Does the widget need to restore the surface before (re)painting?
+bool tcontrol::full_redraw() const
+{
+       assert(config());
+       return config()->state[get_state()].full_redraw;
+}
 
 //! Sets the text variable for the canvases.
 void tcontrol::set_canvas_text()

Modified: trunk/src/gui/widgets/control.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/widgets/control.hpp?rev=25710&r1=25709&r2=25710&view=diff
==============================================================================
--- trunk/src/gui/widgets/control.hpp (original)
+++ trunk/src/gui/widgets/control.hpp Wed Apr  9 18:08:36 2008
@@ -83,7 +83,7 @@
        virtual unsigned get_state() const = 0;
 
        //! Does the widget need to restore the surface before (re)painting?
-       virtual bool full_redraw() const = 0;
+       virtual bool full_redraw() const;
 
        //! Sets the text variable for the canvases.
        virtual void set_canvas_text();

Modified: trunk/src/gui/widgets/label.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/widgets/label.cpp?rev=25710&r1=25709&r2=25710&view=diff
==============================================================================
--- trunk/src/gui/widgets/label.cpp (original)
+++ trunk/src/gui/widgets/label.cpp Wed Apr  9 18:08:36 2008
@@ -44,25 +44,6 @@
        DBG_G_E << "Text_box: mouse hover.\n"; 
 }
 
-void tlabel::draw(surface& surface)
-{
-       SDL_Rect rect = get_rect();
-
-       DBG_G_D << "Label: drawing enabled state.\n";
-/*     if(!restorer_) {
-               restorer_ = get_surface_portion(canvas, rect);
-       } 
-       if(definition_->enabled.full_redraw) {
-               SDL_BlitSurface(restorer_, 0, canvas, &rect);
-               rect = get_rect();
-       }
-*/
-       canvas(0).draw(true);
-       SDL_BlitSurface(canvas(0).surf(), 0, surface, &rect);
-
-       set_dirty(false);
-}
-
 void tlabel::set_state(tstate state)
 {
        if(state != state_) {

Modified: trunk/src/gui/widgets/label.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/widgets/label.hpp?rev=25710&r1=25709&r2=25710&view=diff
==============================================================================
--- trunk/src/gui/widgets/label.hpp (original)
+++ trunk/src/gui/widgets/label.hpp Wed Apr  9 18:08:36 2008
@@ -26,17 +26,15 @@
 public:
        
        tlabel() :
-               tcontrol(COUNT)
+               tcontrol(COUNT),
+               state_(ENABLED)
        {}
 
        void set_active(const bool active) { set_state(active ? ENABLED : 
DISABLED); };
        bool get_active() const { return state_ == ENABLED; }
        unsigned get_state() const { return state_; }
-       bool full_redraw() const { return false; /* FIXME IMPLEMENT */ }
 
        void mouse_hover(tevent_handler&);
-
-       void draw(surface& surface);
 
        //! Inherited from twidget.
        void load_config();

Modified: trunk/src/gui/widgets/text_box.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/widgets/text_box.cpp?rev=25710&r1=25709&r2=25710&view=diff
==============================================================================
--- trunk/src/gui/widgets/text_box.cpp (original)
+++ trunk/src/gui/widgets/text_box.cpp Wed Apr  9 18:08:36 2008
@@ -397,12 +397,6 @@
        set_dirty();
 }
 
-bool ttext_box::full_redraw() const
-{
-       assert(config());
-       return config()->state[get_state()].full_redraw;
-}
-
 //! Inherited from tcontrol.
 void ttext_box::set_canvas_text()
 {

Modified: trunk/src/gui/widgets/text_box.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/widgets/text_box.hpp?rev=25710&r1=25709&r2=25710&view=diff
==============================================================================
--- trunk/src/gui/widgets/text_box.hpp (original)
+++ trunk/src/gui/widgets/text_box.hpp Wed Apr  9 18:08:36 2008
@@ -33,6 +33,7 @@
 public:
        ttext_() :
                tcontrol(COUNT),
+               state_(ENABLED),
                text_(),
                sel_start_(0),
                sel_len_(0),
@@ -42,7 +43,7 @@
 
        void set_active(const bool active) { /*FIXME IMPLEMENT*/ };
        bool get_active() const { return true; /* FIXME IMPLEMENT */ }
-       unsigned get_state() const { return 0; /* FIXME IMPLEMENT */ }
+       unsigned get_state() const { return state_; }
 
        void mouse_move(tevent_handler&);
        void mouse_hover(tevent_handler&);
@@ -187,8 +188,6 @@
        //! Inherited from ttext_.
        void delete_selection();
 
-       bool full_redraw() const;
-
        //! Inherited from tcontrol.
        void set_canvas_text();
 


_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits

Reply via email to