|
csspinbx.h00001 /* 00002 Crystal Space Windowing System: spin box class 00003 Copyright (C) 1998,1999 by Andrew Zabolotny <bit@eltech.ru> 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Library General Public 00007 License as published by the Free Software Foundation; either 00008 version 2 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 Library General Public License for more details. 00014 00015 You should have received a copy of the GNU Library General Public 00016 License along with this library; if not, write to the Free 00017 Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00018 */ 00019 00020 #ifndef __CSSPINBX_H__ 00021 #define __CSSPINBX_H__ 00022 00023 #include "cscomp.h" 00024 #include "cstimer.h" 00025 #include "csiline.h" 00026 #include "csutil/csstrvec.h" 00027 00029 struct csSpinBoxItem 00030 { 00032 char *Value; 00034 int Position; 00035 }; 00036 00039 #define CSSB_ITEM_BEFOREALL 0 00040 00041 #define CSSB_ITEM_AFTERALL 999999 00042 00043 struct csSpinBoxLimits 00044 { 00045 int MinValue,MaxValue; 00046 char *ValueFormat; 00047 }; 00048 00049 enum 00050 { 00057 cscmdSpinBoxQueryValue = 0x00000A00, 00064 cscmdSpinBoxSetValue, 00072 cscmdSpinBoxInsertItem, 00079 cscmdSpinBoxSetLimits, 00086 cscmdSpinBoxValueChanged 00087 }; 00088 00094 class csSpinBox : public csInputLine 00095 { 00096 // Current spin box value 00097 int Value; 00098 // The list of allowed values; if list is empty, spin box is numerical 00099 csStrVector Values; 00100 // Alternative value limits for numerical content 00101 csSpinBoxLimits NumLimits; 00102 // Spin box state 00103 int SpinState; 00104 // Spin timer 00105 csTimer *SpinTimer; 00106 // spin box size in pixels 00107 int SpinBoxSize; 00108 // Number of autorepeats since spin beginning 00109 int AutoRepeats; 00110 00111 public: 00113 csSpinBox (csComponent *iParent, 00114 csInputLineFrameStyle iFrameStyle = csifsThickRect); 00115 00117 virtual ~csSpinBox (); 00118 00120 virtual void Draw (); 00121 00123 virtual bool HandleEvent (iEvent &Event); 00124 00126 void SetLimits (int iMin, int iMax, char *iFormat = "%d"); 00127 00134 void SetValue (int iValue); 00135 00137 int InsertItem (char *iValue, int iPosition); 00138 00140 virtual void SetText (const char *iText); 00141 00142 private: 00143 // Spin to other value 00144 void Spin (int iDelta); 00145 // Spin value depending on spin box state 00146 void Spin (); 00147 }; 00148 00149 #endif // __CSSPINBX_H__ Generated for Crystal Space by doxygen 1.2.5 written by Dimitri van Heesch, ©1997-2000 |