KiCad PCB EDA Suite
LAYER_BOX_SELECTOR Class Referenceabstract

#include <class_layer_box_selector.h>

Inheritance diagram for LAYER_BOX_SELECTOR:
LAYER_SELECTOR GBR_LAYER_BOX_SELECTOR PCB_LAYER_BOX_SELECTOR

Public Member Functions

 LAYER_BOX_SELECTOR (wxWindow *parent, wxWindowID id, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, int n=0, const wxString choices[]=NULL)
 
 LAYER_BOX_SELECTOR (wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size, const wxArrayString &choices)
 
int GetChoice ()
 
LAYER_NUM GetLayerSelection () const
 
int SetLayerSelection (LAYER_NUM layer)
 
virtual void Resync ()=0
 
void ResyncBitmapOnly ()
 
virtual COLOR4D GetLayerColor (LAYER_NUM aLayer) const =0
 
virtual wxString GetLayerName (LAYER_NUM aLayer) const =0
 
virtual bool IsLayerEnabled (LAYER_NUM aLayer) const =0
 
bool SetLayersOrdered (bool value)
 
bool SetLayersHotkeys (bool value)
 

Public Attributes

struct EDA_HOTKEY_CONFIGm_hotkeys
 

Protected Member Functions

void SetBitmapLayer (wxBitmap &aLayerbmp, LAYER_NUM aLayer)
 

Protected Attributes

bool m_layerhotkeys
 

Detailed Description

Definition at line 74 of file class_layer_box_selector.h.

Constructor & Destructor Documentation

LAYER_BOX_SELECTOR::LAYER_BOX_SELECTOR ( wxWindow *  parent,
wxWindowID  id,
const wxPoint pos = wxDefaultPosition,
const wxSize &  size = wxDefaultSize,
int  n = 0,
const wxString  choices[] = NULL 
)

Definition at line 69 of file class_layer_box_selector.cpp.

References m_hotkeys, and ResyncBitmapOnly().

71  :
72  wxBitmapComboBox( parent, id, wxEmptyString, pos, size, n, choices, wxCB_READONLY ),
74 {
75  m_hotkeys = NULL;
76 
77  if( choices != NULL )
79 }
struct EDA_HOTKEY_CONFIG * m_hotkeys
LAYER_BOX_SELECTOR::LAYER_BOX_SELECTOR ( wxWindow *  parent,
wxWindowID  id,
const wxPoint pos,
const wxSize &  size,
const wxArrayString &  choices 
)

Definition at line 82 of file class_layer_box_selector.cpp.

References m_hotkeys, and ResyncBitmapOnly().

84  :
85  wxBitmapComboBox( parent, id, wxEmptyString, pos, size, choices, wxCB_READONLY ),
87 {
88  m_hotkeys = NULL;
89 
90  if( !choices.IsEmpty() )
92 }
struct EDA_HOTKEY_CONFIG * m_hotkeys

Member Function Documentation

int LAYER_BOX_SELECTOR::GetChoice ( )

Definition at line 96 of file class_layer_box_selector.cpp.

97 {
98  return GetSelection();
99 }
virtual COLOR4D LAYER_SELECTOR::GetLayerColor ( LAYER_NUM  aLayer) const
pure virtualinherited
virtual wxString LAYER_SELECTOR::GetLayerName ( LAYER_NUM  aLayer) const
pure virtualinherited
virtual bool LAYER_SELECTOR::IsLayerEnabled ( LAYER_NUM  aLayer) const
pure virtualinherited
virtual void LAYER_BOX_SELECTOR::Resync ( )
pure virtual
void LAYER_BOX_SELECTOR::ResyncBitmapOnly ( )

Definition at line 137 of file class_layer_box_selector.cpp.

References LAYER_SELECTOR::SetBitmapLayer().

Referenced by LAYER_BOX_SELECTOR(), and GERBER_LAYER_WIDGET::OnLayerColorChange().

138 {
139  int elements = GetCount();
140 
141  for( LAYER_NUM i = 0; i < elements; ++i )
142  {
143  wxBitmap layerbmp( 14, 14 );
144  SetBitmapLayer( layerbmp, i );
145  }
146 }
void SetBitmapLayer(wxBitmap &aLayerbmp, LAYER_NUM aLayer)
int LAYER_NUM
Type LAYER_NUM can be replaced with int and removed.
void LAYER_SELECTOR::SetBitmapLayer ( wxBitmap &  aLayerbmp,
LAYER_NUM  aLayer 
)
protectedinherited

Definition at line 50 of file class_layer_box_selector.cpp.

References LAYER_SELECTOR::GetLayerColor().

Referenced by GBR_LAYER_BOX_SELECTOR::Resync(), PCB_LAYER_BOX_SELECTOR::Resync(), and ResyncBitmapOnly().

51 {
52  wxMemoryDC bmpDC;
53  wxBrush brush;
54 
55  // Prepare Bitmap
56  bmpDC.SelectObject( aLayerbmp );
57  brush.SetColour( GetLayerColor( aLayer ).ToColour() );
58  brush.SetStyle( wxBRUSHSTYLE_SOLID );
59 
60  bmpDC.SetBrush( brush );
61  bmpDC.DrawRectangle( 0, 0, aLayerbmp.GetWidth(), aLayerbmp.GetHeight() );
62  bmpDC.SetBrush( *wxTRANSPARENT_BRUSH );
63  bmpDC.SetPen( *wxBLACK_PEN );
64  bmpDC.DrawRectangle( 0, 0, aLayerbmp.GetWidth(), aLayerbmp.GetHeight() );
65 }
virtual COLOR4D GetLayerColor(LAYER_NUM aLayer) const =0
int LAYER_BOX_SELECTOR::SetLayerSelection ( LAYER_NUM  layer)

Definition at line 113 of file class_layer_box_selector.cpp.

Referenced by DIALOG_DIMENSION_EDITOR::DIALOG_DIMENSION_EDITOR(), DIALOG_DXF_IMPORT::DIALOG_DXF_IMPORT(), DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES(), PCB_EDIT_FRAME::OnUpdateLayerSelectBox(), DialogEditModuleText::TransferDataToWindow(), DIALOG_PCB_TEXT_PROPERTIES::TransferDataToWindow(), DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataToWindow(), and DIALOG_MODEDIT_FP_BODY_ITEM_PROPERTIES::TransferDataToWindow().

114 {
115  int elements = GetCount();
116 
117  for( int i = 0; i < elements; i++ )
118  {
119  if( GetClientData( i ) == (void*)(intptr_t) layer )
120  {
121  if( GetSelection() != i ) // Element (i) is not selected
122  {
123  SetSelection( i );
124  return i;
125  }
126  else
127  return i; //If element already selected; do nothing
128  }
129  }
130 
131  // Not Found
132  SetSelection( -1 );
133  return -1;
134 }
bool LAYER_SELECTOR::SetLayersOrdered ( bool  value)
inherited

Member Data Documentation

struct EDA_HOTKEY_CONFIG* LAYER_BOX_SELECTOR::m_hotkeys

Definition at line 78 of file class_layer_box_selector.h.

Referenced by LAYER_BOX_SELECTOR().


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