Mercurial > hg > orthanc-stone
annotate Framework/Widgets/WidgetBase.h @ 46:766d31dc5716 wasm
removing threads for wasm
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 19 Apr 2017 14:33:06 +0200 |
parents | 7207a407bcd8 |
children | 25befef48c35 |
rev | line source |
---|---|
0 | 1 /** |
2 * Stone of Orthanc | |
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics | |
4 * Department, University Hospital of Liege, Belgium | |
40
7207a407bcd8
shared copyright with osimis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
5 * Copyright (C) 2017 Osimis, Belgium |
0 | 6 * |
7 * This program is free software: you can redistribute it and/or | |
8 * modify it under the terms of the GNU General Public License as | |
9 * published by the Free Software Foundation, either version 3 of the | |
10 * License, or (at your option) any later version. | |
11 * | |
12 * In addition, as a special exception, the copyright holders of this | |
13 * program give permission to link the code of its release with the | |
14 * OpenSSL project's "OpenSSL" library (or with modified versions of it | |
15 * that use the same license as the "OpenSSL" library), and distribute | |
16 * the linked executables. You must obey the GNU General Public License | |
17 * in all respects for all of the code used other than "OpenSSL". If you | |
18 * modify file(s) with this exception, you may extend this exception to | |
19 * your version of the file(s), but you are not obligated to do so. If | |
20 * you do not wish to do so, delete this exception statement from your | |
21 * version. If you delete this exception statement from all source files | |
22 * in the program, then also delete it here. | |
23 * | |
24 * This program is distributed in the hope that it will be useful, but | |
25 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
27 * General Public License for more details. | |
28 * | |
29 * You should have received a copy of the GNU General Public License | |
30 * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
31 **/ | |
32 | |
33 | |
34 #pragma once | |
35 | |
36 #include "IWidget.h" | |
37 | |
38 #include "../Viewport/CairoContext.h" | |
39 #include "../Toolbox/ObserversRegistry.h" | |
40 | |
41 namespace OrthancStone | |
42 { | |
43 class WidgetBase : public IWidget | |
44 { | |
45 private: | |
46 IStatusBar* statusBar_; | |
47 ObserversRegistry<IWidget> observers_; | |
48 bool started_; | |
49 bool backgroundCleared_; | |
50 uint8_t backgroundColor_[3]; | |
51 | |
52 protected: | |
53 void ClearBackgroundOrthanc(Orthanc::ImageAccessor& target) const; | |
54 | |
55 void ClearBackgroundCairo(CairoContext& context) const; | |
56 | |
57 void ClearBackgroundCairo(Orthanc::ImageAccessor& target) const; | |
58 | |
59 void NotifyChange(); | |
60 | |
61 void UpdateStatusBar(const std::string& message); | |
62 | |
63 IStatusBar* GetStatusBar() const | |
64 { | |
65 return statusBar_; | |
66 } | |
67 | |
68 bool IsStarted() const | |
69 { | |
70 return started_; | |
71 } | |
72 | |
46
766d31dc5716
removing threads for wasm
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
40
diff
changeset
|
73 public: |
766d31dc5716
removing threads for wasm
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
40
diff
changeset
|
74 WidgetBase(); |
766d31dc5716
removing threads for wasm
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
40
diff
changeset
|
75 |
0 | 76 void SetBackgroundCleared(bool clear) |
77 { | |
78 backgroundCleared_ = clear; | |
79 } | |
80 | |
81 bool IsBackgroundCleared() const | |
82 { | |
83 return backgroundCleared_; | |
84 } | |
85 | |
86 void SetBackgroundColor(uint8_t red, | |
87 uint8_t green, | |
88 uint8_t blue); | |
89 | |
90 void GetBackgroundColor(uint8_t& red, | |
91 uint8_t& green, | |
92 uint8_t& blue) const; | |
93 | |
94 virtual void Register(IChangeObserver& observer); | |
95 | |
96 virtual void Unregister(IChangeObserver& observer); | |
97 | |
98 virtual void SetStatusBar(IStatusBar& statusBar) | |
99 { | |
100 statusBar_ = &statusBar; | |
101 } | |
102 | |
103 virtual void ResetStatusBar() | |
104 { | |
105 statusBar_ = NULL; | |
106 } | |
107 | |
108 virtual void Start(); | |
109 | |
110 virtual void Stop(); | |
111 | |
112 virtual bool Render(Orthanc::ImageAccessor& surface); | |
46
766d31dc5716
removing threads for wasm
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
40
diff
changeset
|
113 |
766d31dc5716
removing threads for wasm
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
40
diff
changeset
|
114 virtual bool HasUpdateContent() const |
766d31dc5716
removing threads for wasm
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
40
diff
changeset
|
115 { |
766d31dc5716
removing threads for wasm
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
40
diff
changeset
|
116 return false; |
766d31dc5716
removing threads for wasm
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
40
diff
changeset
|
117 } |
766d31dc5716
removing threads for wasm
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
40
diff
changeset
|
118 |
766d31dc5716
removing threads for wasm
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
40
diff
changeset
|
119 virtual void UpdateContent(); |
0 | 120 }; |
121 } |