cleanup - reformatting, pt 2

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@38648 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
David Surovell
2006-04-10 04:45:25 +00:00
parent cee24bf7ab
commit 520b09fcda

View File

@@ -35,8 +35,8 @@ END_EVENT_TABLE()
class wxMacListControl : public wxMacControl class wxMacListControl : public wxMacControl
{ {
public: public:
wxMacListControl( wxListBox *peer ) : wxMacListControl( wxListBox *peer )
wxMacControl( peer ) : wxMacControl( peer )
{ {
} }
@@ -60,9 +60,7 @@ public:
virtual void MacScrollTo( int n ) = 0; virtual void MacScrollTo( int n ) = 0;
wxListBox * GetPeer() const wxListBox * GetPeer() const
{ { return (wxListBox*)m_peer; }
return (wxListBox*)m_peer;
}
}; };
#if 0 #if 0
@@ -169,10 +167,10 @@ private:
const short kTextColumnId = 1024; const short kTextColumnId = 1024;
const short kCheckboxColumnId = 1025; const short kCheckboxColumnId = 1025;
// new databrowserbased version // new DataBrowser-based version
// because of the limited insert // because of the limited insert
// functionality of DataBrowser, // functionality of DataBrowser,
// we just introduce id s corresponding // we just introduce IDs corresponding
// to the line number // to the line number
DataBrowserItemDataUPP gDataBrowserItemDataUPP = NULL; DataBrowserItemDataUPP gDataBrowserItemDataUPP = NULL;
@@ -233,6 +231,7 @@ pascal void wxMacDataBrowserListControl::DataBrowserItemNotificationProc(
event.SetInt( i ); event.SetInt( i );
event.SetExtraLong( list->HasMultipleSelection() ? message == kDataBrowserItemSelected : true ); event.SetExtraLong( list->HasMultipleSelection() ? message == kDataBrowserItemSelected : true );
wxPostEvent( list->GetEventHandler(), event ); wxPostEvent( list->GetEventHandler(), event );
// direct notification is not always having the listbox GetSelection() having in synch with event // direct notification is not always having the listbox GetSelection() having in synch with event
// list->GetEventHandler()->ProcessEvent(event); // list->GetEventHandler()->ProcessEvent(event);
} }
@@ -240,9 +239,12 @@ pascal void wxMacDataBrowserListControl::DataBrowserItemNotificationProc(
} }
} }
static pascal OSStatus ListBoxGetSetItemData(ControlRef browser, static pascal OSStatus ListBoxGetSetItemData(
DataBrowserItemID itemID, DataBrowserPropertyID property, ControlRef browser,
DataBrowserItemDataRef itemData, Boolean changeValue) DataBrowserItemID itemID,
DataBrowserPropertyID property,
DataBrowserItemDataRef itemData,
Boolean changeValue )
{ {
OSStatus err = errDataBrowserPropertyNotSupported; OSStatus err = errDataBrowserPropertyNotSupported;
@@ -258,26 +260,28 @@ static pascal OSStatus ListBoxGetSetItemData(ControlRef browser,
switch (property) switch (property)
{ {
case kTextColumnId: case kTextColumnId:
if ( ref ) if ( ref != 0 )
{ {
int i = itemID - 1; int i = itemID - 1;
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; err = noErr;
} }
} }
break; break;
case kCheckboxColumnId: case kCheckboxColumnId:
if ( ref ) if ( ref != 0 )
{ {
wxCheckListBox *list = wxDynamicCast( (wxObject*)ref, wxCheckListBox ); wxCheckListBox *list = wxDynamicCast( (wxObject*)ref, wxCheckListBox );
int i = itemID - 1; int i = itemID - 1;
if (i >= 0 && (unsigned int) i < list->GetCount()) 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 );
err = noErr; err = noErr;
} }
} }
@@ -297,7 +301,7 @@ static pascal OSStatus ListBoxGetSetItemData(ControlRef browser,
switch (property) switch (property)
{ {
case kCheckboxColumnId: case kCheckboxColumnId:
if ( ref ) if ( ref != 0 )
{ {
wxCheckListBox *list = wxDynamicCast( (wxObject*)ref, wxCheckListBox ); wxCheckListBox *list = wxDynamicCast( (wxObject*)ref, wxCheckListBox );
int i = itemID - 1; int i = itemID - 1;
@@ -305,7 +309,8 @@ static pascal OSStatus ListBoxGetSetItemData(ControlRef browser,
{ {
// we have to change this behind the back, since Check() would be triggering another update round // we have to change this behind the back, since Check() would be triggering another update round
bool newVal = !list->IsChecked( i ); bool newVal = !list->IsChecked( i );
verify_noerr( ::SetDataBrowserItemDataButtonValue( itemData, newVal ? kThemeButtonOn : kThemeButtonOff ) ); err = ::SetDataBrowserItemDataButtonValue( itemData, newVal ? kThemeButtonOn : kThemeButtonOff );
verify_noerr( err );
err = noErr; err = noErr;
list->m_checks[i] = newVal; list->m_checks[i] = newVal;
@@ -403,7 +408,6 @@ wxMacDataBrowserListControl::wxMacDataBrowserListControl( wxListBox *peer, const
columnDesc.headerBtnDesc.minimumWidth = 0; columnDesc.headerBtnDesc.minimumWidth = 0;
columnDesc.headerBtnDesc.maximumWidth = 10000; columnDesc.headerBtnDesc.maximumWidth = 10000;
columnDesc.propertyDesc.propertyID = kTextColumnId; columnDesc.propertyDesc.propertyID = kTextColumnId;
columnDesc.propertyDesc.propertyType = kDataBrowserTextType; columnDesc.propertyDesc.propertyType = kDataBrowserTextType;
columnDesc.propertyDesc.propertyFlags = kDataBrowserTableViewSelectionColumn; columnDesc.propertyDesc.propertyFlags = kDataBrowserTableViewSelectionColumn;
@@ -776,7 +780,8 @@ wxListBox::wxListBox()
m_noItems = 0; m_noItems = 0;
} }
bool wxListBox::Create(wxWindow *parent, bool wxListBox::Create(
wxWindow *parent,
wxWindowID id, wxWindowID id,
const wxPoint& pos, const wxPoint& pos,
const wxSize& size, const wxSize& size,
@@ -792,7 +797,8 @@ bool wxListBox::Create(wxWindow *parent,
style, validator, name ); style, validator, name );
} }
bool wxListBox::Create(wxWindow *parent, bool wxListBox::Create(
wxWindow *parent,
wxWindowID id, wxWindowID id,
const wxPoint& pos, const wxPoint& pos,
const wxSize& size, const wxSize& size,
@@ -805,7 +811,7 @@ bool wxListBox::Create(wxWindow *parent,
m_macIsUserPane = false; m_macIsUserPane = false;
wxASSERT_MSG( !(style & wxLB_MULTIPLE) || !(style & wxLB_EXTENDED), 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; return false;
@@ -920,7 +926,7 @@ void wxListBox::DoSetItems(const wxArrayString& choices, void** clientData)
{ {
#if wxUSE_OWNER_DRAWN #if wxUSE_OWNER_DRAWN
wxASSERT_MSG(clientData[i] == NULL, 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 #else
Append( choices[i], clientData[i] ); Append( choices[i], clientData[i] );
#endif #endif
@@ -1015,7 +1021,7 @@ void wxListBox::DoSetItemClientData(unsigned int n, void *clientData)
{ {
// client data must be pointer to wxOwnerDrawn, otherwise we would crash // client data must be pointer to wxOwnerDrawn, otherwise we would crash
// in OnMeasure/OnDraw. // 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"));
} }
#endif #endif