]> git.lyx.org Git - lyx.git/blob - src/frontends/qt/GuiToc.cpp
No need (any longer?) to create a new view for lyxfiles-open
[lyx.git] / src / frontends / qt / GuiToc.cpp
1 /**
2  * \file GuiToc.cpp
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author John Levon
7  * \author Abdelrazak Younes
8  * \author Angus Leeming
9  *
10  * Full author contact details are available in file CREDITS.
11  */
12
13 #include <config.h>
14
15 #include "GuiToc.h"
16 #include "GuiView.h"
17 #include "TocWidget.h"
18 #include "qt_helpers.h"
19
20 #include "Buffer.h"
21 #include "BufferView.h"
22 #include "BufferParams.h"
23 #include "FuncRequest.h"
24
25 #include "support/debug.h"
26 #include "support/gettext.h"
27 #include "support/lassert.h"
28
29 using namespace std;
30
31 namespace lyx {
32 namespace frontend {
33
34 GuiToc::GuiToc(GuiView & parent, Qt::DockWidgetArea area, Qt::WindowFlags flags)
35         : DockView(parent, "toc", qt_("Outline"), area, flags),
36           widget_(new TocWidget(parent, this)),
37           is_closing_(false)
38 {
39         setWidget(widget_);
40         setFocusProxy(widget_);
41 }
42
43
44 void GuiToc::updateView()
45 {
46         widget_->updateView();
47 }
48
49
50 bool GuiToc::initialiseParams(string const & sdata)
51 {
52         widget_->init(toqstr(sdata));
53         return true;
54 }
55
56
57 void GuiToc::dispatchParams()
58 {
59 }
60
61
62 void GuiToc::enableView(bool enable)
63 {
64         if (!enable)
65                 // In the opposite case, updateView() will be called anyway.
66                 widget_->updateViewNow();
67 }
68
69
70 void GuiToc::closeEvent(QCloseEvent * /*event*/)
71 {
72         is_closing_ = true;
73         static_cast<GuiView *>(parent())->updateToolbars();
74         is_closing_ = false;
75 }
76
77
78 void GuiToc::doDispatch(Cursor & cur, FuncRequest const & cmd,
79                 DispatchResult & dr)
80 {
81         widget_->doDispatch(cur, cmd, dr);
82 }
83
84
85 bool GuiToc::getStatus(Cursor & cur, FuncRequest const & cmd,
86         FuncStatus & status) const
87 {
88         return widget_->getStatus(cur, cmd, status);
89 }
90
91
92 } // namespace frontend
93 } // namespace lyx
94
95 #include "moc_GuiToc.cpp"