00001 /* 00002 * Copyright (C) 2004 Ivo Danihelka (ivo@danihelka.net) 00003 * 00004 * This program is free software; you can redistribute it and/or modify 00005 * it under the terms of the GNU General Public License as published by 00006 * the Free Software Foundation; either version 2 of the License, or 00007 * (at your option) any later version. 00008 */ 00009 #include "WiButton.h" 00010 00011 #include "BaseMsg.h" 00012 #include "MouseStroke.h" 00013 00014 //----------------------------------------------------------------- 00015 /** 00016 * Create button which will send given message on mouse press. 00017 */ 00018 WiButton::WiButton(IWidget *new_content, BaseMsg *new_msg) 00019 : WiContainer(new_content) 00020 { 00021 m_msg = new_msg; 00022 } 00023 //----------------------------------------------------------------- 00024 /** 00025 * Release remain message. 00026 */ 00027 WiButton::~WiButton() 00028 { 00029 delete m_msg; 00030 } 00031 //----------------------------------------------------------------- 00032 void 00033 WiButton::own_mouseButton(const MouseStroke &stroke) 00034 { 00035 if (stroke.isLeft()) { 00036 m_msg->sendClone(); 00037 } 00038 } 00039