CrystalSpace

Public API Reference

Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

csws/csspinbx.h

Go to the documentation of this file.
00001 /*
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 __CS_CSSPINBX_H__
00021 #define __CS_CSSPINBX_H__
00022 
00031 #include "cscomp.h"
00032 #include "cstimer.h"
00033 #include "csiline.h"
00034 #include "csutil/stringarray.h"
00035 
00037 struct csSpinBoxItem
00038 {
00040   char *Value;
00042   int Position;
00043 };
00044 
00048 
00049 #define CSSB_ITEM_BEFOREALL     0
00050 
00051 #define CSSB_ITEM_AFTERALL      999999
00052 
00054 
00055 struct csSpinBoxLimits
00056 {
00057   int MinValue,MaxValue;
00058   char *ValueFormat;
00059 };
00060 
00062 enum
00063 {
00070   cscmdSpinBoxQueryValue = 0x00000A00,
00077   cscmdSpinBoxSetValue,
00085   cscmdSpinBoxInsertItem,
00092   cscmdSpinBoxSetLimits,
00099   cscmdSpinBoxValueChanged
00100 };
00101 
00107 class csSpinBox : public csInputLine
00108 {
00110   int Value;
00112   csStringArray Values;
00114   csSpinBoxLimits NumLimits;
00116   int SpinState;
00118   csTimer *SpinTimer;
00120   int SpinBoxSize;
00122   int AutoRepeats;
00123 
00124 public:
00126   csSpinBox (csComponent *iParent,
00127     csInputLineFrameStyle iFrameStyle = csifsThickRect);
00128 
00130   virtual ~csSpinBox ();
00131 
00133   virtual void Draw ();
00134 
00136   virtual bool HandleEvent (iEvent &Event);
00137 
00139   void SetLimits (int iMin, int iMax, char *iFormat = "%d");
00140 
00147   void SetValue (int iValue);
00148 
00150   int InsertItem (char *iValue, int iPosition);
00151 
00153   virtual void SetText (const char *iText);
00154 
00155 private:
00157   void Spin (int iDelta);
00159   void Spin ();
00160 };
00161 
00164 #endif // __CS_CSSPINBX_H__

Generated for Crystal Space by doxygen 1.2.18