/* $Id$ */
#include "../stdafx.h"
#include <stdarg.h>
#include "../openttd.h"
#include "../debug.h"
#include "../functions.h"
#include "../map.h"
#include "../player.h"
#include "../window.h"
#include "../gfx.h"
#include "../viewport.h"
#include "../console.h"
#include "../variables.h"
#include "../table/sprites.h"
#include "../genworld.h"
#include "../helpers.hpp"
#include "window_events.hpp"
namespace gui {
void Button::OnCapturePressed(EvtMouseOver &e)
{
if (_left_button_down) {
e.SetHandled();
return;
}
m_pushed = false;
m_ticket_pressed.Release();
EvtClick ev(Point(0, 0));
ev.m_widget = this;
CallHandlers(ev);
}
/*virtual*/ void Button::DrawBackground(EvtPaint &ev)
{
DrawFrameRect(m_color, m_pushed ? FR_LOWERED : FR_NONE);
}
/*virtual*/ void Button::OnLeftClick(EvtClick &ev)
{
m_pushed = true;
ev.SetHandled();
m_ticket_pressed = CaptureEventsT(this, &Button::OnCapturePressed);
Invalidate();
}
}; // namespace gui