From 671efb02c9bae61d19578a376c24e466d9965886 Mon Sep 17 00:00:00 2001
From: YuSanka <yusanka@gmail.com>
Date: Tue, 23 Feb 2021 10:02:41 +0100
Subject: [PATCH] Fix of #6110 - Preview: View Menu/List placement incorrect
 Use wxComboBox with wxCB_READONLY flag instead of wxChoice

---
 src/slic3r/GUI/GUI_Preview.cpp | 7 ++++---
 src/slic3r/GUI/GUI_Preview.hpp | 4 ++--
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/slic3r/GUI/GUI_Preview.cpp b/src/slic3r/GUI/GUI_Preview.cpp
index 67f724f27..76677660d 100644
--- a/src/slic3r/GUI/GUI_Preview.cpp
+++ b/src/slic3r/GUI/GUI_Preview.cpp
@@ -18,6 +18,7 @@
 #include <wx/stattext.h>
 #include <wx/choice.h>
 #include <wx/combo.h>
+#include <wx/combobox.h>
 #include <wx/checkbox.h>
 
 // this include must follow the wxWidgets ones or it won't compile on Windows -> see http://trac.wxwidgets.org/ticket/2421
@@ -204,7 +205,7 @@ bool Preview::init(wxWindow* parent, Model* model)
 
     m_bottom_toolbar_panel = new wxPanel(this);
     m_label_view_type = new wxStaticText(m_bottom_toolbar_panel, wxID_ANY, _L("View"));
-    m_choice_view_type = new wxChoice(m_bottom_toolbar_panel, wxID_ANY);
+    m_choice_view_type = new wxComboBox(m_bottom_toolbar_panel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_READONLY);
     m_choice_view_type->Append(_L("Feature type"));
     m_choice_view_type->Append(_L("Height"));
     m_choice_view_type->Append(_L("Width"));
@@ -415,7 +416,7 @@ void Preview::edit_layers_slider(wxKeyEvent& evt)
 void Preview::bind_event_handlers()
 {
     this->Bind(wxEVT_SIZE, &Preview::on_size, this);
-    m_choice_view_type->Bind(wxEVT_CHOICE, &Preview::on_choice_view_type, this);
+    m_choice_view_type->Bind(wxEVT_COMBOBOX, &Preview::on_choice_view_type, this);
     m_combochecklist_features->Bind(wxEVT_CHECKLISTBOX, &Preview::on_combochecklist_features, this);
     m_combochecklist_options->Bind(wxEVT_CHECKLISTBOX, &Preview::on_combochecklist_options, this);
     m_moves_slider->Bind(wxEVT_SCROLL_CHANGED, &Preview::on_moves_slider_scroll_changed, this);
@@ -424,7 +425,7 @@ void Preview::bind_event_handlers()
 void Preview::unbind_event_handlers()
 {
     this->Unbind(wxEVT_SIZE, &Preview::on_size, this);
-    m_choice_view_type->Unbind(wxEVT_CHOICE, &Preview::on_choice_view_type, this);
+    m_choice_view_type->Unbind(wxEVT_COMBOBOX, &Preview::on_choice_view_type, this);
     m_combochecklist_features->Unbind(wxEVT_CHECKLISTBOX, &Preview::on_combochecklist_features, this);
     m_combochecklist_options->Unbind(wxEVT_CHECKLISTBOX, &Preview::on_combochecklist_options, this);
     m_moves_slider->Unbind(wxEVT_SCROLL_CHANGED, &Preview::on_moves_slider_scroll_changed, this);
diff --git a/src/slic3r/GUI/GUI_Preview.hpp b/src/slic3r/GUI/GUI_Preview.hpp
index 945c6ff96..3bf0e21ae 100644
--- a/src/slic3r/GUI/GUI_Preview.hpp
+++ b/src/slic3r/GUI/GUI_Preview.hpp
@@ -13,7 +13,7 @@ class wxNotebook;
 class wxGLCanvas;
 class wxBoxSizer;
 class wxStaticText;
-class wxChoice;
+class wxComboBox;
 class wxComboCtrl;
 class wxBitmapComboBox;
 class wxCheckBox;
@@ -82,7 +82,7 @@ class Preview : public wxPanel
     wxBoxSizer* m_layers_slider_sizer { nullptr };
     wxPanel* m_bottom_toolbar_panel { nullptr };
     wxStaticText* m_label_view_type { nullptr };
-    wxChoice* m_choice_view_type { nullptr };
+    wxComboBox* m_choice_view_type { nullptr };
     wxStaticText* m_label_show { nullptr };
     wxComboCtrl* m_combochecklist_features { nullptr };
     size_t m_combochecklist_features_pos { 0 };