ENH:refine GLCanvas update dark mode logic

Change-Id: Id4c4f00a18fa0672eab528a6819b6665031a8915
This commit is contained in:
liz.li 2022-12-05 18:21:15 +08:00 committed by Lane.Wei
parent e59fe6511d
commit aab62b77bf
27 changed files with 234 additions and 148 deletions

View file

@ -166,6 +166,7 @@ public:
NotificationManager(wxEvtHandler* evt_handler);
~NotificationManager(){}
void on_change_color_mode(bool is_dark);
// init is called after canvas3d is created. Notifications added before init are not showed or updated
void init() { m_initialized = true; }
// Push a prefabricated notification from basic_notifications (see the table at the end of this file).
@ -394,8 +395,7 @@ private:
// set start of notification to now. Used by delayed notifications
void reset_timer() { m_notification_start = GLCanvas3D::timestamp_now(); m_state = EState::Shown; }
void set_Multiline(bool Multi) { m_multiline = Multi; }
bool m_is_dark_mode = false;
void on_change_color_mode(bool is_dark);
protected:
// Call after every size change
@ -432,6 +432,8 @@ private:
// used this function instead of reading directly m_data.duration. Some notifications might need to return changing value.
virtual int get_duration() { return m_data.duration; }
bool m_is_dark = false;
const NotificationData m_data;
// For reusing ImGUI windows.
NotificationIDProvider &m_id_provider;
@ -823,6 +825,7 @@ private:
}
}
bool m_is_dark = false;
// set by init(), until false notifications are only added not updated and frame is not requested after push
bool m_initialized{ false };
// Target for wxWidgets events sent by clicking on the hyperlink available at some notifications.