Mercurial > hg > orthanc-stone
comparison Applications/Samples/SimpleViewerApplication.h @ 267:89d02de83c03 am-2
added declaretion of messages handled/emitted
author | am@osimis.io |
---|---|
date | Wed, 22 Aug 2018 14:59:20 +0200 |
parents | c9cf95b49a86 |
children | 5bd4161bf11b |
comparison
equal
deleted
inserted
replaced
266:c9cf95b49a86 | 267:89d02de83c03 |
---|---|
175 // } | 175 // } |
176 | 176 |
177 | 177 |
178 virtual void HandleMessage(const IObservable& from, const IMessage& message) { | 178 virtual void HandleMessage(const IObservable& from, const IMessage& message) { |
179 switch (message.GetType()) { | 179 switch (message.GetType()) { |
180 case MessageType_GeometryReady: | 180 case MessageType_Widget_GeometryChanged: |
181 mainLayout_->SetDefaultView(); | 181 //TODO remove constness !! dynamic_cast<const LayerWidget&>(from).SetDefaultView(); |
182 break; | 182 break; |
183 default: | 183 default: |
184 VLOG("unhandled message type" << message.GetType()); | 184 VLOG("unhandled message type" << message.GetType()); |
185 } | 185 } |
186 } | 186 } |
206 currentInstanceIndex_(0), | 206 currentInstanceIndex_(0), |
207 wasmViewport1_(NULL), | 207 wasmViewport1_(NULL), |
208 wasmViewport2_(NULL), | 208 wasmViewport2_(NULL), |
209 slice_(0) | 209 slice_(0) |
210 { | 210 { |
211 DeclareIgnoredMessage(MessageType_Widget_ContentChanged); | |
212 DeclareHandledMessage(MessageType_Widget_GeometryChanged); | |
211 } | 213 } |
212 | 214 |
213 virtual void Finalize() {} | 215 virtual void Finalize() {} |
214 virtual IWidget* GetCentralWidget() {return mainLayout_;} | 216 virtual IWidget* GetCentralWidget() {return mainLayout_;} |
215 | 217 |
265 thumbnailsLayout_->SetVertical(); | 267 thumbnailsLayout_->SetVertical(); |
266 | 268 |
267 mainViewport_ = new LayerWidget(broker_); | 269 mainViewport_ = new LayerWidget(broker_); |
268 thumbnails_.push_back(new LayerWidget(broker_)); | 270 thumbnails_.push_back(new LayerWidget(broker_)); |
269 thumbnails_.push_back(new LayerWidget(broker_)); | 271 thumbnails_.push_back(new LayerWidget(broker_)); |
272 mainViewport_->RegisterObserver(*this); | |
273 thumbnails_[0]->RegisterObserver(*this); | |
274 thumbnails_[1]->RegisterObserver(*this); | |
270 | 275 |
271 // hierarchy | 276 // hierarchy |
272 mainLayout_->AddWidget(thumbnailsLayout_); | 277 mainLayout_->AddWidget(thumbnailsLayout_); |
273 mainLayout_->AddWidget(mainViewport_); | 278 mainLayout_->AddWidget(mainViewport_); |
274 thumbnailsLayout_->AddWidget(thumbnails_[0]); | 279 thumbnailsLayout_->AddWidget(thumbnails_[0]); |
275 thumbnailsLayout_->AddWidget(thumbnails_[1]); | 280 thumbnailsLayout_->AddWidget(thumbnails_[1]); |
276 | 281 |
277 // sources | 282 // sources |
278 smartLoader_.reset(new SmartLoader(broker_, context_->GetWebService())); | 283 smartLoader_.reset(new SmartLoader(broker_, context_->GetWebService())); |
279 smartLoader_->SetImageQuality(SliceImageQuality_FullPam); | 284 smartLoader_->SetImageQuality(SliceImageQuality_FullPam); |
280 smartLoader_->RegisterObserver(*this); | |
281 | 285 |
282 mainViewport_->AddLayer(smartLoader_->GetFrame(instances_[currentInstanceIndex_], 0)); | 286 mainViewport_->AddLayer(smartLoader_->GetFrame(instances_[currentInstanceIndex_], 0)); |
283 thumbnails_[0]->AddLayer(smartLoader_->GetFrame(instances_[0], 0)); | 287 thumbnails_[0]->AddLayer(smartLoader_->GetFrame(instances_[0], 0)); |
284 thumbnails_[1]->AddLayer(smartLoader_->GetFrame(instances_[1], 0)); | 288 thumbnails_[1]->AddLayer(smartLoader_->GetFrame(instances_[1], 0)); |
285 | 289 |