Mercurial > hg > orthanc-stone
annotate Framework/Widgets/WidgetBase.h @ 330:7a364e44fbb4 am-2
renamed SetDefaultView in FitContent
author | am@osimis.io |
---|---|
date | Wed, 17 Oct 2018 12:45:52 +0200 |
parents | 8a86695fcbc3 |
children | 6cc3ce74dc05 |
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 | |
134
4cff7b1ed31d
upgrade to year 2018
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
47
diff
changeset
|
5 * Copyright (C) 2017-2018 Osimis S.A., 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 | |
28 namespace OrthancStone | |
29 { | |
30 class WidgetBase : public IWidget | |
31 { | |
32 private: | |
61
ca644004d2ee
MAJOR - removal of Start/Stop and observers in IWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
55
diff
changeset
|
33 IWidget* parent_; |
ca644004d2ee
MAJOR - removal of Start/Stop and observers in IWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
55
diff
changeset
|
34 IViewport* viewport_; |
ca644004d2ee
MAJOR - removal of Start/Stop and observers in IWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
55
diff
changeset
|
35 IStatusBar* statusBar_; |
ca644004d2ee
MAJOR - removal of Start/Stop and observers in IWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
55
diff
changeset
|
36 bool backgroundCleared_; |
ca644004d2ee
MAJOR - removal of Start/Stop and observers in IWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
55
diff
changeset
|
37 uint8_t backgroundColor_[3]; |
85 | 38 bool transmitMouseOver_; |
273
f21ba2468570
force all Widgets to have a name to ease debugging
am@osimis.io
parents:
196
diff
changeset
|
39 std::string name_; |
0 | 40 |
41 protected: | |
42 void ClearBackgroundOrthanc(Orthanc::ImageAccessor& target) const; | |
43 | |
44 void ClearBackgroundCairo(CairoContext& context) const; | |
45 | |
46 void ClearBackgroundCairo(Orthanc::ImageAccessor& target) const; | |
47 | |
48 void UpdateStatusBar(const std::string& message); | |
49 | |
50 IStatusBar* GetStatusBar() const | |
51 { | |
52 return statusBar_; | |
53 } | |
54 | |
55 public: | |
273
f21ba2468570
force all Widgets to have a name to ease debugging
am@osimis.io
parents:
196
diff
changeset
|
56 WidgetBase(const std::string& name); |
0 | 57 |
330 | 58 virtual void FitContent() |
0 | 59 { |
60 } | |
61
ca644004d2ee
MAJOR - removal of Start/Stop and observers in IWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
55
diff
changeset
|
61 |
ca644004d2ee
MAJOR - removal of Start/Stop and observers in IWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
55
diff
changeset
|
62 virtual void SetParent(IWidget& parent); |
ca644004d2ee
MAJOR - removal of Start/Stop and observers in IWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
55
diff
changeset
|
63 |
ca644004d2ee
MAJOR - removal of Start/Stop and observers in IWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
55
diff
changeset
|
64 virtual void SetViewport(IViewport& viewport); |
0 | 65 |
66 void SetBackgroundCleared(bool clear) | |
67 { | |
68 backgroundCleared_ = clear; | |
69 } | |
70 | |
71 bool IsBackgroundCleared() const | |
72 { | |
73 return backgroundCleared_; | |
74 } | |
75 | |
85 | 76 void SetTransmitMouseOver(bool transmit) |
77 { | |
78 transmitMouseOver_ = transmit; | |
79 } | |
80 | |
0 | 81 void SetBackgroundColor(uint8_t red, |
82 uint8_t green, | |
83 uint8_t blue); | |
84 | |
85 void GetBackgroundColor(uint8_t& red, | |
86 uint8_t& green, | |
87 uint8_t& blue) const; | |
88 | |
89 virtual void SetStatusBar(IStatusBar& statusBar) | |
90 { | |
91 statusBar_ = &statusBar; | |
92 } | |
93 | |
94 virtual bool Render(Orthanc::ImageAccessor& surface); | |
46
766d31dc5716
removing threads for wasm
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
40
diff
changeset
|
95 |
766d31dc5716
removing threads for wasm
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
40
diff
changeset
|
96 virtual bool HasUpdateContent() const |
0 | 97 { |
46
766d31dc5716
removing threads for wasm
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
40
diff
changeset
|
98 return false; |
766d31dc5716
removing threads for wasm
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
40
diff
changeset
|
99 } |
0 | 100 |
46
766d31dc5716
removing threads for wasm
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
40
diff
changeset
|
101 virtual void UpdateContent(); |
0 | 102 |
55 | 103 virtual bool HasRenderMouseOver() |
54
01aa453d4d5b
IWidget::HasRenderMouseOver
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
48
diff
changeset
|
104 { |
85 | 105 return transmitMouseOver_; |
54
01aa453d4d5b
IWidget::HasRenderMouseOver
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
48
diff
changeset
|
106 } |
0 | 107 |
278 | 108 virtual void NotifyContentChanged(); |
273
f21ba2468570
force all Widgets to have a name to ease debugging
am@osimis.io
parents:
196
diff
changeset
|
109 |
f21ba2468570
force all Widgets to have a name to ease debugging
am@osimis.io
parents:
196
diff
changeset
|
110 const std::string& GetName() const |
f21ba2468570
force all Widgets to have a name to ease debugging
am@osimis.io
parents:
196
diff
changeset
|
111 { |
f21ba2468570
force all Widgets to have a name to ease debugging
am@osimis.io
parents:
196
diff
changeset
|
112 return name_; |
f21ba2468570
force all Widgets to have a name to ease debugging
am@osimis.io
parents:
196
diff
changeset
|
113 } |
f21ba2468570
force all Widgets to have a name to ease debugging
am@osimis.io
parents:
196
diff
changeset
|
114 |
0 | 115 }; |
116 } |