Files
OrcaSlicer/src/slic3r/GUI/Widgets/TextInput.hpp
T
SoftFever 9e34dde632 Color mixing feature (#15347)
# Description

This PR ports the color mixing feature from BambuStudio.
The port is based on the previous work by @ianalexis in #15231.
This PR completes the port and fixes various bugs.

Several improvements were also made during the porting process.

WIP


# Screenshots/Recordings/Graphs

<!--
> Please attach relevant screenshots to showcase the UI changes.
> Please attach images that can help explain the changes.
-->

## Tests

<!--
> Please describe the tests that you have conducted to verify the
changes made in this PR.
-->

<!--
> A guide for users on how to download the artifacts from this PR.
-->

[How to Download Pull Requests Artifacts for
Testing](https://www.orcaslicer.com/wiki/how_to_download_pr_artifacts)
2026-08-25 22:10:49 +08:00

92 lines
2.3 KiB
C++

#ifndef slic3r_GUI_TextInput_hpp_
#define slic3r_GUI_TextInput_hpp_
#include <wx/textctrl.h>
#include "StaticBox.hpp"
class TextInput : public wxNavigationEnabled<StaticBox>
{
wxSize labelSize;
ScalableBitmap icon;
ScalableBitmap icon_1;
StateColor label_color;
StateColor text_color;
wxTextCtrl * text_ctrl;
wxString static_tips;
wxSize static_tips_size;
wxBitmap static_tips_icon;
static const int TextInputWidth = 200;
static const int TextInputHeight = 50;
public:
TextInput();
TextInput(wxWindow * parent,
wxString text,
wxString label = "",
wxString icon = "",
const wxPoint &pos = wxDefaultPosition,
const wxSize & size = wxDefaultSize,
long style = 0);
public:
void Create(wxWindow * parent,
wxString text,
wxString label = "",
wxString icon = "",
const wxPoint &pos = wxDefaultPosition,
const wxSize & size = wxDefaultSize,
long style = 0);
void SetCornerRadius(double radius);
// Only meant to be used by inspector, not public API
int GetCornerRadius() const { return static_cast<int>(radius); }
void SetLabel(const wxString& label) override;
void SetStaticTips(const wxString& tips, const wxBitmap& bitmap);
void SetIcon(const wxBitmap & icon);
void SetIcon(const wxString & icon);
void SetIcon_1(const wxString &icon);
void SetIcon_1(const wxBitmap &icon);
void SetLabelColor(StateColor const &color);
void SetTextColor(StateColor const &color);
virtual void Rescale();
virtual bool Enable(bool enable = true) override;
virtual void SetMinSize(const wxSize& size) override;
wxTextCtrl *GetTextCtrl() { return text_ctrl; }
wxTextCtrl const *GetTextCtrl() const { return text_ctrl; }
protected:
virtual void OnEdit() {}
virtual void DoSetSize(
int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO) override;
void DoSetToolTipText(wxString const &tip) override;
private:
void paintEvent(wxPaintEvent& evt);
void render(wxDC& dc);
void messureSize();
DECLARE_EVENT_TABLE()
};
#endif // !slic3r_GUI_TextInput_hpp_