]> git.lyx.org Git - lyx.git/blob - src/frontends/kde/formtocdialog.C
A few tweaks needed by cxx
[lyx.git] / src / frontends / kde / formtocdialog.C
1 /*
2  * formtocdialog.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 "formtocdialog.h"
17
18 FormTocDialog::FormTocDialog(FormToc *form, QWidget *parent, const char *name, bool, WFlags)
19         : QDialog(parent,name,false), 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         menu->setMinimumSize(menu->sizeHint()); 
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         buttonUpdate->setMinimumSize(buttonUpdate->sizeHint());
41         buttonUpdate->setMaximumSize(buttonUpdate->sizeHint());
42         buttonUpdate->setText(_("&Update"));
43
44         buttonClose = new QPushButton(this);
45         buttonClose->setMinimumSize(buttonClose->sizeHint());
46         buttonClose->setMaximumSize(buttonClose->sizeHint());
47         buttonClose->setText(_("&Close"));
48         buttonClose->setDefault(true);
49
50         // layouts
51  
52         topLayout = new QHBoxLayout(this,10);
53
54         layout = new QVBoxLayout();
55         topLayout->addLayout(layout);
56         layout->addSpacing(10);
57
58         layout->addWidget(menu,0);
59         layout->addWidget(tree,1);
60
61         buttonLayout = new QHBoxLayout();
62
63         layout->addLayout(buttonLayout);
64         buttonLayout->addStretch(1);
65         buttonLayout->addWidget(buttonUpdate, 1);
66         buttonLayout->addStretch(2);
67         buttonLayout->addWidget(buttonClose, 1);
68         buttonLayout->addStretch(1);
69
70         // connections
71
72         connect(tree, SIGNAL(selectionChanged(QListViewItem *)), this, SLOT(select_adaptor(QListViewItem *)));
73         connect(menu, SIGNAL(activated(int)), this, SLOT(activate_adaptor(int))); 
74         connect(buttonUpdate, SIGNAL(clicked()), this, SLOT(update_adaptor())); 
75         connect(buttonClose, SIGNAL(clicked()), this, SLOT(close_adaptor()));
76 }
77
78 void FormTocDialog::closeEvent(QCloseEvent *e)
79 {
80         form_->close();
81         e->accept();
82 }
83
84 FormTocDialog::~FormTocDialog()
85 {
86 }