Audacity 3.2.0
TrackPanelDrawable.h
Go to the documentation of this file.
1/**********************************************************************
2
3Audacity: A Digital Audio Editor
4
5TrackPanelDrawable.h
6
7Paul Licameli
8
9**********************************************************************/
10
11#ifndef __AUDACITY_TRACK_PANEL_DRAWABLE__
12#define __AUDACITY_TRACK_PANEL_DRAWABLE__
13
14
15
16#include <wx/gdicmn.h> // for wxRect
17
19class wxRect;
20
22class AUDACITY_DLL_API TrackPanelDrawable {
23public:
24 virtual ~TrackPanelDrawable() = 0;
25
26 // Drawing functions of the subdivision are visited repeatedly in one
27 // painting if their areas (as computed by DrawingArea) intersect the
28 // panel area, and depending on iPass may overpaint results of previous
29 // passes.
30 // Drawing function is given the rectangle computed by DrawingArea.
31 // iPass counts zero-based up to some limit given to CellularPanel::Draw.
32 // Default implementation does nothing.
33 virtual void Draw(
34 TrackPanelDrawingContext &context, const wxRect &rect, unsigned iPass );
35
36 // For drawing purposes, a cell might require a bigger rectangle than for
37 // hit-test purposes, spilling over into other parts of the partition of the
38 // panel area.
39 // Default implementation returns rect unchanged.
40 // TrackPanelContext is passed in because sometimes a drawing context is
41 // needed for text extent calculations.
42 virtual wxRect DrawingArea(
44 const wxRect &rect, const wxRect &panelRect, unsigned iPass );
45
46 // Utilities for implementing DrawingArea:
47 static inline wxRect MaximizeWidth(
48 const wxRect &rect, const wxRect &panelRect ) {
49 return { panelRect.x, rect.y, panelRect.width, rect.height };
50 }
51
52 static inline wxRect MaximizeHeight(
53 const wxRect &rect, const wxRect &panelRect ) {
54 return { rect.x, panelRect.y, rect.width, panelRect.height };
55 }
56};
57
58#endif
Drawing interface common to cells, groups of cells, and temporary handles in CellularPanel.
static wxRect MaximizeHeight(const wxRect &rect, const wxRect &panelRect)
static wxRect MaximizeWidth(const wxRect &rect, const wxRect &panelRect)