Using of wxWidgets 3.1.6 WIP:
* Create Cache of wxBitmapBundles instead of wxBitmaps * Use wxBitmapBundles instead of wxBitmap for most of Widgets * Use empty bitmabundles instead of wxNullBitmap for wxBitmapComboBoxes. * Updated wxWidgets.cmake * OSX specific: Discard BitmapComboBox overrides + some code cleaning
This commit is contained in:
parent
e21921f2eb
commit
066b567714
45 changed files with 930 additions and 867 deletions
|
@ -16,15 +16,14 @@
|
|||
#include <functional>
|
||||
|
||||
|
||||
#ifdef __WXMSW__
|
||||
void msw_rescale_menu(wxMenu* menu);
|
||||
#else /* __WXMSW__ */
|
||||
inline void msw_rescale_menu(wxMenu* /* menu */) {}
|
||||
#endif /* __WXMSW__ */
|
||||
#ifndef __linux__
|
||||
void sys_color_changed_menu(wxMenu* menu);
|
||||
#else
|
||||
inline void sys_color_changed_menu(wxMenu* /* menu */) {}
|
||||
#endif // no __linux__
|
||||
|
||||
wxMenuItem* append_menu_item(wxMenu* menu, int id, const wxString& string, const wxString& description,
|
||||
// std::function<void(wxCommandEvent& event)> cb, const wxBitmap& icon, wxEvtHandler* event_handler = nullptr,
|
||||
std::function<void(wxCommandEvent& event)> cb, const wxBitmapBundle& icon, wxEvtHandler* event_handler = nullptr,
|
||||
std::function<void(wxCommandEvent& event)> cb, wxBitmapBundle* icon, wxEvtHandler* event_handler = nullptr,
|
||||
std::function<bool()> const cb_condition = []() { return true;}, wxWindow* parent = nullptr, int insert_pos = wxNOT_FOUND);
|
||||
wxMenuItem* append_menu_item(wxMenu* menu, int id, const wxString& string, const wxString& description,
|
||||
std::function<void(wxCommandEvent& event)> cb, const std::string& icon = "", wxEvtHandler* event_handler = nullptr,
|
||||
|
@ -51,15 +50,16 @@ void msw_buttons_rescale(wxDialog* dlg, const int em_unit, const std::vector<
|
|||
int em_unit(wxWindow* win);
|
||||
int mode_icon_px_size();
|
||||
|
||||
//wxBitmap create_menu_bitmap(const std::string& bmp_name);
|
||||
wxBitmapBundle create_menu_bitmap(const std::string& bmp_name);
|
||||
wxBitmapBundle* get_bmp_bundle(const std::string& bmp_name, int px_cnt = 16);
|
||||
wxBitmapBundle* get_empty_bmp_bundle(int width, int height);
|
||||
wxBitmapBundle* get_solid_bmp_bundle(int width, int height, const std::string& color);
|
||||
|
||||
wxBitmap create_scaled_bitmap(const std::string& bmp_name, wxWindow *win = nullptr,
|
||||
const int px_cnt = 16, const bool grayscale = false,
|
||||
const std::string& new_color = std::string(), // color witch will used instead of orange
|
||||
const bool menu_bitmap = false);
|
||||
|
||||
std::vector<wxBitmap*> get_extruder_color_icons(bool thin_icon = false);
|
||||
std::vector<wxBitmapBundle*> get_extruder_color_icons(bool thin_icon = false);
|
||||
|
||||
namespace Slic3r {
|
||||
namespace GUI {
|
||||
|
@ -148,21 +148,28 @@ public:
|
|||
|
||||
~ScalableBitmap() {}
|
||||
|
||||
wxSize GetBmpSize() const;
|
||||
int GetBmpWidth() const;
|
||||
int GetBmpHeight() const;
|
||||
void sys_color_changed();
|
||||
|
||||
void msw_rescale();
|
||||
const wxBitmapBundle& bmp() const { return m_bmp; }
|
||||
wxBitmap get_bitmap() { return m_bmp.GetBitmapFor(m_parent); }
|
||||
wxWindow* parent() const { return m_parent;}
|
||||
const std::string& name() const { return m_icon_name; }
|
||||
int px_cnt() const { return m_px_cnt;}
|
||||
|
||||
const wxBitmap& bmp() const { return m_bmp; }
|
||||
wxBitmap& bmp() { return m_bmp; }
|
||||
const std::string& name() const{ return m_icon_name; }
|
||||
|
||||
int px_cnt()const {return m_px_cnt;}
|
||||
wxSize GetSize() const {
|
||||
#ifdef __APPLE__
|
||||
return m_bmp.GetDefaultSize();
|
||||
#else
|
||||
return m_bmp.GetPreferredBitmapSizeFor(m_parent);
|
||||
#endif
|
||||
}
|
||||
int GetWidth() const { return GetSize().GetWidth(); }
|
||||
int GetHeight() const { return GetSize().GetHeight(); }
|
||||
|
||||
private:
|
||||
wxWindow* m_parent{ nullptr };
|
||||
wxBitmap m_bmp = wxBitmap();
|
||||
wxBitmapBundle m_bmp = wxBitmapBundle();
|
||||
wxBitmap m_bitmap = wxBitmap();
|
||||
std::string m_icon_name = "";
|
||||
int m_px_cnt {16};
|
||||
bool m_grayscale {false};
|
||||
|
@ -192,7 +199,7 @@ public:
|
|||
void enable() { m_disabled = false; }
|
||||
void disable() { m_disabled = true; }
|
||||
|
||||
void msw_rescale();
|
||||
void sys_color_changed();
|
||||
|
||||
protected:
|
||||
void update_button_bitmaps();
|
||||
|
@ -224,7 +231,6 @@ public:
|
|||
const wxSize& size = wxDefaultSize,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
long style = wxBU_EXACTFIT | wxNO_BORDER,
|
||||
bool use_default_disabled_bitmap = false,
|
||||
int bmp_px_cnt = 16);
|
||||
|
||||
ScalableButton(
|
||||
|
@ -240,9 +246,8 @@ public:
|
|||
bool SetBitmap_(const std::string& bmp_name);
|
||||
void SetBitmapDisabled_(const ScalableBitmap &bmp);
|
||||
int GetBitmapHeight();
|
||||
void UseDefaultBitmapDisabled();
|
||||
|
||||
void msw_rescale();
|
||||
void sys_color_changed();
|
||||
|
||||
private:
|
||||
wxWindow* m_parent { nullptr };
|
||||
|
@ -251,8 +256,6 @@ private:
|
|||
int m_width {-1}; // should be multiplied to em_unit
|
||||
int m_height{-1}; // should be multiplied to em_unit
|
||||
|
||||
bool m_use_default_disabled_bitmap {false};
|
||||
|
||||
// bitmap dimensions
|
||||
int m_px_cnt{ 16 };
|
||||
bool m_has_border {false};
|
||||
|
@ -318,7 +321,7 @@ public:
|
|||
void set_items_flag(int flag);
|
||||
void set_items_border(int border);
|
||||
|
||||
void msw_rescale();
|
||||
void sys_color_changed();
|
||||
const std::vector<ModeButton*>& get_btns() { return m_mode_btns; }
|
||||
|
||||
private:
|
||||
|
@ -366,12 +369,11 @@ public:
|
|||
|
||||
~BlinkingBitmap() {}
|
||||
|
||||
void msw_rescale();
|
||||
void invalidate();
|
||||
void activate();
|
||||
void blink();
|
||||
|
||||
const wxBitmap& get_bmp() const { return bmp.bmp(); }
|
||||
const wxBitmapBundle& get_bmp() const { return bmp.bmp(); }
|
||||
|
||||
private:
|
||||
ScalableBitmap bmp;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue