mirror of
https://github.com/wolfpld/tracy
synced 2025-05-01 05:03:53 +00:00
Note that this will likely work only when loading existing traces. In live captures the thread name may not have yet been retrieved at the point when timeline item insertion occurs, which will prevent the check from succeeding.
60 lines
1.5 KiB
C++
60 lines
1.5 KiB
C++
#ifndef __TRACYTIMELINEITEM_HPP__
|
|
#define __TRACYTIMELINEITEM_HPP__
|
|
|
|
#include <stdint.h>
|
|
|
|
#include "imgui.h"
|
|
|
|
namespace tracy
|
|
{
|
|
|
|
class View;
|
|
class Worker;
|
|
|
|
class TimelineItem
|
|
{
|
|
public:
|
|
TimelineItem( View& view, Worker& worker );
|
|
virtual ~TimelineItem() = default;
|
|
|
|
void Draw( bool firstFrame, double pxns, int& offset, const ImVec2& wpos, bool hover, float yMin, float yMax );
|
|
|
|
void VisibilityCheckbox();
|
|
void SetVisible( bool visible ) { m_visible = visible; }
|
|
|
|
protected:
|
|
virtual uint32_t HeaderColor() const = 0;
|
|
virtual uint32_t HeaderColorInactive() const = 0;
|
|
virtual uint32_t HeaderLineColor() const = 0;
|
|
virtual const char* HeaderLabel() const = 0;
|
|
|
|
virtual void HeaderTooltip( const char* label ) const {};
|
|
virtual void HeaderExtraContents( int offset, const ImVec2& wpos, float labelWidth, double pxns, bool hover ) {};
|
|
|
|
virtual int64_t RangeBegin() const = 0;
|
|
virtual int64_t RangeEnd() const = 0;
|
|
|
|
virtual bool DrawContents( double pxns, int& offset, const ImVec2& wpos, bool hover, float yMin, float yMax ) = 0;
|
|
virtual void DrawOverlay( const ImVec2& ul, const ImVec2& dr ) {}
|
|
|
|
virtual bool IsEmpty() const { return false; }
|
|
|
|
bool m_visible;
|
|
bool m_showFull;
|
|
|
|
private:
|
|
void AdjustThreadHeight( bool firstFrame, int oldOffset, int& offset );
|
|
float AdjustThreadPosition( float wy, int& offset );
|
|
|
|
int m_height;
|
|
int m_offset;
|
|
|
|
protected:
|
|
View& m_view;
|
|
Worker& m_worker;
|
|
};
|
|
|
|
}
|
|
|
|
#endif
|