From 543964eb3a5ba5c40424bb86464e418d2511675e Mon Sep 17 00:00:00 2001 From: Angus Leeming Date: Tue, 4 Mar 2003 13:54:05 +0000 Subject: [PATCH] Set the label on the FormText input widget from Dialogs3.C. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6335 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/xforms/ChangeLog | 7 +++++++ src/frontends/xforms/Dialogs3.C | 6 ++++-- src/frontends/xforms/FormText.C | 8 ++++++-- src/frontends/xforms/FormText.h | 5 ++++- 4 files changed, 21 insertions(+), 5 deletions(-) diff --git a/src/frontends/xforms/ChangeLog b/src/frontends/xforms/ChangeLog index d14a9721e8..52bf4b9c10 100644 --- a/src/frontends/xforms/ChangeLog +++ b/src/frontends/xforms/ChangeLog @@ -1,3 +1,10 @@ +2003-03-04 Angus Leeming + + * FormText.[Ch]: the label of the input widget is passed to the + FormText c-tor and used in the build method. + + * Dialogs3.C: pass an extra arg to the FormText c-tor. + 2003-02-28 Alfredo Braunstein * FormPreferences.C diff --git a/src/frontends/xforms/Dialogs3.C b/src/frontends/xforms/Dialogs3.C index 95499c0239..2482052a84 100644 --- a/src/frontends/xforms/Dialogs3.C +++ b/src/frontends/xforms/Dialogs3.C @@ -130,11 +130,13 @@ Dialog * Dialogs::build(string const & name) dialog->setButtonController(new NoRepeatedApplyReadOnlyBC); } else if (name == "index") { dialog->setController(new ControlIndex(*dialog)); - dialog->setView(new FormText(*dialog, _("Index"))); + dialog->setView(new FormText(*dialog, + _("Index"), _("Keyword:|#K"))); dialog->setButtonController(new NoRepeatedApplyReadOnlyBC); } else if (name == "label") { dialog->setController(new ControlLabel(*dialog)); - dialog->setView(new FormText(*dialog, _("Label"))); + dialog->setView(new FormText(*dialog, + _("Label"), _("Label:|#L"))); dialog->setButtonController(new NoRepeatedApplyReadOnlyBC); } else if (name == "ref") { dialog->setController(new ControlRef(*dialog)); diff --git a/src/frontends/xforms/FormText.C b/src/frontends/xforms/FormText.C index 29487d2184..868b9e7611 100644 --- a/src/frontends/xforms/FormText.C +++ b/src/frontends/xforms/FormText.C @@ -14,6 +14,7 @@ #include "ControlCommand.h" #include "FormText.h" #include "forms/form_text.h" +#include "forms_gettext.h" #include "support/lstrings.h" @@ -21,8 +22,8 @@ typedef FormController > base_class; -FormText::FormText(Dialog & parent, string const & title) - : base_class(parent, title) +FormText::FormText(Dialog & parent, string const & title, string const & label) + : base_class(parent, title), label_(label) {} @@ -33,6 +34,9 @@ void FormText::build() fl_set_input_return(dialog_->input_text, FL_RETURN_CHANGED); setPrehandler(dialog_->input_text); + fl_set_object_label(dialog_->input_text, idex(label_).c_str()); + fl_set_button_shortcut(dialog_->input_text, scex(label_).c_str(), 1); + // Manage the ok, apply, restore and cancel/close buttons bc().setOK(dialog_->button_ok); bc().setApply(dialog_->button_apply); diff --git a/src/frontends/xforms/FormText.h b/src/frontends/xforms/FormText.h index 94cd5b8f44..13ce31f33d 100644 --- a/src/frontends/xforms/FormText.h +++ b/src/frontends/xforms/FormText.h @@ -22,7 +22,7 @@ struct FD_text; class FormText : public FormController > { public: /// - FormText(Dialog &, string const & title); + FormText(Dialog &, string const & title, string const & label); private: /// Set the Params variable for the Controller. virtual void apply(); @@ -30,6 +30,9 @@ private: virtual void build(); /// Update dialog before/whilst showing it. virtual void update(); + + /// + string const label_; }; #endif // FORMTEXT_H