Audacity  3.0.3
TrackPanelDrawable.h
Go to the documentation of this file.
1 /**********************************************************************
2 
3 Audacity: A Digital Audio Editor
4 
5 TrackPanelDrawable.h
6 
7 Paul 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 
19 class wxRect;
20 
22 class AUDACITY_DLL_API TrackPanelDrawable {
23 public:
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(
43  TrackPanelDrawingContext &context,
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
TrackPanelDrawingContext
Definition: TrackPanelDrawingContext.h:22
TrackPanelDrawable::MaximizeWidth
static wxRect MaximizeWidth(const wxRect &rect, const wxRect &panelRect)
Definition: TrackPanelDrawable.h:47
TrackPanelDrawable::MaximizeHeight
static wxRect MaximizeHeight(const wxRect &rect, const wxRect &panelRect)
Definition: TrackPanelDrawable.h:52
TrackPanelDrawable
Drawing interface common to cells, groups of cells, and temporary handles in CellularPanel.
Definition: TrackPanelDrawable.h:22