3 * Copyright 2001 The LyX Team.
4 * See the file COPYING.
6 * \author Michael Koziarski <michael@koziarski.org>
10 #pragma implementation
17 #include "support/lstrings.h"
19 #include <gtkmm/button.h>
20 #include <gtkmm/checkbutton.h>
21 #include <gtkmm/radiobutton.h>
22 #include <gtkmm/box.h>
24 GFloat::GFloat(ControlFloat & c)
25 : FormCB<ControlFloat>(c, "GFloat")
35 // Connect the buttons.
36 close_btn()->signal_clicked().connect(SigC::slot(*this, &GFloat::OKClicked));
37 // Manage the buttons state
38 bc().setCancel(close_btn());
46 if (here_definitely()->get_active()) {
49 if (top_of_page()->get_active()) {
52 if (bottom_of_page()->get_active()) {
55 if (page_of_floats()->get_active()) {
58 if (here_if_possible()->get_active()) {
62 controller().params().placement = placement;
73 bool forcehere = false;
75 string placement(controller().params().placement);
77 if (contains(placement, "H")) {
80 if (contains(placement, "t")) {
83 if (contains(placement, "b")) {
86 if (contains(placement, "p")) {
89 if (contains(placement, "h")) {
94 top_of_page()->set_active(top);
95 page_of_floats()->set_active(page);
96 bottom_of_page()->set_active(bottom);
97 here_if_possible()->set_active(here);
98 here_definitely()->set_active(forcehere);
102 void GFloat::connect_signals()
104 conn_top_ = top_of_page()->signal_toggled().connect(
105 SigC::slot(*this, &GFloat::ApplyClicked)
107 conn_bottom_ = bottom_of_page()->signal_toggled().connect(
108 SigC::slot(*this, &GFloat::ApplyClicked)
110 conn_page_ = page_of_floats()->signal_toggled().connect(
111 SigC::slot(*this, &GFloat::ApplyClicked)
113 conn_ifposs_ = here_if_possible()->signal_toggled().connect(
114 SigC::slot(*this, &GFloat::ApplyClicked)
116 conn_definitely_ = here_definitely()->signal_toggled().connect(
117 SigC::slot(*this, &GFloat::ApplyClicked)
119 conn_disable_ = here_definitely()->signal_toggled().connect(
120 SigC::slot(*this, &GFloat::update_sensitive)
124 void GFloat::disconnect_signals()
126 conn_top_.disconnect();
127 conn_bottom_.disconnect();
128 conn_page_.disconnect();
129 conn_ifposs_.disconnect();
130 conn_definitely_.disconnect();
131 conn_disable_.disconnect();
134 void GFloat::update_sensitive()
136 if (here_definitely()->get_active())
137 other_options()->set_sensitive(false);
139 other_options()->set_sensitive(true);
143 Gtk::HBox * GFloat::other_options() const
145 return getWidget<Gtk::HBox>("r_other_options");
147 Gtk::CheckButton * GFloat::page_of_floats() const
149 return getWidget<Gtk::CheckButton>("r_page_of_floats");
151 Gtk::CheckButton * GFloat::top_of_page() const
153 return getWidget<Gtk::CheckButton>("r_top_of_page");
155 Gtk::CheckButton * GFloat::bottom_of_page() const
157 return getWidget<Gtk::CheckButton>("r_bottom_of_page");
159 Gtk::CheckButton * GFloat::here_if_possible() const
161 return getWidget<Gtk::CheckButton>("r_here_if_possible");
163 Gtk::RadioButton * GFloat::here_definitely() const
165 return getWidget<Gtk::RadioButton>("r_here_definitely");
168 Gtk::Button * GFloat::close_btn() const
170 return getWidget<Gtk::Button>("r_close_btn");