git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@38648
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
class wxMacListControl : public wxMacControl
{
public:
class wxMacListControl : public wxMacControl
{
public:
- wxMacListControl( wxListBox *peer ) :
- wxMacControl( peer )
+ wxMacListControl( wxListBox *peer )
+ : wxMacControl( peer )
virtual void UpdateLine( int n ) = 0;
virtual void MacDelete( int n ) = 0;
virtual void UpdateLine( int n ) = 0;
virtual void MacDelete( int n ) = 0;
- virtual void MacInsert( int n, const wxString& item) = 0;
- virtual void MacInsert( int n, const wxArrayString& items) = 0;
- virtual void MacAppend( const wxString& item) = 0;
+ virtual void MacInsert( int n, const wxString& item ) = 0;
+ virtual void MacInsert( int n, const wxArrayString& items ) = 0;
+ virtual void MacAppend( const wxString& item ) = 0;
virtual void MacSet( int n, const wxString& item ) = 0;
virtual void MacClear() = 0;
virtual void MacDeselectAll() = 0;
virtual void MacSetSelection( int n, bool select ) = 0;
virtual int MacGetSelection() const = 0;
virtual void MacSet( int n, const wxString& item ) = 0;
virtual void MacClear() = 0;
virtual void MacDeselectAll() = 0;
virtual void MacSetSelection( int n, bool select ) = 0;
virtual int MacGetSelection() const = 0;
- virtual int MacGetSelections(wxArrayInt& aSelections) const = 0;
- virtual bool MacIsSelected( int n ) const= 0;
+ virtual int MacGetSelections( wxArrayInt& aSelections ) const = 0;
+ virtual bool MacIsSelected( int n ) const = 0;
virtual void MacScrollTo( int n ) = 0;
wxListBox * GetPeer() const
virtual void MacScrollTo( int n ) = 0;
wxListBox * GetPeer() const
- {
- return (wxListBox*)m_peer;
- }
+ { return (wxListBox*)m_peer; }
~wxMacCustomHIViewListControl();
void MacDelete( int n );
~wxMacCustomHIViewListControl();
void MacDelete( int n );
- void MacInsert( int n, const wxString& item);
- void MacInsert( int n, const wxArrayString& items);
- void MacAppend( const wxString& item);
+ void MacInsert( int n, const wxString& item );
+ void MacInsert( int n, const wxArrayString& items );
+ void MacAppend( const wxString& item );
void MacSet( int n, const wxString& item );
void MacClear();
void MacDeselectAll();
void MacSetSelection( int n, bool select );
int MacGetSelection() const;
void MacSet( int n, const wxString& item );
void MacClear();
void MacDeselectAll();
void MacSetSelection( int n, bool select );
int MacGetSelection() const;
- int MacGetSelections(wxArrayInt& aSelections) const;
+ int MacGetSelections( wxArrayInt& aSelections ) const;
bool MacIsSelected( int n ) const;
void MacScrollTo( int n );
};
bool MacIsSelected( int n ) const;
void MacScrollTo( int n );
};
void UpdateLine( int n );
void MacDelete( int n );
void UpdateLine( int n );
void MacDelete( int n );
- void MacInsert( int n, const wxString& item);
- void MacInsert( int n, const wxArrayString& items);
- void MacAppend( const wxString& item);
+ void MacInsert( int n, const wxString& item );
+ void MacInsert( int n, const wxArrayString& items );
+ void MacAppend( const wxString& item );
void MacSet( int n, const wxString& item );
void MacClear();
void MacDeselectAll();
void MacSetSelection( int n, bool select );
int MacGetSelection() const;
void MacSet( int n, const wxString& item );
void MacClear();
void MacDeselectAll();
void MacSetSelection( int n, bool select );
int MacGetSelection() const;
- int MacGetSelections(wxArrayInt& aSelections) const;
+ int MacGetSelections( wxArrayInt& aSelections ) const;
bool MacIsSelected( int n ) const;
void MacScrollTo( int n );
bool MacIsSelected( int n ) const;
void MacScrollTo( int n );
virtual OSStatus AutoSizeListViewColumns();
virtual OSStatus SetHasScrollBars( bool horiz, bool vert );
virtual OSStatus SetTableViewHiliteStyle( DataBrowserTableViewHiliteStyle hiliteStyle );
virtual OSStatus AutoSizeListViewColumns();
virtual OSStatus SetHasScrollBars( bool horiz, bool vert );
virtual OSStatus SetTableViewHiliteStyle( DataBrowserTableViewHiliteStyle hiliteStyle );
- virtual OSStatus SetListViewHeaderBtnHeight(UInt16 height);
- virtual OSStatus SetCallbacks(const DataBrowserCallbacks *callbacks);
+ virtual OSStatus SetListViewHeaderBtnHeight( UInt16 height );
+ virtual OSStatus SetCallbacks( const DataBrowserCallbacks *callbacks );
virtual OSStatus UpdateItems( DataBrowserItemID container, UInt32 numItems,
const DataBrowserItemID *items,
DataBrowserPropertyID preSortProperty,
virtual OSStatus UpdateItems( DataBrowserItemID container, UInt32 numItems,
const DataBrowserItemID *items,
DataBrowserPropertyID preSortProperty,
DataBrowserRevealOptions options );
virtual OSStatus GetSelectionAnchor( DataBrowserItemID *first, DataBrowserItemID *last ) const;
virtual bool IsItemSelected( DataBrowserItemID item ) const;
DataBrowserRevealOptions options );
virtual OSStatus GetSelectionAnchor( DataBrowserItemID *first, DataBrowserItemID *last ) const;
virtual bool IsItemSelected( DataBrowserItemID item ) const;
- virtual OSStatus SetSelectedItems(UInt32 numItems,
+ virtual OSStatus SetSelectedItems( UInt32 numItems,
const DataBrowserItemID *items,
DataBrowserSetOption operation );
const DataBrowserItemID *items,
DataBrowserSetOption operation );
const short kTextColumnId = 1024;
const short kCheckboxColumnId = 1025;
const short kTextColumnId = 1024;
const short kCheckboxColumnId = 1025;
-// new databrowserbased version
+// new DataBrowser-based version
// because of the limited insert
// functionality of DataBrowser,
// because of the limited insert
// functionality of DataBrowser,
-// we just introduce id s corresponding
+// we just introduce IDs corresponding
// to the line number
DataBrowserItemDataUPP gDataBrowserItemDataUPP = NULL;
// to the line number
DataBrowserItemDataUPP gDataBrowserItemDataUPP = NULL;
ControlRef browser,
DataBrowserItemID itemID,
DataBrowserItemNotification message,
ControlRef browser,
DataBrowserItemID itemID,
DataBrowserItemNotification message,
- DataBrowserItemDataRef itemData)
+ DataBrowserItemDataRef itemData )
#else
pascal void wxMacDataBrowserListControl::DataBrowserItemNotificationProc(
ControlRef browser,
DataBrowserItemID itemID,
#else
pascal void wxMacDataBrowserListControl::DataBrowserItemNotificationProc(
ControlRef browser,
DataBrowserItemID itemID,
- DataBrowserItemNotification message)
+ DataBrowserItemNotification message )
#endif
{
long ref = GetControlReference( browser );
if ( ref != 0 )
{
wxListBox *list = wxDynamicCast( (wxObject*)ref, wxListBox );
#endif
{
long ref = GetControlReference( browser );
if ( ref != 0 )
{
wxListBox *list = wxDynamicCast( (wxObject*)ref, wxListBox );
- wxMacDataBrowserListControl* peer = (wxMacDataBrowserListControl*) list->GetPeer();
+ wxMacDataBrowserListControl *peer = (wxMacDataBrowserListControl*) list->GetPeer();
int i = itemID - 1;
if (i >= 0 && i < (int)list->GetCount())
int i = itemID - 1;
if (i >= 0 && i < (int)list->GetCount())
event.SetInt( i );
event.SetExtraLong( list->HasMultipleSelection() ? message == kDataBrowserItemSelected : true );
wxPostEvent( list->GetEventHandler(), event );
event.SetInt( i );
event.SetExtraLong( list->HasMultipleSelection() ? message == kDataBrowserItemSelected : true );
wxPostEvent( list->GetEventHandler(), event );
// direct notification is not always having the listbox GetSelection() having in synch with event
// list->GetEventHandler()->ProcessEvent(event);
}
// direct notification is not always having the listbox GetSelection() having in synch with event
// list->GetEventHandler()->ProcessEvent(event);
}
-static pascal OSStatus ListBoxGetSetItemData(ControlRef browser,
- DataBrowserItemID itemID, DataBrowserPropertyID property,
- DataBrowserItemDataRef itemData, Boolean changeValue)
+static pascal OSStatus ListBoxGetSetItemData(
+ ControlRef browser,
+ DataBrowserItemID itemID,
+ DataBrowserPropertyID property,
+ DataBrowserItemDataRef itemData,
+ Boolean changeValue )
{
OSStatus err = errDataBrowserPropertyNotSupported;
long ref = GetControlReference( browser );
{
OSStatus err = errDataBrowserPropertyNotSupported;
long ref = GetControlReference( browser );
- wxListBox* list = wxDynamicCast( (wxObject*) ref, wxListBox );
+ wxListBox *list = wxDynamicCast( (wxObject*)ref, wxListBox );
bool isCheckList = false;
if (list)
isCheckList = list->IsKindOf( CLASSINFO(wxCheckListBox) );
bool isCheckList = false;
if (list)
isCheckList = list->IsKindOf( CLASSINFO(wxCheckListBox) );
switch (property)
{
case kTextColumnId:
switch (property)
{
case kTextColumnId:
- if (i >= 0 && i < (int)list->GetCount() )
+ if (i >= 0 && i < (int)list->GetCount())
{
wxMacCFStringHolder cf( list->GetString( i ), list->GetFont().GetEncoding() );
{
wxMacCFStringHolder cf( list->GetString( i ), list->GetFont().GetEncoding() );
- verify_noerr( ::SetDataBrowserItemDataText( itemData, cf ) );
+ err = ::SetDataBrowserItemDataText( itemData, cf );
+ verify_noerr( err );
err = noErr;
}
}
break;
case kCheckboxColumnId:
err = noErr;
}
}
break;
case kCheckboxColumnId:
- wxCheckListBox* list = wxDynamicCast( (wxObject*) ref, wxCheckListBox );
+ wxCheckListBox *list = wxDynamicCast( (wxObject*)ref, wxCheckListBox );
int i = itemID - 1;
if (i >= 0 && (unsigned int) i < list->GetCount())
{
int i = itemID - 1;
if (i >= 0 && (unsigned int) i < list->GetCount())
{
- verify_noerr( ::SetDataBrowserItemDataButtonValue( itemData, list->IsChecked( i ) ? kThemeButtonOn : kThemeButtonOff ) );
+ err = ::SetDataBrowserItemDataButtonValue( itemData, list->IsChecked( i ) ? kThemeButtonOn : kThemeButtonOff );
+ verify_noerr( err );
case kDataBrowserItemIsEditableProperty:
if ( isCheckList )
case kDataBrowserItemIsEditableProperty:
if ( isCheckList )
- err = ::SetDataBrowserItemDataBooleanValue(itemData, true);
+ err = ::SetDataBrowserItemDataBooleanValue( itemData, true );
switch (property)
{
case kCheckboxColumnId:
switch (property)
{
case kCheckboxColumnId:
- wxCheckListBox* list = wxDynamicCast( (wxObject*) ref, wxCheckListBox );
+ wxCheckListBox *list = wxDynamicCast( (wxObject*)ref, wxCheckListBox );
- if (i >= 0 && (unsigned int)i < list->GetCount() )
+ if (i >= 0 && (unsigned int)i < list->GetCount())
{
// we have to change this behind the back, since Check() would be triggering another update round
bool newVal = !list->IsChecked( i );
{
// we have to change this behind the back, since Check() would be triggering another update round
bool newVal = !list->IsChecked( i );
- verify_noerr( ::SetDataBrowserItemDataButtonValue( itemData, newVal ? kThemeButtonOn : kThemeButtonOff ) );
+ err = ::SetDataBrowserItemDataButtonValue( itemData, newVal ? kThemeButtonOn : kThemeButtonOff );
+ verify_noerr( err );
err = noErr;
list->m_checks[i] = newVal;
err = noErr;
list->m_checks[i] = newVal;
- wxCommandEvent event(wxEVT_COMMAND_CHECKLISTBOX_TOGGLED, list->GetId());
- event.SetInt(i);
- event.SetEventObject(list);
- list->GetEventHandler()->ProcessEvent(event);
+ wxCommandEvent event( wxEVT_COMMAND_CHECKLISTBOX_TOGGLED, list->GetId() );
+ event.SetInt( i );
+ event.SetEventObject( list );
+ list->GetEventHandler()->ProcessEvent( event );
columnDesc.headerBtnDesc.minimumWidth = 0;
columnDesc.headerBtnDesc.maximumWidth = 10000;
columnDesc.headerBtnDesc.minimumWidth = 0;
columnDesc.headerBtnDesc.maximumWidth = 10000;
columnDesc.propertyDesc.propertyID = kTextColumnId;
columnDesc.propertyDesc.propertyType = kDataBrowserTextType;
columnDesc.propertyDesc.propertyFlags = kDataBrowserTableViewSelectionColumn;
columnDesc.propertyDesc.propertyID = kTextColumnId;
columnDesc.propertyDesc.propertyType = kDataBrowserTextType;
columnDesc.propertyDesc.propertyFlags = kDataBrowserTableViewSelectionColumn;
-bool wxListBox::Create(wxWindow *parent,
+bool wxListBox::Create(
+ wxWindow *parent,
wxWindowID id,
const wxPoint& pos,
const wxSize& size,
const wxArrayString& choices,
long style,
const wxValidator& validator,
wxWindowID id,
const wxPoint& pos,
const wxSize& size,
const wxArrayString& choices,
long style,
const wxValidator& validator,
{
wxCArrayString chs(choices);
return Create(
parent, id, pos, size, chs.GetCount(), chs.GetStrings(),
{
wxCArrayString chs(choices);
return Create(
parent, id, pos, size, chs.GetCount(), chs.GetStrings(),
- style, validator, name);
+ style, validator, name );
-bool wxListBox::Create(wxWindow *parent,
+bool wxListBox::Create(
+ wxWindow *parent,
wxWindowID id,
const wxPoint& pos,
const wxSize& size,
wxWindowID id,
const wxPoint& pos,
const wxSize& size,
const wxString choices[],
long style,
const wxValidator& validator,
const wxString choices[],
long style,
const wxValidator& validator,
{
m_macIsUserPane = false;
wxASSERT_MSG( !(style & wxLB_MULTIPLE) || !(style & wxLB_EXTENDED),
{
m_macIsUserPane = false;
wxASSERT_MSG( !(style & wxLB_MULTIPLE) || !(style & wxLB_EXTENDED),
- _T("only one of listbox selection modes can be specified") );
+ wxT("only a single listbox selection mode can be specified") );
- if ( !wxListBoxBase::Create(parent, id, pos, size, style & ~(wxHSCROLL | wxVSCROLL), validator, name) )
+ if ( !wxListBoxBase::Create( parent, id, pos, size, style & ~(wxHSCROLL | wxVSCROLL), validator, name ) )
return false;
// this will be increased by our append command
return false;
// this will be increased by our append command
{
#if wxUSE_OWNER_DRAWN
wxASSERT_MSG(clientData[i] == NULL,
{
#if wxUSE_OWNER_DRAWN
wxASSERT_MSG(clientData[i] == NULL,
- wxT("Can't use client data with owner-drawn listboxes"));
+ wxT("Cannot use client data with owner-drawn listboxes"));
#else
Append( choices[i], clientData[i] );
#endif
#else
Append( choices[i], clientData[i] );
#endif
{
for ( size_t i = 0; i < m_noItems; ++ i )
{
{
for ( size_t i = 0; i < m_noItems; ++ i )
{
- if (s.IsSameAs(GetString(i), bCase))
+ if (s.IsSameAs( GetString( i ), bCase) )
{
wxCHECK_MSG( IsValid(n), NULL, wxT("invalid index in wxListBox::GetClientData"));
{
wxCHECK_MSG( IsValid(n), NULL, wxT("invalid index in wxListBox::GetClientData"));
- wxASSERT_MSG( m_dataArray.GetCount() >= (unsigned int) n, wxT("invalid client_data array") );
+ wxASSERT_MSG( m_dataArray.GetCount() >= (unsigned int)n, wxT("invalid client_data array") );
- return (void *)m_dataArray[n];
+ return (void*)m_dataArray[n];
}
wxClientData *wxListBox::DoGetItemClientObject(unsigned int n) const
{
}
wxClientData *wxListBox::DoGetItemClientObject(unsigned int n) const
{
- return (wxClientData *) DoGetItemClientData( n );
+ return (wxClientData*)DoGetItemClientData( n );
}
void wxListBox::DoSetItemClientData(unsigned int n, void *clientData)
}
void wxListBox::DoSetItemClientData(unsigned int n, void *clientData)
{
// client data must be pointer to wxOwnerDrawn, otherwise we would crash
// in OnMeasure/OnDraw.
{
// client data must be pointer to wxOwnerDrawn, otherwise we would crash
// in OnMeasure/OnDraw.
- wxFAIL_MSG(wxT("Can't use client data with owner-drawn listboxes"));
+ wxFAIL_MSG(wxT("Cannot use client data with owner-drawn listboxes"));
- wxASSERT_MSG( m_dataArray.GetCount() >= (unsigned int) n, wxT("invalid client_data array") );
+ wxASSERT_MSG( m_dataArray.GetCount() >= (unsigned int)n, wxT("invalid client_data array") );
- if ( m_dataArray.GetCount() > (unsigned int) n )
+ if ( m_dataArray.GetCount() > (unsigned int)n )
m_dataArray[n] = (char*)clientData;
else
m_dataArray.Add( (char*)clientData );
m_dataArray[n] = (char*)clientData;
else
m_dataArray.Add( (char*)clientData );
else
{
::TextFont( kFontIDMonaco );
else
{
::TextFont( kFontIDMonaco );
::TextFace( 0 );
}
// Find the widest line
for (unsigned int i = 0; i < GetCount(); i++)
{
::TextFace( 0 );
}
// Find the widest line
for (unsigned int i = 0; i < GetCount(); i++)
{
- wxString str(GetString(i));
+ wxString str( GetString( i ) );
#if wxUSE_UNICODE
Point bounds = {0, 0};
#if wxUSE_UNICODE
Point bounds = {0, 0};
}
// Add room for the scrollbar
}
// Add room for the scrollbar
- lbWidth += wxSystemSettings::GetMetric(wxSYS_VSCROLL_X);
+ lbWidth += wxSystemSettings::GetMetric( wxSYS_VSCROLL_X );
// And just a bit more
int cy = 12;
// And just a bit more
int cy = 12;
: wxOwnerDrawn(str, false)
{
// no bitmaps/checkmarks
: wxOwnerDrawn(str, false)
{
// no bitmaps/checkmarks
}
wxOwnerDrawn *wxListBox::CreateItem(size_t n)
}
wxOwnerDrawn *wxListBox::CreateItem(size_t n)