1 /* This file is part of
2 * =================================================
4 * LyX, The Document Processor
5 * Copyright 1995-2000 The LyX Team.
7 * =================================================
9 * \author Michael Koziarski <michael@koziarski.org>
13 #pragma implementation
20 #include "GTabularCreate.h"
22 #include <gtkmm/spinbutton.h>
23 #include <gtkmm/button.h>
25 GTabularCreate::GTabularCreate(ControlTabularCreate & c)
26 : FormCB<ControlTabularCreate>(c, "GTabularCreate")
30 GTabularCreate::~GTabularCreate()
34 void GTabularCreate::build()
36 // Connect the buttons.
37 ok_btn()->signal_clicked().connect(SigC::slot(*this,
38 >abularCreate::OKClicked));
39 cancel_btn()->signal_clicked().connect(SigC::slot(*this,
40 >abularCreate::CancelClicked));
41 apply_btn()->signal_clicked().connect(SigC::slot(*this,
42 >abularCreate::ApplyClicked));
44 // Manage the buttons state
46 bc().setCancel(cancel_btn());
47 bc().setApply(apply_btn());
49 // Make sure everything is in the correct state.
54 void GTabularCreate::apply()
56 unsigned int ysize = (unsigned int)(rows()->get_value_as_int());
57 unsigned int xsize = (unsigned int)(cols()->get_value_as_int());
59 controller().params() = std::make_pair(xsize, ysize);
63 void GTabularCreate::update()
67 bool GTabularCreate::validate() const
69 return ( rows()->get_value_as_int() > 0 ) &&
70 ( cols()->get_value_as_int() > 0 );
74 Gtk::Button * GTabularCreate::ok_btn() const
76 return getWidget<Gtk::Button>("r_ok_btn");
78 Gtk::Button * GTabularCreate::apply_btn() const
80 return getWidget<Gtk::Button>("r_apply_btn");
82 Gtk::Button * GTabularCreate::cancel_btn() const
84 return getWidget<Gtk::Button>("r_cancel_btn");
86 Gtk::SpinButton * GTabularCreate::rows() const
88 return getWidget<Gtk::SpinButton>("r_rows");
90 Gtk::SpinButton * GTabularCreate::cols() const
92 return getWidget<Gtk::SpinButton>("r_cols");