00001 #ifndef Impala_Visualization_RotorBrowser_RotorBrowserControl_h
00002 #define Impala_Visualization_RotorBrowser_RotorBrowserControl_h
00003
00004
00005
00006
00007
00008
00009 #include <list>
00010
00011 #include "RotorBrowser.h"
00012 #include "Core/Trec/ThreadSet.h"
00013
00014
00015 namespace Impala {
00016 namespace Visualization {
00017 namespace RotorBrowser {
00018
00019 using namespace Impala::Core::Trec;
00020
00021 class BrowserControl : public OglGui::Window,
00022 public OglGui::ButtonListener
00023 {
00024 public:
00025 BrowserControl(OglGui::Window *wnd, int w, int h, RotorBrowser *b,
00026 ThreadSet *threadset) :
00027 OglGui::Window(wnd,w,h)
00028 {
00029 Init(b, threadset);
00030 }
00031 BrowserControl(OglGui::Window *wnd, int x, int y, int w, int h,
00032 RotorBrowser *b, ThreadSet *threadset) :
00033 OglGui::Window(wnd,x,y,w,h)
00034 {
00035 Init(b, threadset);
00036 }
00037
00038 virtual void ButtonSelectionEvent(Button *src, void* vData)
00039 {
00040
00041 int userData = (int)(long long) vData;
00042 switch (userData) {
00043 case 1:
00044 ILOG_USER("BUTTON: switch browser to CrossBrowser");
00045 mBrowser->SetBrowseMode(RotorBrowser::MODE_CROSSBROWSER);
00046 break;
00047 case 2:
00048 ILOG_USER("BUTTON: switch browser to RotorBrowser");
00049 mBrowser->SetBrowseMode(RotorBrowser::MODE_ROTORBROWSER);
00050 break;
00051 case 3:
00052 mBrowser->SetEnableShotSwallow(!mBrowser->GetEnableShotSwallow());
00053 ILOG_USER("BUTTON: toggle enable shot swallow. Now " <<
00054 mBrowser->GetEnableShotSwallow());
00055 mBrowser->UpdateViewsToContext();
00056 break;
00057 case 4:
00058 mBrowser->SetActiveHorizontal(!mBrowser->GetActiveHorizontal());
00059 ILOG_USER("BUTTON: toggle active horiziontal. Now " <<
00060 mBrowser->GetActiveHorizontal());
00061 break;
00062 case 5:
00063 ILOG_USER("BUTTON: toggle show direction. Now " <<
00064 mBrowser->GetShowDirection());
00065 mBrowser->SetShowDirection(!mBrowser->GetShowDirection());
00066 break;
00067 }
00068 }
00069
00070 private:
00071 void Init (RotorBrowser *b, ThreadSet *t)
00072 {
00073 ownc = 2;
00074 mThreadSet = t;
00075
00076 SetBorderFillShaded(2);
00077 SetBorderType(3);
00078 SetRoundness(5,5,5,5);
00079 mBrowser = b;
00080 Button *first = new Button(this, 200, 20, "F5: CrossBrowser mode");
00081 Button *second = new Button(this, 200, 20, "F6: RotorBrowser mode");
00082 Button *movefirst = new Button(this, 200, 20, "F7: Toggle shot hiding");
00083 Button *bar = new Button(this, 200, 20, "Toggle bar");
00084 Button *turn = new Button(this, 200, 20, "Toggle positioning");
00085 first->SetButtonListener(this, 1);
00086 second->SetButtonListener(this, 2);
00087 movefirst->SetButtonListener(this, 3);
00088 bar->SetButtonListener(this, 5);
00089 turn->SetButtonListener(this, 4);
00090 }
00091
00092 RotorBrowser* mBrowser;
00093 ThreadSet* mThreadSet;
00094 int ownc;
00095 int mNr;
00096
00097 ILOG_VAR_DEC;
00098 };
00099 ILOG_VAR_INIT(BrowserControl, Visualization.RotorBrowser);
00100
00101 }
00102 }
00103 }
00104
00105 #endif