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

A checkable list of files, grouped into sections. More...

#include <file_checklist_ctrl.h>

Inheritance diagram for FILE_CHECKLIST_CTRL:
WX_DATAVIEWCTRL

Public Member Functions

 FILE_CHECKLIST_CTRL (wxWindow *aParent, wxWindowID aId=wxID_ANY)
 
 ~FILE_CHECKLIST_CTRL () override
 
void SetEntries (const std::vector< FILE_CHECKLIST_ENTRY > &aEntries)
 
void SetAllChecked (bool aChecked)
 
std::vector< wxString > GetCheckedPaths () const
 
wxString GetItemPath (const wxDataViewItem &aItem) const
 Path of the file row for aItem, or empty for a section header or invalid item.
 
void DoSetToolTipText (const wxString &aTip) override
 WX_DATAVIEWCTRL drops tooltips for every data view it is the base of.
 
bool AssociateModel (wxDataViewModel *aModel) override
 Install a WX_ENSURE_VISIBLE_CANCELLER on aModel so deferred scrolls are dropped automatically when it frees items, then associate it as usual.
 
wxDataViewItem GetPrevItem (wxDataViewItem const &aItem)
 Get the previous item in list order.
 
wxDataViewItem GetNextItem (wxDataViewItem const &aItem)
 Get the next item in list order.
 
wxDataViewItem GetPrevSibling (wxDataViewItem const &aItem)
 Get the previous sibling of an item.
 
wxDataViewItem GetNextSibling (wxDataViewItem const &aItem)
 Get the next sibling of an item.
 
void ExpandAll ()
 
void CollapseAll ()
 
void CancelPendingEnsureVisible ()
 Cancel any pending deferred EnsureVisible request.
 

Private Member Functions

void onIdle (wxIdleEvent &aEvent)
 wxDataViewCtrl sends no mouse moves, so the hovered row is read on idle.
 

Private Attributes

wxObjectDataPtr< FILE_CHECKLIST_MODEL > m_model
 
wxString m_ownerTooltip
 What the owner set, shown when no row has more to say.
 
wxString m_shownTooltip
 What is on screen, so an unchanged hover is left alone.
 
wxDataViewModelNotifier * m_ensureVisibleCanceller = nullptr
 

Detailed Description

A checkable list of files, grouped into sections.

Each row has a checkbox, a status icon, a name, and a status word. Section header rows carry a checkbox that ticks or clears every row in the section.

The control is git-agnostic. Callers describe rows with FILE_CHECKLIST_ENTRY and ask back for the checked paths.

Definition at line 95 of file file_checklist_ctrl.h.

Constructor & Destructor Documentation

◆ FILE_CHECKLIST_CTRL()

FILE_CHECKLIST_CTRL::FILE_CHECKLIST_CTRL ( wxWindow * aParent,
wxWindowID aId = wxID_ANY )

◆ ~FILE_CHECKLIST_CTRL()

FILE_CHECKLIST_CTRL::~FILE_CHECKLIST_CTRL ( )
override

Definition at line 387 of file file_checklist_ctrl.cpp.

Member Function Documentation

◆ AssociateModel()

bool WX_DATAVIEWCTRL::AssociateModel ( wxDataViewModel * aModel)
overrideinherited

Install a WX_ENSURE_VISIBLE_CANCELLER on aModel so deferred scrolls are dropped automatically when it frees items, then associate it as usual.

Definition at line 187 of file wx_dataviewctrl.cpp.

References CancelPendingEnsureVisible(), and m_ensureVisibleCanceller.

Referenced by FILE_CHECKLIST_CTRL::FILE_CHECKLIST_CTRL().

◆ CancelPendingEnsureVisible()

void WX_DATAVIEWCTRL::CancelPendingEnsureVisible ( )
inherited

Cancel any pending deferred EnsureVisible request.

On GTK, wxDataViewCtrl::EnsureVisible() records the target item and re-scrolls to it during the next idle cycle (in OnInternalIdle). If the model is rebuilt and the underlying item is freed before that idle runs, OnInternalIdle dereferences the stale pointer in ExpandAncestors and crashes. The installed WX_ENSURE_VISIBLE_CANCELLER invokes this automatically when the model frees items, so call sites normally do not need to. This is a no-op on platforms that do not defer the scroll.

Definition at line 164 of file wx_dataviewctrl.cpp.

Referenced by AssociateModel().

◆ CollapseAll()

void WX_DATAVIEWCTRL::CollapseAll ( )
inherited

Definition at line 158 of file wx_dataviewctrl.cpp.

References recursiveDescent().

◆ DoSetToolTipText()

void FILE_CHECKLIST_CTRL::DoSetToolTipText ( const wxString & aTip)
override

