KiCad PCB EDA Suite
design_tree_frame.h
Go to the documentation of this file.
1 /*
2  * This program source code file is part of KiCad, a free EDA CAD application.
3  *
4  * Copyright (C) 2013 CERN
5  * @author Jean-Pierre Charras, jp.charras at wanadoo.fr
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, you may find one here:
19  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20  * or you may search the http://www.gnu.org website for the version 2 license,
21  * or you may write to the Free Software Foundation, Inc.,
22  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23  */
24 
29 #ifndef _DESIGN_TREE_FRAME_H
30 #define _DESIGN_TREE_FRAME_H
31 
32 #include <wx/treectrl.h>
33 
34 #include <pl_editor_frame.h>
35 
36 class WORKSHEET_DATAITEM;
37 
41 class DESIGN_TREE_ITEM_DATA : public wxTreeItemData
42 {
43 private:
44  WORKSHEET_DATAITEM* m_wsItem; // the page layout item owned by me
45 
46 public:
47 
49  {
50  m_wsItem = aItem;
51  }
52 
56  {
57  return m_wsItem;
58  }
59 
62  void SetItem( WORKSHEET_DATAITEM* aItem )
63  {
64  m_wsItem = aItem;
65  }
66 };
67 
68 
73 class DESIGN_TREE_FRAME : protected wxTreeCtrl
74 {
75  friend class PL_EDITOR_FRAME;
76 
77 private:
78  wxImageList* m_imageList;
79 
80 public:
83 
84  void ReCreateDesignTree();
85  wxSize GetMinSize() const override;
86 
89  WORKSHEET_DATAITEM* GetPageLayoutItem(wxTreeItemId aCell) const;
90 
94 
98 
99  // Select the tree item corresponding to the WORKSHEET_DATAITEM aItem
100  void SelectCell( WORKSHEET_DATAITEM* aItem );
101 
102  void SelectCell( const wxTreeItemId &aTreeItem, bool aSelect=true )
103  {
104  SelectItem( aTreeItem, aSelect );
105  }
106 };
107 
108 #endif /* _DESIGN_TREE_FRAME_H */
WORKSHEET_DATAITEM * GetPageLayoutItem(wxTreeItemId aCell) const
void SelectCell(WORKSHEET_DATAITEM *aItem)
wxSize GetMinSize() const override
wxImageList * m_imageList
Class DESIGN_TREE_FRAME is the left window showing the list of items.
DESIGN_TREE_FRAME(PL_EDITOR_FRAME *aParent)
class DESIGN_TREE_ITEM Handle one item for the page layoiut design
DESIGN_TREE_ITEM_DATA(WORKSHEET_DATAITEM *aItem=NULL)
void SelectCell(const wxTreeItemId &aTreeItem, bool aSelect=true)
void SetItem(WORKSHEET_DATAITEM *aItem)
Set the link to the item managed by the cell.
WORKSHEET_DATAITEM * m_wsItem
WORKSHEET_DATAITEM * GetItem() const
WORKSHEET_DATAITEM * GetPageLayoutSelectedItem() const