]> git.lyx.org Git - lyx.git/blob - src/frontends/qt2/tabularcreatedlgimpl.C
implement getLabelList
[lyx.git] / src / frontends / qt2 / tabularcreatedlgimpl.C
1 /**
2  * \file tabularcreatedlgimpl.C
3  * Copyright 2001 LyX Team
4  * see the file COPYING
5  *
6  * \author John Levon, moz@compsoc.man.ac.uk
7  * \author Edwin Leuven, leuven@fee.uva.nl
8  */
9
10 #include "tabularcreatedlg.h"
11
12 #include <config.h>
13 #include <gettext.h>
14 #include <string>
15
16 #include "tabularcreatedlgimpl.h"
17 #include "FormTabularCreate.h"
18 #include "support/lstrings.h"
19
20 #include "qpushbutton.h"
21 #include "qspinbox.h"
22 #include "emptytable.h"
23 #include "qpainter.h"
24 #include "qtableview.h"
25 #include "qtooltip.h"
26
27 TabularCreateDlgImpl::TabularCreateDlgImpl(FormTabularCreate* form, QWidget* parent,  const char* name, bool modal, WFlags fl )
28     : InsertTabularDlg( parent, name, modal, fl ), form_(form)
29 {
30    setCaption(name);
31    table->setMinimumSize(100,100);
32    rows->setValue(5);
33    columns->setValue(5);
34    QToolTip::add(table, _("Drag with left mouse button to resize"));
35 }
36
37 TabularCreateDlgImpl::~TabularCreateDlgImpl()
38 {
39     // no need to delete child widgets, Qt does it all for us
40 }
41
42 void TabularCreateDlgImpl::insert_tabular()
43 {
44    form_->apply((rows->text()).toInt(), (columns->text()).toInt());
45    form_->close();
46    hide();
47 }
48
49 void TabularCreateDlgImpl::cancel_adaptor()
50 {
51    form_->close();
52    hide();
53 }
54
55 void TabularCreateDlgImpl::colsChanged(int nr_cols)
56 {
57    if (nr_cols != (columns->text()).toInt())
58      columns->setValue(nr_cols);
59 }
60
61 void TabularCreateDlgImpl::rowsChanged(int nr_rows)
62 {
63    if (nr_rows != (rows->text()).toInt()) 
64      rows->setValue(nr_rows);
65 }
66