[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Wesnoth-cvs-commits] wesnoth/src/widgets menu.cpp
From: |
Guillaume Melquiond |
Subject: |
[Wesnoth-cvs-commits] wesnoth/src/widgets menu.cpp |
Date: |
Sat, 06 Nov 2004 15:32:36 -0500 |
CVSROOT: /cvsroot/wesnoth
Module name: wesnoth
Branch:
Changes by: Guillaume Melquiond <address@hidden> 04/11/06 20:26:14
Modified files:
src/widgets : menu.cpp
Log message:
Avoid the downsizing of the menus.
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/menu.cpp.diff?tr1=1.71&tr2=1.72&r1=text&r2=text
Patches:
Index: wesnoth/src/widgets/menu.cpp
diff -u wesnoth/src/widgets/menu.cpp:1.71 wesnoth/src/widgets/menu.cpp:1.72
--- wesnoth/src/widgets/menu.cpp:1.71 Sat Nov 6 20:13:05 2004
+++ wesnoth/src/widgets/menu.cpp Sat Nov 6 20:26:14 2004
@@ -86,23 +86,25 @@
}
void menu::update_size() {
- SDL_Rect rect = location();
+ unsigned h = 0;
for(size_t i = get_position(),
i_end = minimum(items_.size(), i + max_items_onscreen());
i != i_end; ++i)
- rect.h += get_item_rect(i).h;
- if (max_height_ > 0 && rect.h > max_height_)
- rect.h = max_height_;
+ h += get_item_rect(i).h;
+ h = maximum(h, height());
+ if (max_height_ > 0 && h > max_height_)
+ h = max_height_;
std::vector<int> const &widths = column_widths();
- rect.w = std::accumulate(widths.begin(), widths.end(), 0);
+ unsigned w = std::accumulate(widths.begin(), widths.end(), 0);
if (items_.size() > max_items_onscreen())
- rect.w += scrollbar_width();
- if (max_width_ > 0 && rect.w > max_width_)
- rect.w = max_width_;
+ w += scrollbar_width();
+ w = maximum(w, width());
+ if (max_width_ > 0 && w > max_width_)
+ w = max_width_;
update_scrollbar_grip_height();
- set_location(rect);
+ set_measurements(w, h);
}
int menu::selection() const { return selected_; }