extern pascal void LAutoScrollWhite(ListHandle lHandle) { OSStatus err; MoreThemeDrawingState state; err = MoreGetThemeDrawingState(&state); if (err == noErr) { err = MoreNormalizeThemeDrawingState(); assert(err == noErr); LAutoScroll(lHandle); err = MoreSetThemeDrawingState(state, true); } assert(err == noErr); }
void wxListBox::MacSetSelection( int n , bool select ) { Cell cell = { 0 , 0 } ; if ( ! (m_windowStyle & wxLB_MULTIPLE) ) { if ( LGetSelect( true , &cell , (ListHandle)m_macList ) ) { LSetSelect( false , cell , (ListHandle)m_macList ) ; } } cell.v = n ; LSetSelect( select , cell , (ListHandle)m_macList ) ; LAutoScroll( (ListHandle)m_macList ) ; Refresh(); }
/* -----------------------------------------------------------------------------*/ static void ListMove (char direction) { Cell c, next; ListHandle list = GetSelectedSlot (&c); if (!list) return; next = c; switch (direction) { case kUpArrowCharCode: next.v -= 1; break; case kDownArrowCharCode: if (!LNextCell(false, true, &next, list)) next.v = -1; break; } if (next.v >= 0) { LSetSelect (false, c, list); LSetSelect (true, next, list); LAutoScroll (list); ListPorts (list, false); } }
static int message_ListWin(int message, long param) { Cell cell; Rect rect; switch(message){ case MW_GROW: rect=win.ref->portRect; LSize(rect.right-14, rect.bottom-14, gPlaylist); return 0; case MW_LIST_SELECT: LDeselectAll(gPlaylist); cell.h=0; cell.v=param; LSetSelect(true, cell, gPlaylist); LAutoScroll(gPlaylist); return 0; } return -1; //not supported }
// -------------------------------------------------------------------------------------- void HandleKeyDown(char keyCode, WindowRef prefsWindow) { /* Why use the virtual key code instead of the character code? When the control key is held down it often masks out bit 7 of the character code, thus making it impossible to distinguish between some key presses such as page down (0x0C) and control-L (0x4C & ~bit7 = 0x0C). The virtual key codes, on the other hand, are unaffected by modifier keys. */ if ( (keyCode == kUpArrowKeyCode) || (keyCode == kDownArrowKeyCode) ) { ListHandle iconList; ListBounds bounds; short lastRow; Cell selectedCell; GetWindowProperty(prefsWindow, kAppSignature, kIconListTag, sizeof(ListHandle), NULL, &iconList); GetListDataBounds(iconList, &bounds); lastRow = bounds.bottom - bounds.top - 1; SetPt(&selectedCell, 0, 0); LGetSelect(true, &selectedCell, iconList); if ( (keyCode == kUpArrowKeyCode) && (selectedCell.v > 0) ) { SInt16 pixelDepth; Boolean isColorDevice; GetWindowDeviceDepthAndColor(prefsWindow, &pixelDepth, &isColorDevice); SetThemeBackground(kThemeBrushWhite, pixelDepth, isColorDevice); LSetSelect(false, selectedCell, iconList); // LSetSelect causes the indicated selectedCell.v--; // cell to be highlighted immediately (no update event) LSetSelect(true, selectedCell, iconList); LAutoScroll(iconList); // scroll the list in case the selected cell isn't in view changePanel(prefsWindow, selectedCell.v + 1); } else if ( (keyCode == kDownArrowKeyCode) && (selectedCell.v < lastRow) ) { SInt16 pixelDepth; Boolean isColorDevice; GetWindowDeviceDepthAndColor(prefsWindow, &pixelDepth, &isColorDevice); SetThemeBackground(kThemeBrushWhite, pixelDepth, isColorDevice); LSetSelect(false, selectedCell, iconList); selectedCell.v++; LSetSelect(true, selectedCell, iconList); LAutoScroll(iconList); // scroll the list in case the selected cell isn't in view changePanel(prefsWindow, selectedCell.v + 1); } } else if ( (keyCode == kPageUpKeyCode) || (keyCode == kPageDownKeyCode) ) { ListHandle iconList; ListBounds visibleCells; SInt16 pixelDepth; Boolean isColorDevice; GetWindowProperty(prefsWindow, kAppSignature, kIconListTag, sizeof(ListHandle), NULL, &iconList); GetListVisibleCells(iconList, &visibleCells); GetWindowDeviceDepthAndColor(prefsWindow, &pixelDepth, &isColorDevice); SetThemeBackground(kThemeBrushWhite, pixelDepth, isColorDevice); // LScroll causes the affected cells to be drawn immediately if (keyCode == kPageUpKeyCode) // (no update event) LScroll(0, -(visibleCells.bottom - 1 - visibleCells.top), iconList); else // keyCode == kPageDownKeyCode LScroll(0, (visibleCells.bottom - 1 - visibleCells.top), iconList); } } // HandleKeyDown