void WINAPI duListBox::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) { int nItemCount = GetItemCount(); if (nItemCount == 0) return; if (nChar == VK_UP) { int nSel = GetSel(); nSel--; if (nSel < 0) nSel = 0; if (nSel >= nItemCount) nSel = nItemCount - 1; SetSel(nSel); duScroll *pScroll = (duScroll *)GetPluginByName(m_szVertScroll); if (pScroll) { pScroll->SetPos(m_nItemHeight * nSel); UpdateScroll(); } if (!m_fCombobox) { m_pHotItem = NULL; Plugin_Redraw(this, TRUE); } else { FadeRedraw(); } } else if (nChar == VK_DOWN) { int nSel = GetSel(); _TRACE(_T("nSel :%d\n"), nSel); nSel++; if (nSel >= nItemCount) nSel = nItemCount - 1; if (nSel < 0) nSel = 0; SetSel(nSel); duScroll *pScroll = (duScroll *)GetPluginByName(m_szVertScroll); if (pScroll) { pScroll->SetPos(m_nItemHeight * nSel); UpdateScroll(); } if (!m_fCombobox) { m_pHotItem = NULL; Plugin_Redraw(this, TRUE); } else FadeRedraw(); } }
BOOL WINAPI duListCtrl::DeleteLine(int nIndex, BOOL fAdjust) { int nLineCount = GetLineCount(); if (nIndex < 0 || nIndex >= nLineCount) return FALSE; duPlugin *pDelete = m_vtLines[nIndex]; if (pDelete == NULL) return FALSE; duRect rcDelete; pDelete->GetRect(&rcDelete); if (nIndex < m_nFirstLine) m_nFLTotalHeight -= rcDelete.Height(); m_nViewCy -= rcDelete.Height(); vector<duPlugin *>::iterator iterDelete = m_vtLines.begin() + nIndex; m_vtLines.erase(iterDelete); UpdateScroll(); if (pDelete == m_pSel) m_pSel = NULL; if (pDelete == m_pHot) m_pHot = NULL; Plugin_Delete(pDelete); CompleteAdjustLine(); return TRUE; }
void CTextCtrl::Clear(BOOL bInvalidate) { #if 0 CPaintDC dc( this ); CFont* pOldFont = (CFont*)dc.SelectObject( &m_pFont ); if ( m_cCharacter.cx == 0 ) m_cCharacter = dc.GetTextExtent( _T("X") ); dc.SelectObject( pOldFont ); #endif CSingleLock pLock( &m_pSection, TRUE ); for ( int nLine = 0 ; nLine < m_pLines.GetSize() ; nLine++ ) { delete (CTextLine*)m_pLines.GetAt( nLine ); } m_pLines.RemoveAll(); m_nPosition = m_nTotal = 0; if ( bInvalidate ) { UpdateScroll( TRUE ); Invalidate(); } }
void Game_Player::Update() { bool last_moving = IsMoving() || IsJumping(); if (IsMovable() && !Game_Map::GetInterpreter().IsRunning()) { switch (Input::dir4) { case 2: Move(Down); break; case 4: Move(Left); break; case 6: Move(Right); break; case 8: Move(Up); } } UpdateScroll(); Game_Character::Update(); if (location.aboard) GetVehicle()->SyncWithPlayer(); UpdateNonMoving(last_moving); }
void Game_Player::Update() { bool last_moving = IsMoving(); if (!IsMoving() && !Game_Map::GetInterpreter().IsRunning() && !IsMoveRouteOverwritten() && !Game_Message::message_waiting) { switch (Input::dir4) { case 2: MoveDown(); break; case 4: MoveLeft(); break; case 6: MoveRight(); break; case 8: MoveUp(); } } int last_real_x = real_x; int last_real_y = real_y; Game_Character::Update(); UpdateScroll(last_real_x, last_real_y); UpdateNonMoving(last_moving); }
// Update void Game_Player::Update() { bool last_moving = IsMoving(); if (!IsMoving() && !Game_Map::GetInterpreter().IsRunning() /*move_route_forcing || Game_Temp::message_window_showing*/) { switch (Input::dir4) { case 2: MoveDown(); break; case 4: MoveLeft(); break; case 6: MoveRight(); break; case 8: MoveUp(); } } int last_real_x = real_x; int last_real_y = real_y; Game_Character::Update(); UpdateScroll(last_real_x, last_real_y); UpdateNonMoving(last_moving); }
BOOL CTextCtrl::OnMouseWheel(UINT nFlags, short zDelta, CPoint pt) { short nRows = ( zDelta / WHEEL_DELTA ); if ( WHEEL_PAGESCROLL == m_nScrollWheelLines ) { // scroll by page is activated SCROLLINFO si; ZeroMemory( &si, sizeof( si ) ); si.cbSize = sizeof( si ); si.fMask = SIF_ALL; GetScrollInfo( SB_VERT, &si ); nRows *=( si.nPage - 1 ); } else nRows *= m_nScrollWheelLines; CSingleLock pLock( &m_pSection, TRUE ); m_nPosition-= nRows; m_nPosition = max( 0, min( m_nTotal, m_nPosition ) ); UpdateScroll(); Invalidate(); return CWnd::OnMouseWheel(nFlags, zDelta, pt); }
BOOL CTextCtrl::OnMouseWheel(UINT nFlags, short zDelta, CPoint pt) { int nScroll = zDelta / WHEEL_DELTA * theApp.m_nMouseWheel; if ( theApp.m_nMouseWheel == 20 ) // 20 lines set for rare WHEEL_PAGESCROLL (UINT_MAX) { // Scroll by page is activated SCROLLINFO si = {}; si.cbSize = sizeof( si ); si.fMask = SIF_ALL; GetScrollInfo( SB_VERT, &si ); nScroll = zDelta / WHEEL_DELTA * ( si.nPage - 1 ); } CQuickLock pLock( m_pSection ); m_nPosition -= nScroll; m_nPosition = max( 0, min( m_nTotal, m_nPosition ) ); UpdateScroll(); Invalidate(); return CWnd::OnMouseWheel(nFlags, zDelta, pt); }
BOOL duTreeListCtrl::DeleteItem(TreeListItem *pItem) { if (pItem == TCVIL_ROOT || pItem == NULL) pItem = &m_RootItem; if (pItem != &m_RootItem) { TreeListItem *pPreItem = NULL; TreeListItem *pParent = pItem->pParent; pPreItem = pParent->pFirstChild; for (; pPreItem->pNextSibling; pPreItem = pPreItem->pNextSibling) if (pPreItem->pNextSibling == pItem) break; if (pParent->pFirstChild == pItem) pParent->pFirstChild = pItem->pNextSibling; else pPreItem->pNextSibling = pItem->pNextSibling; DeleteItemT(pItem); } else { DeleteItemT(pItem); m_RootItem.pFirstChild = NULL; } UpdateScroll(); CompleteAdjustLine(); return TRUE; }
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; }
BOOL duTreeCtrl::DeleteItem(TreeCtrlItem *pItem) { if (pItem == TCVI_ROOT || !pItem) pItem = m_pRoot; if (pItem != m_pRoot) { TreeCtrlItem *pPreItem = NULL; TreeCtrlItem *pParent = pItem->pParent; pPreItem = pParent->pFirstChild; for (; pPreItem->pNextSibling; pPreItem = pPreItem->pNextSibling) if (pPreItem->pNextSibling == pItem) break; if (pParent->pFirstChild == pItem) pParent->pFirstChild = pItem->pNextSibling; else pPreItem->pNextSibling = pItem->pNextSibling; DeleteItemT(pItem); } else { DeleteItemT(pItem); m_pRoot->pFirstChild = NULL; } UpdateScroll(); return TRUE; }
BOOL WINAPI duListBox::InsertItem(int nIndex, LPCTSTR lpszText, LPCTSTR lpszIcon) { int nItemCount = GetItemCount(); if (nIndex == -1) nIndex = nItemCount; if (nIndex < 0 || nIndex > nItemCount) return FALSE; ListBoxItem *pItem = new ListBoxItem; pItem->uIconX = m_nItemIconX; pItem->uIconY = m_nItemIconY; pItem->uIconWidth = m_nItemIconWidth; pItem->uIconHeight = m_nItemIconHeight; if (lpszText) pItem->szText = lpszText; else pItem->szText = _T(""); if (lpszIcon) pItem->szIcon = lpszIcon; else pItem->szIcon = _T(""); pItem->fDisable = FALSE; vector<ListBoxItem *>::iterator iterInsert = m_vtItem.begin() + nIndex; m_vtItem.insert(iterInsert, pItem); UpdateScroll(); return TRUE; }
void FMEDITAPI NewOffset( POINT point ) /*************************************/ { // Set the offset to 'point' and reset the scrolling stuff SetOffset( point ); UpdateScroll(); InvalidateRect( GetAppWnd(), NULL, TRUE ); }
void CLibraryAlbumView::ScrollTo(int nPosition) { if ( nPosition == m_nScroll ) return; m_nScroll = nPosition; UpdateScroll(); RedrawWindow( NULL, NULL, RDW_INVALIDATE ); }
void duTreeCtrl::Expand(TreeCtrlItem *pItem, BOOL fExpand) { if (pItem == NULL || pItem->fExpand == fExpand) return; pItem->fExpand = fExpand; UpdateScroll(); }
void CTextCtrl::OnPaint() { CSingleLock pLock( &m_pSection, TRUE ); CRect rcClient, rcLine; CPaintDC dc( this ); GetClientRect( &rcClient ); CFont* pOldFont = (CFont*)dc.SelectObject( &m_pFont ); if ( m_cCharacter.cx == 0 ) m_cCharacter = dc.GetTextExtent( _T("X") ); BOOL bBottom = ( m_nPosition >= m_nTotal ); BOOL bModified = m_bProcess; if ( m_bProcess ) m_nTotal = 0; int nWidth = ( rcClient.right - 4 ) / m_cCharacter.cx; for ( int nLine = 0 ; nLine < m_pLines.GetSize() ; nLine++ ) { CTextLine* pLine = (CTextLine*)m_pLines.GetAt( nLine ); if ( m_bProcess || ! pLine->m_nLine ) { m_nTotal += pLine->Process( nWidth ); bModified = TRUE; } } if ( bBottom ) m_nPosition = m_nTotal; if ( bModified ) UpdateScroll( TRUE ); m_bProcess = FALSE; dc.SetTextColor( m_crText[0] ); dc.SetBkColor( m_crBackground ); dc.SetBkMode( OPAQUE ); rcLine.CopyRect( &rcClient ); rcLine.bottom += ( m_nTotal - m_nPosition ) * m_cCharacter.cy; rcLine.top = rcLine.bottom - m_cCharacter.cy; for ( nLine = m_pLines.GetSize() - 1 ; nLine >= 0 && rcLine.bottom > 0 ; nLine-- ) { CTextLine* pLine = (CTextLine*)m_pLines.GetAt( nLine ); dc.SetTextColor( m_crText[ pLine->m_nType ] ); pLine->Paint( &dc, &rcLine ); } if ( rcLine.bottom > 0 ) { rcLine.top = 0; dc.FillSolidRect( &rcLine, m_crBackground ); } dc.SelectObject( pOldFont ); }
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; }
void duTreeCtrl::SetItemHeight(int nItemHeight) { if (nItemHeight > 0) { m_nItemHeight = nItemHeight; UpdateScroll(); Plugin_Redraw(this, TRUE); } }
void CDuiItemBox::OnSize(UINT nType, CSize size) { if(m_rcWindow.IsRectEmpty()) return; m_ptOrigin=CPoint(0,0); m_siVer.nPos=0; UpdateScroll(); ReLayout(); }
void CLibraryAlbumView::OnSize(UINT nType, int cx, int cy) { CLibraryFileView::OnSize( nType, cx, cy ); m_szTrack.cx = cx; m_szTrack.cy = ROW_HEIGHT; m_nRows = cy / m_szTrack.cy - 1; UpdateScroll(); }
bool FMEDITAPI RemoveObject( OBJPTR obj, OBJPTR member ) /******************************************************/ { /* Update the position of the passed member with in the given object. */ bool ret; ret = Forward( obj, REMOVE_SUBOBJECT, member, NULL ); UpdateScroll(); return( ret ); }
BOOL CDuiItemBox::RemoveItem(CDuiWindow * pChild) { if (DestroyChild(pChild)) { UpdateScroll(); ReLayout(); NotifyInvalidate(); return TRUE; } return FALSE; }
void CLibraryTileView::OnSize(UINT nType, int cx, int cy) { CLibraryView::OnSize( nType, cx, cy ); m_nColumns = cx / m_szBlock.cx; m_nRows = cy / m_szBlock.cy + 1; m_nColumns = max( m_nColumns, 1 ); UpdateScroll(); }
void BattleScene::Update() { switch (stage) { case BattleStages::SCROLL: //0 UpdateScroll(); break; case BattleStages::INTRO: //1 UpdateIntro(); break; } }
void CBrowseTreeCtrl::ScrollTo(int nPosition) { CSingleLock lRoot( &m_csRoot, TRUE ); if ( nPosition == m_nScroll ) return; m_nScroll = nPosition; UpdateScroll(); CRect rc; GetClientRect( &rc ); RedrawWindow( &rc, NULL, RDW_INVALIDATE ); }
TreeCtrlItem *duTreeCtrl::InsertItem(LPCTSTR lpszText, LPCTSTR lpszImage, TreeCtrlItem *pParent, TreeCtrlItem *pInsertAfter) { TreeCtrlItem *pNewItem = new TreeCtrlItem; pNewItem->strText = lpszText; pNewItem->strImage = lpszImage; pNewItem->fExpand = TRUE; pNewItem->nTextWidth = 0; pNewItem->lParam = NULL; pNewItem->pParent = NULL; pNewItem->pNextSibling = NULL; pNewItem->pFirstChild = NULL; if ((pParent == NULL) || (pParent == TCVI_ROOT)) pParent = m_pRoot; else if (!m_pRoot->pFirstChild) { delete pNewItem; return NULL; } if ((pInsertAfter == TCVI_FIRST) || !pParent->pFirstChild) { pNewItem->pNextSibling = pParent->pFirstChild; pParent->pFirstChild = pNewItem; } else { TreeCtrlItem *pItem = NULL; if (pInsertAfter == TCVI_LAST) { for (pItem = pParent->pFirstChild; pItem->pNextSibling; pItem = pItem->pNextSibling) ; } else { for (pItem = pParent->pFirstChild; pItem->pNextSibling; pItem = pItem->pNextSibling) if (pItem == pInsertAfter) break; } pNewItem->pNextSibling = pItem->pNextSibling; pItem->pNextSibling = pNewItem; } pNewItem->pParent = pParent; pNewItem->nLevel = pParent->nLevel + 1; m_nItems++; UpdateScroll(); return pNewItem; }
BOOL CBrowseTreeCtrl::Expand(CBrowseTreeItem* pItem, TRISTATE bExpand, BOOL bInvalidate) { CSingleLock lRoot( &m_csRoot, TRUE ); if ( pItem == NULL ) return FALSE; switch ( bExpand ) { case TS_UNKNOWN: pItem->m_bExpanded = ! pItem->m_bExpanded; break; case TS_TRUE: if ( pItem->m_bExpanded ) return FALSE; pItem->m_bExpanded = TRUE; break; case TS_FALSE: if ( ! pItem->m_bExpanded ) return FALSE; pItem->m_bExpanded = FALSE; break; } if ( ! pItem->IsVisible() ) return FALSE; if ( pItem->m_bExpanded ) { m_nTotal += pItem->GetChildCount(); } else { m_nTotal -= pItem->GetChildCount(); DeselectAll( NULL, pItem, FALSE ); } pItem->m_bContract1 = pItem->m_bExpanded == TRUE && bExpand == TS_TRUE && bInvalidate == FALSE; if ( pItem->m_bContract1 == FALSE ) { for ( CBrowseTreeItem* pParent = pItem ; pParent != NULL ; pParent = pParent->m_pParent ) pParent->m_bContract1 = FALSE; } if ( bInvalidate ) { UpdateScroll(); Invalidate(); } return TRUE; }
void WINAPI duListCtrl::ResetLine() { m_nYOffset = 0; m_nFirstLine = 0; m_nFLTotalHeight = 0; m_nHotLine = 0; if (Plugin_IsValid(m_pHot)) { m_pHot->SetState(DU_STATE_NORMAL); Plugin_Redraw(m_pHot, TRUE); } UpdateScroll(); AdjustVisibleLine(0); }
BOOL CDuiItemBox::RemoveItem(UINT iItem) { if(iItem>=GetItemCount()) return FALSE; CDuiWindow *pChild=m_pFirstChild; for(UINT iChild=0; iChild<iItem ; iChild++) { pChild=pChild->GetDuiWindow(GDUI_NEXTSIBLING); } DestroyChild(pChild); UpdateScroll(); ReLayout(); NotifyInvalidate(); return TRUE; }
void CMemoryCardView::SetMemoryCard(CMemoryCard* memoryCard) { m_memoryCard = memoryCard; if(m_memoryCard != NULL) { m_itemCount = static_cast<unsigned int>(m_memoryCard->GetSaveCount()); } else { m_itemCount = 0; } m_viewState.m_nScrollPosition = 0; UpdateScroll(); m_render->SetMemoryCard(memoryCard); SetSelection(0); }