本文整理匯總了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);
}
示例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;
}
示例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();
}
示例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]
}
示例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;
}
示例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;
}
示例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);
}
}
}
示例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;
}
示例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();
}
}
示例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;
}
}
}
示例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();
}
示例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);
}
示例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;
}
示例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;
}
示例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);
}
}