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 SetHasIndeterminateChoice (bool aHasChoice=true)
 Set if the choice selection should show the INDETERMINATE_ACTION option at the top of the font selection list.
 
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

wxCoord OnMeasureItem (size_t aItem) const override
 
void OnDrawItem (wxDC &aDc, const wxRect &aRect, int aItem, int aFlags) 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 clearList ()
 
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_hasIndeterminateChoice
 
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 204 of file font_choice.cpp.

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

Member Function Documentation

◆ clearList()

void FONT_CHOICE::clearList ( )
private

Definition at line 210 of file font_choice.cpp.

Referenced by FilterFontList(), RefreshFonts(), and RestoreFullFontList().

◆ DoAutoComplete()

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

Definition at line 721 of file font_choice.cpp.

References FindBestMatch(), and m_lastText.

Referenced by OnCharHook(), and OnTextCtrl().

◆ FilterFontList()

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

◆ FindBestMatch()

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

Definition at line 863 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 899 of file font_choice.cpp.

References m_fullFontList.

Referenced by OnKillFocus().

◆ GetDefaultFontName()

wxString FONT_CHOICE::GetDefaultFontName ( ) const
private

Definition at line 940 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

◆ GetStringSelection()

wxString FONT_CHOICE::GetStringSelection ( ) const
override

Definition at line 376 of file font_choice.cpp.

◆ HaveFontSelection()

bool FONT_CHOICE::HaveFontSelection ( ) const

Definition at line 288 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 627 of file font_choice.cpp.

References m_isFiltered, and RestoreFullFontList().

Referenced by FONT_CHOICE().

◆ OnDrawItem()

void FONT_CHOICE::OnDrawItem ( wxDC & aDc,
const wxRect & aRect,
int aItem,
int aFlags ) const
overrideprotected

Definition at line 336 of file font_choice.cpp.

References m_systemFontCount, and name.

◆ OnDropDown()

void FONT_CHOICE::OnDropDown ( wxCommandEvent & aEvent)
protected

Definition at line 619 of file font_choice.cpp.

References m_originalSelection.

Referenced by FONT_CHOICE().

◆ OnKeyDown()

void FONT_CHOICE::OnKeyDown ( wxKeyEvent & aEvent)
protected

Definition at line 382 of file font_choice.cpp.

References m_lastText.

Referenced by FONT_CHOICE().

◆ OnKillFocus()

void FONT_CHOICE::OnKillFocus ( wxFocusEvent & aEvent)
protected

◆ OnMeasureItem()

wxCoord FONT_CHOICE::OnMeasureItem ( size_t aItem) const
overrideprotected

Definition at line 324 of file font_choice.cpp.

References name.

◆ OnSetFocus()

void FONT_CHOICE::OnSetFocus ( wxFocusEvent & aEvent)
protected

Definition at line 643 of file font_choice.cpp.

Referenced by FONT_CHOICE().

◆ OnTextCtrl()

void FONT_CHOICE::OnTextCtrl ( wxCommandEvent & aEvent)
protected

◆ RefreshFonts()

◆ RestoreFullFontList()

void FONT_CHOICE::RestoreFullFontList ( )
private

Definition at line 841 of file font_choice.cpp.

References clearList(), 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 269 of file font_choice.cpp.

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

◆ SetHasIndeterminateChoice()

void FONT_CHOICE::SetHasIndeterminateChoice ( bool aHasChoice = true)
inline

Set if the choice selection should show the INDETERMINATE_ACTION option at the top of the font selection list.

Definition at line 42 of file font_choice.h.

References m_hasIndeterminateChoice.

Member Data Documentation

◆ m_fullFontList

wxArrayString FONT_CHOICE::m_fullFontList
private

◆ m_hasIndeterminateChoice

bool FONT_CHOICE::m_hasIndeterminateChoice
private

Definition at line 84 of file font_choice.h.

Referenced by FONT_CHOICE(), RefreshFonts(), and SetHasIndeterminateChoice().

◆ 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 82 of file font_choice.h.

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

◆ m_originalSelection

wxString FONT_CHOICE::m_originalSelection
private

Definition at line 87 of file font_choice.h.

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

◆ m_systemFontCount

int FONT_CHOICE::m_systemFontCount
private

Definition at line 81 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: