1 #ifndef oxygensliderdemowidget_h 2 #define oxygensliderdemowidget_h 3 4 /* 5 * this file is part of the oxygen gtk engine 6 * Copyright (c) 2010 Hugo Pereira Da Costa <hugo.pereira@free.fr> 7 * 8 * based on the Null Theme Engine for Gtk+. 9 * Copyright (c) 2008 Robert Staudinger <robert.staudinger@gmail.com> 10 * 11 * This library is free software; you can redistribute it and/or 12 * modify it under the terms of the GNU Lesser General Public 13 * License as published by the Free Software Foundation; either 14 * version 2 of the License, or( at your option ) any later version. 15 * 16 * This library is distributed in the hope that it will be useful, 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 * Lesser General Public License for more details. 20 * 21 * You should have received a copy of the GNU Lesser General Public 22 * License along with this library; if not, write to the Free 23 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, 24 * MA 02110-1301, USA. 25 */ 26 27 #include "oxygendemowidget.h" 28 #include "oxygensignal.h" 29 #include "oxygentimer.h" 30 31 #include <gtk/gtk.h> 32 33 namespace Oxygen 34 { 35 36 class SliderDemoWidget: public DemoWidget 37 { 38 39 public: 40 41 //! constructor 42 SliderDemoWidget( void ); 43 44 //! destructor 45 virtual ~SliderDemoWidget( void ); 46 47 //! pulse progress bar startPulse(void)48 void startPulse( void ) 49 { if( !_timer.isRunning() ) _timer.start( 50, (GSourceFunc)pulseProgressBar, this ); } 50 51 //! pulse progress bar stopPulse(void)52 void stopPulse( void ) 53 { if( _timer.isRunning() ) _timer.stop(); } 54 55 protected: 56 57 //! pulse progress bar 58 static gboolean pulseProgressBar( gpointer ); 59 60 //! callback 61 static void valueChanged( GtkRange*, gpointer ); 62 63 private: 64 65 //! widget container 66 class Sliders 67 { 68 public: 69 70 //! constructor Sliders(void)71 Sliders( void ): 72 _scale( 0 ), 73 _progressBar( 0 ), 74 _scrollBar( 0 ), 75 _progressEntry( 0 ) 76 {} 77 78 //! change value 79 void setValue( const double& value ) const; 80 81 GtkWidget* _scale; 82 GtkWidget* _progressBar; 83 GtkWidget* _scrollBar; 84 GtkWidget* _progressEntry; 85 }; 86 87 //! horizontal sliders 88 Sliders _horizontalSliders; 89 90 //! vertical sliders 91 Sliders _verticalSliders; 92 93 //! pulse progressbar timer 94 Timer _timer; 95 96 //! pulse progress bar 97 GtkWidget* _pulseProgressBar; 98 }; 99 100 } 101 102 #endif 103