MCPcopy Create free account
hub / github.com/NetHack/NetHack / maxXOffset

Method maxXOffset

outdated/win/Qt3/qt3tableview.cpp:2081–2115  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2079*/
2080
2081int QtTableView::maxXOffset()
2082{
2083 int tw = totalWidth();
2084 int maxOffs;
2085 if ( testTableFlags(Tbl_scrollLastHCell) ) {
2086 if ( nCols != 1)
2087 maxOffs = tw - ( cellW ? cellW : cellWidth( nCols - 1 ) );
2088 else
2089 maxOffs = tw - viewWidth();
2090 } else {
2091 if ( testTableFlags(Tbl_snapToHGrid) ) {
2092 if ( cellW ) {
2093 maxOffs = tw - (viewWidth()/cellW)*cellW;
2094 } else {
2095 int goal = tw - viewWidth();
2096 int pos = tw;
2097 int nextCol = nCols - 1;
2098 int nextCellWidth = cellWidth( nextCol );
2099 while( nextCol > 0 && pos > goal + nextCellWidth ) {
2100 pos -= nextCellWidth;
2101 nextCellWidth = cellWidth( --nextCol );
2102 }
2103 if ( goal + nextCellWidth == pos )
2104 maxOffs = goal;
2105 else if ( goal < pos )
2106 maxOffs = pos;
2107 else
2108 maxOffs = 0;
2109 }
2110 } else {
2111 maxOffs = tw - viewWidth();
2112 }
2113 }
2114 return maxOffs > 0 ? maxOffs : 0;
2115}
2116
2117
2118/*!

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected