Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

pgspinnerbox.h

Go to the documentation of this file.
00001 /*
00002     ParaGUI - crossplatform widgetset
00003     Copyright (C) 2000,2001,2002  Alexander Pipelka
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     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018  
00019     Alexander Pipelka
00020     pipelka@teleweb.at
00021  
00022     Last Update:      $Author: mbickel $
00023     Update Date:      $Date: 2007-04-13 16:15:57 $
00024     Source File:      $Source: /home/cvspsrv/cvsroot/games/asc/source/libs/paragui/include/pgspinnerbox.h,v $
00025     CVS/RCS Revision: $Revision: 1.2 $
00026     Status:           $State: Exp $
00027 */
00028 
00033 #ifndef PG_SPINNERBOX_H
00034 #define PG_SPINNERBOX_H
00035 
00036 #include "pgthemewidget.h"
00037 
00038 class PG_Button;
00039 class PG_MaskEdit;
00040 class PG_LineEdit;
00041 
00061 class DECLSPEC PG_SpinnerBox : public PG_ThemeWidget {
00062 public:
00063 
00067         template<class datatype>
00068 class SignalChange : public PG_Signal2<PG_SpinnerBox*, datatype> {}
00069         ;
00070 
00071         enum {
00072             IDSPINNERBOX_UP = PG_WIDGETID_INTERNAL + 12,
00073             IDSPINNERBOX_DOWN = PG_WIDGETID_INTERNAL + 13
00074         };
00075 
00078         PG_SpinnerBox(PG_Widget *parent, const PG_Rect& r = PG_Rect::null, const std::string& style = "SpinnerBox");
00079 
00080         void SetValue(int value) {
00081                 m_iValue = value;
00082                 SetTextValue();
00083         }
00084         void SetMinValue( int value ) {
00085                 m_iMinValue = value;
00086         }
00087         void SetMaxValue( int value ) {
00088                 m_iMaxValue = value;
00089         }
00090 
00091         void SetMask( const std::string& value );
00092 
00093         int GetValue() {
00094                 return( m_iValue );
00095         }
00096         int GetMinValue() {
00097                 return( m_iMinValue );
00098         }
00099         int GetMaxValue() {
00100                 return( m_iMaxValue );
00101         }
00102         const PG_String& GetMask() {
00103                 return( m_sMask );
00104         }
00105 
00106         SignalChange<int> sigChange;
00107 
00108 protected:
00109 
00110         bool handleButtonClick(PG_Button* button);
00111 
00112         bool handleEditEnd(PG_LineEdit* edit);
00113 
00114 private:
00115 
00116         DLLLOCAL void SetTextValue();
00117 
00118         DLLLOCAL void AdjustSize();
00119 
00120         PG_Widget* m_pParent;
00121 
00122         PG_MaskEdit* m_pEditBox;
00123 
00124         PG_Button* m_pButtonUp;
00125 
00126         PG_Button* m_pButtonDown;
00127 
00128         int m_iMinValue;
00129 
00130         int m_iMaxValue;
00131 
00132         int m_iValue;
00133 
00134         PG_String m_sMask;
00135 
00136 };
00137 
00138 #endif  // PG_SPINNERBOX_H

Generated on Tue Jun 24 01:27:49 2008 for Advanced Strategic Command by  doxygen 1.4.2