Changed size of hexagons.
+ ModeButton: Added another constructor
This commit is contained in:
parent
d81f7d8465
commit
a5de3386ac
3 changed files with 31 additions and 7 deletions
|
@ -257,9 +257,10 @@ void Tab::create_preset_tab()
|
|||
|
||||
// Fill cache for mode bitmaps
|
||||
m_mode_bitmap_cache.reserve(3);
|
||||
m_mode_bitmap_cache.push_back(ScalableBitmap(this, "mode_simple"));
|
||||
m_mode_bitmap_cache.push_back(ScalableBitmap(this, "mode_advanced"));
|
||||
m_mode_bitmap_cache.push_back(ScalableBitmap(this, "mode_expert"));
|
||||
int icon_px = 14;
|
||||
m_mode_bitmap_cache.push_back(ScalableBitmap(this, "mode_simple" , icon_px));
|
||||
m_mode_bitmap_cache.push_back(ScalableBitmap(this, "mode_advanced", icon_px));
|
||||
m_mode_bitmap_cache.push_back(ScalableBitmap(this, "mode_expert" , icon_px));
|
||||
|
||||
// Initialize the DynamicPrintConfig by default keys/values.
|
||||
build();
|
||||
|
|
|
@ -676,6 +676,20 @@ ModeButton::ModeButton( wxWindow * parent,
|
|||
const wxSize& size /* = wxDefaultSize*/,
|
||||
const wxPoint& pos /* = wxDefaultPosition*/) :
|
||||
ScalableButton(parent, id, icon_name, mode, size, pos, wxBU_EXACTFIT)
|
||||
{
|
||||
Init(mode);
|
||||
}
|
||||
|
||||
ModeButton::ModeButton( wxWindow* parent,
|
||||
const wxString& mode/* = wxEmptyString*/,
|
||||
const std::string& icon_name/* = ""*/,
|
||||
int px_cnt/* = 16*/) :
|
||||
ScalableButton(parent, wxID_ANY, ScalableBitmap(parent, icon_name, px_cnt), mode, wxBU_EXACTFIT)
|
||||
{
|
||||
Init(mode);
|
||||
}
|
||||
|
||||
void ModeButton::Init(const wxString &mode)
|
||||
{
|
||||
m_tt_focused = wxString::Format(_(L("Switch to the %s mode")), mode);
|
||||
m_tt_selected = wxString::Format(_(L("Current mode is %s")), mode);
|
||||
|
@ -739,7 +753,7 @@ ModeSizer::ModeSizer(wxWindow *parent, int hgap/* = 0*/) :
|
|||
|
||||
m_mode_btns.reserve(3);
|
||||
for (const auto& button : buttons) {
|
||||
m_mode_btns.push_back(new ModeButton(parent, wxID_ANY, button.second, button.first));
|
||||
m_mode_btns.push_back(new ModeButton(parent, button.first, button.second, 14));
|
||||
|
||||
m_mode_btns.back()->Bind(wxEVT_BUTTON, std::bind(modebtnfn, std::placeholders::_1, int(m_mode_btns.size() - 1)));
|
||||
Add(m_mode_btns.back());
|
||||
|
|
|
@ -255,9 +255,9 @@ public:
|
|||
void msw_rescale();
|
||||
|
||||
private:
|
||||
wxWindow* m_parent;
|
||||
std::string m_current_icon_name = "";
|
||||
std::string m_disabled_icon_name = "";
|
||||
wxWindow* m_parent { nullptr };
|
||||
std::string m_current_icon_name;
|
||||
std::string m_disabled_icon_name;
|
||||
int m_width {-1}; // should be multiplied to em_unit
|
||||
int m_height{-1}; // should be multiplied to em_unit
|
||||
|
||||
|
@ -280,8 +280,17 @@ public:
|
|||
const wxString& mode = wxEmptyString,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
const wxPoint& pos = wxDefaultPosition);
|
||||
|
||||
ModeButton(
|
||||
wxWindow* parent,
|
||||
const wxString& mode = wxEmptyString,
|
||||
const std::string& icon_name = "",
|
||||
int px_cnt = 16);
|
||||
|
||||
~ModeButton() {}
|
||||
|
||||
void Init(const wxString& mode);
|
||||
|
||||
void OnButton(wxCommandEvent& event);
|
||||
void OnEnterBtn(wxMouseEvent& event) { focus_button(true); event.Skip(); }
|
||||
void OnLeaveBtn(wxMouseEvent& event) { focus_button(m_is_selected); event.Skip(); }
|
||||
|
|
Loading…
Reference in a new issue