KiCad PCB EDA Suite
EDA_DOCKART Class Reference

#include <eda_dockart.h>

Inheritance diagram for EDA_DOCKART:

Public Member Functions

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

Detailed Description

Definition at line 32 of file eda_dockart.h.

Constructor & Destructor Documentation

◆ EDA_DOCKART()

EDA_DOCKART::EDA_DOCKART ( )
inline

Definition at line 35 of file eda_dockart.h.

36  {
37  SetMetric( wxAUI_DOCKART_PANE_BORDER_SIZE, 1 );
38  }

Member Function Documentation

◆ DrawBorder()

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 29 of file eda_dockart.cpp.

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

References FRAME_GERBER, FRAME_PCB, FRAME_PCB_MODULE_EDITOR, FRAME_PCB_MODULE_VIEWER, and FRAME_PCB_MODULE_VIEWER_MODAL.


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