Audacity 3.2.0
Public Member Functions | Private Member Functions | Private Attributes | List of all members
SashLine Class Reference
Inheritance diagram for SashLine:
[legend]
Collaboration diagram for SashLine:
[legend]

Public Member Functions

 SashLine (wxWindow *parent, wxWindowID id, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize)
 
void SetSplitterWindow (wxSplitterWindow *window)
 
bool AcceptsFocus () const override
 

Private Member Functions

void OnMouseCaptureLost (wxMouseCaptureLostEvent &event)
 
void OnMouseDown (wxMouseEvent &evt)
 
void OnMouseUp (wxMouseEvent &evt)
 
void OnMove (wxMouseEvent &evt)
 
void OnPaint (wxPaintEvent &)
 

Private Attributes

wxWeakRef< wxSplitterWindow > mSplitter
 
bool mDrag {false}
 

Detailed Description

Definition at line 1496 of file RealtimeEffectPanel.cpp.

Constructor & Destructor Documentation

◆ SashLine()

SashLine::SashLine ( wxWindow *  parent,
wxWindowID  id,
const wxPoint &  pos = wxDefaultPosition,
const wxSize &  size = wxDefaultSize 
)
inline

Definition at line 1501 of file RealtimeEffectPanel.cpp.

1505 : wxWindow(parent, id, pos, size, wxNO_BORDER, wxEmptyString)
1506 {
1507 wxWindow::SetBackgroundStyle(wxBG_STYLE_PAINT);
1508 SetCursor(wxCursor(wxCURSOR_SIZENS));
1509
1510 Bind(wxEVT_LEFT_DOWN, &SashLine::OnMouseDown, this);
1511 Bind(wxEVT_LEFT_UP, &SashLine::OnMouseUp, this);
1512 Bind(wxEVT_MOTION, &SashLine::OnMove, this);
1513 Bind(wxEVT_MOUSE_CAPTURE_LOST, &SashLine::OnMouseCaptureLost, this);
1514 Bind(wxEVT_PAINT, &SashLine::OnPaint, this);
1515 }
void OnPaint(wxPaintEvent &)
void OnMouseCaptureLost(wxMouseCaptureLostEvent &event)
void OnMove(wxMouseEvent &evt)
void OnMouseUp(wxMouseEvent &evt)
void OnMouseDown(wxMouseEvent &evt)

References OnMouseCaptureLost(), OnMouseDown(), OnMouseUp(), OnMove(), and OnPaint().

Here is the call graph for this function:

Member Function Documentation

◆ AcceptsFocus()

bool SashLine::AcceptsFocus ( ) const
inlineoverride

Definition at line 1522 of file RealtimeEffectPanel.cpp.

1522{ return false; }

◆ OnMouseCaptureLost()

void SashLine::OnMouseCaptureLost ( wxMouseCaptureLostEvent &  event)
inlineprivate

Definition at line 1526 of file RealtimeEffectPanel.cpp.

1527 {
1528 mDrag = false;
1529 }

References mDrag.

Referenced by SashLine().

Here is the caller graph for this function:

◆ OnMouseDown()

void SashLine::OnMouseDown ( wxMouseEvent &  evt)
inlineprivate

Definition at line 1531 of file RealtimeEffectPanel.cpp.

1532 {
1533 if(!mSplitter)
1534 return;
1535 CaptureMouse();
1536 mDrag = true;
1537 }
wxWeakRef< wxSplitterWindow > mSplitter

References mDrag, and mSplitter.

Referenced by SashLine().

Here is the caller graph for this function:

◆ OnMouseUp()

void SashLine::OnMouseUp ( wxMouseEvent &  evt)
inlineprivate

Definition at line 1539 of file RealtimeEffectPanel.cpp.

1540 {
1541 mDrag = false;
1542 ReleaseMouse();
1543 }

References mDrag.

Referenced by SashLine().

Here is the caller graph for this function:

◆ OnMove()

void SashLine::OnMove ( wxMouseEvent &  evt)
inlineprivate

Definition at line 1545 of file RealtimeEffectPanel.cpp.

1546 {
1547 if(!mDrag || !mSplitter)
1548 {
1549 evt.Skip();
1550 return;
1551 }
1552 const auto pos = mSplitter->ScreenToClient(ClientToScreen(evt.GetPosition()));
1553 mSplitter->SetSashPosition(
1554 std::clamp(
1555 pos.y,
1556 mSplitter->GetMinimumPaneSize(),
1557 mSplitter->GetSize().y - mSplitter->GetMinimumPaneSize()
1558 ));
1559 }

References mDrag, and mSplitter.

Referenced by SashLine().

Here is the caller graph for this function:

◆ OnPaint()

void SashLine::OnPaint ( wxPaintEvent &  )
inlineprivate

Definition at line 1561 of file RealtimeEffectPanel.cpp.

1562 {
1563 wxBufferedPaintDC dc(this);
1564 const auto rect = wxRect(GetSize());
1565
1566 dc.SetPen(*wxTRANSPARENT_PEN);
1567 dc.SetBrush(GetBackgroundColour());
1568 dc.DrawRectangle(rect);
1569
1570 dc.SetPen(GetForegroundColour());
1571 dc.SetBrush(*wxTRANSPARENT_BRUSH);
1572 const auto yy = rect.GetTop() + rect.GetHeight() / 2;
1573 dc.DrawLine(rect.GetLeft(), yy, rect.GetRight(), yy);
1574 }

Referenced by SashLine().

Here is the caller graph for this function:

◆ SetSplitterWindow()

void SashLine::SetSplitterWindow ( wxSplitterWindow *  window)
inline

Definition at line 1517 of file RealtimeEffectPanel.cpp.

1518 {
1519 mSplitter = window;
1520 }

References mSplitter.

Member Data Documentation

◆ mDrag

bool SashLine::mDrag {false}
private

Definition at line 1499 of file RealtimeEffectPanel.cpp.

Referenced by OnMouseCaptureLost(), OnMouseDown(), OnMouseUp(), and OnMove().

◆ mSplitter

wxWeakRef<wxSplitterWindow> SashLine::mSplitter
private

Definition at line 1498 of file RealtimeEffectPanel.cpp.

Referenced by OnMouseDown(), OnMove(), and SetSplitterWindow().


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