Welcome to mirror list, hosted at ThFree Co, Russian Federation.

TracyTimelineItem.hpp « server - github.com/wolfpld/tracy.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: c08d911a4492f516a0f5fd6135beda2a9931a00b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#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();
    virtual void SetVisible( bool visible ) { m_visible = visible; }
    virtual bool IsVisible() const { return m_visible; }

    void SetShowFull( bool showFull ) { m_showFull = showFull; }

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