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