Debian Codegraph @

src/widget/WiButton.cpp

raw
1 /*
2 * Copyright (C) 2004 Ivo Danihelka ([email protected])
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 */
9 #include "WiButton.h"
10
11 #include "BaseMsg.h"
12 #include "MouseStroke.h"
13
14 //-----------------------------------------------------------------
15 /**
16 * Create button which will send given message on mouse press.
17 */
18 WiButton::WiButton(IWidget *new_content, BaseMsg *new_msg)
19 : WiContainer(new_content)
20 {
21 m_msg = new_msg;
22 }
23 //-----------------------------------------------------------------
24 /**
25 * Release remain message.
26 */
27 WiButton::~WiButton()
28 {
29 delete m_msg;
30 }
31 //-----------------------------------------------------------------
32 void
33 WiButton::own_mouseButton(const MouseStroke &stroke)
34 {
35 if (stroke.isLeft()) {
36 m_msg->sendClone();
37 }
38 }
39