delete m_data;
wxASSERT_MSG( m_children.IsEmpty(),
- _T("please call DeleteChildren() before deleting the item") );
+ wxT("please call DeleteChildren() before deleting the item") );
}
void wxGenericTreeItem::DeleteChildren(wxTreeCtrl *tree)
size_t wxTreeCtrl::GetChildrenCount(const wxTreeItemId& item, bool recursively)
{
- wxCHECK_MSG( item.IsOk(), 0u, _T("invalid tree item") );
+ wxCHECK_MSG( item.IsOk(), 0u, wxT("invalid tree item") );
return item.m_pItem->GetChildrenCount(recursively);
}
wxString wxTreeCtrl::GetItemText(const wxTreeItemId& item) const
{
- wxCHECK_MSG( item.IsOk(), _T(""), _T("invalid tree item") );
+ wxCHECK_MSG( item.IsOk(), wxT(""), wxT("invalid tree item") );
return item.m_pItem->GetText();
}
int wxTreeCtrl::GetItemImage(const wxTreeItemId& item,
wxTreeItemIcon which) const
{
- wxCHECK_MSG( item.IsOk(), -1, _T("invalid tree item") );
+ wxCHECK_MSG( item.IsOk(), -1, wxT("invalid tree item") );
return item.m_pItem->GetImage(which);
}
wxTreeItemData *wxTreeCtrl::GetItemData(const wxTreeItemId& item) const
{
- wxCHECK_MSG( item.IsOk(), NULL, _T("invalid tree item") );
+ wxCHECK_MSG( item.IsOk(), NULL, wxT("invalid tree item") );
return item.m_pItem->GetData();
}
void wxTreeCtrl::SetItemText(const wxTreeItemId& item, const wxString& text)
{
- wxCHECK_RET( item.IsOk(), _T("invalid tree item") );
+ wxCHECK_RET( item.IsOk(), wxT("invalid tree item") );
wxClientDC dc(this);
wxGenericTreeItem *pItem = item.m_pItem;
int image,
wxTreeItemIcon which)
{
- wxCHECK_RET( item.IsOk(), _T("invalid tree item") );
+ wxCHECK_RET( item.IsOk(), wxT("invalid tree item") );
wxGenericTreeItem *pItem = item.m_pItem;
pItem->SetImage(image, which);
void wxTreeCtrl::SetItemData(const wxTreeItemId& item, wxTreeItemData *data)
{
- wxCHECK_RET( item.IsOk(), _T("invalid tree item") );
+ wxCHECK_RET( item.IsOk(), wxT("invalid tree item") );
item.m_pItem->SetData(data);
}
void wxTreeCtrl::SetItemHasChildren(const wxTreeItemId& item, bool has)
{
- wxCHECK_RET( item.IsOk(), _T("invalid tree item") );
+ wxCHECK_RET( item.IsOk(), wxT("invalid tree item") );
wxGenericTreeItem *pItem = item.m_pItem;
pItem->SetHasPlus(has);
void wxTreeCtrl::SetItemBold(const wxTreeItemId& item, bool bold)
{
- wxCHECK_RET( item.IsOk(), _T("invalid tree item") );
+ wxCHECK_RET( item.IsOk(), wxT("invalid tree item") );
// avoid redrawing the tree if no real change
wxGenericTreeItem *pItem = item.m_pItem;
bool wxTreeCtrl::IsVisible(const wxTreeItemId& WXUNUSED(item)) const
{
- wxFAIL_MSG(_T("not implemented"));
+ wxFAIL_MSG(wxT("not implemented"));
return TRUE;
}
bool wxTreeCtrl::ItemHasChildren(const wxTreeItemId& item) const
{
- wxCHECK_MSG( item.IsOk(), FALSE, _T("invalid tree item") );
+ wxCHECK_MSG( item.IsOk(), FALSE, wxT("invalid tree item") );
return !item.m_pItem->GetChildren().IsEmpty();
}
bool wxTreeCtrl::IsExpanded(const wxTreeItemId& item) const
{
- wxCHECK_MSG( item.IsOk(), FALSE, _T("invalid tree item") );
+ wxCHECK_MSG( item.IsOk(), FALSE, wxT("invalid tree item") );
return item.m_pItem->IsExpanded();
}
bool wxTreeCtrl::IsSelected(const wxTreeItemId& item) const
{
- wxCHECK_MSG( item.IsOk(), FALSE, _T("invalid tree item") );
+ wxCHECK_MSG( item.IsOk(), FALSE, wxT("invalid tree item") );
return item.m_pItem->IsSelected();
}
bool wxTreeCtrl::IsBold(const wxTreeItemId& item) const
{
- wxCHECK_MSG( item.IsOk(), FALSE, _T("invalid tree item") );
+ wxCHECK_MSG( item.IsOk(), FALSE, wxT("invalid tree item") );
return item.m_pItem->IsBold();
}
wxTreeItemId wxTreeCtrl::GetParent(const wxTreeItemId& item) const
{
- wxCHECK_MSG( item.IsOk(), wxTreeItemId(), _T("invalid tree item") );
+ wxCHECK_MSG( item.IsOk(), wxTreeItemId(), wxT("invalid tree item") );
return item.m_pItem->GetParent();
}
wxTreeItemId wxTreeCtrl::GetFirstChild(const wxTreeItemId& item, long& cookie) const
{
- wxCHECK_MSG( item.IsOk(), wxTreeItemId(), _T("invalid tree item") );
+ wxCHECK_MSG( item.IsOk(), wxTreeItemId(), wxT("invalid tree item") );
cookie = 0;
return GetNextChild(item, cookie);
wxTreeItemId wxTreeCtrl::GetNextChild(const wxTreeItemId& item, long& cookie) const
{
- wxCHECK_MSG( item.IsOk(), wxTreeItemId(), _T("invalid tree item") );
+ wxCHECK_MSG( item.IsOk(), wxTreeItemId(), wxT("invalid tree item") );
wxArrayGenericTreeItems& children = item.m_pItem->GetChildren();
if ( (size_t)cookie < children.Count() )
wxTreeItemId wxTreeCtrl::GetLastChild(const wxTreeItemId& item) const
{
- wxCHECK_MSG( item.IsOk(), wxTreeItemId(), _T("invalid tree item") );
+ wxCHECK_MSG( item.IsOk(), wxTreeItemId(), wxT("invalid tree item") );
wxArrayGenericTreeItems& children = item.m_pItem->GetChildren();
return (children.IsEmpty() ? wxTreeItemId() : wxTreeItemId(children.Last()));
wxTreeItemId wxTreeCtrl::GetNextSibling(const wxTreeItemId& item) const
{
- wxCHECK_MSG( item.IsOk(), wxTreeItemId(), _T("invalid tree item") );
+ wxCHECK_MSG( item.IsOk(), wxTreeItemId(), wxT("invalid tree item") );
wxGenericTreeItem *i = item.m_pItem;
wxGenericTreeItem *parent = i->GetParent();
wxTreeItemId wxTreeCtrl::GetPrevSibling(const wxTreeItemId& item) const
{
- wxCHECK_MSG( item.IsOk(), wxTreeItemId(), _T("invalid tree item") );
+ wxCHECK_MSG( item.IsOk(), wxTreeItemId(), wxT("invalid tree item") );
wxGenericTreeItem *i = item.m_pItem;
wxGenericTreeItem *parent = i->GetParent();
wxTreeItemId wxTreeCtrl::GetFirstVisibleItem() const
{
- wxFAIL_MSG(_T("not implemented"));
+ wxFAIL_MSG(wxT("not implemented"));
return wxTreeItemId();
}
wxTreeItemId wxTreeCtrl::GetNextVisible(const wxTreeItemId& item) const
{
- wxCHECK_MSG( item.IsOk(), wxTreeItemId(), _T("invalid tree item") );
+ wxCHECK_MSG( item.IsOk(), wxTreeItemId(), wxT("invalid tree item") );
- wxFAIL_MSG(_T("not implemented"));
+ wxFAIL_MSG(wxT("not implemented"));
return wxTreeItemId();
}
wxTreeItemId wxTreeCtrl::GetPrevVisible(const wxTreeItemId& item) const
{
- wxCHECK_MSG( item.IsOk(), wxTreeItemId(), _T("invalid tree item") );
+ wxCHECK_MSG( item.IsOk(), wxTreeItemId(), wxT("invalid tree item") );
- wxFAIL_MSG(_T("not implemented"));
+ wxFAIL_MSG(wxT("not implemented"));
return wxTreeItemId();
}
int image, int selImage,
wxTreeItemData *data)
{
- wxCHECK_MSG( !m_anchor, wxTreeItemId(), _T("tree can have only one root") );
+ wxCHECK_MSG( !m_anchor, wxTreeItemId(), wxT("tree can have only one root") );
wxClientDC dc(this);
m_anchor = new wxGenericTreeItem((wxGenericTreeItem *)NULL, text, dc,
int index = parent->GetChildren().Index(idPrevious.m_pItem);
wxASSERT_MSG( index != wxNOT_FOUND,
- _T("previous item in wxTreeCtrl::InsertItem() is not a sibling") );
+ wxT("previous item in wxTreeCtrl::InsertItem() is not a sibling") );
return DoInsertItem(parentId, (size_t)++index, text, image, selImage, data);
}
wxTreeEvent event( wxEVT_COMMAND_TREE_ITEM_EXPANDING, GetId() );
event.m_item = item;
event.SetEventObject( this );
- if ( ProcessEvent( event ) && event.m_code )
+
+// if ( ProcessEvent( event ) && event.m_code ) TODO: Was this a typo ?
+ if ( ProcessEvent( event ) && !event.IsAllowed() )
{
// cancelled by program
return;
bool unselect_others,
bool extended_select)
{
- wxCHECK_RET( itemId.IsOk(), _T("invalid tree item") );
+ wxCHECK_RET( itemId.IsOk(), wxT("invalid tree item") );
bool is_single=!(GetWindowStyleFlag() & wxTR_MULTIPLE);
wxGenericTreeItem *item = itemId.m_pItem;
//wxCHECK_RET( ( (!unselect_others) && is_single),
- // _T("this is a single selection tree") );
+ // wxT("this is a single selection tree") );
// to keep going anyhow !!!
if (is_single)
static int tree_ctrl_compare_func(wxGenericTreeItem **item1,
wxGenericTreeItem **item2)
{
- wxCHECK_MSG( s_treeBeingSorted, 0, _T("bug in wxTreeCtrl::SortChildren()") );
+ wxCHECK_MSG( s_treeBeingSorted, 0, wxT("bug in wxTreeCtrl::SortChildren()") );
return s_treeBeingSorted->OnCompareItems(*item1, *item2);
}
void wxTreeCtrl::SortChildren(const wxTreeItemId& itemId)
{
- wxCHECK_RET( itemId.IsOk(), _T("invalid tree item") );
+ wxCHECK_RET( itemId.IsOk(), wxT("invalid tree item") );
wxGenericTreeItem *item = itemId.m_pItem;
wxCHECK_RET( !s_treeBeingSorted,
- _T("wxTreeCtrl::SortChildren is not reentrant") );
+ wxT("wxTreeCtrl::SortChildren is not reentrant") );
wxArrayGenericTreeItems& children = item->GetChildren();
if ( children.Count() > 1 )
}
else
{
- wxFAIL_MSG(_T("wxDC::GetFont() failed!"));
+ wxFAIL_MSG(wxT("wxDC::GetFont() failed!"));
}
}
void wxTreeCtrl::OnMouse( wxMouseEvent &event )
{
- if ( !(event.LeftUp() || event.LeftDClick() || event.Dragging()) ) return;
+ if ( !(event.LeftUp() || event.RightDown() || event.LeftDClick() || event.Dragging()) ) return;
if ( !m_anchor ) return;
if (item == NULL) return; /* we hit the blank area */
+ if (event.RightDown()) {
+ wxTreeEvent nevent(wxEVT_COMMAND_TREE_ITEM_RIGHT_CLICK,GetId());
+ nevent.m_item=item;
+ nevent.m_code=0;
+ nevent.SetEventObject(this);
+ GetEventHandler()->ProcessEvent(nevent);
+ return;
+ }
+
if (event.LeftUp() && (item == m_current) &&
(flags & wxTREE_HITTEST_ONITEMLABEL) &&
HasFlag(wxTR_EDIT_LABELS) )
}
else
{
- wxFAIL_MSG(_T("wxDC::GetFont() failed!"));
+ wxFAIL_MSG(wxT("wxDC::GetFont() failed!"));
}
}