3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
6 * \author Abdelrazak Younes
8 * Full author contact details are available in file CREDITS.
17 #include "FuncStatus.h"
20 #include "frontends/LyXView.h"
22 #include "qt_helpers.h"
24 #include "support/lstrings.h"
26 #include <boost/bind.hpp>
39 int const statusbar_timer_value = 3000;
43 Action::Action(LyXView & lyxView, docstring const & text,
44 FuncRequest const & func, docstring const & tooltip)
45 : QAction(this), func_(func), lyxView_(lyxView)
47 setText(toqstr(text));
48 setToolTip(toqstr(tooltip));
49 setStatusTip(toqstr(tooltip));
50 connect(this, SIGNAL(triggered()), this, SLOT(action()));
54 Action::Action(LyXView & lyxView, string const & icon, docstring const & text,
55 FuncRequest const & func, docstring const & tooltip)
56 : QAction(this), func_(func), lyxView_(lyxView)
58 setIcon(QPixmap(icon.c_str()));
59 setText(toqstr(text));
60 setToolTip(toqstr(tooltip));
61 setStatusTip(toqstr(tooltip));
62 connect(this, SIGNAL(triggered()), this, SLOT(action()));
67 void Action::setAction(FuncRequest const & func)
75 FuncStatus const status = lyx::getStatus(func_);
77 if (status.onoff(true)) {
80 } else if (status.onoff(false)) {
87 setEnabled(status.enabled());
93 // lyxerr[Debug::ACTION] << "calling LyXFunc::dispatch: func_: " << func_ << endl;
95 lyxView_.dispatch(func_);
98 } // namespace frontend
101 #include "Action_moc.cpp"