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