Mercurial > hg > orthanc-stone
annotate Framework/Widgets/WidgetBase.h @ 54:01aa453d4d5b wasm
IWidget::HasRenderMouseOver
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 27 Apr 2017 17:49:29 +0200 |
parents | 25befef48c35 |
children | f0f354a97581 |
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 | |
47 | 8 * modify it under the terms of the GNU Affero General Public License |
9 * as published by the Free Software Foundation, either version 3 of | |
10 * the License, or (at your option) any later version. | |
0 | 11 * |
12 * This program is distributed in the hope that it will be useful, but | |
13 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
47 | 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
15 * Affero General Public License for more details. | |
16 * | |
17 * You should have received a copy of the GNU Affero General Public License | |
0 | 18 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
19 **/ | |
20 | |
21 | |
22 #pragma once | |
23 | |
24 #include "IWidget.h" | |
25 | |
26 #include "../Viewport/CairoContext.h" | |
27 #include "../Toolbox/ObserversRegistry.h" | |
28 | |
29 namespace OrthancStone | |
30 { | |
31 class WidgetBase : public IWidget | |
32 { | |
33 private: | |
34 IStatusBar* statusBar_; | |
35 ObserversRegistry<IWidget> observers_; | |
36 bool started_; | |
37 bool backgroundCleared_; | |
38 uint8_t backgroundColor_[3]; | |
39 | |
40 protected: | |
41 void ClearBackgroundOrthanc(Orthanc::ImageAccessor& target) const; | |
42 | |
43 void ClearBackgroundCairo(CairoContext& context) const; | |
44 | |
45 void ClearBackgroundCairo(Orthanc::ImageAccessor& target) const; | |
46 | |
47 void NotifyChange(); | |
48 | |
49 void UpdateStatusBar(const std::string& message); | |
50 | |
51 IStatusBar* GetStatusBar() const | |
52 { | |
53 return statusBar_; | |
54 } | |
55 | |
56 bool IsStarted() const | |
57 { | |
58 return started_; | |
59 } | |
60 | |
46
766d31dc5716
removing threads for wasm
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
40
diff
changeset
|
61 public: |
766d31dc5716
removing threads for wasm
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
40
diff
changeset
|
62 WidgetBase(); |
766d31dc5716
removing threads for wasm
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
40
diff
changeset
|
63 |
0 | 64 void SetBackgroundCleared(bool clear) |
65 { | |
66 backgroundCleared_ = clear; | |
67 } | |
68 | |
69 bool IsBackgroundCleared() const | |
70 { | |
71 return backgroundCleared_; | |
72 } | |
73 | |
74 void SetBackgroundColor(uint8_t red, | |
75 uint8_t green, | |
76 uint8_t blue); | |
77 | |
78 void GetBackgroundColor(uint8_t& red, | |
79 uint8_t& green, | |
80 uint8_t& blue) const; | |
81 | |
82 virtual void Register(IChangeObserver& observer); | |
83 | |
84 virtual void Unregister(IChangeObserver& observer); | |
85 | |
86 virtual void SetStatusBar(IStatusBar& statusBar) | |
87 { | |
88 statusBar_ = &statusBar; | |
89 } | |
90 | |
91 virtual void ResetStatusBar() | |
92 { | |
93 statusBar_ = NULL; | |
94 } | |
95 | |
96 virtual void Start(); | |
97 | |
98 virtual void Stop(); | |
99 | |
100 virtual bool Render(Orthanc::ImageAccessor& surface); | |
46
766d31dc5716
removing threads for wasm
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
40
diff
changeset
|
101 |
766d31dc5716
removing threads for wasm
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
40
diff
changeset
|
102 virtual bool HasUpdateContent() const |
766d31dc5716
removing threads for wasm
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
40
diff
changeset
|
103 { |
766d31dc5716
removing threads for wasm
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
40
diff
changeset
|
104 return false; |
766d31dc5716
removing threads for wasm
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
40
diff
changeset
|
105 } |
766d31dc5716
removing threads for wasm
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
40
diff
changeset
|
106 |
766d31dc5716
removing threads for wasm
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
40
diff
changeset
|
107 virtual void UpdateContent(); |
54
01aa453d4d5b
IWidget::HasRenderMouseOver
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
48
diff
changeset
|
108 |
01aa453d4d5b
IWidget::HasRenderMouseOver
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
48
diff
changeset
|
109 virtual bool HasRenderMouseOver(int x, |
01aa453d4d5b
IWidget::HasRenderMouseOver
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
48
diff
changeset
|
110 int y) |
01aa453d4d5b
IWidget::HasRenderMouseOver
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
48
diff
changeset
|
111 { |
01aa453d4d5b
IWidget::HasRenderMouseOver
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
48
diff
changeset
|
112 return false; |
01aa453d4d5b
IWidget::HasRenderMouseOver
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
48
diff
changeset
|
113 } |
0 | 114 }; |
115 } |