libroot/posix/stdio: Remove unused portions.
[haiku.git] / src / apps / debugger / user_interface / gui / value / TableCellFormattedValueRenderer.cpp
blob5c31c64b8257940c86ce5c72e376ea2394871b9b
1 /*
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.
5 */
8 #include "TableCellFormattedValueRenderer.h"
10 #include <String.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();
31 Settings*
32 TableCellFormattedValueRenderer::GetSettings() const
34 return fValueFormatter->GetSettings();
38 void
39 TableCellFormattedValueRenderer::RenderValue(Value* value, bool valueChanged,
40 BRect rect, BView* targetView)
42 BString output;
44 if (fValueFormatter->FormatValue(value, output) != B_OK)
45 return;
47 // render
48 TableCellValueRendererUtils::DrawString(targetView, rect, output,
49 valueChanged, B_ALIGN_RIGHT, true);
53 float
54 TableCellFormattedValueRenderer::PreferredValueWidth(Value* value, BView* targetView)
56 BString output;
58 if (fValueFormatter->FormatValue(value, output) != B_OK)
59 return 0;
61 // render
62 return TableCellValueRendererUtils::PreferredStringWidth(targetView,
63 output);