From de387fc99cf48b8fad44cc9ec5233242076d1584 Mon Sep 17 00:00:00 2001 From: Kevin Ollivier Date: Thu, 28 Dec 2006 06:33:57 +0000 Subject: [PATCH] exposing generic system option define, adding missing event.Skip() to OnChar, and tweaking handling of scrollbars. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@44067 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/mac/carbon/listctrl.h | 2 ++ src/mac/carbon/listctrl_mac.cpp | 29 +++++++++++++++++------------ 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/include/wx/mac/carbon/listctrl.h b/include/wx/mac/carbon/listctrl.h index 45c87d0da0..8e2efb0c6b 100644 --- a/include/wx/mac/carbon/listctrl.h +++ b/include/wx/mac/carbon/listctrl.h @@ -15,6 +15,8 @@ #include "wx/defs.h" #include "wx/generic/listctrl.h" +#define wxMAC_ALWAYS_USE_GENERIC_LISTCTRL wxT("mac.listctrl.always_use_generic") + class wxMacDataBrowserListCtrlControl; class wxMacListControl; class wxListCtrlTextCtrlWrapper; diff --git a/src/mac/carbon/listctrl_mac.cpp b/src/mac/carbon/listctrl_mac.cpp index bee5f011ef..6d7f881fd5 100644 --- a/src/mac/carbon/listctrl_mac.cpp +++ b/src/mac/carbon/listctrl_mac.cpp @@ -40,8 +40,6 @@ #include "wx/hashmap.h" -#define wxMAC_ALWAYS_USE_GENERIC_LISTCTRL wxT("mac.listctrl.always_use_generic") - #if wxUSE_EXTENDED_RTTI WX_DEFINE_FLAGS( wxListCtrlStyle ) @@ -221,7 +219,8 @@ public: virtual void MacSetColumnInfo( unsigned int row, unsigned int column, wxListItem* item ); virtual void MacGetColumnInfo( unsigned int row, unsigned int column, wxListItem& item ); virtual void UpdateState(wxMacDataItem* dataItem, wxListItem* item); - + int GetFlags() { return m_flags; } + protected: // we need to override to provide specialized handling for virtual wxListCtrls virtual OSStatus GetSetItemData(DataBrowserItemID itemID, @@ -276,6 +275,7 @@ protected: wxClientDataType m_clientDataItemsType; bool m_isVirtual; + int m_flags; DECLARE_DYNAMIC_CLASS_NO_COPY(wxMacDataBrowserListCtrlControl) }; @@ -671,6 +671,7 @@ void wxListCtrl::OnChar(wxKeyEvent& event) } GetEventHandler()->ProcessEvent(le); } + event.Skip(); } #endif @@ -802,12 +803,15 @@ void wxListCtrl::DoSetSize( int x, int y, int width, int height, int sizeFlags ) totalWidth += m_dbImpl->GetColumnWidth( column ); } - Boolean vertScrollBar; - GetDataBrowserHasScrollBars( m_dbImpl->GetControlRef(), NULL, &vertScrollBar ); - if (totalWidth > width) - SetDataBrowserHasScrollBars( m_dbImpl->GetControlRef(), true, vertScrollBar ); - else - SetDataBrowserHasScrollBars( m_dbImpl->GetControlRef(), false, vertScrollBar ); + if ( !(m_dbImpl->GetFlags() & wxHSCROLL) ) + { + Boolean vertScrollBar; + GetDataBrowserHasScrollBars( m_dbImpl->GetControlRef(), NULL, &vertScrollBar ); + if (totalWidth > width) + SetDataBrowserHasScrollBars( m_dbImpl->GetControlRef(), true, vertScrollBar ); + else + SetDataBrowserHasScrollBars( m_dbImpl->GetControlRef(), false, vertScrollBar ); + } } } @@ -1021,7 +1025,7 @@ bool wxListCtrl::SetColumnWidth(int col, int width) { wxListItem colInfo; GetColumn(col, colInfo); - + colInfo.SetWidth(width); SetColumn(col, colInfo); m_dbImpl->SetColumnWidth(col, mywidth); @@ -2367,6 +2371,7 @@ wxMacDataBrowserListCtrlControl::wxMacDataBrowserListCtrlControl( wxWindow *peer OSStatus err = noErr; m_clientDataItemsType = wxClientData_None; m_isVirtual = false; + m_flags = 0; if ( style & wxLC_VIRTUAL ) m_isVirtual = true; @@ -2431,7 +2436,7 @@ wxMacDataBrowserListCtrlControl::wxMacDataBrowserListCtrlControl( wxWindow *peer } verify_noerr( SetHiliteStyle(kDataBrowserTableViewFillHilite ) ); - err = SetHasScrollBars( (style & wxHSCROLL) != 0 , (style & wxVSCROLL) != 0 ); + verify_noerr( SetHasScrollBars( (style & wxHSCROLL) != 0 , true ) ); } pascal Boolean wxMacDataBrowserListCtrlControl::DataBrowserEditTextProc( @@ -2842,7 +2847,7 @@ void wxMacDataBrowserListCtrlControl::ItemNotification(DataBrowserItemID itemID, // avoid asserts by getting out now return ; } - + wxListCtrl *list = wxDynamicCast( GetPeer() , wxListCtrl ); if ( list ) {