mail[Wesnoth-commits] r40185 - in /trunk/src/gui: dialogs/lobby_main.cpp widgets/scrollbar_container.cpp widgets/scrollbar_container.hpp


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by kailoran on December 11, 2009 - 01:59:
Author: ilor
Date: Fri Dec 11 01:59:22 2009
New Revision: 40185

URL: http://svn.gna.org/viewcvs/wesnoth?rev=40185&view=rev
Log:
Partial fix for bug #14741 (chat log scrolling to top on message added). Will 
now scroll to bottom which is a less dumb thing to do.

Added a tscrollbar_container::scroll_to_vertical_end() member function in gui 
as I couldn't find a way to change the scroll position from within dialog 
code.

Modified:
    trunk/src/gui/dialogs/lobby_main.cpp
    trunk/src/gui/widgets/scrollbar_container.cpp
    trunk/src/gui/widgets/scrollbar_container.hpp

Modified: trunk/src/gui/dialogs/lobby_main.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/dialogs/lobby_main.cpp?rev=40185&r1=40184&r2=40185&view=diff
==============================================================================
--- trunk/src/gui/dialogs/lobby_main.cpp (original)
+++ trunk/src/gui/dialogs/lobby_main.cpp Fri Dec 11 01:59:22 2009
@@ -25,6 +25,7 @@
 #include "gui/widgets/listbox.hpp"
 #include "gui/widgets/minimap.hpp"
 #include "gui/widgets/multi_page.hpp"
+#include "gui/widgets/scroll_label.hpp"
 #include "gui/widgets/text_box.hpp"
 #include "gui/widgets/toggle_button.hpp"
 #include "gui/widgets/toggle_panel.hpp"
@@ -247,8 +248,9 @@
 void tlobby_main::append_to_chatbox(const std::string& text, size_t id)
 {
        tgrid& grid = chat_log_container_->page_grid(id);
-       tcontrol& log = find_widget<tcontrol>(&grid, "log_text", false);
+       tscroll_label& log = find_widget<tscroll_label>(&grid, "log_text", 
false);
        log.set_label(log.label() + "\n" + 
preferences::get_chat_timestamp(time(0)) + text);
+       log.scroll_to_vertical_end();
 }
 
 void tlobby_main::do_notify(t_notify_mode mode)

Modified: trunk/src/gui/widgets/scrollbar_container.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/widgets/scrollbar_container.cpp?rev=40185&r1=40184&r2=40185&view=diff
==============================================================================
--- trunk/src/gui/widgets/scrollbar_container.cpp (original)
+++ trunk/src/gui/widgets/scrollbar_container.cpp Fri Dec 11 01:59:22 2009
@@ -754,6 +754,12 @@
        }
 }
 
+void tscrollbar_container::scroll_to_vertical_end()
+{
+       vertical_scrollbar_->scroll(tscrollbar_::END);
+       scrollbar_moved();
+}
+
 void tscrollbar_container::handle_key_home(SDLMod /*modifier*/, bool& 
handled)
 {
        assert(vertical_scrollbar_ && horizontal_scrollbar_);

Modified: trunk/src/gui/widgets/scrollbar_container.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/widgets/scrollbar_container.hpp?rev=40185&r1=40184&r2=40185&view=diff
==============================================================================
--- trunk/src/gui/widgets/scrollbar_container.hpp (original)
+++ trunk/src/gui/widgets/scrollbar_container.hpp Fri Dec 11 01:59:22 2009
@@ -157,6 +157,8 @@
        const SDL_Rect& content_visible_area() const
                { return content_visible_area_; }
 
+       void scroll_to_vertical_end();
+
        /**
         * Callback when the scrollbar moves (NOTE maybe only one callback 
needed).
         * Maybe also make protected or private and add a friend.




Related Messages


Powered by MHonArc, Updated Fri Dec 11 03:00:07 2009