2022-09-03 14:34:53 +00:00
|
|
|
#ifndef __TRACYTIMELINEITEM_HPP__
|
|
|
|
#define __TRACYTIMELINEITEM_HPP__
|
|
|
|
|
2023-03-14 01:02:21 +00:00
|
|
|
#include <assert.h>
|
2022-09-03 14:34:53 +00:00
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
#include "imgui.h"
|
|
|
|
|
|
|
|
namespace tracy
|
|
|
|
{
|
|
|
|
|
2023-03-18 16:03:23 +00:00
|
|
|
struct TimelineContext;
|
2022-09-03 14:34:53 +00:00
|
|
|
class View;
|
|
|
|
class Worker;
|
|
|
|
|
|
|
|
class TimelineItem
|
|
|
|
{
|
|
|
|
public:
|
2023-03-14 01:02:21 +00:00
|
|
|
TimelineItem( View& view, Worker& worker, const void* key, bool wantPreprocess );
|
2022-09-03 14:34:53 +00:00
|
|
|
virtual ~TimelineItem() = default;
|
|
|
|
|
2023-03-14 00:54:21 +00:00
|
|
|
// draws the timeline item and also updates the next frame height value
|
2023-03-18 15:07:56 +00:00
|
|
|
void Draw( bool firstFrame, const TimelineContext& ctx, int yOffset );
|
2022-09-03 14:34:53 +00:00
|
|
|
|
2023-03-14 01:02:21 +00:00
|
|
|
bool WantPreprocess() const { return m_wantPreprocess; }
|
2023-03-14 01:11:33 +00:00
|
|
|
virtual void Preprocess( const TimelineContext& ctx ) { assert( false ); }
|
2023-03-14 01:02:21 +00:00
|
|
|
|
2022-09-03 14:34:53 +00:00
|
|
|
void VisibilityCheckbox();
|
2022-09-04 12:22:12 +00:00
|
|
|
virtual void SetVisible( bool visible ) { m_visible = visible; }
|
|
|
|
virtual bool IsVisible() const { return m_visible; }
|
2022-09-03 14:34:53 +00:00
|
|
|
|
2022-09-05 18:29:45 +00:00
|
|
|
void SetShowFull( bool showFull ) { m_showFull = showFull; }
|
|
|
|
|
2023-01-27 19:00:05 +00:00
|
|
|
// returns 0 instead of the correct value for the first frame
|
|
|
|
int GetNextFrameHeight() const { return m_height; }
|
|
|
|
|
2023-01-27 19:00:05 +00:00
|
|
|
const void* GetKey() const { return m_key; }
|
|
|
|
|
2022-09-03 14:34:53 +00:00
|
|
|
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 {};
|
2023-03-18 15:07:56 +00:00
|
|
|
virtual void HeaderExtraContents( const TimelineContext& ctx, int offset, float labelWidth ) {};
|
2022-09-03 14:34:53 +00:00
|
|
|
|
|
|
|
virtual int64_t RangeBegin() const = 0;
|
|
|
|
virtual int64_t RangeEnd() const = 0;
|
|
|
|
|
2023-03-18 15:07:56 +00:00
|
|
|
virtual bool DrawContents( const TimelineContext& ctx, int& offset ) = 0;
|
2022-09-03 21:24:00 +00:00
|
|
|
virtual void DrawOverlay( const ImVec2& ul, const ImVec2& dr ) {}
|
2022-09-03 21:17:57 +00:00
|
|
|
|
|
|
|
virtual bool IsEmpty() const { return false; }
|
|
|
|
|
2022-09-03 21:35:35 +00:00
|
|
|
bool m_visible;
|
|
|
|
bool m_showFull;
|
|
|
|
|
2022-09-03 14:34:53 +00:00
|
|
|
private:
|
2023-01-27 19:00:05 +00:00
|
|
|
void AdjustThreadHeight( bool firstFrame, int yBegin, int yEnd );
|
2022-09-03 14:34:53 +00:00
|
|
|
|
|
|
|
int m_height;
|
2023-03-14 01:02:21 +00:00
|
|
|
bool m_wantPreprocess;
|
2022-09-03 14:34:53 +00:00
|
|
|
|
2023-01-27 19:00:05 +00:00
|
|
|
const void* m_key;
|
|
|
|
|
2022-09-03 14:34:53 +00:00
|
|
|
protected:
|
|
|
|
View& m_view;
|
2022-09-03 16:34:11 +00:00
|
|
|
Worker& m_worker;
|
2022-09-03 14:34:53 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|