Author: mordante
Date: Sun Jul 31 18:56:18 2011
New Revision: 50510
URL: http://svn.gna.org/viewcvs/wesnoth?rev=50510&view=rev
Log:
Add the can_focus logic to register_text.
This allows us to deprecate and remove register_text2 later.
Modified:
trunk/src/gui/dialogs/dialog.cpp
trunk/src/gui/dialogs/dialog.hpp
Modified: trunk/src/gui/dialogs/dialog.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/dialogs/dialog.cpp?rev=50510&r1=50509&r2=50510&view=diff
==============================================================================
--- trunk/src/gui/dialogs/dialog.cpp (original)
+++ trunk/src/gui/dialogs/dialog.cpp Sun Jul 31 18:56:18 2011
@@ -136,7 +136,8 @@
const std::string& id
, const bool mandatory
, std::string (*callback_load_value) ()
- , void (*callback_save_value) (const std::string& value))
+ , void (*callback_save_value) (const std::string& value)
+ , const bool capture_focus)
{
tfield_text* field = new tfield_text(
id
@@ -144,18 +145,27 @@
, callback_load_value
, callback_save_value);
+ if(capture_focus) {
+ focus_ = id;
+ }
+
fields_.push_back(field);
return field;
}
tfield_text* tdialog::register_text(const std::string& id
, const bool mandatory
- , std::string& linked_variable)
+ , std::string& linked_variable
+ , const bool capture_focus)
{
tfield_text* field = new tfield_text(
id
, mandatory
, linked_variable);
+
+ if(capture_focus) {
+ focus_ = id;
+ }
fields_.push_back(field);
return field;
Modified: trunk/src/gui/dialogs/dialog.hpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/dialogs/dialog.hpp?rev=50510&r1=50509&r2=50510&view=diff
==============================================================================
--- trunk/src/gui/dialogs/dialog.hpp (original)
+++ trunk/src/gui/dialogs/dialog.hpp Sun Jul 31 18:56:18 2011
@@ -241,7 +241,8 @@
tfield_text* register_text(const std::string& id
, const bool mandatory
, std::string (*callback_load_value) () = NULL
- , void (*callback_save_value) (const std::string&
value) = NULL);
+ , void (*callback_save_value) (const std::string&
value) = NULL
+ , const bool capture_focus = false);
/**
* Creates a new text field.
@@ -250,7 +251,8 @@
*/
tfield_text* register_text(const std::string& id
, const bool mandatory
- , std::string& linked_variable);
+ , std::string& linked_variable
+ , const bool capture_focus = false);
/**
* Creates a new text field.
@@ -264,6 +266,8 @@
*
* @todo Convert more functions to this new style once done drop the 2
from
* the function name.
+ *
+ * @deprecated Use @ref register_text instead.
*
* @param id Id of the widget, same value as in WML.
* @param mandatory Is the widget mandatory or optional.
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits