Пример #1
0
int CEnHeaderCtrl::GetNextVisibleItem(int nItem, BOOL bNext) const
{
	CIntArray aOrder;
	int nNumItems = GetItemOrder(aOrder);
	
	int nPos = GetItemPosition(nItem, aOrder);
	
	if (nPos != -1)
	{
		if (bNext)
		{
			while (++nPos < nNumItems)
			{
				nItem = OrderToIndex(nPos);

				if (IsItemVisible(nItem) && GetItemWidth(nItem))
					return nItem;
			}
		}
		else
		{
			while (nPos--)
			{
				nItem = OrderToIndex(nPos);
				
				if (IsItemVisible(nItem) && GetItemWidth(nItem))
					return nItem;
			}
		}
	}

	// outside range
	return -1;
}
Пример #2
0
int32_t CFX_ListCtrl::GetTopItem() const {
  int32_t nItemIndex = GetItemIndex(GetBTPoint());

  if (!IsItemVisible(nItemIndex) && IsItemVisible(nItemIndex + 1))
    nItemIndex += 1;

  return nItemIndex;
}
Пример #3
0
void COptionTree::EnsureVisible(COptionTreeItem *otiItem)
{
	// Declare variables
	COptionTreeItem* otiParent;
	CRect rcClient;
	CPoint ptPoint;
	long lOY;
	
	// Make sure valid
	if (otiItem == NULL)
	{
		return;
	}

	// Item is not scroll visible (expand all parents)
	if (IsItemVisible(otiItem) == FALSE)
	{
		otiParent = otiItem->GetParent();
		while (otiParent != NULL)
		{
			otiParent->Expand();
			
			otiParent = otiParent->GetParent();
		}

		UpdatedItems();
		UpdateWindow();
	}

	// Item should be visible
	if (IsItemVisible(otiItem) == FALSE)
	{
		return;
	}

	// Calculate list client rectangle
	m_otlList.GetClientRect(rcClient);
	rcClient.OffsetRect(0, m_ptOrigin.y);
	rcClient.bottom -= otiItem->GetHeight();

	// Get item location
	ptPoint = otiItem->GetLocation();
	//when the item is at the end will get a bug ,so avoid it
	ptPoint.y -= 2;
	if (!rcClient.PtInRect(ptPoint))
	{
		if (ptPoint.y < rcClient.top)
		{
			lOY = ptPoint.y;
		}
		else
		{
			lOY = ptPoint.y - rcClient.Height() + otiItem->GetHeight();
		}

		m_otlList.OnVScroll(SB_THUMBTRACK, lOY, NULL);
	}
}
Пример #4
0
void CInformationPanel::SetTheme(const TVTest::Theme::CThemeManager *pThemeManager)
{
	pThemeManager->GetStyle(TVTest::Theme::CThemeManager::STYLE_PANEL_CONTENT,
							&m_Theme.Style);
	pThemeManager->GetStyle(TVTest::Theme::CThemeManager::STYLE_INFORMATIONPANEL_EVENTINFO,
							&m_Theme.ProgramInfoStyle);
	pThemeManager->GetStyle(TVTest::Theme::CThemeManager::STYLE_INFORMATIONPANEL_BUTTON,
							&m_Theme.ButtonStyle);
	pThemeManager->GetStyle(TVTest::Theme::CThemeManager::STYLE_INFORMATIONPANEL_BUTTON_HOT,
							&m_Theme.ButtonHotStyle);

	if (m_hwnd!=NULL) {
		m_BackBrush.Create(m_Theme.Style.Back.Fill.GetSolidColor());
		m_ProgramInfoBackBrush.Create(m_Theme.ProgramInfoStyle.Back.Fill.GetSolidColor());

		Invalidate();

		if (m_hwndProgramInfo!=NULL) {
			if (m_fUseRichEdit) {
				::SendMessage(m_hwndProgramInfo,EM_SETBKGNDCOLOR,0,
							  (COLORREF)m_Theme.ProgramInfoStyle.Back.Fill.GetSolidColor());
				POINT ptScroll;
				::SendMessage(m_hwndProgramInfo,EM_GETSCROLLPOS,0,reinterpret_cast<LPARAM>(&ptScroll));
				UpdateProgramInfoText();
				::SendMessage(m_hwndProgramInfo,EM_SETSCROLLPOS,0,reinterpret_cast<LPARAM>(&ptScroll));
			}
			::InvalidateRect(m_hwndProgramInfo,NULL,TRUE);

			if (IsItemVisible(ITEM_PROGRAMINFO))
				SendSizeMessage();
		}
	}
}
Пример #5
0
void CEnHeaderCtrl::TraceVisibleToolTipRects(LPCTSTR szKey)
{
	TRACE(_T("CEnHeaderCtrl::TraceVisibleItemWidths(%s "), szKey);
	
	CIntArray aItems;
	int nNumItem = GetItemOrder(aItems);
	
	if (nNumItem)
	{
		for (int nItem = 0; nItem < nNumItem; nItem++)
		{
			if (IsItemVisible(aItems[nItem]))
			{
				CToolInfo ti;
				CRect rItem;

				if (m_tooltips.GetToolInfo(ti, this, (nItem + 1)) && GetItemRect(nItem, rItem))
				{
					TRACE(_T("\n   %s: item (%d, %d, %d, %d), tip (%d, %d, %d, %d)"), ti.szText,
							rItem.left, rItem.top, rItem.right, rItem.bottom,
							ti.rect.left, ti.rect.top, ti.rect.right, ti.rect.bottom);
				}
			}
		}
	}
	else
	{
		TRACE(_T("empty"));
	}
	
	TRACE(_T(")\n"));
}
Пример #6
0
// -----------------------------------------------------
// Override QWidget
// -----------------------------------------------------
void ReImagePanel::paintEvent( QPaintEvent* _event )
{
	QPainter painter( this );

	TItemListCItor itor = m_itemList.begin();
	TItemListCItor itorEnd = m_itemList.end();
		
	for( ; itor != itorEnd; ++itor )
	{
		const ReImageItem* item = *itor;
		if( NULL != item )
		{
			if( IsItemVisible( item ) )
			{
				QRect rect;
				rect.setLeft( m_contentOrigin.x() + item->m_pos.x() );
				rect.setRight( rect.left() + m_currentItemSize );
				rect.setTop( m_contentOrigin.y() + item->m_pos.y() );
				rect.setBottom( rect.top() + m_currentItemSize );
				painter.drawImage( rect, *item->m_image );
			}
		}
	}

	// Debug.
	//painter.setPen( QColor( 255, 255, 255 ) );
	//QSize bv = GetBv();
	//painter.drawRect( m_contentOrigin.x(), m_contentOrigin.y(), bv.width(), bv.height() );
}
Пример #7
0
void CFX_ListCtrl::OnMouseMove(const CPDF_Point & point,FX_BOOL bShift,FX_BOOL bCtrl)
{
	int32_t nHitIndex = GetItemIndex(point);

	if (IsMultipleSel())
	{
		if (bCtrl)
		{
			if (m_bCtrlSel)
				m_aSelItems.Add(m_nFootIndex,nHitIndex);
			else
				m_aSelItems.Sub(m_nFootIndex,nHitIndex);

			SelectItems();
		}
		else
		{
			m_aSelItems.DeselectAll();
			m_aSelItems.Add(m_nFootIndex,nHitIndex);
			SelectItems();
		}

		SetCaret(nHitIndex);
	}
	else
	{
		SetSingleSelect(nHitIndex);
	}

	if (!IsItemVisible(nHitIndex))
		ScrollToListItem(nHitIndex);
}
Пример #8
0
void CFX_ListCtrl::OnVK(int32_t nItemIndex,FX_BOOL bShift,FX_BOOL bCtrl)
{
	if (IsMultipleSel())
	{
		if (nItemIndex >= 0 && nItemIndex < GetCount())
		{
			if (bCtrl)
			{
			}
			else if (bShift)
			{
				m_aSelItems.DeselectAll();
				m_aSelItems.Add(m_nFootIndex,nItemIndex);
				SelectItems();
			}
			else
			{
				m_aSelItems.DeselectAll();
				m_aSelItems.Add(nItemIndex);
				SelectItems();
				m_nFootIndex = nItemIndex;
			}

			SetCaret(nItemIndex);
		}
	}
	else
	{
		SetSingleSelect(nItemIndex);
	}

	if (!IsItemVisible(nItemIndex))
		ScrollToListItem(nItemIndex);
}
Пример #9
0
void CInformationPanel::OnCommand(HWND hwnd,int id,HWND hwndCtl,UINT codeNotify)
{
	switch (id) {
	case CM_PROGRAMINFOPREV:
	case CM_PROGRAMINFONEXT:
		{
			bool fNext=id==CM_PROGRAMINFONEXT;
			CProgramInfoItem *pItem=
				static_cast<CProgramInfoItem*>(GetItem(ITEM_PROGRAMINFO));

			if (fNext!=pItem->IsNext()) {
				pItem->SetNext(fNext);
				RedrawButton(BUTTON_PROGRAMINFOPREV);
				RedrawButton(BUTTON_PROGRAMINFONEXT);
			}
		}
		return;

	default:
		if (id>=CM_INFORMATIONPANEL_ITEM_FIRST
				&& id<CM_INFORMATIONPANEL_ITEM_FIRST+NUM_ITEMS) {
			int Item=id-CM_INFORMATIONPANEL_ITEM_FIRST;

			SetItemVisible(Item,!IsItemVisible(Item));
			return;
		}
	}
}
Пример #10
0
void CHgzListCtrl::HoldOnEditing()
{
	m_edit.m_bEndEdit = FALSE;
	if (m_bEditing) {
		if (IsItemVisible(m_nItem)) {
			CRect rect;
			if( GetSubItemRect(m_nItem, m_nSubItem, LVIR_LABEL, rect)==FALSE )
				return;
			m_edit.MoveWindow(&rect);
			m_edit.RedrawWindow();
			if (m_edit.m_bEditingAndOutOfView) {
				m_edit.m_bEditingAndOutOfView = FALSE;
				m_edit.SetWindowText(m_edit.m_TempStr);
				m_edit.m_TempStr.Empty();
				m_edit.ShowWindow(SW_SHOW);
				m_edit.SetFocus();
				m_edit.SetActiveWindow();
				m_edit.CreateSolidCaret(1, rect.Height());
				m_edit.SetSel(m_edit.m_nStartChar, m_edit.m_nEndChar);
				m_edit.ShowCaret();
			}
			m_edit.m_bEndEdit = TRUE;
		}
		else {
			m_edit.GetWindowText(m_edit.m_TempStr);
			m_edit.GetSel(m_edit.m_nStartChar, m_edit.m_nEndChar);
			m_edit.m_bEditingAndOutOfView = TRUE;
			m_edit.ShowWindow(SW_HIDE);
		}
	}
}
Пример #11
0
void CInformationPanel::RedrawButton(ItemButtonNumber Button)
{
	if (Button.IsValid() && IsItemVisible(Button.Item)) {
		RECT rc;
		if (m_ItemList[Button.Item]->GetButtonRect(Button.Button,&rc))
			Invalidate(&rc);
	}
}
Пример #12
0
bool CInformationPanel::GetDrawItemRect(int Item,RECT *pRect,const RECT &PaintRect) const
{
	if (!IsItemVisible(Item))
		return false;
	GetItemRect(Item,pRect);
	pRect->bottom+=m_Style.LineSpacing;
	return ::IsRectIntersect(&PaintRect,pRect)!=FALSE;
}
Пример #13
0
void CEGPropertyGrid::EnsureVisible(CEGPropertyGridItem* pItem)
{
	if (!pItem)
		return;

	// item is not scroll visible (expand all parents)
	if (!IsItemVisible(pItem))
	{
		CEGPropertyGridItem* pParent;

		pParent = pItem->GetParent();
		while (pParent)
		{
			pParent->Expand();
			pParent = pParent->GetParent();
		}

		UpdatedItems();
		UpdateWindow();
	}

	ASSERT(IsItemVisible(pItem));

	CRect rc;

	m_List.GetClientRect(rc);
	rc.OffsetRect(0, m_Origin.y);
	rc.bottom -= pItem->GetHeight();

	CPoint pt;

	pt = pItem->GetLocation();

	if (!rc.PtInRect(pt))
	{
		LONG oy;

		if (pt.y < rc.top)
			oy = pt.y;
		else
			oy = pt.y - rc.Height() + pItem->GetHeight();

		m_List.OnVScroll(SB_THUMBTRACK, oy, NULL);
	}
}
Пример #14
0
void CInformationPanel::RedrawItem(int Item)
{
	if (m_hwnd!=NULL && IsItemVisible(Item)) {
		RECT rc;

		GetItemRect(Item,&rc);
		Invalidate(&rc);
	}
}
Пример #15
0
void CInformationPanel::OnCommand(HWND hwnd,int id,HWND hwndCtl,UINT codeNotify)
{
	if (id>=CM_INFORMATIONPANEL_ITEM_FIRST
			&& id<CM_INFORMATIONPANEL_ITEM_FIRST+NUM_ITEMS) {
		int Item=id-CM_INFORMATIONPANEL_ITEM_FIRST;

		SetItemVisible(Item,!IsItemVisible(Item));
		return;
	}
}
Пример #16
0
/**
	Renders all visible items.
*/
void AlbumView::DrawOffscreen(BView *view, BRect update)
{
	view->SetScale(fZoom);
	AlbumItem *item;
	for (int i = 0; (item = ItemAt(i)); i++) {
 			if (IsItemVisible(item) && update.Intersects(Adjust(item->Frame()))) {
				item->DrawItem(view);
 			}
	}
}
Пример #17
0
void CInformationPanel::GetItemRect(int Item,RECT *pRect) const
{
	int VisibleItemCount;

	GetClientRect(pRect);
	VisibleItemCount=0;
	for (int i=0;i<Item;i++) {
		if (IsItemVisible(i))
			VisibleItemCount++;
	}
	pRect->top=(m_FontHeight+m_Style.LineSpacing)*VisibleItemCount;
	if (!IsItemVisible(Item)) {
		pRect->bottom=pRect->top;
	} else {
		if (Item==ITEM_PROGRAMINFO)
			pRect->bottom-=m_Style.ButtonSize.Height;
		if (Item!=ITEM_PROGRAMINFO || pRect->top>=pRect->bottom)
			pRect->bottom=pRect->top+m_FontHeight;
	}
}
Пример #18
0
void CInformationPanel::Draw(HDC hdc,const RECT &PaintRect)
{
	HDC hdcDst;
	RECT rc;
//	TCHAR szText[256];

	GetClientRect(&rc);
	if (rc.right>m_Offscreen.GetWidth()
			|| m_FontHeight+m_Style.LineSpacing>m_Offscreen.GetHeight())
		m_Offscreen.Create(rc.right,m_FontHeight+m_Style.LineSpacing);
	hdcDst=m_Offscreen.GetDC();
	if (hdcDst==NULL)
		hdcDst=hdc;

	HFONT hfontOld=DrawUtil::SelectObject(hdcDst,m_Font);
	COLORREF crOldTextColor=::SetTextColor(hdcDst,m_Theme.Style.Fore.Fill.GetSolidColor());
	int OldBkMode=::SetBkMode(hdcDst,TRANSPARENT);

	for (int i=0;i<ITEM_PROGRAMINFO;i++) {
		if (GetDrawItemRect(i,&rc,PaintRect))
			m_ItemList[i]->Draw(hdc,rc);
	}

	GetItemRect(ITEM_PROGRAMINFO-1,&rc);
	if (PaintRect.bottom>rc.bottom) {
		rc.left=PaintRect.left;
		rc.top=max(PaintRect.top,rc.bottom);
		rc.right=PaintRect.right;
		rc.bottom=PaintRect.bottom;
		::FillRect(hdc,&rc,m_BackBrush.GetHandle());
	}

	if (IsItemVisible(ITEM_PROGRAMINFO)) {
		if (m_Theme.ProgramInfoStyle.Back.Border.Type!=TVTest::Theme::BORDER_NONE) {
			GetItemRect(ITEM_PROGRAMINFO,&rc);
			TVTest::Theme::Draw(hdc,rc,m_Theme.ProgramInfoStyle.Back.Border);
		}

		GetButtonRect(BUTTON_PROGRAMINFOPREV,&rc);
		DrawProgramInfoPrevNextButton(
			hdc,rc,false,IsButtonEnabled(BUTTON_PROGRAMINFOPREV),
			m_HotButton==BUTTON_PROGRAMINFOPREV);
		GetButtonRect(BUTTON_PROGRAMINFONEXT,&rc);
		DrawProgramInfoPrevNextButton(
			hdc,rc,true,IsButtonEnabled(BUTTON_PROGRAMINFONEXT),
			m_HotButton==BUTTON_PROGRAMINFONEXT);
	}

	::SetBkMode(hdcDst,OldBkMode);
	::SetTextColor(hdcDst,crOldTextColor);
	::SelectObject(hdcDst,hfontOld);
}
void CBeikeSafeInstallKavEngineDlg::OnBkBtnCancel()
{
    if (IsItemEnable(IDC_BTN_INSAVE_CANCEL) && IsItemVisible(IDC_BTN_INSAVE_CANCEL, TRUE))
    {
        m_bCancel = TRUE;

        EnableItem(IDC_BTN_INSAVE_CANCEL, FALSE);
    }
    else
    {
        EndDialog(IDOK);
    }
}
Пример #20
0
/**
	Adds or removes items from the selection.
	Returns number of changes.
*/
int32 AlbumView::Select(int32 index, int32 count, bool enabled)
{
	int32 n = 0;
	for (int i = index; i < index + count ;i++) {
		AlbumItem *item = ItemAt(i);
		if (IsItemVisible(item) && item->IsSelected() != enabled) {
			item->Select(enabled);
			InvalidateItem(item);
			n++;	
		}
	}
	return n;
}
Пример #21
0
/**
	First item containing point.
*/
int32 AlbumView::IndexOf(BPoint *p)
{
	if (p == NULL)
		return -1;
		
	AlbumItem *item;
	for (int32 i = 0; (item = ItemAt(i)); i++) {
		if (!IsItemVisible(item) || !item->Frame().Contains(*p))
			continue;
		return i;
	}	
	return -1;
}
Пример #22
0
void CInformationPanel::RedrawItem(int Item)
{
	if (m_hwnd!=NULL && IsItemVisible(Item)) {
		RECT rc;

		GetItemRect(Item,&rc);
		if (Item==ITEM_PROGRAMINFO) {
			RECT rcClient;
			GetClientRect(&rcClient);
			rc.bottom=rcClient.bottom;
		}
		Invalidate(&rc);
	}
}
Пример #23
0
bool CInformationPanel::GetButtonRect(int Button,RECT *pRect) const
{
	RECT rc;

	GetItemRect(ITEM_PROGRAMINFO,&rc);
	pRect->left=rc.right-m_Style.ButtonSize.Width*(2-Button);
	pRect->right=pRect->left+m_Style.ButtonSize.Width;
	pRect->top=rc.bottom;
	if (!IsItemVisible(ITEM_PROGRAMINFO)) {
		pRect->bottom=rc.bottom;
		return false;
	}
	pRect->bottom=rc.bottom+m_Style.ButtonSize.Height;

	return true;
}
Пример #24
0
int CEnHeaderCtrl::GetLastVisibleItem() const
{
	CIntArray aOrder;
	int nOrder = GetItemOrder(aOrder);

	while (nOrder--)
	{
		int nItem = aOrder[nOrder];

		if (IsItemVisible(nItem) && GetItemWidth(nItem))
			return nItem;
	}

	// all hidden
	return -1;
}
Пример #25
0
int CEnHeaderCtrl::GetFirstVisibleItem() const
{
	CIntArray aItems;
	int nNumItem = GetItemOrder(aItems);
	
	for (int nOrder = 0; nOrder < nNumItem; nOrder++)
	{
		int nItem = aItems[nOrder];

		if (IsItemVisible(nItem) && GetItemWidth(nItem))
			return nItem;
	}
	
	// all hidden
	return -1;
}
Пример #26
0
/**
	Lays out items one after another.
*/
void AlbumView::Arrange(bool invalidate)
{
	// scale back the page relative to zoom ratio
	BRect bounds = Bounds();
	bounds.left /= fZoom;
	bounds.top /= fZoom;
	bounds.right /= fZoom;
	bounds.bottom /= fZoom;
	FlowLayout layout(bounds.OffsetToCopy(0,0), fColumns);
	layout.SetSpacing(1,1);
	// The entire set must be examined.
	float width = 0;
	float height = 0;
	AlbumItem *item;
	for (int32 i = 0; (item = ItemAt(i)); i++) {
		if (!IsItemVisible(item))
			continue;
		BRect frame0 = item->Frame();
		// separator
		uint32 hint = item->Flags() & ALBUMITEM_SEPARATOR ? LAYOUT_HINT_BREAK : 0;
		BRect frame = layout.Next(frame0, hint);
		if (hint == LAYOUT_HINT_BREAK) {
			// shift the last frame, so we get a gap in the layout
			layout.Last().OffsetBy(0,fSeparatorHeight);
			frame = layout.Last();
		}
		if (frame != frame0) {
			// rects outside the bounds are new
			if (invalidate && bounds.Intersects(frame0) && frame0.left >= 0) {
				// clear the old rect
				Invalidate(Adjust(frame0));				
			}
			// reposition to the new location
			item->SetFrame(frame);
			if (invalidate && bounds.Intersects(frame))  {
				// show on the new location
				Invalidate(Adjust(frame));
			}
		}
		if (frame.right > width)
			width = frame.right;
		if (frame.bottom > height)
			height = frame.bottom;
	}
	SetPageBounds(BRect(0,0,width,height));
}
Пример #27
0
CInformationPanel::ItemButtonNumber CInformationPanel::ButtonHitTest(int x,int y) const
{
	ItemButtonNumber ItemButton;

	for (int i=0;i<NUM_ITEMS;i++) {
		if (IsItemVisible(i)) {
			const CItem *pItem=m_ItemList[i];
			int Button=pItem->ButtonHitTest(x,y);
			if (Button>=0 && pItem->IsButtonEnabled(Button)) {
				ItemButton.Item=i;
				ItemButton.Button=Button;
				break;
			}
		}
	}

	return ItemButton;
}
Пример #28
0
bool CInformationPanel::SetProgramInfoRichEdit(bool fRichEdit)
{
	if (fRichEdit!=m_fUseRichEdit) {
		if (m_hwndProgramInfo!=NULL) {
			::DestroyWindow(m_hwndProgramInfo);
			m_hwndProgramInfo=NULL;
		}
		m_fUseRichEdit=fRichEdit;
		if (m_hwnd!=NULL) {
			CreateProgramInfoEdit();
			SendSizeMessage();
			if (IsItemVisible(ITEM_PROGRAMINFO))
				::ShowWindow(m_hwndProgramInfo,SW_SHOW);
		}
	}

	return true;
}
Пример #29
0
void PropertyTree::EnsureVisible(PropertyTreeItem* pItem)
{
    if (!pItem)
        return;

    // item is not scroll visible (expand all parents)
    if (!IsItemVisible(pItem))
    {
        PropertyTreeItem* pParent;

        pParent = pItem->GetParent();
        while (pParent)
        {
            pParent->Expand();
            pParent = pParent->GetParent();
        }

        UpdatedItems();
        UpdateWindow();
    }

    CRect rc;

    GetClientRect(rc);
    rc.OffsetRect(0, m_ScrollPos);
    rc.bottom -= pItem->GetHeight();

    CPoint pt;

    pt = pItem->GetLocation();

    if (!rc.PtInRect(pt))
    {
        LONG oy;

        //if (pt.y < rc.top)
            oy = pt.y;
        //else
        //	oy = pt.y - rc.Height() + pItem->GetHeight();

        OnVScroll(SB_THUMBTRACK, oy, NULL);
    }
}
Пример #30
0
bool CInformationPanel::SetItemVisible(int Item,bool fVisible)
{
	CItem *pItem=GetItem(Item);

	if (pItem==NULL)
		return false;

	if (pItem->IsVisible()!=fVisible) {
		pItem->SetVisible(fVisible);

		if (m_hwnd!=NULL) {
			if (IsItemVisible(ITEM_PROGRAMINFO))
				SendSizeMessage();
			if (Item==ITEM_PROGRAMINFO)
				::ShowWindow(m_hwndProgramInfo,fVisible?SW_SHOW:SW_HIDE);
			::InvalidateRect(m_hwnd,NULL,TRUE);
		}
	}

	return true;
}