MCPcopy Create free account
hub / github.com/SpartanJ/eepp / updateScrollBar

Method updateScrollBar

src/eepp/ui/uicodeeditor.cpp:2137–2175  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2135}
2136
2137void UICodeEditor::updateScrollBar() {
2138 Int64 notVisibleLineCount = (Int64)getTotalVisibleLines() - (Int64)getViewPortLineCount().y;
2139
2140 mHScrollBar->setEnabled( false );
2141 mHScrollBar->setVisible( false );
2142
2143 mVScrollBar->setPixelsSize( mVScrollBar->getPixelsSize().getWidth(), editorHeight() );
2144
2145 if ( mHorizontalScrollBarEnabled ) {
2146 mHScrollBar->setPixelsPosition( mPaddingPx.Left,
2147 mSize.getHeight() - mPaddingPx.Bottom -
2148 mHScrollBar->getPixelsSize().getHeight() );
2149 mHScrollBar->setPixelsSize( editorWidth() -
2150 ( mVerticalScrollBarEnabled && notVisibleLineCount > 0
2151 ? mVScrollBar->getPixelsSize().getWidth()
2152 : 0 ),
2153 mHScrollBar->getPixelsSize().getHeight() );
2154 Float viewPortWidth = getViewportWidth();
2155 mHScrollBar->setPageStep( viewPortWidth / mLongestLineWidth );
2156 mHScrollBar->setClickStep( 0.2f );
2157 bool showHScroll = mLongestLineWidth > viewPortWidth && !mDocView.isWrapEnabled();
2158 mHScrollBar->setEnabled( showHScroll );
2159 mHScrollBar->setVisible( showHScroll );
2160 }
2161
2162 mVScrollBar->setPixelsPosition( mSize.getWidth() - mVScrollBar->getPixelsSize().getWidth(),
2163 mPaddingPx.Top );
2164 mVScrollBar->setPageStep( getViewPortLineCount().y / (float)mDocView.getVisibleLinesCount() );
2165 mVScrollBar->setClickStep( 0.2f );
2166 bool wasVScrollVisible = mVScrollBar->isVisible();
2167 bool showVScroll = mVerticalScrollBarEnabled && notVisibleLineCount > 0;
2168 mVScrollBar->setEnabled( showVScroll );
2169 mVScrollBar->setVisible( showVScroll );
2170
2171 if ( wasVScrollVisible != showVScroll && mDocView.isWrapEnabled() )
2172 invalidateLineWrapMaxWidth( false );
2173
2174 setScrollY( mScroll.y );
2175}
2176
2177void UICodeEditor::goToLine( const TextPosition& position, bool centered, bool forceExactPosition,
2178 bool scrollX ) {

Callers

nothing calls this directly

Calls 12

setPixelsPositionMethod · 0.80
isWrapEnabledMethod · 0.80
setEnabledMethod · 0.45
setVisibleMethod · 0.45
setPixelsSizeMethod · 0.45
getWidthMethod · 0.45
getPixelsSizeMethod · 0.45
getHeightMethod · 0.45
setPageStepMethod · 0.45
setClickStepMethod · 0.45
getVisibleLinesCountMethod · 0.45
isVisibleMethod · 0.45

Tested by

no test coverage detected