Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members

/home/jeroen/FOX/fox/fox-1.7.33/include/FXRangeSlider.h
00001 /********************************************************************************
00002 *                                                                               *
00003 *                           S l i d e r   W i d g e t                           *
00004 *                                                                               *
00005 *********************************************************************************
00006 * Copyright (C) 1997,2012 by Jeroen van der Zijp.   All Rights Reserved.        *
00007 *********************************************************************************
00008 * This library is free software; you can redistribute it and/or modify          *
00009 * it under the terms of the GNU Lesser General Public License as published by   *
00010 * the Free Software Foundation; either version 3 of the License, or             *
00011 * (at your option) any later version.                                           *
00012 *                                                                               *
00013 * This library is distributed in the hope that it will be useful,               *
00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of                *
00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                 *
00016 * GNU Lesser General Public License for more details.                           *
00017 *                                                                               *
00018 * You should have received a copy of the GNU Lesser General Public License      *
00019 * along with this program.  If not, see <http://www.gnu.org/licenses/>          *
00020 ********************************************************************************/
00021 #ifndef FXRANGERANGESLIDER_H
00022 #define FXRANGERANGESLIDER_H
00023 
00024 #ifndef FXFRAME_H
00025 #include "FXFrame.h"
00026 #endif
00027 
00028 namespace FX {
00029 
00030 
00032 enum {
00033   RANGESLIDER_HORIZONTAL   = 0,                         
00034   RANGESLIDER_VERTICAL     = 0x00008000,                
00035   RANGESLIDER_ARROW_UP     = 0x00010000,                
00036   RANGESLIDER_ARROW_DOWN   = 0x00020000,                
00037   RANGESLIDER_ARROW_LEFT   = RANGESLIDER_ARROW_UP,      
00038   RANGESLIDER_ARROW_RIGHT  = RANGESLIDER_ARROW_DOWN,    
00039   RANGESLIDER_INSIDE_BAR   = 0x00040000,                
00040   RANGESLIDER_NORMAL       = RANGESLIDER_HORIZONTAL
00041   };
00042 
00043 
00055 class FXAPI FXRangeSlider : public FXFrame {
00056   FXDECLARE(FXRangeSlider)
00057 protected:
00058   FXint         headPos[2];     // Head position
00059   FXint         headSize;       // Head size
00060   FXint         slotSize;       // Slot size
00061   FXColor       slotColor;      // Color of slot the head moves in
00062   FXint         dragPoint;      // Where the head is grabbed
00063   FXint         values[4];      // Slider values
00064   FXint         active;         // Which head is being manipulated
00065   FXint         incr;           // Increment when auto-sliding
00066   FXString      help;           // Help string
00067   FXString      tip;            // Tip string
00068 protected:
00069   FXRangeSlider();
00070   void drawSliderHead(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h);
00071 private:
00072   FXRangeSlider(const FXRangeSlider&);
00073   FXRangeSlider &operator=(const FXRangeSlider&);
00074 public:
00075   long onPaint(FXObject*,FXSelector,void*);
00076   long onMotion(FXObject*,FXSelector,void*);
00077   long onMouseWheel(FXObject*,FXSelector,void*);
00078   long onLeftBtnPress(FXObject*,FXSelector,void*);
00079   long onLeftBtnRelease(FXObject*,FXSelector,void*);
00080   long onMiddleBtnPress(FXObject*,FXSelector,void*);
00081   long onMiddleBtnRelease(FXObject*,FXSelector,void*);
00082   long onKeyPress(FXObject*,FXSelector,void*);
00083   long onKeyRelease(FXObject*,FXSelector,void*);
00084   long onUngrabbed(FXObject*,FXSelector,void*);
00085   long onAutoSlide(FXObject*,FXSelector,void*);
00086   long onCmdSetIntRange(FXObject*,FXSelector,void*);
00087   long onCmdGetIntRange(FXObject*,FXSelector,void*);
00088   long onCmdSetRealRange(FXObject*,FXSelector,void*);
00089   long onCmdGetRealRange(FXObject*,FXSelector,void*);
00090   long onCmdSetHelp(FXObject*,FXSelector,void*);
00091   long onCmdGetHelp(FXObject*,FXSelector,void*);
00092   long onCmdSetTip(FXObject*,FXSelector,void*);
00093   long onCmdGetTip(FXObject*,FXSelector,void*);
00094   long onQueryHelp(FXObject*,FXSelector,void*);
00095   long onQueryTip(FXObject*,FXSelector,void*);
00096 public:
00097   enum{
00098     ID_AUTOSLIDE=FXFrame::ID_LAST,
00099     ID_LAST
00100     };
00101 public:
00102 
00104   FXRangeSlider(FXComposite* p,FXObject* tgt=NULL,FXSelector sel=0,FXuint opts=RANGESLIDER_NORMAL,FXint x=0,FXint y=0,FXint w=0,FXint h=0,FXint pl=0,FXint pr=0,FXint pt=0,FXint pb=0);
00105 
00107   virtual FXint getDefaultWidth();
00108 
00110   virtual FXint getDefaultHeight();
00111 
00113   virtual FXbool canFocus() const;
00114 
00116   virtual void layout();
00117 
00119   virtual void enable();
00120 
00122   virtual void disable();
00123 
00125   void setValue(FXint head,FXint value,FXbool notify=false);
00126 
00128   FXint getValue(FXint head) const { return values[1+head]; }
00129 
00131   void setRange(FXint lo,FXint hi,FXbool notify=false);
00132 
00134   void getRange(FXint& lo,FXint& hi) const { lo=values[0]; hi=values[3]; }
00135 
00137   FXuint getSliderStyle() const;
00138 
00140   void setSliderStyle(FXuint style);
00141 
00143   FXint getHeadSize() const { return headSize; }
00144 
00146   void setHeadSize(FXint hs);
00147 
00149   FXint getSlotSize() const { return slotSize; }
00150 
00152   void setSlotSize(FXint bs);
00153 
00155   FXint getIncrement() const { return incr; }
00156 
00158   void setIncrement(FXint inc);
00159 
00161   void setSlotColor(FXColor clr);
00162 
00164   FXColor getSlotColor() const { return slotColor; }
00165 
00167   void setHelpText(const FXString& text){ help=text; }
00168 
00170   const FXString& getHelpText() const { return help; }
00171 
00173   void setTipText(const FXString& text){ tip=text; }
00174 
00176   const FXString& getTipText() const { return tip; }
00177 
00179   virtual void save(FXStream& store) const;
00180 
00182   virtual void load(FXStream& store);
00183 
00185   virtual ~FXRangeSlider();
00186   };
00187 
00188 }
00189 
00190 #endif

Copyright © 1997-2011 Jeroen van der Zijp