2 Copyright 2004-2005 Chris Tallon
\r
4 This file is part of VOMP.
\r
6 VOMP is free software; you can redistribute it and/or modify
\r
7 it under the terms of the GNU General Public License as published by
\r
8 the Free Software Foundation; either version 2 of the License, or
\r
9 (at your option) any later version.
\r
11 VOMP is distributed in the hope that it will be useful,
\r
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
14 GNU General Public License for more details.
\r
16 You should have received a copy of the GNU General Public License
\r
17 along with VOMP; if not, write to the Free Software
\r
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
\r
21 #include "wbutton.h"
\r
28 setSize(70, 21/*fontHeight*/);
\r
38 if (mytext) delete[] mytext;
\r
41 void WButton::setText(const char* takeText)
\r
43 int length = strlen(takeText);
\r
44 mytext = new char[length + 1];
\r
45 strcpy(mytext, takeText);
\r
48 void WButton::setActive(UCHAR tactive)
\r
56 // a bolt on for now - an active but dimmed state
\r
61 void WButton::draw()
\r
65 fillColour(Colour::BLACK);
\r
66 drawTextCentre(mytext, area.w / 2, 0, Colour::SELECTHIGHLIGHT);
\r
70 fillColour(Colour::SELECTHIGHLIGHT);
\r
71 drawTextCentre(mytext, area.w / 2, 0, Colour::DARKTEXT);
\r
75 fillColour(Colour::BUTTONBACKGROUND);
\r
76 drawTextCentre(mytext, area.w / 2, 0, Colour::LIGHTTEXT);
\r
80 void WButton::setTag(int newTag)
\r
85 int WButton::getTag()
\r
90 // Sorry, I've broken these in the boxx upgrade - chris
\r
92 bool WButton::mouseMove(int x, int y)
\r
94 if ((x-getRootBoxOffsetX())>=0 && (y-getRootBoxOffsetY())>=0
\r
95 && (x-getRootBoxOffsetX())<=(int)area.w && (y-getRootBoxOffsetY())<=(int)area.h && !active)
\r
103 bool WButton::mouseLBDOWN(int x, int y)
\r
105 if ((x-getRootBoxOffsetX())>=0 && (y-getRootBoxOffsetY())>=0
\r
106 && (x-getRootBoxOffsetX())<=(int)area.w && (y-getRootBoxOffsetY())<=(int)area.h && active)
\r