2 /* This file is part of
3 * =================================================
5 * LyX, The Document Processor
6 * Copyright 1995-2000 The LyX Team.
8 * =================================================
10 * \author Michael Koziarski <michael@koziarski.org>
14 #pragma implementation
21 #include "FormTabularCreate.h"
23 #include <gtk--/spinbutton.h>
24 #include <gtk--/button.h>
26 FormTabularCreate::FormTabularCreate(ControlTabularCreate & c)
27 : FormCB<ControlTabularCreate>(c, "diainserttabular.glade",
32 FormTabularCreate::~FormTabularCreate()
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.
41 void FormTabularCreate::build()
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));
51 // Manage the buttons state
53 bc().setCancel(cancel_btn());
54 bc().setApply(apply_btn());
56 // Make sure everything is in the correct state.
61 void FormTabularCreate::apply()
63 unsigned int ysize = (unsigned int)(rows_spin()->get_value_as_int());
64 unsigned int xsize = (unsigned int)(columns_spin()->get_value_as_int());
66 controller().params() = std::make_pair(xsize, ysize);
70 void FormTabularCreate::update()
75 bool FormTabularCreate::validate() const
77 // Always valid! (not really so, needs fixing).
82 Gtk::SpinButton * FormTabularCreate::rows_spin() const
84 return getWidget<Gtk::SpinButton>("tabular_spin_rows");
88 Gtk::SpinButton * FormTabularCreate::columns_spin() const
90 return getWidget<Gtk::SpinButton>("tabular_spin_columns");
94 Gtk::Button * FormTabularCreate::ok_btn() const
96 return getWidget<Gtk::Button>("button_ok");
100 Gtk::Button * FormTabularCreate::cancel_btn() const
102 return getWidget<Gtk::Button>("button_cancel");
106 Gtk::Button * FormTabularCreate::apply_btn() const
108 return getWidget<Gtk::Button>("button_apply");