KiCad PCB EDA Suite
Loading...
Searching...
No Matches
FONT_CHOICE Class Reference

#include <font_choice.h>

Inheritance diagram for FONT_CHOICE:

Public Member Functions

 FONT_CHOICE (wxWindow *aParent, int aId, wxPoint aPosition, wxSize aSize, int nChoices, wxString *aChoices, int aStyle)
 
virtual ~FONT_CHOICE ()
 
void RefreshFonts ()
 
void SetFontSelection (KIFONT::FONT *aFont, bool aSilentMode=false)
 Set the selection in wxChoice widget.
 
bool HaveFontSelection () const
 
KIFONT::FONTGetFontSelection (bool aBold, bool aItalic, bool aForDrawingSheet=false) const
 
wxString GetStringSelection () const override
 

Protected Member Functions

void OnDrawItem (wxDC &dc, const wxRect &rect, int item, int flags) const override
 
void OnKeyDown (wxKeyEvent &aEvent)
 
void OnCharHook (wxKeyEvent &aEvent)
 
void OnTextCtrl (wxCommandEvent &aEvent)
 
void OnDropDown (wxCommandEvent &aEvent)
 
void OnCloseUp (wxCommandEvent &aEvent)
 
void OnSetFocus (wxFocusEvent &aEvent)
 
void OnKillFocus (wxFocusEvent &aEvent)
 

Private Member Functions

void DoAutoComplete (const wxString &aText)
 
void FilterFontList (const wxString &aFilter)
 
void RestoreFullFontList ()
 
int FindBestMatch (const wxString &aText)
 
wxString FindBestPartialMatch (const wxString &aText)
 
wxString GetDefaultFontName () const
 

Private Attributes

int m_systemFontCount
 
wxString m_notFound
 
wxArrayString m_fullFontList
 
bool m_isFiltered
 
wxString m_lastText
 
wxString m_originalSelection
 

Detailed Description

Definition at line 28 of file font_choice.h.

Constructor & Destructor Documentation

◆ FONT_CHOICE()

FONT_CHOICE::FONT_CHOICE ( wxWindow * aParent,
int aId,
wxPoint aPosition,
wxSize aSize,
int nChoices,
wxString * aChoices,
int aStyle )

◆ ~FONT_CHOICE()

FONT_CHOICE::~FONT_CHOICE ( )
virtual

Definition at line 202 of file font_choice.cpp.

References FONT_LIST_MANAGER::Get(), and FONT_LIST_MANAGER::Unregister().

Member Function Documentation

◆ DoAutoComplete()

void FONT_CHOICE::DoAutoComplete ( const wxString & aText)
private

Definition at line 662 of file font_choice.cpp.

References FindBestMatch(), and m_lastText.

Referenced by OnCharHook(), and OnTextCtrl().

◆ FilterFontList()

void FONT_CHOICE::FilterFontList ( const wxString & aFilter)
private

Definition at line 693 of file font_choice.cpp.

References m_fullFontList, m_isFiltered, m_systemFontCount, Refresh(), and RestoreFullFontList().

Referenced by OnCharHook(), and OnTextCtrl().

◆ FindBestMatch()

int FONT_CHOICE::FindBestMatch ( const wxString & aText)
private

Definition at line 806 of file font_choice.cpp.

References m_fullFontList.

Referenced by DoAutoComplete(), OnCharHook(), OnKillFocus(), and OnTextCtrl().

◆ FindBestPartialMatch()

wxString FONT_CHOICE::FindBestPartialMatch ( const wxString & aText)
private

Definition at line 842 of file font_choice.cpp.

References m_fullFontList.

Referenced by OnKillFocus().

◆ GetDefaultFontName()

wxString FONT_CHOICE::GetDefaultFontName ( ) const
private

Definition at line 883 of file font_choice.cpp.

References KICAD_FONT_NAME.

Referenced by OnCharHook(), and OnKillFocus().

◆ GetFontSelection()

