/* orxonox - the future of 3D-vertical-scrollers Copyright (C) 2004 orx This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. ### File Specific: main-programmer: Benjamin Grauer co-programmer: ... */ #include "glgui_imagebutton.h" #include "debug.h" namespace OrxGui { GLGuiImageButton::GLGuiImageButton(const std::string& label, unsigned int levelID, const std::string& imageName, GLGuiImage* image) : GLGuiPushButton(label) { this->imageName = imageName; this->levelID = levelID; this->image = image; image->loadImageFromFile(imageName); } GLGuiImageButton::~GLGuiImageButton() {} void GLGuiImageButton::releasing(const Vector2D& pos, bool focused) { GLGuiPushButton::releasing(pos, focused); if (focused) this->startLevel.emit(this->levelID); } void GLGuiImageButton::receivedFocus() { PRINTF(4)("%s:: %s\n", this->label().c_str(), this->imageName.c_str()); this->image->loadImageFromFile(this->imageName); } void GLGuiImageButton::removedFocus() {} void GLGuiImageButton::showing() { GLGuiPushButton::showing(); //this->image->show(); } void GLGuiImageButton::hiding() { GLGuiPushButton::hiding(); //this->image->hide(); } bool GLGuiImageButton::processEvent(const Event& event) { if (event.type == SDLK_SPACE) { if (event.bPressed) // emit(pushed()); ; else { // emit(released()); startLevel.emit(this->levelID); } return true; } return false; } }