00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include <GLW/GLWCheckBoxText.h>
00022
00023 REGISTER_CLASS_SOURCE(GLWCheckBoxText);
00024
00025 GLWCheckBoxText::GLWCheckBoxText(float x, float y,
00026 const LangString &text,
00027 bool startState,
00028 float offset) :
00029 GLWidget(x, y, 0.0f, 20.0f),
00030 offset_(offset),
00031 box_(x, y, startState),
00032 label_(x + box_.getW() + 5.0f - offset_, y - 2.0f - offset_, text)
00033 {
00034 }
00035
00036 GLWCheckBoxText::~GLWCheckBoxText()
00037 {
00038 }
00039
00040 void GLWCheckBoxText::draw()
00041 {
00042 GLWidget::draw();
00043 box_.draw();
00044 label_.draw();
00045 }
00046
00047 void GLWCheckBoxText::mouseDown(int button, float x, float y, bool &skipRest)
00048 {
00049 GLWidget::mouseDown(button, x, y, skipRest);
00050 box_.mouseDown(button, x, y, skipRest);
00051 label_.mouseDown(button, x, y, skipRest);
00052 }
00053
00054 void GLWCheckBoxText::mouseUp(int button, float x, float y, bool &skipRest)
00055 {
00056 GLWidget::mouseUp(button, x, y, skipRest);
00057 box_.mouseUp(button, x, y, skipRest);
00058 label_.mouseUp(button, x, y, skipRest);
00059 }
00060
00061 void GLWCheckBoxText::mouseDrag(int button, float mx, float my, float x, float y, bool &skipRest)
00062 {
00063 GLWidget::mouseDrag(button, mx, my, x, y, skipRest);
00064 box_.mouseDrag(button, mx, my, x, y, skipRest);
00065 label_.mouseDrag(button, mx, my, x, y, skipRest);
00066 }
00067
00068 float GLWCheckBoxText::getW()
00069 {
00070 return box_.getW() + 5.0f + label_.getW();
00071 }
00072
00073 void GLWCheckBoxText::setX(float x)
00074 {
00075 GLWidget::setX(x);
00076 box_.setX(x);
00077 label_.setX(x + box_.getW() + 5.0f - offset_);
00078 }
00079
00080 void GLWCheckBoxText::setY(float y)
00081 {
00082 GLWidget::setY(y);
00083 box_.setY(y);
00084 label_.setY(y - 2.0f - offset_);
00085 }