![[]](/images/special/trans.gif)
LibN2L-4 Library Code ReferenceClassesCompounds Files Members Method Index Full Reference cGuiSlider.hGo to the documentation of this file.00001 /************************************************************************ 00002 Nova-2 Library (libN2L, or simply n2l) Game development C++ Library 00003 Copyright (C) 2002 Aaron Cameron 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Lesser General Public 00007 License as published by the Free Software Foundation; either 00008 version 2.1 of the License, or (at your option) any later version. 00009 00010 This library is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Lesser General Public License for more details. 00014 00015 You should have received a copy of the GNU Lesser General Public 00016 License along with this library; if not, write to the Free Software 00017 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00018 00019 A copy of the GNU Lesser General Public License has been provided with 00020 this library in the file 'COPYING'. 00021 00022 Contact information for the author of this library has been provided 00023 with this library in the file 'AUTHOR'. 00024 ************************************************************************/ 00025 #ifndef _n2l4_cGuiSlider_H 00026 #define _n2l4_cGuiSlider_H 00027 00028 #include "n2l/n2l.h" 00029 00030 #include "gui/cGuiInteractive.h" 00031 #include "gui/types.h" 00032 #include "gui/cGuiFill.h" 00033 00034 /******************************************************************************/ 00035 namespace n2l 00036 { 00037 class cVfsNodeInterface; 00038 class cDynVar; 00039 class cMouseButtonEvent; 00040 class cEventInterface; 00041 00046 class cGuiSlider : public cGuiInteractive 00047 { 00048 public: 00049 typedef tFloat tValue; 00050 00051 typedef enum { 00052 Align_Horizontal, 00053 Align_Vertical, 00054 00055 Align_NumAlignments 00056 } tAlignment; 00057 00058 typedef enum { 00059 State_Normal, 00060 State_Over, 00061 State_Down, 00062 00063 State_NumStates 00064 } tState; 00065 00066 typedef enum { 00067 Prop_Background, 00068 Prop_Slider, 00069 00070 Prop_NumProps 00071 } tProp; 00072 00073 cGuiSlider(); 00074 cGuiSlider( const cVfsNodeInterface &iNode ); 00075 cGuiSlider( const cDynVar &iDefinition ); 00076 virtual ~cGuiSlider(); 00077 00078 virtual void load( const cVfsNodeInterface &iNode ); 00079 virtual void load( const cDynVar &iDefinition ); 00080 00081 virtual void draw() const; 00082 virtual void align( const tAlignment iAlign ); 00083 00084 virtual void fill( const tProp iProp, const tState iState, 00085 const cGuiFill &iFill ); 00086 00087 virtual void alignment( const tAlignment iAlignment ); 00088 00089 virtual void min( const tValue &iValue ); 00090 virtual void value( const tValue &iValue ); 00091 virtual const tValue &value() const; 00092 virtual void range( const tValue &iValue ); 00093 virtual void max( const tValue &iValue ); 00094 00095 virtual void swapWheel( const tBool iSwap ); 00096 virtual const tBool swapWheel() const; 00097 00098 virtual const tValue &min() const; 00099 virtual const tValue &max() const; 00100 virtual const tValue &range() const; 00101 00102 virtual void scrollRangePCent( const tFloat &iPCent ); 00103 00107 virtual void scrollPlus(); 00108 virtual void scrollMinus(); 00109 00110 virtual const cAutoPtr<cGuiElement> clone() const; 00111 00112 virtual void systemEvent( 00113 const cAutoPtr<const cEventInterface> &i_iEvent ); 00114 00115 protected: 00116 virtual void cloneInto( 00117 const cAutoPtr<cGuiSlider> &i_ioElement ) const; 00118 virtual void dimensionChanged(); 00119 00120 virtual void mouseClickAt( const cMouseButtonEvent &iClick ); 00121 virtual void mouseMove( const tGuiPos &iPos ); 00122 00123 private: 00124 00125 tValue mMin,mMax,mValue,mRange,mRequestedRange; 00126 00127 tAlignment mAlignment; 00128 00132 tBool mSwapWheel; 00133 00134 cGuiFill mFills[Prop_NumProps][State_NumStates]; 00135 00136 // These members are caching elements only 00137 tGuiPos mSliderPos; 00138 tGuiPos mSliderSize; 00139 tFloat mValueToPosScale; 00140 00141 // States 00142 tBool mOverSlider; 00143 tBool mDownOnSlider; 00144 tGuiPos mDownOffset; 00145 00146 # ifdef N2L_PASSIVE_GUI_REG 00147 static tBool smRegistered; 00148 # endif 00149 00150 }; // class 00151 00152 } // namespace n2l 00153 00154 #endif |