Home || Architecture || Video Search || Visual Search || Scripts || Applications || Important Messages || OGL || Src

CameraEventButton.h

Go to the documentation of this file.
00001 /*
00002 12345678901234567890123456789012345678901234567890123456789012345678901234567890
00003 */
00004 // Author: Richard van Balen
00005 
00006 #ifndef Impala_Application_SDash_CameraEventButton_h
00007 #define Impala_Application_SDash_CameraEventButton_h
00008 
00009 #ifndef Impala_Application_SDash_CameraEvent_h
00010 #include "Application/sdash/CameraEvent.h"
00011 #endif
00012 
00013 #ifndef OglGui_Button_h
00014 #include "OglGui/Button.h"
00015 #endif
00016 
00017 
00018 namespace Impala {
00019 namespace Application {
00020 namespace SDash {
00021 
00022 class CameraEventButton : public OglGui::Button
00023 {
00024 typedef Impala::Application::SDash::CameraEvent CameraEvent;
00025 
00026 typedef OglGui::Window  Window;
00027 typedef OglGui::Button  Button;
00028 
00029 public:
00030     CameraEventButton(Window* parent, int x, int y, int w, int h,
00031                       const CameraEvent* cameraEvent) :
00032         Button(parent, x, y, w, h, "", BEV_LINE, true)
00033     {
00034         Init(cameraEvent);
00035     }
00036 
00037     void SetXPositions(int x0, int x1, int x2, int x3)
00038     {
00039         mX[0] = x0;
00040         mX[1] = x1;
00041         mX[2] = x2;
00042         mX[3] = x3;
00043     }
00044 
00045     virtual void DisplayFunc()
00046     {
00047         int     w = W(), h = H();
00048         ULONG   col  = GetState() ? mForeGroundColor : 0xff999999;
00049         const char* str = mCameraEvent->AlertDescription();
00050         long    secs = mCameraEvent->Seconds();
00051         int     id   = mCameraEvent->CameraId();
00052         const char* comments = mCameraEvent->CommentsC();
00053         int     hr   = secs / 3600;
00054         int     m    = (secs % 3600) / 60;
00055         int     s    = (secs % 3600) % 60;
00056 
00057         OGC myOGC;
00058         OGCSave(&myOGC);
00059         oglSys.PosColPrintf(mOglWnd, mX[0], 7, col, "%02d:%02d:%02d", hr, m, s);
00060         oglSys.PosColPrintf(mOglWnd, mX[1], 7, col, "%d", id);
00061         oglSys.PosColPrintf(mOglWnd, mX[2], 7, col, "%s", str);
00062         oglSys.PosColPrintf(mOglWnd, mX[3], 7, col, "%s", comments);
00063         if (IsSelected())
00064         {
00065             DrawLine(0, h-2, w, h-2);
00066             DrawLine(0, h-3, w, h-3);
00067             DrawLine(0, 1, w, 1);
00068             DrawLine(0, 2, w, 2);
00069         }
00070         Window::DisplayFunc();
00071         OGCRestore(&myOGC);
00072     }
00073 
00074     int     CameraId()      { return mCameraEvent->CameraId(); }
00075     int     EventType()     { return mCameraEvent->Type(); }
00076     int     FrameNr()       { return mCameraEvent->FrameNr(); }
00077     long    Seconds()       { return mCameraEvent->Seconds(); }
00078     std::string Comments()  { return mCameraEvent->Comments(); }
00079 
00080 private:
00081     void Init(const CameraEvent *cameraEvent)
00082     {
00083         mCameraEvent = cameraEvent;
00084 
00085         mX[0] = 4;
00086         mX[1] = 70;
00087         mX[2] = 100;
00088         mX[3] = 212;
00089 
00090         SetBorderBackground(cameraEvent->PreferredBackColor());
00091         mDoStateFeedback = false;
00092     }
00093 
00094     const CameraEvent* mCameraEvent;
00095     int          mX[4];
00096 };
00097 
00098 }
00099 }
00100 }
00101 #endif

Generated on Fri Mar 19 09:30:37 2010 for ImpalaSrc by  doxygen 1.5.1