WgWidget * WgTablePanel::FindWidget( const WgCoord& ofs, WgSearchMode mode ) { // Check cell content int xOfs; int yOfs; WgTableRow* pRow; int col = _getMarkedColumn( ofs.x, xOfs ); int row = _getMarkedRow( ofs.y, pRow, yOfs ); WgWidget * pWidget = 0; if( col != -1 && row != -1 && pRow->GetHook(col)->IsVisible() ) { if( xOfs < m_cellPadding.left || xOfs >= m_pColumns[col].m_realWidth - m_cellPadding.right || yOfs < m_cellPadding.top || yOfs >= pRow->Height() - m_cellPadding.bottom ) { pWidget = pRow->GetWidget(col); if( mode == WG_SEARCH_GEOMETRY || pWidget->MarkTest( WgCoord( xOfs-m_cellPadding.left, yOfs-m_cellPadding.top) ) ) return pWidget; } } // Check ourselves if( mode == WG_SEARCH_GEOMETRY || MarkTest( ofs ) ) return this; else return 0; }
WgWidget * WgMenu::_findWidget( const WgCoord& ofs, WgSearchMode mode ) { WgWidget * pWidget = WgPanel::_findWidget(ofs, mode); if( !pWidget && MarkTest( ofs ) ) return this; return pWidget; }
WgWidget * WgPackList::_findWidget( const WgCoord& ofs, WgSearchMode mode ) { WgWidget * pResult = 0; WgRect list = _listArea(); if( list.Contains(ofs) && _listWindow().Contains(ofs) ) { int entry; if( m_bHorizontal ) entry = _getEntryAt(ofs.x-list.x); else entry = _getEntryAt(ofs.y-list.y); if( entry != m_hooks.Size() ) { WgPackListHook * pHook = m_hooks.Hook(entry); WgRect childGeo; _getChildGeo( childGeo, pHook ); if( childGeo.Contains(ofs) ) { if( pHook->_widget()->IsContainer() ) { pResult = static_cast<WgContainer*>(pHook->_widget())->_findWidget( ofs - childGeo.Pos(), mode ); } else if( mode == WG_SEARCH_GEOMETRY || pHook->_widget()->MarkTest( ofs - childGeo.Pos() ) ) { pResult = pHook->_widget(); } } if( !pResult && mode == WG_SEARCH_ACTION_TARGET ) pResult = pHook->_widget(); // Entries are opaque as action targets. } } // Check against ourselves if( !pResult && ( mode == WG_SEARCH_GEOMETRY || MarkTest(ofs)) ) pResult = this; return pResult; }