WX_DATAVIEWCTRL drops tooltips for every data view it is the base of.

This one shows them, and remembers what the owner asked for so the row tooltip can give way to it.

Definition at line 347 of file file_checklist_ctrl.cpp.

References m_ownerTooltip, and m_shownTooltip.

◆ ExpandAll()

void WX_DATAVIEWCTRL::ExpandAll ( )
inherited

Definition at line 152 of file wx_dataviewctrl.cpp.

References recursiveDescent().

Referenced by FILE_CHECKLIST_CTRL::SetEntries().

◆ GetCheckedPaths()

std::vector< wxString > FILE_CHECKLIST_CTRL::GetCheckedPaths ( ) const

Definition at line 405 of file file_checklist_ctrl.cpp.

References m_model.

◆ GetItemPath()

wxString FILE_CHECKLIST_CTRL::GetItemPath ( const wxDataViewItem & aItem) const

Path of the file row for aItem, or empty for a section header or invalid item.

Definition at line 411 of file file_checklist_ctrl.cpp.

References m_model.

Referenced by onIdle().

◆ GetNextItem()

wxDataViewItem WX_DATAVIEWCTRL::GetNextItem ( wxDataViewItem const & aItem)
inherited

Get the next item in list order.

Parameters
aItema valid item in the control's model.
Returns
the item after aItem, or an invalid item if aItem is at the bottom.

Definition at line 44 of file wx_dataviewctrl.cpp.

References GetNextSibling().

◆ GetNextSibling()

wxDataViewItem WX_DATAVIEWCTRL::GetNextSibling ( wxDataViewItem const & aItem)
inherited

Get the next sibling of an item.

Parameters
aItema valid item in the control's model.
Returns
the sibling after aItem, or an invalid item if aItem has no siblings after it.

Definition at line 110 of file wx_dataviewctrl.cpp.

Referenced by GetNextItem().

◆ GetPrevItem()

wxDataViewItem WX_DATAVIEWCTRL::GetPrevItem ( wxDataViewItem const & aItem)
inherited

Get the previous item in list order.

Parameters
aItema valid item in the control's model.
Returns
the item before aItem, or an invalid item if aItem is at the top.

Definition at line 23 of file wx_dataviewctrl.cpp.

References GetPrevSibling().

◆ GetPrevSibling()

wxDataViewItem WX_DATAVIEWCTRL::GetPrevSibling ( wxDataViewItem const & aItem)
inherited

Get the previous sibling of an item.

Parameters
aItema valid item in the control's model.
Returns
the sibling before aItem, or an invalid item if aItem has no siblings before it.

Definition at line 87 of file wx_dataviewctrl.cpp.

Referenced by GetPrevItem().

◆ onIdle()

void FILE_CHECKLIST_CTRL::onIdle ( wxIdleEvent & aEvent)
private

wxDataViewCtrl sends no mouse moves, so the hovered row is read on idle.

LIB_TREE tracks its preview the same way.

Definition at line 357 of file file_checklist_ctrl.cpp.

References GetItemPath(), m_ownerTooltip, m_shownTooltip, and path.

Referenced by FILE_CHECKLIST_CTRL().

◆ SetAllChecked()

void FILE_CHECKLIST_CTRL::SetAllChecked ( bool aChecked)

Definition at line 399 of file file_checklist_ctrl.cpp.

References m_model.

◆ SetEntries()

void FILE_CHECKLIST_CTRL::SetEntries ( const std::vector< FILE_CHECKLIST_ENTRY > & aEntries)

Definition at line 392 of file file_checklist_ctrl.cpp.

References WX_DATAVIEWCTRL::ExpandAll(), and m_model.

Member Data Documentation

◆ m_ensureVisibleCanceller

wxDataViewModelNotifier* WX_DATAVIEWCTRL::m_ensureVisibleCanceller = nullptr
privateinherited

Definition at line 150 of file wx_dataviewctrl.h.

Referenced by AssociateModel(), and ~WX_DATAVIEWCTRL().

◆ m_model

wxObjectDataPtr<FILE_CHECKLIST_MODEL> FILE_CHECKLIST_CTRL::m_model
private

◆ m_ownerTooltip

wxString FILE_CHECKLIST_CTRL::m_ownerTooltip
private

What the owner set, shown when no row has more to say.

Definition at line 121 of file file_checklist_ctrl.h.

Referenced by DoSetToolTipText(), and onIdle().

◆ m_shownTooltip

wxString FILE_CHECKLIST_CTRL::m_shownTooltip
private

What is on screen, so an unchanged hover is left alone.

Definition at line 122 of file file_checklist_ctrl.h.

Referenced by DoSetToolTipText(), and onIdle().


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