mirror of
https://gitea.wildfiregames.com/0ad/0ad
synced 2026-06-18 22:33:56 -07:00
39 lines
807 B
C++
39 lines
807 B
C++
|
|
#include "stdafx.h"
|
||
|
|
|
||
|
|
#include "ToolButton.h"
|
||
|
|
#include "ScenarioEditor/Tools/Common/Tools.h"
|
||
|
|
|
||
|
|
BEGIN_EVENT_TABLE(ToolButton, wxButton)
|
||
|
|
EVT_BUTTON(wxID_ANY, ToolButton::OnClick)
|
||
|
|
END_EVENT_TABLE()
|
||
|
|
|
||
|
|
void ToolButton::OnClick(wxCommandEvent& evt)
|
||
|
|
{
|
||
|
|
if (g_Current)
|
||
|
|
g_Current->SetSelectedAppearance(false);
|
||
|
|
|
||
|
|
// Toggle on/off
|
||
|
|
if (g_Current == this)
|
||
|
|
{
|
||
|
|
g_Current = NULL;
|
||
|
|
SetSelectedAppearance(false);
|
||
|
|
SetCurrentTool(_T(""));
|
||
|
|
}
|
||
|
|
else
|
||
|
|
{
|
||
|
|
g_Current = this;
|
||
|
|
SetSelectedAppearance(true);
|
||
|
|
SetCurrentTool(m_Tool);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
void ToolButton::SetSelectedAppearance(bool selected)
|
||
|
|
{
|
||
|
|
if (selected)
|
||
|
|
SetBackgroundColour(wxColour(0xee, 0xcc, 0x55));
|
||
|
|
else
|
||
|
|
SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE));
|
||
|
|
}
|
||
|
|
|
||
|
|
ToolButton* ToolButton::g_Current = NULL;
|