当前位置: 首页>>代码示例>>C++>>正文


C++ EnsureVisible函数代码示例

本文整理汇总了C++中EnsureVisible函数的典型用法代码示例。如果您正苦于以下问题:C++ EnsureVisible函数的具体用法?C++ EnsureVisible怎么用?C++ EnsureVisible使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了EnsureVisible函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: wxLogDebug

void DirectoryTree::OnItemExpanded(wxTreeEvent& evt)
  {
  wxTreeItemId tid = evt.GetItem();
	if(!tid.IsOk())
		{
    wxLogDebug(wxT("OnItemExpanded(): invalid event wxTreeItemId %u"), (int) tid);
		return;
		}

  wxString sPath;
  bool bGotPath = GetItemPath(tid, sPath);
	if(!bGotPath)
		{
    wxLogDebug(wxT("OnItemExpanded(): Can't get path from tree item %u"), (int) tid);
		return;
		}

  wxLogTrace(DIRECTORYTREE_EVENTS, wxT("OnItemExpanded(): '%s'"), sPath.c_str());

	AddChildren(tid);

	// TBI: Improve this by using GetBoundingRect
  // Scroll the view so that we can see as much of the newly expanded branch as possible
	// Get the last 'nChildId', so we can call 'EnsureVisible'
	wxTreeItemId tidLastChild = GetLastChild(tid);
 	if(tidLastChild.IsOk())
 		EnsureVisible(tidLastChild);
	EnsureVisible(tid);
  }
开发者ID:joeyates,项目名称:sherpa,代码行数:29,代码来源:DirectoryTree.cpp

示例2: EnsureVisible

BOOL CDuiItemBox::SetNewPosition(CDuiWindow * pChild, DWORD nPos, BOOL bEnsureVisible)
{
    if (pChild == NULL)
    {
        return FALSE;
    }

    CDuiWindow * pCurChild = m_pFirstChild;
    DWORD nCurPos = 0;
    for (; pCurChild != NULL; pCurChild = pCurChild->GetDuiWindow(GDUI_NEXTSIBLING))
    {
        if (pCurChild == pChild)
        {
            break;
        }
        ++nCurPos;
    }

    if (pCurChild == NULL)
    {
        return FALSE;
    }

    if (nCurPos == nPos)
    {
        if (bEnsureVisible)
        {
            EnsureVisible(pChild);
        }

        NotifyInvalidate();
        return TRUE;
    }

    if (nPos == 0)
    {
        BringWindowAfter(pChild, ICWND_FIRST);
    }
    else
    {
        CDuiWindow * pNewNext = m_pFirstChild;
        for (UINT i = 0; i < nPos && pNewNext != NULL; i++)
        {
            pNewNext = pNewNext->GetDuiWindow(GDUI_NEXTSIBLING);
        }

        BringWindowAfter(pChild, pNewNext);
    }

    UpdateScroll();
    ReLayout();
    if (bEnsureVisible)
    {
        EnsureVisible(pChild);
    }
    NotifyInvalidate();
    return TRUE;
}
开发者ID:maerson,项目名称:GUI-duiengine,代码行数:58,代码来源:duiitembox.cpp

示例3: ATLASSERT

void CTuotuoTabCtrl::InsertItem(size_t nInsertTo, CTabItem *pItem)
{
	ATLASSERT(pItem);
	m_bClosingTabs = false;

	// we assume, that any new tab appears on the right
	if (m_TabItems.empty())
	{
		m_TabItems.push_back(pItem);
		pItem->SetIndex(0);
		pItem->ChangeItemParent(this);
		pItem->SetPosImmediately(0);
		pItem->SetNewWidthImmediately();
	}
	else
	{
		if (nInsertTo == -1)
			nInsertTo = m_TabItems.size();
		ATLASSERT(nInsertTo >= 0 && nInsertTo <= m_TabItems.size());
		m_TabItems.insert(m_TabItems.begin() + nInsertTo, pItem);
		for (size_t i = nInsertTo; i < m_TabItems.size(); i++)
		{
			m_TabItems[i]->SetIndex(i);
			m_TabItems[i]->SetPosImmediately(i * m_iCurrentWidth);
		}
		pItem->ChangeItemParent(this);
		pItem->SetNewWidthImmediately();
	}
	EnsureVisible(pItem);

	UpdateLayout();
}
开发者ID:Williamzuckerberg,项目名称:chtmoneyhub,代码行数:32,代码来源:TabCtrl.cpp

示例4: GetSelection

void CCrystalEditView::OnEditDelete() 
{
	if (! QueryEditable() || m_pTextBuffer == NULL)
		return;

	CPoint ptSelStart, ptSelEnd;
	GetSelection(ptSelStart, ptSelEnd);
	if (ptSelStart == ptSelEnd)
	{
		if (ptSelEnd.x == GetLineLength(ptSelEnd.y))
		{
			if (ptSelEnd.y == GetLineCount() - 1)
				return;
			ptSelEnd.y ++;
			ptSelEnd.x = 0;
		}
		else
			ptSelEnd.x ++;
	}

	CPoint ptCursorPos = ptSelStart;
	ASSERT_VALIDTEXTPOS(ptCursorPos);
	SetAnchor(ptCursorPos);
	SetSelection(ptCursorPos, ptCursorPos);
	SetCursorPos(ptCursorPos);
	EnsureVisible(ptCursorPos);

	m_pTextBuffer->DeleteText(this, ptSelStart.y, ptSelStart.x, ptSelEnd.y, ptSelEnd.x, CE_ACTION_DELETE); // [JRT]
}
开发者ID:open2cerp,项目名称:Open2C-ERP,代码行数:29,代码来源:CCrystalEditView.cpp

示例5: CBCGProp

LRESULT CObjectProperty::OnAddEditBox ( WPARAM wParam, LPARAM lParam )
{
    //char szDebug [ 255 ] = "";
    //theApp.m_Debug.Write ( "OnAddEditBox - Begin" );

    sItem* pEdit = ( sItem* ) lParam;

    //sprintf ( szDebug, "pEdit->iGroup - %i", pEdit->iGroup );
    //theApp.m_Debug.Write ( szDebug );

    if ( pEdit->iGroup > (int)m_pGroups.size ( ) )
    {
        //theApp.m_Debug.Write ( "INVALID GROUP" );
        return 0;
    }

    CBCGProp* pProp = m_pGroups [ pEdit->iGroup ].pProperty;

    m_pGroups [ pEdit->iGroup ].iType = 0;

    //sprintf ( szDebug, "pEdit->name - %s", GetANSIFromWide ( pEdit->name ) );
    //theApp.m_Debug.Write ( szDebug );
    //sprintf ( szDebug, "pEdit->contents - %s", GetANSIFromWide ( pEdit->contents ) );
    //theApp.m_Debug.Write ( szDebug );
    //sprintf ( szDebug, "pEdit->description - %s", GetANSIFromWide ( pEdit->description ) );
    //theApp.m_Debug.Write ( szDebug );

    pProp->AddSubItem ( new CBCGProp ( pEdit->name, ( _variant_t ) pEdit->contents, pEdit->description ) );

    EnsureVisible ( pProp );

    //theApp.m_Debug.Write ( "OnAddEditBox - End\n" );
    return 0;
}
开发者ID:LeeBamberTGC,项目名称:FPS-Creator-Classic,代码行数:34,代码来源:ObjectProperty.cpp

示例6: InsertChild

CDuiPanel* CDuiItemBox::InsertItem(LPCWSTR pszXml,int iItem/*=-1*/,BOOL bEnsureVisible/*=FALSE*/)
{
    CDuiStringA strXml=DUI_CW2A(pszXml,CP_UTF8);;

    pugi::xml_document xmlDoc;
    if(!xmlDoc.load_buffer((LPCSTR)strXml,strXml.GetLength(),pugi::parse_default,pugi::encoding_utf8)) return NULL;

    CDuiWindow *pChild=m_pFirstChild,*pPrevChild=ICWND_FIRST;
    for(int iChild=0; iChild<iItem || iItem==-1; iChild++)
    {
        if(!pChild) break;
        pPrevChild=pChild;
        pChild=pChild->GetDuiWindow(GDUI_NEXTSIBLING);
    }

    CDuiPanel *pPanel=new CDuiPanel;
    InsertChild(pPanel, pPrevChild);

    pPanel->LoadChildren(xmlDoc);
    pPanel->SetVisible(TRUE);
    pPanel->SetFixSize(m_nItemWid,m_nItemHei);

    UpdateScroll();
    ReLayout();

    if(bEnsureVisible) EnsureVisible(pPanel);

    NotifyInvalidate();
    return pPanel;
}
开发者ID:maerson,项目名称:GUI-duiengine,代码行数:30,代码来源:duiitembox.cpp

示例7: getSelectedEntries

// ----------------------------------------------------------------------------
// ArchiveEntryList::filterList
//
// Filters the list to only entries and directories with names matching
// [filter], and with type categories matching [category].
// ----------------------------------------------------------------------------
void ArchiveEntryList::filterList(string filter, string category)
{
	// Update variables
	filter_text = filter;
	filter_category = category;

	// Save current selection
	vector<ArchiveEntry*> selection = getSelectedEntries();
	ArchiveEntry* focus = getFocusedEntry();

	// Apply the filter
	clearSelection();
	applyFilter();

	// Restore selection (if selected entries aren't filtered)
	ArchiveEntry* entry = nullptr;
	for (int a = 0; a < GetItemCount(); a++)
	{
		entry = getEntry(a, false);
		for (unsigned b = 0; b < selection.size(); b++)
		{
			if (entry == selection[b])
			{
				selectItem(a);
				break;
			}
		}

		if (entry == focus)
		{
			focusItem(a);
			EnsureVisible(a);
		}
	}
}
开发者ID:Gaerzi,项目名称:SLADE,代码行数:41,代码来源:ArchiveEntryList.cpp

示例8: PopulateTreeView

bool CXTPShellTreeCtrl::Init()
{
	if (!CXTPShellTreeCtrlBase::Init())
		return false;

	if (m_bAutoInit)
	{
		// mimic native Windows Explorer styles.
		DWORD dwStyle = TVS_SHOWSELALWAYS | TVS_HASBUTTONS;

		if (XTPSystemVersion()->IsWinXPOrGreater())
		{
			dwStyle |= (TVS_TRACKSELECT);
		}
		else
		{
			dwStyle |= (TVS_HASLINES | TVS_LINESATROOT);
		}

		if (InitializeTree(dwStyle))
		{
			PopulateTreeView();
		}

		// make the parent of the selected item visible if found.
		HTREEITEM hItem = GetSelectedItem();
		HTREEITEM hItemParent = GetParentItem(hItem);

		EnsureVisible(hItemParent ? hItemParent : hItem);
	}

	return true;
}
开发者ID:killbug2004,项目名称:ghost2013,代码行数:33,代码来源:XTPShellTreeCtrlView.cpp

示例9: FindSpace

void CDebugView::MarkPauseItem(int64 PauseItemID){

	CVSpace2* Item = FindSpace(PauseItemID);
	if (Item)
	{

		if (m_Toolbar.m_Owner)
		{
			m_Toolbar.m_Owner->m_AreaBottom-=m_Toolbar.m_Height;
			m_Toolbar.m_Owner->m_State &= ~SPACE_SELECTED;
		}

		m_Toolbar.m_Owner = Item;
        m_Toolbar.m_Owner->m_AreaBottom+=m_Toolbar.m_Height;

		Item->m_State |= SPACE_PAUSE|SPACE_SELECTED;

		m_SpaceSelected = Item;

		SetStepBnt(true);
		SetRunBnt(true);
		SetBreakBnt(false,0);

		Layout();
		EnsureVisible(Item,true);
	}else
	{
		Invalidate();
	}
	
}
开发者ID:GMIS,项目名称:GMIS,代码行数:31,代码来源:DebugView.cpp

示例10: GetItemCount

void CXTPTaskPanelGroup::RepositionScrollOffset()
{
	int nItemCount = GetItemCount();
	int nLastVisibleItem = m_pItems->GetNextVisibleIndex(nItemCount, -1);

	int nScrollOffset = min(GetOffsetItem(), nLastVisibleItem);

	if (nScrollOffset > 0)
	{
		CRect rcItem(GetAt(nLastVisibleItem)->GetItemRect());

		int nTopMargin = GetPaintManager()->GetGroupInnerMargins(this).top;

		while ((nScrollOffset > 0) && ((rcItem.bottom - GetAt(nScrollOffset - 1)->GetItemRect().top + nTopMargin
			< m_nExpandedClientHeight) || !GetAt(nScrollOffset - 1)->IsVisible()))
		{
			nScrollOffset--;
		}
	}
	SetOffsetItem(nScrollOffset, FALSE);

	for (int i = 0; i < nItemCount; i++)
	{
		CXTPTaskPanelGroupItem* pItem = GetAt(i);

		if (pItem->IsItemFocused() || (pItem->IsItemSelected() && GetTaskPanel()->m_bSelectItemOnFocus))
		{
			EnsureVisible(pItem, FALSE);
			break;
		}
	}
}
开发者ID:killbug2004,项目名称:ghost2013,代码行数:32,代码来源:XTPTaskPanelGroup.cpp

示例11: SetFocus

/// Left-click
void InstanceCtrl::OnLeftClick(wxMouseEvent& event)
{
	SetFocus();
	VisualCoord clickedIndex;
	HitTest(event.GetPosition(), clickedIndex);
	if(clickedIndex.isItem())
	{
		int flags = 0;
		if (event.ControlDown())
			flags |= wxINST_CTRL_DOWN;
		if (event.ShiftDown())
			flags |= wxINST_SHIFT_DOWN;
		if (event.AltDown())
			flags |= wxINST_ALT_DOWN;
			
		EnsureVisible(clickedIndex);
		DoSelection(clickedIndex);
		SetIntendedColumn(clickedIndex);
	}
	else if(clickedIndex.isHeaderTicker())
	{
		ToggleGroup(clickedIndex.groupIndex);
	}
	else ClearSelections();
}
开发者ID:Glought,项目名称:MultiMC4,代码行数:26,代码来源:instancectrl.cpp

示例12: GetSelection

void CEditWnd::InsertText(LPCSTR text, int action)
{
	m_pTextBuffer->BeginUndoGroup();
    
	CPoint ptCursorPos;
  if (IsSelection ())
  {
		CPoint ptSelStart, ptSelEnd;
    GetSelection (ptSelStart, ptSelEnd);
    
    ptCursorPos = ptSelStart;
    
		m_pTextBuffer->DeleteText (this, ptSelStart.y, ptSelStart.x, ptSelEnd.y, ptSelEnd.x, CE_ACTION_PASTE);
	}
  else ptCursorPos = GetCursorPos ();
	ASSERT_VALIDTEXTPOS (ptCursorPos);
      
  int x, y;
  m_pTextBuffer->InsertText (this, ptCursorPos.y, ptCursorPos.x, text, y, x, action);

  ptCursorPos.x = x;
  ptCursorPos.y = y;
  ASSERT_VALIDTEXTPOS (ptCursorPos);
  SetAnchor (ptCursorPos);
  SetSelection (ptCursorPos, ptCursorPos);
  SetCursorPos (ptCursorPos);
  EnsureVisible (ptCursorPos);
  m_pTextBuffer->FlushUndoGroup (this);
}
开发者ID:kosfango,项目名称:fips,代码行数:29,代码来源:EditWnd.cpp

示例13: _T

