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