private:
wxGenericTreeCtrl *m_owner;
- DECLARE_NO_COPY_CLASS(wxTreeRenameTimer)
+ wxDECLARE_NO_COPY_CLASS(wxTreeRenameTimer);
};
// control used for in-place edit
bool m_aboutToFinish;
DECLARE_EVENT_TABLE()
- DECLARE_NO_COPY_CLASS(wxTreeTextCtrl)
+ wxDECLARE_NO_COPY_CLASS(wxTreeTextCtrl);
};
// timer used to clear wxGenericTreeCtrl::m_findPrefix if no key was pressed
private:
wxGenericTreeCtrl *m_owner;
- DECLARE_NO_COPY_CLASS(wxTreeFindTimer)
+ wxDECLARE_NO_COPY_CLASS(wxTreeFindTimer);
};
// a tree item
unsigned int m_isBold :1; // render the label in bold font
unsigned int m_ownsAttr :1; // delete attribute when done
- DECLARE_NO_COPY_CLASS(wxGenericTreeItem)
+ wxDECLARE_NO_COPY_CLASS(wxGenericTreeItem);
};
// =============================================================================
m_lastOnSame = false;
#if defined( __WXMAC__ )
-#if wxOSX_USE_ATSU_TEXT
- m_normalFont.MacCreateFromThemeFont( kThemeViewsFont ) ;
-#else
- m_normalFont.MacCreateFromUIFont( kCTFontViewsFontType ) ;
-#endif
+ m_normalFont.CreateSystemFont(wxOSX_SYSTEM_FONT_VIEWS);
#else
m_normalFont = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
#endif
if (major < 10)
style |= wxTR_ROW_LINES;
+
+ if (style & wxTR_HAS_BUTTONS)
+ style |= wxTR_NO_LINES;
#endif // __WXMAC__
+#ifdef __WXGTK20__
+ if (style & wxTR_HAS_BUTTONS)
+ style |= wxTR_NO_LINES;
+#endif
+
if ( !wxControl::Create( parent, id, pos, size,
style|wxHSCROLL|wxVSCROLL,
validator,
}
wxGenericTreeItem *parent = item->GetParent();
+
+ // if the selected item will be deleted, select the parent ...
+ wxGenericTreeItem *to_be_selected = parent;
+ if (parent)
+ {
+ // .. unless there is a next sibling like wxMSW does it
+ int pos = parent->GetChildren().Index( item );
+ if ((int)(parent->GetChildren().GetCount()) > pos+1)
+ to_be_selected = parent->GetChildren().Item( pos+1 );
+ }
// don't keep stale pointers around!
if ( IsDescendantOf(item, m_key_current) )
// a different item, in idle time.
if ( m_select_me && IsDescendantOf(item, m_select_me) )
{
- m_select_me = parent;
+ m_select_me = to_be_selected;
}
if ( IsDescendantOf(item, m_current) )
// m_current = parent;
m_current = NULL;
- m_select_me = parent;
+ m_select_me = to_be_selected;
}
// remove the item from the tree
void wxGenericTreeCtrl::SelectItem(const wxTreeItemId& itemId, bool select)
{
+ wxGenericTreeItem * const item = (wxGenericTreeItem*) itemId.m_pItem;
+ wxCHECK_RET( item, wxT("SelectItem(): invalid tree item") );
+
if ( select )
{
- DoSelectItem(itemId, !HasFlag(wxTR_MULTIPLE));
+ if ( !item->IsSelected() )
+ DoSelectItem(itemId, !HasFlag(wxTR_MULTIPLE));
}
else // deselect
{
- wxGenericTreeItem *item = (wxGenericTreeItem*) itemId.m_pItem;
- wxCHECK_RET( item, wxT("SelectItem(): invalid tree item") );
-
wxTreeEvent event(wxEVT_COMMAND_TREE_SEL_CHANGING, this, item);
if ( GetEventHandler()->ProcessEvent( event ) && !event.IsAllowed() )
return;
#if defined(__WXMSW__) || defined(__WXMAC__) || defined(__WXGTK20__)
Update();
#else
+ // TODO: remove this call or use wxEventLoopBase::GetActive()->YieldFor(wxEVT_CATEGORY_UI)
+ // instead (needs to be tested!)
wxYieldIfNeeded();
#endif
}
SetCursor(m_oldCursor);
-#if defined( __WXMSW__ ) || defined(__WXMAC__)
+#if defined( __WXMSW__ ) || defined(__WXMAC__) || defined(__WXGTK20__)
Update();
#else
+ // TODO: remove this call or use wxEventLoopBase::GetActive()->YieldFor(wxEVT_CATEGORY_UI)
+ // instead (needs to be tested!)
wxYieldIfNeeded();
#endif
}