Add a register_text2 function.

The original version has an optional flag the new version a
mandatory flag. The latter feels better. At some point all register
functions need to be changed.
This commit is contained in:
Mark de Wever 2011-03-13 07:49:38 +00:00
parent 0a649850c6
commit 62ed384d10
2 changed files with 24 additions and 0 deletions

View file

@ -185,6 +185,24 @@ tfield_text* tdialog::register_text2(const std::string& id
return tdialog::register_text(id, !mandatory, linked_variable); return tdialog::register_text(id, !mandatory, linked_variable);
} }
tfield_text* tdialog::register_text2(const std::string& id
, const bool mandatory
, std::string (*callback_load_value) ()
, void (*callback_save_value) (const std::string& value)
, const bool capture_focus)
{
assert(!capture_focus || focus_.empty());
if(capture_focus) {
focus_ = id;
}
return tdialog::register_text(id
, !mandatory
, callback_load_value
, callback_save_value);
}
tfield_label* tdialog::register_label2(const std::string& id tfield_label* tdialog::register_label2(const std::string& id
, const bool mandatory , const bool mandatory
, const std::string& text , const std::string& text

View file

@ -298,6 +298,12 @@ protected:
, std::string& linked_variable , std::string& linked_variable
, const bool capture_focus = false); , const bool capture_focus = false);
tfield_text* register_text2(const std::string& id
, const bool mandatory
, std::string (*callback_load_value) () = NULL
, void (*callback_save_value) (const std::string& value) = NULL
, const bool capture_focus = false);
/** /**
* Registers a new control as a label. * Registers a new control as a label.
* *