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.
15 #include "BufferView.h"
18 #include "FuncStatus.h"
21 #include "frontends/LyXView.h"
23 #include "qt_helpers.h"
25 #include "support/lstrings.h"
27 #include <boost/bind.hpp>
39 int const statusbar_timer_value = 3000;
43 Action::Action(LyXView & lyxView, string const & text,
44 FuncRequest const & func, string 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, string const & text,
55 FuncRequest const & func, string 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 = lyxView_.getLyXFunc().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_.getLyXFunc().dispatch(func_);
98 } // namespace frontend
101 #include "Action_moc.cpp"