← Back to team overview

kicad-developers team mailing list archive

[PATCH 21/27] PinTypeComboBox: typesafe Get/Set

 

---
 eeschema/dialogs/dialog_lib_edit_pin.h |  2 +-
 eeschema/widgets/pin_type_combobox.cpp | 12 ++++++++++++
 eeschema/widgets/pin_type_combobox.h   |  5 +++++
 3 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/eeschema/dialogs/dialog_lib_edit_pin.h b/eeschema/dialogs/dialog_lib_edit_pin.h
index 8012495..a3209f8 100644
--- a/eeschema/dialogs/dialog_lib_edit_pin.h
+++ b/eeschema/dialogs/dialog_lib_edit_pin.h
@@ -65,7 +65,7 @@ public:
     }
     ElectricPinType GetElectricalType( void )
     {
-        return static_cast<ElectricPinType>( m_choiceElectricalType->GetSelection() );
+        return m_choiceElectricalType->GetSelection();
     }
 
     void SetStyle( PinShape style ) { m_choiceStyle->SetSelection( style ); }
diff --git a/eeschema/widgets/pin_type_combobox.cpp b/eeschema/widgets/pin_type_combobox.cpp
index c83d14f..ae9676d 100644
--- a/eeschema/widgets/pin_type_combobox.cpp
+++ b/eeschema/widgets/pin_type_combobox.cpp
@@ -56,3 +56,15 @@ PinTypeComboBox::PinTypeComboBox( wxWindow* parent,
             Insert( text, KiBitmap( bitmap ), ii );
     }
 }
+
+
+ElectricPinType PinTypeComboBox::GetSelection()
+{
+    return static_cast<ElectricPinType>( wxBitmapComboBox::GetSelection() );
+}
+
+
+void PinTypeComboBox::SetSelection( ElectricPinType aType )
+{
+    wxBitmapComboBox::SetSelection( aType );
+}
diff --git a/eeschema/widgets/pin_type_combobox.h b/eeschema/widgets/pin_type_combobox.h
index 1564839..05ed022 100644
--- a/eeschema/widgets/pin_type_combobox.h
+++ b/eeschema/widgets/pin_type_combobox.h
@@ -28,6 +28,8 @@
 
 #include <wx/bmpcbox.h>
 
+#include <pin_type.h>
+
 class PinTypeComboBox : public wxBitmapComboBox
 {
 public:
@@ -43,4 +45,7 @@ public:
             long style = 0,
             const wxValidator& validator = wxDefaultValidator,
             const wxString& name = wxBitmapComboBoxNameStr );
+
+    ElectricPinType     GetSelection();
+    void                SetSelection( ElectricPinType aType );
 };

Follow ups

References