KiCad PCB EDA Suite
HTML_WINDOW Class Reference

Add dark theme support to wxHtmlWindow. More...

#include <html_window.h>

Inheritance diagram for HTML_WINDOW:
WX_HTML_REPORT_BOX

Public Member Functions

 HTML_WINDOW (wxWindow *aParent, wxWindowID aId=wxID_ANY, const wxPoint &aPos=wxDefaultPosition, const wxSize &aSize=wxDefaultSize, long aStyle=wxHW_DEFAULT_STYLE, const wxString &aName="htmlWindow")
 
bool SetPage (const wxString &aSource) override
 
bool AppendToPage (const wxString &aSource)
 
void ThemeChanged ()
 

Private Member Functions

void onThemeChanged (wxSysColourChangedEvent &aEvent)
 

Private Attributes

wxString m_pageSource
 

Detailed Description

Add dark theme support to wxHtmlWindow.

Definition at line 33 of file html_window.h.

Constructor & Destructor Documentation

◆ HTML_WINDOW()

HTML_WINDOW::HTML_WINDOW ( wxWindow *  aParent,
wxWindowID  aId = wxID_ANY,
const wxPoint &  aPos = wxDefaultPosition,
const wxSize &  aSize = wxDefaultSize,
long  aStyle = wxHW_DEFAULT_STYLE,
const wxString &  aName = "htmlWindow" 
)

Definition at line 29 of file html_window.cpp.

30  :
31  wxHtmlWindow( aParent, aId, aPos, aSize, aStyle, aName )
32 {
33  Bind( wxEVT_SYS_COLOUR_CHANGED,
34  wxSysColourChangedEventHandler( HTML_WINDOW::onThemeChanged ), this );
35 }
void onThemeChanged(wxSysColourChangedEvent &aEvent)
Definition: html_window.cpp:69

References onThemeChanged().

Member Function Documentation

◆ AppendToPage()

bool HTML_WINDOW::AppendToPage ( const wxString &  aSource)

Definition at line 57 of file html_window.cpp.

58 {
59  return SetPage( m_pageSource + aSource );
60 }
bool SetPage(const wxString &aSource) override
Definition: html_window.cpp:38
wxString m_pageSource
Definition: html_window.h:51

References m_pageSource, and SetPage().

Referenced by DIALOG_RESCUE_EACH::DIALOG_RESCUE_EACH(), DIALOG_SYMBOL_REMAP::DIALOG_SYMBOL_REMAP(), WX_HTML_REPORT_PANEL::Report(), and PANEL_ATTENUATORS::TransfAttenuatorResultsToPanel().

◆ onThemeChanged()

void HTML_WINDOW::onThemeChanged ( wxSysColourChangedEvent &  aEvent)
private

Definition at line 69 of file html_window.cpp.

70 {
71  ThemeChanged();
72 }
void ThemeChanged()
Definition: html_window.cpp:63

References ThemeChanged().

Referenced by HTML_WINDOW().

◆ SetPage()

bool HTML_WINDOW::SetPage ( const wxString &  aSource)
override

Definition at line 38 of file html_window.cpp.

39 {
40  m_pageSource = aSource;
41 
42  wxColour fgColor = wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOWTEXT );
43  wxColour bgColor = wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW );
44  wxColour linkColor = wxSystemSettings::GetColour( wxSYS_COLOUR_HOTLIGHT );
45 
46  wxString html = wxString::Format( wxT( "<html>\n<body text='%s' bgcolor='%s' link='%s'>\n" ),
47  fgColor.GetAsString( wxC2S_HTML_SYNTAX ),
48  bgColor.GetAsString( wxC2S_HTML_SYNTAX ),
49  linkColor.GetAsString( wxC2S_HTML_SYNTAX ) );
50  html.Append( aSource );
51  html.Append( wxT( "\n</body>\n</html>" ) );
52 
53  return wxHtmlWindow::SetPage( html );
54 }
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200
wxString m_pageSource
Definition: html_window.h:51

References Format(), and m_pageSource.

Referenced by AppendToPage(), DIALOG_ABOUT::createNotebookHtmlPage(), DIALOG_FP_PLUGIN_OPTIONS::DIALOG_FP_PLUGIN_OPTIONS(), DIALOG_TEMPLATE_SELECTOR::DIALOG_TEMPLATE_SELECTOR(), WX_HTML_REPORT_BOX::Flush(), WX_HTML_REPORT_PANEL::Flush(), PANEL_TRACK_WIDTH::LoadSettings(), DIALOG_FP_PLUGIN_OPTIONS::onListBoxItemSelected(), LIB_TREE::onPreselect(), HTML_MESSAGE_BOX::reload(), PANEL_ATTENUATORS::SetAttenuator(), PANEL_PACKAGES_VIEW::setPackageDetails(), DIALOG_DISPLAY_HTML_TEXT::SetPage(), ThemeChanged(), PANEL_ATTENUATORS::TransfAttenuatorDataToPanel(), PANEL_ATTENUATORS::TransfAttenuatorResultsToPanel(), and PANEL_PACKAGES_VIEW::unsetPackageDetails().

◆ ThemeChanged()

void HTML_WINDOW::ThemeChanged ( )

Definition at line 63 of file html_window.cpp.

64 {
66 }
bool SetPage(const wxString &aSource) override
Definition: html_window.cpp:38
wxString m_pageSource
Definition: html_window.h:51

References m_pageSource, and SetPage().

Referenced by onThemeChanged(), PANEL_TRACK_WIDTH::ThemeChanged(), and PANEL_ATTENUATORS::ThemeChanged().

Member Data Documentation

◆ m_pageSource

wxString HTML_WINDOW::m_pageSource
private

Definition at line 51 of file html_window.h.

Referenced by AppendToPage(), SetPage(), and ThemeChanged().


The documentation for this class was generated from the following files: