00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
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