00001
00002
00003
00004
00005
00006 #ifndef Impala_Application_SDash_CameraEventListPane_h
00007 #define Impala_Application_SDash_CameraEventListPane_h
00008
00009 #ifndef OglGui_DropDownWindow_h
00010 #include "OglGui/DropDownWindow.h"
00011 #endif
00012
00013 #ifndef OglGui_ScrollWnd_h
00014 #include "OglGui/ScrollWnd.h"
00015 #endif
00016
00017 #ifndef OglGui_CheckBox_h
00018 #include "OglGui/CheckBox.h"
00019 #endif
00020
00021 #ifndef OglGui_RadioGroup_h
00022 #include "OglGui/RadioGroup.h"
00023 #endif
00024
00025 #include "Application/SDash/CameraEvent.h"
00026 #include "Application/SDash/CameraEventList.h"
00027
00028 namespace Impala {
00029 namespace Application {
00030 namespace SDash {
00031
00032 class CameraEventListPane : public OglGui::Window,
00033 public OglGui::RadioGroupListener,
00034 public OglGui::CheckBoxListener,
00035 public OglGui::AlertTimeLineListener,
00036 public OglGui::ButtonListener
00037 {
00038 typedef OglGui::Window Window;
00039 typedef OglGui::Button Button;
00040 typedef OglGui::StaticText StaticText;
00041 typedef OglGui::ButtonListener ButtonListener;
00042 typedef OglGui::CheckBox CheckBox;
00043 typedef OglGui::CheckBoxListener CheckBoxListener;
00044 typedef OglGui::RadioGroup RadioGroup;
00045 typedef OglGui::RadioGroupListener RadioGroupListener;
00046 typedef OglGui::DropDownWindow DropDownWindow;
00047 typedef OglGui::ScrollWnd ScrollWnd;
00048 typedef OglGui::AlertTimeLine AlertTimeLine;
00049
00050 public:
00051 CameraEventListPane(int x, int y, int w, int h) :
00052 Window(x,y,w,h)
00053 {
00054 Init(w, h);
00055 }
00056 CameraEventListPane(Window* parent, int w, int h) :
00057 Window(parent,w,h)
00058 {
00059 Init(w, h);
00060 }
00061 CameraEventListPane(Window* parent, int x, int y, int w, int h) :
00062 Window(parent,x,y,w,h)
00063 {
00064 Init(w, h);
00065 }
00066
00067 virtual void ButtonSelectionEvent(Button *src, void* userData)
00068 {
00069 mCameraEventList->DiscardCurrent();
00070 }
00071
00072 virtual void CheckBoxEvent(CheckBox *src, bool checked, void* userData)
00073 {
00074 mCameraEventList->HideDiscarded(checked);
00075 }
00076
00077
00078 virtual void OnRadioChange(RadioGroup *src, int nr, void* data)
00079 {
00080 if (nr == 15)
00081 mCameraEventList->ShowAllCameras();
00082 else
00083 {
00084 int camId = nr + 1;
00085 mCameraEventList->ShowCameraWithId(camId);
00086 }
00087 mScrollWnd->VerticalScrollBar()->SetNewPos(0);
00088 mCameraEventList->SelectTopCameraEvent();
00089 }
00090
00091 virtual void
00092 AlertSelectionEvent(AlertTimeLine *src,int btnId,int btnData,void* userData)
00093 {
00094 CameraEvent* cameraEvent = (CameraEvent*) btnData;
00095 int camId = btnId;
00096 EventList()->ShowCameraWithId(camId);
00097 Button* btn;
00098
00099
00100 if (WhichCameraRadioGroup()->GetActiveRadio() == camId-1)
00101 {
00102 btn = WhichCameraRadioGroup()->GetButton(camId);
00103 WhichCameraRadioGroup()->ButtonSelectionEvent(btn,(void*)camId);
00104 }
00105 btn = WhichCameraRadioGroup()->GetButton(camId-1);
00106 WhichCameraRadioGroup()->ButtonSelectionEvent(btn, (void*)(camId - 1));
00107 EventList()->SelectCameraEvent(cameraEvent);
00108 }
00109
00110 CameraEventList* EventList() { return mCameraEventList; }
00111 CheckBox* HideDiscardedCheck() { return mHideDiscardedCheck; }
00112 Button* ShowAllCameraButton() { return mShowAllCameraButton; }
00113 Button* DiscardButton() { return mDiscardButton; }
00114 RadioGroup* WhichCameraRadioGroup() { return mWhichCameraRadioGroup; }
00115 ScrollWnd* Scroller() { return mScrollWnd; }
00116
00117 private:
00118 void Init(int w, int h)
00119 {
00120 SetBorderType(BEV_ETCHED);
00121
00122 mScrollWnd = new ScrollWnd(this,2,60,w-4,h-64,true,0,1);
00123
00124 mCameraEventList =
00125 new CameraEventList(mScrollWnd->ContentHolder(),0,0,300,20,"Events");
00126 mCameraEventList->SetBorderType(0);
00127 mScrollWnd->ReplaceContentPane(mCameraEventList);
00128
00129 mCameraEventList->DropDown(true);
00130
00131 mHideDiscardedCheck = new CheckBox(this,4,34,w-30,22,"Hide Discarded");
00132 mHideDiscardedCheck->SetCheckBoxListener(this);
00133
00134 mDiscardButton = new Button(this,w-124,34,120,22,"Discard",BEV_ETCHED,true);
00135 mDiscardButton->SetButtonListener(this);
00136
00137 mWhichCameraRadioGroup = new RadioGroup(this,2,2,w-4,30,2);
00138 Button* btn;
00139 char buf[40];
00140 int rW = (w-40)/15;
00141 int i;
00142 for (i=0; i<15; i++)
00143 {
00144 sprintf(buf, "%d", i+1);
00145 btn = new Button(mWhichCameraRadioGroup,2+i*(rW+1),3,rW,24,buf,
00146 BEV_RAISED, true);
00147 mWhichCameraRadioGroup->Add(btn);
00148 }
00149 btn = new Button(mWhichCameraRadioGroup,2+i*(rW+1),3,rW,24,"All",
00150 BEV_RAISED, true);
00151 mWhichCameraRadioGroup->Add(btn);
00152 mWhichCameraRadioGroup->SetActiveRadio(15);
00153 mWhichCameraRadioGroup->SetRadioListener(this);
00154 mWhichCameraRadioGroup->ScaleChildren();
00155
00156 ScaleChildren();
00157 }
00158
00159 ScrollWnd* mScrollWnd;
00160 CameraEventList* mCameraEventList;
00161 CheckBox* mHideDiscardedCheck;
00162 Button* mShowAllCameraButton;
00163 Button* mDiscardButton;
00164 RadioGroup* mWhichCameraRadioGroup;
00165 };
00166
00167 }
00168 }
00169 }
00170 #endif