00001
00002
00003
00004 #ifndef Impala_Visualization_VideoPlayerControl_h
00005 #define Impala_Visualization_VideoPlayerControl_h
00006
00007 #ifndef Impala_Visualization_VideoPlayer_h
00008 #include "Visualization/VideoPlayer.h"
00009 #endif
00010
00011 #ifndef Impala_Visualization_VideoPlayerButtons_h
00012 #include "Visualization/VideoPlayerButtons.h"
00013 #endif
00014
00015 namespace Impala
00016 {
00017 namespace Visualization
00018 {
00019
00020 class VideoPlayerControl : public VideoPlayerButtons,
00021 public OglGui::RadioGroupListener
00022 {
00023 public:
00024 typedef OglGui::Window Window;
00025 typedef OglGui::RadioGroup RadioGroup;
00026
00027 VideoPlayerControl(int x, int y, int w, int h, VideoPlayer* videoPlayer) :
00028 VideoPlayerButtons(x, y, w, h)
00029 {
00030 Init(w, h, videoPlayer);
00031 }
00032
00033 VideoPlayerControl(Window* parent, int w, int h, VideoPlayer* videoPlayer) :
00034 VideoPlayerButtons(parent, w, h)
00035 {
00036 Init(w, h, videoPlayer);
00037 }
00038
00039 VideoPlayerControl(Window* parent, int x, int y, int w, int h,
00040 VideoPlayer* videoPlayer) :
00041 VideoPlayerButtons(parent, x, y, w, h)
00042 {
00043 Init(w, h, videoPlayer);
00044 }
00045
00046 void SetVideoPlayer(VideoPlayer* videoPlayer)
00047 {
00048 if (mVideoPlayer = videoPlayer)
00049 MapKeysTo(mVideoPlayer);
00050 }
00051
00052 virtual void OnRadioButton(RadioGroup *src, int button, void* data)
00053 {
00054 if (button == PLAY)
00055 {
00056 mVideoPlayer->NormalSpeed(true);
00057 mVideoPlayer->Play();
00058 }
00059 if (button == STOP)
00060 mVideoPlayer->Stop();
00061 if (button == RESET)
00062 mVideoPlayer->Reset();
00063 if (button == INCR)
00064 mVideoPlayer->NextFrame(1);
00065 if (button == DECR)
00066 mVideoPlayer->NextFrame(-1);
00067 if (button == FFWD)
00068 mVideoPlayer->FFwd();
00069 if (button == FBWD)
00070 mVideoPlayer->FBwd();
00071 }
00072
00073 virtual void InitDisplayFunc()
00074 {
00075 VideoPlayerButtons::InitDisplayFunc();
00076
00077 SetDisabled(!mVideoPlayer);
00078
00079 if (mVideoPlayer)
00080 {
00081 if (mVideoPlayer->Playing())
00082 {
00083 if (mVideoPlayer->FFwding())
00084 SetActiveRadio(FFWD);
00085 else if (mVideoPlayer->FBwding())
00086 SetActiveRadio(FBWD);
00087 else
00088 SetActiveRadio(PLAY);
00089 }
00090 else
00091 SetActiveRadio(STOP);
00092 }
00093 }
00094
00095 private:
00096 void Init(int w, int h, VideoPlayer* videoPlayer)
00097 {
00098 GuiGeneralName("VideoPlayerControl");
00099 GuiName("VideoPlayerControl");
00100 SetVideoPlayer(videoPlayer);
00101 SetRadioListener(this,0);
00102 }
00103
00104 VideoPlayer* mVideoPlayer;
00105 };
00106
00107 }
00108 }
00109 #endif