Consolidate wxAui art providers
This commit is contained in:
parent
17bcbdbf56
commit
924accfdc8
|
@ -210,7 +210,6 @@ set( COMMON_DLG_SRCS
|
|||
|
||||
set( COMMON_WIDGET_SRCS
|
||||
widgets/app_progress_dialog.cpp
|
||||
widgets/aui_art_provider.cpp
|
||||
widgets/bitmap_button.cpp
|
||||
widgets/bitmap_toggle.cpp
|
||||
widgets/button_row_panel.cpp
|
||||
|
@ -242,9 +241,9 @@ set( COMMON_WIDGET_SRCS
|
|||
widgets/unit_binder.cpp
|
||||
widgets/widget_save_restore.cpp
|
||||
widgets/widget_hotkey_list.cpp
|
||||
widgets/wx_aui_art_providers.cpp
|
||||
widgets/wx_busy_indicator.cpp
|
||||
widgets/wx_grid.cpp
|
||||
widgets/wx_aui_dock_art.cpp
|
||||
)
|
||||
|
||||
set( COMMON_DRAWING_SHEET_SRCS
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
#include <trace_helpers.h>
|
||||
#include <widgets/paged_dialog.h>
|
||||
#include <widgets/infobar.h>
|
||||
#include <widgets/wx_aui_dock_art.h>
|
||||
#include <widgets/wx_aui_art_providers.h>
|
||||
#include <wx/display.h>
|
||||
#include <wx/stdpaths.h>
|
||||
#include <wx/string.h>
|
||||
|
|
|
@ -35,8 +35,8 @@
|
|||
#include <tool/tool_event.h>
|
||||
#include <tool/tool_interactive.h>
|
||||
#include <tool/tool_manager.h>
|
||||
#include <widgets/aui_art_provider.h>
|
||||
#include <widgets/bitmap_button.h>
|
||||
#include <widgets/wx_aui_art_providers.h>
|
||||
#include <wx/popupwin.h>
|
||||
#include <wx/renderer.h>
|
||||
|
||||
|
@ -175,7 +175,7 @@ ACTION_TOOLBAR::ACTION_TOOLBAR( EDA_BASE_FRAME* parent, wxWindowID id, const wxP
|
|||
#ifdef NOTYET
|
||||
#if !wxCHECK_VERSION( 3, 1, 0 )
|
||||
// Custom art provider makes dark mode work on wx < 3.1
|
||||
AUI_ART_PROVIDER* newArt = new AUI_ART_PROVIDER();
|
||||
WX_AUI_TOOLBAR_ART* newArt = new WX_AUI_TOOLBAR_ART();
|
||||
SetArtProvider( newArt );
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -18,20 +18,21 @@
|
|||
*/
|
||||
|
||||
#include <wx/aui/aui.h>
|
||||
#include <wx/aui/framemanager.h>
|
||||
#include <wx/bitmap.h>
|
||||
#include <wx/dc.h>
|
||||
#include <wx/settings.h>
|
||||
|
||||
#include <kiplatform/ui.h>
|
||||
#include <widgets/aui_art_provider.h>
|
||||
#include <widgets/wx_aui_art_providers.h>
|
||||
|
||||
/**
|
||||
* wxAuiDefaultToolBarArt::DrawButton except with dark-mode awareness based on BITMAP_BUTTON
|
||||
* Unfortunately, wx 3.0 does not provide any hooks that would make it possible to do this in a way
|
||||
* other than just copy/pasting the upstream implementation and modifying it...
|
||||
*/
|
||||
void AUI_ART_PROVIDER::DrawButton( wxDC& aDc, wxWindow* aWindow, const wxAuiToolBarItem& aItem,
|
||||
const wxRect& aRect )
|
||||
void WX_AUI_TOOLBAR_ART::DrawButton( wxDC& aDc, wxWindow* aWindow, const wxAuiToolBarItem& aItem,
|
||||
const wxRect& aRect )
|
||||
{
|
||||
bool darkMode = KIPLATFORM::UI::IsDarkTheme();
|
||||
int textWidth = 0;
|
||||
|
@ -121,3 +122,20 @@ void AUI_ART_PROVIDER::DrawButton( wxDC& aDc, wxWindow* aWindow, const wxAuiTool
|
|||
aDc.DrawText( aItem.GetLabel(), textX, textY );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
WX_AUI_DOCK_ART::WX_AUI_DOCK_ART() : wxAuiDefaultDockArt()
|
||||
{
|
||||
#if defined( _WIN32 )
|
||||
#if wxCHECK_VERSION( 3, 1, 0 )
|
||||
// Use normal control font, wx likes to use "small"
|
||||
m_captionFont = *wxNORMAL_FONT;
|
||||
|
||||
// Increase the box the caption rests in size a bit
|
||||
m_captionSize = wxWindow::FromDIP( 20, NULL );
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Turn off the ridiculous looking gradient
|
||||
m_gradientType = wxAUI_GRADIENT_NONE;
|
||||
}
|
|
@ -1,38 +0,0 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation, either version 3 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <wx/aui/framemanager.h>
|
||||
#include <widgets/wx_aui_dock_art.h>
|
||||
|
||||
|
||||
WX_AUI_DOCK_ART::WX_AUI_DOCK_ART() : wxAuiDefaultDockArt()
|
||||
{
|
||||
#if defined( _WIN32 )
|
||||
#if wxCHECK_VERSION( 3, 1, 0 )
|
||||
// Use normal control font, wx likes to use "small"
|
||||
m_captionFont = *wxNORMAL_FONT;
|
||||
|
||||
// Increase the box the caption rests in size a bit
|
||||
m_captionSize = wxWindow::FromDIP( 20, NULL );
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Turn off the ridiculous looking gradient
|
||||
m_gradientType = wxAUI_GRADIENT_NONE;
|
||||
}
|
|
@ -17,25 +17,34 @@
|
|||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef KICAD_AUI_ART_PROVIDER_H
|
||||
#define KICAD_AUI_ART_PROVIDER_H
|
||||
#ifndef KICAD_WX_AUI_ART_PROVIDERS_H
|
||||
#define KICAD_WX_AUI_ART_PROVIDERS_H
|
||||
|
||||
#include <wx/aui/auibar.h>
|
||||
#include <wx/aui/dockart.h>
|
||||
|
||||
/**
|
||||
* wxWidgets 3.1 has support for dark mode detection, but 3.0 doesn't.
|
||||
* The main purpose of this replacement art provider is to backport that functionality
|
||||
* so that it is available in Linux systems that will likely be stuck on 3.0 for a while.
|
||||
*/
|
||||
class AUI_ART_PROVIDER : public wxAuiDefaultToolBarArt
|
||||
class WX_AUI_TOOLBAR_ART : public wxAuiDefaultToolBarArt
|
||||
{
|
||||
public:
|
||||
AUI_ART_PROVIDER() : wxAuiDefaultToolBarArt() {}
|
||||
WX_AUI_TOOLBAR_ART() : wxAuiDefaultToolBarArt() {}
|
||||
|
||||
virtual ~AUI_ART_PROVIDER() = default;
|
||||
virtual ~WX_AUI_TOOLBAR_ART() = default;
|
||||
|
||||
void DrawButton( wxDC& aDc, wxWindow* aWindow, const wxAuiToolBarItem& aItem,
|
||||
const wxRect& aRect ) override;
|
||||
};
|
||||
|
||||
#endif // KICAD_AUI_ART_PROVIDER_H
|
||||
|
||||
class WX_AUI_DOCK_ART : public wxAuiDefaultDockArt
|
||||
{
|
||||
public:
|
||||
WX_AUI_DOCK_ART();
|
||||
};
|
||||
|
||||
|
||||
#endif // KICAD_WX_AUI_ART_PROVIDERS_H
|
|
@ -1,31 +0,0 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation, either version 3 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef WX_AUI_DOCK_ART_H
|
||||
#define WX_AUI_DOCK_ART_H
|
||||
|
||||
#include <wx/aui/dockart.h>
|
||||
|
||||
class WX_AUI_DOCK_ART : public wxAuiDefaultDockArt
|
||||
{
|
||||
public:
|
||||
WX_AUI_DOCK_ART();
|
||||
};
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue