kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #17905
[PATCH 10/27] 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 a3a1ce1..057e840 100644
--- a/eeschema/dialogs/dialog_lib_edit_pin.h
+++ b/eeschema/dialogs/dialog_lib_edit_pin.h
@@ -69,7 +69,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
-
[PATCH 00/27] My current patch stack
From: Simon Richter, 2015-04-13
-
[PATCH 01/27] Move feature check before dependent tests
From: Simon Richter, 2015-04-13
-
[PATCH 02/27] Use Link Time Optimization with GCC in Release builds
From: Simon Richter, 2015-04-13
-
[PATCH 03/27] Make NETLIST_OBJECT::GetConnectionType() const
From: Simon Richter, 2015-04-13
-
[PATCH 04/27] Remove superfluous cast
From: Simon Richter, 2015-04-13
-
[PATCH 05/27] Separate ElectricPinType and TypeSheetLabel
From: Simon Richter, 2015-04-13
-
[PATCH 06/27] Regenerate "Edit Pin" dialog with newer wxFormBuilder
From: Simon Richter, 2015-04-13
-
[PATCH 07/27] Replace DrawPinShape enum with PinShape
From: Simon Richter, 2015-04-13
-
[PATCH 08/27] PinShapeComboBox: Introduce widget
From: Simon Richter, 2015-04-13
-
[PATCH 09/27] PinShapeComboBox: Fully initialize in c'tor
From: Simon Richter, 2015-04-13