00001
00011
00012 #ifdef _MSC_VER
00013 #include "msdevstudio/MSconfig.h"
00014 #endif
00015
00016 #include "RepBase.h"
00017
00018 #include "graphics/ViewBase.h"
00019
00020 using std::string;
00021
00022 using namespace hippodraw;
00023
00024 const Color RepBase::s_desel_color ( 225, 225, 225 );
00025
00026 RepBase::RepBase ( const char * string, float size )
00027 : m_name ( string ),
00028 m_size ( size ),
00029 m_desel ( false )
00030 {
00031 }
00032
00033 RepBase::RepBase ( const RepBase & rep )
00034 : m_name ( rep.m_name ),
00035 m_text ( rep.m_text ),
00036 m_color ( rep.m_color ),
00037 m_size ( rep.m_size ),
00038 m_desel ( rep.m_desel )
00039 {
00040 }
00041
00042
00043 RepBase::~RepBase ()
00044 {
00045 }
00046
00047 const string & RepBase::name () const
00048 {
00049 return m_name;
00050 }
00051
00052 void
00053 RepBase::setColor ( const Color & color )
00054 {
00055 m_color = color;
00056 }
00057
00058 const Color & RepBase::getColor () const
00059 {
00060 return m_color;
00061 }
00062
00063 const Color & RepBase::color () const
00064 {
00065 if ( m_desel ) {
00066 return s_desel_color;
00067 }
00068
00069 return m_color;
00070 }
00071
00072 void RepBase::setSelected ( bool yes )
00073 {
00074 m_desel = !yes;
00075 }
00076
00077 bool
00078 RepBase::
00079 isSelected () const
00080 {
00081 return m_desel == false;
00082 }
00083
00084 void
00085 RepBase::
00086 setHighLighted ( bool yes )
00087 {
00088 m_highlite = yes;
00089 }
00090
00091 float RepBase::size () const
00092 {
00093 return m_size;
00094 }
00095
00096 void RepBase::setSize ( float size )
00097 {
00098 m_size = size;
00099 }
00100
00101 void
00102 RepBase::
00103 setStyle ( unsigned int )
00104 {
00105
00106 }
00107
00108 unsigned int
00109 RepBase::
00110 getStyle ( ) const
00111 {
00112 return 0;
00113 }
00114
00115
00116 bool RepBase::xError () const
00117 {
00118 return false;
00119 }
00120
00121
00122 bool RepBase::yError () const
00123 {
00124 return false;
00125 }
00126
00127 void
00128 RepBase::
00129 setErrorOn ( Axes::Type, bool )
00130 {
00131 }
00132
00133 void RepBase::setText ( const std::string & text )
00134 {
00135 m_text = text;
00136 }
00137
00138 const std::string &
00139 RepBase::getText() const
00140 {
00141 return m_text;
00142 }
00143
00144
00145 const BinToColor *
00146 RepBase::
00147 getValueTransform () const
00148 {
00149 return 0;
00150 }
00151
00152 void
00153 RepBase::
00154 setValueTransform ( BinToColor * )
00155 {
00156
00157 }
00158
00159 void
00160 RepBase::
00161 displayError ( ViewBase & view )
00162 {
00163 string error ( "Error: " );
00164 error += m_name;
00165 error += " can not be displayed.";
00166 view.drawText ( error, 5.0, 0.0, m_size, 0, 'l', 't', true );
00167 }
00168
00169 bool
00170 RepBase::
00171 uses ( Color::Value ) const
00172 {
00173 return true;
00174 }
00175
00176 bool
00177 RepBase::
00178 uses ( Line::Style ) const
00179 {
00180 return false;
00181 }
00182
00183 bool
00184 RepBase::
00185 uses ( Symbol::Type ) const
00186 {
00187 return false;
00188 }