ENH:fixed transparent controls that cannot be clicked

Change-Id: I36f34b73a5248299b1db20127b5cbd010592f62a
This commit is contained in:
tao wang 2023-05-30 20:12:05 +08:00 committed by Lane.Wei
parent bba4b993f5
commit 27c8c81cc1
4 changed files with 21 additions and 1 deletions

View file

@ -1168,6 +1168,14 @@ ColorPickerPopup::ColorPickerPopup(wxWindow* parent)
m_ts_bitmap_custom = ScalableBitmap(this, "ts_custom_color_picker", 25);
m_ts_stbitmap_custom = new wxStaticBitmap(m_custom_cp, wxID_ANY, m_ts_bitmap_custom.bmp());
m_ts_stbitmap_custom->Bind(wxEVT_LEFT_DOWN, &ColorPickerPopup::on_custom_clr_picker, this);
m_ts_stbitmap_custom->Bind(wxEVT_ENTER_WINDOW, [this](auto& e) {
SetCursor(wxCURSOR_HAND);
});
m_ts_stbitmap_custom->Bind(wxEVT_LEAVE_WINDOW, [this](auto& e) {
SetCursor(wxCURSOR_ARROW);
});
auto sizer_custom = new wxBoxSizer(wxVERTICAL);
m_custom_cp->SetSizer(sizer_custom);
sizer_custom->Add(m_ts_stbitmap_custom, 0, wxEXPAND, 0);

View file

@ -1341,6 +1341,7 @@ void AMSItem::Update(AMSinfo amsinfo)
void AMSItem::create(wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size)
{
m_ts_bitmap_cube = new ScalableBitmap(this, "ts_bitmap_cube", 14);
wxWindow::Create(parent, id, pos, size);
SetBackgroundColour(AMS_CONTROL_WHITE_COLOUR);
HideHumidity();
@ -1461,7 +1462,13 @@ void AMSItem::doRender(wxDC &dc)
dc.DrawRoundedRectangle(left - 1, (size.y - AMS_ITEM_CUBE_SIZE.y) / 2 - 1, AMS_ITEM_CUBE_SIZE.x + 2, AMS_ITEM_CUBE_SIZE.y + 2, 2);
}else {
dc.DrawRoundedRectangle(left, (size.y - AMS_ITEM_CUBE_SIZE.y) / 2, AMS_ITEM_CUBE_SIZE.x, AMS_ITEM_CUBE_SIZE.y, 2);
if (iter->material_colour.Alpha() == 0) {
dc.DrawBitmap(m_ts_bitmap_cube->bmp(),left,(size.y - AMS_ITEM_CUBE_SIZE.y) / 2);
}
else {
dc.DrawRoundedRectangle(left, (size.y - AMS_ITEM_CUBE_SIZE.y) / 2, AMS_ITEM_CUBE_SIZE.x, AMS_ITEM_CUBE_SIZE.y, 2);
}
}

View file

@ -416,6 +416,7 @@ protected:
bool m_selected = {false};
bool m_show_humidity = {false};
int m_humidity = {0};
ScalableBitmap* m_ts_bitmap_cube;
void paintEvent(wxPaintEvent &evt);
void render(wxDC &dc);