Add Expert user mode (#13348)

Add Expert user mode with three-way mode switch. the old ModeButton has been removed.

Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
SoftFever
2026-04-25 18:14:51 +08:00
committed by GitHub
parent 95e6d8d4fd
commit 82e7ee937f
17 changed files with 338 additions and 399 deletions

View File

@@ -3,10 +3,9 @@
#include "../wxExtensions.hpp"
#include "StateColor.hpp"
#include "StaticBox.hpp"
#include <wx/tglbtn.h>
#include "Label.hpp"
#include "Button.hpp"
wxDECLARE_EVENT(wxCUSTOMEVT_SWITCH_POS, wxCommandEvent);
@@ -46,6 +45,37 @@ private:
StateColor thumb_color;
};
class ModeSwitchButton : public StaticBox
{
public:
ModeSwitchButton(wxWindow* parent = nullptr, wxWindowID id = wxID_ANY);
int GetSelection() const { return m_selection; }
void SetSelection(int selection);
void SelectAndNotify(int selection);
void Rescale();
void msw_rescale() { Rescale(); }
bool Enable(bool enable = true) override;
protected:
void doRender(wxDC& dc) override;
private:
void mouseDown(wxMouseEvent& event);
void mouseReleased(wxMouseEvent& event);
void mouseCaptureLost(wxMouseCaptureLostEvent& event);
int hit_test_selection(const wxPoint& point) const;
wxRect thumb_rect_for(int selection) const;
void update_tooltip();
private:
int m_selection { 0 };
bool m_pressed { false };
wxString m_tooltips[3];
};
class SwitchBoard : public wxWindow
{
public:
@@ -62,8 +92,8 @@ public:
void* client_data = nullptr;/*MachineObject* in StatusPanel*/
public:
void Enable();
void Disable();
bool Enable(bool enable = true) override;
bool Disable() { return Enable(false); }
bool IsEnabled(){return is_enable;};
void SetClientData(void* data) { client_data = data; };