mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-09-25 01:40:57 +00:00
Micro-refactor
This commit is contained in:
@@ -156,14 +156,13 @@ void ButtonsListCtrl::SetSelection(int sel)
|
||||
Refresh();
|
||||
}
|
||||
|
||||
bool ButtonsListCtrl::InsertPage(size_t n, const wxString &text, bool bSelect /* = false*/, const std::string &bmp_name /* = ""*/, int imageId /* = wxBookCtrlBase::NO_IMAGE */)
|
||||
bool ButtonsListCtrl::InsertPage(size_t n, const wxString &text, bool bSelect /* = false*/, const std::string &bmp_name /* = ""*/, const wxBitmap &bmp /* = wxNullBitmap */)
|
||||
{
|
||||
Button * btn = new Button(this, text.empty() ? text : " " + text, bmp_name, wxNO_BORDER);
|
||||
btn->SetCornerRadius(0);
|
||||
|
||||
if (bmp_name.empty() && m_imageList != nullptr && imageId != wxBookCtrlBase::NO_IMAGE && imageId >= 0 &&
|
||||
imageId < m_imageList->GetImageCount())
|
||||
btn->SetIcon(m_imageList->GetBitmap(imageId));
|
||||
if (bmp_name.empty() && bmp.IsOk())
|
||||
btn->SetIcon(bmp);
|
||||
|
||||
int em = em_unit(this);
|
||||
//BBS set size for button
|
||||
@@ -232,23 +231,6 @@ bool ButtonsListCtrl::SetPageImage(size_t n, const std::string& bmp_name) const
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ButtonsListCtrl::SetPageImage(size_t n, int imageId)
|
||||
{
|
||||
if (n >= m_pageButtons.size())
|
||||
return false;
|
||||
|
||||
if (imageId == wxBookCtrlBase::NO_IMAGE) {
|
||||
m_pageButtons[n]->SetIcon(wxBitmap());
|
||||
return true;
|
||||
}
|
||||
|
||||
if (m_imageList == nullptr || imageId < 0 || imageId >= m_imageList->GetImageCount())
|
||||
return false;
|
||||
|
||||
m_pageButtons[n]->SetIcon(m_imageList->GetBitmap(imageId));
|
||||
return true;
|
||||
}
|
||||
|
||||
void ButtonsListCtrl::SetPageText(size_t n, const wxString& strText)
|
||||
{
|
||||
Button* btn = m_pageButtons[n];
|
||||
|
||||
Reference in New Issue
Block a user