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
12 #pragma implementation
19 #include "support/lstrings.h"
21 #include <gtkmm/button.h>
22 #include <gtkmm/checkbutton.h>
23 #include <gtkmm/radiobutton.h>
24 #include <gtkmm/box.h>
26 GFloat::GFloat(ControlFloat & c)
27 : GnomeCB<ControlFloat>(c, "GFloat")
37 // Connect the buttons.
38 close_btn()->signal_clicked().connect(SigC::slot(*this, &GFloat::OKClicked));
39 // Manage the buttons state
40 bc().setCancel(close_btn());
48 if (here_definitely()->get_active()) {
51 if (top_of_page()->get_active()) {
54 if (bottom_of_page()->get_active()) {
57 if (page_of_floats()->get_active()) {
60 if (here_if_possible()->get_active()) {
64 controller().params().placement = placement;
75 bool forcehere = false;
77 string placement(controller().params().placement);
79 if (contains(placement, "H")) {
82 if (contains(placement, "t")) {
85 if (contains(placement, "b")) {
88 if (contains(placement, "p")) {
91 if (contains(placement, "h")) {
96 top_of_page()->set_active(top);
97 page_of_floats()->set_active(page);
98 bottom_of_page()->set_active(bottom);
99 here_if_possible()->set_active(here);
100 here_definitely()->set_active(forcehere);
104 void GFloat::connect_signals()
106 conn_top_ = top_of_page()->signal_toggled().connect(
107 SigC::slot(*this, &GFloat::ApplyClicked)
109 conn_bottom_ = bottom_of_page()->signal_toggled().connect(
110 SigC::slot(*this, &GFloat::ApplyClicked)
112 conn_page_ = page_of_floats()->signal_toggled().connect(
113 SigC::slot(*this, &GFloat::ApplyClicked)
115 conn_ifposs_ = here_if_possible()->signal_toggled().connect(
116 SigC::slot(*this, &GFloat::ApplyClicked)
118 conn_definitely_ = here_definitely()->signal_toggled().connect(
119 SigC::slot(*this, &GFloat::ApplyClicked)
121 conn_disable_ = here_definitely()->signal_toggled().connect(
122 SigC::slot(*this, &GFloat::update_sensitive)
126 void GFloat::disconnect_signals()
128 conn_top_.disconnect();
129 conn_bottom_.disconnect();
130 conn_page_.disconnect();
131 conn_ifposs_.disconnect();
132 conn_definitely_.disconnect();
133 conn_disable_.disconnect();
136 void GFloat::update_sensitive()
138 if (here_definitely()->get_active())
139 other_options()->set_sensitive(false);
141 other_options()->set_sensitive(true);
145 Gtk::HBox * GFloat::other_options() const
147 return getWidget<Gtk::HBox>("r_other_options");
149 Gtk::CheckButton * GFloat::page_of_floats() const
151 return getWidget<Gtk::CheckButton>("r_page_of_floats");
153 Gtk::CheckButton * GFloat::top_of_page() const
155 return getWidget<Gtk::CheckButton>("r_top_of_page");
157 Gtk::CheckButton * GFloat::bottom_of_page() const
159 return getWidget<Gtk::CheckButton>("r_bottom_of_page");
161 Gtk::CheckButton * GFloat::here_if_possible() const
163 return getWidget<Gtk::CheckButton>("r_here_if_possible");
165 Gtk::RadioButton * GFloat::here_definitely() const
167 return getWidget<Gtk::RadioButton>("r_here_definitely");
170 Gtk::Button * GFloat::close_btn() const
172 return getWidget<Gtk::Button>("r_close_btn");