Ocean
FrameMediumWindow.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) Meta Platforms, Inc. and affiliates.
3  *
4  * This source code is licensed under the MIT license found in the
5  * LICENSE file in the root directory of this source tree.
6  */
7 
8 #ifndef META_OCEAN_PLATFORM_WXWIDGETS_FRAME_MEDIUM_WINDOW_H
9 #define META_OCEAN_PLATFORM_WXWIDGETS_FRAME_MEDIUM_WINDOW_H
10 
12 
13 #include "ocean/base/Callback.h"
14 #include "ocean/base/Lock.h"
15 #include "ocean/base/Thread.h"
16 
18 
19 namespace Ocean
20 {
21 
22 namespace Platform
23 {
24 
25 namespace WxWidgets
26 {
27 
28 /**
29  * This class implements the main window.
30  * @ingroup platformwxw
31  */
32 class OCEAN_PLATFORM_WXWIDGETS_EXPORT FrameMediumWindow :
33  public FrameWindow,
34  protected Thread
35 {
36  public:
37 
38  /**
39  * Definition of a callback for medium finished events.
40  */
42 
43  public:
44 
45  /**
46  * Creates a new main window object.
47  * @param title Tile of the frame window to be created
48  * @param parent Parent window
49  * @param pos Position of the frame window
50  * @param size Size of the frame window
51  */
52  FrameMediumWindow(const wxString& title, wxWindow* parent = nullptr, const wxPoint& pos = wxPoint(-1, -1), const wxSize& size = wxSize(-1, -1));
53 
54  /**
55  * Destructs this frame medium window.
56  */
57  ~FrameMediumWindow() override;
58 
59  /**
60  * Sets or changes the frame medium of this window.
61  * @param medium Frame medium to be set
62  */
64 
65  /**
66  * Sets the callback function for medium finished events.
67  * @param callback Callback function to set
68  */
69  inline void setFinishedCallback(const Callback& callback);
70 
71  protected:
72 
73  /**
74  * Thread run function.
75  * @see Thread::threadRun().
76  */
77  void threadRun() override;
78 
79  protected:
80 
81  /// Frame medium to be displed.
83 
84  /// Timestamp of the current frame.
86 
87  /// Medium finished callback function.
89 
90  /// True, if the medium has finished.
92 
93  /// Frame lock.
95 };
96 
98 {
99  callback_ = callback;
100 }
101 
102 }
103 
104 }
105 
106 }
107 
108 #endif // META_OCEAN_PLATFORM_WXWIDGETS_FRAME_MEDIUM_WINDOW_H
This class implements a recursive lock object.
Definition: Lock.h:31
This class implements the main window.
Definition: FrameMediumWindow.h:35
Media::FrameMediumRef frameMedium_
Frame medium to be displed.
Definition: FrameMediumWindow.h:82
void setFrameMedium(const Media::FrameMediumRef &medium)
Sets or changes the frame medium of this window.
void setFinishedCallback(const Callback &callback)
Sets the callback function for medium finished events.
Definition: FrameMediumWindow.h:97
Ocean::Lock lock_
Frame lock.
Definition: FrameMediumWindow.h:94
Callback callback_
Medium finished callback function.
Definition: FrameMediumWindow.h:88
Ocean::Callback< void > Callback
Definition of a callback for medium finished events.
Definition: FrameMediumWindow.h:41
bool hasFinished_
True, if the medium has finished.
Definition: FrameMediumWindow.h:91
~FrameMediumWindow() override
Destructs this frame medium window.
Timestamp frameTimestamp_
Timestamp of the current frame.
Definition: FrameMediumWindow.h:85
void threadRun() override
Thread run function.
FrameMediumWindow(const wxString &title, wxWindow *parent=nullptr, const wxPoint &pos=wxPoint(-1, -1), const wxSize &size=wxSize(-1, -1))
Creates a new main window object.
This class implements the main window.
Definition: FrameWindow.h:29
This class implements a thread.
Definition: Thread.h:115
This class implements a timestamp.
Definition: Timestamp.h:36
SmartMediumRef< FrameMedium > FrameMediumRef
Definition of a smart medium reference holding a frame medium object.
Definition: FrameMedium.h:32
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15