// list box control implementation
// ============================================================================
-wxWidgetImplType* wxWidgetImpl::CreateListBox( wxWindowMac* wxpeer,
- wxWindowMac* parent,
- wxWindowID id,
- const wxPoint& pos,
+wxWidgetImplType* wxWidgetImpl::CreateListBox( wxWindowMac* wxpeer,
+ wxWindowMac* WXUNUSED(parent),
+ wxWindowID WXUNUSED(id),
+ const wxPoint& pos,
const wxSize& size,
- long style,
- long extraStyle)
+ long style,
+ long WXUNUSED(extraStyle))
{
wxMacDataBrowserListControl* control = new wxMacDataBrowserListControl( wxpeer, pos, size, style );
// TODO CHECK control->SetClientDataType( m_clientDataItemsType );
wxListBox *list = wxDynamicCast( owner->GetWXPeer() , wxListBox );
wxMacDataBrowserCellValue valueholder(itemData);
list->GetValueCallback( n , col, valueholder );
-
+
err = noErr;
}
else
}
}
-
+
}
else
{
{
err = wxMacDataItem::GetSetData(owner, property, itemData, changeValue);
}
-
+
return err;
}
if (message == kDataBrowserItemDoubleClicked)
{
unsigned int n = owner->GetLineFromItem( this );
- wxCommandEvent event( wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, list->GetId() );
- event.SetEventObject( list );
- if ( list->HasClientObjectData() )
- event.SetClientObject( list->GetClientObject(n) );
- else if ( list->HasClientUntypedData() )
- event.SetClientData( list->GetClientData(n) );
- event.SetString( list->GetString(n) );
- event.SetInt( n );
- event.SetExtraLong( 1 );
- list->HandleWindowEvent(event);
+ list->HandleLineEvent( n, true );
return;
}
}
: wxMacDataItemBrowserControl( peer, pos, size, style )
{
m_nextColumnId = 0 ;
-
+
OSStatus err = noErr;
m_clientDataItemsType = wxClientData_None;
if ( style & wxLB_SORT )
}
void wxMacDataBrowserListControl::ItemNotification(
- const wxMacDataItem* itemID,
+ DataBrowserItemID itemID,
DataBrowserItemNotification message,
DataBrowserItemDataRef itemData)
{
wxListBox *list = wxDynamicCast( GetWXPeer() , wxListBox );
wxCHECK_RET( list != NULL , wxT("Listbox expected"));
-
+
if (list->HasMultipleSelection() && (message == kDataBrowserSelectionSetChanged) && (!list->MacGetBlockEvents()))
{
list->CalcAndSendEvent();
if ((message == kDataBrowserSelectionSetChanged) && (!list->MacGetBlockEvents()))
{
wxCommandEvent event( wxEVT_COMMAND_LISTBOX_SELECTED, list->GetId() );
-
+
int sel = list->GetSelection();
if ((sel < 0) || (sel > (int) list->GetCount())) // OS X can select an item below the last item (why?)
return;
- event.SetEventObject( list );
- if ( list->HasClientObjectData() )
- event.SetClientObject( list->GetClientObject( sel ) );
- else if ( list->HasClientUntypedData() )
- event.SetClientData( list->GetClientData( sel ) );
- event.SetString( list->GetString( sel ) );
- event.SetInt( sel );
- event.SetExtraLong( 1 );
- list->HandleWindowEvent(event);
+ list->HandleLineEvent( sel, false );
return;
}
-
+
// call super for item level(wxMacDataItem->Notification) callback processing
wxMacDataItemBrowserControl::ItemNotification( itemID, message, itemData);
}
// List Methods
//
-wxMacDataBrowserColumn* wxMacDataBrowserListControl::DoInsertColumn( unsigned int pos, DataBrowserPropertyID property,
+wxMacDataBrowserColumn* wxMacDataBrowserListControl::DoInsertColumn( unsigned int pos, DataBrowserPropertyID property,
const wxString& title, bool editable,
DataBrowserPropertyType colType, SInt16 just, int width )
{
columnDesc.propertyDesc.propertyFlags = kDataBrowserListViewSortableColumn;
columnDesc.propertyDesc.propertyFlags |= kDataBrowserListViewTypeSelectColumn;
columnDesc.propertyDesc.propertyFlags |= kDataBrowserListViewNoGapForIconInHeaderButton;
-
+
if ( editable )
columnDesc.propertyDesc.propertyFlags |= kDataBrowserPropertyIsMutable;
}
wxMacDataBrowserColumn *col = new wxMacDataBrowserColumn( property, colType, editable );
-
+
m_columns.Insert( col, pos );
-
+
return col;
}
-wxListWidgetColumn* wxMacDataBrowserListControl::InsertTextColumn( unsigned pos, const wxString& title, bool editable,
- wxAlignment just, int defaultWidth)
+wxListWidgetColumn* wxMacDataBrowserListControl::InsertTextColumn( unsigned pos, const wxString& title, bool editable,
+ wxAlignment just, int defaultWidth)
{
DataBrowserPropertyID property = kMinColumnId + m_nextColumnId++;
-
+
SInt16 j = teFlushLeft;
if ( just & wxALIGN_RIGHT )
j = teFlushRight;
else if ( just & wxALIGN_CENTER_HORIZONTAL )
j = teCenter;
-
- return DoInsertColumn( pos, property, title, editable, kDataBrowserTextType, just, defaultWidth );
+
+ return DoInsertColumn( pos, property, title, editable, kDataBrowserTextType, just, defaultWidth );
}
-wxListWidgetColumn* wxMacDataBrowserListControl::InsertCheckColumn( unsigned pos , const wxString& title, bool editable,
- wxAlignment just, int defaultWidth )
+wxListWidgetColumn* wxMacDataBrowserListControl::InsertCheckColumn( unsigned pos , const wxString& title, bool editable,
+ wxAlignment just, int defaultWidth )
{
DataBrowserPropertyID property = kMinColumnId + m_nextColumnId++;
-
+
SInt16 j = teFlushLeft;
if ( just & wxALIGN_RIGHT )
j = teFlushRight;
else if ( just & wxALIGN_CENTER_HORIZONTAL )
j = teCenter;
-
- return DoInsertColumn( pos, property, title, editable, kDataBrowserCheckboxType, just, defaultWidth );
+
+ return DoInsertColumn( pos, property, title, editable, kDataBrowserCheckboxType, just, defaultWidth );
}
wxMacDataBrowserColumn* wxMacDataBrowserListControl::GetColumnFromProperty( DataBrowserPropertyID property)
for ( unsigned int i = 0; i < m_columns.size() ; ++ i )
if ( m_columns[i]->GetProperty() == property )
return m_columns[i];
-
+
return NULL;
}
RevealItem( item , kDataBrowserRevealWithoutSelecting );
}
-
-void wxMacDataBrowserListControl::UpdateLine( unsigned int n, wxListWidgetColumn* col )
+
+void wxMacDataBrowserListControl::UpdateLine( unsigned int n, wxListWidgetColumn* col )
{
wxMacDataBrowserColumn* dbcol = dynamic_cast<wxMacDataBrowserColumn*> (col);
wxMacDataItem * item = (wxMacDataItem*) GetItemFromLine( n );
UpdateItem(wxMacDataBrowserRootContainer, item, dbcol ? dbcol->GetProperty() : kDataBrowserNoItem );
}
-void wxMacDataBrowserListControl::UpdateLineToEnd( unsigned int n)
+void wxMacDataBrowserListControl::UpdateLineToEnd( unsigned int n)
{
// with databrowser inserting does not need updating the entire model, it's done by databrowser itself
wxMacDataItem * item = (wxMacDataItem*) GetItemFromLine( n );
SetDataBrowserItemDataText( m_data, (CFStringRef) cf);
}
-void wxMacDataBrowserCellValue::Set( int value )
+void wxMacDataBrowserCellValue::Set( int value )
{
SetDataBrowserItemDataValue( m_data, value );
- // SetDataBrowserItemDataButtonValue( m_data, value ? kThemeButtonOn : kThemeButtonOff);
}
-
-int wxMacDataBrowserCellValue::GetIntValue() const
+
+void wxMacDataBrowserCellValue::Check( bool check )
+{
+ SetDataBrowserItemDataButtonValue( m_data, check ? kThemeButtonOn : kThemeButtonOff);
+}
+
+int wxMacDataBrowserCellValue::GetIntValue() const
{
SInt32 value;
GetDataBrowserItemDataValue( m_data, &value );
return value;
}
-wxString wxMacDataBrowserCellValue::GetStringValue() const
+wxString wxMacDataBrowserCellValue::GetStringValue() const
{
CFStringRef value;
GetDataBrowserItemDataText ( m_data, &value );