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