BOOL CEditWnd::ReplaceSelection (LPCTSTR pszNewText)
{
  if (!pszNewText)
    pszNewText = _T ("");

  CPoint ptCursorPos;
  if (IsSelection ())
	{
		CPoint ptSelStart, ptSelEnd;
		GetSelection (ptSelStart, ptSelEnd);
		ptCursorPos = ptSelStart;
		m_pTextBuffer->DeleteText (this, ptSelStart.y, ptSelStart.x, ptSelEnd.y, ptSelEnd.x, CE_ACTION_REPLACE);
	}
  else ptCursorPos = GetCursorPos ();
  ASSERT_VALIDTEXTPOS (ptCursorPos);

  int x, y;
  m_pTextBuffer->InsertText (this, ptCursorPos.y, ptCursorPos.x, pszNewText, y, x, CE_ACTION_REPLACE);
  m_nLastReplaceLen = (int)_tcslen (pszNewText);
  CPoint ptEndOfBlock = CPoint (x, y);
  ASSERT_VALIDTEXTPOS (ptCursorPos);
  ASSERT_VALIDTEXTPOS (ptEndOfBlock);
  SetAnchor (ptEndOfBlock);
  SetSelection (ptCursorPos, ptEndOfBlock);
  SetCursorPos (ptEndOfBlock);
  EnsureVisible (ptEndOfBlock);
  return TRUE;
}
开发者ID:kosfango,项目名称:fips,代码行数:28,代码来源:EditWnd.cpp

示例14: ConvertWideToANSI

LRESULT CObjectProperty::OnAddColorPicker (WPARAM wParam, LPARAM lParam )
{
    //char szDebug [ 255 ] = "";
    //theApp.m_Debug.Write ( "OnAddColorPicker - Begin" );

    sItem* pColor = ( sItem* ) lParam;

    //sprintf ( szDebug, "pColor->iGroup - %i", pColor->iGroup );
    //theApp.m_Debug.Write ( szDebug );

    if ( pColor->iGroup > (int)m_pGroups.size ( ) )
    {
        //theApp.m_Debug.Write ( "INVALID GROUP" );
        return 0;
    }

    CBCGProp* pProp = m_pGroups [ pColor->iGroup ].pProperty;

    int iColor [ 3 ];

    {
        char		szTextANSI [ 255 ]	= "";
        ConvertWideToANSI ( NULL, &pColor->contents, szTextANSI );

        char  seps[ ] = " ";
        char* token;

        token = strtok ( szTextANSI, seps );

        int iToken = 0;

        while ( token != NULL )
        {
            iColor [ iToken++ ] = atoi ( token );
            token = strtok ( NULL, seps );
        }
    }


    CBCGColorProp* pColorProp = new CBCGColorProp ( pColor->name, RGB ( iColor [ 0 ], iColor [ 1 ], iColor [ 2 ] ), NULL, pColor->description );

    //sprintf ( szDebug, "pColor->description - %s", GetANSIFromWide ( pColor->description ) );
    //theApp.m_Debug.Write ( szDebug );

    m_pGroups [ pColor->iGroup ].iType = 2;

    pProp->AddSubItem ( pColorProp );

    // v105 - 190107 - fix by reverting to standard colour dialog
//	pColorProp->EnableOtherButton ( _T ( "Other..." ) );
    pColorProp->EnableOtherButton ( _T ( "Other..." ), FALSE, TRUE );
    pColorProp->EnableAutomaticButton (_T ( "Default" ), ::GetSysColor ( COLOR_3DFACE ) );



    EnsureVisible ( pProp );

    //theApp.m_Debug.Write ( "OnAddColorPicker - End\n" );
    return 0;
}
开发者ID:LeeBamberTGC,项目名称:FPS-Creator-Classic,代码行数:60,代码来源:ObjectProperty.cpp

示例15: sigSelectItem

void PG_ListBox::OnItemSelected(PG_ListBoxBaseItem* item, bool select) 
{
	if(item == NULL) 
	{
		return;
	}

	if(!my_multiselect) 
	{
		if((m_poCurrentItem != NULL) && (m_poCurrentItem != item))
		{
			m_poCurrentItem->Select(false);
			m_poCurrentItem->Update();
		}

		m_poCurrentItem = item;
		m_poCurrentItem->Update();
	}

	if (select)
	{
		sigSelectItem(item);
		eventSelectItem(item);
		EnsureVisible(item);
	}
}
开发者ID:KAMI911,项目名称:openmortal,代码行数:26,代码来源:pglistbox.cpp


注:本文中的EnsureVisible函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。