3 * Copyright 2001 the LyX Team
4 * Read the file COPYING
12 #include "dlg/helpers.h"
14 using kde_helpers::setSizeHint;
16 TocDialog::TocDialog(FormToc * form, QWidget * parent, char const * name, bool, WFlags)
17 : QDialog(parent,name,0), form_(form)
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"));
31 tree = new QListView(this);
32 tree->setMinimumHeight(200);
33 tree->setRootIsDecorated(true);
35 tree->addColumn("Table of Contents");
37 buttonUpdate = new QPushButton(this);
38 setSizeHint(buttonUpdate);
39 buttonUpdate->setMaximumSize(buttonUpdate->sizeHint());
40 buttonUpdate->setText(_("&Update"));
42 buttonClose = new QPushButton(this);
43 setSizeHint(buttonClose);
44 buttonClose->setMaximumSize(buttonClose->sizeHint());
45 buttonClose->setText(_("&Close"));
46 buttonClose->setDefault(true);
48 depth = new QSlider(0, 5, 1, 1, QSlider::Horizontal, this);
50 depth->setTickInterval(1);
51 depth->setTracking(true);
53 depthlabel = new QLabel(this);
54 depthlabel->setText(_("Depth"));
55 setSizeHint(depthlabel);
56 depthlabel->setMaximumSize(depthlabel->sizeHint());
60 topLayout = new QHBoxLayout(this,10);
62 layout = new QVBoxLayout();
63 topLayout->addLayout(layout);
64 layout->addSpacing(10);
66 layout->addWidget(menu,0);
67 layout->addWidget(tree,1);
68 layout->addWidget(depthlabel,0,AlignLeft);
69 layout->addWidget(depth,0);
71 buttonLayout = new QHBoxLayout();
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);
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)));
92 void TocDialog::closeEvent(QCloseEvent * e)
99 TocDialog::~TocDialog()