/* Copyright 2005 Nicholas Bishop * * This file is part of SharpConstruct. * * SharpConstruct is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * SharpConstruct is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with SharpConstruct; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef SLIDER_HH #define SLIDER_HH #include namespace SharpConstruct { namespace GInterface { class Slider : public Gtk::Range { public: Slider(); Slider( const double, const double ); double Start() const; void SetStart( const double ); bool Snap() const; void SetSnap( const bool ); double Range() const; bool InSlide() const; typedef sigc::signal< void, const double > SliderSignal; SliderSignal& SignalStart(); SliderSignal& SignalContinue(); SliderSignal& SignalEnd(); protected: virtual bool on_button_press_event( GdkEventButton* ); virtual bool on_button_release_event( GdkEventButton* ); virtual bool on_expose_event( GdkEventExpose* ); virtual bool on_motion_notify_event( GdkEventMotion* ); virtual void on_realize(); virtual void on_size_request( Gtk::Requisition* ); private: void start_slide_(); void continue_slide_(); void end_slide_(); int amount_to_loc_( const double ) const; double loc_to_amount_( const int ) const; SliderSignal signal_start_; SliderSignal signal_continue_; SliderSignal signal_end_; double start_; bool snap_; int mouse_down_x_; double original_; bool in_slide_; }; } } #endif