KiCad PCB EDA Suite
worksheet_viewitem.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 Maciej Suminski <maciej.suminski@cern.ch>
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 
30 #ifndef WORKSHEET_VIEWITEM_H
31 #define WORKSHEET_VIEWITEM_H
32 
33 #include <base_struct.h>
34 
35 class BOARD;
36 class PAGE_INFO;
37 class TITLE_BLOCK;
38 class WS_DRAW_ITEM_LINE;
39 class WS_DRAW_ITEM_RECT;
41 class WS_DRAW_ITEM_TEXT;
42 
43 namespace KIGFX
44 {
45 class VIEW;
46 class GAL;
47 
49 {
50 public:
51  WORKSHEET_VIEWITEM( const PAGE_INFO* aPageInfo, const TITLE_BLOCK* aTitleBlock );
52 
59  void SetFileName( const std::string& aFileName )
60  {
61  m_fileName = aFileName;
62  }
63 
70  void SetSheetName( const std::string& aSheetName )
71  {
72  m_sheetName = aSheetName;
73  }
74 
81  void SetPageInfo( const PAGE_INFO* aPageInfo );
82 
89  void SetTitleBlock( const TITLE_BLOCK* aTitleBlock );
90 
97  void SetSheetNumber( int aSheetNumber )
98  {
99  m_sheetNumber = aSheetNumber;
100  }
101 
108  void SetSheetCount( int aSheetCount )
109  {
110  m_sheetCount = aSheetCount;
111  }
112 
114  const BOX2I ViewBBox() const override;
115 
117  void ViewDraw( int aLayer, VIEW* aView ) const override;
118 
120  void ViewGetLayers( int aLayers[], int& aCount ) const override;
121 
122 #if defined(DEBUG)
123  void Show( int x, std::ostream& st ) const override
125  {
126  }
127 #endif
128 
132  virtual wxString GetClass() const override
133  {
134  return wxT( "WORKSHEET_VIEWITEM" );
135  }
136 
137 protected:
139  std::string m_fileName;
140 
142  std::string m_sheetName;
143 
146 
149 
152 
155 
156  // Functions for drawing items that makes a worksheet
157  void draw( const WS_DRAW_ITEM_LINE* aItem, GAL* aGal ) const;
158  void draw( const WS_DRAW_ITEM_RECT* aItem, GAL* aGal ) const;
159  void draw( const WS_DRAW_ITEM_POLYGON* aItem, GAL* aGal ) const;
160  void draw( const WS_DRAW_ITEM_TEXT* aItem, GAL* aGal ) const;
161 
163  void drawBorder( GAL* aGal ) const;
164 };
165 }
166 
167 #endif /* WORKSHEET_VIEWITEM_H */
std::string m_sheetName
Sheet name displayed in the title block.
void SetPageInfo(const PAGE_INFO *aPageInfo)
Function SetPageInfo() Changes the PAGE_INFO object used to draw the worksheet.
Class CAIRO_GAL is the cairo implementation of the graphics abstraction layer.
Definition: class_module.h:58
const BOX2I ViewBBox() const override
Function ViewBBox() returns the bounding box of the item covering all its layers. ...
void SetTitleBlock(const TITLE_BLOCK *aTitleBlock)
Function SetTitleBlock() Changes the TITLE_BLOCK object used to draw the worksheet.
int m_sheetCount
Sheets count number displayed in the title block.
void ViewGetLayers(int aLayers[], int &aCount) const override
Function ViewGetLayers() Returns the all the layers within the VIEW the object is painted on...
void draw(const WS_DRAW_ITEM_LINE *aItem, GAL *aGal) const
Class TITLE_BLOCK holds the information shown in the lower right corner of a plot, printout, or editing view.
std::string m_fileName
File name displayed in the title block.
void SetSheetName(const std::string &aSheetName)
Function SetSheetName() Sets the sheet name displayed in the title block.
void drawBorder(GAL *aGal) const
Draws a border that determines the page size.
Class PAGE_INFO describes the page size and margins of a paper page on which to eventually print or p...
void SetFileName(const std::string &aFileName)
Function SetFileName() Sets the file name displayed in the title block.
void SetSheetNumber(int aSheetNumber)
Function SetSheetNumber() Changes the sheet number displayed in the title block.
void ViewDraw(int aLayer, VIEW *aView) const override
Function ViewDraw() Draws the parts of the object belonging to layer aLayer.
virtual wxString GetClass() const override
Get class name.
const PAGE_INFO * m_pageInfo
Worksheet page information.
int m_sheetNumber
Sheet number displayed in the title block.
Class BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:169
void SetSheetCount(int aSheetCount)
Function SetSheetCount() Changes the sheets count number displayed in the title block.
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:165
const TITLE_BLOCK * m_titleBlock
Title block that contains properties of the title block displayed in the worksheet.
WORKSHEET_VIEWITEM(const PAGE_INFO *aPageInfo, const TITLE_BLOCK *aTitleBlock)
Basic classes for most KiCad items.
Class VIEW.
Definition: view.h:58
Class GAL is the abstract interface for drawing on a 2D-surface.