KiCad PCB EDA Suite
Loading...
Searching...
No Matches
PROPERTIES_PANEL Class Referenceabstract

#include <properties_panel.h>

Inheritance diagram for PROPERTIES_PANEL:
FOOTPRINT_WIZARD_PROPERTIES_PANEL PCB_PROPERTIES_PANEL SCH_PROPERTIES_PANEL

Classes

struct  CATEGORY_BUTTON
 

Public Member Functions

 PROPERTIES_PANEL (wxWindow *aParent, EDA_BASE_FRAME *aFrame)
 
virtual ~PROPERTIES_PANEL ()
 
virtual void UpdateData ()=0
 
virtual void AfterCommit ()
 
wxPropertyGrid * GetPropertyGrid ()
 
int PropertiesCount () const
 
const std::vector< PROPERTY_BASE * > & Properties () const
 
void RecalculateSplitterPos ()
 
void SetSplitterProportion (float aProportion)
 
float SplitterProportion () const
 

Public Attributes

int m_SuppressGridChangeEvents
 

Protected Member Functions

virtual void rebuildProperties (const SELECTION &aSelection)
 Generates the property grid for a given selection of items.
 
virtual wxPGProperty * createPGProperty (const PROPERTY_BASE *aProperty) const =0
 
virtual void valueChanging (wxPropertyGridEvent &aEvent)
 
virtual void valueChanged (wxPropertyGridEvent &aEvent)
 
void onCharHook (wxKeyEvent &aEvent)
 
void onShow (wxShowEvent &aEvent)
 
virtual void OnLanguageChanged (wxCommandEvent &aEvent)
 
virtual bool isKeyEditable (const wxPGProperty *aPGProp) const
 
virtual bool isKeyNameInUse (const wxString &aName) const
 
virtual void onKeyRenamed (const wxString &aOldName, const wxString &aNewName)
 
virtual void onLabelEditBegin (wxPropertyGridEvent &aEvent)
 
virtual void onLabelEditEnding (wxPropertyGridEvent &aEvent)
 
virtual bool buildContextMenu (wxMenu &aMenu, wxPGProperty *aPGProp)
 
virtual void onNewItemLeftBlank (const wxString &aKey)
 
void onRightClick (wxPropertyGridEvent &aEvent)
 
void beginLabelEdit (const wxString &aKey, bool aStartBlank=false)
 
void settlePendingLabelEdit ()
 Synchronously ends any in-progress label edit; potentially canceling a newly added row.
 
virtual bool getItemValue (EDA_ITEM *aItem, PROPERTY_BASE *aProperty, wxVariant &aValue)
 Utility to fetch a property value and convert to wxVariant Precondition: aItem is known to have property aProperty.
 
bool extractValueAndWritability (const SELECTION &aSelection, const wxString &aPropName, wxVariant &aValue, bool &aWritable, wxPGChoices &aChoices)
 Processes a selection and determines whether the given property should be available or not and what the common value should be for the items in the selection.
 
void addCategoryButton (const wxString &aGroupKey, const wxString &aTooltip, BITMAPS aBitmap, std::function< void()> aAction, std::function< bool()> aEnableFunc=nullptr, bool aForceCategory=false)
 Registers an overlay button on a category caption row.
 
void updateCategoryButtons ()
 Updates overlay button visibility/positions; called after rebuilds and on scroll.
 
void hideCategoryButtons ()
 Hides all overlay buttons (used when no selection or a rebuild is deferred).
 
void positionCategoryButtons ()
 Find the caption row for the given untranslated group name, if present.
 
wxPGProperty * categoryForGroup (const wxString &aGroupKey) const
 

Protected Attributes

wxStaticText * m_caption
 
std::vector< PROPERTY_BASE * > m_displayed
 
wxPropertyGrid * m_grid
 
EDA_BASE_FRAMEm_frame
 
float m_splitter_key_proportion
 Proportion of the grid column splitter that is used for the key column (0.0 - 1.0)
 
wxTimer m_deferredRebuildTimer
 Not CallAfter(): on macOS the pending-event queue is drained from inside tool events, where a deferred rebuild would only re-defer itself forever.
 
SELECTION m_deferredSelection
 
wxString m_editingOriginalLabel
 
wxString m_contextMenuPropertyName
 
std::vector< CATEGORY_BUTTONm_categoryButtons
 
bool m_resolvingPendingKey = false
 True while settling a pending label edit synchronously (see settlePendingLabelEdit).
 
wxString m_pendingNewKey
 Key of a freshly-added blank field/custom property awaiting a name from the user.
 

Friends

class PROPERTIES_PANEL_GRID
 

