OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
animctrl.cpp
Go to the documentation of this file.
1//----------------------------------------------------------------------------
2// ObjectWindows
3// Copyright (c) 1995, 1996 by Borland International, All Rights Reserved
4//
5/// \file
6/// Implementation of the TAnimateCtrl class
7//----------------------------------------------------------------------------
8#include <owl/pch.h>
9
10#include <owl/animctrl.h>
11
12namespace owl {
13
16
17/// Constructor for a TAnimateCtrl to be associated with a new underlying
18/// control.
19//
20TAnimateCtrl::TAnimateCtrl(TWindow* parent, int id, int x, int y, int w, int h,
21 TModule* module)
22:
23 TControl(parent, id, _T(""), x, y, w, h, module)
24{
27 TRACEX(OwlCommCtrl, OWL_CDLEVEL, _T("TAnimateCtrl constructed @") << (void*)this);
28}
29
30
31/// Constructor to alias a control defined in a dialog resource
32//
34:
35 TControl(parent, resourceId, module)
36{
38 TRACEX(OwlCommCtrl, OWL_CDLEVEL, _T("TAnimateCtrl constructed @") << (void*)this);
39}
40
41/// Destructor
42//
44{
45 TRACEX(OwlCommCtrl, OWL_CDLEVEL, _T("TAnimateCtrl deleted @") << (void*)this);
46}
47
48//
49/// Returns the predefined class registered by the Common Control library
50/// for the Animation control.
51//
56
57//
58/// Opens an .AVI file and displays the first frame.
59/// The 'res' parameter may be a resourceId if the .AVI is from a resource.
60/// It may also be a full path of an .AVI file.
61/// Use NULL (0) as 'res' to close any previously opened .AVI file.
62/// If 'module' is not NULL, the resource is opened from the given module.
63/// If 'module' is NULL, the resource is opened from the module associated with the control, i.e.
64/// the module returned by GetModule.
65//
66bool
68{
69 const auto moduleHandle = module ? module->GetHandle() :
70 GetModule() ? GetModule()->GetHandle() :
71 nullptr;
72 return SendMessage(ACM_OPEN, reinterpret_cast<TParam1>(moduleHandle), TParam2(res)) != 0;
73}
74
75
76/// Plays the .AVI file from frame index 'start' to frame index 'end'.
77/// The 'repeat' parameter is the number of times to play the frames.
78/// Use -1 for repeat to play indefinitely.
79/// \note The control plays the clip in the backgroud while the
80/// current thread continues executing.
81//
82bool
87
88/// Stops playing the current AVI file.
89//
90void
95
96
97/// Seek to frame index 'frame'. The value is zero-based and must not
98/// exceed 65,536.
99//
100bool
102{
103 return Play(frame, frame, 0);
104}
105
106
107} // OWL namespace
108/* ========================================================================== */
109
Definition of class TAnimateCtrl.
#define DIAG_DECLARE_GROUP(group)
Definition checks.h:404
#define TRACEX(group, level, message)
Definition checks.h:263
bool Seek(uint16 frame)
Seek to frame index 'frame'.
Definition animctrl.cpp:101
virtual auto GetWindowClassName() -> TWindowClassName
Returns the predefined class registered by the Common Control library for the Animation control.
Definition animctrl.cpp:52
bool Play(uint16 start=0, uint16 end=-1, uint repeat=1)
Plays the .AVI file from frame index 'start' to frame index 'end'.
Definition animctrl.cpp:83
bool Open(LPCTSTR fileOrRes, TModule *module=nullptr)
Opens an .AVI file and displays the first frame.
Definition animctrl.cpp:67
void Stop()
Stops playing the current AVI file.
Definition animctrl.cpp:91
~TAnimateCtrl()
Destructor.
Definition animctrl.cpp:43
TAnimateCtrl(TWindow *parent, int id, int x, int y, int w, int h, TModule *module=nullptr)
Constructor for a TAnimateCtrl to be associated with a new underlying control.
Definition animctrl.cpp:20
TControl unifies its derived control classes, such as TScrollBar, TControlGadget, and TButton.
Definition control.h:38
ObjectWindows dynamic-link libraries (DLLs) construct an instance of TModule, which acts as an object...
Definition module.h:75
Type-safe encapsulation of a Windows class name, a union between ATOM and LPCTSTR.
Definition module.h:47
TWindow, derived from TEventHandler and TStreamableBase, provides window-specific behavior and encaps...
Definition window.h:414
TResult SendMessage(TMsgId, TParam1=0, TParam2=0) const
Sends a message (msg) to a specified window or windows.
Definition window.cpp:3288
#define _T(x)
Definition cygwin.h:51
Object Windows Library (OWLNext Core)
Definition animctrl.h:22
void InitializeCommonControls(uint controlFlags)
Wrapper for the Windows API function InitCommmonControlsEx.
Definition commctrl.cpp:19
uint32 MkUint32(uint16 lo, uint16 hi)
Definition defs.h:261
LPARAM TParam2
Second parameter type.
Definition dispatch.h:55
OWL_DIAGINFO
Definition animctrl.cpp:14
unsigned short uint16
Definition number.h:33
unsigned int uint
Definition number.h:25
#define OWL_CDLEVEL
Definition defs.h:171