From 37d42d45f3f4a5d3e916a080af50b37ae4a9d118 Mon Sep 17 00:00:00 2001 From: John Spray Date: Sat, 28 Jan 2006 16:37:19 +0000 Subject: [PATCH] Continue to improve GtkLengthEntry git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@10787 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/gtk/ChangeLog | 8 ++++++-- src/frontends/gtk/GtkLengthEntry.C | 12 +++++++++--- src/frontends/gtk/GtkLengthEntry.h | 5 +++++ 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/src/frontends/gtk/ChangeLog b/src/frontends/gtk/ChangeLog index fc6c3e510e..181062a82d 100644 --- a/src/frontends/gtk/ChangeLog +++ b/src/frontends/gtk/ChangeLog @@ -1,9 +1,13 @@ +2006-01-28 John Spray + + * GtkLengthEntry.[Ch]: implement signal_changed, setup spin limits + 2006-01-27 Bernhard Reiter * GBranch.[Ch], glade/branch.glade: Add the Branches dialog * Dialogs.C, Makefile.am, glade/Makefile.am: Use GBranch - * GCitation.C, glade/citation.glade: Add some shortcuts, - set shortcut targets correctly plus some minor bc().valid() logic + * GCitation.C, glade/citation.glade: Add some shortcuts, + set shortcut targets correctly plus some minor bc().valid() logic 2006-01-25 Georg Baum diff --git a/src/frontends/gtk/GtkLengthEntry.C b/src/frontends/gtk/GtkLengthEntry.C index 9317164723..e1a29a930d 100644 --- a/src/frontends/gtk/GtkLengthEntry.C +++ b/src/frontends/gtk/GtkLengthEntry.C @@ -29,10 +29,8 @@ namespace frontend { GtkLengthEntry::GtkLengthEntry( BaseObjectType* cobject, const Glib::RefPtr& refGlade) -: Gtk::HBox(cobject), spin_(0.1, 2) +: Gtk::HBox(cobject), adj_(666.0, 0.0, 99999.0, 0.1, 1, 0.0), spin_(adj_, 0.1, 2) { - - spin_.set_range(0.0, 99999.0f); populateUnitCombo (combo_, true); relative_ = true; @@ -40,6 +38,14 @@ GtkLengthEntry::GtkLengthEntry( pack_start (spin_, true, true, 0); pack_start (combo_, true, true, 0); show_all(); + spin_.signal_changed().connect(sigc::mem_fun(changedsignal_, &sigc::signal::emit)); + combo_.signal_changed().connect(sigc::mem_fun(changedsignal_, &sigc::signal::emit)); +} + + +sigc::signal< void >& GtkLengthEntry::signal_changed() +{ + return changedsignal_; } diff --git a/src/frontends/gtk/GtkLengthEntry.h b/src/frontends/gtk/GtkLengthEntry.h index e684085de1..af0991e081 100644 --- a/src/frontends/gtk/GtkLengthEntry.h +++ b/src/frontends/gtk/GtkLengthEntry.h @@ -38,10 +38,15 @@ public: Gtk::SpinButton *get_spin(); Gtk::ComboBoxText *get_combo(); + sigc::signal &signal_changed(); protected: + // spin_ construction depends on adj_, so it must come first + Gtk::Adjustment adj_; Gtk::SpinButton spin_; Gtk::ComboBoxText combo_; + sigc::signal changedsignal_; + void emit_changed(); bool relative_; };