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.
16 #include "GTabularCreate.h"
18 #include <gtkmm/spinbutton.h>
19 #include <gtkmm/button.h>
21 GTabularCreate::GTabularCreate()
22 : GnomeCB<ControlTabularCreate>("GTabularCreate")
26 GTabularCreate::~GTabularCreate()
30 void GTabularCreate::build()
32 // Connect the buttons.
33 ok_btn()->signal_clicked().connect(SigC::slot(*this,
34 >abularCreate::OKClicked));
35 cancel_btn()->signal_clicked().connect(SigC::slot(*this,
36 >abularCreate::CancelClicked));
37 apply_btn()->signal_clicked().connect(SigC::slot(*this,
38 >abularCreate::ApplyClicked));
40 // Manage the buttons state
42 bc().setCancel(cancel_btn());
43 bc().setApply(apply_btn());
45 // Make sure everything is in the correct state.
50 void GTabularCreate::apply()
52 unsigned int xsize = (unsigned int)(rows()->get_value_as_int());
53 unsigned int ysize = (unsigned int)(cols()->get_value_as_int());
55 controller().params() = std::make_pair(xsize, ysize);
59 void GTabularCreate::update()
63 bool GTabularCreate::validate() const
65 return ( rows()->get_value_as_int() > 0 ) &&
66 ( cols()->get_value_as_int() > 0 );
70 Gtk::Button * GTabularCreate::ok_btn() const
72 return getWidget<Gtk::Button>("r_ok_btn");
74 Gtk::Button * GTabularCreate::apply_btn() const
76 return getWidget<Gtk::Button>("r_apply_btn");
78 Gtk::Button * GTabularCreate::cancel_btn() const
80 return getWidget<Gtk::Button>("r_cancel_btn");
82 Gtk::SpinButton * GTabularCreate::rows() const
84 return getWidget<Gtk::SpinButton>("r_rows");
86 Gtk::SpinButton * GTabularCreate::cols() const
88 return getWidget<Gtk::SpinButton>("r_cols");