mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-31 04:31:15 -06:00 
			
		
		
		
	FIX: [STUDIO-2186] hide PopupWindow on alt-tab
Change-Id: Ie1bffdd9ace2c6e05979743da9f75ca2c1e87cf3
This commit is contained in:
		
							parent
							
								
									6faecbf718
								
							
						
					
					
						commit
						81dea77932
					
				
					 23 changed files with 139 additions and 70 deletions
				
			
		|  | @ -28,6 +28,8 @@ 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 | ||||
|  |  | |||
|  | @ -207,7 +207,7 @@ void MaterialItem::doRender(wxDC &dc) | |||
| } | ||||
| 
 | ||||
|  AmsMapingPopup::AmsMapingPopup(wxWindow *parent)  | ||||
|     :wxPopupTransientWindow(parent, wxBORDER_NONE) | ||||
|     : PopupWindow(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 wxPopupTransientWindow::ProcessLeftDown(event); | ||||
|     return PopupWindow::ProcessLeftDown(event); | ||||
| } | ||||
| 
 | ||||
| void AmsMapingPopup::paintEvent(wxPaintEvent &evt)  | ||||
|  | @ -639,7 +639,7 @@ void MappingItem::doRender(wxDC &dc) | |||
| } | ||||
| 
 | ||||
| AmsMapingTipPopup::AmsMapingTipPopup(wxWindow *parent)  | ||||
|     :wxPopupTransientWindow(parent, wxBORDER_NONE) | ||||
|     :PopupWindow(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 wxPopupTransientWindow::ProcessLeftDown(event); } | ||||
|     return PopupWindow::ProcessLeftDown(event); } | ||||
| 
 | ||||
| 
 | ||||
