X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/5c86a7fa9e1331a9d331a525ca39000c8d9a257f..cde242b856935bb368f4582d17db47ef2f875ad7:/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 f815aa8dab..6cded83c61 100644 --- a/wxPython/contrib/gizmos/wxCode/src/treelistctrl.cpp +++ b/wxPython/contrib/gizmos/wxCode/src/treelistctrl.cpp @@ -18,10 +18,6 @@ // headers // --------------------------------------------------------------------------- -#if defined(__GNUG__) && !defined(__APPLE__) - #pragma implementation "treelistctrl.h" -#endif - // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" @@ -1194,7 +1190,8 @@ void wxTreeListHeaderWindow::OnPaint( wxPaintEvent &WXUNUSED(event) ) if ((image != -1) && imageList) params.m_labelBitmap = imageList->GetBitmap(image); - wxRendererNative::Get().DrawHeaderButton(this, dc, rect, flags, ¶ms); + wxRendererNative::Get().DrawHeaderButton(this, dc, rect, flags, + wxHDR_SORT_ICON_NONE, ¶ms); } if (x < w) { @@ -1855,8 +1852,6 @@ bool wxTreeListMainWindow::Create (wxTreeListCtrl *parent, const wxString& name) { #ifdef __WXMAC__ - if (style & wxTR_HAS_BUTTONS) style |= wxTR_MAC_BUTTONS; - if (style & wxTR_HAS_BUTTONS) style &= ~wxTR_HAS_BUTTONS; style &= ~wxTR_LINES_AT_ROOT; style |= wxTR_NO_LINES; @@ -2674,7 +2669,7 @@ void wxTreeListMainWindow::SelectItem (const wxTreeItemId& itemId, } void wxTreeListMainWindow::SelectAll() { - wxCHECK_RET (HasFlag(wxTR_MULTIPLE), _T("invalid tree style")); + wxCHECK_RET (HasFlag(wxTR_MULTIPLE), _T("invalid tree style, must have wxTR_MULTIPLE style to select all items")); // send event to user code wxTreeEvent event (wxEVT_COMMAND_TREE_SEL_CHANGING, m_owner->GetId()); @@ -2695,6 +2690,7 @@ void wxTreeListMainWindow::SelectAll() { wxTreeItemId root = GetRootItem(); wxTreeListItem *first = (wxTreeListItem *)GetFirstChild (root, cookie).m_pItem; wxTreeListItem *last = (wxTreeListItem *)GetLastChild (root, cookie).m_pItem; + if (!first || !last) return; if (!TagAllChildrenUntilLast (first, last)) { TagNextChildren (first, last); } @@ -3025,24 +3021,34 @@ void wxTreeListMainWindow::PaintItem (wxTreeListItem *item, wxDC& dc) { #endif // !__WXMAC__ dc.SetTextForeground (colTextHilight); }else if (item->IsSelected()) { +#if defined(__WXGTK2__) || defined(__WXMAC__) + int flags = wxCONTROL_SELECTED; + if (m_hasFocus) + { + flags |= wxCONTROL_FOCUSED; +#ifdef __WXMAC__ + dc.SetTextForeground( *wxWHITE ); +#endif + } + wxRendererNative::GetDefault().DrawItemSelectionRect( m_owner, dc, wxRect( 0, item->GetY() + off_h, total_w, total_h - off_h ), flags); +#else if (!m_isDragging && m_hasFocus) { dc.SetBrush (*m_hilightBrush); -#ifndef __WXMAC__ // don't draw rect outline if we already have the background color dc.SetPen (*wxBLACK_PEN); -#endif // !__WXMAC__ }else{ dc.SetBrush (*m_hilightUnfocusedBrush); -#ifndef __WXMAC__ // don't draw rect outline if we already have the background color dc.SetPen (*wxTRANSPARENT_PEN); -#endif // !__WXMAC__ } dc.SetTextForeground (colTextHilight); +#endif // defined(__WXGTK2__) || defined(__WXMAC__) }else if (item == m_curItem) { dc.SetPen (m_hasFocus? *wxBLACK_PEN: *wxTRANSPARENT_PEN); }else{ dc.SetTextForeground (colText); } +#if !defined(__WXGTK2__) && !defined(__WXMAC__) dc.DrawRectangle (0, item->GetY() + off_h, total_w, total_h - off_h); +#endif }else{ dc.SetTextForeground (colText); } @@ -3103,24 +3109,34 @@ void wxTreeListMainWindow::PaintItem (wxTreeListItem *item, wxDC& dc) { #endif // !__WXMAC__ dc.SetTextForeground (colTextHilight); }else if (item->IsSelected()) { +#if defined(__WXGTK2__) || defined(__WXMAC__) + int flags = wxCONTROL_SELECTED; + if (m_hasFocus) + { + flags |= wxCONTROL_FOCUSED; +#ifdef __WXMAC__ + dc.SetTextForeground( *wxWHITE ); +#endif + } + wxRendererNative::GetDefault().DrawItemSelectionRect( m_owner, dc, wxRect( 0, item->GetY() + off_h, total_w, total_h - off_h ), flags); +#else if (!m_isDragging && m_hasFocus) { dc.SetBrush (*m_hilightBrush); -#ifndef __WXMAC__ // don't draw rect outline if we already have the background color dc.SetPen (*wxBLACK_PEN); -#endif // !__WXMAC__ }else{ dc.SetBrush (*m_hilightUnfocusedBrush); -#ifndef __WXMAC__ // don't draw rect outline if we already have the background color - dc.SetPen (*wxTRANSPARENT_PEN); -#endif // !__WXMAC__ + dc.SetPen (*wxTRANSPARENT_PEN); } dc.SetTextForeground (colTextHilight); +#endif // defined(__WXGTK2__) || defined(__WXMAC__) }else if (item == m_curItem) { dc.SetPen (m_hasFocus? *wxBLACK_PEN: *wxTRANSPARENT_PEN); }else{ dc.SetTextForeground (colText); } +#if !defined(__WXGTK2__) && !defined(__WXMAC__) dc.DrawRectangle (text_x, item->GetY() + off_h, text_w, total_h - off_h); +#endif }else{ dc.SetTextForeground (colText); } @@ -3794,6 +3810,7 @@ void wxTreeListMainWindow::OnMouse (wxMouseEvent &event) { #else nevent.SetItem (item); // the item the drag is ended #endif + nevent.SetPoint (p); nevent.Veto(); // dragging must be explicit allowed! m_owner->GetEventHandler()->ProcessEvent (nevent); @@ -4619,8 +4636,7 @@ void wxTreeListCtrl::ScrollTo(const wxTreeItemId& item) wxTreeItemId wxTreeListCtrl::HitTest(const wxPoint& pos, int& flags, int& column) { - wxPoint p = m_main_win->ScreenToClient (ClientToScreen (pos)); - return m_main_win->HitTest (p, flags, column); + return m_main_win->HitTest (pos, flags, column); } bool wxTreeListCtrl::GetBoundingRect(const wxTreeItemId& item, wxRect& rect,