Generic list and tree ctrl should not use the focused selection color when the top level window is not active.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@44108 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Kevin Ollivier 2007-01-07 01:15:20 +00:00
parent 3d7a1b394b
commit ed9a7a63b8
3 changed files with 36 additions and 5 deletions

View File

@ -1410,7 +1410,11 @@ bool wxListLineData::SetAttributes(wxDC *dc,
if ( highlighted )
#ifdef __WXMAC__
{
if (m_owner->HasFocus())
if (m_owner->HasFocus()
#ifdef __WXMAC__
&& IsControlActive( (ControlRef)m_owner->GetHandle() )
#endif
)
colText = *wxWHITE;
else
colText = *wxBLACK;
@ -1470,7 +1474,11 @@ void wxListLineData::Draw( wxDC *dc )
if (highlighted)
{
int flags = wxCONTROL_SELECTED;
if (m_owner->HasFocus())
if (m_owner->HasFocus()
#ifdef __WXMAC__
&& IsControlActive( (ControlRef)m_owner->GetHandle() )
#endif
)
flags |= wxCONTROL_FOCUSED;
wxRendererNative::Get().DrawItemSelectionRect( m_owner, *dc, m_gi->m_rectHighlight, flags );
@ -1529,7 +1537,11 @@ void wxListLineData::DrawInReportMode( wxDC *dc,
if (highlighted)
{
int flags = wxCONTROL_SELECTED;
if (m_owner->HasFocus())
if (m_owner->HasFocus()
#ifdef __WXMAC__
&& IsControlActive( (ControlRef)m_owner->GetHandle() )
#endif
)
flags |= wxCONTROL_FOCUSED;
wxRendererNative::Get().DrawItemSelectionRect( m_owner, *dc, rectHL, flags );
}

View File

@ -2232,7 +2232,11 @@ void wxGenericTreeCtrl::PaintItem(wxGenericTreeItem *item, wxDC& dc)
else
{
int flags = wxCONTROL_SELECTED;
if (m_hasFocus)
if (m_hasFocus
#ifdef __WXMAC__
&& IsControlActive( (ControlRef)GetHandle() )
#endif
)
flags |= wxCONTROL_FOCUSED;
if ((item == m_current) && (m_hasFocus))
flags |= wxCONTROL_CURRENT;
@ -2374,7 +2378,7 @@ void wxGenericTreeCtrl::PaintLevel( wxGenericTreeItem *item, wxDC &dc, int level
// rectangle, so we want to make sure that the text is visible
// against the normal background, not the highlightbackground, so
// don't use the highlight text colour unless we have the focus.
&& m_hasFocus
&& m_hasFocus && IsControlActive( (ControlRef)GetHandle() )
#endif
)
{

View File

@ -33,6 +33,8 @@
#include "wx/layout.h"
#include "wx/statusbr.h"
#include "wx/menuitem.h"
#include "wx/treectrl.h"
#include "wx/listctrl.h"
#endif
#include "wx/tooltip.h"
@ -167,6 +169,9 @@ static const EventTypeSpec eventList[] =
{ kEventClassControl , kEventControlVisibilityChanged } ,
{ kEventClassControl , kEventControlEnabledStateChanged } ,
{ kEventClassControl , kEventControlHiliteChanged } ,
{ kEventClassControl , kEventControlActivate } ,
{ kEventClassControl , kEventControlDeactivate } ,
#endif
{ kEventClassControl , kEventControlSetFocusPart } ,
@ -294,6 +299,16 @@ static pascal OSStatus wxMacWindowControlEventHandler( EventHandlerCallRef handl
case kEventControlHiliteChanged :
thisWindow->MacHiliteChanged() ;
break ;
case kEventControlActivate :
case kEventControlDeactivate :
if ( thisWindow->IsKindOf( CLASSINFO( wxTreeCtrl ) )
|| thisWindow->IsKindOf( CLASSINFO( wxListCtrl ) )
)
thisWindow->Refresh();
//thisWindow->MacActivateStateChanged() ;
break ;
#endif
// we emulate this event under Carbon CFM