comparison Framework/Viewport/WidgetViewport.cpp @ 91:81f73efd81a1 wasm

cleaning up
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 29 May 2017 11:18:35 +0200
parents 02c3a7a4938f
children 2eca030792aa
comparison
equal deleted inserted replaced
90:64e60018943f 91:81f73efd81a1
72 { 72 {
73 centralWidget_->SetStatusBar(*statusBar_); 73 centralWidget_->SetStatusBar(*statusBar_);
74 } 74 }
75 75
76 backgroundChanged_ = true; 76 backgroundChanged_ = true;
77 observers_.NotifyChange(this); 77 observers_.Apply(*this, &IObserver::NotifyChange);
78 78
79 return *widget; 79 return *widget;
80 } 80 }
81 81
82 82
83 void WidgetViewport::NotifyChange(const IWidget& widget) 83 void WidgetViewport::NotifyChange(const IWidget& widget)
84 { 84 {
85 backgroundChanged_ = true; 85 backgroundChanged_ = true;
86 observers_.NotifyChange(this); 86 observers_.Apply(*this, &IObserver::NotifyChange);
87 } 87 }
88 88
89 89
90 void WidgetViewport::SetSize(unsigned int width, 90 void WidgetViewport::SetSize(unsigned int width,
91 unsigned int height) 91 unsigned int height)
95 if (centralWidget_.get() != NULL) 95 if (centralWidget_.get() != NULL)
96 { 96 {
97 centralWidget_->SetSize(width, height); 97 centralWidget_->SetSize(width, height);
98 } 98 }
99 99
100 observers_.NotifyChange(this); 100 observers_.Apply(*this, &IObserver::NotifyChange);
101 } 101 }
102 102
103 103
104 bool WidgetViewport::Render(Orthanc::ImageAccessor& surface) 104 bool WidgetViewport::Render(Orthanc::ImageAccessor& surface)
105 { 105 {
152 else 152 else
153 { 153 {
154 mouseTracker_.reset(NULL); 154 mouseTracker_.reset(NULL);
155 } 155 }
156 156
157 observers_.NotifyChange(this); 157 observers_.Apply(*this, &IObserver::NotifyChange);
158 } 158 }
159 159
160 160
161 void WidgetViewport::MouseUp() 161 void WidgetViewport::MouseUp()
162 { 162 {
163 if (mouseTracker_.get() != NULL) 163 if (mouseTracker_.get() != NULL)
164 { 164 {
165 mouseTracker_->MouseUp(); 165 mouseTracker_->MouseUp();
166 mouseTracker_.reset(NULL); 166 mouseTracker_.reset(NULL);
167 observers_.NotifyChange(this); 167 observers_.Apply(*this, &IObserver::NotifyChange);
168 } 168 }
169 } 169 }
170 170
171 171
172 void WidgetViewport::MouseMove(int x, 172 void WidgetViewport::MouseMove(int x,
193 } 193 }
194 194
195 if (repaint) 195 if (repaint)
196 { 196 {
197 // The scene must be repainted, notify the observers 197 // The scene must be repainted, notify the observers
198 observers_.NotifyChange(this); 198 observers_.Apply(*this, &IObserver::NotifyChange);
199 } 199 }
200 } 200 }
201 201
202 202
203 void WidgetViewport::MouseEnter() 203 void WidgetViewport::MouseEnter()
204 { 204 {
205 isMouseOver_ = true; 205 isMouseOver_ = true;
206 observers_.NotifyChange(this); 206 observers_.Apply(*this, &IObserver::NotifyChange);
207 } 207 }
208 208
209 209
210 void WidgetViewport::MouseLeave() 210 void WidgetViewport::MouseLeave()
211 { 211 {
215 { 215 {
216 mouseTracker_->MouseUp(); 216 mouseTracker_->MouseUp();
217 mouseTracker_.reset(NULL); 217 mouseTracker_.reset(NULL);
218 } 218 }
219 219
220 observers_.NotifyChange(this); 220 observers_.Apply(*this, &IObserver::NotifyChange);
221 } 221 }
222 222
223 223
224 void WidgetViewport::MouseWheel(MouseWheelDirection direction, 224 void WidgetViewport::MouseWheel(MouseWheelDirection direction,
225 int x, 225 int x,