+//-----------------------------------------------------------------------------
+// wxGraphicsGradientStops
+//-----------------------------------------------------------------------------
+
+void wxGraphicsGradientStops::Add(const wxGraphicsGradientStop& stop)
+{
+ for ( wxVector<wxGraphicsGradientStop>::iterator it = m_stops.begin();
+ it != m_stops.end();
+ ++it )
+ {
+ if ( stop.GetPosition() < it->GetPosition() )
+ {
+ if ( it != m_stops.begin() )
+ {
+ m_stops.insert(it, stop);
+ }
+ else // we shouldn't be inserting it at the beginning
+ {
+ wxFAIL_MSG( "invalid gradient stop position < 0" );
+ }
+
+ return;
+ }
+ }
+
+ if ( stop.GetPosition() == 1. )
+ {
+ m_stops.insert(m_stops.end() - 1, stop);
+ }
+ else
+ {
+ wxFAIL_MSG( "invalid gradient stop position > 1" );
+ }
+}
+