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 scrollarea.cpp scrollbar.cp...


From: Philippe Plantier
Subject: [Wesnoth-cvs-commits] wesnoth/src/widgets scrollarea.cpp scrollbar.cp...
Date: Sun, 21 Aug 2005 09:11:29 -0400

CVSROOT:        /cvsroot/wesnoth
Module name:    wesnoth
Branch:         
Changes by:     Philippe Plantier <address@hidden>      05/08/21 13:11:29

Modified files:
        src/widgets    : scrollarea.cpp scrollbar.cpp scrollbar.hpp 

Log message:
        Scrollbar does not need to be a fiend class of scrollarea anymore.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/scrollarea.cpp.diff?tr1=1.13&tr2=1.14&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/scrollbar.cpp.diff?tr1=1.35&tr2=1.36&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/scrollbar.hpp.diff?tr1=1.18&tr2=1.19&r1=text&r2=text

Patches:
Index: wesnoth/src/widgets/scrollarea.cpp
diff -u wesnoth/src/widgets/scrollarea.cpp:1.13 
wesnoth/src/widgets/scrollarea.cpp:1.14
--- wesnoth/src/widgets/scrollarea.cpp:1.13     Sun Aug 21 12:58:46 2005
+++ wesnoth/src/widgets/scrollarea.cpp  Sun Aug 21 13:11:28 2005
@@ -1,4 +1,4 @@
-/* $Id: scrollarea.cpp,v 1.13 2005/08/21 12:58:46 gruikya Exp $*/
+/* $Id: scrollarea.cpp,v 1.14 2005/08/21 13:11:28 gruikya Exp $*/
 /*
    Copyright (C) 2004 by Guillaume Melquiond <address@hidden>
    Part of the Battle for Wesnoth Project http://www.wesnoth.org/
@@ -143,11 +143,14 @@
                return;
 
        SDL_MouseButtonEvent const &e = event.button;
-       if (point_in_rect(e.x, e.y, inner_location()))
-               if (e.button == SDL_BUTTON_WHEELDOWN)
-                       scrollbar_.move_position(scrollbar_.scroll_rate_);
-               else if (e.button == SDL_BUTTON_WHEELUP)
-                       scrollbar_.move_position(-scrollbar_.scroll_rate_);
+       if (point_in_rect(e.x, e.y, inner_location())) {
+               if (e.button == SDL_BUTTON_WHEELDOWN) {
+                       scrollbar_.scroll_down();
+               } else if (e.button == SDL_BUTTON_WHEELUP) {
+                       scrollbar_.scroll_up();
+               }
+       }
 }
 
 }
+
Index: wesnoth/src/widgets/scrollbar.cpp
diff -u wesnoth/src/widgets/scrollbar.cpp:1.35 
wesnoth/src/widgets/scrollbar.cpp:1.36
--- wesnoth/src/widgets/scrollbar.cpp:1.35      Sun Aug 21 12:58:46 2005
+++ wesnoth/src/widgets/scrollbar.cpp   Sun Aug 21 13:11:28 2005
@@ -1,4 +1,4 @@
-/* $Id: scrollbar.cpp,v 1.35 2005/08/21 12:58:46 gruikya Exp $*/
+/* $Id: scrollbar.cpp,v 1.36 2005/08/21 13:11:28 gruikya Exp $*/
 /*
    Copyright (C) 2003 by David White <address@hidden>
                  2004 by Guillaume Melquiond <address@hidden>
@@ -150,12 +150,23 @@
        }
 }
 
+void scrollbar::scroll_down()
+{
+       move_position(scroll_rate_);
+}
+
+void scrollbar::scroll_up()
+{
+       move_position(-scroll_rate_);
+}
+
 void scrollbar::process_event()
 {
        if (uparrow_.pressed())
-               move_position(-scroll_rate_);
+               scroll_up();
+
        if (downarrow_.pressed())
-               move_position(scroll_rate_);
+               scroll_down();
 }
 
 SDL_Rect scrollbar::groove_area() const
Index: wesnoth/src/widgets/scrollbar.hpp
diff -u wesnoth/src/widgets/scrollbar.hpp:1.18 
wesnoth/src/widgets/scrollbar.hpp:1.19
--- wesnoth/src/widgets/scrollbar.hpp:1.18      Sat Jul  2 21:37:20 2005
+++ wesnoth/src/widgets/scrollbar.hpp   Sun Aug 21 13:11:28 2005
@@ -1,4 +1,4 @@
-/* $Id: scrollbar.hpp,v 1.18 2005/07/02 21:37:20 ott Exp $ */
+/* $Id: scrollbar.hpp,v 1.19 2005/08/21 13:11:28 gruikya Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
                  2004 by Guillaume Melquiond <address@hidden>
@@ -63,6 +63,12 @@
        /// Return true if the scrollbar has a valid size.
        bool is_valid_height(int height) const;
 
+       /// Scrolls down one step
+       void scroll_down();
+
+       /// Scrolls up one step
+       void scroll_up();
+
 protected:
        virtual void update_location(SDL_Rect const &rect);
        virtual void handle_event(const SDL_Event& event);
@@ -83,7 +89,6 @@
        // Relative data
        int grip_position_, old_position_, grip_height_, full_height_, 
scroll_rate_;
 
-       friend class scrollarea;
 };
 
 }




reply via email to

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