#include "FormBase.h"
#include "xformsBC.h"
#include "support/LAssert.h"
+#include "xforms_helpers.h" // formatted
#if FL_REVISION < 89
FormBase::FormBase(ControlButtons & c, string const & t, bool allowResize)
: ViewBC<xformsBC>(c), minw_(0), minh_(0), allow_resize_(allowResize),
- title_(t), warning_posted_(false)
+ title_(t), warning_posted_(false), tooltip_level_(VERBOSE_TOOLTIP)
{
#if FL_REVISION < 89
}
-void FormBase::setPrehandler(FL_OBJECT * ob)
+string const FormBase::getTooltip(FL_OBJECT * ob) const
{
lyx::Assert(ob);
- fl_set_object_prehandler(ob, C_FormBasePrehandler);
-}
+ switch (tooltip_level_) {
+ case VERBOSE_TOOLTIP:
+ {
+ string str = getVerboseTooltip(ob);
+ if (!str.empty())
+ return formatted(_(str), 400);
+ // else, fall through
+ }
+
+ case MINIMAL_TOOLTIP:
+ return getMinimalTooltip(ob);
+
+ case NO_TOOLTIP:
+ default:
+ return string();
+ }
+
+}
+
-void FormBase::setWarningPosted(bool warning)
+void FormBase::setTooltipLevel(TooltipLevel level)
{
- warning_posted_ = warning;
+ tooltip_level_ = level;
}
-#if FL_REVISION < 89
-
-string const FormBase::getTooltipCB(FL_OBJECT * ob)
+void FormBase::setPrehandler(FL_OBJECT * ob)
{
- return getTooltip(ob);
+ lyx::Assert(ob);
+ fl_set_object_prehandler(ob, C_FormBasePrehandler);
}
-#endif // FL_REVISION < 89
+
+void FormBase::setWarningPosted(bool warning)
+{
+ warning_posted_ = warning;
+}
namespace {
FL_OBJECT * ob = reinterpret_cast<FL_OBJECT*>(data);
lyx::Assert(ob && ob->form);
- string const help = GetForm(timer)->getTooltipCB(ob);
+ string const help = GetForm(timer)->getTooltip(ob);
if (help.empty())
return;