bool WHotSpotList::leftBttnDn( int x, int y, WMouseKeyFlags f ) //------------------------------------------------------------ { int row = getRow( WPoint( x, y ) ) + _topIndex; if( row < 0 ) row = 0; if( row >= count() ) row = count() - 1; if( row < 0 ) { // count == 0 return FALSE; } if( _hs != NULL ) { WPoint hotSize; _hs->hotSpotSize( getHotSpot( row, FALSE ), hotSize ); int hotOffset = getHotOffset( row ); if( x > hotOffset && x < hotOffset + hotSize.x() ) { _hotPressIdx = row; } } _leftDown = TRUE; mouseMove( x, y, f ); return TRUE; }
bool WHotSpotList::paint() //----------------------- { int offset; int maxRows = numDirtyRows() + _topIndex + firstDirtyRow(); int numElem = count(); int extent; WRect r; getClientRect( r ); for( int i = _topIndex + firstDirtyRow(); i < maxRows && i < numElem; i += 1 ) { const char * str = getString( i ); int hotSpot; if( i == _hotPressIdx && _inHotZone ) { hotSpot = getHotSpot( i, TRUE ); } else { hotSpot = getHotSpot( i, FALSE ); } if( _hs != NULL ) { WPoint hotSize; _hs->hotSpotSize( hotSpot, hotSize ); offset = getHotOffset( i ) + hotSize.x(); drawHotSpot( hotSpot, i - _topIndex, getHotOffset( i ) ); } else { offset = 0; } extent = r.w(); if( width() > extent ) extent = width(); if( i == _selected ) { drawTextExtent( i - _topIndex, offset, str, WPaintAttrMenuActive, extent ); } else { drawTextExtent( i - _topIndex, offset, str, WPaintAttrControlBackground, extent ); } } return TRUE; }
bool WHotSpotList::mouseMove( int x, int y, WMouseKeyFlags ) //--------------------------------------------------------- { if( _leftDown ) { int row = getRow( WPoint( x, y ) ); int oldSel = _selected; if( row < 0 ) row = 0; if( row > getRows() - 1 ) { row = getRows() - 1; } row += _topIndex; if( _hs != NULL && _hotPressIdx >= 0 ) { WPoint hotSize; _hs->hotSpotSize( getHotSpot( _hotPressIdx, FALSE ), hotSize ); int hotOffset = getHotOffset( _hotPressIdx ); if( row == _hotPressIdx && x >= hotOffset && x <= hotOffset + hotSize.x() ) { if( !_inHotZone ) { _inHotZone = TRUE; invalidateRow( _hotPressIdx - _topIndex ); } } else { if( _inHotZone ) { _inHotZone = FALSE; invalidateRow( _hotPressIdx - _topIndex ); } } } else { if( row >= count() ) { row = count() - 1; } if( _selected != row ) { _selected = row; invalidateRow( oldSel - _topIndex ); invalidateRow( _selected - _topIndex ); scrollToSelected(); } } return TRUE; } else { return FALSE; } }
GLMotif::WidgetArranger::Transformation UIManagerSpherical::calcTopLevelTransform(GLMotif::Widget* topLevelWidget) { /* Return a top-level transformation for the default hot spot: */ return calcTopLevelTransformInternal(topLevelWidget,getHotSpot()); }