コード例 #1
0
BOOL COXTreeItem::SetFont(int nCol, CFont* pFont)
{
	if(nCol == 0)
	{
		if(pFont==NULL)
		{
			dwStateEx &= ~XTIS_HASFONT;
			return TRUE;
		}

		LOGFONT lf;
		if(!pFont->GetLogFont(&lf))
		{
			return FALSE;
		}
		if((HFONT)m_font!=NULL)
		{
			m_font.DeleteObject();
		}
		if(m_font.CreateFontIndirect(&lf))
		{
			dwStateEx |= XTIS_HASFONT;
			return TRUE;
		}
		return FALSE;
	}
	else
	{
		COXTreeSubItem *pSubItem = GetSubItem(nCol);
		if(!pSubItem)
			return FALSE;
		return pSubItem->SetFont(pFont);
	}
}
コード例 #2
0
ファイル: ItemList.cpp プロジェクト: sanyaade-webdev/wpub
BOOL CItemList::ModifySubItem(DWORD index, DWORD subitem, LPVOID data, HICON icon, DWORD type, DWORD flags )
{
	LPLISTSUBITEMINFO	sitem = GetSubItem( index, subitem );
	if ( sitem == NULL ) return FALSE;

	// Remove old data
	DeleteSubItemData( sitem );

	// Zero memory
//	ZeroMemory( sitem, sizeof( LISTSUBITEMINFO ) );

	// Save data
	sitem->type = type;
	sitem->flags = flags;
	sitem->icon = icon;

	switch( type )
	{
		case SIT_TEXT :
			sitem->data = new char[ strlen( (char*)data ) + 2 ];
			if ( sitem->data != NULL )
				strcpy( (char*)sitem->data, (char*)data );
			break;

		default:
			sitem->data = data;
			break;

	} // end switch

	return TRUE;
}
コード例 #3
0
void COXTreeItem::SetEditMode(UINT uMode,CStringArray& saTextEx,int nCol)
	{
	if(nCol == 0)
		{
		//set main item
		switch(uMode)
			{
			case OXET_EDIT:
			case OXET_NOEDIT:
			case OXET_COMBO:
			case OXET_CALENDAR:
				m_uEditMode = uMode;
				break;
			default:
				// Undefined edit mode found!
				ASSERT(FALSE);
				break;
			}
		m_saTextEx.RemoveAll();
		for(int i=0;i < saTextEx.GetSize();i++)
			m_saTextEx.SetAtGrow(i,saTextEx[i]);
		}
	else
		{
		COXTreeSubItem *pSubItem = GetSubItem(nCol);
		ASSERT(pSubItem);
		if(pSubItem)
			pSubItem->SetEditMode(uMode,saTextEx);
		}
	}
