equal
deleted
inserted
replaced
14 #include "../variables.h" |
14 #include "../variables.h" |
15 #include "../table/sprites.h" |
15 #include "../table/sprites.h" |
16 #include "../genworld.h" |
16 #include "../genworld.h" |
17 #include "../helpers.hpp" |
17 #include "../helpers.hpp" |
18 #include "window_events.hpp" |
18 #include "window_events.hpp" |
|
19 #include "widget_types.h" |
19 |
20 |
20 namespace gui { |
21 namespace gui { |
21 |
22 |
22 void Button::OnCapturePressed(EvtMouseOver &e) |
23 void Button::OnCapturePressed(EvtMouseOver &e) |
23 { |
24 { |
57 /*virtual*/ void Button::DrawBackground(EvtPaint &ev) |
58 /*virtual*/ void Button::DrawBackground(EvtPaint &ev) |
58 { |
59 { |
59 DrawFrameRect(m_color, m_pushed ? FR_LOWERED : FR_NONE); |
60 DrawFrameRect(m_color, m_pushed ? FR_LOWERED : FR_NONE); |
60 } |
61 } |
61 |
62 |
62 /*virtual*/ void Button::OnLeftButtonDown(EvtLeftButtonDown &ev) |
63 /*virtual*/ void Button::OnLeftButtonDown(EvtLeftButtonDown &e) |
63 { |
64 { |
64 /* start capturing mouse move events */ |
65 if ((m_feature_flags & FF_TOGGLE_BUTTON) != FF_NONE) { |
65 m_ticket_pressed = CaptureEventsT(this, &Button::OnCapturePressed); |
66 /* toggle button */ |
|
67 m_pushed = !m_pushed; |
66 |
68 |
67 /* push the button */ |
69 /* issue click event */ |
68 m_pushed = true; |
70 EvtLeftClick ev(e.m_pt); |
|
71 ev.m_widget = this; |
|
72 OnLeftClick(ev); |
|
73 } else { |
|
74 /* push button */ |
|
75 m_pushed = true; |
|
76 |
|
77 /* start capturing mouse move events */ |
|
78 m_ticket_pressed = CaptureEventsT(this, &Button::OnCapturePressed); |
|
79 } |
69 Invalidate(); |
80 Invalidate(); |
70 |
81 e.SetHandled(); |
71 ev.SetHandled(); |
|
72 } |
82 } |
73 |
83 |
74 |
84 |
75 |
85 |
76 }; // namespace gui |
86 }; // namespace gui |