Mercurial > hg > orthanc-stone
diff Framework/Widgets/LayoutWidget.cpp @ 53:c2dc924f1a63 wasm
removing threading out of the framework
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 27 Apr 2017 16:57:49 +0200 |
parents | 25befef48c35 |
children | 01aa453d4d5b |
line wrap: on
line diff
--- a/Framework/Widgets/LayoutWidget.cpp Thu Apr 27 14:50:40 2017 +0200 +++ b/Framework/Widgets/LayoutWidget.cpp Thu Apr 27 16:57:49 2017 +0200 @@ -82,15 +82,25 @@ int top_; unsigned int width_; unsigned int height_; + bool hasUpdate_; public: ChildWidget(IWidget* widget) : - widget_(widget) + widget_(widget), + hasUpdate_(widget->HasUpdateContent()) { assert(widget != NULL); SetEmpty(); } + void UpdateContent() + { + if (hasUpdate_) + { + widget_->UpdateContent(); + } + } + IWidget& GetWidget() const { return *widget_; @@ -348,6 +358,11 @@ ComputeChildrenExtents(); + if (widget->HasUpdateContent()) + { + hasUpdateContent_ = true; + } + return *widget; } @@ -473,4 +488,20 @@ children_[i]->GetWidget().KeyPressed(key, modifiers); } } + + + void LayoutWidget::UpdateContent() + { + if (hasUpdateContent_) + { + for (size_t i = 0; i < children_.size(); i++) + { + children_[i]->UpdateContent(); + } + } + else + { + throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError); + } + } }