Yet another fix for the colour property 'Custom' entry (get drop-down list index directly from wxOwnerDrawnComboBox)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61412 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Jaakko Salli
2009-07-12 09:59:26 +00:00
parent bb276f53fc
commit fbbde24964

View File

@@ -62,6 +62,8 @@
#include "wx/msw/dc.h" #include "wx/msw/dc.h"
#endif #endif
#include "wx/odcombo.h"
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
#if defined(__WXMSW__) #if defined(__WXMSW__)
@@ -1250,19 +1252,29 @@ bool wxSystemColourProperty::OnEvent( wxPropertyGrid* propgrid,
if ( propgrid->IsMainButtonEvent(event) ) if ( propgrid->IsMainButtonEvent(event) )
{ {
// We need to handle button click in case editor has been
// switched to one that has wxButton as well.
askColour = true; askColour = true;
} }
else if ( event.GetEventType() == wxEVT_COMMAND_COMBOBOX_SELECTED ) else if ( event.GetEventType() == wxEVT_COMMAND_COMBOBOX_SELECTED )
{ {
if ( GetIndex() == GetCustomColourIndex() && // Must override index detection since at this point GetIndex()
!(m_flags & wxPG_PROP_HIDE_CUSTOM_COLOUR) ) // will return old value.
askColour = true; wxOwnerDrawnComboBox* cb =
static_cast<wxOwnerDrawnComboBox*>(propgrid->GetEditorControl());
if ( cb )
{
int index = cb->GetSelection();
if ( index == GetCustomColourIndex() &&
!(m_flags & wxPG_PROP_HIDE_CUSTOM_COLOUR) )
askColour = true;
}
} }
if ( askColour && !propgrid->WasValueChangedInEvent() ) if ( askColour && !propgrid->WasValueChangedInEvent() )
{ {
// We need to handle button click in case editor has been
// switched to one that has wxButton as well.
wxVariant variant; wxVariant variant;
if ( QueryColourFromUser(variant) ) if ( QueryColourFromUser(variant) )
return true; return true;