1 /* slider.h 2 * This file belongs to Worker, a file manager for UN*X/X11. 3 * Copyright (C) 2005-2007,2012 Ralf Hoffmann. 4 * You can contact me at: ralf@boomerangsworld.de 5 * or http://www.boomerangsworld.de/worker 6 * 7 * This program is free software; you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation; either version 2 of the License, or 10 * (at your option) any later version. 11 * 12 * This program is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with this program; if not, write to the Free Software 19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 20 */ 21 22 #ifndef SLIDER_H 23 #define SLIDER_H 24 25 #include "aguixdefs.h" 26 #include "guielement.h" 27 #include "callback.h" 28 29 class AGUIX; 30 31 class Slider : public GUIElement 32 { 33 public: 34 Slider( AGUIX *caguix, int cx, int cy, int cwidth, int cheight, bool cvertical, int cdata ); 35 ~Slider(); 36 Slider( const Slider &other ); 37 Slider &operator=( const Slider &other ); 38 39 void redraw(); 40 void resize( int w, int h ); 41 int getData() const; 42 void setData( int ); 43 void flush(); 44 bool handleMessage( XEvent *E, Message *msg ); 45 void handleBar( Message *msg ); 46 bool handleKeys( Message *msg ); 47 48 const char *getType() const; 49 bool isType( const char *type ) const; 50 51 void setOffset( int nv ); 52 int getOffset() const; 53 void setMaxLen( int nv ); 54 int getMaxLen() const; 55 void setMaxDisplay( int nv ); 56 int getMaxDisplay() const; 57 58 bool isParent( Window ) const; 59 60 void setDisplayFocus( bool nv ); 61 bool getDisplayFocus() const; 62 63 int getBG() const; 64 void setBG( int v ); 65 66 void setShowArrowButtons( bool nv ); 67 bool getShowArrowButtons() const; 68 protected: 69 static const char *type; 70 71 int max_len, offset, maxdisplay; 72 bool vertical; 73 int old_offset; 74 75 int data; 76 int bar_dir; 77 bool bar_pressed; 78 void handleExpose( Window msgwin, int ex, int ey, int ew, int eh ); 79 80 bool displayFocus; 81 82 typedef enum { BAR_IDLE, BAR_SCROLL, BAR_SCROLL_LEFT, BAR_SCROLL_RIGHT } barMode_t; 83 barMode_t barMode; 84 int grabs, scrollDelta; 85 void checkValues(); 86 void msgAndCallback(); 87 88 void enableTimer(); 89 int _init_timer_wait; 90 91 int m_bg; 92 93 bool m_show_arrow_buttons; 94 }; 95 96 #endif 97