GLWCheckBoxText.cpp

Go to the documentation of this file.
00001 ////////////////////////////////////////////////////////////////////////////////
00002 //    Scorched3D (c) 2000-2009
00003 //
00004 //    This file is part of Scorched3D.
00005 //
00006 //    Scorched3D is free software; you can redistribute it and/or modify
00007 //    it under the terms of the GNU General Public License as published by
00008 //    the Free Software Foundation; either version 2 of the License, or
00009 //    (at your option) any later version.
00010 //
00011 //    Scorched3D is distributed in the hope that it will be useful,
00012 //    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 //    GNU General Public License for more details.
00015 //
00016 //    You should have received a copy of the GNU General Public License
00017 //    along with Scorched3D; if not, write to the Free Software
00018 //    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
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 }

Generated on Mon Feb 16 15:14:45 2009 for Scorched3D by  doxygen 1.5.3