comparison Applications/Generic/GuiAdapter.h @ 1297:6ab03e429f06 broker

integration mainline->broker
author Sebastien Jodogne <s.jodogne@gmail.com>
date Sun, 23 Feb 2020 15:32:24 +0100
parents 7ec8fea061b9 7def6ab2929f
children 4f8c9065ee52
comparison
equal deleted inserted replaced
1281:68579a31eeb4 1297:6ab03e429f06
231 static int instanceCount = 0; 231 static int instanceCount = 0;
232 ORTHANC_ASSERT(instanceCount == 0); 232 ORTHANC_ASSERT(instanceCount == 0);
233 instanceCount = 1; 233 instanceCount = 1;
234 } 234 }
235 235
236 void RegisterWidget(boost::shared_ptr<IGuiAdapterWidget> widget);
237
238 /** 236 /**
239 emscripten_set_resize_callback("#window", NULL, false, OnWindowResize); 237 emscripten_set_resize_callback("#window", NULL, false, OnWindowResize);
240 238
241 emscripten_set_wheel_callback("mycanvas1", widget1_.get(), false, OnXXXMouseWheel); 239 emscripten_set_wheel_callback("mycanvas1", widget1_.get(), false, OnXXXMouseWheel);
242 emscripten_set_wheel_callback("mycanvas2", widget2_.get(), false, OnXXXMouseWheel); 240 emscripten_set_wheel_callback("mycanvas2", widget2_.get(), false, OnXXXMouseWheel);
357 /** 355 /**
358 This executes all the registered headers if needed (in wasm, the browser 356 This executes all the registered headers if needed (in wasm, the browser
359 deals with this) 357 deals with this)
360 */ 358 */
361 void ViewportsUpdateSize(); 359 void ViewportsUpdateSize();
362
363 std::vector<boost::weak_ptr<IGuiAdapterWidget> > widgets_;
364
365 template<typename F> void VisitWidgets(F func)
366 {
367 for (size_t i = 0; i < widgets_.size(); i++)
368 {
369 boost::shared_ptr<IGuiAdapterWidget> widget = widgets_[i].lock();
370
371 // TODO: we need to clean widgets!
372 if (widget.get() != NULL)
373 {
374 func(widget);
375 }
376 }
377 }
378 }; 360 };
379 } 361 }