]> git.lyx.org Git - lyx.git/blob - src/frontends/kde/tocdlg.C
implement getLabelList
[lyx.git] / src / frontends / kde / tocdlg.C
1 /**
2  * \file tocdlg.C
3  * Copyright 2001 the LyX Team
4  * Read the file COPYING
5  *
6  * \author John Levon
7  */
8
9 #include <config.h>
10 #include "tocdlg.h"
11
12 #include "dlg/helpers.h"
13
14 using kde_helpers::setSizeHint;
15
16 TocDialog::TocDialog(FormToc * form, QWidget * parent, char const * name, bool, WFlags)
17         : QDialog(parent,name,0), form_(form)
18 {
19         setCaption(name);
20         setMinimumWidth(350);
21
22         // widgets
23
24         menu = new QComboBox(this);
25         menu->insertItem(_("Table of Contents"));
26         menu->insertItem(_("List of Figures"));
27         menu->insertItem(_("List of Tables"));
28         menu->insertItem(_("List of Algorithms"));
29         setSizeHint(menu);
30
31         tree = new QListView(this);
32         tree->setMinimumHeight(200);
33         tree->setRootIsDecorated(true);
34         tree->setSorting(-1);
35         tree->addColumn("Table of Contents");
36
37         buttonUpdate = new QPushButton(this);
38         setSizeHint(buttonUpdate);
39         buttonUpdate->setMaximumSize(buttonUpdate->sizeHint());
40         buttonUpdate->setText(_("&Update"));
41
42         buttonClose = new QPushButton(this);
43         setSizeHint(buttonClose);
44         buttonClose->setMaximumSize(buttonClose->sizeHint());
45         buttonClose->setText(_("&Close"));
46         buttonClose->setDefault(true);
47
48         depth = new QSlider(0, 5, 1, 1, QSlider::Horizontal, this);
49         setSizeHint(depth);
50         depth->setTickInterval(1);
51         depth->setTracking(true);
52
53         depthlabel = new QLabel(this);
54         depthlabel->setText(_("Depth"));
55         setSizeHint(depthlabel);
56         depthlabel->setMaximumSize(depthlabel->sizeHint()); 
57  
58         // layouts
59
60         topLayout = new QHBoxLayout(this,10);
61
62         layout = new QVBoxLayout();
63         topLayout->addLayout(layout);
64         layout->addSpacing(10);
65
66         layout->addWidget(menu,0);
67         layout->addWidget(tree,1);
68         layout->addWidget(depthlabel,0,AlignLeft);
69         layout->addWidget(depth,0);
70
71         buttonLayout = new QHBoxLayout();
72
73         layout->addLayout(buttonLayout);
74         buttonLayout->addStretch(1);
75         buttonLayout->addWidget(buttonUpdate, 1);
76         buttonLayout->addStretch(2);
77         buttonLayout->addWidget(buttonClose, 1);
78         buttonLayout->addStretch(1);
79
80         // connections
81
82         connect(tree, SIGNAL(selectionChanged(QListViewItem *)), this, SLOT(select_adaptor(QListViewItem *)));
83         connect(menu, SIGNAL(activated(int)), this, SLOT(activate_adaptor(int)));
84         connect(buttonUpdate, SIGNAL(clicked()), this, SLOT(update_adaptor()));
85         connect(buttonClose, SIGNAL(clicked()), this, SLOT(close_adaptor()));
86         connect(depth, SIGNAL(valueChanged(int)), this, SLOT(depth_adaptor(int)));
87         
88         resize(sizeHint());
89 }
90
91
92 void TocDialog::closeEvent(QCloseEvent * e)
93 {
94         form_->close();
95         e->accept();
96 }
97
98
99 TocDialog::~TocDialog()
100 {
101 }