]> git.lyx.org Git - lyx.git/blob - src/frontends/gnome/FormTabularCreate.C
fix problem with nroff detection, remove dead code with old floats, bogus message...
[lyx.git] / src / frontends / gnome / FormTabularCreate.C
1 /* This file is part of
2  * =================================================
3  * 
4  *          LyX, The Document Processor
5  *          Copyright 1995-2000 The LyX Team.
6  *
7  * ================================================= 
8  *
9  * \author Michael Koziarski <michael@koziarski.org>
10  */
11
12 #ifdef __GNUG__
13 #pragma implementation
14 #endif
15
16 #include <config.h>
17 #include <utility>
18
19 #include "gnomeBC.h"
20 #include "FormTabularCreate.h"
21
22 #include <gtk--/spinbutton.h>
23 #include <gtk--/button.h>
24
25 FormTabularCreate::FormTabularCreate(ControlTabularCreate & c)
26         : FormCB<ControlTabularCreate>(c, "diainserttabular.glade", 
27                                       "DiaInsertTabular")
28 {}
29
30
31 FormTabularCreate::~FormTabularCreate()
32 {
33         // Note that there is no need to destroy the class itself, it seems
34         // like everything is managed inside it. Deleting the class itself will
35         // a crash at the end of the program.
36         //dialog_->destroy();
37 }
38
39
40 void FormTabularCreate::build()
41 {
42         // Connect the buttons.
43         ok_btn()->clicked.connect(SigC::slot(this, 
44                                          &FormTabularCreate::OKClicked));
45         cancel_btn()->clicked.connect(SigC::slot(this, 
46                                          &FormTabularCreate::CancelClicked));
47         apply_btn()->clicked.connect(SigC::slot(this, 
48                                      &FormTabularCreate::ApplyClicked));
49         
50         // Manage the buttons state
51         bc().setOK(ok_btn());
52         bc().setCancel(cancel_btn());
53         bc().setApply(apply_btn());
54
55         // Make sure everything is in the correct state.
56         bc().refresh();
57 }
58
59
60 void FormTabularCreate::apply()
61 {
62         unsigned int ysize = (unsigned int)(rows_spin()->get_value_as_int());
63         unsigned int xsize = (unsigned int)(columns_spin()->get_value_as_int());
64
65         controller().params() = std::make_pair(xsize, ysize);
66 }
67
68
69 void FormTabularCreate::update()
70 {
71 }
72
73
74 bool FormTabularCreate::validate() const
75 {
76         // Always valid! (not really so, needs fixing).
77         return true;
78 }
79
80
81 Gtk::SpinButton * FormTabularCreate::rows_spin() const
82 {
83         return getWidget<Gtk::SpinButton>("tabular_spin_rows");
84 }
85
86
87 Gtk::SpinButton * FormTabularCreate::columns_spin() const
88 {
89         return getWidget<Gtk::SpinButton>("tabular_spin_columns");
90 }
91
92
93 Gtk::Button * FormTabularCreate::ok_btn() const
94 {
95         return getWidget<Gtk::Button>("button_ok");
96 }
97
98
99 Gtk::Button * FormTabularCreate::cancel_btn() const
100 {
101         return getWidget<Gtk::Button>("button_cancel");
102 }
103
104
105 Gtk::Button * FormTabularCreate::apply_btn() const
106 {
107         return getWidget<Gtk::Button>("button_apply");
108 }