Audacity 3.2.0
Classes | Public Types | Public Member Functions | Public Attributes | List of all members
RulerPanel Class Referencefinal

RulerPanel class allows you to work with a Ruler like any other wxWindow. More...

#include <RulerPanel.h>

Inheritance diagram for RulerPanel:
[legend]
Collaboration diagram for RulerPanel:
[legend]

Classes

struct  Options
 

Public Types

using Range = std::pair< double, double >
 

Public Member Functions

 RulerPanel (wxWindow *parent, wxWindowID id, wxOrientation orientation, const wxSize &bounds, const Range &range, const RulerFormat &format, const TranslatableString &units, const Options &options={}, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize)
 
 ~RulerPanel ()
 
void DoSetSize (int x, int y, int width, int height, int sizeFlags=wxSIZE_AUTO) override
 
void OnErase (wxEraseEvent &evt)
 
void OnPaint (wxPaintEvent &evt)
 
void OnSize (wxSizeEvent &evt)
 
void SetTickColour (wxColour &c)
 
bool AcceptsFocus () const override
 
bool AcceptsFocusFromKeyboard () const override
 
- Public Member Functions inherited from wxPanelWrapper
 wxPanelWrapper ()
 
 wxPanelWrapper (wxWindow *parent, wxWindowID winid=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL|wxNO_BORDER, const TranslatableString &name=XO("Panel"))
 
bool Create (wxWindow *parent, wxWindowID winid=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL|wxNO_BORDER, const TranslatableString &name=XO("Panel"))
 
void SetLabel (const TranslatableString &label)
 
void SetName (const TranslatableString &name)
 
void SetToolTip (const TranslatableString &toolTip)
 
void SetName ()
 
- Public Member Functions inherited from wxTabTraversalWrapper< wxPanel >
 wxTabTraversalWrapper (Args &&... args)
 
 wxTabTraversalWrapper (const wxTabTraversalWrapper &)=delete
 
 wxTabTraversalWrapper (wxTabTraversalWrapper &&)=delete
 
wxTabTraversalWrapperoperator= (const wxTabTraversalWrapper &)=delete
 
wxTabTraversalWrapperoperator= (wxTabTraversalWrapper &&)=delete
 

Public Attributes

Ruler ruler
 

Detailed Description

RulerPanel class allows you to work with a Ruler like any other wxWindow.

Definition at line 19 of file RulerPanel.h.

Member Typedef Documentation

◆ Range

using RulerPanel::Range = std::pair<double, double>

Definition at line 23 of file RulerPanel.h.

Constructor & Destructor Documentation

◆ RulerPanel()

RulerPanel::RulerPanel ( wxWindow *  parent,
wxWindowID  id,
wxOrientation  orientation,
const wxSize &  bounds,
const Range range,
const RulerFormat format,
const TranslatableString units,
const Options options = {},
const wxPoint &  pos = wxDefaultPosition,
const wxSize &  size = wxDefaultSize 
)

Definition at line 35 of file RulerPanel.cpp.

45 : wxPanelWrapper(parent, id, pos, size)
46 , ruler{
47 [&]() -> const RulerUpdater& {
48 if (options.log)
50 else
52 }(),
53 format
54 }
55{
56 ruler.SetBounds( 0, 0, bounds.x, bounds.y );
57 ruler.SetOrientation(orientation);
58 ruler.SetRange( range.first, range.second );
59 ruler.SetUnits(units);
60 ruler.SetFlip(options.flip);
61 ruler.SetLabelEdges(options.labelEdges);
62 ruler.mbTicksAtExtremes = options.ticksAtExtremes;
63 if (orientation == wxVERTICAL) {
64 wxCoord w;
65 ruler.GetMaxSize(&w, NULL);
66 SetMinSize(wxSize(w, 150)); // height needed for wxGTK
67 }
68 else if (orientation == wxHORIZONTAL) {
69 wxCoord h;
70 ruler.GetMaxSize(NULL, &h);
71 SetMinSize(wxSize(wxDefaultCoord, h));
72 }
73 if (options.hasTickColour)
74 ruler.SetTickColour( options.tickColour );
75}
static const LinearUpdater & Instance()
static const LogarithmicUpdater & Instance()
void SetTickColour(const wxColour &colour)
Definition: Ruler.h:135
void SetFlip(bool flip)
Definition: Ruler.cpp:192
void SetOrientation(int orient)
Definition: Ruler.cpp:141
void SetLabelEdges(bool labelEdges)
Definition: Ruler.cpp:179
bool mbTicksAtExtremes
Definition: Ruler.h:149
void GetMaxSize(wxCoord *width, wxCoord *height)
Definition: Ruler.cpp:612
void SetBounds(int left, int top, int right, int bottom)
Definition: Ruler.cpp:304
void SetUnits(const TranslatableString &units)
Definition: Ruler.cpp:120
void SetRange(double min, double max)
Definition: Ruler.cpp:152
Ruler ruler
Definition: RulerPanel.h:79
Used to update a Ruler.
Definition: RulerUpdater.h:58

References anonymous_namespace{ExportPCM.cpp}::format, LinearUpdater::Instance(), and LogarithmicUpdater::Instance().

Here is the call graph for this function:

◆ ~RulerPanel()

RulerPanel::~RulerPanel ( )

Definition at line 77 of file RulerPanel.cpp.

78{
79}

Member Function Documentation

◆ AcceptsFocus()

bool RulerPanel::AcceptsFocus ( ) const
inlineoverride

Definition at line 73 of file RulerPanel.h.

73{ return false; }

◆ AcceptsFocusFromKeyboard()

bool RulerPanel::AcceptsFocusFromKeyboard ( ) const
inlineoverride

Definition at line 75 of file RulerPanel.h.

75{ return false; }

◆ DoSetSize()

void RulerPanel::DoSetSize ( int  x,
int  y,
int  width,
int  height,
int  sizeFlags = wxSIZE_AUTO 
)
override

Definition at line 106 of file RulerPanel.cpp.

109{
110 wxPanelWrapper::DoSetSize(x, y, width, height, sizeFlags);
111
112 int w, h;
113 GetClientSize(&w, &h);
114
115 ruler.SetBounds(0, 0, w-1, h-1);
116}

References ruler, and Ruler::SetBounds().

Here is the call graph for this function:

◆ OnErase()

void RulerPanel::OnErase ( wxEraseEvent &  evt)

Definition at line 81 of file RulerPanel.cpp.

82{
83 // Ignore it to prevent flashing
84}

◆ OnPaint()

void RulerPanel::OnPaint ( wxPaintEvent &  evt)

Definition at line 86 of file RulerPanel.cpp.

87{
88 wxPaintDC dc(this);
89
90#if defined(__WXMSW__)
91 dc.Clear();
92#endif
93
94 ruler.Draw(dc);
95}
void Draw(wxDC &dc) const
Definition: Ruler.cpp:441

References Ruler::Draw(), and ruler.

Here is the call graph for this function:

◆ OnSize()

void RulerPanel::OnSize ( wxSizeEvent &  evt)

Definition at line 97 of file RulerPanel.cpp.

98{
99 Refresh();
100}

◆ SetTickColour()

void RulerPanel::SetTickColour ( wxColour &  c)
inline

Definition at line 70 of file RulerPanel.h.

70{ ruler.SetTickColour( c );}

References anonymous_namespace{TimeTrackVRulerControls.cpp}::ruler(), and Ruler::SetTickColour().

Here is the call graph for this function:

Member Data Documentation

◆ ruler

Ruler RulerPanel::ruler

The documentation for this class was generated from the following files: