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 69 of file hierarch.cpp.

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

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

Member Function Documentation

◆ onChar()

void HIERARCHY_TREE::onChar ( wxKeyEvent &  event)

Definition at line 154 of file hierarch.cpp.

155 {
156  if( event.GetKeyCode() == WXK_ESCAPE )
157  m_parent->Close( true );
158  else
159  event.Skip();
160 }
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 163 of file hierarch.cpp.

164 {
165  SCH_SHEET_PATH* item1Path = &static_cast<TreeItemData*>( GetItemData( item1 ) )->m_SheetPath;
166  SCH_SHEET_PATH* item2Path = &static_cast<TreeItemData*>( GetItemData( item2 ) )->m_SheetPath;
167 
168  return item1Path->ComparePageNumAndName( *item2Path );
169 }
int ComparePageNumAndName(const SCH_SHEET_PATH &aSheetPathToTest) const
Compare sheets by their page number and then by their name.
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...

References SCH_SHEET_PATH::ComparePageNumAndName().

◆ 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: