Browse Source
Insert a cover for wxBitmapCombobox.
Insert a cover for wxBitmapCombobox.
(This will allow us to hack-fix wxWidgets' bug for determining the height when fonts are scaled. This commit includes such a fix, but I have no idea if this particular one will work or not.)pull/18/head
10 changed files with 110 additions and 19 deletions
-
1common/CMakeLists.txt
-
52common/widgets/wx_bitmap_combobox.cpp
-
4eeschema/dialogs/dialog_pin_properties_base.cpp
-
2eeschema/dialogs/dialog_pin_properties_base.fbp
-
4eeschema/dialogs/dialog_pin_properties_base.h
-
7eeschema/widgets/pinshape_combobox.cpp
-
4eeschema/widgets/pinshape_combobox.h
-
7eeschema/widgets/pintype_combobox.cpp
-
6eeschema/widgets/pintype_combobox.h
-
42include/widgets/wx_bitmap_combobox.h
@ -0,0 +1,52 @@ |
|||
/*
|
|||
* This program source code file is part of KiCad, a free EDA CAD application. |
|||
* |
|||
* Copyright The KiCad Developers, see AUTHORS.txt for contributors. |
|||
* |
|||
* This program is free software; you can redistribute it and/or |
|||
* modify it under the terms of the GNU General Public License |
|||
* as published by the Free Software Foundation; either version 3 |
|||
* of the License, or (at your option) any later version. |
|||
* |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program; if not, you may find one here: |
|||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|||
* or you may search the http://www.gnu.org website for the version 2 license,
|
|||
* or you may write to the Free Software Foundation, Inc., |
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA |
|||
*/ |
|||
|
|||
#include <widgets/wx_bitmap_combobox.h>
|
|||
#include <wx/textctrl.h>
|
|||
|
|||
WX_BITMAP_COMBOBOX::WX_BITMAP_COMBOBOX( wxWindow* parent, wxWindowID id, const wxString& value, |
|||
const wxPoint& pos, const wxSize& size, int n, |
|||
const wxString choices[], long style, |
|||
const wxValidator& validator, const wxString& name ) : |
|||
wxBitmapComboBox( parent, id, value, pos, size, n, choices, style, validator, name ) |
|||
{ |
|||
} |
|||
|
|||
|
|||
wxSize WX_BITMAP_COMBOBOX::DoGetBestSize() const |
|||
{ |
|||
wxSize size = wxBitmapComboBox::DoGetBestSize(); |
|||
|
|||
#ifdef __WXGTK__
|
|||
// wxWidgets has a bug on GTK where the wxBitmapComboBox doesn't scale correctly with scaled
|
|||
// fonts. This is a bit of a hack to get around it.
|
|||
wxTextCtrl dummyCtrl( m_parent, wxID_ANY ); |
|||
int dummyWidth = 100; |
|||
|
|||
size.y = std::max( size.y, dummyCtrl.GetBestHeight( dummyWidth ) ); |
|||
#endif
|
|||
|
|||
return size; |
|||
} |
|||
|
|||
|
|||
@ -0,0 +1,42 @@ |
|||
/* |
|||
* This program source code file is part of KiCad, a free EDA CAD application. |
|||
* |
|||
* Copyright The KiCad Developers, see AUTHORS.txt for contributors. |
|||
* |
|||
* This program is free software; you can redistribute it and/or |
|||
* modify it under the terms of the GNU General Public License |
|||
* as published by the Free Software Foundation; either version 3 |
|||
* of the License, or (at your option) any later version. |
|||
* |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program; if not, you may find one here: |
|||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html |
|||
* or you may search the http://www.gnu.org website for the version 2 license, |
|||
* or you may write to the Free Software Foundation, Inc., |
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA |
|||
*/ |
|||
|
|||
#ifndef WX_BITMAP_COMBOBOX_H |
|||
#define WX_BITMAP_COMBOBOX_H |
|||
|
|||
#include <wx/bmpcbox.h> |
|||
|
|||
class WX_BITMAP_COMBOBOX : public wxBitmapComboBox |
|||
{ |
|||
public: |
|||
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 ) ); |
|||
|
|||
wxSize DoGetBestSize() const override; |
|||
}; |
|||
|
|||
|
|||
#endif //WX_BITMAP_COMBOBOX_H |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue