Go to the documentation of this file.00001 #include "widget.h"
00002 #include "item.h"
00003
00004 iil4mitkItem::iil4mitkItem ()
00005 : _x (0.0), _y (0.0), _red (1.0), _green (1.0), _blue (1.0), _alpha (1.0), _lineWidth (0.0), _constraint (0), _visible (true), _pickable (false), _scalable (true)
00006 {
00007 }
00008
00009 void
00010 iil4mitkItem::remove (iil4mitkWidget* )
00011 {
00012 }
00013
00014 void
00015 iil4mitkItem::move (const float x, const float y)
00016 {
00017 _x = x;
00018 _y = y;
00019 }
00020
00021 float
00022 iil4mitkItem::x () const
00023 {
00024 return _x;
00025 }
00026
00027 float
00028 iil4mitkItem::y () const
00029 {
00030 return _y;
00031 }
00032
00033 float
00034 iil4mitkItem::width () const
00035 {
00036 return 0.0;
00037 }
00038
00039 float
00040 iil4mitkItem::height () const
00041 {
00042 return 0.0;
00043 }
00044
00045
00046 void
00047 iil4mitkItem::setColor (const float red, const float green, const float blue, const float alpha)
00048 {
00049 _red = red;
00050 _green = green;
00051 _blue = blue;
00052 _alpha = alpha;
00053 }
00054
00055 float
00056 iil4mitkItem::red () const
00057 {
00058 return _red;
00059 }
00060
00061 float
00062 iil4mitkItem::green () const
00063 {
00064 return _green;
00065 }
00066
00067 float
00068 iil4mitkItem::blue () const
00069 {
00070 return _blue;
00071 }
00072
00073 float
00074 iil4mitkItem::alpha () const
00075 {
00076 return _alpha;
00077 }
00078
00079 void
00080 iil4mitkItem::setLineWidth (const float width)
00081 {
00082 _lineWidth = width;
00083 }
00084
00085 float
00086 iil4mitkItem::lineWidth () const
00087 {
00088 return _lineWidth;
00089 }
00090
00091 void
00092 iil4mitkItem::setPickable (const bool on)
00093 {
00094 _pickable = on;
00095 }
00096
00097 bool
00098 iil4mitkItem::pickable () const
00099 {
00100 return _pickable;
00101 }
00102
00103 iil4mitkItem*
00104 iil4mitkItem::picked (iil4mitkWidget*, const float x, const float y)
00105 {
00106 if (!pickable () || !visible ()) return NULL;
00107
00108 bool p = !((x < this->x ()) || (y < this->y ()) || (x > this->x () + this->width ()) || (y > this->y () + this->height ()));
00109 iil4mitkItem* obj = (p ? this : NULL);
00110 return obj;
00111 }
00112
00113 void
00114 iil4mitkItem::setScalable (const bool scalable)
00115 {
00116 _scalable = scalable;
00117 }
00118
00119 bool
00120 iil4mitkItem::scalable () const
00121 {
00122 return _scalable;
00123 }
00124
00125 void
00126 iil4mitkItem::setConstraint (iil4mitkWidget* widget) {
00127 _constraint = widget;
00128 }
00129
00130 iil4mitkWidget*
00131 iil4mitkItem::constraint () const
00132 {
00133 return _constraint;
00134 }
00135
00136 void
00137 iil4mitkItem::setVisible (const bool visible)
00138 {
00139 _visible = visible;
00140 }
00141
00142 bool
00143 iil4mitkItem::visible () const
00144 {
00145 return _visible;
00146 }
00147
00148 void
00149 iil4mitkItem::hide ()
00150 {
00151 setVisible (false);
00152 }
00153
00154 void
00155 iil4mitkItem::show ()
00156 {
00157 setVisible (true);
00158 }