X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c86ec17bcdf0c50d0987c862eed6abaae7990aa1..6f026b5b63fe7ccb025e84509886f74772b9df13:/src/cocoa/listbox.mm diff --git a/src/cocoa/listbox.mm b/src/cocoa/listbox.mm index 3731f9461b..f75f35c0ab 100644 --- a/src/cocoa/listbox.mm +++ b/src/cocoa/listbox.mm @@ -4,9 +4,8 @@ // Author: David Elliott // Modified by: // Created: 2003/03/18 -// Id: $Id$ // Copyright: (c) 2003 David Elliott -// Licence: wxWidgets licence +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #include "wx/wxprec.h" @@ -68,7 +67,6 @@ static void _SetWidthOfTableColumnToFitItems(NSTableColumn *tableColumn, NSArray // class wxListBox // ============================================================================ -IMPLEMENT_DYNAMIC_CLASS(wxListBox, wxControlWithItems) BEGIN_EVENT_TABLE(wxListBox, wxListBoxBase) END_EVENT_TABLE() WX_IMPLEMENT_COCOA_OWNER(wxListBox,NSTableView,NSControl,NSView) @@ -143,6 +141,8 @@ The listbox contents are sorted in alphabetical order. // Add the single column NSTableColumn *tableColumn = [[NSTableColumn alloc] initWithIdentifier:nil]; [GetNSTableView() addTableColumn: tableColumn]; + // By default, entries should not be editable + [tableColumn setEditable:NO]; [tableColumn release]; [GetNSTableView() sizeToFit]; @@ -154,13 +154,25 @@ The listbox contents are sorted in alphabetical order. CocoaCreateNSScrollView(); SetInitialFrameRect(pos,size); - [m_wxCocoaScrollView->GetNSScrollView() setHasVerticalScroller:YES]; - // Pre-10.3: Always show vertical scroller, never show horizontal scroller - // Post-10.3: Show scrollers dynamically (turn them both on, set auto-hide) - if([m_wxCocoaScrollView->GetNSScrollView() respondsToSelector:@selector(setAutohidesScrollers:)]) + if ((style & wxLB_NEEDED_SB) || (style & wxLB_ALWAYS_SB)) { - [m_wxCocoaScrollView->GetNSScrollView() setHasHorizontalScroller:YES]; - [m_wxCocoaScrollView->GetNSScrollView() setAutohidesScrollers:YES]; + [m_wxCocoaScrollView->GetNSScrollView() setHasVerticalScroller: YES]; + } + + if (style & wxLB_HSCROLL) + { + [m_wxCocoaScrollView->GetNSScrollView() setHasHorizontalScroller: YES]; + } + + // We can't set auto-hiding individually for horizontal/vertical scrollers, + // so we have settled on always allowing hiding for both unless the vertical + // setting is "always show". + if (((style & wxLB_NEEDED_SB) || (style & wxLB_HSCROLL)) && !(style & wxLB_ALWAYS_SB)) + { + if ([m_wxCocoaScrollView->GetNSScrollView() respondsToSelector:@selector(setAutohidesScrollers:)]) + { + [m_wxCocoaScrollView->GetNSScrollView() setAutohidesScrollers: YES]; + } } // Set up extended/multiple selection flags