KIFONT::FONT * FONT_CHOICE::GetFontSelection ( bool aBold,
bool aItalic,
bool aForDrawingSheet = false ) const

Definition at line 277 of file font_choice.cpp.

References KIFONT::FONT::GetFont(), KICAD_FONT_NAME, and m_systemFontCount.

◆ GetStringSelection()

wxString FONT_CHOICE::GetStringSelection ( ) const
override

Definition at line 317 of file font_choice.cpp.

◆ HaveFontSelection()

bool FONT_CHOICE::HaveFontSelection ( ) const

Definition at line 263 of file font_choice.cpp.

References m_notFound.

◆ OnCharHook()

void FONT_CHOICE::OnCharHook ( wxKeyEvent & aEvent)
protected

◆ OnCloseUp()

void FONT_CHOICE::OnCloseUp ( wxCommandEvent & aEvent)
protected

Definition at line 568 of file font_choice.cpp.

References m_isFiltered, and RestoreFullFontList().

Referenced by FONT_CHOICE().

◆ OnDrawItem()

void FONT_CHOICE::OnDrawItem ( wxDC & dc,
const wxRect & rect,
int item,
int flags ) const
overrideprotected

Definition at line 295 of file font_choice.cpp.

References m_systemFontCount, and name.

◆ OnDropDown()

void FONT_CHOICE::OnDropDown ( wxCommandEvent & aEvent)
protected

Definition at line 560 of file font_choice.cpp.

References m_originalSelection.

Referenced by FONT_CHOICE().

◆ OnKeyDown()

void FONT_CHOICE::OnKeyDown ( wxKeyEvent & aEvent)
protected

Definition at line 323 of file font_choice.cpp.

References m_lastText.

Referenced by FONT_CHOICE().

◆ OnKillFocus()

void FONT_CHOICE::OnKillFocus ( wxFocusEvent & aEvent)
protected

◆ OnSetFocus()

void FONT_CHOICE::OnSetFocus ( wxFocusEvent & aEvent)
protected

Definition at line 584 of file font_choice.cpp.

Referenced by FONT_CHOICE().

◆ OnTextCtrl()

void FONT_CHOICE::OnTextCtrl ( wxCommandEvent & aEvent)
protected

◆ RefreshFonts()

void FONT_CHOICE::RefreshFonts ( )

◆ RestoreFullFontList()

void FONT_CHOICE::RestoreFullFontList ( )
private

Definition at line 784 of file font_choice.cpp.

References m_fullFontList, and m_isFiltered.

Referenced by FilterFontList(), OnCharHook(), OnCloseUp(), OnKillFocus(), and OnTextCtrl().

◆ SetFontSelection()

void FONT_CHOICE::SetFontSelection ( KIFONT::FONT * aFont,
bool aSilentMode = false )

Set the selection in wxChoice widget.

Parameters
aFontis the fotn to select
aSilentModeallow or not a wxEVT_CHOICE on selection default = false: the event is sent. if true, just make silently the selection

Definition at line 244 of file font_choice.cpp.

References KIFONT::FONT::GetName(), m_notFound, and result.

Member Data Documentation

◆ m_fullFontList

wxArrayString FONT_CHOICE::m_fullFontList
private

◆ m_isFiltered

bool FONT_CHOICE::m_isFiltered
private

◆ m_lastText

wxString FONT_CHOICE::m_lastText
private

◆ m_notFound

wxString FONT_CHOICE::m_notFound
private

Definition at line 72 of file font_choice.h.

Referenced by FONT_CHOICE(), HaveFontSelection(), and SetFontSelection().

◆ m_originalSelection

wxString FONT_CHOICE::m_originalSelection
private

Definition at line 76 of file font_choice.h.

Referenced by FONT_CHOICE(), OnCharHook(), and OnDropDown().

◆ m_systemFontCount

int FONT_CHOICE::m_systemFontCount
private

Definition at line 71 of file font_choice.h.

Referenced by FilterFontList(), FONT_CHOICE(), GetFontSelection(), OnDrawItem(), and RefreshFonts().


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