]> git.lyx.org Git - lyx.git/blob - src/frontends/kde/formtocdialog.C
Applied John's KDE patch
[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 KTreeList(this,"tree");
34         tree->setMinimumHeight(200);
35
36         buttonUpdate = new QPushButton(this);
37         buttonUpdate->setMinimumSize(buttonUpdate->sizeHint());
38         buttonUpdate->setMaximumSize(buttonUpdate->sizeHint());
39         buttonUpdate->setText(_("&Update"));
40
41         buttonClose = new QPushButton(this);
42         buttonClose->setMinimumSize(buttonClose->sizeHint());
43         buttonClose->setMaximumSize(buttonClose->sizeHint());
44         buttonClose->setText(_("&Close"));
45         buttonClose->setDefault(true);
46
47         // layouts
48  
49         topLayout = new QHBoxLayout(this,10);
50
51         layout = new QVBoxLayout();
52         topLayout->addLayout(layout);
53         layout->addSpacing(10);
54
55         layout->addWidget(menu,0);
56         layout->addWidget(tree,1);
57
58         buttonLayout = new QHBoxLayout();
59
60         layout->addLayout(buttonLayout);
61         buttonLayout->addStretch(1);
62         buttonLayout->addWidget(buttonUpdate, 1);
63         buttonLayout->addStretch(2);
64         buttonLayout->addWidget(buttonClose, 1);
65         buttonLayout->addStretch(1);
66
67         // connections
68
69         connect(tree, SIGNAL(highlighted(int)), this, SLOT(highlight_adaptor(int)));
70         connect(menu, SIGNAL(activated(int)), this, SLOT(activate_adaptor(int))); 
71         connect(buttonUpdate, SIGNAL(clicked()), this, SLOT(update_adaptor())); 
72         connect(buttonClose, SIGNAL(clicked()), this, SLOT(close_adaptor()));
73 }
74
75 void FormTocDialog::closeEvent(QCloseEvent *e)
76 {
77         form_->close();
78         e->accept();
79 }
80
81 FormTocDialog::~FormTocDialog()
82 {
83 }