]> git.lyx.org Git - lyx.git/blob - src/frontends/kde/tocdlg.h
e21b0d806467ce6c3d3ac61f27de6a265f790f9c
[lyx.git] / src / frontends / kde / tocdlg.h
1 /*
2  * tocdlg.h
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 #ifndef TOCDLG_H
17 #define TOCDLG_H
18
19 #include <config.h>
20 #include <gettext.h>
21
22 #include <debug.h>
23 #include <qlabel.h> 
24 #include <qdialog.h>
25 #include <qlayout.h>
26 #include <qpushbutton.h>
27 #include <qcombobox.h>
28 #include <qlistview.h>
29 #include <qslider.h>
30
31 #include "FormToc.h"
32
33 class TocDialog : public QWidget {
34    Q_OBJECT
35 public:
36         TocDialog(FormToc *form, QWidget *parent=0, const char *name=0,
37                             bool modal=false, WFlags f=0);
38         ~TocDialog();
39
40         // widgets
41
42         QComboBox *menu;
43         QListView *tree;
44         QPushButton *buttonUpdate;
45         QPushButton *buttonClose;
46         QSlider *depth;
47         QLabel *depthlabel; 
48
49 protected:
50         void closeEvent(QCloseEvent *e);
51
52 private:
53         FormToc *form_;
54
55         // layouts 
56
57         QHBoxLayout *topLayout;
58         QVBoxLayout *layout;
59         QHBoxLayout *buttonLayout;
60
61 private slots:
62         /// adaptor to FormToc::select
63         void select_adaptor(QListViewItem *item) {
64                 form_->select(item->text(0));
65         }
66
67         /// adaptor to FormToc::set_depth
68         void depth_adaptor(int depth) {
69                 form_->set_depth(depth);
70         }
71
72         /// adaptor to FormToc::update
73         void update_adaptor(void) {
74                 form_->update();
75         }
76
77         // adaptors to FormToc::set_type
78         void activate_adaptor(int index) {
79                 switch (index) {
80                         case 0:
81                                 form_->set_type(Buffer::TOC_TOC);
82                                 break;
83                         case 1:
84                                 form_->set_type(Buffer::TOC_LOF);
85                                 break;
86                         case 2:
87                                 form_->set_type(Buffer::TOC_LOT);
88                                 break;
89                         case 3:
90                                 form_->set_type(Buffer::TOC_LOA);
91                                 break;
92                         default:
93                                 lyxerr[Debug::GUI] << "Unknown TOC combo selection." << std::endl;
94                                 break;
95                 }
96         }
97
98         /// adaptor to FormToc::close
99         void close_adaptor(void) {
100                 form_->close();
101                 hide();
102         }
103 };
104
105 #endif