00001
00002
00003
00004
00005
00006
00007
00008
00009 #include "RadioBox.h"
00010
00011 #include "WiPicture.h"
00012 #include "OptionAgent.h"
00013 #include "MouseStroke.h"
00014
00015
00016 RadioBox::RadioBox(const std::string ¶m, const std::string &value,
00017 const Path &picture)
00018 : WiContainer(new WiPicture(picture), BORDER), m_param(param), m_value(value)
00019 {
00020 }
00021
00022
00023
00024
00025 void
00026 RadioBox::drawOn(SDL_Surface *screen)
00027 {
00028 if (OptionAgent::agent()->getParam(m_param) == m_value) {
00029 SDL_Rect rect;
00030 rect.x = m_shift.getX();
00031 rect.y = m_shift.getY();
00032 rect.w = getW();
00033 rect.h = getH();
00034
00035 Uint32 green = SDL_MapRGB(screen->format, 0x00, 0xff, 0x00);
00036 SDL_FillRect(screen, &rect, green);
00037 }
00038 WiContainer::drawOn(screen);
00039 }
00040
00041
00042
00043
00044 void
00045 RadioBox::own_mouseButton(const MouseStroke &stroke)
00046 {
00047 if (stroke.isLeft()) {
00048 OptionAgent::agent()->setPersistent(m_param, m_value);
00049 }
00050 }
00051