Audacity 3.2.0
AttachableScrollBar.cpp
Go to the documentation of this file.
1/**********************************************************************
2
3 Audacity: A Digital Audio Editor
4
5 AttachableScrollBar.cpp
6
7 James Crook
8
9 Audacity is free software.
10 This file is licensed under the wxWidgets license, see License.txt
11
12*****************************************************************//*******************************************************************/
29
30
31#include "AttachableScrollBar.h"
32
33#include <wx/wxprec.h>
34#include "ViewInfo.h"
35
36
37BEGIN_EVENT_TABLE(AttachableScrollBar, wxScrollBar)
40
42 wxWindow* parent,
43 wxWindowID id,
44 const wxPoint& pos,
45 const wxSize& size,
46 long style) :
47 wxScrollBar( parent, id, pos, size, style )
48{
49 mpViewInfo = NULL;
50}
51
53{
54}
55
56// Essentially a float to int conversion.
58{
59 // FIXME: PRL Aug 2015: Screen Width in Viewinfo Not needed?
60#if 0
61 ViewInfo & mViewInfo = *mpViewInfo;
62
63 mViewInfo.sbarTotal = (int) (mViewInfo.GetTotalWidth());
64 mViewInfo.sbarScreen = (int) (mViewInfo.GetScreenWidth());
65 mViewInfo.sbarH = (int) (mViewInfo.GetBeforeScreenWidth());
66
67 SetScrollbar(mViewInfo.sbarH, mViewInfo.sbarScreen,
68 mViewInfo.sbarTotal, mViewInfo.sbarScreen, TRUE);
69#endif
70}
71
72// Essentially an int to float conversion.
74{
75 // FIXME: PRL Aug 2015: Screen Width in Viewinfo Not needed?
76#if 0
77 ViewInfo & mViewInfo = *mpViewInfo;
78
79 int hlast = mViewInfo.sbarH;
80
81 mViewInfo.sbarH = GetThumbPosition();
82
83 if (mViewInfo.sbarH != hlast)
84 mViewInfo.SetBeforeScreenWidth(mViewInfo.sbarH);
85#endif
86}
87
88// Used to associated a ViewInfo structure with a scrollbar.
90{
91 mpViewInfo = view;
93}
94
95void AttachableScrollBar::OnScroll(wxScrollEvent & event)
96{
97 if( mpViewInfo == NULL )
98 {
99 event.Skip();
100 return;
101 }
103 event.Skip(); // This is so that the parent control can refresh whatever it needs to...
104}
END_EVENT_TABLE()
An AttachableScrollBar is a scroll bar that can be attached to multiple items and so control their sc...
void SetViewInfo(ViewInfo *view)
void OnScroll(wxScrollEvent &event)
double GetBeforeScreenWidth() const
Definition: ViewInfo.h:209