2 * Copyright 2014-2015, Rene Gollent, rene@gollent.com.
3 * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
4 * Distributed under the terms of the MIT License.
8 #include "TableCellFormattedValueRenderer.h"
12 #include "TableCellValueRendererUtils.h"
13 #include "ValueFormatter.h"
16 TableCellFormattedValueRenderer::TableCellFormattedValueRenderer(
17 ValueFormatter
* formatter
)
19 fValueFormatter(formatter
)
21 fValueFormatter
->AcquireReference();
25 TableCellFormattedValueRenderer::~TableCellFormattedValueRenderer()
27 fValueFormatter
->ReleaseReference();
32 TableCellFormattedValueRenderer::GetSettings() const
34 return fValueFormatter
->GetSettings();
39 TableCellFormattedValueRenderer::RenderValue(Value
* value
, bool valueChanged
,
40 BRect rect
, BView
* targetView
)
44 if (fValueFormatter
->FormatValue(value
, output
) != B_OK
)
48 TableCellValueRendererUtils::DrawString(targetView
, rect
, output
,
49 valueChanged
, B_ALIGN_RIGHT
, true);
54 TableCellFormattedValueRenderer::PreferredValueWidth(Value
* value
, BView
* targetView
)
58 if (fValueFormatter
->FormatValue(value
, output
) != B_OK
)
62 return TableCellValueRendererUtils::PreferredStringWidth(targetView
,