Ticket #7548: vslider.diff
File vslider.diff, 3.8 KB (added by , 13 years ago) |
---|
-
src/kits/interface/ControlLook.cpp
890 890 rightBarSide.left = sliderPosition; 891 891 } else { 892 892 sliderPosition = floorf(rect.top + 2 + (rect.Height() - 2) 893 * sliderScale);894 leftBarSide. bottom = sliderPosition - 1;895 rightBarSide. top = sliderPosition;893 * (1.0 - sliderScale)); // position is reverse of coords 894 leftBarSide.top = sliderPosition; 895 rightBarSide.bottom = sliderPosition - 1; 896 896 } 897 897 898 898 // fill the background for the corners, exclude the middle bar for now … … 1223 1223 view->SetFlags(viewFlags | B_SUBPIXEL_PRECISE); 1224 1224 view->SetLineMode(B_ROUND_CAP, B_ROUND_JOIN); 1225 1225 1226 float center = (rect.left + rect.right) / 2; 1226 float centerh = (rect.left + rect.right) / 2; 1227 float centerv = (rect.top + rect.bottom) / 2; 1227 1228 1228 1229 BShape shape; 1230 if (orientation == B_HORIZONTAL) { 1229 1231 shape.MoveTo(BPoint(rect.left + 0.5, rect.bottom + 0.5)); 1230 1232 shape.LineTo(BPoint(rect.right + 0.5, rect.bottom + 0.5)); 1231 1233 shape.LineTo(BPoint(rect.right + 0.5, rect.bottom - 1 + 0.5)); 1232 shape.LineTo(BPoint(center + 0.5, rect.top + 0.5));1234 shape.LineTo(BPoint(centerh + 0.5, rect.top + 0.5)); 1233 1235 shape.LineTo(BPoint(rect.left + 0.5, rect.bottom - 1 + 0.5)); 1236 } else { 1237 shape.MoveTo(BPoint(rect.right + 0.5, rect.top + 0.5)); 1238 shape.LineTo(BPoint(rect.right + 0.5, rect.bottom + 0.5)); 1239 shape.LineTo(BPoint(rect.right - 1 + 0.5, rect.bottom + 0.5)); 1240 shape.LineTo(BPoint( rect.left + 0.5, centerv + 0.5)); 1241 shape.LineTo(BPoint(rect.right - 1 + 0.5, rect.top + 0.5)); 1242 } 1234 1243 shape.Close(); 1235 1244 1236 1245 view->MovePenTo(BPoint(1, 1)); … … 1247 1256 1248 1257 rect.InsetBy(1, 1); 1249 1258 shape.Clear(); 1250 shape.MoveTo(BPoint(rect.left, rect.bottom + 1)); 1251 shape.LineTo(BPoint(rect.right + 1, rect.bottom + 1)); 1252 shape.LineTo(BPoint(center + 0.5, rect.top)); 1259 if (orientation == B_HORIZONTAL) { 1260 shape.MoveTo(BPoint(rect.left, rect.bottom + 1)); 1261 shape.LineTo(BPoint(rect.right + 1, rect.bottom + 1)); 1262 shape.LineTo(BPoint(centerh + 0.5, rect.top)); 1263 } else { 1264 shape.MoveTo(BPoint(rect.right+1, rect.top)); 1265 shape.LineTo(BPoint(rect.right+1, rect.bottom + 1)); 1266 shape.LineTo(BPoint( rect.left, centerv + 0.5)); 1267 } 1253 1268 shape.Close(); 1254 1269 1255 1270 BGradientLinear gradient; -
src/kits/interface/Slider.cpp
703 703 if (fOrientation == B_HORIZONTAL) 704 704 oldThumbFrame.top = BarFrame().top; 705 705 else 706 oldThumbFrame.right = BarFrame().right; 706 // Haiku triangle thumb is on the right 707 oldThumbFrame.left = BarFrame().left; 707 708 708 709 BControl::SetValueNoUpdate(value); 709 710 BRect invalid = oldThumbFrame | ThumbFrame(); … … 1445 1446 { 1446 1447 BSize preferredSize = PreferredSize(); 1447 1448 1448 if (_width) { 1449 // *_width = preferredSize.width; 1450 // NOTE: For compatibility reasons, the BSlider never shrinks 1451 // horizontally. This only affects applications which do not 1452 // use the new layout system. 1453 *_width = max_c(Bounds().Width(), preferredSize.width); 1449 if (Orientation() == B_HORIZONTAL) { 1450 if (_width) { 1451 // NOTE: For compatibility reasons, a Horixontal BSlider 1452 // never shrinks horizontally. This only affects applications 1453 // which do not use the new layout system. 1454 *_width = max_c(Bounds().Width(), preferredSize.width); 1455 } 1456 1457 if (_height) 1458 *_height = preferredSize.height; 1459 } else { 1460 if (_width) 1461 *_width = preferredSize.width; 1462 1463 if (_height) 1464 // Similarly, a Vertical BSlider never shrinks 1465 // verticall. This only affects applications which do not 1466 // use the new layout system. 1467 *_height = max_c(Bounds().Height(), preferredSize.height); 1454 1468 } 1455 1456 if (_height)1457 *_height = preferredSize.height;1458 1469 } 1459 1470 1460 1471