mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-31 04:31:15 -06:00 
			
		
		
		
	FIX: dark mode of wxTextCtrl
Change-Id: I8a377228b79d24ffe6284acf9be7017207b5dddc
This commit is contained in:
		
							parent
							
								
									3925ceb9f4
								
							
						
					
					
						commit
						65ee16f676
					
				
					 8 changed files with 21 additions and 7 deletions
				
			
		|  | @ -96,6 +96,7 @@ MediaFilePanel::MediaFilePanel(wxWindow * parent) | |||
|     m_button_management->SetBorderWidth(0); | ||||
|     m_button_management->SetBackgroundColorNormal(wxColor("#00AE42")); | ||||
|     m_button_management->SetTextColorNormal(*wxWHITE); | ||||
|     m_button_management->Enable(false); | ||||
| 
 | ||||
|     wxBoxSizer *manage_sizer = new wxBoxSizer(wxHORIZONTAL); | ||||
|     manage_sizer->AddStretchSpacer(1); | ||||
|  |  | |||
|  | @ -26,7 +26,7 @@ Button::Button() | |||
|     : paddingSize(10, 8) | ||||
| { | ||||
|     background_color = StateColor( | ||||
|         std::make_pair(0xF0F0F0, (int) StateColor::Disabled), | ||||
|         std::make_pair(0xF0F0F1, (int) StateColor::Disabled), | ||||
|         std::make_pair(0x37EE7C, (int) StateColor::Hovered | StateColor::Checked), | ||||
|         std::make_pair(0x00AE42, (int) StateColor::Checked), | ||||
|         std::make_pair(*wxLIGHT_GREY, (int) StateColor::Hovered),  | ||||
|  |  | |||
|  | @ -41,7 +41,7 @@ ComboBox::ComboBox(wxWindow *      parent, | |||
|         TextInput::SetBorderColor(StateColor(std::make_pair(0xDBDBDB, (int) StateColor::Disabled), | ||||
|             std::make_pair(0x00AE42, (int) StateColor::Hovered), | ||||
|             std::make_pair(0xDBDBDB, (int) StateColor::Normal))); | ||||
|         TextInput::SetBackgroundColor(StateColor(std::make_pair(0xF0F0F0, (int) StateColor::Disabled), | ||||
|         TextInput::SetBackgroundColor(StateColor(std::make_pair(0xF0F0F1, (int) StateColor::Disabled), | ||||
|             std::make_pair(0xEDFAF2, (int) StateColor::Focused), | ||||
|             std::make_pair(*wxWHITE, (int) StateColor::Normal))); | ||||
|         TextInput::SetLabelColor(StateColor(std::make_pair(0x909090, (int) StateColor::Disabled), | ||||
|  |  | |||
|  | @ -1,6 +1,7 @@ | |||
| #include "SpinInput.hpp" | ||||
| #include "Label.hpp" | ||||
| #include "Button.hpp" | ||||
| #include "TextCtrl.h" | ||||
| 
 | ||||
| #include <wx/dcgraph.h> | ||||
| 
 | ||||
|  | @ -27,7 +28,7 @@ SpinInput::SpinInput() | |||
|     border_width     = 1; | ||||
|     border_color     = StateColor(std::make_pair(0xDBDBDB, (int) StateColor::Disabled), std::make_pair(0x00AE42, (int) StateColor::Hovered), | ||||
|                               std::make_pair(0xDBDBDB, (int) StateColor::Normal)); | ||||
|     background_color = StateColor(std::make_pair(0xF0F0F0, (int) StateColor::Disabled), std::make_pair(*wxWHITE, (int) StateColor::Normal)); | ||||
|     background_color = StateColor(std::make_pair(0xF0F0F1, (int) StateColor::Disabled), std::make_pair(*wxWHITE, (int) StateColor::Normal)); | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
|  | @ -56,7 +57,7 @@ void SpinInput::Create(wxWindow *parent, | |||
|     wxWindow::SetLabel(label); | ||||
|     state_handler.attach({&label_color, &text_color}); | ||||
|     state_handler.update_binds(); | ||||
|     text_ctrl = new wxTextCtrl(this, wxID_ANY, text, {20, 4}, wxDefaultSize, style | wxBORDER_NONE | wxTE_PROCESS_ENTER, wxTextValidator(wxFILTER_DIGITS)); | ||||
|     text_ctrl = new TextCtrl(this, wxID_ANY, text, {20, 4}, wxDefaultSize, style | wxBORDER_NONE | wxTE_PROCESS_ENTER, wxTextValidator(wxFILTER_DIGITS)); | ||||
|     text_ctrl->SetFont(Label::Body_14); | ||||
|     text_ctrl->SetBackgroundColour(background_color.colorForStates(state_handler.states())); | ||||
|     text_ctrl->SetForegroundColour(text_color.colorForStates(state_handler.states())); | ||||
|  |  | |||
|  | @ -32,6 +32,7 @@ static std::map<wxColour, wxColour> gDarkColors{ | |||
|     {"#FEFFFF", "#242428"}, | ||||
|     {"#A6A9AA", "#2D2D29"}, | ||||
|     {"#363636", "#B2B3B5"}, | ||||
|     {"#F0F0F1", "#404040"}, | ||||
| }; | ||||
| std::map<wxColour, wxColour> const & StateColor::GetDarkMap()  | ||||
| { | ||||
|  |  | |||
|  | @ -21,7 +21,7 @@ StaticBox::StaticBox() | |||
|     , radius(8) | ||||
| { | ||||
|     border_color = StateColor( | ||||
|         std::make_pair(*wxLIGHT_GREY, (int) StateColor::Disabled),  | ||||
|         std::make_pair(0xF0F0F1, (int) StateColor::Disabled),  | ||||
|         std::make_pair(0x303A3C, (int) StateColor::Normal)); | ||||
| } | ||||
| 
 | ||||
|  |  | |||
							
								
								
									
										10
									
								
								src/slic3r/GUI/Widgets/TextCtrl.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								src/slic3r/GUI/Widgets/TextCtrl.h
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,10 @@ | |||
| #ifdef __WXMSW__ | ||||
| class TextCtrl : public wxTextCtrl | ||||
| { | ||||
| public: | ||||
|     using wxTextCtrl::wxTextCtrl; | ||||
|     WXHBRUSH DoMSWControlColor(WXHDC pDC, wxColour colBg, WXHWND hWnd) { return wxTextCtrl::DoMSWControlColor(pDC, wxColour(), hWnd); } | ||||
| }; | ||||
| #else | ||||
| typedef wxTextCtrl TextCtrl; | ||||
| #endif | ||||
|  | @ -1,5 +1,6 @@ | |||
| #include "TextInput.hpp" | ||||
| #include "Label.hpp" | ||||
| #include "TextCtrl.h" | ||||
| 
 | ||||
| #include <wx/dcgraph.h> | ||||
| 
 | ||||
|  | @ -25,7 +26,7 @@ TextInput::TextInput() | |||
|     border_width = 1; | ||||
|     border_color = StateColor(std::make_pair(0xDBDBDB, (int) StateColor::Disabled), std::make_pair(0x00AE42, (int) StateColor::Hovered), | ||||
|                               std::make_pair(0xDBDBDB, (int) StateColor::Normal)); | ||||
|     background_color = StateColor(std::make_pair(0xF0F0F0, (int) StateColor::Disabled), std::make_pair(*wxWHITE, (int) StateColor::Normal)); | ||||
|     background_color = StateColor(std::make_pair(0xF0F0F1, (int) StateColor::Disabled), std::make_pair(*wxWHITE, (int) StateColor::Normal)); | ||||
|     SetFont(Label::Body_12); | ||||
| } | ||||
| 
 | ||||
|  | @ -55,7 +56,7 @@ void TextInput::Create(wxWindow *     parent, | |||
|     style &= ~wxRIGHT; | ||||
|     state_handler.attach({&label_color, & text_color}); | ||||
|     state_handler.update_binds(); | ||||
|     text_ctrl = new wxTextCtrl(this, wxID_ANY, text, {4, 4}, wxDefaultSize, style | wxBORDER_NONE | wxTE_PROCESS_ENTER); | ||||
|     text_ctrl = new TextCtrl(this, wxID_ANY, text, {4, 4}, wxDefaultSize, style | wxBORDER_NONE | wxTE_PROCESS_ENTER); | ||||
|     text_ctrl->SetFont(Label::Body_14); | ||||
|     text_ctrl->SetInitialSize(text_ctrl->GetBestSize()); | ||||
|     text_ctrl->SetBackgroundColour(background_color.colorForStates(state_handler.states())); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 chunmao.guo
						chunmao.guo