00001 #ifndef EDITABLE_INT_H 00002 #define EDITABLE_INT_H 00003 00004 #include "AbstractEditable.h" 00005 #include "Editor_Int.h" 00006 #include <string> 00007 00008 class VEditable_Int : public VAbstractEditable 00009 { 00010 protected: 00011 int m_nValue; 00012 public: 00013 VEditable_Int( ) { m_nValue = 0; } 00014 VEditable_Int( int n ) { m_nValue = n; } 00015 VEditable_Int( const VEditable_Int& i ) { m_nValue = i.m_nValue; } 00016 00017 void operator=(int n) {m_nValue = n;} 00018 00019 int operator+(int n) {return m_nValue + n;} 00020 int operator-(int n) {return m_nValue - n;} 00021 float operator*(int n) {return (float) m_nValue * n;} 00022 float operator/(int n) {return (float)m_nValue / n;} 00023 00024 void operator++() {m_nValue++;} 00025 void operator--() {m_nValue--;} 00026 00027 void operator+=(int n) {m_nValue += n;} 00028 void operator-=(int n) {m_nValue -= n;} 00029 void operator*=(int n) {m_nValue *= n;} 00030 void operator/=(int n) {m_nValue /= n;} 00031 00032 operator int() { return m_nValue; } 00033 int* operator &() { return &m_nValue; } 00034 00035 00037 VAbstractEditor* CreateEditor() 00038 { 00039 VAbstractEditor *p = new VEditor_Int( &m_nValue ); 00040 if (p == NULL) 00041 return (VAbstractEditor*) VOUTOFMEMORYCONSTANT; 00042 00043 return p; 00044 } 00045 00046 int ControllerCount() const { return 1; } 00047 00048 00049 string ControllerInfo( int index ) const 00050 { 00051 switch (index) { 00052 case 0: 00053 return string("Key Controller"); 00054 } 00055 } 00056 }; 00057 00058 #endif