Detailed Description

Definition at line 49 of file properties_panel.h.

Constructor & Destructor Documentation

◆ PROPERTIES_PANEL()

◆ ~PROPERTIES_PANEL()

PROPERTIES_PANEL::~PROPERTIES_PANEL ( )
virtual

Definition at line 216 of file properties_panel.cpp.

References m_frame, and OnLanguageChanged().

Member Function Documentation

◆ addCategoryButton()

void PROPERTIES_PANEL::addCategoryButton ( const wxString & aGroupKey,
const wxString & aTooltip,
BITMAPS aBitmap,
std::function< void()> aAction,
std::function< bool()> aEnableFunc = nullptr,
bool aForceCategory = false )
protected

Registers an overlay button on a category caption row.

The button is shown when its category row is on-screen and selection-appropriate (the optional enable predicate is consulted; it is re-evaluated on every rebuild).

TODO it would be nice to remove this hack by getting upstream wxWidgets to support customizing/subclassing the property group widgets

Parameters
aGroupKeyis the untranslated group name (e.g. _HKI( "Fields" )).
aTooltipis the tooltip text (translated by the caller).
aBitmapis the icon shown on the button.
aActionis invoked when the button is clicked.
aEnableFuncoptionally controls visibility (evaluated on each rebuild).
aForceCategoryoptionally forces the category caption row to be emitted during rebuilds (only when aEnableFunc, if set, returns true).

Definition at line 938 of file properties_panel.cpp.

References KiBitmapBundle(), m_categoryButtons, m_grid, and BITMAP_BUTTON::SetBitmap().

Referenced by PCB_PROPERTIES_PANEL::PCB_PROPERTIES_PANEL(), and SCH_PROPERTIES_PANEL::SCH_PROPERTIES_PANEL().

◆ AfterCommit()

virtual void PROPERTIES_PANEL::AfterCommit ( )
inlinevirtual

Reimplemented in PCB_PROPERTIES_PANEL, and SCH_PROPERTIES_PANEL.

Definition at line 59 of file properties_panel.h.

◆ beginLabelEdit()

void PROPERTIES_PANEL::beginLabelEdit ( const wxString & aKey,
bool aStartBlank = false )
protected

◆ buildContextMenu()

virtual bool PROPERTIES_PANEL::buildContextMenu ( wxMenu & aMenu,
wxPGProperty * aPGProp )
inlineprotectedvirtual

Reimplemented in PCB_PROPERTIES_PANEL, and SCH_PROPERTIES_PANEL.

Definition at line 106 of file properties_panel.h.

Referenced by onRightClick().

◆ categoryForGroup()

wxPGProperty * PROPERTIES_PANEL::categoryForGroup ( const wxString & aGroupKey) const
protected

Definition at line 968 of file properties_panel.cpp.

References m_grid.

Referenced by positionCategoryButtons().

◆ createPGProperty()

virtual wxPGProperty * PROPERTIES_PANEL::createPGProperty ( const PROPERTY_BASE * aProperty) const
protectedpure virtual

◆ extractValueAndWritability()

bool PROPERTIES_PANEL::extractValueAndWritability ( const SELECTION & aSelection,
const wxString & aPropName,
wxVariant & aValue,
bool & aWritable,
wxPGChoices & aChoices )
protected

Processes a selection and determines whether the given property should be available or not and what the common value should be for the items in the selection.

Parameters
aSelectionis a set of EDA_ITEMs to process
aPropertyis the property to look up
aValuewill be filled with the value common to the selection, or null if different
aWritablewill be set to whether or not the property can be written for the selection
Returns
true if the property is available for all the items in the selection

Definition at line 563 of file properties_panel.cpp.

References PROPERTY_BASE::GetChoices(), getItemValue(), PROPERTY_MANAGER::GetProperty(), PROPERTY_MANAGER::Instance(), PROPERTY_MANAGER::IsAvailableFor(), PROPERTY_MANAGER::IsWriteableFor(), and TYPE_HASH.

Referenced by rebuildProperties().

◆ getItemValue()

bool PROPERTIES_PANEL::getItemValue ( EDA_ITEM * aItem,
PROPERTY_BASE * aProperty,
wxVariant & aValue )
protectedvirtual

Utility to fetch a property value and convert to wxVariant Precondition: aItem is known to have property aProperty.

Returns
true if conversion succeeded

Reimplemented in PCB_PROPERTIES_PANEL, and SCH_PROPERTIES_PANEL.

Definition at line 532 of file properties_panel.cpp.

References INSPECTABLE::Get(), KIGFX::VIEW_ITEM::GetClass(), PROPERTY_BASE::HasChoices(), and PROPERTY_BASE::Name().

