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.
16 #include "support/lstrings.h"
18 #include <gtkmm/button.h>
19 #include <gtkmm/checkbutton.h>
20 #include <gtkmm/radiobutton.h>
21 #include <gtkmm/box.h>
24 : GnomeCB<ControlFloat>("GFloat")
34 // Connect the buttons.
35 close_btn()->signal_clicked().connect(SigC::slot(*this, &GFloat::OKClicked));
36 // Manage the buttons state
37 bc().setCancel(close_btn());
45 if (here_definitely()->get_active()) {
48 if (top_of_page()->get_active()) {
51 if (bottom_of_page()->get_active()) {
54 if (page_of_floats()->get_active()) {
57 if (here_if_possible()->get_active()) {
61 controller().params().placement = placement;
72 bool forcehere = false;
74 string placement(controller().params().placement);
76 if (contains(placement, "H")) {
79 if (contains(placement, "t")) {
82 if (contains(placement, "b")) {
85 if (contains(placement, "p")) {
88 if (contains(placement, "h")) {
93 top_of_page()->set_active(top);
94 page_of_floats()->set_active(page);
95 bottom_of_page()->set_active(bottom);
96 here_if_possible()->set_active(here);
97 here_definitely()->set_active(forcehere);
101 void GFloat::connect_signals()
103 conn_top_ = top_of_page()->signal_toggled().connect(
104 SigC::slot(*this, &GFloat::ApplyClicked)
106 conn_bottom_ = bottom_of_page()->signal_toggled().connect(
107 SigC::slot(*this, &GFloat::ApplyClicked)
109 conn_page_ = page_of_floats()->signal_toggled().connect(
110 SigC::slot(*this, &GFloat::ApplyClicked)
112 conn_ifposs_ = here_if_possible()->signal_toggled().connect(
113 SigC::slot(*this, &GFloat::ApplyClicked)
115 conn_definitely_ = here_definitely()->signal_toggled().connect(
116 SigC::slot(*this, &GFloat::ApplyClicked)
118 conn_disable_ = here_definitely()->signal_toggled().connect(
119 SigC::slot(*this, &GFloat::update_sensitive)
123 void GFloat::disconnect_signals()
125 conn_top_.disconnect();
126 conn_bottom_.disconnect();
127 conn_page_.disconnect();
128 conn_ifposs_.disconnect();
129 conn_definitely_.disconnect();
130 conn_disable_.disconnect();
133 void GFloat::update_sensitive()
135 if (here_definitely()->get_active())
136 other_options()->set_sensitive(false);
138 other_options()->set_sensitive(true);
142 Gtk::HBox * GFloat::other_options() const
144 return getWidget<Gtk::HBox>("r_other_options");
146 Gtk::CheckButton * GFloat::page_of_floats() const
148 return getWidget<Gtk::CheckButton>("r_page_of_floats");
150 Gtk::CheckButton * GFloat::top_of_page() const
152 return getWidget<Gtk::CheckButton>("r_top_of_page");
154 Gtk::CheckButton * GFloat::bottom_of_page() const
156 return getWidget<Gtk::CheckButton>("r_bottom_of_page");
158 Gtk::CheckButton * GFloat::here_if_possible() const
160 return getWidget<Gtk::CheckButton>("r_here_if_possible");
162 Gtk::RadioButton * GFloat::here_definitely() const
164 return getWidget<Gtk::RadioButton>("r_here_definitely");
167 Gtk::Button * GFloat::close_btn() const
169 return getWidget<Gtk::Button>("r_close_btn");