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.

97 lines
2.4 KiB

  1. /**
  2. * @file UnitSelector.h
  3. * a wxChoiceBox to select units in Pcb_Calculator
  4. */
  5. #ifndef _UnitSelector_h_
  6. #define _UnitSelector_h_
  7. #include <wx/string.h>
  8. #include <wx/choice.h>
  9. class UNIT_SELECTOR: public wxChoice
  10. {
  11. public:
  12. UNIT_SELECTOR(wxWindow *parent, wxWindowID id,
  13. const wxPoint& pos, const wxSize& size,
  14. const wxArrayString& choices, long style = 0 ):
  15. wxChoice( parent, id, pos, size, choices, style )
  16. {
  17. }
  18. /**
  19. * Function GetUnitScale
  20. * @return the scaling factor to convert users units
  21. * to normalized units (meter, herz, ohm, radian )
  22. */
  23. virtual double GetUnitScale() = 0;
  24. wxString GetUnitName()
  25. {
  26. return GetStringSelection();
  27. }
  28. };
  29. class UNIT_SELECTOR_LEN: public UNIT_SELECTOR
  30. {
  31. public:
  32. UNIT_SELECTOR_LEN(wxWindow *parent, wxWindowID id,
  33. const wxPoint& pos, const wxSize& size,
  34. const wxArrayString& choices, long style = 0 );
  35. /**
  36. * Function GetUnitScale
  37. * @return the scaling factor to convert users units
  38. * to normalized units (meter)
  39. */
  40. virtual double GetUnitScale();
  41. };
  42. class UNIT_SELECTOR_FREQUENCY: public UNIT_SELECTOR
  43. {
  44. public:
  45. UNIT_SELECTOR_FREQUENCY(wxWindow *parent, wxWindowID id,
  46. const wxPoint& pos, const wxSize& size,
  47. const wxArrayString& choices, long style = 0 );
  48. /**
  49. * Function GetUnitScale
  50. * @return the scaling factor to convert users units
  51. * to normalized units (Hz)
  52. */
  53. virtual double GetUnitScale();
  54. };
  55. class UNIT_SELECTOR_ANGLE: public UNIT_SELECTOR
  56. {
  57. public:
  58. UNIT_SELECTOR_ANGLE(wxWindow *parent, wxWindowID id,
  59. const wxPoint& pos, const wxSize& size,
  60. const wxArrayString& choices, long style = 0 );
  61. /**
  62. * Function GetUnitScale
  63. * @return the scaling factor to convert users units
  64. * to normalized units (Hz)
  65. */
  66. virtual double GetUnitScale();
  67. };
  68. class UNIT_SELECTOR_RESISTOR: public UNIT_SELECTOR
  69. {
  70. public:
  71. UNIT_SELECTOR_RESISTOR(wxWindow *parent, wxWindowID id,
  72. const wxPoint& pos, const wxSize& size,
  73. const wxArrayString& choices, long style = 0 );
  74. /**
  75. * Function GetUnitScale
  76. * @return the scaling factor to convert users units
  77. * to normalized units (Hz)
  78. */
  79. virtual double GetUnitScale();
  80. };
  81. #endif // _UnitSelector_h_