Code refactoring for Highlighter class

This commit is contained in:
YuSanka 2021-12-22 12:30:19 +01:00
parent f2aeca3a71
commit c767781827
6 changed files with 89 additions and 40 deletions

View file

@ -382,26 +382,59 @@ namespace Slic3r {
namespace GUI {
class OG_CustomCtrl;
// Highlighter is used as an instrument to put attention to some UI control
class Highlighter
{
OG_CustomCtrl* m_custom_ctrl{ nullptr };
bool* m_show_blink_ptr{ nullptr };
BlinkingBitmap* m_blinking_bitmap{ nullptr };
int m_blink_counter{ 0 };
int m_blink_counter { 0 };
wxTimer m_timer;
public:
void set_timer_owner(wxEvtHandler* owner, int timerid = wxID_ANY);
void init(std::pair<OG_CustomCtrl*, bool*>);
void init(BlinkingBitmap* blinking_bitmap);
Highlighter() {}
~Highlighter() {}
void set_timer_owner(wxWindow* owner, int timerid = wxID_ANY);
virtual void bind_timer(wxWindow* owner) = 0;
bool init(bool input_failed);
void blink();
void invalidate();
};
class HighlighterForWx : public Highlighter
{
// There are 2 possible cases to use HighlighterForWx:
// - using a BlinkingBitmap. Change state of this bitmap
BlinkingBitmap* m_blinking_bitmap { nullptr };
// - using OG_CustomCtrl where arrow will be rendered and flag indicated "show/hide" state of this arrow
OG_CustomCtrl* m_custom_ctrl { nullptr };
bool* m_show_blink_ptr { nullptr };
public:
HighlighterForWx() {}
~HighlighterForWx() {}
void bind_timer(wxWindow* owner) override;
void init(BlinkingBitmap* blinking_bitmap);
void init(std::pair<OG_CustomCtrl*, bool*>);
void blink();
void invalidate();
};
/*
class HighlighterForImGUI : public Highlighter
{
public:
HighlighterForImGUI() {}
~HighlighterForImGUI() {}
void init();
void blink();
void invalidate();
};
*/
} // GUI
} // Slic3r
#endif // slic3r_GUI_wxExtensions_hpp_