You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

66 lines
2.2 KiB

  1. #ifndef CLASS_PCB_PCB_LAYER_BOX_SELECTOR_H
  2. #define CLASS_PCB_PCB_LAYER_BOX_SELECTOR_H 1
  3. #include <class_layer_box_selector.h>
  4. class PCB_BASE_FRAME;
  5. /* class to display a pcb layer list in a wxBitmapComboBox.
  6. */
  7. class PCB_LAYER_BOX_SELECTOR : public LAYER_BOX_SELECTOR
  8. {
  9. PCB_BASE_FRAME * m_boardFrame;
  10. LAYER_MSK m_layerMaskDisable; // A mask to remove some layers from layer list
  11. public:
  12. // Hotkey Info
  13. struct EDA_HOTKEY_CONFIG* m_hotkeys;
  14. public:
  15. // If you are thinking the constructor is a bit curious,
  16. // just remember it is used by automaticallty generated by wxFormBuilder files,
  17. // and it should mimic the wxBitmapComboBox constructor.
  18. // Therefore, value, style are not yet used,
  19. // but they are here for compatibility
  20. PCB_LAYER_BOX_SELECTOR( wxWindow* parent, wxWindowID id,
  21. const wxString& value = wxEmptyString,
  22. const wxPoint& pos = wxDefaultPosition,
  23. const wxSize& size = wxDefaultSize,
  24. int n = 0, const wxString choices[] = NULL, int style = 0 )
  25. :LAYER_BOX_SELECTOR( parent, id, pos, size, n, choices )
  26. {
  27. m_boardFrame = NULL;
  28. m_layerMaskDisable = 0;
  29. }
  30. // Accessors
  31. // SetBoardFrame should be called after creating a PCB_LAYER_BOX_SELECTOR
  32. // It is not passed through the constructor because when using wxFormBuilder
  33. // we should use a constructor compatible with a wxBitmapComboBox
  34. void SetBoardFrame( PCB_BASE_FRAME * aFrame ) { m_boardFrame = aFrame; };
  35. // SetLayerMask allows disableing some layers, whiech are not
  36. // shown in list;
  37. void SetLayerMask( LAYER_MSK aMask ) { m_layerMaskDisable = aMask; }
  38. // Reload the Layers names and bitmaps
  39. // Virtual function
  40. void Resync();
  41. private:
  42. // Returns a color index from the layer id
  43. // Virtual function
  44. EDA_COLOR_T GetLayerColor( LAYER_NUM aLayer ) const;
  45. // Returns true if the layer id is enabled (i.e. is it should be displayed)
  46. // Virtual function
  47. bool IsLayerEnabled( LAYER_NUM aLayer ) const;
  48. // Returns the name of the layer id
  49. // Virtual function
  50. wxString GetLayerName( LAYER_NUM aLayer ) const;
  51. };
  52. #endif //CLASS_PCB_PCB_LAYER_BOX_SELECTOR_H