KiCad PCB EDA Suite
Loading...
Searching...
No Matches
wx_bitmap_combobox.cpp
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 3
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, you may find one here:
18 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
19 * or you may search the http://www.gnu.org website for the version 2 license,
20 * or you may write to the Free Software Foundation, Inc.,
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
22 */
23
25#include <wx/textctrl.h>
26
27WX_BITMAP_COMBOBOX::WX_BITMAP_COMBOBOX( wxWindow* parent, wxWindowID id, const wxString& value,
28 const wxPoint& pos, const wxSize& size, int n,
29 const wxString choices[], long style,
30 const wxValidator& validator, const wxString& name ) :
31 wxBitmapComboBox( parent, id, value, pos, size, n, choices, style, validator, name )
32{
33}
34
35
37{
38 wxSize size = wxBitmapComboBox::DoGetBestSize();
39
40#ifdef __WXGTK__
41 // wxWidgets has a bug on GTK where the wxBitmapComboBox doesn't scale correctly with fontsize.
42 // The following hack is incomplete, but gets around the worst of it. The hack can be removed
43 // once https://github.com/wxWidgets/wxWidgets/issues/25468 is fixed.
44 wxTextCtrl dummyCtrl( m_parent, wxID_ANY );
45 int dummyWidth = 100;
46
47 size.y = std::max( size.y, dummyCtrl.GetBestHeight( dummyWidth ) + 4 );
48#endif
49
50 return size;
51}
52
53
const char * name
wxSize DoGetBestSize() const override
WX_BITMAP_COMBOBOX(wxWindow *parent, wxWindowID id=wxID_ANY, const wxString &value=wxEmptyString, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, int n=0, const wxString choices[]=NULL, long style=0, const wxValidator &validator=wxDefaultValidator, const wxString &name=wxASCII_STR(wxBitmapComboBoxNameStr))