////////////////// // Key down int CScrollbar::DoKeyDown(UnicodeChar c, int keysym, const ModifiersState& modstate) { switch (keysym) { case SDLK_UP: if (iDirection == scrVertical) ScrollUp(); break; case SDLK_DOWN: if (iDirection == scrVertical) ScrollDown(); break; case SDLK_LEFT: if (iDirection == scrHorizontal) ScrollUp(); break; case SDLK_RIGHT: if (iDirection == scrHorizontal) ScrollDown(); break; } CWidget::DoKeyDown(c, keysym, modstate); return WID_NOT_PROCESSED; }
int VgaText::Write(off_t, const void *buf, size_t size) { cpu_flags fl = DisableInterrupts(); char *s = (char*) buf; while (size-- > 0) { char c = *s++; switch (c) { case '\n': fOffset += kScreenWidth - (fOffset % kScreenWidth); if (fOffset >= kScreenWidth * kScreenHeight) { fOffset -= kScreenWidth; ScrollUp(); } break; case '\010': // Backspace if (fOffset > 0) fTextBuffer[--fOffset] = fCurrentAttribute | ' '; break; default: fTextBuffer[fOffset++] = fCurrentAttribute | c; if (fOffset > kScreenWidth * kScreenHeight) { fOffset -= kScreenWidth; ScrollUp(); } } } UpdateHardwareCursor(); RestoreInterrupts(fl); return E_NO_ERROR; }
/////////////////// // Mouse wheel up int CScrollbar::DoMouseWheelUp(int x, int y, int dx, int dy, const ModifiersState& modstate) { if ((iDirection == scrVertical && !modstate.bShift) || (iDirection == scrHorizontal && modstate.bShift)) ScrollUp(); CWidget::DoMouseWheelDown(x, y, dx, dy, modstate); return WID_PROCESSED; }
/* This callback is called when some action is performed on the scrollbar. -> action : type of action that call the event. -> x,y : scrollbar thumb positions, value between 0 and 1 */ int iupMatrixScrollCB(Ihandle* ih, int action, float x, float y) { int err; x = IupGetFloat(ih, "POSX"); y = IupGetFloat(ih, "POSY"); IsCanvasSet(ih, err); if(err == CD_OK) { switch(action) { case IUP_SBUP : ScrollUp(ih); break; case IUP_SBDN : ScrollDown(ih); break; case IUP_SBPGUP : ScrollPgUp(ih); break; case IUP_SBPGDN : ScrollPgDown(ih); break; case IUP_SBRIGHT : ScrollRight(ih); break; case IUP_SBLEFT : ScrollLeft(ih); break; case IUP_SBPGRIGHT : ScrollPgRight(ih); break; case IUP_SBPGLEFT : ScrollPgLeft(ih); break; case IUP_SBPOSV : ScrollPosVer(ih,y); break; case IUP_SBPOSH : ScrollPosHor(ih,x); break; case IUP_SBDRAGV : ScrollPosVer(ih,y); break; case IUP_SBDRAGH : ScrollPosHor(ih,x); break; } } { cdCanvasFlush(ih->data->cddbuffer); ih->data->redraw = 0; } /* always update */ return IUP_DEFAULT; }
/*------------------------------------------------------------------------------ -- FUNCTION: MoveCursor -- -- DATE: Oct 19, 2010 -- -- REVISIONS: (Date and Description) -- -- DESIGNER: Dean Morin -- -- PROGRAMMER: Dean Morin -- -- INTERFACE: VOID MoveCursor(HWND hWnd, UINT cxCoord, UINT cyCoord, -- BOOL bScroll) -- hWnd - the handle to the window -- cxCoord - the x coordinate to move the cursor to -- (1,1) origin -- cyCoord - the y coordinate to move the cursor to -- (1,1) origin -- bScroll - whether or not to scroll when the -- y coordinate is beyond the bounds of -- screen -- -- RETURNS: VOID. -- -- NOTES: -- Moves the cursor to the specified position. The position passed -- in the arguments is based screen coordinates(1,1) origin). -- If bScroll is true, then the screen will scroll when the top -- of bottom lines of the window are reached. ------------------------------------------------------------------------------*/ VOID MoveCursor(HWND hWnd, INT cxCoord, INT cyCoord, BOOL bScroll) { PWNDDATA pwd = NULL; pwd = (PWNDDATA) GetWindowLongPtr(hWnd, 0); if (cxCoord < 1) { X = 0; } else if (cxCoord > CHARS_PER_LINE) { X = CHARS_PER_LINE - 1; } else { X = --cxCoord; } if (cyCoord < WINDOW_TOP + 1) { Y = WINDOW_TOP; if (bScroll) { ScrollUp(hWnd); } } else if (cyCoord > WINDOW_BOTTOM + 1) { Y = WINDOW_BOTTOM; if (bScroll) { ScrollDown(hWnd); } } else { Y = --cyCoord; } }
void SimpleConsole::NextLine() { cursorX = 0; cursorY ++; if(cursorY >= height) //是否需要滚屏? ScrollUp(); }
bool pawsScrollBar::OnMouseDown(int button, int /*modifiers*/, int x, int y) { if(button == csmbWheelUp || button == csmbHWheelLeft) { ScrollUp(); // Always return true, we don't want the scroll to go to the parent widget(s) return true; } else if(button == csmbWheelDown || button == csmbHWheelRight) { ScrollDown(); return true; } else if(WidgetAt(x, y) == thumb) { if(horizontal) thumbDragPoint = x - thumb->GetScreenFrame().xmin; else thumbDragPoint = y - thumb->GetScreenFrame().ymin; mouseIsDraggingThumb = true; thumb->SetBackground(thumbMoving); } else { MoveThumbToMouse(); } return true; }
/*------------------------------------------------------------------------------ -- FUNCTION: DisplayFrameInfo -- -- DATE: Dec 2, 2010 -- -- REVISIONS: -- -- DESIGNER: Daniel Wright -- -- PROGRAMMER: Daniel Wright -- -- INTERFACE: DisplayFrameInfo(HWND hWnd, FRAME frame) -- hWnd - a handle to the window -- frame - frame to display information about -- -- RETURNS: VOID. -- -- NOTES: Uses GetOpenFileName to get the name of the file to be -- transmitted and opens it. ------------------------------------------------------------------------------*/ VOID DisplayFrameInfo(HWND hWnd, FRAME frame){ PWNDDATA pwd = NULL; int a ; CHAR* b = (CHAR*)malloc(sizeof(CHAR)*4); CHAR* c = (CHAR*)malloc(sizeof(CHAR)); int i = 0; int j; SetScrollRegion(hWnd,2,LINES_PER_SCRN); ScrollUp(hWnd); pwd = (PWNDDATA) GetWindowLongPtr(hWnd, 0); a= pwd->NumOfFrames; sprintf(b, "%04x", frame.length); sprintf(c, "%02x", frame.crc); MoveCursor( hWnd, 3, 2, FALSE); for(i = 0; i < 3; i++){ j=(a)%(10); a /=10; UpdateDisplayBuf(hWnd, j+48); X -=2; } MoveCursor( hWnd, 12, 2, FALSE); for(i = 0; i < 4; i++) UpdateDisplayBuf(hWnd, b[i]); MoveCursor(hWnd, 29, 2, FALSE); for(i = 0; i < 3; i++){ UpdateDisplayBuf(hWnd, c[i]); } InvalidateRect(hWnd,NULL,FALSE); }
//----------------------------------------------------------------------------- //! //----------------------------------------------------------------------------- void tAbstractChannelTable::mouseMoveEvent( QMouseEvent* pEvent ) { // only move if we started within the table. if ( m_MousePressed ) { bool resetStart = false; int yChanged = m_MouseStartY - pEvent->pos().y(); if ( -yChanged >= m_RowHeight ) { // the user moved their finger towards the bottom enough to scroll the list. ScrollUp(); resetStart = true; } else { if ( yChanged >= m_RowHeight ) { // the user moved their finger towards the top enough to scroll the list. ScrollDown(); resetStart = true; } } if ( resetStart ) { m_MouseStartY = pEvent->pos().y(); } } }
void SayA( unsigned char attrib, register char *cp ) { unsigned char far *scptr = CurrentPos(); unsigned char far *scend = ScrPtr( 80, 25 ); while (*cp) { switch( *cp ) { case '\n': scptr = (unsigned char far *) ((long) scptr + (long) 160 ); case '\r': scptr = (unsigned char far *) ( ( ( (long) scptr - (long) VIDSEG ) / (long) 160 ) * (long) 160 + (long) VIDSEG ); cp++; break; case BELL: Beep(); cp++; break; case TAB: scptr = (unsigned char far *) ( (long) scptr / 16 * 16 ); cp++; break; default: *scptr++ = *cp++; *scptr++ = attrib; break; } if ( scptr > scend ) { ScrollUp( 1, 1, 80, 25, 1 ); scptr -= 160; } } RestoreCurPos( scptr ); }
void CXTPDatePickerList::ScrollDown(int nCount) { int nMonth = m_dtMiddleMonth.GetMonth(); int nYear = m_dtMiddleMonth.GetYear(); ShiftMonthUp(nYear, nMonth, nCount); COleDateTime dtMinRange, dtMaxRange; DWORD dwRes = m_pControl->GetRange(&dtMinRange, &dtMaxRange); if (dwRes & GDTR_MAX) { int nBottomMonth = nMonth; int nBottomYear = nYear; ShiftMonthUp(nBottomYear, nBottomMonth, m_nItemsBelow); COleDateTime dtTmp(nBottomYear, nBottomMonth, m_dtMiddleMonth.GetDay(), 0, 0, 0); if (dtTmp > dtMaxRange) { nYear = dtMaxRange.GetYear(); nMonth = dtMaxRange.GetMonth(); ShiftMonthDown(nYear, nMonth, m_nItemsBelow); } } m_dtMiddleMonth.SetDate(nYear, nMonth, 1); ScrollUp(0); }
void CXTPDatePickerList::OnTimer(UINT_PTR /*nIDEvent*/) { // determine cursor position DWORD dwPos = ::GetMessagePos(); POINTS ptsPos = MAKEPOINTS(dwPos); CPoint ptPos; ptPos.x = ptsPos.x; ptPos.y = ptsPos.y; CRect rcClient; GetClientRect(rcClient); ClientToScreen(rcClient); if (ptPos.y < rcClient.top) { int nDiff = rcClient.top - ptPos.y; int nScroll = nDiff / rcClient.Height() + 1; ScrollUp(nScroll); Invalidate(); } else if (ptPos.y > rcClient.bottom) { int nDiff = ptPos.y - rcClient.bottom; int nScroll = nDiff / rcClient.Height() + 1; ScrollDown(nScroll); Invalidate(); } }
void CSkinVerticleScrollbar::OnTimer(UINT nIDEvent) { if(nIDEvent == 1) { if(bMouseDownArrowDown) { ScrollDown(); } if(bMouseDownArrowUp) { ScrollUp(); } } else if(nIDEvent == 2) { if(bMouseDownArrowDown) { KillTimer(2); SetTimer(1, 50, NULL); } if(bMouseDownArrowUp) { KillTimer(2); SetTimer(1, 50, NULL); } } CStatic::OnTimer(nIDEvent); }
/* ScrollWindow - scrolls a window which has a content region * * arguements: * hWnd handle of window * numLines number of lines to scroll it * dir direction * any +num scrolls window down (contents go up) * any -num scrolls window up (contents go down) * returns: * no return value * */ VOID PASCAL INTERNAL ScrollWindow ( HW hWnd, INT numLines, INT direction ) { INT width = TWINWIDTH ( hWnd ); INT height = TWINHEIGHT ( hWnd ); INT cbContent; INT cbBlank; INT cbMove; if ((hWnd->pContent == NULL) || (numLines <= 0) || (direction == 0)) return; numLines = min (height, numLines); cbContent = width * height * sizeof ( CHAR ); cbBlank = width * numLines * sizeof ( CHAR ); cbMove = cbContent - cbBlank; /* cbContent number of bytes in total content region * cbBlank number of bytes of blanking * cbMove number of bytes to move */ if (direction > 0) { if (cbMove > 0) Move ((LPSTR) (hWnd->pContent + cbBlank), (LPSTR) hWnd->pContent, cbMove); Fill ((LPSTR) (hWnd->pContent + cbMove), ' ', cbBlank); } else { if (cbMove > 0) Move ((LPSTR) hWnd->pContent, (LPSTR) (hWnd->pContent + cbBlank), cbMove); Fill ((LPSTR) hWnd->pContent, ' ', cbBlank); } // // If the window is on the top, // or, if the command window is on top and this is the second window, // use video scrolling. don't use video scrolling for command window. // if ( (hWnd != hCommand) && ( (hWnd == winList) || ( (winList == hCommand) && (hWnd == winList->pNext) ) ) ) { if (direction > 0 && numLines > 0) ScrollUp (hWnd->win.left+hWnd->lLeft, hWnd->win.top+1, hWnd->win.right-hWnd->lRight, hWnd->win.bottom-hWnd->lBottom, numLines, DefNorm); else if (direction < 0 && numLines > 0) ScrollDn (hWnd->win.left+hWnd->lLeft, hWnd->win.top+1, hWnd->win.right-hWnd->lRight, hWnd->win.bottom-hWnd->lBottom, numLines, DefNorm); else DrawWindow ( hWnd, FALSE ); } else DrawWindow ( hWnd, FALSE ); return; }
/////////////////////////////////////////////////////////////////////////////// // OnTimer void CXScrollBar::OnTimer(UINT nIDEvent) { if (nIDEvent == TIMER_MOUSE_OVER_BUTTON) // mouse is in an arrow button, // and left button is down { if (m_bMouseDownArrowLeft) { ScrollLeft(); } if (m_bMouseDownArrowRight) { ScrollRight(); } if (m_bMouseDownArrowUp) { ScrollUp(); } if (m_bMouseDownArrowDown) { ScrollDown(); } } else if (nIDEvent == TIMER_LBUTTON_PRESSED) // mouse is in an arrow button, // and left button has just been pressed { KillTimer(nIDEvent); if (m_bMouseDownArrowLeft || m_bMouseDownArrowRight || m_bMouseDownArrowUp || m_bMouseDownArrowDown) { // debounce left click SetTimer(TIMER_MOUSE_OVER_BUTTON, 100, NULL); } } else if (nIDEvent == TIMER_MOUSE_OVER_THUMB) // mouse is over thumb { CPoint point; ::GetCursorPos(&point); ScreenToClient(&point); if (!m_rectThumb.PtInRect(point)) { // no longer over thumb, restore thumb color m_bThumbHover = FALSE; KillTimer(nIDEvent); ::SetCursor(::LoadCursor(NULL, IDC_ARROW)); Invalidate(); } } CStatic::OnTimer(nIDEvent); }
void cyg_hal_plf_screen_putc(void *__ch_data, char ch) { CYGARC_HAL_SAVE_GP(); switch( ch ) { case '\n': NewLine(); return; case '\r': XPos = 0; MoveCursor(); return; case '\b': if( XPos == 0 ) return; XPos--; MoveCursor(); return; case '\t': do { DisplayChar(' '); } while( (XPos % 8) != 0 ); return; case 0x0c: ClearScreen(); XPos = YPos = 0; MoveCursor(); return; case 1: ScrollUp(1); XPos = 0; YPos = ScreenLength-1; return; case 2: ScrollDown(1); XPos = 0; YPos = 0; return; default: DisplayChar(ch); return; } CYGARC_HAL_RESTORE_GP(); }
/** Mouse Button Down */ void ScrollBar::OnMouseDown(unsigned short /*x*/, unsigned short y, unsigned short Button, unsigned short /*Mod*/) { //removing the double click flag, use a more sophisticated method //if it is needed later Button&=GEM_MB_NORMAL; if (Button==GEM_MB_SCRLUP) { ScrollUp(); return; } if (Button==GEM_MB_SCRLDOWN) { ScrollDown(); return; } if (y <= GetFrameHeight(IE_GUI_SCROLLBAR_UP_UNPRESSED) ) { State |= UP_PRESS; ScrollUp(); return; } if (y >= Height - GetFrameHeight(IE_GUI_SCROLLBAR_DOWN_UNPRESSED)) { State |= DOWN_PRESS; ScrollDown(); return; } // check that stepPx is set if value is set if (Value && !stepPx) { SetMax(Value); } if (y >= SliderYPos && y < SliderYPos + GetFrameHeight(IE_GUI_SCROLLBAR_SLIDER)) { /* TODO: factor in where we grab the slider and offset it when dragging. */ State |= SLIDER_GRAB; return; } // if we made it this far we will jump the nib y and "grab" it // this way we only need to click once to jump+scroll State |= SLIDER_GRAB; SetPosForY(y - GetFrameHeight(IE_GUI_SCROLLBAR_UP_UNPRESSED)); }
void CSkinVerticleScrollbar::OnLButtonUp(UINT nFlags, CPoint point) { UpdateThumbPosition(); KillTimer(1); ReleaseCapture(); bool bInChannel = true; CRect clientRect; GetClientRect(&clientRect); int nHeight = clientRect.Height() - 37; CRect rectUpArrow(0,11,20,37); CRect rectDownArrow(0,nHeight,20,nHeight+26); CRect rectThumb(0,nThumbTop,20,nThumbTop+26); if(rectUpArrow.PtInRect(point) && bMouseDownArrowUp) { ScrollUp(); bInChannel = false; } if(rectDownArrow.PtInRect(point) && bMouseDownArrowDown) { ScrollDown(); bInChannel = false; } if(rectThumb.PtInRect(point)) { bInChannel = false; } if(bInChannel == true && !bMouseDown) { if(point.y > nThumbTop) { PageDown(); } else { PageUp(); } } bMouseDown = false; bDragging = false; bMouseDownArrowUp = false; bMouseDownArrowDown = false; CStatic::OnLButtonUp(nFlags, point); }
//**************************************************************************************** void CBCGPropSheetBar::EnsureVisible (int iButton) { ASSERT_VALID (this); CBCGToolbarButton* pButton = GetButton (iButton); ASSERT_VALID (pButton); CRect rectButton = pButton->Rect (); CRect rectWork; GetWorkArea (rectWork); if (rectButton.Height () >= rectWork.Height ()) { // Work area is too small, nothing to do return; } if (rectButton.top >= rectWork.top && rectButton.bottom <= rectWork.bottom) { // Already visible return; } if (rectButton.top < rectWork.top) { while (pButton->Rect ().top < rectWork.top) { int iScrollOffset = m_iScrollOffset; ScrollUp (); if (iScrollOffset == m_iScrollOffset) { break; } } } else { while (pButton->Rect ().bottom > rectWork.bottom) { int iScrollOffset = m_iScrollOffset; ScrollDown (); if (iScrollOffset == m_iScrollOffset) { break; } } } }
void tAllChannelStatus::keyPressEvent(QKeyEvent *pEvent) { int key = pEvent->key(); switch(key) { case Key::Exit: if( pEvent->isAutoRepeat() == false) { pEvent->accept(); emit Cancel(); } break; case Key::Up: ScrollUp(); pEvent->accept(); break; case Key::Down: ScrollDown(); pEvent->accept(); break; case Key::Right: case Key::Left: if( pEvent->isAutoRepeat() == false ) { ToggleFavorite(); pEvent->accept(); } break; case Key::Enter: case Key::Rotary: if( pEvent->isAutoRepeat() == false) { tAbstractChannelTable::keyPressEvent(pEvent); pEvent->accept(); } break; case Key::Menu: pEvent->ignore(); //this makes it so the parent gets the event break; default: tAbstractChannelTable::keyPressEvent(pEvent); break; }; }
void FlameThread::Init( void ) { PrepPal(); pBuffer = pBlitter->GetVirtualScreen()->GetBuffer(); srand( 42 ); while( TRUE ) { ScrollUp(); NewLine(); pBlitter->Blit(); DosSleep( 0 ); } // while } // FlameThread::Init
//activate the frame, raise it and set the timer bool ToasterBoxWindow::Play() { //do some checks to make sure this window is valid if (bottomRight.x < 1 || bottomRight.y < 1) return false; if (GetSize().GetWidth() < 50 || GetSize().GetWidth() < 50) { //toasterbox launches into a endless loop for some reason //when you try to make the window too small. return false; } ScrollUp(); Start(pauseTime, true); return true; }
void IncrementCursorRow() { ACB *j; j = GetACBPtr(); j->CursorRow++; if (j->CursorRow < j->VideoRows) { UpdateCursorPos(); return; } j->CursorRow--; UpdateCursorPos(); ScrollUp(); }
void ATotemCharacter::SetAbility(int32 index) { int count = 0; if (index < NumAbilities && !CurrentAbility->isRightClickDown()) { while (index != CurrentAbilityIndex()) { ScrollUp(); count++; if (count > NumAbilities) { break; } } } }
BOOL CDXCtrlTreeview::OnMouseWheel(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { POINT p; p.x = LOWORD(lParam); p.y = HIWORD(lParam); ScreenToClient(hwnd, &p); if(IsVisible() && HitTest(p.x, p.y)) { if(HIWORD(wParam) == 120) ScrollUp(3); else ScrollDown(3); return TRUE; } return FALSE; }
Void GUIListModel::OnScroll( const Point2 & /*ptLocalPos*/, Int iWheelDelta, GUIEventFlag iFlags ) { if ( m_iDisplayCount >= m_arrNodes.Count() ) { if ( m_iDisplayTop != 0 ) SetScroll( 0 ); return; } // Flags Bool bCtrl = ( (iFlags & GUIEVENT_FLAG_CTRL) != 0 ); // Deal event if ( iWheelDelta > 0 ) ScrollUp( bCtrl ? 3 : 1 ); else if ( iWheelDelta < 0 ) ScrollDown( bCtrl ? 3 : 1 ); }
void Display::PrintLine(const char* text) { // Scroll the display if necessary. if (_currentRow < LCD_ROW_COUNT - 1) _currentRow++; else ScrollUp(); SetCursor(_currentRow, _currentColumn); // Pad text with spaces. String paddedText = String(text); paddedText.concat(_blankline); paddedText = paddedText.substring(0, 20); // Write text to the display. Print(paddedText); }
void NewLine ( void ) { XPos = 0; YPos++; if( YPos >= ScreenLength ) { YPos = ScreenLength-1; ScrollUp(1); } MoveCursor(); } /* NewLine */
BOOL CDXCtrlTreeview::OnCommand(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { WORD wId, wCode; wId = LOWORD(wParam); wCode = HIWORD(wParam); if(wCode == BN_CLICKED) { if(wId == IDC_SCROLLUP && (PCDXCtrlBase)lParam == m_pChild->FindControl(IDC_SCROLLUP)) { ScrollUp(1); return TRUE; } else if(wId == IDC_SCROLLDOWN && (PCDXCtrlBase)lParam == m_pChild->FindControl(IDC_SCROLLDOWN)) { ScrollDown(1); return TRUE; } } return FALSE; }
void Game_Map::UpdateScroll() { if (scroll_rest > 0) { int distance = (1 << scroll_speed) / 2; switch (scroll_direction) { case 2: ScrollDown(distance); break; case 4: ScrollLeft(distance); break; case 6: ScrollRight(distance); break; case 8: ScrollUp(distance); break; } scroll_rest -= distance; } }