]> git.lyx.org Git - lyx.git/blob - src/frontends/qt2/FormTocDialog.C
implement getLabelList
[lyx.git] / src / frontends / qt2 / FormTocDialog.C
1 #include <config.h>
2 #include <debug.h>
3 #include "FormTocDialog.h"
4 #include "Dialogs.h"
5 #include "FormToc.h"
6
7 #include <qlistview.h>
8
9 /* 
10  *  Constructs a FormTocDialog which is a child of 'parent', with the 
11  *  name 'name' and widget flags set to 'f' 
12  *
13  *  The dialog will by default be modeless, unless you set 'modal' to
14  *  TRUE to construct a modal dialog.
15  */
16 FormTocDialog::FormTocDialog( FormToc* form_, QWidget* parent,  const char* name, bool modal, WFlags fl )
17   : FormTocDialogBase( parent, name, modal, fl ),
18     form( form_ )
19 {
20 }
21
22 /*  
23  *  Destroys the object and frees any allocated resources
24  */
25 FormTocDialog::~FormTocDialog()
26 {
27     // no need to delete child widgets, Qt does it all for us
28 }
29
30 /* 
31  * public slot
32  */
33 void FormTocDialog::activate_adaptor(int index)
34 {
35   switch (index) {
36   case 0:
37     form->set_type(Buffer::TOC_TOC);
38     break;
39   case 1:
40     form->set_type(Buffer::TOC_LOF);
41     break;
42   case 2:
43     form->set_type(Buffer::TOC_LOT);
44     break;
45   case 3:
46     form->set_type(Buffer::TOC_LOA);
47     break;
48   default:
49     lyxerr[Debug::GUI] << "Unknown TOC combo selection." << std::endl;
50     break;
51   }
52 }
53 /* 
54  * public slot
55  */
56 void FormTocDialog::close_adaptor()
57 {
58   form->close();
59   hide();
60 }
61 /* 
62  * public slot
63  */
64 void FormTocDialog::depth_adaptor(int depth)
65 {
66   form->set_depth(depth);
67 }
68 /* 
69  * public slot
70  */
71 void FormTocDialog::select_adaptor(QListViewItem* item)
72 {
73   form->select(item->text(0));
74 }
75 /* 
76  * public slot
77  */
78 void FormTocDialog::update_adaptor()
79 {
80   form->update();
81 }
82
83 void FormTocDialog::closeEvent(QCloseEvent *e)
84 {
85   form->close();
86   e->accept();
87 }