forked from 0ad/0ad
28 lines
561 B
C++
28 lines
561 B
C++
class ActionButton : public wxButton
|
|
{
|
|
typedef void (*actionFun)(void* data);
|
|
|
|
public:
|
|
ActionButton(wxWindow *parent,
|
|
const wxString& label,
|
|
actionFun fun,
|
|
void* data,
|
|
const wxSize& size = wxDefaultSize,
|
|
long style = 0)
|
|
: wxButton(parent, wxID_ANY, label, wxDefaultPosition, size, style),
|
|
m_Fun(fun), m_Data(data)
|
|
{
|
|
}
|
|
|
|
protected:
|
|
virtual void OnClick(wxCommandEvent&)
|
|
{
|
|
m_Fun(m_Data);
|
|
}
|
|
|
|
private:
|
|
actionFun m_Fun;
|
|
void* m_Data;
|
|
DECLARE_EVENT_TABLE();
|
|
};
|