void BSlider::_InitBarColor() { if (be_control_look != NULL) { SetBarColor(be_control_look->SliderBarColor( ui_color(B_PANEL_BACKGROUND_COLOR))); } else { SetBarColor(tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), B_DARKEN_4_TINT)); } UseFillColor(false, NULL); }
// constructor VolumeSlider::VolumeSlider(const char* name, int32 minValue, int32 maxValue, int32 snapValue, BMessage* message) : BSlider(name, NULL, NULL, minValue, maxValue, B_HORIZONTAL, B_BLOCK_THUMB), fMuted(false), fSnapValue(snapValue), fSnapping(false) { SetModificationMessage(message); UseFillColor(true, &kGreen); SetBarThickness(PreferredBarThickness()); }
void VolumeSlider::SetMuted(bool mute) { if (mute == fMuted) return; fMuted = mute; rgb_color fillColor = kGreen; if (fMuted) { fillColor = tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), B_DARKEN_2_TINT); } UseFillColor(true, &fillColor); Invalidate(); }
SeekSlider::SeekSlider(const char* name, BMessage* message, int32 minValue, int32 maxValue) : BSlider(name, NULL, NULL, minValue, maxValue, B_HORIZONTAL, B_TRIANGLE_THUMB), fTracking(false), fLastTrackTime(0), fDisabledString(""), fScale(0.0f) { BFont font(be_plain_font); font.SetSize(9.0); SetFont(&font); SetSymbolScale(1.0); rgb_color fillColor = tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), B_DARKEN_3_TINT); UseFillColor(true, &fillColor); SetModificationMessage(message); }
SizeSlider::SizeSlider(const char* name, const char* label, BMessage* message, int32 minValue, int32 maxValue) : BSlider(name, label, message, minValue, maxValue, B_HORIZONTAL, B_TRIANGLE_THUMB), fStartOffset(minValue), fEndOffset(maxValue), fMaxPartitionSize(maxValue - minValue) { rgb_color fillColor = ui_color(B_CONTROL_HIGHLIGHT_COLOR); UseFillColor(true, &fillColor); char minString[64]; char maxString[64]; snprintf(minString, sizeof(minString), B_TRANSLATE("Offset: %ld MB"), fStartOffset); snprintf(maxString, sizeof(maxString), B_TRANSLATE("End: %ld MB"), fEndOffset); SetLimitLabels(minString, maxString); }
APPosSlider::APPosSlider(BRect frame, BMessage *message, uint32 resizingMode, uint32 flags) : BSlider(frame, NULL, NULL, message, 0, 99, B_BLOCK_THUMB, resizingMode, flags) { // Set fill color UseFillColor(true, &LightBlue); }
BSlider::BSlider(BMessage *archive) : BControl(archive) { fModificationMessage = NULL; if (archive->HasMessage("_mod_msg")) { BMessage* message = new BMessage; archive->FindMessage("_mod_msg", message); SetModificationMessage(message); } if (archive->FindInt32("_sdelay", &fSnoozeAmount) != B_OK) SetSnoozeAmount(20000); rgb_color color; if (archive->FindInt32("_fcolor", (int32 *)&color) == B_OK) UseFillColor(true, &color); else UseFillColor(false); int32 orient; if (archive->FindInt32("_orient", &orient) == B_OK) fOrientation = (orientation)orient; else fOrientation = B_HORIZONTAL; fMinLimitLabel = NULL; fMaxLimitLabel = NULL; const char* minlbl = NULL; const char* maxlbl = NULL; archive->FindString("_minlbl", &minlbl); archive->FindString("_maxlbl", &maxlbl); SetLimitLabels(minlbl, maxlbl); if (archive->FindInt32("_min", &fMinValue) != B_OK) fMinValue = 0; if (archive->FindInt32("_max", &fMaxValue) != B_OK) fMaxValue = 100; if (archive->FindInt32("_incrementvalue", &fKeyIncrementValue) != B_OK) fKeyIncrementValue = 1; if (archive->FindInt32("_hashcount", &fHashMarkCount) != B_OK) fHashMarkCount = 11; int16 hashloc; if (archive->FindInt16("_hashloc", &hashloc) == B_OK) fHashMarks = (hash_mark_location)hashloc; else fHashMarks = B_HASH_MARKS_NONE; int16 sstyle; if (archive->FindInt16("_sstyle", &sstyle) == B_OK) fStyle = (thumb_style)sstyle; else fStyle = B_BLOCK_THUMB; if (archive->FindInt32("_bcolor", (int32 *)&color) != B_OK) color = tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), B_DARKEN_4_TINT); SetBarColor(color); float bthickness; if (archive->FindFloat("_bthickness", &bthickness) == B_OK) fBarThickness = bthickness; else fBarThickness = 6.0f; _InitObject(); }