forked from Sneeds-Feed-and-Seed/sneedacity
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTrackPanelDrawable.h
58 lines (43 loc) · 1.95 KB
/
TrackPanelDrawable.h
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
/**********************************************************************
Sneedacity: A Digital Audio Editor
TrackPanelDrawable.h
Paul Licameli
**********************************************************************/
#ifndef __SNEEDACITY_TRACK_PANEL_DRAWABLE__
#define __SNEEDACITY_TRACK_PANEL_DRAWABLE__
#include <wx/gdicmn.h> // for wxRect
struct TrackPanelDrawingContext;
class wxRect;
/// \brief Drawing interface common to cells, groups of cells, and temporary handles in CellularPanel
class SNEEDACITY_DLL_API TrackPanelDrawable {
public:
virtual ~TrackPanelDrawable() = 0;
// Drawing functions of the subdivision are visited repeatedly in one
// painting if their areas (as computed by DrawingArea) intersect the
// panel area, and depending on iPass may overpaint results of previous
// passes.
// Drawing function is given the rectangle computed by DrawingArea.
// iPass counts zero-based up to some limit given to CellularPanel::Draw.
// Default implementation does nothing.
virtual void Draw(
TrackPanelDrawingContext &context, const wxRect &rect, unsigned iPass );
// For drawing purposes, a cell might require a bigger rectangle than for
// hit-test purposes, spilling over into other parts of the partition of the
// panel area.
// Default implementation returns rect unchanged.
// TrackPanelContext is passed in because sometimes a drawing context is
// needed for text extent calculations.
virtual wxRect DrawingArea(
TrackPanelDrawingContext &context,
const wxRect &rect, const wxRect &panelRect, unsigned iPass );
// Utilities for implementing DrawingArea:
static inline wxRect MaximizeWidth(
const wxRect &rect, const wxRect &panelRect ) {
return { panelRect.x, rect.y, panelRect.width, rect.height };
}
static inline wxRect MaximizeHeight(
const wxRect &rect, const wxRect &panelRect ) {
return { rect.x, panelRect.y, rect.width, panelRect.height };
}
};
#endif