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

@ -930,7 +930,7 @@ void NotificationManager::HintNotification::render_close_button(ImGuiWrapper& im
std::wstring button_text;
button_text = m_is_dark_mode ? ImGui::CloseNotifDarkButton : ImGui::CloseNotifButton;
button_text = m_is_dark ? ImGui::CloseNotifDarkButton : ImGui::CloseNotifButton;
ImVec2 button_pic_size = ImGui::CalcTextSize(into_u8(button_text).c_str());
ImVec2 button_size(button_pic_size.x * 1.25f, button_pic_size.y * 1.25f);
@ -939,7 +939,7 @@ void NotificationManager::HintNotification::render_close_button(ImGuiWrapper& im
ImVec2(win_pos.x, win_pos.y + win_size.y / 2 + button_pic_size.y),
true))
{
button_text = m_is_dark_mode ? ImGui::CloseNotifHoverDarkButton : ImGui::CloseNotifHoverButton;
button_text = m_is_dark ? ImGui::CloseNotifHoverDarkButton : ImGui::CloseNotifHoverButton;
if (ImGui::IsMouseClicked(ImGuiMouseButton_Left))
close();
}
@ -974,12 +974,12 @@ void NotificationManager::HintNotification::render_preferences_button(ImGuiWrapp
push_style_color(ImGuiCol_TextSelectedBg, ImVec4(0, .75f, .75f, 1.f), m_state == EState::FadingOut, m_current_fade_opacity);
std::wstring button_text;
button_text = m_is_dark_mode ? ImGui::PreferencesDarkButton : ImGui::PreferencesButton;
button_text = m_is_dark ? ImGui::PreferencesDarkButton : ImGui::PreferencesButton;
//hover
if (ImGui::IsMouseHoveringRect(ImVec2(win_pos_x - m_window_width / 15.f, win_pos_y + m_window_height - 1.5f * m_line_height),
ImVec2(win_pos_x, win_pos_y + m_window_height),
true)) {
button_text = m_is_dark_mode ? ImGui::PreferencesHoverDarkButton : ImGui::PreferencesHoverButton;
button_text = m_is_dark ? ImGui::PreferencesHoverDarkButton : ImGui::PreferencesHoverButton;
// tooltip
ImGui::PushStyleColor(ImGuiCol_PopupBg, ImGuiWrapper::COL_WINDOW_BACKGROUND);
ImGui::PushStyleColor(ImGuiCol_Border, { 0,0,0,0 });
@ -1017,7 +1017,7 @@ void NotificationManager::HintNotification::render_right_arrow_button(ImGuiWrapp
ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(.0f, .0f, .0f, .0f));
std::wstring button_text;
button_text = m_is_dark_mode ? ImGui::RightArrowDarkButton : ImGui::RightArrowButton;
button_text = m_is_dark ? ImGui::RightArrowDarkButton : ImGui::RightArrowButton;
ImVec2 button_pic_size = ImGui::CalcTextSize(into_u8(button_text).c_str());
ImVec2 button_size(button_pic_size.x * 1.25f, button_pic_size.y * 1.25f);
@ -1025,7 +1025,7 @@ void NotificationManager::HintNotification::render_right_arrow_button(ImGuiWrapp
ImVec2(win_pos_x - m_window_width / 15.f, win_pos_y + m_window_height),
true))
{
button_text = m_is_dark_mode ? ImGui::RightArrowHoverDarkButton : ImGui::RightArrowHoverButton;
button_text = m_is_dark ? ImGui::RightArrowHoverDarkButton : ImGui::RightArrowHoverButton;
// tooltip
ImGui::PushStyleColor(ImGuiCol_PopupBg, ImGuiWrapper::COL_WINDOW_BACKGROUND);
ImGui::PushStyleColor(ImGuiCol_Border, { 0,0,0,0 });
@ -1068,7 +1068,7 @@ void NotificationManager::HintNotification::render_documentation_button(ImGuiWra
ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(.0f, .0f, .0f, .0f));
std::wstring button_text;
button_text = m_is_dark_mode ? ImGui::DocumentationDarkButton : ImGui::DocumentationButton;
button_text = m_is_dark ? ImGui::DocumentationDarkButton : ImGui::DocumentationButton;
std::string placeholder_text;
placeholder_text = ImGui::EjectButton;
@ -1078,7 +1078,7 @@ void NotificationManager::HintNotification::render_documentation_button(ImGuiWra
ImVec2(win_pos.x - m_line_height * 2.5f, win_pos.y + win_size.y / 2 + button_pic_size.y),
true))
{
button_text = m_is_dark_mode ? ImGui::DocumentationHoverDarkButton : ImGui::DocumentationHoverButton;
button_text = m_is_dark ? ImGui::DocumentationHoverDarkButton : ImGui::DocumentationHoverButton;
// tooltip
ImGui::PushStyleColor(ImGuiCol_PopupBg, ImGuiWrapper::COL_WINDOW_BACKGROUND);
ImGui::PushStyleColor(ImGuiCol_Border, { 0,0,0,0 });