2016-05-07 17:00:48 +00:00
|
|
|
//
|
|
|
|
// BackedPanel.h
|
|
|
|
// Audacity
|
|
|
|
//
|
|
|
|
// Created by Paul Licameli on 5/7/16.
|
|
|
|
//
|
|
|
|
//
|
|
|
|
|
|
|
|
#ifndef __AUDACITY_BACKED_PANEL__
|
|
|
|
#define __AUDACITY_BACKED_PANEL__
|
|
|
|
|
2018-11-14 20:23:25 +00:00
|
|
|
#include <wx/dcmemory.h> // member variable
|
2019-03-30 19:06:57 +00:00
|
|
|
#include "wxPanelWrapper.h" // to inherit
|
2016-05-07 17:00:48 +00:00
|
|
|
|
2018-11-03 13:17:54 +00:00
|
|
|
|
|
|
|
/// \brief BackedPanel is for a panel that consists of a bitmap with something drawn
|
2018-12-02 14:45:40 +00:00
|
|
|
/// over it. It supports efficient repainting when the overlays change and
|
2018-11-03 13:17:54 +00:00
|
|
|
/// recreation of the bitmap when the panel size is changed.
|
2016-06-25 18:18:23 +00:00
|
|
|
class AUDACITY_DLL_API BackedPanel /* not final */ : public wxPanelWrapper {
|
2016-05-07 17:00:48 +00:00
|
|
|
public:
|
|
|
|
BackedPanel(wxWindow * parent, wxWindowID id,
|
|
|
|
const wxPoint & pos,
|
|
|
|
const wxSize & size,
|
|
|
|
long style);
|
|
|
|
|
|
|
|
~BackedPanel();
|
|
|
|
|
|
|
|
wxDC &GetBackingDC();
|
|
|
|
wxDC &GetBackingDCForRepaint();
|
|
|
|
void ResizeBacking();
|
|
|
|
void RepairBitmap(wxDC &dc, wxCoord x, wxCoord y, wxCoord width, wxCoord height);
|
|
|
|
void DisplayBitmap(wxDC &dc);
|
|
|
|
void OnSize(wxSizeEvent & event);
|
|
|
|
|
|
|
|
private:
|
|
|
|
std::unique_ptr<wxBitmap> mBacking;
|
|
|
|
wxMemoryDC mBackingDC;
|
|
|
|
bool mResizeBacking {};
|
|
|
|
|
|
|
|
DECLARE_EVENT_TABLE()
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|