CWsSprite::~CWsSprite() { if (!IsFloating() && IsActivated() && iWin && iWin->IsVisible() && !Screen()->ChangeTracking()) ForceRedraw(); if (iAnim) CWsAnim::CloseAnim(iAnim); }
// // FUNCTION: WndProc(HWND, UINT, WPARAM, LPARAM) // // PURPOSE: Processes messages for the main window. // // WM_COMMAND - process the application menu // WM_PAINT - Paint the main window // WM_DESTROY - post a quit message and return // // LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { static BOOL isTimerRunning = FALSE; switch (message) { case WM_HOTKEY: if (!isTimerRunning) { SetTimer(hWnd, POLLING_TIMER, 25, NULL); isTimerRunning = TRUE; } else { KillTimer(hWnd, POLLING_TIMER); isTimerRunning = FALSE; ForceRedraw(); } break; case WM_DESTROY: KillTimer(hWnd, POLLING_TIMER); PostQuitMessage(0); break; case WM_TIMER: MakeFullscreen(); break; default: return DefWindowProc(hWnd, message, wParam, lParam); } return 0; }
void CWsSpriteBase::Deactivate() { //Disconnect from the sprite list and hide the sprite if (iFlags & ESpriteActive) { iFlags&=~ESpriteActive; MWsWindowTreeObserver* const windowTreeObserver = Screen()->WindowTreeObserver(); if (windowTreeObserver) { windowTreeObserver->NodeReleased(*this); } if (iMembers && iMembers->Count()>1) { iDeltaTimer->Remove(iDeltaTimerEntry); } if (IsFloating()) { Screen()->SpriteManager()->RemoveFloatingSprite(this); if (!Screen()->ChangeTracking()) { ForceRedraw(); } } // Note: This could be a floating sprite attached to the root window (PDEF138379) if(iWin) { iWin->RemoveSprite(this); } } }
void CHTMLSection::SetCurrentFocus( CFocusControlABC *pFocus, bool bScrollIntoView ) { if( m_pFocus ) { m_pFocus->SetFocus( false ); } m_pFocus = pFocus; if( m_pFocus ) { m_pFocus->SetFocus( true ); if( bScrollIntoView ) { // // Now we need to ensure that our focused section is visible WinHelper::CRect rcBounds; m_pFocus->GetObjectRect( rcBounds ); bool bChanged = false; if( rcBounds.Height() > Height() ) { SetPos( rcBounds.top ); bChanged = true; } else { rcBounds.Offset( GetScrollPosH(), GetScrollPos() ); int nPos = GetScrollPos(); int nBottom = nPos + Height(); if( rcBounds.top < nPos ) { ScrollV( rcBounds.top - nPos ); bChanged = true; } else if( rcBounds.bottom > nBottom ) { ScrollV( rcBounds.bottom - nBottom ); bChanged = true; } } if( bChanged ) { ForceRedraw(); NotifyParent( 1 ); } } } }
void CHTMLSection::OnTimer( int nTimerID ) { if( nTimerID == m_nBackgroundTimerID && !IsTransparent() ) { m_nBackgroundFrame++; if( m_nBackgroundFrame == m_pDocument->m_pimgBackground->GetFrameCount() ) m_nBackgroundFrame = 0; UnregisterTimerEvent( m_nBackgroundTimerID ); m_nBackgroundTimerID = RegisterTimerEvent( this, m_pDocument->m_pimgBackground->GetFrameTime( m_nBackgroundFrame ) ); ForceRedraw(); } else { CScrollContainer::OnTimer( nTimerID ); } }
void CHTMLImageSection::OnTimer( int nTimerID ) { if( nTimerID == m_nTimerID ) { m_nFrame++; if( m_nFrame == m_pImage->GetFrameCount() ) m_nFrame = 0; UnregisterTimerEvent( m_nTimerID ); m_nTimerID = RegisterTimerEvent( this, m_pImage->GetFrameTime( m_nFrame ) ); ForceRedraw(); } else { CHTMLSectionABC::OnTimer( nTimerID ); } }
void CHTMLSection::GotoLink( LPCTSTR pcszLinkTarget ) { if( *pcszLinkTarget == '#' ) { pcszLinkTarget++; } // Locate it in the map... WinHelper::CPoint* pPoint = m_mapNames.Lookup( StringClass( pcszLinkTarget ) ); if( pPoint ) { SetPos( pPoint->y - top ); SetPosH( pPoint->x - left ); ForceRedraw(); NotifyParent( 1 ); } }
void CGtkNfoViewCtrl::SwitchView(ENfoViewMode a_newMode) { ENfoViewMode l_oldMode = m_mode; m_mode = a_newMode; CNFORenderer* l_pRenderer = GetRenderer(); if(!l_pRenderer->HasNfoData() && m_pNfo) { // when switching to a view for the first time, load the NFO into the correct renderer. if(m_mode != NFO_VIEW_TEXTONLY) { l_pRenderer->AssignNFO(m_pNfo); } else { // generate text-only data const std::string l_stripped = CNFOData::GetStrippedTextUtf8(m_pNfo->GetTextWide()); m_pNfoTextOnly = new CNFOData(); m_pNfoTextOnly->SetCharsetToTry(NFOC_UTF8); if(!m_pNfoTextOnly->LoadFromMemory((const unsigned char*)l_stripped.c_str(), l_stripped.size())) { delete m_pNfoTextOnly; m_pNfoTextOnly = NULL; } else { m_textOnlyRenderer.AssignNFO(m_pNfoTextOnly); } } } this->set_size(l_pRenderer->GetWidth(), l_pRenderer->GetHeight()); // from Gtk::Layout ForceRedraw(); }
void CWsSpriteBase::Activate() { if (iFlags&ESpriteDisabled) { iFlags&=~ESpriteDisabled; } if (iMembers->Count()>1) { QueueDeltaTimer(); iDeltaTimer->Activate(); } iFlags|=ESpriteActive; if(iWin) iWin->AddSprite(this); SetDirty(ETrue); Screen()->SpriteManager()->Schedule(this); if(IsFloating()) { Screen()->SpriteManager()->AddFloatingSprite(this); if (!Screen()->ChangeTracking()) ForceRedraw(); } // As custom text cursors are sprites (CWsCustomTextCursor) and can be activated/deactivated // on various different windows during their lifetime, when activating // a text cursor, we pretend it's just been created to give us the option // of specifying a new parent window. Normal sprites (CWsSprite) are // treated the same way just for consistency as it does no harm. MWsWindowTreeObserver* const windowTreeObserver = Screen()->WindowTreeObserver(); if (windowTreeObserver) { windowTreeObserver->NodeCreated(*this, ParentNode()); windowTreeObserver->NodeExtentChanged(*this, Rect()); windowTreeObserver->NodeActivated(*this); } }
void CLASS::onLButtonDown(){ if(State.enabled){ State.index = (State.index +1 ) &1; ForceRedraw(); } }
void CRealMediaWindowlessSite::ComputeRegion() { REGION* pTempRegion = NULL; if(m_pRegion) { pTempRegion = RMACreateRegion(); RMAUnionRegion(pTempRegion, m_pRegion, pTempRegion); RMADestroyRegion(m_pRegion); } if(m_pRegionWithoutChildren) { RMADestroyRegion(m_pRegionWithoutChildren); } PNxPoint topleft = {0,0}; GetTopLeft(&topleft); if(IsSiteVisible()) { m_pRegionWithoutChildren = RMACreateRectRegion(topleft.x, topleft.y, topleft.x + m_size.cx, topleft.y + m_size.cy); if(m_pParentSite) { RMAIntersectRegion(m_pRegionWithoutChildren, m_pParentSite->m_pRegionWithoutChildren, m_pRegionWithoutChildren); POSITION pos = m_pParentSite->m_pChildren.GetHeadPosition(); while(pos) { CRealMediaWindowlessSite* pSiblingSite = (CRealMediaWindowlessSite*)(IRMASite*)m_pParentSite->m_pChildren.GetNext(pos); if(pSiblingSite != this) { INT32 zOrder; pSiblingSite->GetZOrder(zOrder); if(zOrder > m_lZOrder && pSiblingSite->IsSiteVisible()) { pSiblingSite->SubtractSite(m_pRegionWithoutChildren); } } } } m_pRegion = RMACreateRegion(); RMAUnionRegion(m_pRegion, m_pRegionWithoutChildren, m_pRegion); POSITION pos = m_pChildren.GetHeadPosition(); while(pos) { CRealMediaWindowlessSite* pChildSite = (CRealMediaWindowlessSite*)(IRMASite*)m_pChildren.GetNext(pos); if(pChildSite->IsSiteVisible()) pChildSite->SubtractSite(m_pRegion); } } else { m_pRegionWithoutChildren = RMACreateRectRegion(0,0,0,0); m_pRegion = RMACreateRectRegion(0,0,0,0); } if(pTempRegion && !RMAEqualRegion(m_pRegion, pTempRegion)) { ForceRedraw(); } RMADestroyRegion(pTempRegion); }
long FAR PASCAL _export tkWndProc(HWND hWnd, UINT message, DWORD wParam, LONG lParam) { int key; PAINTSTRUCT paint; HDC hdc; switch (message) { case WM_USER: if ( RealizePaletteNow( tkhdc, tkhpalette) > 0 ) ForceRedraw( hWnd ); return(0); case WM_SIZE: windInfo.width = LOWORD(lParam); windInfo.height = HIWORD(lParam); if (ReshapeFunc) { (*ReshapeFunc)(windInfo.width, windInfo.height); ForceRedraw( hWnd ); } return (0); case WM_MOVE: windInfo.x = LOWORD(lParam); windInfo.y = HIWORD(lParam); return (0); case WM_PAINT: /* * Validate the region even if there are no DisplayFunc. * Otherwise, USER will not stop sending WM_PAINT messages. */ hdc = BeginPaint(tkhwnd, &paint); if (DisplayFunc) { (*DisplayFunc)(); } EndPaint(tkhwnd, &paint); return (0); case WM_PALETTECHANGED: if ( hWnd != (HWND) wParam ) RealizePaletteNow(tkhdc,tkhpalette); return (0); case WM_QUERYNEWPALETTE: // In the foreground! Let RealizePaletteNow do the work-- // if management of the static system color usage is needed, // RealizePaletteNow will take care of it. if ( NULL != tkhpalette ) { if ( RealizePaletteNow(tkhdc, tkhpalette) > 0 ) ForceRedraw( hWnd ); return (1); } return (0); case WM_ACTIVATE: // If the window is going inactive, the palette must be realized to // the background. Cannot depend on WM_PALETTECHANGED to be sent since // the window that comes to the foreground may or may not be palette // managed. if ( LOWORD(wParam) == WA_INACTIVE ) { if ( NULL != tkhpalette ) { // Realize as a background palette. Need to call // RealizePaletteNow rather than RealizePalette directly to // because it may be necessary to release usage of the static // system colors. if ( RealizePaletteNow( tkhdc, tkhpalette) > 0 ) ForceRedraw( hWnd ); } } // Allow DefWindowProc() to finish the default processing (which includes // changing the keyboard focus). break; case WM_MOUSEMOVE: if (MouseMoveFunc) { GLenum mask; mask = 0; if (wParam & MK_LBUTTON) { mask |= TK_LEFTBUTTON; } if (wParam & MK_MBUTTON) { mask |= TK_MIDDLEBUTTON; } if (wParam & MK_RBUTTON) { mask |= TK_RIGHTBUTTON; } if ((*MouseMoveFunc)( LOWORD(lParam), HIWORD(lParam), mask )) { ForceRedraw( hWnd ); } } return (0); case WM_LBUTTONDOWN: SetCapture(hWnd); if (MouseDownFunc) { if ( (*MouseDownFunc)(LOWORD(lParam), HIWORD(lParam), TK_LEFTBUTTON) ) { ForceRedraw( hWnd ); } } return (0); case WM_LBUTTONUP: ReleaseCapture(); if (MouseUpFunc) { if ((*MouseUpFunc)(LOWORD(lParam), HIWORD(lParam), TK_LEFTBUTTON)) { ForceRedraw( hWnd ); } } return (0); case WM_MBUTTONDOWN: SetCapture(hWnd); if (MouseDownFunc) { if ((*MouseDownFunc)(LOWORD(lParam), HIWORD(lParam), TK_MIDDLEBUTTON)) { ForceRedraw( hWnd ); } } return (0); case WM_MBUTTONUP: ReleaseCapture(); if (MouseUpFunc) { if ((*MouseUpFunc)(LOWORD(lParam), HIWORD(lParam), TK_MIDDLEBUTTON)) { ForceRedraw( hWnd ); } } return (0); case WM_RBUTTONDOWN: SetCapture(hWnd); if (MouseDownFunc) { if ((*MouseDownFunc)(LOWORD(lParam), HIWORD(lParam), TK_RIGHTBUTTON)) { ForceRedraw( hWnd ); } } return (0); case WM_RBUTTONUP: ReleaseCapture(); if (MouseUpFunc) { if ((*MouseUpFunc)(LOWORD(lParam), HIWORD(lParam), TK_RIGHTBUTTON)) { ForceRedraw( hWnd ); } } return (0); case WM_KEYDOWN: switch (wParam) { case VK_SPACE: key = TK_SPACE; break; case VK_RETURN: key = TK_RETURN; break; case VK_ESCAPE: key = TK_ESCAPE; break; case VK_LEFT: key = TK_LEFT; break; case VK_UP: key = TK_UP; break; case VK_RIGHT: key = TK_RIGHT; break; case VK_DOWN: key = TK_DOWN; break; default: key = GL_FALSE; break; } if (key && KeyDownFunc) { GLenum mask; mask = 0; if (GetKeyState(VK_CONTROL)) { mask |= TK_CONTROL; } if (GetKeyState(VK_SHIFT)) { mask |= TK_SHIFT; } if ( (*KeyDownFunc)(key, mask) ) { ForceRedraw( hWnd ); } } return (0); case WM_CHAR: if (('0' <= wParam && wParam <= '9') || ('a' <= wParam && wParam <= 'z') || ('A' <= wParam && wParam <= 'Z')) { key = wParam; } else { key = GL_FALSE; } if (key && KeyDownFunc) { GLenum mask; mask = 0; if (GetKeyState(VK_CONTROL)) { mask |= TK_CONTROL; } if (GetKeyState(VK_SHIFT)) { mask |= TK_SHIFT; } if ( (*KeyDownFunc)(key, mask) ) { ForceRedraw( hWnd ); } } return (0); case WM_CLOSE: DestroyWindow(tkhwnd); return(0); case WM_DESTROY: CleanUp(); PostQuitMessage(TRUE); return 0; } return(DefWindowProc( hWnd, message, wParam, lParam)); }