void wxListHeaderData::GetItem( wxListItem& item )
{
- item.m_mask = m_mask;
- item.m_text = m_text;
- item.m_image = m_image;
- item.m_format = m_format;
- item.m_width = m_width;
- item.m_state = m_state;
+ long mask = item.m_mask;
+ if ( !mask )
+ {
+ // by default, get everything for backwards compatibility
+ mask = -1;
+ }
+
+ if ( mask & wxLIST_MASK_STATE )
+ item.m_state = m_state;
+ if ( mask & wxLIST_MASK_TEXT )
+ item.m_text = m_text;
+ if ( mask & wxLIST_MASK_IMAGE )
+ item.m_image = m_image;
+ if ( mask & wxLIST_MASK_WIDTH )
+ item.m_width = m_width;
+ if ( mask & wxLIST_MASK_FORMAT )
+ item.m_format = m_format;
}
int wxListHeaderData::GetImage() const
BEGIN_EVENT_TABLE(wxListHeaderWindow,wxWindow)
EVT_PAINT (wxListHeaderWindow::OnPaint)
EVT_MOUSE_EVENTS (wxListHeaderWindow::OnMouse)
- EVT_SET_FOCUS (wxListHeaderWindow::OnSetFocus)
END_EVENT_TABLE()
void wxListHeaderWindow::Init()
}
}
-void wxListHeaderWindow::OnSetFocus( wxFocusEvent &WXUNUSED(event) )
-{
- m_owner->SetFocus();
- m_owner->Update();
-}
-
bool wxListHeaderWindow::SendListEvent(wxEventType type, const wxPoint& pos)
{
wxWindow *parent = GetParent();
wxListMainWindow::wxListMainWindow( wxWindow *parent,
wxWindowID id,
const wxPoint& pos,
- const wxSize& size,
- long style,
- const wxString &name )
- : wxWindow( parent, id, pos, size, style, name )
+ const wxSize& size )
+ : wxWindow( parent, id, pos, size,
+ wxWANTS_CHARS | wxBORDER_NONE )
{
Init();
wxCHECK_MSG( (item >= 0) && ((size_t)item < GetItemCount()), NULL,
wxT("wrong index in wxGenericListCtrl::EditLabel()") );
- wxASSERT_MSG( textControlClass->IsKindOf(CLASSINFO(wxTextCtrl)),
+ wxASSERT_MSG( textControlClass->IsKindOf(wxCLASSINFO(wxTextCtrl)),
wxT("EditLabel() needs a text control") );
size_t itemEdit = (size_t)item;
if ( event.LeftDown() )
SetFocus();
- event.SetEventObject( GetParent() );
- if ( GetParent()->GetEventHandler()->ProcessEvent( event) )
+ // Pretend that the event happened in wxListCtrl itself.
+ wxMouseEvent me(event);
+ me.SetEventObject( GetParent() );
+ me.SetId(GetParent()->GetId());
+ if ( GetParent()->GetEventHandler()->ProcessEvent( me ))
return;
if (event.GetEventType() == wxEVT_MOUSEWHEEL)
int command = event.RightIsDown() ? wxEVT_COMMAND_LIST_BEGIN_RDRAG
: wxEVT_COMMAND_LIST_BEGIN_DRAG;
- wxListEvent le( command, GetParent()->GetId() );
- le.SetEventObject( GetParent() );
- le.m_item.m_itemId =
- le.m_itemIndex = m_lineLastClicked;
- le.m_pointDrag = m_dragStart;
- GetParent()->GetEventHandler()->ProcessEvent( le );
+ SendNotify( m_lineLastClicked, command, m_dragStart );
return;
}
// propagate the key event upwards
wxKeyEvent ke(event);
ke.SetEventObject( parent );
+ ke.SetId(GetParent()->GetId());
if (parent->GetEventHandler()->ProcessEvent( ke ))
return;
// propagate the key event upwards
wxKeyEvent ke(event);
+ ke.SetEventObject( parent );
+ ke.SetId(GetParent()->GetId());
if (parent->GetEventHandler()->ProcessEvent( ke ))
return;
// propagate the char event upwards
wxKeyEvent ke(event);
ke.SetEventObject( parent );
+ ke.SetId(GetParent()->GetId());
if (parent->GetEventHandler()->ProcessEvent( ke ))
return;
RefreshLines(id, GetItemCount() - 1);
}
-void wxListMainWindow::InsertColumn( long col, const wxListItem &item )
+long wxListMainWindow::InsertColumn( long col, const wxListItem &item )
{
+ long idx = -1;
+
m_dirty = true;
if ( InReportView() )
{
node = m_columns.Item( col );
m_columns.Insert( node, column );
m_aColWidths.Insert( colWidthInfo, col );
+ idx = col;
}
else
{
+ idx = m_aColWidths.GetCount();
m_columns.Append( column );
m_aColWidths.Add( colWidthInfo );
}
// invalidate it as it has to be recalculated
m_headerWidth = 0;
}
+ return idx;
}
int wxListMainWindow::GetItemWidthWithImage(wxListItem * item)
validator, name ) )
return false;
-#ifdef __WXGTK__
- style &= ~wxBORDER_MASK;
- style |= wxBORDER_THEME;
-#endif
-
- m_mainWin = new wxListMainWindow( this, wxID_ANY, wxPoint(0, 0), size, style );
+ m_mainWin = new wxListMainWindow(this, wxID_ANY, wxPoint(0, 0), size);
SetTargetWindow( m_mainWin );
{
wxCHECK_MSG( InReportView(), -1, wxT("can't add column in non report mode") );
- m_mainWin->InsertColumn( col, item );
+ long idx = m_mainWin->InsertColumn( col, item );
// NOTE: if wxLC_NO_HEADER was given, then we are in report view mode but
// still have m_headerWin==NULL
if (m_headerWin)
m_headerWin->Refresh();
- return 0;
+ return idx;
}
bool wxGenericListCtrl::ScrollList( int dx, int dy )
wxListCtrlBase::DoScreenToClient(x, y);
}
-void wxGenericListCtrl::SetFocus()
-{
- // The test in window.cpp fails as we are a composite
- // window, so it checks against "this", but not m_mainWin.
- if ( DoFindFocus() != this )
- m_mainWin->SetFocus();
-}
-
wxSize wxGenericListCtrl::DoGetBestClientSize() const
{
- // Something is better than nothing even if this is completely arbitrary.
- wxSize sizeBest(100, 80);
+ // The base class version can compute the best size in report view only.
+ wxSize sizeBest = wxListCtrlBase::DoGetBestClientSize();
if ( !InReportView() )
{