Author: mordante
Date: Tue Sep 2 20:04:22 2008
New Revision: 29203
URL: http://svn.gna.org/viewcvs/wesnoth?rev=29203&view=rev
Log:
When using the arrows make sure the selected item remains visible.
Modified:
trunk/src/gui/widgets/listbox.cpp
Modified: trunk/src/gui/widgets/listbox.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/widgets/listbox.cpp?rev=29203&r1=29202&r2=29203&view=diff
==============================================================================
--- trunk/src/gui/widgets/listbox.cpp (original)
+++ trunk/src/gui/widgets/listbox.cpp Tue Sep 2 20:04:22 2008
@@ -262,6 +262,7 @@
* moving out of visible range we don't scroll down and possibly more
minor
* glitches exist in this hack.
*/
+ tscrollbar_* sb = scrollbar();
switch(key) {
case SDLK_UP : {
@@ -273,6 +274,11 @@
if(i >= 0) {
select_row(i);
handled = true;
+
+ if(i < sb->get_item_position()) {
+ sb->set_item_position(i);
+ set_scrollbar_button_status();
+ }
}
break;
}
@@ -286,6 +292,11 @@
if(i < rows_.size()) {
select_row(i);
handled = true;
+ if(i >= sb->get_item_position() +
sb->get_visible_items()) {
+
+ sb->set_item_position(i + 1 -
sb->get_visible_items());
+ set_scrollbar_button_status();
+ }
}
break;
}
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits