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.
13 #include "BufferView.h"
16 #include "FuncStatus.h"
20 #include <boost/bind.hpp>
22 #include "frontends/LyXView.h"
23 #include "qt_helpers.h"
27 #include "support/lstrings.h"
38 int const statusbar_timer_value = 3000;
42 Action::Action(LyXView & lyxView, string const & text,
43 FuncRequest const & func, string const & tooltip)
44 : QAction(this), func_(func), lyxView_(lyxView)
46 setText(tr(toqstr(text)));
47 setToolTip(tr(toqstr(tooltip)));
48 setStatusTip(toqstr(tooltip));
49 connect(this, SIGNAL(triggered()), this, SLOT(action()));
50 this->setCheckable(true);
53 Action::Action(LyXView & lyxView, string const & icon, string const & text,
54 FuncRequest const & func, string const & tooltip)
55 : QAction(this), func_(func), lyxView_(lyxView)
57 setIcon(QPixmap(icon.c_str()));
58 setText(tr(toqstr(text)));
59 setToolTip(tr(toqstr(tooltip)));
60 setStatusTip(toqstr(tooltip));
61 connect(this, SIGNAL(triggered()), this, SLOT(action()));
62 this->setCheckable(true);
66 void Action::setAction(FuncRequest const & func)
74 FuncStatus const status = lyxView_.getLyXFunc().getStatus(func_);
76 this->setChecked(status.onoff(true));
77 this->setEnabled(status.enabled());
83 // lyxerr[Debug::ACTION] << "calling LyXFunc::dispatch: func_: " << func_ << endl;
85 lyxView_.getLyXFunc().dispatch(func_);
88 } // namespace frontend
91 #include "Action_moc.cpp"