]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/TocWidget.h
2516e3d046f3cbbd24ebeb47b003b6d02757a804
[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 <QWidget>
19
20 namespace lyx {
21 namespace frontend {
22
23 class QToc;
24
25 class TocWidget : public QWidget, public Ui::QTocUi {
26         Q_OBJECT
27 public:
28         TocWidget(QToc * form, QWidget * parent = 0);
29
30         /// Update the display of the dialog whilst it is still visible.
31         void update();
32
33 protected Q_SLOTS:
34         /// Update Gui of the display.
35         void updateGui();
36         ///
37         void setTocModel(size_t type);
38         ///
39         void select(QModelIndex const & index);
40         ///
41         void selectionChanged(const QModelIndex & current,
42                 const QModelIndex & previous);
43
44         void on_updateTB_clicked();
45         void on_depthSL_valueChanged(int depth);
46         void on_typeCO_currentIndexChanged(int value);
47         void on_moveUpTB_clicked();
48         void on_moveDownTB_clicked();
49         void on_moveInTB_clicked();
50         void on_moveOutTB_clicked();
51
52 protected:
53         ///
54         void enableControls(bool enable = true);
55         ///
56         int getIndexDepth(QModelIndex const & index, int depth = -1);
57         ///
58         void setTreeDepth(int depth);
59
60 private:
61         /// Reconnects the selection model change signal when TOC changed.
62         void reconnectSelectionModel();
63         /// Disconnects the selection model.
64         //This is a workaround for a problem of signals blocking.
65         void disconnectSelectionModel();
66
67         QToc * form_;
68
69         /// depth of list shown
70         int depth_;
71 };
72
73 } // namespace frontend
74 } // namespace lyx
75
76 #endif // TOC_WIDGET_H