mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-04 09:30:19 +00:00
parent
a65cfed035
commit
3a07ec23d7
@ -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) {
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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_;
|
||||
|
Loading…
x
Reference in New Issue
Block a user