Exemple #1
0
// Draw
void
PropertyItemView::Draw(BRect updateRect)
{
	const Property* property = GetProperty();
	if (property && fParent) {
		BRect b(Bounds());

		// just draw background and label
		rgb_color labelColor = LowColor();
		if (fEnabled)
			labelColor = tint_color(labelColor, B_DARKEN_MAX_TINT);
		else
			labelColor = tint_color(labelColor, B_DISABLED_LABEL_TINT);
		
		SetHighColor(labelColor);
		BFont font;
		GetFont(&font);
		
		BString truncated(name_for_id(property->Identifier()));
		font.TruncateString(&truncated, B_TRUNCATE_MIDDLE, fLabelWidth - 10.0);

		font_height fh;
		font.GetHeight(&fh);

		FillRect(BRect(b.left, b.top, b.left + fLabelWidth, b.bottom), B_SOLID_LOW);
		DrawString(truncated.String(), BPoint(b.left + 5.0,
											  floorf(b.top + b.Height() / 2.0
												  		   + fh.ascent / 2.0)));

		// draw a "separator" line behind the label
		SetHighColor(tint_color(LowColor(), B_DARKEN_1_TINT));
		StrokeLine(BPoint(b.left + fLabelWidth - 1.0, b.top),
				   BPoint(b.left + fLabelWidth - 1.0, b.bottom), B_SOLID_HIGH);
	}
}
Exemple #2
0
// PropertyChanged
void
PropertyListView::PropertyChanged(const Property* previous,
								  const Property* current)
{
	printf("PropertyListView::PropertyChanged(%s)\n",
		name_for_id(current->Identifier()));
}
Exemple #3
0
// PreferredLabelWidth
float
PropertyItemView::PreferredLabelWidth() const
{
	float width = 0.0;
	if (const Property* property = GetProperty())
		width = ceilf(StringWidth(name_for_id(property->Identifier())) + 10.0);
	return width;
}
// GetName
void
SetPropertiesCommand::GetName(BString& name)
{
	if (fOldProperties->CountProperties() > 1) {
		if (fObjectCount > 1)
			name << B_TRANSLATE("Multi Paste Properties");
		else
			name << B_TRANSLATE("Paste Properties");
	} else {
		BString property = name_for_id(
			fOldProperties->PropertyAt(0)->Identifier());
		if (fObjectCount > 1)
			name << B_TRANSLATE_WITH_CONTEXT("Multi Set ",
				"Multi Set (property name)") << property;
		else
			name << B_TRANSLATE_WITH_CONTEXT("Set ", "Set (property name)")
				 << property;
	}
}