Mercurial > hg > orthanc-stone
annotate Framework/Widgets/LayoutWidget.h @ 560:aaeec7be8fb7
add support for alpha channel in CairoSurface
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 17 Apr 2019 17:57:50 +0200 |
parents | b70e9be013e4 |
children | 3b4df9925db6 |
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 | |
439 | 5 * Copyright (C) 2017-2019 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 "WidgetBase.h" | |
25 | |
53
c2dc924f1a63
removing threading out of the framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
48
diff
changeset
|
26 #include <vector> |
c2dc924f1a63
removing threading out of the framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
48
diff
changeset
|
27 #include <memory> |
0 | 28 |
29 namespace OrthancStone | |
30 { | |
61
ca644004d2ee
MAJOR - removal of Start/Stop and observers in IWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
55
diff
changeset
|
31 class LayoutWidget : public WidgetBase |
0 | 32 { |
33 private: | |
34 class LayoutMouseTracker; | |
35 class ChildWidget; | |
36 | |
37 std::vector<ChildWidget*> children_; | |
38 bool isHorizontal_; | |
39 unsigned int width_; | |
40 unsigned int height_; | |
41 std::auto_ptr<IMouseTracker> mouseTracker_; | |
42 unsigned int paddingLeft_; | |
43 unsigned int paddingTop_; | |
44 unsigned int paddingRight_; | |
45 unsigned int paddingBottom_; | |
46 unsigned int paddingInternal_; | |
386
e33659decec5
renamed UpdateContent() as DoAnimation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
330
diff
changeset
|
47 bool hasAnimation_; |
0 | 48 |
49 void ComputeChildrenExtents(); | |
50 | |
51 public: | |
273
f21ba2468570
force all Widgets to have a name to ease debugging
am@osimis.io
parents:
196
diff
changeset
|
52 LayoutWidget(const std::string& name); |
0 | 53 |
54 virtual ~LayoutWidget(); | |
55 | |
330 | 56 virtual void FitContent(); |
61
ca644004d2ee
MAJOR - removal of Start/Stop and observers in IWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
55
diff
changeset
|
57 |
278 | 58 virtual void NotifyContentChanged(const IWidget& widget); |
0 | 59 |
60 void SetHorizontal(); | |
61 | |
62 void SetVertical(); | |
63 | |
64 void SetPadding(unsigned int left, | |
65 unsigned int top, | |
66 unsigned int right, | |
67 unsigned int bottom, | |
68 unsigned int spacing); | |
69 | |
70 void SetPadding(unsigned int padding); | |
71 | |
72 unsigned int GetPaddingLeft() const | |
73 { | |
74 return paddingLeft_; | |
75 } | |
76 | |
77 unsigned int GetPaddingTop() const | |
78 { | |
79 return paddingTop_; | |
80 } | |
81 | |
82 unsigned int GetPaddingRight() const | |
83 { | |
84 return paddingRight_; | |
85 } | |
86 | |
87 unsigned int GetPaddingBottom() const | |
88 { | |
89 return paddingBottom_; | |
90 } | |
91 | |
92 unsigned int GetPaddingInternal() const | |
93 { | |
94 return paddingInternal_; | |
95 } | |
96 | |
97 IWidget& AddWidget(IWidget* widget); // Takes ownership | |
98 | |
99 virtual void SetStatusBar(IStatusBar& statusBar); | |
100 | |
101 virtual void SetSize(unsigned int width, | |
102 unsigned int height); | |
103 | |
104 virtual bool Render(Orthanc::ImageAccessor& surface); | |
105 | |
106 virtual IMouseTracker* CreateMouseTracker(MouseButton button, | |
107 int x, | |
108 int y, | |
109 KeyboardModifiers modifiers); | |
110 | |
111 virtual void RenderMouseOver(Orthanc::ImageAccessor& target, | |
112 int x, | |
113 int y); | |
114 | |
115 virtual void MouseWheel(MouseWheelDirection direction, | |
116 int x, | |
117 int y, | |
118 KeyboardModifiers modifiers); | |
119 | |
327 | 120 virtual void KeyPressed(KeyboardKeys key, |
121 char keyChar, | |
0 | 122 KeyboardModifiers modifiers); |
53
c2dc924f1a63
removing threading out of the framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
48
diff
changeset
|
123 |
386
e33659decec5
renamed UpdateContent() as DoAnimation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
330
diff
changeset
|
124 virtual bool HasAnimation() const |
53
c2dc924f1a63
removing threading out of the framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
48
diff
changeset
|
125 { |
386
e33659decec5
renamed UpdateContent() as DoAnimation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
330
diff
changeset
|
126 return hasAnimation_; |
53
c2dc924f1a63
removing threading out of the framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
48
diff
changeset
|
127 } |
c2dc924f1a63
removing threading out of the framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
48
diff
changeset
|
128 |
386
e33659decec5
renamed UpdateContent() as DoAnimation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
330
diff
changeset
|
129 virtual void DoAnimation(); |
54
01aa453d4d5b
IWidget::HasRenderMouseOver
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
53
diff
changeset
|
130 |
55 | 131 virtual bool HasRenderMouseOver(); |
0 | 132 }; |
133 } |