31 #include <wx/renderer.h>
34 bool SplitButton::Create(wxWindow* parent, wxWindowID
id,
const wxString& label,
const wxPoint& pos,
const wxSize& size,
const wxString& name)
36 if (!wxPanel::Create(parent,
id, pos, size, wxBORDER_NONE | wxTAB_TRAVERSAL))
42 if (size == wxDefaultSize)
105 event.GetPosition(&x, &y);
109 wxEvtHandler* pEventHandler = GetEventHandler();
110 wxASSERT(pEventHandler);
112 pEventHandler->CallAfter([=]()
114 wxCommandEvent evt(wxEVT_BUTTON, this->GetId());
115 evt.SetEventObject(
this);
116 GetEventHandler()->ProcessEvent(evt);
127 event.GetPosition(&x, &y);
135 wxSize size = GetSize();
138 position.y = size.GetHeight();
161 wxSize size = GetSize();
168 r1.width = width + 2;
169 r1.height = size.GetHeight();
171 wxRendererNative::Get().DrawPushButton(
this, dc, r1,
m_stateButton);
172 dc.SetTextForeground(wxSystemSettings::GetColour(
m_IsEnabled ? wxSYS_COLOUR_BTNTEXT : wxSYS_COLOUR_GRAYTEXT));
180 dc.DrawLabel(
m_label, r1, wxALIGN_CENTER);
188 r2.height = size.GetHeight();
190 wxRendererNative::Get().DrawPushButton(
this, dc, r2,
m_stateMenu);
191 wxRendererNative::Get().DrawDropArrow(
this, dc, r2,
m_stateMenu);
201 wxSize size = wxButton::GetDefaultSize();
202 wxSize textSize = GetTextExtent(
m_label);
211 bitmapSize.IncBy(0, 8);
214 size.SetWidth(
std::max(size.GetWidth(), bitmapSize.GetWidth() + textSize.GetWidth()));
215 size.SetHeight(
std::max(size.GetHeight(),
std::max(bitmapSize.GetHeight(), textSize.GetHeight())));
218 size.SetHeight(size.GetHeight() + 7);
221 InvalidateBestSize();
285 control->Create(m_parentAsWindow, GetID(), GetText(wxT(
"label")), GetPosition(), GetSize(), GetName());
286 if (GetParamNode(
"bitmap"))
288 control->SetBitmap(GetBitmap(
"bitmap", wxART_BUTTON));
291 SetupWindow(control);
297 return IsOfClass(node, wxT(
"SplitButton"));
IMPLEMENT_DYNAMIC_CLASS(wxTreeListHeaderWindow, wxWindow)