Author: ilor
Date: Tue Aug 12 13:37:02 2008
New Revision: 28481
URL: http://svn.gna.org/viewcvs/wesnoth?rev=28481&view=rev
Log:
Add an auto_tooltip feature in menus that will add a tooltip for one-item menus
with the auto_tooltip wml attribute bu taking the only item's hotkey
description.
Modified:
trunk/src/theme.cpp
Modified: trunk/src/theme.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/theme.cpp?rev=28481&r1=28480&r2=28481&view=diff
==============================================================================
--- trunk/src/theme.cpp (original)
+++ trunk/src/theme.cpp Tue Aug 12 13:37:02 2008
@@ -19,6 +19,7 @@
#include "config.hpp"
#include "font.hpp"
#include "gettext.hpp"
+#include "hotkeys.hpp"
#include "language.hpp"
#include "log.hpp"
#include "sdl_utils.hpp"
@@ -502,9 +503,13 @@
context_(utils::string_bool(cfg["is_context_menu"])),
title_(cfg["title"].str() +
cfg["title_literal"].str()),
tooltip_(cfg["tooltip"]),
- image_(cfg["image"]),
type_(cfg["type"]),
-
items_(utils::split(cfg["items"]))
-{}
+
image_(cfg["image"]), type_(cfg["type"]),
+
items_(utils::split(cfg["items"]))
+{
+ if (utils::string_bool(cfg["auto_tooltip"]) && tooltip_.empty() &&
items_.size() == 1) {
+ tooltip_ = hotkey::get_hotkey(items_[0]).get_description();
+ }
+}
theme::theme(const config& cfg, const SDL_Rect& screen) :
theme_reset_("theme_reset")
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits