comparison OrthancStone/Sources/Deprecated/Widgets/LayoutWidget.h @ 1512:244ad1e4e76a

reorganization of folders
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 07 Jul 2020 16:21:02 +0200
parents Framework/Deprecated/Widgets/LayoutWidget.h@257f2c9a02ac
children
comparison
equal deleted inserted replaced
1511:9dfeee74c1e6 1512:244ad1e4e76a
1 /**
2 * Stone of Orthanc
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
4 * Department, University Hospital of Liege, Belgium
5 * Copyright (C) 2017-2020 Osimis S.A., Belgium
6 *
7 * This program is free software: you can redistribute it and/or
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.
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
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
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
26 #include <vector>
27 #include <memory>
28
29 namespace Deprecated
30 {
31 class LayoutWidget : public WidgetBase
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::unique_ptr<IMouseTracker> mouseTracker_;
42 unsigned int paddingLeft_;
43 unsigned int paddingTop_;
44 unsigned int paddingRight_;
45 unsigned int paddingBottom_;
46 unsigned int paddingInternal_;
47 bool hasAnimation_;
48
49 void ComputeChildrenExtents();
50
51 public:
52 LayoutWidget(const std::string& name);
53
54 virtual ~LayoutWidget();
55
56 virtual void FitContent();
57
58 virtual void NotifyContentChanged(const IWidget& widget);
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 void AddWidget(boost::shared_ptr<IWidget> widget);
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(OrthancStone::MouseButton button,
107 int x,
108 int y,
109 OrthancStone::KeyboardModifiers modifiers,
110 const std::vector<Touch>& touches);
111
112 virtual void RenderMouseOver(Orthanc::ImageAccessor& target,
113 int x,
114 int y);
115
116 virtual void MouseWheel(OrthancStone::MouseWheelDirection direction,
117 int x,
118 int y,
119 OrthancStone::KeyboardModifiers modifiers);
120
121 virtual void KeyPressed(OrthancStone::KeyboardKeys key,
122 char keyChar,
123 OrthancStone::KeyboardModifiers modifiers);
124
125 virtual bool HasAnimation() const
126 {
127 return hasAnimation_;
128 }
129
130 virtual void DoAnimation();
131
132 virtual bool HasRenderMouseOver();
133 };
134 }