penguins  1.0.0
simple_static_box.cc
Go to the documentation of this file.
2 #include <wx/gdicmn.h>
3 #ifdef __WXGTK__
4 #include <wx/stattext.h>
5 #endif
6 
8  wxWindow* parent,
9  wxWindowID id,
10  const wxPoint& pos,
11  const wxSize& size,
12  long style,
13  const wxString& name
14 ) {
15 #ifdef __WXGTK__
16  auto fake_label = new wxStaticText(parent, wxID_ANY, wxEmptyString);
17  if (!wxStaticBox::Create(parent, id, fake_label, pos, size, style, name)) {
18  return false;
19  }
20  // This tricks wxGTK into removing the top border of the static box.
21  fake_label->Destroy();
22  this->m_labelWin = nullptr;
23  return true;
24 #else
25  return wxStaticBox::Create(parent, id, wxEmptyString, pos, size, style, name);
26 #endif
27 }
28 
29 #ifdef __WXGTK__
30 // Get rid of annoying warnings caused by the removal of the GtkFrame's label.
31 bool SimpleStaticBox::GTKWidgetNeedsMnemonic() const {
32  return false;
33 }
34 void SimpleStaticBox::GTKWidgetDoSetMnemonic(GtkWidget* WXUNUSED(w)) {}
35 #endif
bool Create(wxWindow *parent, wxWindowID id, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=0, const wxString &name=wxStaticBoxNameStr)
bool Create(wxWindow *parent, wxWindowID id, const wxString &label, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=0, const wxString &name=wxStaticBoxNameStr)
wxID_ANY
wxString wxEmptyString
int wxWindowID