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.
16 #include "qt_helpers.h"
20 #include "FuncStatus.h"
23 #include "support/lstrings.h"
25 #include <boost/bind.hpp>
34 Action::Action(GuiView & lyxView, docstring const & text,
35 FuncRequest const & func, docstring const & tooltip)
36 : QAction(&lyxView), func_(func), lyxView_(lyxView)
38 #if QT_VERSION >= 0x040200
39 // only Qt/Mac handles that
42 setText(toqstr(text));
43 setToolTip(toqstr(tooltip));
44 setStatusTip(toqstr(tooltip));
45 connect(this, SIGNAL(triggered()), this, SLOT(action()));
49 Action::Action(GuiView & lyxView, string const & icon, docstring const & text,
50 FuncRequest const & func, docstring const & tooltip)
51 : QAction(&lyxView), func_(func), lyxView_(lyxView)
53 setIcon(QPixmap(icon.c_str()));
54 setText(toqstr(text));
55 setToolTip(toqstr(tooltip));
56 setStatusTip(toqstr(tooltip));
57 connect(this, SIGNAL(triggered()), this, SLOT(action()));
62 void Action::setAction(FuncRequest const & func)
70 FuncStatus const status = getStatus(func_);
72 if (status.onoff(true)) {
75 } else if (status.onoff(false)) {
82 setEnabled(status.enabled());
88 // LYXERR(Debug::ACTION) << "calling LyXFunc::dispatch: func_: " << func_ << endl;
90 lyxView_.dispatch(func_);
94 } // namespace frontend
97 #include "Action_moc.cpp"