29 #include "../../idlib/precompiled.h"
57 CTreeCtrl::PreSubclassWindow();
58 EnableToolTips(
TRUE );
71 HTREEITEM item, parentItem;
76 lastSlash = pathName.
Last(
'/' );
78 while( item && lastSlash > path.
Length() ) {
79 itemName = GetItemText( item );
80 tmpPath = path + itemName;
81 if ( pathName.
Icmpn( tmpPath, tmpPath.
Length() ) == 0 ) {
83 item = GetChildItem( item );
86 item = GetNextSiblingItem( item );
90 for ( item = GetChildItem( parentItem ); item; item = GetNextSiblingItem( item ) ) {
91 itemName = GetItemText( item );
92 if ( pathName.
Icmp( path + itemName ) == 0 ) {
111 HTREEITEM item, parentItem;
114 item = GetRootItem();
116 lastSlash = pathName.
Last(
'/' );
118 while( item && lastSlash > path.
Length() ) {
119 itemName = GetItemText( item );
120 tmpPath = path + itemName;
121 if ( pathName.
Icmpn( tmpPath, tmpPath.
Length() ) == 0 ) {
123 item = GetChildItem( item );
124 path = tmpPath +
"/";
126 item = GetNextSiblingItem( item );
130 while( lastSlash > path.
Length() ) {
132 tmpPath.
Left( tmpPath.
Find(
'/' ), itemName );
133 parentItem = InsertItem( itemName, parentItem );
134 path += itemName +
"/";
138 item = InsertItem( itemName, parentItem, TVI_SORT );
139 SetItemData( item,
id );
154 idStr itemName, tmpPath;
157 lastSlash = pathName.
Last(
'/' );
159 while( stack.
Num() > 1 ) {
168 tmpPath.
Left( tmpPath.
Find(
'/' ), itemName );
169 item = InsertItem( itemName, stack.
TopItem() );
170 stack.
Push( item, itemName );
174 item = InsertItem( itemName, stack.
TopItem() );
175 SetItemData( item,
id );
191 HTREEITEM item, child;
196 result.DeleteAllItems();
199 item = GetRootItem();
203 while( searchStack.
Num() > 0 ) {
205 for ( child = GetChildItem( item ); child; child = GetChildItem( child ) ) {
206 searchStack.
Push( item, GetItemText( item ) );
211 name += GetItemText( item );
212 id = GetItemData( item );
214 if ( compare( data, item, name ) ) {
219 for ( item = GetNextSiblingItem( item ); item ==
NULL; ) {
220 item = GetNextSiblingItem( searchStack.
TopItem() );
222 if ( searchStack.
Num() <= 0 ) {
233 ON_NOTIFY_EX_RANGE(TTN_NEEDTEXTW, 0, 0xFFFF, OnToolTipText)
234 ON_NOTIFY_EX_RANGE(TTN_NEEDTEXTA, 0, 0xFFFF, OnToolTipText)
248 HTREEITEM hitem = HitTest( point, &nFlags );
249 if( nFlags & TVHT_ONITEM ) {
250 GetItemRect( hitem, &rect,
TRUE );
252 pTI->uId = (
UINT)hitem;
253 pTI->lpszText = LPSTR_TEXTCALLBACK;
267 TOOLTIPTEXTA* pTTTA = (TOOLTIPTEXTA*)pNMHDR;
268 TOOLTIPTEXTW* pTTTW = (TOOLTIPTEXTW*)pNMHDR;
270 UINT nID = pNMHDR->idFrom;
275 if( nID == (
UINT)m_hWnd &&
276 (( pNMHDR->code == TTN_NEEDTEXTA && pTTTA->uFlags & TTF_IDISHWND ) ||
277 ( pNMHDR->code == TTN_NEEDTEXTW && pTTTW->uFlags & TTF_IDISHWND ) ) ) {
281 CString toolTip =
"?";
286 pMessage = GetCurrentMessage();
289 ScreenToClient( &pt );
293 HTREEITEM hitem = HitTest( pt, &nFlags );
295 if( nFlags & TVHT_ONITEM ) {
297 pTTTA->hdr.hwndFrom = GetSafeHwnd();
298 pTTTA->hdr.idFrom = (
UINT) hitem;
299 if (
GetParent()->SendMessage( WM_NOTIFY, ( TTN_NEEDTEXT << 16 ) | GetDlgCtrlID(), (
LPARAM)pTTTA ) ==
FALSE ) {
HTREEITEM FindItem(const idStr &pathName)
CONST PIXELFORMATDESCRIPTOR UINT
afx_msg BOOL OnToolTipText(UINT id, NMHDR *pNMHDR, LRESULT *pResult)
const char * Left(int len, idStr &result) const
bool(* treeItemCompare_t)(void *data, HTREEITEM item, const char *name)
int Icmp(const char *text) const
int Icmpn(const char *text, int n) const
void Push(HTREEITEM item, const char *name)
int SearchTree(treeItemCompare_t compare, void *data, CPathTreeCtrl &result)
GLsizei GLsizei GLenum GLenum const GLvoid * data
virtual void PreSubclassWindow()
int Find(const char c, int start=0, int end=-1) const
HTREEITEM InsertPathIntoTree(const idStr &pathName, const int id)
HTREEITEM AddPathToTree(const idStr &pathName, const int id, idPathTreeStack &stack)
const char * Mid(int start, int len, idStr &result) const
void PushRoot(HTREEITEM root)
MFnDagNode * GetParent(MFnDagNode *joint)
int Last(const char c) const
const char * TopName(void) const
int TopNameLength(void) const
HTREEITEM TopItem(void) const