]> git.lyx.org Git - lyx.git/blob - src/frontends/kde/tocdlg.C
Move LaTeX and VC logs to GUI-I on xforms
[lyx.git] / src / frontends / kde / tocdlg.C
1 /*
2  * tocdlg.C
3  * (C) 2000 LyX Team
4  * John Levon, moz@compsoc.man.ac.uk
5  */
6
7 /***************************************************************************
8  *                                                                       *
9  *   This program is free software; you can redistribute it and/or modify  *
10  *   it under the terms of the GNU General Public License as published by  *
11  *   the Free Software Foundation; either version 2 of the License, or     *
12  *   (at your option) any later version.                                   *
13  *                                                                       *
14  ***************************************************************************/
15
16 #include <config.h>
17 #include "tocdlg.h"
18
19 #include "dlg/helpers.h"
20
21 #ifdef CXX_WORKING_NAMESPACES
22 using kde_helpers::setSizeHint;
23 #endif
24
25 TocDialog::TocDialog(FormToc *form, QWidget *parent, const char *name, bool, WFlags)
26         : QWidget(parent,name,0), form_(form)
27 {
28         setCaption(name);
29         setMinimumWidth(350);
30
31         // widgets
32
33         menu = new QComboBox(this);
34         menu->insertItem(_("Table of Contents"));
35         menu->insertItem(_("List of Figures"));
36         menu->insertItem(_("List of Tables"));
37         menu->insertItem(_("List of Algorithms"));
38         setSizeHint(menu);
39
40         tree = new QListView(this);
41         tree->setMinimumHeight(200);
42         tree->setRootIsDecorated(true);
43         tree->setSorting(-1);
44         tree->addColumn("Table of Contents");
45
46         buttonUpdate = new QPushButton(this);
47         setSizeHint(buttonUpdate);
48         buttonUpdate->setMaximumSize(buttonUpdate->sizeHint());
49         buttonUpdate->setText(_("&Update"));
50
51         buttonClose = new QPushButton(this);
52         setSizeHint(buttonClose);
53         buttonClose->setMaximumSize(buttonClose->sizeHint());
54         buttonClose->setText(_("&Close"));
55         buttonClose->setDefault(true);
56
57         depth = new QSlider(0, 5, 1, 1, QSlider::Horizontal, this);
58         setSizeHint(depth);
59         depth->setTickInterval(1);
60         depth->setTracking(true);
61
62         depthlabel = new QLabel(this);
63         depthlabel->setText(_("Depth"));
64         setSizeHint(depthlabel);
65         depthlabel->setMaximumSize(depthlabel->sizeHint()); 
66  
67         // layouts
68
69         topLayout = new QHBoxLayout(this,10);
70
71         layout = new QVBoxLayout();
72         topLayout->addLayout(layout);
73         layout->addSpacing(10);
74
75         layout->addWidget(menu,0);
76         layout->addWidget(tree,1);
77         layout->addWidget(depthlabel,0,AlignLeft);
78         layout->addWidget(depth,0);
79
80         buttonLayout = new QHBoxLayout();
81
82         layout->addLayout(buttonLayout);
83         buttonLayout->addStretch(1);
84         buttonLayout->addWidget(buttonUpdate, 1);
85         buttonLayout->addStretch(2);
86         buttonLayout->addWidget(buttonClose, 1);
87         buttonLayout->addStretch(1);
88
89         // connections
90
91         connect(tree, SIGNAL(selectionChanged(QListViewItem *)), this, SLOT(select_adaptor(QListViewItem *)));
92         connect(menu, SIGNAL(activated(int)), this, SLOT(activate_adaptor(int)));
93         connect(buttonUpdate, SIGNAL(clicked()), this, SLOT(update_adaptor()));
94         connect(buttonClose, SIGNAL(clicked()), this, SLOT(close_adaptor()));
95         connect(depth, SIGNAL(valueChanged(int)), this, SLOT(depth_adaptor(int)));
96         
97         resize(sizeHint());
98 }
99
100 void TocDialog::closeEvent(QCloseEvent *e)
101 {
102         form_->close();
103         e->accept();
104 }
105
106 TocDialog::~TocDialog()
107 {
108 }