KiCad PCB EDA Suite
EDA_DOCKART Class Reference

#include <eda_dockart.h>

Inheritance diagram for EDA_DOCKART:

Public Member Functions

 EDA_DOCKART (EDA_DRAW_FRAME *aParent)
 
void DrawBorder (wxDC &aDC, wxWindow *aWindow, const wxRect &r, wxAuiPaneInfo &aPane) override
 Draw borders for Kicad AUI panes. More...
 

Private Attributes

EDA_DRAW_FRAMEm_frame
 

Detailed Description

Definition at line 35 of file eda_dockart.h.

Constructor & Destructor Documentation

EDA_DOCKART::EDA_DOCKART ( EDA_DRAW_FRAME aParent)
inline

Definition at line 41 of file eda_dockart.h.

References DrawBorder().

41  :
42  m_frame( aParent )
43  {
44  SetMetric( wxAUI_DOCKART_PANE_BORDER_SIZE, 1 );
45  }
EDA_DRAW_FRAME * m_frame
Definition: eda_dockart.h:38

Member Function Documentation

void EDA_DOCKART::DrawBorder ( wxDC &  aDC,
wxWindow *  aWindow,
const wxRect &  r,
wxAuiPaneInfo &  aPane 
)
override

Draw borders for Kicad AUI panes.

The principal specialization over wxWidgets' default borders is the absence of a white single-pixel frame (which looks particularly poor on canvasses with dark backgrounds).

Definition at line 31 of file eda_dockart.cpp.

References FRAME_GERBER, FRAME_PCB, FRAME_PCB_MODULE_EDITOR, FRAME_PCB_MODULE_VIEWER, FRAME_PCB_MODULE_VIEWER_MODAL, EDA_DRAW_FRAME::GetDrawBgColor(), EDA_BASE_FRAME::IsType(), and m_frame.

Referenced by EDA_DOCKART().

33 {
34  const wxRect& r = aRect;
35  aDC.SetPen( m_borderPen );
36  aDC.SetBrush( *wxTRANSPARENT_BRUSH );
37 
38  // notebooks draw the border themselves, so they can use native rendering (e.g. tabartgtk)
39  wxAuiTabArt* art = nullptr;
40  wxAuiNotebook* nb = wxDynamicCast( aWindow, wxAuiNotebook );
41 
42  if( nb )
43  art = nb->GetArtProvider();
44 
45  if( art )
46  {
47  art->DrawBorder( aDC, aWindow, r );
48  }
49  else if( aPane.name == "DrawFrame" || aPane.name == "DrawFrameGal" )
50  {
51  // We don't want to re-write the layout manager, so we give the canvas a single-pixel
52  // border and then fill in the top and left with the canvas background colour.
53  //
54  // This achieves a right-bottom-bordered canvas, which works reasonably well with
55  // wxWidgets right-bottom bordered toolbars.
56 
57  //wxWindow* window = reinterpret_cast<wxWindow*>( m_frame->GetCanvas() );
58  //wxSize scrollbarSize = window->GetSize() - window->GetClientSize();
59  // Not sure why it takes a pen twice as wide as the border to fill it in, but it does.
60  #if 0
61  int borderWidth = GetMetric( wxAUI_DOCKART_PANE_BORDER_SIZE ) * 2;
62  int borderAdjust = borderWidth;
63 
64  aDC.SetPen( wxPen( m_frame->GetDrawBgColor().ToColour(), borderWidth ) );
65 
66  // Yes, this leaves me scratching my head too.
67  if( m_frame->IsType( FRAME_PCB )
71  || m_frame->IsType( FRAME_GERBER ) )
72  {
73  borderAdjust += 1;
74  }
75 
76  // left
77  aDC.DrawLine( r.x + 1, r.y, r.x + 1, r.y + r.height - borderAdjust - scrollbarSize.y );
78  // top
79  aDC.DrawLine( r.x + 1, r.y, r.x + r.width - borderAdjust - scrollbarSize.x, r.y );
80 
81  aDC.SetPen( m_borderPen );
82 
83  // finish off bottom of left side (at end of scrollbar)
84  aDC.DrawLine( r.x, r.y + r.height - 1 - scrollbarSize.y, r.x, r.y + r.height - 1 );
85  // right
86  aDC.DrawLine( r.x + r.width, r.y, r.x + r.width, r.y + r.height - 1 );
87  // bottom
88  aDC.DrawLine( r.x, r.y + r.height - 1, r.x + r.width - 1, r.y + r.height - 1 );
89  #endif
90  }
91  else
92  {
93  aDC.DrawRectangle( r );
94  }
95 }
EDA_DRAW_FRAME * m_frame
Definition: eda_dockart.h:38
virtual COLOR4D GetDrawBgColor() const
Definition: draw_frame.h:375
bool IsType(FRAME_T aType) const

Member Data Documentation

EDA_DRAW_FRAME* EDA_DOCKART::m_frame
private

Definition at line 38 of file eda_dockart.h.

Referenced by DrawBorder().


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