示例#1
0
		void CScrollHelper::SetDisplaySize(int displayWidth, int displayHeight)
		{
			m_displaySize = CSize(displayWidth, displayHeight);

			if (m_attachWnd != nullptr && ::IsWindow(m_attachWnd->m_hWnd))
				UpdateScrollInfo();
		}
示例#2
0
BOOL COXHistoryCtrl::AppendToLine(CString string, 
								  BOOL bAddToLog/*=TRUE*/)
{
	//enter into a critical section
	EnterCriticalSection(&m_criticalSection);

	if(m_arrEntries.IsEmpty())
		return FALSE;

	//update the log file
	if(bAddToLog && m_bEnableLog)
		WriteToLog(string,FALSE);

	HISTORYENTRY entry=m_arrEntries.GetTail();
	entry.m_sText+=string;
	m_arrEntries.SetAt(m_arrEntries.GetTailPosition(),entry);

	int nLength=entry.m_sText.GetLength();
	if(m_nMaxLengthEntry<nLength)
	{
		m_nMaxLengthEntry=nLength;
		UpdateScrollInfo();
	}

	ScrollToEnd();
	RedrawWindow();

	//exit the critical section
	LeaveCriticalSection(&m_criticalSection);

	return TRUE;
}
示例#3
0
void ScrollBar::SetScrollInfo(int iVisual, int iLogic, bool bRepaint)
{
    UpdateScrollInfo(iVisual, iLogic, true);

    if (bRepaint)
    {
        InvalidateVisual();
    }
}
示例#4
0
BOOL COXHistoryCtrl::AddLine(CString string, BOOL bAddToLog/*=TRUE*/)
{
	//enter into a critical section
	EnterCriticalSection(&m_criticalSection);

	//update the log file
	if(bAddToLog && m_bEnableLog)
		WriteToLog(string,TRUE);

	BOOL bUpdateScroll=FALSE;

	ASSERT(m_arrEntries.GetCount()<=GetMaxNumEntries());

	HISTORYENTRY entry(string,m_clrText,m_clrBack,m_nOffset,m_nAlignment);
	m_arrEntries.AddTail(entry);
	
	if(m_arrEntries.GetCount()==GetMaxNumEntries()+1)
	{
		entry=m_arrEntries.RemoveHead();
		ASSERT(entry.m_sText.GetLength()<=m_nMaxLengthEntry);
		if(entry.m_sText.GetLength()==m_nMaxLengthEntry)
		{
			UpdateMaxLengthInfo();
			bUpdateScroll=TRUE;
		}
	}
	else
		bUpdateScroll=TRUE;

	int nLength=string.GetLength();
	if(m_nMaxLengthEntry<nLength)
	{
		m_nMaxLengthEntry=nLength;
		bUpdateScroll=TRUE;
	}

	if(bUpdateScroll)
		UpdateScrollInfo();

	ScrollToEnd();
	RedrawWindow();

	//exit the critical section
	LeaveCriticalSection(&m_criticalSection);

	return TRUE;
}
示例#5
0
BOOL COXHistoryCtrl::ClearHistory()
{
	//enter into a critical section
	EnterCriticalSection(&m_criticalSection);

	m_arrEntries.RemoveAll();

	//max line length
	m_nMaxLengthEntry=0;

	UpdateScrollInfo();
	RedrawWindow();

	//exit the critical section
	LeaveCriticalSection(&m_criticalSection);

	return TRUE;
}
示例#6
0
BOOL COXTabViewContainer::SetActivePageIndex(int nIndex)
{
	if(nIndex==m_nActivePageIndex)
	{
		return TRUE;
	}

	CWnd* pWndOld=GetActivePage();
	if(pWndOld!=NULL)
	{
		ASSERT(::IsWindow(pWndOld->m_hWnd));
		if(::IsWindow(pWndOld->m_hWnd))
		{
			UpdateScrollInfo();

			pWndOld->ShowWindow(SW_HIDE);
			PAGEINFO pi=m_arrPages[GetActivePageIndex()];
			m_nActivePageIndex=-1;
			UINT nBar=(pi.bHasScrollHorz&pi.bHasScrollVert ? SB_BOTH : 
				(pi.bHasScrollHorz ? SB_HORZ : 
				(pi.bHasScrollVert ? SB_VERT : 0)));
			if(nBar!=0)
			{
				pWndOld->ShowScrollBar(nBar,TRUE);
			}
		}
	}

	m_nActivePageIndex=nIndex;
	if(m_nActivePageIndex>=0 && m_nActivePageIndex<GetPageCount())
	{
		EnsureTabBtnVisible(m_nActivePageIndex);

		CWnd* pWnd=GetPage(m_nActivePageIndex);
		if(pWnd!=NULL)
		{
			ASSERT(::IsWindow(pWnd->m_hWnd));
			if(::IsWindow(pWnd->m_hWnd))
			{
				IniScrollInfo();

				pWnd->ShowWindow(SW_SHOW);
				CRect rect;
				pWnd->GetWindowRect(rect);
				if(rect.Width()!=m_rectPage.Width() || 
					rect.Height()!=m_rectPage.Height())
				{
					pWnd->MoveWindow(m_rectPage);
				}
				else
				{
					pWnd->SendMessage(WM_SIZE,SIZE_RESTORED,
						MAKELPARAM(rect.Width(),rect.Height()));
				}

				// set the focus to the page
				CFrameWnd* pFrameWnd=(CFrameWnd*)GetParent();
				ASSERT(pFrameWnd!=NULL);
				if(pFrameWnd->IsKindOf(RUNTIME_CLASS(CFrameWnd)))
				{
					if(pWnd->IsKindOf(RUNTIME_CLASS(CView)))
					{
						pFrameWnd->SetActiveView((CView*)pWnd);
					}
					else
					{
						if(pWndOld!=NULL && 
							pWndOld->IsKindOf(RUNTIME_CLASS(CView)))
						{
							pFrameWnd->SetActiveView(NULL);
						}
						pWnd->SetFocus();
					}
				}
				else
				{
					pWnd->SetFocus();
				}

				RedrawTabBtnArea();
			}
		}
	}
	else
		return FALSE;

	return TRUE;
}
void CSampleDialogScrollHelper::SetDisplaySize(int width, int height)
{
  m_display_size = CSize(width, height);
  if (m_pWnd && ::IsWindow(m_pWnd->m_hWnd))
    UpdateScrollInfo();
}
void CSampleDialogScrollHelper::OnSize(UINT nType, int cx, int cy)
{
  UpdateScrollInfo();
}
示例#9
0
 void SScrollText::SetWindowText(const SStringT & strText)
 {
     m_strText = strText;
     UpdateScrollInfo(GetClientRect().Size());//重新计算滚动长度
 }
示例#10
0
 void SScrollText::OnSize(UINT nType, CSize size)
 {
     __super::OnSize(nType,size);
     UpdateScrollInfo(size);
 }
示例#11
0
		void CScrollHelper::OnSize(UINT /*nType*/, int /*cx*/, int /*cy*/)
		{
			UpdateScrollInfo();
		}