diff --git a/src/slic3r/CMakeLists.txt b/src/slic3r/CMakeLists.txt index 5ef69d32f..2b6f05204 100644 --- a/src/slic3r/CMakeLists.txt +++ b/src/slic3r/CMakeLists.txt @@ -28,8 +28,6 @@ set(SLIC3R_GUI_SOURCES GUI/Widgets/SideMenuPopup.cpp GUI/Widgets/DropDown.cpp GUI/Widgets/DropDown.hpp - GUI/Widgets/PopupWindow.cpp - GUI/Widgets/PopupWindow.hpp GUI/Widgets/Label.cpp GUI/Widgets/Label.hpp GUI/Widgets/Scrollbar.cpp diff --git a/src/slic3r/GUI/AmsMappingPopup.cpp b/src/slic3r/GUI/AmsMappingPopup.cpp index aa4f0e919..a4ea07c7b 100644 --- a/src/slic3r/GUI/AmsMappingPopup.cpp +++ b/src/slic3r/GUI/AmsMappingPopup.cpp @@ -207,7 +207,7 @@ void MaterialItem::doRender(wxDC &dc) } AmsMapingPopup::AmsMapingPopup(wxWindow *parent) - : PopupWindow(parent, wxBORDER_NONE) + :wxPopupTransientWindow(parent, wxBORDER_NONE) { SetSize(wxSize(FromDIP(360), -1)); SetMinSize(wxSize(FromDIP(360), -1)); @@ -504,7 +504,7 @@ void AmsMapingPopup::OnDismiss() bool AmsMapingPopup::ProcessLeftDown(wxMouseEvent &event) { - return PopupWindow::ProcessLeftDown(event); + return wxPopupTransientWindow::ProcessLeftDown(event); } void AmsMapingPopup::paintEvent(wxPaintEvent &evt) @@ -639,7 +639,7 @@ void MappingItem::doRender(wxDC &dc) } AmsMapingTipPopup::AmsMapingTipPopup(wxWindow *parent) - :PopupWindow(parent, wxBORDER_NONE) + :wxPopupTransientWindow(parent, wxBORDER_NONE) { SetBackgroundColour(*wxWHITE); wxBoxSizer *m_sizer_main = new wxBoxSizer(wxVERTICAL); @@ -739,11 +739,11 @@ void AmsMapingTipPopup::paintEvent(wxPaintEvent &evt) void AmsMapingTipPopup::OnDismiss() {} bool AmsMapingTipPopup::ProcessLeftDown(wxMouseEvent &event) { - return PopupWindow::ProcessLeftDown(event); } + return wxPopupTransientWindow::ProcessLeftDown(event); } AmsHumidityTipPopup::AmsHumidityTipPopup(wxWindow* parent) - :PopupWindow(parent, wxBORDER_NONE) + :wxPopupTransientWindow(parent, wxBORDER_NONE) { SetBackgroundColour(*wxWHITE); @@ -857,11 +857,11 @@ void AmsHumidityTipPopup::paintEvent(wxPaintEvent& evt) void AmsHumidityTipPopup::OnDismiss() {} bool AmsHumidityTipPopup::ProcessLeftDown(wxMouseEvent& event) { - return PopupWindow::ProcessLeftDown(event); + return wxPopupTransientWindow::ProcessLeftDown(event); } AmsTutorialPopup::AmsTutorialPopup(wxWindow* parent) -:PopupWindow(parent, wxBORDER_NONE) +:wxPopupTransientWindow(parent, wxBORDER_NONE) { Bind(wxEVT_PAINT, &AmsTutorialPopup::paintEvent, this); SetBackgroundColour(*wxWHITE); @@ -959,12 +959,12 @@ void AmsTutorialPopup::paintEvent(wxPaintEvent& evt) void AmsTutorialPopup::OnDismiss() {} bool AmsTutorialPopup::ProcessLeftDown(wxMouseEvent& event) { - return PopupWindow::ProcessLeftDown(event); + return wxPopupTransientWindow::ProcessLeftDown(event); } AmsIntroducePopup::AmsIntroducePopup(wxWindow* parent) -:PopupWindow(parent, wxBORDER_NONE) +:wxPopupTransientWindow(parent, wxBORDER_NONE) { Bind(wxEVT_PAINT, &AmsIntroducePopup::paintEvent, this); SetBackgroundColour(*wxWHITE); @@ -1044,7 +1044,7 @@ void AmsIntroducePopup::paintEvent(wxPaintEvent& evt) void AmsIntroducePopup::OnDismiss() {} bool AmsIntroducePopup::ProcessLeftDown(wxMouseEvent& event) { - return PopupWindow::ProcessLeftDown(event); + return wxPopupTransientWindow::ProcessLeftDown(event); } diff --git a/src/slic3r/GUI/AmsMappingPopup.hpp b/src/slic3r/GUI/AmsMappingPopup.hpp index d4e079643..1e461710a 100644 --- a/src/slic3r/GUI/AmsMappingPopup.hpp +++ b/src/slic3r/GUI/AmsMappingPopup.hpp @@ -34,7 +34,6 @@ #include "Widgets/CheckBox.hpp" #include "Widgets/ComboBox.hpp" #include "Widgets/ScrolledWindow.hpp" -#include "Widgets/PopupWindow.hpp" #include #include @@ -114,7 +113,7 @@ public: void doRender(wxDC &dc); }; -class AmsMapingPopup : public PopupWindow +class AmsMapingPopup : public wxPopupTransientWindow { public: AmsMapingPopup(wxWindow *parent); @@ -147,7 +146,7 @@ public: std::vector parse_ams_mapping(std::map amsList); }; -class AmsMapingTipPopup : public PopupWindow +class AmsMapingTipPopup : public wxPopupTransientWindow { public: AmsMapingTipPopup(wxWindow *parent); @@ -167,7 +166,7 @@ public: wxStaticText * m_tip_disable_ams; }; -class AmsHumidityTipPopup : public PopupWindow +class AmsHumidityTipPopup : public wxPopupTransientWindow { public: AmsHumidityTipPopup(wxWindow* parent); @@ -187,7 +186,7 @@ public: Button* m_button_confirm; }; -class AmsTutorialPopup : public PopupWindow +class AmsTutorialPopup : public wxPopupTransientWindow { public: Label* text_title; @@ -209,7 +208,7 @@ public: }; -class AmsIntroducePopup : public PopupWindow +class AmsIntroducePopup : public wxPopupTransientWindow { public: bool is_enable_ams = {false}; diff --git a/src/slic3r/GUI/CameraPopup.cpp b/src/slic3r/GUI/CameraPopup.cpp index fbf0450a9..42f1792ab 100644 --- a/src/slic3r/GUI/CameraPopup.cpp +++ b/src/slic3r/GUI/CameraPopup.cpp @@ -12,9 +12,9 @@ namespace Slic3r { namespace GUI { -wxIMPLEMENT_CLASS(CameraPopup, PopupWindow); +wxIMPLEMENT_CLASS(CameraPopup, wxPopupTransientWindow); -wxBEGIN_EVENT_TABLE(CameraPopup, PopupWindow) +wxBEGIN_EVENT_TABLE(CameraPopup, wxPopupTransientWindow) EVT_MOUSE_EVENTS(CameraPopup::OnMouse ) EVT_SIZE(CameraPopup::OnSize) EVT_SET_FOCUS(CameraPopup::OnSetFocus ) @@ -29,7 +29,7 @@ wxDEFINE_EVENT(EVT_SDCARD_ABSENT_HINT, wxCommandEvent); const wxColour TEXT_COL = wxColour(43, 52, 54); CameraPopup::CameraPopup(wxWindow *parent, MachineObject* obj) - : PopupWindow(parent, wxBORDER_NONE | wxPU_CONTAINS_CONTROLS), + : wxPopupTransientWindow(parent, wxBORDER_NONE | wxPU_CONTAINS_CONTROLS), m_obj(obj) { #ifdef __WINDOWS__ @@ -165,7 +165,7 @@ void CameraPopup::Popup(wxWindow *WXUNUSED(focus)) this->SetPosition(curr_position); if (!m_is_in_interval) - PopupWindow::Popup(); + wxPopupTransientWindow::Popup(); } wxWindow* CameraPopup::create_item_radiobox(wxString title, wxWindow* parent, wxString tooltip, int padding_left) @@ -347,7 +347,7 @@ void CameraPopup::rescale() m_panel->Layout(); main_sizer->Fit(m_panel); SetClientSize(m_panel->GetSize()); - PopupWindow::Update(); + wxPopupTransientWindow::Update(); } void CameraPopup::OnLeftUp(wxMouseEvent &event) @@ -409,18 +409,18 @@ void CameraPopup::stop_interval(wxTimerEvent& event) } void CameraPopup::OnDismiss() { - PopupWindow::OnDismiss(); + wxPopupTransientWindow::OnDismiss(); this->start_interval(); } bool CameraPopup::ProcessLeftDown(wxMouseEvent &event) { - return PopupWindow::ProcessLeftDown(event); + return wxPopupTransientWindow::ProcessLeftDown(event); } bool CameraPopup::Show(bool show) { - return PopupWindow::Show(show); + return wxPopupTransientWindow::Show(show); } void CameraPopup::OnSize(wxSizeEvent &event) diff --git a/src/slic3r/GUI/CameraPopup.hpp b/src/slic3r/GUI/CameraPopup.hpp index bab08850c..fde8ffa5c 100644 --- a/src/slic3r/GUI/CameraPopup.hpp +++ b/src/slic3r/GUI/CameraPopup.hpp @@ -13,7 +13,6 @@ #include #include "Widgets/SwitchButton.hpp" #include "Widgets/RadioBox.hpp" -#include "Widgets/PopupWindow.hpp" namespace Slic3r { namespace GUI { @@ -21,13 +20,13 @@ namespace GUI { wxDECLARE_EVENT(EVT_VCAMERA_SWITCH, wxMouseEvent); wxDECLARE_EVENT(EVT_SDCARD_ABSENT_HINT, wxCommandEvent); -class CameraPopup : public PopupWindow +class CameraPopup : public wxPopupTransientWindow { public: CameraPopup(wxWindow *parent, MachineObject* obj = nullptr); virtual ~CameraPopup() {} - // PopupWindow virtual methods are all overridden to log them + // wxPopupTransientWindow virtual methods are all overridden to log them virtual void Popup(wxWindow *focus = NULL) wxOVERRIDE; virtual void OnDismiss() wxOVERRIDE; virtual bool ProcessLeftDown(wxMouseEvent &event) wxOVERRIDE; diff --git a/src/slic3r/GUI/Search.cpp b/src/slic3r/GUI/Search.cpp index f4965cb9f..03eeeabd7 100644 --- a/src/slic3r/GUI/Search.cpp +++ b/src/slic3r/GUI/Search.cpp @@ -522,7 +522,7 @@ static const std::map icon_idxs = { }; SearchDialog::SearchDialog(OptionsSearcher *searcher, Preset::Type type, wxWindow *parent, TextInput *input, wxWindow *search_btn) - : PopupWindow(parent, wxBORDER_NONE | wxPU_CONTAINS_CONTROLS), searcher(searcher) + : wxPopupTransientWindow(parent, wxBORDER_NONE | wxPU_CONTAINS_CONTROLS), searcher(searcher) { m_event_tag = parent; search_line = input; @@ -622,7 +622,7 @@ void SearchDialog::Popup(wxPoint position /*= wxDefaultPosition*/) search_line->GetTextCtrl()->SetValue(wxString("")); //const std::string &line = searcher->search_string(); //searcher->search(into_u8(line), true); - PopupWindow::Popup(); + wxPopupTransientWindow::Popup(); search_line->SetFocus(); update_list(); } @@ -649,7 +649,7 @@ void SearchDialog::Dismiss() void SearchDialog::Die() { - PopupWindow::Dismiss(); + wxPopupTransientWindow::Dismiss(); wxCommandEvent event(wxCUSTOMEVT_EXIT_SEARCH); wxPostEvent(search_line, event); } diff --git a/src/slic3r/GUI/Search.hpp b/src/slic3r/GUI/Search.hpp index 6331609ca..52ac6b35f 100644 --- a/src/slic3r/GUI/Search.hpp +++ b/src/slic3r/GUI/Search.hpp @@ -20,7 +20,6 @@ #include "libslic3r/Preset.hpp" #include "Widgets/ScrolledWindow.hpp" #include "Widgets/TextInput.hpp" -#include "Widgets/PopupWindow.hpp" namespace Slic3r { @@ -176,7 +175,7 @@ public: // SearchDialog //------------------------------------------ class SearchListModel; -class SearchDialog : public PopupWindow +class SearchDialog : public wxPopupTransientWindow { public: wxString search_str; diff --git a/src/slic3r/GUI/SelectMachine.cpp b/src/slic3r/GUI/SelectMachine.cpp index 320cd0fcc..6d434d301 100644 --- a/src/slic3r/GUI/SelectMachine.cpp +++ b/src/slic3r/GUI/SelectMachine.cpp @@ -387,7 +387,7 @@ void MachineObjectPanel::on_mouse_left_up(wxMouseEvent &evt) } SelectMachinePopup::SelectMachinePopup(wxWindow *parent) - : PopupWindow(parent, wxBORDER_NONE | wxPU_CONTAINS_CONTROLS), m_dismiss(false) + : wxPopupTransientWindow(parent, wxBORDER_NONE | wxPU_CONTAINS_CONTROLS), m_dismiss(false) { #ifdef __WINDOWS__ SetDoubleBuffered(true); @@ -481,7 +481,7 @@ void SelectMachinePopup::Popup(wxWindow *WXUNUSED(focus)) } wxPostEvent(this, wxTimerEvent()); - PopupWindow::Popup(); + wxPopupTransientWindow::Popup(); } void SelectMachinePopup::OnDismiss() @@ -507,7 +507,7 @@ void SelectMachinePopup::OnDismiss() } bool SelectMachinePopup::ProcessLeftDown(wxMouseEvent &event) { - return PopupWindow::ProcessLeftDown(event); + return wxPopupTransientWindow::ProcessLeftDown(event); } bool SelectMachinePopup::Show(bool show) { @@ -522,7 +522,7 @@ bool SelectMachinePopup::Show(bool show) { m_other_list_machine_panel[j]->mPanel->Hide(); } } - return PopupWindow::Show(show); + return wxPopupTransientWindow::Show(show); } wxWindow *SelectMachinePopup::create_title_panel(wxString text) diff --git a/src/slic3r/GUI/SelectMachine.hpp b/src/slic3r/GUI/SelectMachine.hpp index 0b141ee95..1b5fe2346 100644 --- a/src/slic3r/GUI/SelectMachine.hpp +++ b/src/slic3r/GUI/SelectMachine.hpp @@ -37,7 +37,6 @@ #include "Widgets/CheckBox.hpp" #include "Widgets/ComboBox.hpp" #include "Widgets/ScrolledWindow.hpp" -#include "Widgets/PopupWindow.hpp" #include #include @@ -180,13 +179,13 @@ public: class ThumbnailPanel; -class SelectMachinePopup : public PopupWindow +class SelectMachinePopup : public wxPopupTransientWindow { public: SelectMachinePopup(wxWindow *parent); ~SelectMachinePopup(); - // PopupWindow virtual methods are all overridden to log them + // wxPopupTransientWindow virtual methods are all overridden to log them virtual void Popup(wxWindow *focus = NULL) wxOVERRIDE; virtual void OnDismiss() wxOVERRIDE; virtual bool ProcessLeftDown(wxMouseEvent &event) wxOVERRIDE; diff --git a/src/slic3r/GUI/SliceInfoPanel.cpp b/src/slic3r/GUI/SliceInfoPanel.cpp index ddf9eb647..5119081aa 100644 --- a/src/slic3r/GUI/SliceInfoPanel.cpp +++ b/src/slic3r/GUI/SliceInfoPanel.cpp @@ -11,9 +11,9 @@ namespace GUI { #define ICON_SIZE (wxSize(FromDIP(16), FromDIP(16))) #define PRINT_ICON_SIZE (wxSize(FromDIP(18), FromDIP(18))) -wxIMPLEMENT_CLASS(SliceInfoPopup, PopupWindow); +wxIMPLEMENT_CLASS(SliceInfoPopup, wxPopupTransientWindow); -wxBEGIN_EVENT_TABLE(SliceInfoPopup, PopupWindow) +wxBEGIN_EVENT_TABLE(SliceInfoPopup, wxPopupTransientWindow) EVT_MOUSE_EVENTS( SliceInfoPopup::OnMouse ) EVT_SIZE(SliceInfoPopup::OnSize) EVT_SET_FOCUS( SliceInfoPopup::OnSetFocus ) @@ -53,7 +53,7 @@ static wxColour decode_color(const std::string &color) SliceInfoPopup::SliceInfoPopup(wxWindow *parent, wxBitmap bmp, BBLSliceInfo *info) - : PopupWindow(parent, wxBORDER_NONE | wxPU_CONTAINS_CONTROLS) + : wxPopupTransientWindow(parent, wxBORDER_NONE | wxPU_CONTAINS_CONTROLS) { #ifdef __WINDOWS__ SetDoubleBuffered(true); @@ -139,20 +139,20 @@ SliceInfoPopup::SliceInfoPopup(wxWindow *parent, wxBitmap bmp, BBLSliceInfo *inf } void SliceInfoPopup::Popup(wxWindow *WXUNUSED(focus)) { - PopupWindow::Popup(); + wxPopupTransientWindow::Popup(); } void SliceInfoPopup::OnDismiss() { - PopupWindow::OnDismiss(); + wxPopupTransientWindow::OnDismiss(); } bool SliceInfoPopup::ProcessLeftDown(wxMouseEvent &event) { - return PopupWindow::ProcessLeftDown(event); + return wxPopupTransientWindow::ProcessLeftDown(event); } bool SliceInfoPopup::Show(bool show) { - return PopupWindow::Show(show); + return wxPopupTransientWindow::Show(show); } void SliceInfoPopup::OnSize(wxSizeEvent &event) diff --git a/src/slic3r/GUI/SliceInfoPanel.hpp b/src/slic3r/GUI/SliceInfoPanel.hpp index 8f1710022..05a853001 100644 --- a/src/slic3r/GUI/SliceInfoPanel.hpp +++ b/src/slic3r/GUI/SliceInfoPanel.hpp @@ -9,18 +9,17 @@ #include #include #include -#include "Widgets/PopupWindow.hpp" namespace Slic3r { namespace GUI { -class SliceInfoPopup : public PopupWindow +class SliceInfoPopup : public wxPopupTransientWindow { public: SliceInfoPopup(wxWindow *parent, wxBitmap bmp= wxNullBitmap, BBLSliceInfo* info=nullptr); virtual ~SliceInfoPopup() {} - // PopupWindow virtual methods are all overridden to log them + // wxPopupTransientWindow virtual methods are all overridden to log them virtual void Popup(wxWindow *focus = NULL) wxOVERRIDE; virtual void OnDismiss() wxOVERRIDE; virtual bool ProcessLeftDown(wxMouseEvent &event) wxOVERRIDE; diff --git a/src/slic3r/GUI/StatusPanel.cpp b/src/slic3r/GUI/StatusPanel.cpp index f4c976b84..740b75367 100644 --- a/src/slic3r/GUI/StatusPanel.cpp +++ b/src/slic3r/GUI/StatusPanel.cpp @@ -2840,9 +2840,9 @@ void StatusPanel::on_switch_speed(wxCommandEvent &event) } #if __WXOSX__ // MacOS has focus problem - PopupWindow *popUp = new PopupWindow(nullptr); + wxPopupTransientWindow *popUp = new wxPopupTransientWindow(nullptr); #else - PopupWindow *popUp = new PopupWindow(m_switch_speed); + wxPopupTransientWindow *popUp = new wxPopupTransientWindow(m_switch_speed); #endif popUp->SetBackgroundColour(StateColor::darkModeColorFor(0xeeeeee)); StepCtrl *step = new StepCtrl(popUp, wxID_ANY); diff --git a/src/slic3r/GUI/Widgets/DropDown.cpp b/src/slic3r/GUI/Widgets/DropDown.cpp index 8f0b390ac..d7a3f4a06 100644 --- a/src/slic3r/GUI/Widgets/DropDown.cpp +++ b/src/slic3r/GUI/Widgets/DropDown.cpp @@ -5,7 +5,7 @@ wxDEFINE_EVENT(EVT_DISMISS, wxCommandEvent); -BEGIN_EVENT_TABLE(DropDown, PopupWindow) +BEGIN_EVENT_TABLE(DropDown, wxPopupTransientWindow) EVT_LEFT_DOWN(DropDown::mouseDown) EVT_LEFT_UP(DropDown::mouseReleased) @@ -50,7 +50,7 @@ DropDown::DropDown(wxWindow * parent, void DropDown::Create(wxWindow * parent, long style) { - PopupWindow::Create(parent, wxPU_CONTAINS_CONTROLS); + wxPopupTransientWindow::Create(parent, wxPU_CONTAINS_CONTROLS); SetBackgroundStyle(wxBG_STYLE_PAINT); SetBackgroundColour(*wxWHITE); state_handler.attach({&border_color, &text_color, &selector_border_color, &selector_background_color}); @@ -62,7 +62,7 @@ void DropDown::Create(wxWindow * parent, // BBS set default font SetFont(Label::Body_14); #ifdef __WXOSX__ - // PopupWindow releases mouse on idle, which may cause various problems, + // wxPopupTransientWindow releases mouse on idle, which may cause various problems, // such as losting mouse move, and dismissing soon on first LEFT_DOWN event. Bind(wxEVT_IDLE, [] (wxIdleEvent & evt) {}); #endif diff --git a/src/slic3r/GUI/Widgets/DropDown.hpp b/src/slic3r/GUI/Widgets/DropDown.hpp index e2a6cb493..b2b7eaa73 100644 --- a/src/slic3r/GUI/Widgets/DropDown.hpp +++ b/src/slic3r/GUI/Widgets/DropDown.hpp @@ -4,7 +4,6 @@ #include #include "../wxExtensions.hpp" #include "StateHandler.hpp" -#include "PopupWindow.hpp" #define DD_NO_CHECK_ICON 0x0001 #define DD_NO_TEXT 0x0002 @@ -12,7 +11,7 @@ wxDECLARE_EVENT(EVT_DISMISS, wxCommandEvent); -class DropDown : public PopupWindow +class DropDown : public wxPopupTransientWindow { std::vector & texts; std::vector & icons; diff --git a/src/slic3r/GUI/Widgets/FanControl.cpp b/src/slic3r/GUI/Widgets/FanControl.cpp index e2fea459d..8a3e05a3a 100644 --- a/src/slic3r/GUI/Widgets/FanControl.cpp +++ b/src/slic3r/GUI/Widgets/FanControl.cpp @@ -499,7 +499,7 @@ void FanControl::post_event(wxCommandEvent&& event) Description:FanControlPopup **************************************************/ FanControlPopup::FanControlPopup(wxWindow* parent) - :PopupWindow(parent, wxBORDER_NONE) + :wxPopupTransientWindow(parent, wxBORDER_NONE) { this->SetSizeHints(wxDefaultSize, wxDefaultSize); @@ -628,7 +628,7 @@ void FanControlPopup::post_event(int fan_type, wxString speed) bool FanControlPopup::ProcessLeftDown(wxMouseEvent& event) { - return PopupWindow::ProcessLeftDown(event); + return wxPopupTransientWindow::ProcessLeftDown(event); } void FanControlPopup::on_show(wxShowEvent& evt) diff --git a/src/slic3r/GUI/Widgets/FanControl.hpp b/src/slic3r/GUI/Widgets/FanControl.hpp index ec5c686d2..9e9d3dd95 100644 --- a/src/slic3r/GUI/Widgets/FanControl.hpp +++ b/src/slic3r/GUI/Widgets/FanControl.hpp @@ -5,7 +5,6 @@ #include "StaticBox.hpp" #include "StepCtrl.hpp" #include "Button.hpp" -#include "PopupWindow.hpp" #include "../DeviceManager.hpp" #include "slic3r/GUI/Event.hpp" #include @@ -138,7 +137,7 @@ public: /************************************************* Description:FanControlPopup **************************************************/ -class FanControlPopup : public PopupWindow +class FanControlPopup : public wxPopupTransientWindow { public: FanControlPopup(wxWindow* parent); diff --git a/src/slic3r/GUI/Widgets/PopupWindow.cpp b/src/slic3r/GUI/Widgets/PopupWindow.cpp deleted file mode 100644 index 132573f2f..000000000 --- a/src/slic3r/GUI/Widgets/PopupWindow.cpp +++ /dev/null @@ -1,33 +0,0 @@ -#include "PopupWindow.hpp" - -static wxWindow *GetTopParent(wxWindow *pWindow) -{ - wxWindow *pWin = pWindow; - while (pWin->GetParent()) pWin = pWin->GetParent(); - return pWin; -} - -bool PopupWindow::Create(wxWindow *parent, int style) -{ - if (!wxPopupTransientWindow::Create(parent, style)) - return false; -#ifdef __WXGTK__ - GetTopParent(parent)->Bind(wxEVT_ACTIVATE, &PopupWindow::topWindowActiavate, this); -#endif - return true; -} - -PopupWindow::~PopupWindow() -{ -#ifdef __WXGTK__ - GetTopParent(this)->Unbind(wxEVT_ACTIVATE, &PopupWindow::topWindowActiavate, this); -#endif -} - -#ifdef __WXGTK__ -void PopupWindow::topWindowActiavate(wxActivateEvent &event) -{ - event.Skip(); - if (!event.GetActive() && IsShown()) DismissAndNotify(); -} -#endif diff --git a/src/slic3r/GUI/Widgets/PopupWindow.hpp b/src/slic3r/GUI/Widgets/PopupWindow.hpp deleted file mode 100644 index 88993de88..000000000 --- a/src/slic3r/GUI/Widgets/PopupWindow.hpp +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef slic3r_GUI_PopupWindow_hpp_ -#define slic3r_GUI_PopupWindow_hpp_ - -#include - -class PopupWindow : public wxPopupTransientWindow -{ -public: - PopupWindow() {} - - ~PopupWindow(); - - PopupWindow(wxWindow *parent, int style = wxBORDER_NONE) - { Create(parent, style); } - - bool Create(wxWindow *parent, int flags = wxBORDER_NONE); - -private: -#ifdef __WXGTK__ - void topWindowActiavate(wxActivateEvent &event); -#endif -}; - -#endif // !slic3r_GUI_PopupWindow_hpp_ diff --git a/src/slic3r/GUI/Widgets/SideMenuPopup.cpp b/src/slic3r/GUI/Widgets/SideMenuPopup.cpp index b50ed6b60..21faf613b 100644 --- a/src/slic3r/GUI/Widgets/SideMenuPopup.cpp +++ b/src/slic3r/GUI/Widgets/SideMenuPopup.cpp @@ -6,12 +6,12 @@ -wxBEGIN_EVENT_TABLE(SidePopup,PopupWindow) +wxBEGIN_EVENT_TABLE(SidePopup,wxPopupTransientWindow) EVT_PAINT(SidePopup::paintEvent) wxEND_EVENT_TABLE() SidePopup::SidePopup(wxWindow* parent) - :PopupWindow(parent, + :wxPopupTransientWindow(parent, wxBORDER_NONE | wxPU_CONTAINS_CONTROLS) { @@ -28,16 +28,16 @@ SidePopup::~SidePopup() void SidePopup::OnDismiss() { Slic3r::GUI::wxGetApp().set_side_menu_popup_status(false); - PopupWindow::OnDismiss(); + wxPopupTransientWindow::OnDismiss(); } bool SidePopup::ProcessLeftDown(wxMouseEvent& event) { - return PopupWindow::ProcessLeftDown(event); + return wxPopupTransientWindow::ProcessLeftDown(event); } bool SidePopup::Show( bool show ) { - return PopupWindow::Show(show); + return wxPopupTransientWindow::Show(show); } void SidePopup::Popup(wxWindow* focus) @@ -66,7 +66,7 @@ void SidePopup::Popup(wxWindow* focus) Position(pos, {0, focus->GetSize().y + 12}); } Slic3r::GUI::wxGetApp().set_side_menu_popup_status(true); - PopupWindow::Popup(); + wxPopupTransientWindow::Popup(); } void SidePopup::Create() diff --git a/src/slic3r/GUI/Widgets/SideMenuPopup.hpp b/src/slic3r/GUI/Widgets/SideMenuPopup.hpp index 09f756a5e..52f306664 100644 --- a/src/slic3r/GUI/Widgets/SideMenuPopup.hpp +++ b/src/slic3r/GUI/Widgets/SideMenuPopup.hpp @@ -9,9 +9,8 @@ #include "../wxExtensions.hpp" #include "StateHandler.hpp" #include "SideButton.hpp" -#include "PopupWindow.hpp" -class SidePopup : public PopupWindow +class SidePopup : public wxPopupTransientWindow { private: std::vector btn_list; diff --git a/src/slic3r/GUI/Widgets/TempInput.cpp b/src/slic3r/GUI/Widgets/TempInput.cpp index fb848afdc..b9d4bdbbe 100644 --- a/src/slic3r/GUI/Widgets/TempInput.cpp +++ b/src/slic3r/GUI/Widgets/TempInput.cpp @@ -1,6 +1,5 @@ #include "TempInput.hpp" #include "Label.hpp" -#include "PopupWindow.hpp" #include "../I18N.hpp" #include #include "../GUI.hpp" @@ -191,7 +190,7 @@ void TempInput::Warning(bool warn, WarningType type) if (warning_mode) { if (wdialog == nullptr) { - wdialog = new PopupWindow(this); + wdialog = new wxPopupTransientWindow(this); wdialog->SetBackgroundColour(wxColour(0xFFFFFF)); wdialog->SetSizeHints(wxDefaultSize, wxDefaultSize); diff --git a/src/slic3r/GUI/wxExtensions.cpp b/src/slic3r/GUI/wxExtensions.cpp index d93c2840a..406698f21 100644 --- a/src/slic3r/GUI/wxExtensions.cpp +++ b/src/slic3r/GUI/wxExtensions.cpp @@ -1048,9 +1048,9 @@ void BlinkingBitmap::blink() } -wxIMPLEMENT_CLASS(ImageTransientPopup,PopupWindow); +wxIMPLEMENT_CLASS(ImageTransientPopup,wxPopupTransientWindow); -wxBEGIN_EVENT_TABLE(ImageTransientPopup,PopupWindow) +wxBEGIN_EVENT_TABLE(ImageTransientPopup,wxPopupTransientWindow) EVT_MOUSE_EVENTS( ImageTransientPopup::OnMouse ) EVT_SIZE( ImageTransientPopup::OnSize ) EVT_SET_FOCUS( ImageTransientPopup::OnSetFocus ) @@ -1058,7 +1058,7 @@ wxBEGIN_EVENT_TABLE(ImageTransientPopup,PopupWindow) wxEND_EVENT_TABLE() ImageTransientPopup::ImageTransientPopup( wxWindow *parent, bool scrolled, wxBitmap bmp) - :PopupWindow( parent, + :wxPopupTransientWindow( parent, wxBORDER_NONE | wxPU_CONTAINS_CONTROLS ) { @@ -1115,21 +1115,21 @@ void ImageTransientPopup::SetImage(wxBitmap bmp) void ImageTransientPopup::Popup(wxWindow* WXUNUSED(focus)) { - PopupWindow::Popup(); + wxPopupTransientWindow::Popup(); } void ImageTransientPopup::OnDismiss() { - PopupWindow::OnDismiss(); + wxPopupTransientWindow::OnDismiss(); } bool ImageTransientPopup::ProcessLeftDown(wxMouseEvent& event) { - return PopupWindow::ProcessLeftDown(event); + return wxPopupTransientWindow::ProcessLeftDown(event); } bool ImageTransientPopup::Show( bool show ) { - return PopupWindow::Show(show); + return wxPopupTransientWindow::Show(show); } void ImageTransientPopup::OnSize(wxSizeEvent &event) diff --git a/src/slic3r/GUI/wxExtensions.hpp b/src/slic3r/GUI/wxExtensions.hpp index e890d30ae..1a9ebf607 100644 --- a/src/slic3r/GUI/wxExtensions.hpp +++ b/src/slic3r/GUI/wxExtensions.hpp @@ -16,7 +16,6 @@ #include #include -#include "Widgets/PopupWindow.hpp" #ifdef __WXMSW__ void msw_rescale_menu(wxMenu* menu); @@ -393,7 +392,7 @@ private: // ImageTransientPopup // ---------------------------------------------------------------------------- -class ImageTransientPopup : public PopupWindow +class ImageTransientPopup : public wxPopupTransientWindow { public: ImageTransientPopup( wxWindow *parent, bool scrolled, wxBitmap bmp); @@ -401,7 +400,7 @@ class ImageTransientPopup : public PopupWindow void SetImage(wxBitmap bmp); - // PopupWindow virtual methods are all overridden to log them + // wxPopupTransientWindow virtual methods are all overridden to log them virtual void Popup(wxWindow *focus = NULL) wxOVERRIDE; virtual void OnDismiss() wxOVERRIDE; virtual bool ProcessLeftDown(wxMouseEvent& event) wxOVERRIDE;