annotate OrthancStone/Sources/Viewport/ViewportLocker.h @ 2012:637d6373127a

width of the vertical slider has doubled to ease user interactions
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 02 Dec 2022 18:49:06 +0100
parents b31e494e34c5
children 07964689cb0b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1973
596f4752fa42 added ViewportLocker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /**
596f4752fa42 added ViewportLocker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 * Stone of Orthanc
596f4752fa42 added ViewportLocker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
596f4752fa42 added ViewportLocker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4 * Department, University Hospital of Liege, Belgium
596f4752fa42 added ViewportLocker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5 * Copyright (C) 2017-2022 Osimis S.A., Belgium
596f4752fa42 added ViewportLocker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6 * Copyright (C) 2021-2022 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
596f4752fa42 added ViewportLocker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 *
596f4752fa42 added ViewportLocker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 * This program is free software: you can redistribute it and/or
596f4752fa42 added ViewportLocker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 * modify it under the terms of the GNU Lesser General Public License
596f4752fa42 added ViewportLocker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 * as published by the Free Software Foundation, either version 3 of
596f4752fa42 added ViewportLocker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 * the License, or (at your option) any later version.
596f4752fa42 added ViewportLocker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 *
596f4752fa42 added ViewportLocker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 * This program is distributed in the hope that it will be useful, but
596f4752fa42 added ViewportLocker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
596f4752fa42 added ViewportLocker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
596f4752fa42 added ViewportLocker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 * Lesser General Public License for more details.
596f4752fa42 added ViewportLocker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 *
596f4752fa42 added ViewportLocker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 * You should have received a copy of the GNU Lesser General Public
596f4752fa42 added ViewportLocker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 * License along with this program. If not, see
596f4752fa42 added ViewportLocker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20 * <http://www.gnu.org/licenses/>.
596f4752fa42 added ViewportLocker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21 **/
596f4752fa42 added ViewportLocker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22
596f4752fa42 added ViewportLocker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23
596f4752fa42 added ViewportLocker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24 #pragma once
596f4752fa42 added ViewportLocker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25
596f4752fa42 added ViewportLocker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26 #include "IViewport.h"
596f4752fa42 added ViewportLocker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27
596f4752fa42 added ViewportLocker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28 namespace OrthancStone
596f4752fa42 added ViewportLocker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29 {
596f4752fa42 added ViewportLocker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30 class ViewportLocker : public boost::noncopyable
596f4752fa42 added ViewportLocker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31 {
596f4752fa42 added ViewportLocker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32 private:
596f4752fa42 added ViewportLocker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33 boost::shared_ptr<IViewport> lock1_;
596f4752fa42 added ViewportLocker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34 std::unique_ptr<IViewport::ILock> lock2_;
596f4752fa42 added ViewportLocker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35
596f4752fa42 added ViewportLocker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36 IViewport::ILock& GetLock() const;
596f4752fa42 added ViewportLocker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37
596f4752fa42 added ViewportLocker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38 public:
1979
b31e494e34c5 cppcheck
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1973
diff changeset
39 explicit ViewportLocker(IViewport& viewport) :
1973
596f4752fa42 added ViewportLocker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40 lock2_(viewport.Lock())
596f4752fa42 added ViewportLocker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41 {
596f4752fa42 added ViewportLocker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42 }
596f4752fa42 added ViewportLocker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43
1979
b31e494e34c5 cppcheck
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1973
diff changeset
44 explicit ViewportLocker(boost::weak_ptr<IViewport> viewport);
1973
596f4752fa42 added ViewportLocker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45
596f4752fa42 added ViewportLocker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
46 bool IsValid() const
596f4752fa42 added ViewportLocker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47 {
596f4752fa42 added ViewportLocker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
48 return (lock2_.get() != NULL);
596f4752fa42 added ViewportLocker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
49 }
596f4752fa42 added ViewportLocker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
50
596f4752fa42 added ViewportLocker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
51 ViewportController& GetController() const
596f4752fa42 added ViewportLocker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
52 {
596f4752fa42 added ViewportLocker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
53 return GetLock().GetController();
596f4752fa42 added ViewportLocker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
54 }
596f4752fa42 added ViewportLocker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
55
596f4752fa42 added ViewportLocker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
56 void Invalidate() const
596f4752fa42 added ViewportLocker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
57 {
596f4752fa42 added ViewportLocker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
58 return GetLock().Invalidate();
596f4752fa42 added ViewportLocker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
59 }
596f4752fa42 added ViewportLocker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
60 };
596f4752fa42 added ViewportLocker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
61 }