Tooltips were not visible at lower resolutions.
This commit is contained in:
Bram Ridder 2005-07-20 06:27:11 +00:00
parent a65cfed035
commit 3a07ec23d7
3 changed files with 11 additions and 7 deletions

View File

@ -138,13 +138,20 @@ map_editor::map_editor(display &gui, gamemap &map, config &theme, config &game_c
*/
void map_editor::load_tooltips()
{
// Add tooltips to all buttons
// Clear all previous tooltips
tooltips::clear_tooltips();
// Add tooltips to all buttons
const theme &t = gui_.get_theme();
const std::vector<theme::menu> &menus = t.menus();
std::vector<theme::menu>::const_iterator it;
for (it = menus.begin(); it != menus.end(); it++) {
const SDL_Rect draw_rect = (*it).get_location();
// Get the button's screen location
SDL_Rect screen;
screen.x = 0; screen.y = 0; screen.w = gui_.x(); screen.h = gui_.y();
const SDL_Rect tooltip_rect = (*it).location(screen);
std::string text = "";
const std::vector<std::string> &menu_items = (*it).items();
@ -174,7 +181,7 @@ void map_editor::load_tooltips()
}
if(text != "")
tooltips::add_tooltip(draw_rect, text);
tooltips::add_tooltip(tooltip_rect, text);
}
}
@ -788,6 +795,7 @@ void map_editor::redraw_everything() {
update_l_button_palette();
palette_.draw(true);
brush_.draw(true);
load_tooltips();
}
void map_editor::highlight_selected_hexes(const bool clear_old) {

View File

@ -429,8 +429,6 @@ const std::string& theme::menu::image() const { return image_; }
const std::vector<std::string>& theme::menu::items() const { return items_; }
const SDL_Rect& theme::menu::get_location(void) const { return object::get_location(); }
theme::theme(const config& cfg, const SDL_Rect& screen):cfg_(resolve_rects(cfg)){
set_resolution(screen);
}

View File

@ -113,8 +113,6 @@ public:
const std::string& image() const;
const std::vector<std::string>& items() const;
const SDL_Rect& get_location(void) const;
private:
bool context_;
std::string title_, image_;