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.

91 lines
2.8 KiB

  1. #ifndef CLASS_LAYER_BOX_SELECTOR_H
  2. #define CLASS_LAYER_BOX_SELECTOR_H 1
  3. #include <hotkeys_basic.h>
  4. #include <wx/bmpcbox.h>
  5. #include <layers_id_colors_and_visibility.h>
  6. class wxAuiToolBar;
  7. /* class to display a layer list.
  8. *
  9. */
  10. class LAYER_BOX_SELECTOR : public wxBitmapComboBox
  11. {
  12. protected:
  13. bool m_layerhotkeys;
  14. bool m_layerorder;
  15. public:
  16. // Hotkey Info
  17. struct EDA_HOTKEY_CONFIG* m_hotkeys;
  18. public:
  19. LAYER_BOX_SELECTOR( wxAuiToolBar* parent, wxWindowID id,
  20. const wxPoint& pos = wxDefaultPosition,
  21. const wxSize& size = wxDefaultSize,
  22. int n = 0, const wxString choices[] = NULL );
  23. LAYER_BOX_SELECTOR( wxAuiToolBar* parent, wxWindowID id,
  24. const wxPoint& pos, const wxSize& size,
  25. const wxArrayString& choices );
  26. // Returns a color index from the layer id
  27. // Virtual function because GerbView uses its own functions in a derived class
  28. virtual EDA_COLOR_T GetLayerColor( LAYER_NUM aLayer ) const = 0;
  29. // Returns the name of the layer id
  30. // Virtual pure function because GerbView uses its own functions in a derived class
  31. virtual wxString GetLayerName( LAYER_NUM aLayer ) const = 0;
  32. // Returns true if the layer id is enabled (i.e. is it should be displayed)
  33. // Virtual function pure because GerbView uses its own functions in a derived class
  34. virtual bool IsLayerEnabled( LAYER_NUM aLayer ) const = 0;
  35. // Get Current Item #
  36. int GetChoice();
  37. // Get Current Layer
  38. LAYER_NUM GetLayerSelection() const;
  39. // Set Layer #
  40. int SetLayerSelection(LAYER_NUM layer);
  41. // Reload the Layers
  42. // Virtual pure function because GerbView uses its own functions in a derived class
  43. virtual void Resync() = 0;
  44. // Reload the Layers bitmaps colors
  45. void ResyncBitmapOnly();
  46. bool SetLayersOrdered(bool value);
  47. bool SetLayersHotkeys(bool value);
  48. protected:
  49. // Fills the layer bitmap aLayerbmp with the layer color
  50. void SetBitmapLayer( wxBitmap& aLayerbmp, LAYER_NUM aLayer );
  51. };
  52. #define DECLARE_LAYERS_HOTKEY(list) int list[NB_LAYERS] = \
  53. { \
  54. HK_SWITCH_LAYER_TO_COPPER, \
  55. HK_SWITCH_LAYER_TO_INNER1, \
  56. HK_SWITCH_LAYER_TO_INNER2, \
  57. HK_SWITCH_LAYER_TO_INNER3, \
  58. HK_SWITCH_LAYER_TO_INNER4, \
  59. HK_SWITCH_LAYER_TO_INNER5, \
  60. HK_SWITCH_LAYER_TO_INNER6, \
  61. HK_SWITCH_LAYER_TO_INNER7, \
  62. HK_SWITCH_LAYER_TO_INNER8, \
  63. HK_SWITCH_LAYER_TO_INNER9, \
  64. HK_SWITCH_LAYER_TO_INNER10, \
  65. HK_SWITCH_LAYER_TO_INNER11, \
  66. HK_SWITCH_LAYER_TO_INNER12, \
  67. HK_SWITCH_LAYER_TO_INNER13, \
  68. HK_SWITCH_LAYER_TO_INNER14, \
  69. HK_SWITCH_LAYER_TO_COMPONENT \
  70. };
  71. #endif //CLASS_LAYER_BOX_SELECTOR_H