void LineEditor::_requestResize( Item * pItem ) { m_bResetCaretOnFocus = true; _requestResize(); _requestRender(); _adjustViewOfs(); }
void WgLineEditor::_onFieldResize( WgField * pField ) { m_bResetCursorOnFocus = true; _requestResize(); _requestRender(); _adjustViewOfs(); }
void WgPackList::_onEntrySkinChanged( WgSize oldPadding, WgSize newPadding ) { _requestRender(); if( oldPadding != newPadding ) { m_entryPadding = newPadding; int nEntries = m_hooks.Size(); int lengthDiff, breadthDiff; if( m_bHorizontal ) { lengthDiff = (newPadding.w - oldPadding.w)*nEntries; breadthDiff = (newPadding.h - oldPadding.h)*nEntries; } else { lengthDiff = (newPadding.h - oldPadding.h)*nEntries; breadthDiff = (newPadding.w - oldPadding.w)*nEntries; } if( lengthDiff != 0 || breadthDiff != 0 ) { m_contentLength += lengthDiff; m_contentBreadth += breadthDiff; m_contentPreferredLength += lengthDiff; m_contentPreferredBreadth += breadthDiff; _requestResize(); } } }
void FpsDisplay::setTextProperties( const Textprop_p& pProp ) { m_labelsText.setProperties(pProp); m_valuesText.setProperties(pProp); _requestResize(); _requestRender(); }
void WgFiller::SetPreferredSize( const WgSize& size ) { if( size != m_preferredSize ) { m_preferredSize = size; _requestResize(); } }
void WgTablePanel::_setContentSize( const WgSize& size ) { if( m_contentSize != size ) { m_contentSize = size; _requestResize(); } }
void WgVolumeMeter::SetDirection( WgDirection direction ) { if( direction != m_direction ) { m_direction = direction; _requestResize(); _requestRender(); } }
bool PanelHook::setPadding( Border padding ) { if( padding != m_padding ) { m_padding = padding; _requestResize(); } return true; }
bool Capsule::removeWidget( const Widget_p& pWidget ) { if( m_hook._widget() != pWidget.rawPtr() ) return false; m_hook._setWidget(0); _requestRender(); _requestResize(); return true; }
bool Capsule::clear() { if( !m_hook._widget() ) return false; m_hook._setWidget(0); _requestRender(); _requestResize(); return true; }
void Widget::_refresh() { if( m_pSkin && m_pSkin->isOpaque(m_state) ) m_bOpaque = true; else m_bOpaque = false; _requestResize(); _requestRender(); }
void WgTablePanel::_disconnectRow( WgTableRow* pRow ) { m_nRows--; pRow->m_pTable = 0; pRow->_disconnect(); m_contentSize.h -= pRow->Height(); _requestRender(); //TODO: Just request render on this row and following. _requestResize(); }
void WgPackList::_onRefreshList() { if( m_pEntrySkin[0] ) m_entryPadding = m_pEntrySkin[0]->ContentPadding(); m_contentPreferredLength = 0; m_contentPreferredBreadth = 0; m_nbPreferredBreadthEntries = 0; int ofs = 0; for( int entry = 0 ; entry < m_hooks.Size() ; entry++ ) { WgPackListHook * pHook = m_hooks.Hook(entry); WgWidget * pChild = pHook->_widget(); WgSize pref = _paddedLimitedPreferredSize( pChild ); if( m_bHorizontal ) { _addToContentPreferredSize( pref.w, pref.h ); pHook->m_ofs = ofs; // Get entry length and breadth if( pref.h == m_contentBreadth ) pHook->m_length = pref.w; else pHook->m_length = _paddedLimitedMatchingWidth(pChild, m_contentBreadth); pHook->m_prefBreadth = pref.h; ofs += pHook->m_length; } else { _addToContentPreferredSize( pref.h, pref.w ); pHook->m_ofs = ofs; // Get entry length and breadth if( pref.w == m_contentBreadth ) pHook->m_length = pref.h; else pHook->m_length = _paddedLimitedMatchingHeight(pChild, m_contentBreadth); pHook->m_prefBreadth = pref.w; ofs += pHook->m_length; } } m_contentLength = ofs; // Finish up _requestRender(); _requestResize(); // This should preferably be done first once we have changed the method. }
bool AnimPlayer::setAnimation( const GfxAnim_p& pAnim ) { m_pAnim = pAnim; m_playPos = 0.0; Size currSize = size(); Size wantedSize; _requestResize(); _requestRender(); return true; }
CapsuleHook_p Capsule::setWidget( const Widget_p& pWidget ) { if( !pWidget ) return 0; m_hook._setWidget(pWidget.rawPtr()); pWidget->_setSize(size()); _requestRender(); _requestResize(); return &m_hook; }
void WgPackList::_onRequestResize( WgPackListHook * pHook ) { if( !pHook->m_bVisible || m_minEntrySize == m_maxEntrySize ) return; WgWidget * pChild = pHook->_widget(); WgSize prefEntrySize = _paddedLimitedPreferredSize(pChild); int prefLength = m_bHorizontal ? prefEntrySize.w : prefEntrySize.h; int prefBreadth = m_bHorizontal ? prefEntrySize.h : prefEntrySize.w; bool bReqResize = false; // Update preferred sizes if( prefBreadth != pHook->m_prefBreadth || prefLength != pHook->m_length ) { _subFromContentPreferredSize( pHook->m_length, pHook->m_prefBreadth ); _addToContentPreferredSize( prefLength, prefBreadth ); pHook->m_prefBreadth = prefBreadth; bReqResize = true; } // Calculate new length int length; if( prefBreadth == m_contentBreadth ) length = prefLength; else length = m_bHorizontal ? _paddedLimitedMatchingWidth(pChild, m_contentBreadth ) : _paddedLimitedMatchingHeight(pChild, m_contentBreadth ); // Update if length has changed if( length != pHook->m_length ) { m_contentLength += length - pHook->m_length; pHook->m_length = length; bReqResize = true; _updateChildOfsFrom( pHook ); _requestRenderChildrenFrom( pHook ); WgRect childGeo; _getChildGeo(childGeo,pHook); pHook->_widget()->_onNewSize(childGeo); } if( bReqResize ) _requestResize(); }
void WgVolumeMeter::SetLEDSpacing( float spacing ) { if( spacing < 0.f ) spacing = 0.f; if( spacing != m_LEDSpacing ) { m_LEDSpacing = spacing; _requestResize(); _requestRender(); } }
void WgPackList::_refreshHeader() { WgSize wantedIconSize = m_header.icon.PreferredSize(); WgSize wantedArrowSize = m_header.arrow.PreferredSize(); WgSize wantedTextSize = m_header.label.PreferredSize(); WgSize wantedSize; //TODO: Assumes icon/arrow origos to not be NORTH, SOUTH or CENTER. //TODO: Assumes text not wrapping. wantedSize.h = WgMax(wantedIconSize.h, wantedArrowSize.h, wantedTextSize.h ); wantedSize.w = wantedTextSize.w; if( m_header.icon.Overlap() ) wantedSize.w = WgMax(wantedSize.w,wantedIconSize.w); else wantedSize.w += wantedIconSize.w; if( m_header.arrow.Overlap() ) wantedSize.w = WgMax(wantedSize.w,wantedArrowSize.w); else wantedSize.w += wantedArrowSize.w; // if( m_header.m_pSkin ) wantedSize = m_header.m_pSkin->SizeForContent(wantedSize); // bool bRequestResize = false; // Update headers size, possibly request resize. if( wantedSize.h != m_header.m_height ) { if( !m_bHorizontal || (wantedSize.h > m_contentPreferredBreadth || m_header.m_height > m_contentPreferredBreadth) ) bRequestResize = true; m_header.m_height = wantedSize.h; } if( wantedSize.w != m_header.m_width ) { if( m_bHorizontal || (wantedSize.w > m_contentPreferredBreadth || m_header.m_width > m_contentPreferredBreadth) ) bRequestResize = true; m_header.m_width = wantedSize.w; } if( bRequestResize ) _requestResize(); }
void SimpleVolumeMeter::setDirection(Direction direction) { if (direction != m_direction) { m_direction = direction; Size size = m_pSkin ? m_size - m_pSkin->contentPadding() : m_size; _updateValueDisplays(size); _requestResize(); _requestRender(); } }
void WgTablePanel::_connectRow( WgTableRow* pRow, WgTableRow* pPlaceBefore ) { m_nRows++; pRow->m_pTable = this; if( pPlaceBefore ) pRow->_moveBefore(pPlaceBefore); else m_rows.PushBack(pRow); m_contentSize.h += pRow->Height(); _requestRender(); //TODO: Just request render on this row and following. _requestResize(); }
void WgPackList::_onWidgetAppeared( WgListHook * pInserted ) { WgPackListHook * pHook = static_cast<WgPackListHook*>(pInserted); WgWidget * pChild = pHook->_widget(); WgSize pref = _paddedLimitedPreferredSize( pChild ); if( m_bHorizontal ) { _addToContentPreferredSize( pref.w, pref.h ); // Get entry length and breadth if( pref.h == m_contentBreadth ) pHook->m_length = pref.w; else pHook->m_length = _paddedLimitedMatchingWidth(pChild, m_contentBreadth); pHook->m_prefBreadth = pref.h; } else { _addToContentPreferredSize( pref.h, pref.w ); // Get entry length and breadth if( pref.w == m_contentBreadth ) pHook->m_length = pref.h; else pHook->m_length = _paddedLimitedMatchingHeight(pChild, m_contentBreadth); pHook->m_prefBreadth = pref.w; } m_contentLength += pHook->m_length; WgRect childGeo; _getChildGeo(childGeo,pHook); static_cast<WgPackListHook*>(pInserted)->_widget()->_onNewSize( childGeo ); // Finish up _updateChildOfsFrom( pHook ); _requestRenderChildrenFrom( pHook ); // Request render on dirty area _requestResize(); // This should preferably be done first once we have changed the method. }
void SplitPanel::_updatePreferredSize() { Size firstSz; Size secondSz; Size sz; if (m_firstChild.pWidget) firstSz = m_firstChild.pWidget->preferredSize(); if (m_secondChild.pWidget) secondSz = m_secondChild.pWidget->preferredSize(); if (m_bHorizontal) { sz.w = firstSz.w + secondSz.w + _handleThickness(); sz.h = max(firstSz.h, secondSz.h); if (m_pHandleSkin && m_pHandleSkin->preferredSize().h > sz.h) sz.h = m_pHandleSkin->preferredSize().h; } else { sz.w = max(firstSz.w, secondSz.w); sz.h = firstSz.h + secondSz.h + _handleThickness(); if (m_pHandleSkin && m_pHandleSkin->preferredSize().w > sz.w) sz.w = m_pHandleSkin->preferredSize().w; } // Take skins padding and preferred size into account if (m_pSkin) { sz += m_pSkin->contentPadding(); Size skinSz = m_pSkin->preferredSize(); if (skinSz.w > sz.w) sz.w = skinSz.w; if (skinSz.h > sz.h) sz.h = skinSz.h; } //TODO: We can't trust that same preferredSize results in same matchingHeight. We need to find a more robust optimization. // if (sz != m_preferredSize) { m_preferredSize = sz; _requestResize(); } }
void Widget::_setSkin( Skin * pSkin ) { if( !m_pSkin || !pSkin || m_pSkin->contentPadding() != pSkin->contentPadding() || m_pSkin->preferredSize() != pSkin->preferredSize() || m_pSkin->minSize() != pSkin->minSize() ) { _requestResize(); } if( pSkin && pSkin->isOpaque(m_state) ) m_bOpaque = true; else m_bOpaque = false; m_pSkin = pSkin; _requestRender(); }
void WgVolumeMeter::SetNbLEDs( int bottomSection, int middleSection, int topSection ) { if( bottomSection < 0 ) bottomSection = 0; if( middleSection < 0 ) middleSection = 0; if( topSection < 0 ) topSection = 0; if( bottomSection != m_nSectionLEDs[0] || middleSection != m_nSectionLEDs[1] || topSection != m_nSectionLEDs[2] ) { m_nSectionLEDs[0] = bottomSection; m_nSectionLEDs[1] = middleSection; m_nSectionLEDs[2] = topSection; m_nLEDs = bottomSection + middleSection + topSection; _requestResize(); _requestRender(); } }
void WgStackPanel::_onWidgetDisappeared( WgVectorHook * _pToBeRemoved ) { bool bRequestResize = false; WgStackHook * pToBeRemoved = (WgStackHook*) _pToBeRemoved; // Get dirty rectangles for all visible sections of pToBeRemoved. _onRenderRequested( pToBeRemoved ); // Update m_preferredSize, skiping pToBeRemoved WgSize preferredSize; WgStackHook * pHook = _firstHook(); while( pHook ) { if( pHook != pToBeRemoved ) { WgSize sz = pHook->_widget()->PreferredSize(); if( sz.w > preferredSize.w ) preferredSize.w = sz.w; if( sz.h > preferredSize.h ) preferredSize.h = sz.h; } pHook = pHook->_next(); } if( preferredSize != m_preferredSize ) bRequestResize = true; m_preferredSize = preferredSize; // Check if removal might affect height for current width int height = pToBeRemoved->_widget()->MatchingHeight(m_size.w); if( height >= m_size.h ) bRequestResize = true; // if( bRequestResize ) _requestResize(); }
void WgImage::SetImage( const WgSurfacePtr& pSurface, const WgRect& rect ) { if( pSurface != m_pSurface || rect != m_rect ) { bool bResize = false; if( rect.w != m_rect.w || rect.h != m_rect.h ) bResize = true; m_pSurface = pSurface; if( pSurface ) m_rect = WgRect( rect, WgRect(pSurface->Size()) ); else m_rect.Clear(); if( bResize ) _requestResize(); _requestRender(); } }
void WgImage::SetImage( const WgSurfacePtr& pSurface ) { if( pSurface != m_pSurface ) { bool bResize = false; if( pSurface->Size() != m_pSurface->Size() ) bResize = true; m_pSurface = pSurface; if( pSurface ) m_rect = pSurface->Size(); else m_rect.Clear(); if( bResize ) _requestResize(); _requestRender(); } }
void Image::setImage( const Surface_p& pSurface, const Rect& rect ) { if( pSurface != m_pSurface || rect != m_rect ) { bool bResize = false; if( rect.w != m_rect.w || rect.h != m_rect.h ) bResize = true; m_pSurface = pSurface; if( pSurface ) m_rect = Rect( rect, Rect(pSurface->size()) ); else m_rect.clear(); if( bResize ) _requestResize(); _requestRender(); } }
void Image::setImage( const Surface_p& pSurface ) { if( pSurface != m_pSurface ) { bool bResize = false; if( !pSurface || !m_pSurface || pSurface->size() != m_pSurface->size() ) bResize = true; m_pSurface = pSurface; if( pSurface ) m_rect = pSurface->size(); else m_rect.clear(); if( bResize ) _requestResize(); _requestRender(); } }
void WgStackPanel::_refreshPreferredSize() { WgSize preferredSize; WgStackHook * pHook = _firstHook(); while( pHook ) { WgSize sz = pHook->_paddedPreferredSize(); if( sz.w > preferredSize.w ) preferredSize.w = sz.w; if( sz.h > preferredSize.h ) preferredSize.h = sz.h; pHook = pHook->_next(); } if( m_preferredSize != preferredSize) { m_preferredSize = preferredSize; _requestResize(); } }