X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/8907154c1a8a6882c6797d1f16393ddfb23e7f3a..998cee67927f551bbb1d79152b13c6df4ea3859b:/wxPython/contrib/gizmos/wxCode/src/treelistctrl.cpp diff --git a/wxPython/contrib/gizmos/wxCode/src/treelistctrl.cpp b/wxPython/contrib/gizmos/wxCode/src/treelistctrl.cpp index 1194a14750..3345ac6e5a 100644 --- a/wxPython/contrib/gizmos/wxCode/src/treelistctrl.cpp +++ b/wxPython/contrib/gizmos/wxCode/src/treelistctrl.cpp @@ -112,7 +112,7 @@ class wxTreeListHeaderWindow : public wxWindow { protected: wxTreeListMainWindow *m_owner; - wxCursor *m_currentCursor; + const wxCursor *m_currentCursor; wxCursor *m_resizeCursor; bool m_isDragging; @@ -1070,7 +1070,7 @@ void wxTreeListTextCtrl::OnKillFocus( wxFocusEvent &event ) // wxTreeListHeaderWindow //----------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxTreeListHeaderWindow,wxWindow); +IMPLEMENT_DYNAMIC_CLASS(wxTreeListHeaderWindow,wxWindow) BEGIN_EVENT_TABLE(wxTreeListHeaderWindow,wxWindow) EVT_ERASE_BACKGROUND (wxTreeListHeaderWindow::OnEraseBackground) @@ -1216,7 +1216,6 @@ void wxTreeListHeaderWindow::OnPaint( wxPaintEvent &WXUNUSED(event) ) dc.SetBackground(wxBrush(GetBackgroundColour())); dc.Clear(); - dc.BeginDrawing(); dc.SetFont( GetFont() ); dc.SetBackgroundMode(wxTRANSPARENT); @@ -1307,7 +1306,6 @@ void wxTreeListHeaderWindow::OnPaint( wxPaintEvent &WXUNUSED(event) ) } // Finish up by drawing the buffer to the real dc - dc.EndDrawing(); dc.SelectObject(wxNullBitmap); real_dc.DrawBitmap(buffer, 0, 0, false); } @@ -2459,7 +2457,7 @@ wxTreeItemId wxTreeListMainWindow::DoInsertItem(const wxTreeItemId& parentId, if ( data != NULL ) { - data->SetId((long)item); + data->SetId((void*)item); } parent->Insert( item, previous ); @@ -2496,7 +2494,7 @@ wxTreeItemId wxTreeListMainWindow::AddRoot(const wxString& text, #endif if ( data != NULL ) { - data->SetId((long)m_anchor); + data->SetId((void*)m_anchor); } if (!HasFlag(wxTR_MULTIPLE)) @@ -2571,7 +2569,7 @@ wxTreeItemId wxTreeListMainWindow::AppendItem(const wxTreeItemId& parentId, void wxTreeListMainWindow::SendDeleteEvent(wxTreeListItem *item) { wxTreeEvent event( wxEVT_COMMAND_TREE_DELETE_ITEM, m_owner->GetId() ); - event.SetItem((long) item); + event.SetItem((void*)item); event.SetEventObject( /*this*/m_owner ); m_owner->ProcessEvent( event ); } @@ -2648,7 +2646,7 @@ void wxTreeListMainWindow::Expand(const wxTreeItemId& itemId) return; wxTreeEvent event( wxEVT_COMMAND_TREE_ITEM_EXPANDING, m_owner->GetId() ); - event.SetItem( (long) item ); + event.SetItem( (void*)item ); event.SetEventObject( /*this*/m_owner ); if ( m_owner->ProcessEvent( event ) && !event.IsAllowed() ) @@ -2694,7 +2692,7 @@ void wxTreeListMainWindow::Collapse(const wxTreeItemId& itemId) return; wxTreeEvent event( wxEVT_COMMAND_TREE_ITEM_COLLAPSING, m_owner->GetId() ); - event.SetItem( (long) item ); + event.SetItem( (void*)item ); event.SetEventObject( /*this*/m_owner ); if ( m_owner->ProcessEvent( event ) && !event.IsAllowed() ) { @@ -2872,8 +2870,8 @@ void wxTreeListMainWindow::SelectItem(const wxTreeItemId& itemId, } wxTreeEvent event( wxEVT_COMMAND_TREE_SEL_CHANGING, m_owner->GetId() ); - event.SetItem( (long) item ); - event.SetOldItem( (long) m_current ); + event.SetItem( (void*)item ); + event.SetOldItem( (void*)m_current ); event.SetEventObject( /*this*/m_owner ); // TODO : Here we don't send any selection mode yet ! @@ -2928,11 +2926,11 @@ void wxTreeListMainWindow::SelectItem(const wxTreeItemId& itemId, void wxTreeListMainWindow::SelectAll(bool extended_select) { - wxCHECK_RET( GetWindowStyleFlag() & wxTR_MULTIPLE, wxT("invalid tree style") ); + wxCHECK_RET( GetWindowStyleFlag() & wxTR_MULTIPLE, wxT("invalid tree style, must have wxTR_MULTIPLE style to select all items") ); wxTreeEvent event( wxEVT_COMMAND_TREE_SEL_CHANGING, m_owner->GetId() ); event.SetItem( GetRootItem() ); - event.SetOldItem( (long) m_current ); + event.SetOldItem( (void*) m_current ); event.SetEventObject( /*this*/m_owner ); // TODO : Here we don't send any selection mode yet ! @@ -2956,6 +2954,7 @@ void wxTreeListMainWindow::SelectAll(bool extended_select) wxTreeItemId root = GetRootItem(); wxTreeListItem *first = (wxTreeListItem *)GetFirstChild (root, cookie).m_pItem; wxTreeListItem *last = (wxTreeListItem *)GetLastChild (GetRootItem()).m_pItem; + if (!first || !last) return; if (TagAllChildrenUntilLast (first, last, true)) return; TagNextChildren (first, last, true); @@ -3451,8 +3450,8 @@ void wxTreeListMainWindow::PaintLevel (wxTreeListItem *item, wxDC &dc, int total_width = m_owner->GetHeaderWindow()->GetWidth(); // if the background colour is white, choose a // contrasting color for the lines - dc.SetPen (*((GetBackgroundColour() == *wxWHITE)? - wxMEDIUM_GREY_PEN : wxWHITE_PEN)); + dc.SetPen(((GetBackgroundColour() == *wxWHITE) ? + wxSystemSettings::GetColour(wxSYS_COLOUR_3DLIGHT) : *wxWHITE_PEN)); dc.DrawLine(0, y_top, total_width, y_top); dc.DrawLine(0, y, total_width, y); } @@ -3797,7 +3796,7 @@ void wxTreeListMainWindow::OnChar( wxKeyEvent &event ) { wxTreeEvent event( wxEVT_COMMAND_TREE_ITEM_ACTIVATED, m_owner->GetId() ); - event.SetItem( (long) m_current); + event.SetItem( (void*) m_current); event.SetEventObject( /*this*/m_owner ); m_owner->GetEventHandler()->ProcessEvent( event ); } @@ -4068,7 +4067,7 @@ void wxTreeListMainWindow::Edit( const wxTreeItemId& item ) m_currentEdit = (wxTreeListItem*) item.m_pItem; wxTreeEvent te( wxEVT_COMMAND_TREE_BEGIN_LABEL_EDIT, m_owner->GetId() ); - te.SetItem( (long) m_currentEdit); + te.SetItem( (void*) m_currentEdit); te.SetEventObject( /*this*/m_owner ); m_owner->GetEventHandler()->ProcessEvent( te ); @@ -4109,7 +4108,7 @@ void wxTreeListMainWindow::OnRenameAccept() { // TODO if the validator fails this causes a crash wxTreeEvent le( wxEVT_COMMAND_TREE_END_LABEL_EDIT, m_owner->GetId() ); - le.SetItem( (long) m_currentEdit ); + le.SetItem( (void*)m_currentEdit ); le.SetEventObject( /*this*/m_owner ); le.SetLabel( m_renameRes ); m_owner->GetEventHandler()->ProcessEvent( le ); @@ -4219,7 +4218,7 @@ void wxTreeListMainWindow::OnMouse( wxMouseEvent &event ) : wxEVT_COMMAND_TREE_BEGIN_DRAG; wxTreeEvent nevent( command,/*ALB*/ m_owner->GetId() ); - nevent.SetItem( (long) m_current); + nevent.SetItem( (void*)m_current); nevent.SetEventObject(/*this*/m_owner); // ALB nevent.SetPoint(pt); @@ -4282,7 +4281,7 @@ void wxTreeListMainWindow::OnMouse( wxMouseEvent &event ) // generate the drag end event wxTreeEvent event(wxEVT_COMMAND_TREE_END_DRAG,/*ALB*/m_owner->GetId()); - event.SetItem( (long) item ); + event.SetItem( (void*)item ); event.SetPoint( wxPoint(x, y) ); event.SetEventObject(/*this*/m_owner); @@ -4310,7 +4309,7 @@ void wxTreeListMainWindow::OnMouse( wxMouseEvent &event ) SetFocus(); wxTreeEvent nevent(wxEVT_COMMAND_TREE_ITEM_RIGHT_CLICK, m_owner->GetId()); - nevent.SetItem( (long) item ); + nevent.SetItem( (void*)item ); int nx, ny; CalcScrolledPosition(x, y, &nx, &ny); nevent.SetPoint( wxPoint(nx, ny)); @@ -4377,7 +4376,7 @@ void wxTreeListMainWindow::OnMouse( wxMouseEvent &event ) // send activate event first wxTreeEvent nevent( wxEVT_COMMAND_TREE_ITEM_ACTIVATED, m_owner->GetId() ); - nevent.SetItem( (long) item ); + nevent.SetItem( (void*)item ); int nx, ny; CalcScrolledPosition(x, y, &nx, &ny); nevent.SetPoint( wxPoint(nx, ny) ); @@ -4625,7 +4624,7 @@ void wxTreeListMainWindow::SetFocus() // wxTreeListCtrl //----------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxTreeListCtrl, wxControl); +IMPLEMENT_DYNAMIC_CLASS(wxTreeListCtrl, wxControl) BEGIN_EVENT_TABLE(wxTreeListCtrl, wxControl) EVT_SIZE(wxTreeListCtrl::OnSize)