Fixed height of features type combo popup when building against wxWidgets 3.1.3

This commit is contained in:
enricoturri1966 2020-06-30 12:53:42 +02:00
parent b20fe43090
commit feb4857cf8
2 changed files with 4 additions and 9 deletions

View file

@ -174,7 +174,6 @@ wxMenuItem* append_menu_check_item(wxMenu* menu, int id, const wxString& string,
const unsigned int wxCheckListBoxComboPopup::DefaultWidth = 200;
const unsigned int wxCheckListBoxComboPopup::DefaultHeight = 200;
const unsigned int wxCheckListBoxComboPopup::DefaultItemHeight = 18;
bool wxCheckListBoxComboPopup::Create(wxWindow* parent)
{
@ -202,20 +201,17 @@ wxSize wxCheckListBoxComboPopup::GetAdjustedSize(int minWidth, int prefHeight, i
// and set height dinamically in dependence of items count
wxComboCtrl* cmb = GetComboCtrl();
if (cmb != nullptr)
{
if (cmb != nullptr) {
wxSize size = GetComboCtrl()->GetSize();
unsigned int count = GetCount();
if (count > 0)
{
if (count > 0) {
int max_width = size.x;
for (unsigned int i = 0; i < count; ++i)
{
for (unsigned int i = 0; i < count; ++i) {
max_width = std::max(max_width, 60 + GetTextExtent(GetString(i)).x);
}
size.SetWidth(max_width);
size.SetHeight(4 + count * (2 + GetTextExtent(GetString(0)).y));
size.SetHeight(count * cmb->GetCharHeight());
}
else
size.SetHeight(DefaultHeight);

View file

@ -63,7 +63,6 @@ class wxCheckListBoxComboPopup : public wxCheckListBox, public wxComboPopup
{
static const unsigned int DefaultWidth;
static const unsigned int DefaultHeight;
static const unsigned int DefaultItemHeight;
wxString m_text;