Referenced by extractValueAndWritability(), PCB_PROPERTIES_PANEL::getItemValue(), and SCH_PROPERTIES_PANEL::getItemValue().

◆ GetPropertyGrid()

wxPropertyGrid * PROPERTIES_PANEL::GetPropertyGrid ( )
inline

Definition at line 61 of file properties_panel.h.

References m_grid.

◆ hideCategoryButtons()

void PROPERTIES_PANEL::hideCategoryButtons ( )
protected

Hides all overlay buttons (used when no selection or a rebuild is deferred).

Definition at line 988 of file properties_panel.cpp.

References m_categoryButtons.

Referenced by rebuildProperties().

◆ isKeyEditable()

virtual bool PROPERTIES_PANEL::isKeyEditable ( const wxPGProperty * aPGProp) const
inlineprotectedvirtual

Reimplemented in PCB_PROPERTIES_PANEL, and SCH_PROPERTIES_PANEL.

Definition at line 99 of file properties_panel.h.

Referenced by onLabelEditBegin(), and onLabelEditEnding().

◆ isKeyNameInUse()

virtual bool PROPERTIES_PANEL::isKeyNameInUse ( const wxString & aName) const
inlineprotectedvirtual

Reimplemented in PCB_PROPERTIES_PANEL, and SCH_PROPERTIES_PANEL.

Definition at line 100 of file properties_panel.h.

Referenced by onLabelEditEnding(), and settlePendingLabelEdit().

◆ onCharHook()

void PROPERTIES_PANEL::onCharHook ( wxKeyEvent & aEvent)
protected

Definition at line 814 of file properties_panel.cpp.

References m_grid.

Referenced by PROPERTIES_PANEL().

◆ onKeyRenamed()

virtual void PROPERTIES_PANEL::onKeyRenamed ( const wxString & aOldName,
const wxString & aNewName )
inlineprotectedvirtual

Reimplemented in PCB_PROPERTIES_PANEL, and SCH_PROPERTIES_PANEL.

Definition at line 101 of file properties_panel.h.

Referenced by onLabelEditEnding(), and settlePendingLabelEdit().

◆ onLabelEditBegin()

void PROPERTIES_PANEL::onLabelEditBegin ( wxPropertyGridEvent & aEvent)
protectedvirtual

Definition at line 643 of file properties_panel.cpp.

References isKeyEditable(), and m_editingOriginalLabel.

Referenced by PROPERTIES_PANEL().

◆ onLabelEditEnding()

void PROPERTIES_PANEL::onLabelEditEnding ( wxPropertyGridEvent & aEvent)
protectedvirtual

◆ OnLanguageChanged()

void PROPERTIES_PANEL::OnLanguageChanged ( wxCommandEvent & aEvent)
protectedvirtual

◆ onNewItemLeftBlank()

virtual void PROPERTIES_PANEL::onNewItemLeftBlank ( const wxString & aKey)
inlineprotectedvirtual

Reimplemented in PCB_PROPERTIES_PANEL, and SCH_PROPERTIES_PANEL.

Definition at line 107 of file properties_panel.h.

Referenced by onLabelEditEnding(), and settlePendingLabelEdit().

◆ onRightClick()

void PROPERTIES_PANEL::onRightClick ( wxPropertyGridEvent & aEvent)
protected

Definition at line 740 of file properties_panel.cpp.

References buildContextMenu(), and m_contextMenuPropertyName.

Referenced by PROPERTIES_PANEL().

◆ onShow()

void PROPERTIES_PANEL::onShow ( wxShowEvent & aEvent)
protected

Definition at line 634 of file properties_panel.cpp.

References UpdateData().

Referenced by PROPERTIES_PANEL().

◆ positionCategoryButtons()

void PROPERTIES_PANEL::positionCategoryButtons ( )
protected

Find the caption row for the given untranslated group name, if present.

Definition at line 995 of file properties_panel.cpp.

References categoryForGroup(), m_categoryButtons, and m_grid.

Referenced by PROPERTIES_PANEL(), and updateCategoryButtons().

◆ Properties()

const std::vector< PROPERTY_BASE * > & PROPERTIES_PANEL::Properties ( ) const
inline

Definition at line 71 of file properties_panel.h.

References m_displayed.

◆ PropertiesCount()

int PROPERTIES_PANEL::PropertiesCount ( ) const
inline

Definition at line 66 of file properties_panel.h.

References m_displayed.

◆ rebuildProperties()

◆ RecalculateSplitterPos()

void PROPERTIES_PANEL::RecalculateSplitterPos ( )

