#include "wx/listctrl.h"
-#if (!defined(__WXMSW__) || defined(__WXUNIVERSAL__)) && !defined(__WXMAC__)
+#if ((!defined(__WXMSW__) && !(defined(__WXMAC__) && wxOSX_USE_CARBON)) || defined(__WXUNIVERSAL__))
// if we have a native version, its implementation file does all this
IMPLEMENT_DYNAMIC_CLASS(wxListItem, wxObject)
IMPLEMENT_DYNAMIC_CLASS(wxListView, wxListCtrl)
#ifdef __WXMAC__
#include "wx/osx/private.h"
+ // for themeing support
+ #include <Carbon/Carbon.h>
#endif
void OnPaint( wxPaintEvent &event );
+ void OnChildFocus(wxChildFocusEvent& event);
+
void DrawImage( int index, wxDC *dc, int x, int y );
void GetImageSize( int index, int &width, int &height ) const;
int GetTextLength( const wxString &s ) const;
#ifdef __WXMAC__
{
if (m_owner->HasFocus()
-#if !defined(__WXUNIVERSAL__)
+#if !defined(__WXUNIVERSAL__) && wxOSX_USE_CARBON
&& IsControlActive( (ControlRef)m_owner->GetHandle() )
#endif
)
{
int flags = wxCONTROL_SELECTED;
if (m_owner->HasFocus()
-#if defined( __WXMAC__ ) && !defined(__WXUNIVERSAL__)
+#if defined( __WXMAC__ ) && !defined(__WXUNIVERSAL__) && wxOSX_USE_CARBON
&& IsControlActive( (ControlRef)m_owner->GetHandle() )
#endif
)
x += wCol;
}
+
+ // Fill in what's missing to the right of the columns, otherwise we will
+ // leave an unpainted area when columns are removed (and it looks better)
+ if ( x < w )
+ {
+ wxRendererNative::Get().DrawHeaderButton
+ (
+ this,
+ dc,
+ wxRect(x, HEADER_OFFSET_Y, w - x, h),
+ 0
+ );
+ }
}
void wxListHeaderWindow::DrawCurrent()
EVT_SET_FOCUS (wxListMainWindow::OnSetFocus)
EVT_KILL_FOCUS (wxListMainWindow::OnKillFocus)
EVT_SCROLLWIN (wxListMainWindow::OnScroll)
+ EVT_CHILD_FOCUS (wxListMainWindow::OnChildFocus)
END_EVENT_TABLE()
void wxListMainWindow::Init()
}
}
+void wxListMainWindow::OnChildFocus(wxChildFocusEvent& WXUNUSED(event))
+{
+ // Do nothing here. This prevents the default handler in wxScrolledWindow
+ // from needlessly scrolling the window when the edit control is
+ // dismissed. See ticket #9563.
+}
+
void wxListMainWindow::SendNotify( size_t line,
wxEventType command,
const wxPoint& point )
wxWindow *parent = GetParent();
// propagate the key event upwards
- wxKeyEvent ke( wxEVT_KEY_DOWN );
- ke.m_shiftDown = event.m_shiftDown;
- ke.m_controlDown = event.m_controlDown;
- ke.m_altDown = event.m_altDown;
- ke.m_metaDown = event.m_metaDown;
- ke.m_keyCode = event.m_keyCode;
- ke.m_x = event.m_x;
- ke.m_y = event.m_y;
+ wxKeyEvent ke(event);
ke.SetEventObject( parent );
- if (parent->GetEventHandler()->ProcessEvent( ke )) return;
+ if (parent->GetEventHandler()->ProcessEvent( ke ))
+ return;
event.Skip();
}
wxWindow *parent = GetParent();
// propagate the key event upwards
- wxKeyEvent ke( wxEVT_KEY_UP );
- ke.m_shiftDown = event.m_shiftDown;
- ke.m_controlDown = event.m_controlDown;
- ke.m_altDown = event.m_altDown;
- ke.m_metaDown = event.m_metaDown;
- ke.m_keyCode = event.m_keyCode;
- ke.m_x = event.m_x;
- ke.m_y = event.m_y;
- ke.SetEventObject( parent );
- if (parent->GetEventHandler()->ProcessEvent( ke )) return;
+ wxKeyEvent ke(event);
+ if (parent->GetEventHandler()->ProcessEvent( ke ))
+ return;
event.Skip();
}
}
// propagate the char event upwards
- wxKeyEvent ke( wxEVT_CHAR );
- ke.m_shiftDown = event.m_shiftDown;
- ke.m_controlDown = event.m_controlDown;
- ke.m_altDown = event.m_altDown;
- ke.m_metaDown = event.m_metaDown;
- ke.m_keyCode = event.m_keyCode;
- ke.m_x = event.m_x;
- ke.m_y = event.m_y;
+ wxKeyEvent ke(event);
ke.SetEventObject( parent );
- if (parent->GetEventHandler()->ProcessEvent( ke )) return;
+ if (parent->GetEventHandler()->ProcessEvent( ke ))
+ return;
if ( HandleAsNavigationKey(event) )
return;
{
for ( int i = 0; i < count; i++ )
{
- wxRect r;
- GetItemRect(i, r);
+ // we need logical, not physical, coordinates here, so use
+ // GetLineRect() instead of GetItemRect()
+ wxRect r = GetLineRect(i);
wxCoord x = r.GetRight(),
y = r.GetBottom();
{
if ( m_headerWin )
{
-#ifdef __WXMAC__
+#if defined( __WXMAC__ ) && wxOSX_USE_COCOA_OR_CARBON
SInt32 h;
GetThemeMetric( kThemeMetricListHeaderHeight, &h );
#else
m_headerHeight = 0;
- if ( !(style & wxLC_MASK_TYPE) )
- {
- style = style | wxLC_LIST;
- }
+ // just like in other ports, an assert will fail if the user doesn't give any type style:
+ wxASSERT_MSG( (style & wxLC_MASK_TYPE),
+ _T("wxListCtrl style should have exactly one mode bit set") );
if ( !wxControl::Create( parent, id, pos, size, style, validator, name ) )
return false;
m_mainWin = new wxListMainWindow( this, wxID_ANY, wxPoint(0, 0), size, style );
-#ifdef __WXMAC__
+#if defined( __WXMAC__ ) && wxOSX_USE_COCOA_OR_CARBON
// Human Interface Guidelines ask us for a special font in this case
if ( GetWindowVariant() == wxWINDOW_VARIANT_NORMAL )
{
wxFont font;
+#if wxOSX_USE_CARBON
font.MacCreateFromThemeFont( kThemeViewsFont );
+#else
+ font.MacCreateFromUIFont( kCTFontViewsFontType );
+#endif
SetFont( font );
}
#endif
{
CreateHeaderWindow();
-#ifdef __WXMAC__
+#if defined( __WXMAC__ ) && wxOSX_USE_COCOA_OR_CARBON
if (m_headerWin)
{
wxFont font;
+#if wxOSX_USE_CARBON
font.MacCreateFromThemeFont( kThemeSmallSystemFont );
+#else
+ font.MacCreateFromUIFont( kCTFontSystemFontType );
+#endif
m_headerWin->SetFont( font );
CalculateAndSetHeaderHeight();
}