1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-11-22 00:47:13 +01:00

Define drawing function of CellularPanel, which visits nodes

This commit is contained in:
Paul Licameli
2018-11-03 00:04:50 -04:00
parent 040decf9e3
commit cb2ea25afc
12 changed files with 157 additions and 43 deletions

51
src/TrackPanelDrawable.h Normal file
View File

@@ -0,0 +1,51 @@
/**********************************************************************
Audacity: A Digital Audio Editor
TrackPanelDrawable.h
Paul Licameli
**********************************************************************/
#ifndef __AUDACITY_TRACK_PANEL_DRAWABLE__
#define __AUDACITY_TRACK_PANEL_DRAWABLE__
struct TrackPanelDrawingContext;
struct wxRect;
/// \brief Drawing interface common to cells, groups of cells, and temporary handles in CellularPanel
class 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.
virtual wxRect DrawingArea(
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