2 * Copyright 2009, Axel Dörfler, axeld@pinc-software.de.
3 * Distributed under the terms of the MIT License.
7 #include "PositionToolTip.h"
11 #include <StringView.h>
13 #include "DurationToString.h"
16 class PositionToolTip::PositionView
: public BStringView
{
20 BStringView("position", ""),
26 virtual ~PositionView()
30 virtual void AttachedToWindow()
32 BStringView::AttachedToWindow();
37 void Update(bigtime_t position
, bigtime_t duration
)
45 if (position
== fPosition
&& duration
== fDuration
) {
54 char positionText
[32];
55 duration_to_string(fPosition
, positionText
, sizeof(positionText
));
57 char durationText
[32];
58 duration_to_string(fDuration
, durationText
, sizeof(durationText
));
61 snprintf(text
, sizeof(text
), "%s / %s", positionText
, durationText
);
76 PositionToolTip::PositionToolTip()
78 fView
= new PositionView();
82 PositionToolTip::~PositionToolTip()
89 PositionToolTip::View() const
96 PositionToolTip::Update(bigtime_t position
, bigtime_t duration
)
98 fView
->Update(position
, duration
);