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>
37 Action::Action(GuiView & lyxView, docstring const & text,
38 FuncRequest const & func, docstring const & tooltip)
39 : QAction(&lyxView), func_(func), lyxView_(lyxView)
41 #if QT_VERSION >= 0x040200
42 // only Qt/Mac handles that
45 setText(toqstr(text));
46 setToolTip(toqstr(tooltip));
47 setStatusTip(toqstr(tooltip));
48 connect(this, SIGNAL(triggered()), this, SLOT(action()));
52 Action::Action(GuiView & lyxView, string const & icon, docstring const & text,
53 FuncRequest const & func, docstring const & tooltip)
54 : QAction(&lyxView), func_(func), lyxView_(lyxView)
56 setIcon(QPixmap(icon.c_str()));
57 setText(toqstr(text));
58 setToolTip(toqstr(tooltip));
59 setStatusTip(toqstr(tooltip));
60 connect(this, SIGNAL(triggered()), this, SLOT(action()));
65 void Action::setAction(FuncRequest const & func)
73 FuncStatus const status = lyx::getStatus(func_);
75 if (status.onoff(true)) {
78 } else if (status.onoff(false)) {
85 setEnabled(status.enabled());
91 // lyxerr[Debug::ACTION] << "calling LyXFunc::dispatch: func_: " << func_ << endl;
93 lyxView_.dispatch(func_);
96 } // namespace frontend
99 #include "Action_moc.cpp"