KiCad PCB EDA Suite
HIERARCHY_TREE Class Reference

Handle hierarchy tree control. More...

#include <hierarch.h>

Inheritance diagram for HIERARCHY_TREE:

Public Member Functions

 HIERARCHY_TREE (HIERARCHY_NAVIG_DLG *parent)
 
void onChar (wxKeyEvent &event)
 
int OnCompareItems (const wxTreeItemId &item1, const wxTreeItemId &item2) override
 

Private Member Functions

 wxDECLARE_ABSTRACT_CLASS (HIERARCHY_TREE)
 

Private Attributes

HIERARCHY_NAVIG_DLGm_parent
 
wxImageList * imageList
 

Detailed Description

Handle hierarchy tree control.

Definition at line 46 of file hierarch.h.

Constructor & Destructor Documentation

◆ HIERARCHY_TREE()

HIERARCHY_TREE::HIERARCHY_TREE ( HIERARCHY_NAVIG_DLG parent)

Definition at line 70 of file hierarch.cpp.

70  :
71  wxTreeCtrl( (wxWindow*) parent, wxID_ANY, wxDefaultPosition, wxDefaultSize,
72  wxTR_HAS_BUTTONS, wxDefaultValidator, wxT( "HierachyTreeCtrl" ) )
73 {
74  m_parent = parent;
75 
76  // Make an image list containing small icons
77  // All icons are expected having the same size.
78  wxBitmap tree_nosel_bm( KiBitmap( BITMAPS::tree_nosel ) );
79  imageList = new wxImageList( tree_nosel_bm.GetWidth(), tree_nosel_bm.GetHeight(), true, 2 );
80 
81  imageList->Add( tree_nosel_bm );
83 
84  AssignImageList( imageList );
85 }
wxImageList * imageList
Definition: hierarch.h:62
HIERARCHY_NAVIG_DLG * m_parent
Definition: hierarch.h:61
wxBitmap KiBitmap(BITMAPS aBitmap)
Construct a wxBitmap from an image identifier Returns the image from the active theme if the image ha...
Definition: bitmap.cpp:104

References imageList, KiBitmap(), m_parent, tree_nosel, and tree_sel.

Member Function Documentation

◆ onChar()

void HIERARCHY_TREE::onChar ( wxKeyEvent &  event)

Definition at line 155 of file hierarch.cpp.

156 {
157  if( event.GetKeyCode() == WXK_ESCAPE )
158  m_parent->Close( true );
159  else
160  event.Skip();
161 }
HIERARCHY_NAVIG_DLG * m_parent
Definition: hierarch.h:61

References m_parent.

Referenced by HIERARCHY_NAVIG_DLG::HIERARCHY_NAVIG_DLG(), and HIERARCHY_NAVIG_DLG::~HIERARCHY_NAVIG_DLG().

◆ OnCompareItems()

int HIERARCHY_TREE::OnCompareItems ( const wxTreeItemId &  item1,
const wxTreeItemId &  item2 
)
override

Definition at line 164 of file hierarch.cpp.

165 {
166  SCH_SHEET_PATH* item1Path = &static_cast<TreeItemData*>( GetItemData( item1 ) )->m_SheetPath;
167  SCH_SHEET_PATH* item2Path = &static_cast<TreeItemData*>( GetItemData( item2 ) )->m_SheetPath;
168 
169  wxString item1PageNo = item1Path->Last()->GetPageNumber( *item1Path );
170  wxString item2PageNo = item2Path->Last()->GetPageNumber( *item2Path );
171 
172  return SCH_SHEET::ComparePageNum( item1PageNo, item2PageNo );
173 }
SCH_SHEET * Last() const
Return a pointer to the last SCH_SHEET of the list.
static int ComparePageNum(const wxString &aPageNumberA, const wxString aPageNumberB)
Compares page numbers of schematic sheets.
Definition: sch_sheet.cpp:1150
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
wxString GetPageNumber(const SCH_SHEET_PATH &aInstance) const
Return the sheet page number for aInstance.
Definition: sch_sheet.cpp:1117

References SCH_SHEET::ComparePageNum(), SCH_SHEET::GetPageNumber(), and SCH_SHEET_PATH::Last().

◆ wxDECLARE_ABSTRACT_CLASS()

HIERARCHY_TREE::wxDECLARE_ABSTRACT_CLASS ( HIERARCHY_TREE  )
private

Member Data Documentation

◆ imageList

wxImageList* HIERARCHY_TREE::imageList
private

Definition at line 62 of file hierarch.h.

Referenced by HIERARCHY_TREE().

◆ m_parent

HIERARCHY_NAVIG_DLG* HIERARCHY_TREE::m_parent
private

Definition at line 61 of file hierarch.h.

Referenced by HIERARCHY_TREE(), and onChar().


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