◆ SetSplitterProportion()

void PROPERTIES_PANEL::SetSplitterProportion ( float aProportion)

Definition at line 931 of file properties_panel.cpp.

References m_splitter_key_proportion, and RecalculateSplitterPos().

◆ settlePendingLabelEdit()

void PROPERTIES_PANEL::settlePendingLabelEdit ( )
protected

◆ SplitterProportion()

float PROPERTIES_PANEL::SplitterProportion ( ) const
inline

Definition at line 79 of file properties_panel.h.

References m_splitter_key_proportion.

◆ updateCategoryButtons()

void PROPERTIES_PANEL::updateCategoryButtons ( )
protected

Updates overlay button visibility/positions; called after rebuilds and on scroll.

Definition at line 982 of file properties_panel.cpp.

References positionCategoryButtons().

Referenced by rebuildProperties().

◆ UpdateData()

virtual void PROPERTIES_PANEL::UpdateData ( )
pure virtual

◆ valueChanged()

virtual void PROPERTIES_PANEL::valueChanged ( wxPropertyGridEvent & aEvent)
inlineprotectedvirtual

Reimplemented in FOOTPRINT_WIZARD_PROPERTIES_PANEL, PCB_PROPERTIES_PANEL, and SCH_PROPERTIES_PANEL.

Definition at line 93 of file properties_panel.h.

Referenced by PROPERTIES_PANEL().

◆ valueChanging()

virtual void PROPERTIES_PANEL::valueChanging ( wxPropertyGridEvent & aEvent)
inlineprotectedvirtual

Reimplemented in FOOTPRINT_WIZARD_PROPERTIES_PANEL, PCB_PROPERTIES_PANEL, and SCH_PROPERTIES_PANEL.

Definition at line 92 of file properties_panel.h.

Referenced by PROPERTIES_PANEL().

Friends And Related Symbol Documentation

◆ PROPERTIES_PANEL_GRID

friend class PROPERTIES_PANEL_GRID
friend

Definition at line 51 of file properties_panel.h.

References PROPERTIES_PANEL_GRID.

Referenced by PROPERTIES_PANEL(), PROPERTIES_PANEL_GRID, and rebuildProperties().

Member Data Documentation

◆ m_caption

wxStaticText* PROPERTIES_PANEL::m_caption
protected

◆ m_categoryButtons

std::vector<CATEGORY_BUTTON> PROPERTIES_PANEL::m_categoryButtons
protected

◆ m_contextMenuPropertyName

wxString PROPERTIES_PANEL::m_contextMenuPropertyName
protected

◆ m_deferredRebuildTimer

wxTimer PROPERTIES_PANEL::m_deferredRebuildTimer
protected

Not CallAfter(): on macOS the pending-event queue is drained from inside tool events, where a deferred rebuild would only re-defer itself forever.

Definition at line 181 of file properties_panel.h.

Referenced by PROPERTIES_PANEL(), and rebuildProperties().

◆ m_deferredSelection

SELECTION PROPERTIES_PANEL::m_deferredSelection
protected

Definition at line 182 of file properties_panel.h.

Referenced by PROPERTIES_PANEL(), and rebuildProperties().

◆ m_displayed

std::vector<PROPERTY_BASE*> PROPERTIES_PANEL::m_displayed
protected

◆ m_editingOriginalLabel

wxString PROPERTIES_PANEL::m_editingOriginalLabel
protected

Definition at line 184 of file properties_panel.h.

Referenced by onLabelEditBegin(), and onLabelEditEnding().

◆ m_frame

EDA_BASE_FRAME* PROPERTIES_PANEL::m_frame
protected

Definition at line 174 of file properties_panel.h.

Referenced by PROPERTIES_PANEL(), rebuildProperties(), and ~PROPERTIES_PANEL().

◆ m_grid

◆ m_pendingNewKey

wxString PROPERTIES_PANEL::m_pendingNewKey
protected

◆ m_resolvingPendingKey

bool PROPERTIES_PANEL::m_resolvingPendingKey = false
protected

True while settling a pending label edit synchronously (see settlePendingLabelEdit).

Definition at line 203 of file properties_panel.h.

Referenced by onLabelEditEnding(), and settlePendingLabelEdit().

◆ m_splitter_key_proportion

float PROPERTIES_PANEL::m_splitter_key_proportion
protected

Proportion of the grid column splitter that is used for the key column (0.0 - 1.0)

Definition at line 177 of file properties_panel.h.

Referenced by PROPERTIES_PANEL(), RecalculateSplitterPos(), SetSplitterProportion(), and SplitterProportion().

◆ m_SuppressGridChangeEvents


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