lyx_mirror/src/frontends/xforms/FormBibitem.C

67 lines
1.4 KiB
C++
Raw Normal View History

/**
* \file FormBibitem.C
* Copyright 2001 the LyX Team
* Read the file COPYING
*
* \author Angus Leeming
* \author John Levon
*/
#ifdef __GNUG__
#pragma implementation
#endif
#include <config.h>
#include "ControlBibitem.h"
#include "FormBibitem.h"
#include "gettext.h"
#include "xformsBC.h"
#include "support/lstrings.h" // compare
FormBibitem::FormBibitem(ControlBibitem & c)
: FormBase2<ControlBibitem, FD_form_bibitem>(c, _("Bibliography Entry"))
{}
void FormBibitem::build()
{
dialog_.reset(build_bibitem());
fl_set_input_return(dialog_->key, FL_RETURN_CHANGED);
fl_set_input_return(dialog_->label, FL_RETURN_CHANGED);
// Manage the ok, apply, restore and cancel/close buttons
bc().setOK(dialog_->button_ok);
bc().setCancel(dialog_->button_cancel);
bc().refresh();
bc().addReadOnly(dialog_->key);
bc().addReadOnly(dialog_->label);
}
ButtonPolicy::SMInput FormBibitem::input(FL_OBJECT *, long)
{
// minimal validation
if (!compare(fl_get_input(dialog_->key), ""))
return ButtonPolicy::SMI_NOOP;
return ButtonPolicy::SMI_VALID;
}
void FormBibitem::update()
{
fl_set_input(dialog_->key,
controller().params().getContents().c_str());
fl_set_input(dialog_->label,
controller().params().getOptions().c_str());
}
void FormBibitem::apply()
{
controller().params().setContents(fl_get_input(dialog_->key));
controller().params().setOptions(fl_get_input(dialog_->label));
}