#pragma hdrstop
#endif
+#include "wx/window.h"
+#include "wx/msw/private.h"
+
#ifndef WX_PRECOMP
- #include "wx/wx.h"
+ #include "wx/settings.h"
+#endif
+
+// Mingw32 is a bit mental even though this is done in winundef
+#ifdef GetFirstChild
+#undef GetFirstChild
+#endif
+#ifdef GetNextSibling
+#undef GetNextSibling
#endif
#if defined(__WIN95__)
#include "wx/imaglist.h"
#include "wx/msw/treectrl.h"
-#include "wx/msw/private.h"
-
#ifdef __GNUWIN32__
#include "wx/msw/gnuwin32/extra.h"
#endif
#include <commctrl.h>
#endif
-#ifdef GetFirstChild
-#undef GetFirstChild
-#endif
-
-#ifdef GetNextChild
-#undef GetNextChild
-#endif
-
-#ifdef GetNextSibling
-#undef GetNextSibling
-#endif
-
-#ifdef GetClassInfo
-#undef GetClassInfo
-#endif
-
// Bug in headers, sometimes
#ifndef TVIS_FOCUSED
#define TVIS_FOCUSED 0x0001
(
exStyle,
WC_TREEVIEW,
- "",
+ _T(""),
wstyle,
pos.x, pos.y, size.x, size.y,
(HWND)parent->GetHWND(),
NULL
);
- wxCHECK_MSG( m_hWnd, FALSE, "Failed to create tree ctrl" );
+ wxCHECK_MSG( m_hWnd, FALSE, _T("Failed to create tree ctrl") );
if ( parent )
parent->AddChild(this);
wxString wxTreeCtrl::GetItemText(const wxTreeItemId& item) const
{
- char buf[512]; // the size is arbitrary...
+ wxChar buf[512]; // the size is arbitrary...
wxTreeViewItem tvItem(item, TVIF_TEXT);
tvItem.pszText = buf;
if ( !DoGetItem(&tvItem) )
{
// don't return some garbage which was on stack, but an empty string
- buf[0] = '\0';
+ buf[0] = _T('\0');
}
return wxString(buf);
void wxTreeCtrl::SetItemText(const wxTreeItemId& item, const wxString& text)
{
wxTreeViewItem tvItem(item, TVIF_TEXT);
- tvItem.pszText = (char *)text.c_str(); // conversion is ok
+ tvItem.pszText = (wxChar *)text.c_str(); // conversion is ok
DoSetItem(&tvItem);
}
wxTreeItemId wxTreeCtrl::GetNextVisible(const wxTreeItemId& item) const
{
- wxASSERT_MSG( IsVisible(item), "The item you call GetNextVisible() "
- "for must be visible itself!");
+ wxASSERT_MSG( IsVisible(item), _T("The item you call GetNextVisible() "
+ "for must be visible itself!"));
return wxTreeItemId((WXHTREEITEM) TreeView_GetNextVisible(wxhWnd, (HTREEITEM) (WXHTREEITEM) item));
}
wxTreeItemId wxTreeCtrl::GetPrevVisible(const wxTreeItemId& item) const
{
- wxASSERT_MSG( IsVisible(item), "The item you call GetPrevVisible() "
- "for must be visible itself!");
+ wxASSERT_MSG( IsVisible(item), _T("The item you call GetPrevVisible() "
+ "for must be visible itself!"));
return wxTreeItemId((WXHTREEITEM) TreeView_GetPrevVisible(wxhWnd, (HTREEITEM) (WXHTREEITEM) item));
}
if ( !text.IsEmpty() )
{
mask |= TVIF_TEXT;
- tvIns.item.pszText = (char *)text.c_str(); // cast is ok
+ tvIns.item.pszText = (wxChar *)text.c_str(); // cast is ok
}
if ( image != -1 )
void wxTreeCtrl::DoExpand(const wxTreeItemId& item, int flag)
{
- wxASSERT_MSG( flag == TVE_COLLAPSE || flag == TVE_COLLAPSERESET ||
- flag == TVE_EXPAND || flag == TVE_TOGGLE,
- "Unknown flag in wxTreeCtrl::DoExpand" );
+ wxASSERT_MSG( flag == TVE_COLLAPSE ||
+ flag == (TVE_COLLAPSE | TVE_COLLAPSERESET) ||
+ flag == TVE_EXPAND ||
+ flag == TVE_TOGGLE,
+ _T("Unknown flag in wxTreeCtrl::DoExpand") );
// TreeView_Expand doesn't send TVN_ITEMEXPAND(ING) messages, so we must
// emulate them
else
{
// I wonder if it really ever happens...
- wxLogDebug("TreeView_Expand: change didn't took place.");
+ wxLogDebug(_T("TreeView_Expand: change didn't took place."));
}
}
void wxTreeCtrl::CollapseAndReset(const wxTreeItemId& item)
{
- DoExpand(item, TVE_COLLAPSERESET);
+ DoExpand(item, TVE_COLLAPSE | TVE_COLLAPSERESET);
}
void wxTreeCtrl::Toggle(const wxTreeItemId& item)
HWND hWnd = (HWND) TreeView_EditLabel(wxhWnd, (HTREEITEM) (WXHTREEITEM) item);
- wxCHECK_MSG( hWnd, NULL, "Can't edit tree ctrl label" );
+ wxCHECK_MSG( hWnd, NULL, _T("Can't edit tree ctrl label") );
DeleteTextCtrl();
wxTreeItemData *pItem2,
wxTreeCtrl *tree)
{
+ wxCHECK_MSG( pItem1 && pItem2, 0,
+ _T("sorting tree without data doesn't make sense") );
+
return tree->OnCompareItems(pItem1->GetId(), pItem2->GetId());
}
int wxTreeCtrl::OnCompareItems(const wxTreeItemId& item1,
const wxTreeItemId& item2)
{
- return strcmp(GetItemText(item1), GetItemText(item2));
+ return wxStrcmp(GetItemText(item1), GetItemText(item2));
}
void wxTreeCtrl::SortChildren(const wxTreeItemId& item)
}
// process WM_NOTIFY Windows message
-bool wxTreeCtrl::MSWNotify(WXWPARAM wParam, WXLPARAM lParam, WXLPARAM *result)
+bool wxTreeCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
{
wxTreeEvent event(wxEVT_NULL, m_windowId);
wxEventType eventType = wxEVT_NULL;
break;
default:
- wxLogDebug("unexpected code %d in TVN_ITEMEXPAND "
- "message", tv->action);
+ wxLogDebug(_T("unexpected code %d in TVN_ITEMEXPAND "
+ "message"), tv->action);
}
bool ing = (hdr->code == TVN_ITEMEXPANDING);
}
default:
- return wxControl::MSWNotify(wParam, lParam, result);
+ return wxControl::MSWOnNotify(idCtrl, lParam, result);
}
event.SetEventObject(this);