2 * \file GTabularCreate.C
3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
6 * \author Michael Koziarski
8 * Full author contact details are available in file CREDITS
12 #pragma implementation
19 #include "GTabularCreate.h"
21 #include <gtkmm/spinbutton.h>
22 #include <gtkmm/button.h>
24 GTabularCreate::GTabularCreate(ControlTabularCreate & c)
25 : GnomeCB<ControlTabularCreate>(c, "GTabularCreate")
29 GTabularCreate::~GTabularCreate()
33 void GTabularCreate::build()
35 // Connect the buttons.
36 ok_btn()->signal_clicked().connect(SigC::slot(*this,
37 >abularCreate::OKClicked));
38 cancel_btn()->signal_clicked().connect(SigC::slot(*this,
39 >abularCreate::CancelClicked));
40 apply_btn()->signal_clicked().connect(SigC::slot(*this,
41 >abularCreate::ApplyClicked));
43 // Manage the buttons state
45 bc().setCancel(cancel_btn());
46 bc().setApply(apply_btn());
48 // Make sure everything is in the correct state.
53 void GTabularCreate::apply()
55 unsigned int ysize = (unsigned int)(rows()->get_value_as_int());
56 unsigned int xsize = (unsigned int)(cols()->get_value_as_int());
58 controller().params() = std::make_pair(xsize, ysize);
62 void GTabularCreate::update()
66 bool GTabularCreate::validate() const
68 return ( rows()->get_value_as_int() > 0 ) &&
69 ( cols()->get_value_as_int() > 0 );
73 Gtk::Button * GTabularCreate::ok_btn() const
75 return getWidget<Gtk::Button>("r_ok_btn");
77 Gtk::Button * GTabularCreate::apply_btn() const
79 return getWidget<Gtk::Button>("r_apply_btn");
81 Gtk::Button * GTabularCreate::cancel_btn() const
83 return getWidget<Gtk::Button>("r_cancel_btn");
85 Gtk::SpinButton * GTabularCreate::rows() const
87 return getWidget<Gtk::SpinButton>("r_rows");
89 Gtk::SpinButton * GTabularCreate::cols() const
91 return getWidget<Gtk::SpinButton>("r_cols");