]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/TocWidget.h
7c7ca3f0e33b2265afe7306313aa7be64c7351b7
[lyx.git] / src / frontends / qt4 / TocWidget.h
1 // -*- C++ -*-
2 /**
3  * \file TocWidget.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author John Levon
8  * \author Abdelrazak Younes
9  *
10  * Full author contact details are available in file CREDITS.
11  */
12
13 #ifndef TOC_WIDGET_H
14 #define TOC_WIDGET_H
15
16 #include "ui_TocUi.h"
17
18 #include "Cursor.h"
19
20 #include <QWidget>
21
22 class QModelIndex;
23 class QString;
24
25 namespace lyx {
26 namespace frontend {
27
28 class GuiView;
29
30 class TocWidget : public QWidget, public Ui::TocUi
31 {
32         Q_OBJECT
33 public:
34         ///
35         TocWidget(GuiView & gui_view, QWidget * parent = 0);
36
37         /// Initialise GUI.
38         void init(QString const & str);
39         ///
40         void doDispatch(Cursor & cur, FuncRequest const & fr);
41         ///
42         bool getStatus(Cursor & cur, FuncRequest const & fr, FuncStatus & status)
43                 const;
44
45 public Q_SLOTS:
46         /// Update the display of the dialog whilst it is still visible.
47         void updateView();
48
49 protected Q_SLOTS:
50         ///
51         void select(QModelIndex const & index);
52         ///
53         void goTo(QModelIndex const &);
54
55         void on_tocTV_activated(QModelIndex const &);
56         void on_tocTV_pressed(QModelIndex const &);
57         void on_updateTB_clicked();
58         void on_sortCB_stateChanged(int state);
59         void on_persistentCB_stateChanged(int state);
60         void on_depthSL_valueChanged(int depth);
61         void on_typeCO_currentIndexChanged(int value);
62         void on_moveUpTB_clicked();
63         void on_moveDownTB_clicked();
64         void on_moveInTB_clicked();
65         void on_moveOutTB_clicked();
66         void filterContents();
67
68         void showContextMenu(const QPoint & pos);
69
70 private:
71         ///
72         void enableControls(bool enable = true);
73         ///
74         void setTreeDepth(int depth);
75         ///
76         void outline(int func_code);
77         /// finds the inset that is connected to the current item,
78         /// if any, otherwise return null
79         Inset * itemInset() const;
80         ///
81         QString current_type_;
82
83         /// depth of list shown
84         int depth_;
85         /// persistence of uncollapsed nodes in toc view
86         bool persistent_;
87         ///
88         GuiView & gui_view_;
89 };
90
91 } // namespace frontend
92 } // namespace lyx
93
94 #endif // TOC_WIDGET_H