ENH: update send print dialog options GUI style

jira: [STUDIO-11444]
Change-Id: I16f6e93edf09dc84786a0f7e6a14c9d0734542b8
(cherry picked from commit 6e9f2ecb5b1471e4e7432ca681b6e5b293929a46)
This commit is contained in:
xin.zhang
2025-04-10 14:32:37 +08:00
committed by Noisyfox
parent 0b2e356f53
commit 35353fb210
2 changed files with 76 additions and 169 deletions

View File

@@ -210,44 +210,38 @@ static int get_brightness_value(wxImage image) {
struct POItem
{
std::string key;
wxString value;
wxString value; // the display value
public:
bool operator==(const POItem &other) const { return key == other.key && value == other.value; }
};
class PrintOptionItem : public wxPanel
class PrintOptionItem : public ComboBox
{
ScalableBitmap m_selected_bk;
std::vector<POItem> m_ops;
std::string selected_key;
std::string m_param;
bool m_enabled = true;
public:
PrintOptionItem(wxWindow *parent, std::vector<POItem> ops, std::string param = "");
~PrintOptionItem(){};
~PrintOptionItem() {};
public:
bool Enable(bool enable) override { m_enabled = enable; return m_enabled;}
bool Enable(bool enable) override { return ComboBox::Enable(enable); }
void setValue(std::string value);
std::string getValue();
std::string getValue() const { return selected_key; }
void msw_rescale() { m_selected_bk.msw_rescale(); Refresh();};
void update_options(std::vector<POItem> ops){
m_ops = ops;
selected_key = "";
auto width = ops.size() * FromDIP(56) + FromDIP(8);
auto height = FromDIP(22) + FromDIP(8);
SetMinSize(wxSize(width, height));
SetMaxSize(wxSize(width, height));
Refresh();
};
void msw_rescale() { ComboBox::Rescale();};
void update_options(std::vector<POItem> ops);
bool CanBeFocused() const override { return false; }
private:
void OnPaint(wxPaintEvent &event);
void render(wxDC &dc);
void on_left_down(wxMouseEvent &evt);
void doRender(wxDC &dc);
void on_combobox_changed(wxCommandEvent &evt);
wxString get_display_str(const std::string& key) const;
std::string get_key(const wxString &display_val) const;
};
class PrintOption : public wxPanel
@@ -273,10 +267,12 @@ public:
bool contain_opt(const std::string& opt_str) const;
void update_options(std::vector<POItem> ops, const wxString &tips);
void update_tooltip(const wxString &tips);
void update_tooltip(const wxString &tips);
void msw_rescale() { m_printoption_item->msw_rescale(); };
void msw_rescale() { m_printoption_item->msw_rescale(); };
// override funcs
bool CanBeFocused() const override { return false; }
private:
void OnPaint(wxPaintEvent &event);