Audacity  3.0.3
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 
37 BEGIN_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 
95 void 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 }
size
size_t size
Definition: ffmpeg-2.3.6-single-header.h:412
AttachableScrollBar::SetScrollBarFromViewInfo
void SetScrollBarFromViewInfo()
Definition: AttachableScrollBar.cpp:57
ViewInfo::SetBeforeScreenWidth
void SetBeforeScreenWidth(wxInt64 beforeWidth, wxInt64 screenWidth, double lowerBoundTime=0.0)
Definition: ViewInfo.cpp:286
AttachableScrollBar::~AttachableScrollBar
~AttachableScrollBar(void)
Definition: AttachableScrollBar.cpp:52
AttachableScrollBar::SetViewInfoFromScrollBar
void SetViewInfoFromScrollBar()
Definition: AttachableScrollBar.cpp:73
ViewInfo
Definition: ViewInfo.h:202
AttachableScrollBar::OnScroll
void OnScroll(wxScrollEvent &event)
Definition: AttachableScrollBar.cpp:95
ViewInfo::sbarH
wxInt64 sbarH
Definition: ViewInfo.h:236
AttachableScrollBar::mpViewInfo
ViewInfo * mpViewInfo
Definition: AttachableScrollBar.h:42
ViewInfo::sbarScreen
wxInt64 sbarScreen
Definition: ViewInfo.h:237
ViewInfo::sbarTotal
wxInt64 sbarTotal
Definition: ViewInfo.h:238
AttachableScrollBar.h
ViewInfo::GetTotalWidth
double GetTotalWidth() const
Definition: ViewInfo.h:224
AttachableScrollBar
An AttachableScrollBar is a scroll bar that can be attached to multiple items and so control their sc...
Definition: AttachableScrollBar.h:26
ViewInfo.h
ViewInfo::GetBeforeScreenWidth
double GetBeforeScreenWidth() const
Definition: ViewInfo.h:218
END_EVENT_TABLE
END_EVENT_TABLE()
AttachableScrollBar::SetViewInfo
void SetViewInfo(ViewInfo *view)
Definition: AttachableScrollBar.cpp:89