コード例 #4
0
BOOL COutlook2Ctrl::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)
{
	if (nHitTest == HTCLIENT)
	{
		CPoint point;
		::GetCursorPos (&point);
		ScreenToClient (&point);

		if (m_iDragging || m_dragRect.PtInRect(point)) 
		{
			SetCursor(hDragCur);
			return TRUE;
		}
		int f,i,s;
		int r = HitTest(f,i,s,point);
		if (r == 4)
		{
			COL2SubItem	* ps = GetSubItem(f,i,s);
			if (ps->dwStyle == 2) // item is hotlinked
			{
				SetCursor(hHandCur);
				return TRUE;
			}
		}
		if (r == 1)
		{
			SetCursor(hHandCur);
			return TRUE;
		}
	}

	return OLCTRL2_BASE_CLASS::OnSetCursor(pWnd, nHitTest, message);
}
コード例 #5
0
int COXTreeItem::GetSubItemImage(int nCol) const
{
	COXTreeSubItem *pSubItem = GetSubItem(nCol);
	if(pSubItem)
		return pSubItem->HasImage() ? pSubItem->nImage:-1;
	else
		return -1;
}
コード例 #6
0
LPCTSTR COXTreeItem::GetSubItemText(int nCol) const
{
	COXTreeSubItem *pSubItem = GetSubItem(nCol);
	if(pSubItem)
		return pSubItem->sItem;
	else
		return _T("");
}
コード例 #7
0
BOOL COXTreeItem::HasBackColor(int nCol) const
{
	if(!nCol)
		return (BOOL)(dwStateEx & XTIS_HASBGCOLOR);
	COXTreeSubItem *pSubItem = GetSubItem(nCol);
	if(!pSubItem)
		return FALSE;
	return pSubItem->HasBackColor();
}
コード例 #8
0
BOOL COXTreeItem::HasFont(int nCol) const
{
	if(!nCol)
		return (BOOL)(dwStateEx & XTIS_HASFONT);
	COXTreeSubItem *pSubItem = GetSubItem(nCol);
	if(!pSubItem)
		return FALSE;
	return pSubItem->HasFont();
}
コード例 #9
0
ファイル: ItemList.cpp プロジェクト: sanyaade-webdev/wpub
BOOL CItemList::SetSubItemFlags(DWORD index, DWORD subitem, DWORD flags )
{
	LPLISTSUBITEMINFO	plsii = GetSubItem( index, subitem );
	if ( plsii == NULL ) return FALSE;

	// Save data
	plsii->flags = flags;

	return TRUE;
}
コード例 #10
0
ファイル: ItemList.cpp プロジェクト: sanyaade-webdev/wpub
BOOL CItemList::SetSubItemBckColor(DWORD index, DWORD subitem, COLORREF rgb)
{
	LPLISTSUBITEMINFO	plsii = GetSubItem( index, subitem );
	if ( plsii == NULL ) return FALSE;

	// Save data
	plsii->rgbbck = rgb;

	return TRUE;
}
コード例 #11
0
ファイル: ItemList.cpp プロジェクト: sanyaade-webdev/wpub
BOOL CItemList::SetSubItemIcon(DWORD index, DWORD subitem, HICON icon)
{
	LPLISTSUBITEMINFO	plsii = GetSubItem( index, subitem );
	if ( plsii == NULL ) return FALSE;

	// Save data
	plsii->icon = icon;

	return TRUE;
}
コード例 #12
0
CStringArray& COXTreeItem::GetTextEx(int nCol)
{
	if(nCol == 0)
		return m_saTextEx;

	COXTreeSubItem *pSubItem = GetSubItem(nCol);
	ASSERT(pSubItem);

	return pSubItem->GetTextEx();
}
コード例 #13
0
UINT COXTreeItem::GetEditMode(int nCol) const
{
	if(nCol == 0)
		return m_uEditMode;
	COXTreeSubItem *pSubItem = GetSubItem(nCol);
	ASSERT(pSubItem);
	if(pSubItem)
		return pSubItem->GetEditMode();
	return 0;
}
コード例 #14
0
ファイル: ItemList.cpp プロジェクト: sanyaade-webdev/wpub
BOOL CItemList::SetSubItemData(DWORD item, DWORD subitem, DWORD data)
{
	// Get sub item
	LPLISTSUBITEMINFO plsii = GetSubItem( item, subitem );
	if ( plsii == NULL ) return FALSE;

	plsii->user = data;

	return TRUE;
}
コード例 #15
0
ファイル: ItemList.cpp プロジェクト: sanyaade-webdev/wpub
DWORD CItemList::FindString(DWORD dwCol, LPCTSTR pStr)
{
	for( DWORD i = 0; i < m_dwPtr; i++ )
	{
		LPLISTSUBITEMINFO plsii = GetSubItem( i, dwCol );
		if (	plsii != NULL && plsii->type == SIT_TEXT &&
				!strcmpi( (LPCTSTR)plsii->data, pStr ) ) return i;
	} // end for

	return MAXDWORD;
}
コード例 #16
0
void COXTreeItem::SetDrawEllipsis(UINT nEllipsisFormat, int nCol/*=0*/)
{
	ASSERT(nEllipsisFormat==DT_END_ELLIPSIS || nEllipsisFormat==DT_PATH_ELLIPSIS || 
		nEllipsisFormat==DT_WORD_ELLIPSIS);
	if(nCol==0)
		m_nEllipsisFormat = nEllipsisFormat;
	else
	{
		COXTreeSubItem *pSubItem = GetSubItem(nCol);
		ASSERT(pSubItem!=NULL);
		pSubItem->SetDrawEllipsis(nEllipsisFormat);
	}
}
コード例 #17
0
COLORREF COXTreeItem::GetItemBackColor(int nCol) const
{
	ASSERT(HasBackColor(nCol));
	if(!nCol)
		return m_clrBackground;
	COXTreeSubItem *pSubItem = GetSubItem(nCol);
	if(!pSubItem)
	{
		ASSERT(FALSE);
		return 0;
	}
	return pSubItem->m_clrBackground;
}
コード例 #18
0
UINT COXTreeItem::GetDrawEllipsis(int nCol/*=0*/) const
{
	if(nCol==0)
		return m_nEllipsisFormat;
	else
	{
		COXTreeSubItem *pSubItem = GetSubItem(nCol);
		if(pSubItem!=NULL)
			return pSubItem->GetDrawEllipsis();
		else
			return DT_END_ELLIPSIS;
	}
}
コード例 #19
0
HBREADCRUMBITEM CBCGPBreadcrumb::GetSubItemByName (HBREADCRUMBITEM hParentItem, const CString& itemName) const
{
	int n = GetSubItemsCount (hParentItem);
	for (int i = 0; i < n; ++i)
	{
		HBREADCRUMBITEM hSubItem = GetSubItem (hParentItem, i);
		if (GetItemText (hSubItem).CompareNoCase (itemName) == 0)
		{
			return hSubItem;
		}
	}
	return NULL;
}
コード例 #20
0
ファイル: ItemList.cpp プロジェクト: sanyaade-webdev/wpub
BOOL CItemList::GetSubItemData(DWORD item, DWORD subitem, LPDWORD pdwData)
{
	// Sanity check
	if ( pdwData == NULL ) return FALSE;

	// Get sub item
	LPLISTSUBITEMINFO plsii = GetSubItem( item, subitem );
	if ( plsii == NULL ) return FALSE;

	*pdwData = plsii->user;

	return TRUE;
}
コード例 #21
0
void COXTreeItem::SetTextEx(CStringArray& saText,int nCol)
	{
	if(nCol == 0)
		{
		m_saTextEx.RemoveAll();
		for(int i=0;i < saText.GetSize();i++)
			m_saTextEx.SetAtGrow(i,saText[i]);
		}
	else
		{
		COXTreeSubItem *pSubItem = GetSubItem(nCol);
		ASSERT(pSubItem);
		pSubItem->SetTextEx(saText);
		}
	}
コード例 #22
0
CFont* COXTreeItem::GetItemFont(int nCol)
{
	if(!HasFont(nCol))
		return NULL;
	if(!nCol)
	{
		return &m_font;
	}
	else
	{
		COXTreeSubItem *pSubItem = GetSubItem(nCol);
		if(!pSubItem)
			return NULL;
		return &(pSubItem->m_font);
	}
}
コード例 #23
0
ファイル: ItemList.cpp プロジェクト: sanyaade-webdev/wpub
BOOL CItemList::GetSubItemText(DWORD item, DWORD subitem, LPSTR buf, DWORD size)
{
	LPLISTSUBITEMINFO plsii = GetSubItem( item, subitem );
	if ( plsii == NULL ) return FALSE;

	// Is it in fact text?
	if ( plsii->type != SIT_TEXT ) return FALSE;

	// Copy text string
	strncpy( buf, (char*)plsii->data, size );

	// NULL terminate to be sure
	buf[ size - 1 ] = NULL;

	return TRUE;
}
コード例 #24
0
void COutlook2Ctrl::OnLButtonDown(UINT nFlags, CPoint point)
{
	
	if (m_iSize <= 4 || m_dragRect.PtInRect(point))
	{
		m_iDragoffset = m_iSize - point.x;

		m_iDragging = 1;
		SetCursor(hDragCur);
		SetCapture();
		SetFocus();
		CRect rc;
		GetClientRect(rc);
		OnInvertTracker(m_dragRect);
		return;
	}
	int f,i,s;
	int r = HitTest(f,i,s,point);
	if (r == 1)
	{
		SetCurFolder(f);
	}
	if (r == 4)
	{
		COL2SubItem	* ps = GetSubItem(f,i,s);
		if (ps->dwStyle == 2 || ps->dwStyle == 3) // item is hotlinked or checkbox
		{
			AfxGetMainWnd()->SendMessage(WM_COMMAND, MAKELONG(ps->lParam, 0), (LPARAM) GetSafeHwnd());
			InvalidateRect(rcInnerRect, FALSE);
		}
		if (ps->dwStyle == 0 || ps->dwStyle == 1) // item is radio or singlelist .. check before sending
		{
			COL2CCmdUI pui;
			pui.pSI = ps;
			pui.m_nID = ps->lParam; 
			AfxGetMainWnd()->OnCmdMsg(pui.m_nID, CN_UPDATE_COMMAND_UI, &pui, NULL);
			if (!(pui.iRes & 2)) // not checked yet .. so let's do it
				AfxGetMainWnd()->SendMessage(WM_COMMAND, MAKELONG(ps->lParam, 0), (LPARAM) GetSafeHwnd());
			InvalidateRect(rcInnerRect, FALSE);
		}
	}
	OLCTRL2_BASE_CLASS::OnLButtonDown(nFlags, point);
}
コード例 #25
0
BOOL COXTreeItem::SetSubItem(int nCol,UINT uMask,LPCTSTR lpszText,int nImage, 
							 CFont * pFont,COLORREF clr, COLORREF clrBack)
{
	if(nCol == -1 || nCol == 0)
	{
		ASSERT(FALSE);
		return FALSE;
	}
	COXTreeSubItem *pSubItem = GetSubItem(nCol);
	if(!pSubItem)
	{
		pSubItem = new COXTreeSubItem(nCol);
		m_Items.Add(pSubItem);
	}
	ASSERT(pSubItem);
	if(uMask & OX_SUBITEM_IMAGE)
	{
		pSubItem->nImage = nImage;
		pSubItem->uFlags |= OX_SUBITEM_IMAGE;
	}
	if(uMask & OX_SUBITEM_TEXT)
	{
		pSubItem->sItem = lpszText;
		pSubItem->uFlags |= OX_SUBITEM_TEXT;
	}
	if(uMask & OX_SUBITEM_FONT)
		pSubItem->SetFont(pFont);
	if(uMask & OX_SUBITEM_COLOR)
	{
		pSubItem->m_clr = clr;
		pSubItem->uFlags |= OX_SUBITEM_COLOR;
	}
	if(uMask & OX_SUBITEM_BGCOLOR)
	{
		pSubItem->m_clrBackground = clrBack;
		pSubItem->uFlags |= OX_SUBITEM_BGCOLOR;
	}
	return TRUE;
}
コード例 #26
0
void COutlook2Ctrl::OnMouseMove(UINT nFlags, CPoint point)
{
	if (m_iDragging == 1)
	{
		CRect rc1(m_dragRect);
		m_dragRect.SetRect(point.x-5 + m_iDragoffset, rc1.top, point.x + m_iDragoffset, rc1.bottom);
		if (rc1 != m_dragRect)
		{
			OnInvertTracker(rc1);
			OnInvertTracker(m_dragRect);
		}
	}
	else
	{
		int f,i,s;
		int r = HitTest(f,i,s,point);
		if (r == 1)
		{
			CClientDC dc(this); 
			if (iHiFolder >= 0 && iHiFolder != f)
			{
				DrawButton(&dc, (COL2Folder *) m_Folders.GetAt(iHiFolder), iHiFolder == m_iSelectedFolder, false);
			}
			if (iHiFolder != f)
			{
				iHiFolder = f;
				DrawButton(&dc, (COL2Folder *) m_Folders.GetAt(iHiFolder), iHiFolder == m_iSelectedFolder, true);
			}
		}
		if (r == 4)
		{
			COL2SubItem	* ps = GetSubItem(f,i,s);
			CClientDC dc(this); 
			if (pLastHilink && pLastHilink != ps)
			{
				DrawSubItem(&dc, GetFolder(iHilinkFolder), GetItem(iHilinkFolder, iHilinkItem), pLastHilink, false);
			}
			if (pLastHilink != ps)
			{
				pLastHilink = ps;
				DrawSubItem(&dc, GetFolder(f), GetItem(f,i), ps, true);
				iHilinkFolder = f;
				iHilinkItem = i;
			}
		}

		if (r == 0)
		{
			if (iHiFolder >= 0)
			{
				CClientDC dc(this); 
				DrawButton(&dc, (COL2Folder *) m_Folders.GetAt(iHiFolder), iHiFolder == m_iSelectedFolder, false);
				iHiFolder = -1;
			}
			if (pLastHilink != NULL)
			{
				CClientDC dc(this); 
				DrawSubItem(&dc, GetFolder(iHilinkFolder), GetItem(iHilinkFolder, iHilinkItem), pLastHilink, false);
				pLastHilink = NULL;
			}
		}
	}

	OLCTRL2_BASE_CLASS::OnMouseMove(nFlags, point);
}