kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #23191
[PATCH 04/19] PinShapeComboBox: typesafe Get/Set
These overrides provide typed access to the current selection, overriding
the regular integer-based accessor/mutator.
---
eeschema/dialogs/dialog_lib_edit_pin.h | 2 +-
eeschema/widgets/pin_shape_combobox.cpp | 12 ++++++++++++
eeschema/widgets/pin_shape_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 e720b14..3b4e363 100644
--- a/eeschema/dialogs/dialog_lib_edit_pin.h
+++ b/eeschema/dialogs/dialog_lib_edit_pin.h
@@ -71,7 +71,7 @@ public:
}
void SetStyle( PinShape style ) { m_choiceStyle->SetSelection( style ); }
- PinShape GetStyle( void ) { return static_cast<PinShape>( m_choiceStyle->GetSelection() ); }
+ PinShape GetStyle( void ) { return m_choiceStyle->GetSelection(); }
void SetPinName( const wxString& name ) { m_textPinName->SetValue( name ); }
wxString GetPinName( void ) { return m_textPinName->GetValue(); }
diff --git a/eeschema/widgets/pin_shape_combobox.cpp b/eeschema/widgets/pin_shape_combobox.cpp
index 08f835c..e030534 100644
--- a/eeschema/widgets/pin_shape_combobox.cpp
+++ b/eeschema/widgets/pin_shape_combobox.cpp
@@ -53,3 +53,15 @@ PinShapeComboBox::PinShapeComboBox( wxWindow* parent,
Insert( list[ii], KiBitmap( bitmaps[ii] ), ii );
}
}
+
+
+PinShape PinShapeComboBox::GetSelection()
+{
+ return static_cast<PinShape>( wxBitmapComboBox::GetSelection() );
+}
+
+
+void PinShapeComboBox::SetSelection( PinShape aShape )
+{
+ wxBitmapComboBox::SetSelection( aShape );
+}
diff --git a/eeschema/widgets/pin_shape_combobox.h b/eeschema/widgets/pin_shape_combobox.h
index 9396770..19c9714 100644
--- a/eeschema/widgets/pin_shape_combobox.h
+++ b/eeschema/widgets/pin_shape_combobox.h
@@ -28,6 +28,8 @@
#include <wx/bmpcbox.h>
+#include <lib_pin.h>
+
class PinShapeComboBox : public wxBitmapComboBox
{
public:
@@ -43,4 +45,7 @@ public:
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxBitmapComboBoxNameStr );
+
+ PinShape GetSelection();
+ void SetSelection( PinShape aShape );
};
Follow ups
References