| AmsHumidityTipPopup::AmsHumidityTipPopup(wxWindow* parent) | ||||
|     :wxPopupTransientWindow(parent, wxBORDER_NONE) | ||||
|     :PopupWindow(parent, wxBORDER_NONE) | ||||
| { | ||||
|     SetBackgroundColour(*wxWHITE); | ||||
| 
 | ||||
|  | @ -857,11 +857,11 @@ void AmsHumidityTipPopup::paintEvent(wxPaintEvent& evt) | |||
| void AmsHumidityTipPopup::OnDismiss() {} | ||||
| 
 | ||||
| bool AmsHumidityTipPopup::ProcessLeftDown(wxMouseEvent& event) { | ||||
|     return wxPopupTransientWindow::ProcessLeftDown(event); | ||||
|     return PopupWindow::ProcessLeftDown(event); | ||||
| } | ||||
| 
 | ||||
| AmsTutorialPopup::AmsTutorialPopup(wxWindow* parent) | ||||
| :wxPopupTransientWindow(parent, wxBORDER_NONE) | ||||
| :PopupWindow(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 wxPopupTransientWindow::ProcessLeftDown(event); | ||||
|     return PopupWindow::ProcessLeftDown(event); | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| AmsIntroducePopup::AmsIntroducePopup(wxWindow* parent) | ||||
| :wxPopupTransientWindow(parent, wxBORDER_NONE) | ||||
| :PopupWindow(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 wxPopupTransientWindow::ProcessLeftDown(event); | ||||
|     return PopupWindow::ProcessLeftDown(event); | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
|  |  | |||
|  | @ -34,6 +34,7 @@ | |||
| #include "Widgets/CheckBox.hpp" | ||||
| #include "Widgets/ComboBox.hpp" | ||||
| #include "Widgets/ScrolledWindow.hpp" | ||||
| #include "Widgets/PopupWindow.hpp" | ||||
| #include <wx/simplebook.h> | ||||
| #include <wx/hashmap.h> | ||||
| 
 | ||||
|  | @ -113,7 +114,7 @@ public: | |||
|     void doRender(wxDC &dc); | ||||
| }; | ||||
| 
 | ||||
| class AmsMapingPopup : public wxPopupTransientWindow | ||||
| class AmsMapingPopup : public PopupWindow | ||||
| { | ||||
| public: | ||||
|     AmsMapingPopup(wxWindow *parent); | ||||
|  | @ -146,7 +147,7 @@ public: | |||
|     std::vector<TrayData> parse_ams_mapping(std::map<std::string, Ams*> amsList); | ||||
| }; | ||||
| 
 | ||||
| class AmsMapingTipPopup : public wxPopupTransientWindow | ||||
| class AmsMapingTipPopup : public PopupWindow | ||||
| { | ||||
| public: | ||||
|     AmsMapingTipPopup(wxWindow *parent); | ||||
|  | @ -166,7 +167,7 @@ public: | |||
|     wxStaticText *   m_tip_disable_ams; | ||||
| }; | ||||
| 
 | ||||
| class AmsHumidityTipPopup : public wxPopupTransientWindow | ||||
| class AmsHumidityTipPopup : public PopupWindow | ||||
| { | ||||
| public: | ||||
|     AmsHumidityTipPopup(wxWindow* parent); | ||||
|  | @ -186,7 +187,7 @@ public: | |||
|     Button* m_button_confirm; | ||||
| }; | ||||
| 
 | ||||
| class AmsTutorialPopup : public wxPopupTransientWindow | ||||
| class AmsTutorialPopup : public PopupWindow | ||||
| { | ||||
| public: | ||||
|     Label* text_title; | ||||
|  | @ -208,7 +209,7 @@ public: | |||
| }; | ||||
| 
 | ||||
| 
 | ||||
| class AmsIntroducePopup : public wxPopupTransientWindow | ||||
| class AmsIntroducePopup : public PopupWindow | ||||
| { | ||||
| public: | ||||
|     bool          is_enable_ams = {false}; | ||||
|  |  | |||
|  | @ -12,9 +12,9 @@ | |||
| namespace Slic3r { | ||||
| namespace GUI { | ||||
| 
 | ||||
| wxIMPLEMENT_CLASS(CameraPopup, wxPopupTransientWindow); | ||||
| wxIMPLEMENT_CLASS(CameraPopup, PopupWindow); | ||||
| 
 | ||||
| wxBEGIN_EVENT_TABLE(CameraPopup, wxPopupTransientWindow) | ||||
| wxBEGIN_EVENT_TABLE(CameraPopup, PopupWindow) | ||||
|     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) | ||||
|    : wxPopupTransientWindow(parent, wxBORDER_NONE | wxPU_CONTAINS_CONTROLS), | ||||
|    : PopupWindow(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) | ||||
|         wxPopupTransientWindow::Popup(); | ||||
|         PopupWindow::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()); | ||||
|     wxPopupTransientWindow::Update(); | ||||
|     PopupWindow::Update(); | ||||
| } | ||||
| 
 | ||||
| void CameraPopup::OnLeftUp(wxMouseEvent &event) | ||||
|  | @ -409,18 +409,18 @@ void CameraPopup::stop_interval(wxTimerEvent& event) | |||
| } | ||||
| 
 | ||||
| void CameraPopup::OnDismiss() { | ||||
|     wxPopupTransientWindow::OnDismiss(); | ||||
|     PopupWindow::OnDismiss(); | ||||
|     this->start_interval(); | ||||
| } | ||||
| 
 | ||||
| bool CameraPopup::ProcessLeftDown(wxMouseEvent &event) | ||||
| { | ||||
|     return wxPopupTransientWindow::ProcessLeftDown(event); | ||||
|     return PopupWindow::ProcessLeftDown(event); | ||||
| } | ||||
| 
 | ||||
| bool CameraPopup::Show(bool show) | ||||
| { | ||||
|     return wxPopupTransientWindow::Show(show); | ||||
|     return PopupWindow::Show(show); | ||||
| } | ||||
| 
 | ||||
| void CameraPopup::OnSize(wxSizeEvent &event) | ||||
|  |  | |||
|  | @ -13,6 +13,7 @@ | |||
| #include <wx/hyperlink.h> | ||||
| #include "Widgets/SwitchButton.hpp" | ||||
| #include "Widgets/RadioBox.hpp" | ||||
| #include "Widgets/PopupWindow.hpp" | ||||
| 
 | ||||
| namespace Slic3r { | ||||
| namespace GUI { | ||||
|  | @ -20,13 +21,13 @@ namespace GUI { | |||
| wxDECLARE_EVENT(EVT_VCAMERA_SWITCH, wxMouseEvent); | ||||
| wxDECLARE_EVENT(EVT_SDCARD_ABSENT_HINT, wxCommandEvent); | ||||
| 
 | ||||
| class CameraPopup : public wxPopupTransientWindow | ||||
| class CameraPopup : public PopupWindow | ||||
| { | ||||
| public: | ||||
|     CameraPopup(wxWindow *parent, MachineObject* obj = nullptr); | ||||
|     virtual ~CameraPopup() {} | ||||
| 
 | ||||
|     // wxPopupTransientWindow virtual methods are all overridden to log them
 | ||||
|     // PopupWindow 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; | ||||
|  |  | |||
|  | @ -522,7 +522,7 @@ static const std::map<const char, int> icon_idxs = { | |||
| }; | ||||
| 
 | ||||
| SearchDialog::SearchDialog(OptionsSearcher *searcher, Preset::Type type, wxWindow *parent, TextInput *input, wxWindow *search_btn)  | ||||
|     : wxPopupTransientWindow(parent, wxBORDER_NONE | wxPU_CONTAINS_CONTROLS), searcher(searcher) | ||||
|     : PopupWindow(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);
 | ||||
|     wxPopupTransientWindow::Popup(); | ||||
|     PopupWindow::Popup(); | ||||
|     search_line->SetFocus(); | ||||
|     update_list(); | ||||
| } | ||||
|  | @ -649,7 +649,7 @@ void SearchDialog::Dismiss() | |||
| 
 | ||||
| void SearchDialog::Die()  | ||||
| { | ||||
|     wxPopupTransientWindow::Dismiss(); | ||||
|     PopupWindow::Dismiss(); | ||||
|     wxCommandEvent event(wxCUSTOMEVT_EXIT_SEARCH); | ||||
|     wxPostEvent(search_line, event); | ||||
| } | ||||
|  |  | |||
|  | @ -20,6 +20,7 @@ | |||
| #include "libslic3r/Preset.hpp" | ||||
| #include "Widgets/ScrolledWindow.hpp" | ||||
| #include "Widgets/TextInput.hpp" | ||||
| #include "Widgets/PopupWindow.hpp" | ||||
| 
 | ||||
| 
 | ||||
| namespace Slic3r { | ||||
|  | @ -175,7 +176,7 @@ public: | |||
| //          SearchDialog
 | ||||
| //------------------------------------------
 | ||||
| class SearchListModel; | ||||
| class SearchDialog : public wxPopupTransientWindow | ||||
| class SearchDialog : public PopupWindow | ||||
| { | ||||
| public: | ||||
|     wxString search_str; | ||||
|  |  | |||
|  | @ -387,7 +387,7 @@ void MachineObjectPanel::on_mouse_left_up(wxMouseEvent &evt) | |||
| } | ||||
| 
 | ||||
| SelectMachinePopup::SelectMachinePopup(wxWindow *parent) | ||||
|     : wxPopupTransientWindow(parent, wxBORDER_NONE | wxPU_CONTAINS_CONTROLS), m_dismiss(false) | ||||
|     : PopupWindow(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()); | ||||
|     wxPopupTransientWindow::Popup(); | ||||
|     PopupWindow::Popup(); | ||||
| } | ||||
| 
 | ||||
| void SelectMachinePopup::OnDismiss() | ||||
|  | @ -507,7 +507,7 @@ void SelectMachinePopup::OnDismiss() | |||
| } | ||||
| 
 | ||||
| bool SelectMachinePopup::ProcessLeftDown(wxMouseEvent &event) { | ||||
|     return wxPopupTransientWindow::ProcessLeftDown(event); | ||||
|     return PopupWindow::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 wxPopupTransientWindow::Show(show); | ||||
|     return PopupWindow::Show(show); | ||||
| } | ||||
| 
 | ||||
| wxWindow *SelectMachinePopup::create_title_panel(wxString text) | ||||
|  |  | |||
|  | @ -37,6 +37,7 @@ | |||
| #include "Widgets/CheckBox.hpp" | ||||
| #include "Widgets/ComboBox.hpp" | ||||
| #include "Widgets/ScrolledWindow.hpp" | ||||
| #include "Widgets/PopupWindow.hpp" | ||||
| #include <wx/simplebook.h> | ||||
| #include <wx/hashmap.h> | ||||
| 
 | ||||
|  | @ -179,13 +180,13 @@ public: | |||
| 
 | ||||
| class ThumbnailPanel; | ||||
| 
 | ||||
| class SelectMachinePopup : public wxPopupTransientWindow | ||||
| class SelectMachinePopup : public PopupWindow | ||||
| { | ||||
| public: | ||||
|     SelectMachinePopup(wxWindow *parent); | ||||
|     ~SelectMachinePopup(); | ||||
| 
 | ||||
|     // wxPopupTransientWindow virtual methods are all overridden to log them
 | ||||
|     // PopupWindow 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; | ||||
|  |  | |||
|  | @ -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, wxPopupTransientWindow); | ||||
| wxIMPLEMENT_CLASS(SliceInfoPopup, PopupWindow); | ||||
| 
 | ||||
| wxBEGIN_EVENT_TABLE(SliceInfoPopup, wxPopupTransientWindow) | ||||
| wxBEGIN_EVENT_TABLE(SliceInfoPopup, PopupWindow) | ||||
|     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) | ||||
|    : wxPopupTransientWindow(parent, wxBORDER_NONE | wxPU_CONTAINS_CONTROLS) | ||||
|    : PopupWindow(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)) { | ||||
|     wxPopupTransientWindow::Popup(); | ||||
|     PopupWindow::Popup(); | ||||
| } | ||||
| 
 | ||||
| void SliceInfoPopup::OnDismiss() { | ||||
|     wxPopupTransientWindow::OnDismiss(); | ||||
|     PopupWindow::OnDismiss(); | ||||
| } | ||||
| 
 | ||||
| bool SliceInfoPopup::ProcessLeftDown(wxMouseEvent &event) | ||||
| { | ||||
|     return wxPopupTransientWindow::ProcessLeftDown(event); | ||||
|     return PopupWindow::ProcessLeftDown(event); | ||||
| } | ||||
| bool SliceInfoPopup::Show(bool show) | ||||
| { | ||||
|     return wxPopupTransientWindow::Show(show); | ||||
|     return PopupWindow::Show(show); | ||||
| } | ||||
| 
 | ||||
| void SliceInfoPopup::OnSize(wxSizeEvent &event) | ||||
|  |  | |||
|  | @ -9,17 +9,18 @@ | |||
| #include <wx/bitmap.h> | ||||
| #include <wx/image.h> | ||||
| #include <wx/webrequest.h> | ||||
| #include "Widgets/PopupWindow.hpp" | ||||
| 
 | ||||
| namespace Slic3r { | ||||
| namespace GUI { | ||||
| 
 | ||||
| class SliceInfoPopup : public wxPopupTransientWindow | ||||
| class SliceInfoPopup : public PopupWindow | ||||
| { | ||||
| public: | ||||
|     SliceInfoPopup(wxWindow *parent, wxBitmap bmp= wxNullBitmap, BBLSliceInfo* info=nullptr); | ||||
|     virtual ~SliceInfoPopup() {} | ||||
| 
 | ||||
|     // wxPopupTransientWindow virtual methods are all overridden to log them
 | ||||
|     // PopupWindow 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; | ||||
|  |  | |||
|  | @ -2840,9 +2840,9 @@ void StatusPanel::on_switch_speed(wxCommandEvent &event) | |||
|     } | ||||
| #if __WXOSX__ | ||||
|     // MacOS has focus problem
 | ||||
|     wxPopupTransientWindow *popUp = new wxPopupTransientWindow(nullptr); | ||||
|     PopupWindow *popUp = new PopupWindow(nullptr); | ||||
| #else | ||||
|     wxPopupTransientWindow *popUp = new wxPopupTransientWindow(m_switch_speed); | ||||
|     PopupWindow *popUp = new PopupWindow(m_switch_speed); | ||||
| #endif | ||||
|     popUp->SetBackgroundColour(StateColor::darkModeColorFor(0xeeeeee)); | ||||
|     StepCtrl *step = new StepCtrl(popUp, wxID_ANY); | ||||
|  |  | |||
|  | @ -5,7 +5,7 @@ | |||
| 
 | ||||
| wxDEFINE_EVENT(EVT_DISMISS, wxCommandEvent); | ||||
| 
 | ||||
| BEGIN_EVENT_TABLE(DropDown, wxPopupTransientWindow) | ||||
| BEGIN_EVENT_TABLE(DropDown, PopupWindow) | ||||
| 
 | ||||
| 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) | ||||
| { | ||||
|     wxPopupTransientWindow::Create(parent, wxPU_CONTAINS_CONTROLS); | ||||
|     PopupWindow::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__ | ||||
|     // wxPopupTransientWindow releases mouse on idle, which may cause various problems,
 | ||||
|     // PopupWindow 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 | ||||
|  |  | |||
|  | @ -4,6 +4,7 @@ | |||
| #include <wx/stattext.h> | ||||
| #include "../wxExtensions.hpp" | ||||
| #include "StateHandler.hpp" | ||||
| #include "PopupWindow.hpp" | ||||
| 
 | ||||
| #define DD_NO_CHECK_ICON    0x0001 | ||||
| #define DD_NO_TEXT          0x0002 | ||||
|  | @ -11,7 +12,7 @@ | |||
| 
 | ||||
| wxDECLARE_EVENT(EVT_DISMISS, wxCommandEvent); | ||||
| 
 | ||||
| class DropDown : public wxPopupTransientWindow | ||||
| class DropDown : public PopupWindow | ||||
| { | ||||
|     std::vector<wxString> &       texts; | ||||
|     std::vector<wxBitmap> &     icons; | ||||
|  |  | |||
|  | @ -499,7 +499,7 @@ void FanControl::post_event(wxCommandEvent&& event) | |||
| Description:FanControlPopup | ||||
| **************************************************/ | ||||
| FanControlPopup::FanControlPopup(wxWindow* parent) | ||||
|     :wxPopupTransientWindow(parent, wxBORDER_NONE) | ||||
|     :PopupWindow(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 wxPopupTransientWindow::ProcessLeftDown(event); | ||||
|     return PopupWindow::ProcessLeftDown(event); | ||||
| } | ||||
| 
 | ||||
| void FanControlPopup::on_show(wxShowEvent& evt) | ||||
|  |  | |||
|  | @ -5,6 +5,7 @@ | |||
| #include "StaticBox.hpp" | ||||
| #include "StepCtrl.hpp" | ||||
| #include "Button.hpp" | ||||
| #include "PopupWindow.hpp" | ||||
| #include "../DeviceManager.hpp" | ||||
| #include "slic3r/GUI/Event.hpp" | ||||
| #include <wx/simplebook.h> | ||||
|  | @ -137,7 +138,7 @@ public: | |||
| /*************************************************
 | ||||
| Description:FanControlPopup | ||||
| **************************************************/ | ||||
| class FanControlPopup : public wxPopupTransientWindow | ||||
| class FanControlPopup : public PopupWindow | ||||
| { | ||||
| public: | ||||
|     FanControlPopup(wxWindow* parent); | ||||
|  |  | |||
							
								
								
									
										33
									
								
								src/slic3r/GUI/Widgets/PopupWindow.cpp
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										33
									
								
								src/slic3r/GUI/Widgets/PopupWindow.cpp
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,33 @@ | |||
| #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 | ||||
							
								
								
									
										24
									
								
								src/slic3r/GUI/Widgets/PopupWindow.hpp
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								src/slic3r/GUI/Widgets/PopupWindow.hpp
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,24 @@ | |||
| #ifndef slic3r_GUI_PopupWindow_hpp_ | ||||
| #define slic3r_GUI_PopupWindow_hpp_ | ||||
| 
 | ||||
| #include <wx/popupwin.h> | ||||
| 
 | ||||
| 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_
 | ||||
|  | @ -6,12 +6,12 @@ | |||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| wxBEGIN_EVENT_TABLE(SidePopup,wxPopupTransientWindow) | ||||
| wxBEGIN_EVENT_TABLE(SidePopup,PopupWindow) | ||||
| EVT_PAINT(SidePopup::paintEvent) | ||||
| wxEND_EVENT_TABLE() | ||||
| 
 | ||||
| SidePopup::SidePopup(wxWindow* parent) | ||||
|     :wxPopupTransientWindow(parent, | ||||
|     :PopupWindow(parent, | ||||
|     wxBORDER_NONE | | ||||
|     wxPU_CONTAINS_CONTROLS) | ||||
| { | ||||
|  | @ -28,16 +28,16 @@ SidePopup::~SidePopup() | |||
| void SidePopup::OnDismiss() | ||||
| { | ||||
|     Slic3r::GUI::wxGetApp().set_side_menu_popup_status(false); | ||||
|     wxPopupTransientWindow::OnDismiss(); | ||||
|     PopupWindow::OnDismiss(); | ||||
| } | ||||
| 
 | ||||
| bool SidePopup::ProcessLeftDown(wxMouseEvent& event) | ||||
| { | ||||
|     return wxPopupTransientWindow::ProcessLeftDown(event); | ||||
|     return PopupWindow::ProcessLeftDown(event); | ||||
| } | ||||
| bool SidePopup::Show( bool show ) | ||||
| { | ||||
|     return wxPopupTransientWindow::Show(show); | ||||
|     return PopupWindow::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); | ||||
|     wxPopupTransientWindow::Popup(); | ||||
|     PopupWindow::Popup(); | ||||
| } | ||||
| 
 | ||||
| void SidePopup::Create() | ||||
|  |  | |||
|  | @ -9,8 +9,9 @@ | |||
| #include "../wxExtensions.hpp" | ||||
| #include "StateHandler.hpp" | ||||
| #include "SideButton.hpp" | ||||
| #include "PopupWindow.hpp" | ||||
| 
 | ||||
| class SidePopup : public wxPopupTransientWindow | ||||
| class SidePopup : public PopupWindow | ||||
| { | ||||
| private: | ||||
| 	std::vector<SideButton*> btn_list; | ||||
|  |  | |||
|  | @ -1,5 +1,6 @@ | |||
| #include "TempInput.hpp" | ||||
| #include "Label.hpp" | ||||
| #include "PopupWindow.hpp" | ||||
| #include "../I18N.hpp" | ||||
| #include <wx/dcgraph.h> | ||||
| #include "../GUI.hpp" | ||||
|  | @ -190,7 +191,7 @@ void TempInput::Warning(bool warn, WarningType type) | |||
| 
 | ||||
|     if (warning_mode) { | ||||
|         if (wdialog == nullptr) { | ||||
|             wdialog = new wxPopupTransientWindow(this); | ||||
|             wdialog = new PopupWindow(this); | ||||
|             wdialog->SetBackgroundColour(wxColour(0xFFFFFF)); | ||||
| 
 | ||||
|             wdialog->SetSizeHints(wxDefaultSize, wxDefaultSize); | ||||
|  |  | |||
|  | @ -1048,9 +1048,9 @@ void BlinkingBitmap::blink() | |||
| } | ||||
| 
 | ||||
| 
 | ||||
| wxIMPLEMENT_CLASS(ImageTransientPopup,wxPopupTransientWindow); | ||||
| wxIMPLEMENT_CLASS(ImageTransientPopup,PopupWindow); | ||||
| 
 | ||||
| wxBEGIN_EVENT_TABLE(ImageTransientPopup,wxPopupTransientWindow) | ||||
| wxBEGIN_EVENT_TABLE(ImageTransientPopup,PopupWindow) | ||||
|     EVT_MOUSE_EVENTS( ImageTransientPopup::OnMouse ) | ||||
|     EVT_SIZE( ImageTransientPopup::OnSize ) | ||||
|     EVT_SET_FOCUS( ImageTransientPopup::OnSetFocus ) | ||||
|  | @ -1058,7 +1058,7 @@ wxBEGIN_EVENT_TABLE(ImageTransientPopup,wxPopupTransientWindow) | |||
| wxEND_EVENT_TABLE() | ||||
| 
 | ||||
| ImageTransientPopup::ImageTransientPopup( wxWindow *parent, bool scrolled, wxBitmap bmp) | ||||
|                      :wxPopupTransientWindow( parent, | ||||
|                      :PopupWindow( parent, | ||||
|                                               wxBORDER_NONE | | ||||
|                                               wxPU_CONTAINS_CONTROLS ) | ||||
| { | ||||
|  | @ -1115,21 +1115,21 @@ void ImageTransientPopup::SetImage(wxBitmap bmp) | |||
| 
 | ||||
| void ImageTransientPopup::Popup(wxWindow* WXUNUSED(focus)) | ||||
| { | ||||
|     wxPopupTransientWindow::Popup(); | ||||
|     PopupWindow::Popup(); | ||||
| } | ||||
| 
 | ||||
| void ImageTransientPopup::OnDismiss() | ||||
| { | ||||
|     wxPopupTransientWindow::OnDismiss(); | ||||
|     PopupWindow::OnDismiss(); | ||||
| } | ||||
| 
 | ||||
| bool ImageTransientPopup::ProcessLeftDown(wxMouseEvent& event) | ||||
| { | ||||
|     return wxPopupTransientWindow::ProcessLeftDown(event); | ||||
|     return PopupWindow::ProcessLeftDown(event); | ||||
| } | ||||
| bool ImageTransientPopup::Show( bool show ) | ||||
| { | ||||
|     return wxPopupTransientWindow::Show(show); | ||||
|     return PopupWindow::Show(show); | ||||
| } | ||||
| 
 | ||||
| void ImageTransientPopup::OnSize(wxSizeEvent &event) | ||||
|  |  | |||
|  | @ -16,6 +16,7 @@ | |||
| #include <vector> | ||||
| #include <functional> | ||||
| 
 | ||||
| #include "Widgets/PopupWindow.hpp" | ||||
| 
 | ||||
| #ifdef __WXMSW__ | ||||
| void                msw_rescale_menu(wxMenu* menu); | ||||
|  | @ -392,7 +393,7 @@ private: | |||
| // ImageTransientPopup
 | ||||
| // ----------------------------------------------------------------------------
 | ||||
| 
 | ||||
| class ImageTransientPopup : public wxPopupTransientWindow | ||||
| class ImageTransientPopup : public PopupWindow | ||||
| { | ||||
|     public: | ||||
|     ImageTransientPopup( wxWindow *parent, bool scrolled, wxBitmap bmp); | ||||
|  | @ -400,7 +401,7 @@ class ImageTransientPopup : public wxPopupTransientWindow | |||
| 
 | ||||
|     void SetImage(wxBitmap bmp); | ||||
| 
 | ||||
|     // wxPopupTransientWindow virtual methods are all overridden to log them
 | ||||
|     // PopupWindow 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; | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 chunmao.guo
						chunmao.guo