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 "FormTabularCreate.h"
22 #include <gtk--/spinbutton.h>
23 #include <gtk--/button.h>
25 FormTabularCreate::FormTabularCreate(ControlTabularCreate & c)
26 : FormCB<ControlTabularCreate>(c, "diainserttabular.glade",
31 FormTabularCreate::~FormTabularCreate()
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.
40 void FormTabularCreate::build()
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));
50 // Manage the buttons state
52 bc().setCancel(cancel_btn());
53 bc().setApply(apply_btn());
55 // Make sure everything is in the correct state.
60 void FormTabularCreate::apply()
62 unsigned int ysize = (unsigned int)(rows_spin()->get_value_as_int());
63 unsigned int xsize = (unsigned int)(columns_spin()->get_value_as_int());
65 controller().params() = std::make_pair(xsize, ysize);
69 void FormTabularCreate::update()
74 bool FormTabularCreate::validate() const
76 // Always valid! (not really so, needs fixing).
81 Gtk::SpinButton * FormTabularCreate::rows_spin() const
83 return getWidget<Gtk::SpinButton>("tabular_spin_rows");
87 Gtk::SpinButton * FormTabularCreate::columns_spin() const
89 return getWidget<Gtk::SpinButton>("tabular_spin_columns");
93 Gtk::Button * FormTabularCreate::ok_btn() const
95 return getWidget<Gtk::Button>("button_ok");
99 Gtk::Button * FormTabularCreate::cancel_btn() const
101 return getWidget<Gtk::Button>("button_cancel");
105 Gtk::Button * FormTabularCreate::apply_btn() const
107 return getWidget<Gtk::Button>("button_apply");