00001
00002
00003
00004
00005
00006
00007
00008 #ifndef VISUALIZATIONMODULE_H
00009 #define VISUALIZATIONMODULE_H
00010
00011 #include "ConfigWindowModule.h"
00012
00013 #include "../TableDataStore.h"
00014
00015 #include "OglGui/Button.h"
00016 #include "OglGui/TitledWindow.h"
00017 #include "OglGui/Strut.h"
00018 #include "OglGui/StringSelector.h"
00019 #include "OglGui/GroupBox.h"
00020
00021 #include "Visualization/RgbOglImage.h"
00022 #include "OglGui/GetOglImageByIdInterface.h"
00023
00024 namespace Impala {
00025 namespace Application {
00026 namespace MediaTable {
00027
00028 class VisualizationModule;
00029
00030 class VisualizationModuleListener : public ConfigWindowModuleListener {
00031 public:
00032 VisualizationModuleListener() : ConfigWindowModuleListener("VisualizationModule") {}
00033
00034 virtual void ReleaseConfigWindow() {}
00035
00036 virtual void HandleNewWindow(VisualizationModule* module) {}
00037 };
00038
00039 class VisualizationModule :
00040 public ConfigWindowModule,
00041 public OglGui::ButtonListener,
00042 public OglGui::GetOglImageByIdInterface
00043 {
00044 public:
00045 VisualizationModule(std::string name) : ConfigWindowModule("VisualizationModule", name) {
00046
00047 }
00048
00049 virtual OGLIMAGE* GetOglImageById(long long quid)
00050 {
00051 if(mGetOglImageByIdI != 0)
00052 return mGetOglImageByIdI->GetOglImageById(quid);
00053
00054 return Visualization::RgbOglImage::OglImage
00055 (TableDataStore::GetInstance()->GetImageDataByQuid(quid));
00056 }
00057
00058 void SetGetOglImageByIdInterface(OglGui::GetOglImageByIdInterface* i)
00059 {
00060 mGetOglImageByIdI = i;
00061 }
00062
00063
00064 bool ContributeToConfigurationWindow(OglGui::Window* wnd, OglGui::Window* grp) {
00065 mConfigWindow = grp->GetParent();
00066 (new OglGui::Button(grp, grp->W()-4, 26, GetName(), BEV_ETCHED))->SetButtonListener(this);
00067 return true;
00068 }
00069
00070 void ButtonSelectionEvent(OglGui::Button *src, void *userData)
00071 {
00072 if(src->GetLabel() == GetName())
00073 {
00074
00075
00076
00077 ClearConfigWindowValues();
00078 ModuleSelected();
00079 }
00080
00081 else
00082 if(src->GetLabel() == "Next")
00083 {
00084 StoreConfigWindowValues();
00085 ClearConfigWindowValues();
00086 ViewSelected();
00087 }
00088 }
00089
00090 virtual std::string GetNewWindowName()
00091 {
00092 return GetName();
00093 }
00094
00095 virtual void NewWindow(OglGui::Window* window) {}
00096
00097 void ModuleSelected() {
00098 VisualizationModule::DrawConfigWindow();
00099 OglGui::GroupBox* grp = new OglGui::GroupBox(mConfigWindow, mConfigWindow->W()-2, 362, "");
00100
00101 #ifdef MEDIATABLE_USING_MULTIPLE_VIEWS
00102 AddSelectorWithTableDataViews(grp, "View", GetName(), 304);
00103 #else
00104 AddSelectorWithTableDataViews(grp, "View", "", 304);
00105 #endif
00106 (new OglGui::Button(grp, grp->W()-4, 26, "Next", BEV_ETCHED))
00107 ->SetButtonListener(this);
00108
00109 grp->RepositionViewports();
00110 grp->ScaleChildren();
00111
00112 #ifndef MEDIATABLE_USING_MULTIPLE_VIEWS
00113 StoreConfigWindowValues();
00114 ClearConfigWindowValues();
00115 ViewSelected();
00116 #endif
00117 }
00118
00119 virtual void ViewSelected() {
00120
00121 }
00122
00123 void DoHandleNewWindow(std::string title, OglGui::Window* window) {
00124 for (std::vector<ModuleListener*>::iterator it=mListeners.begin() ; it != mListeners.end(); it++ )
00125 ((VisualizationModuleListener*) (*it))->HandleNewWindow(this);
00126 }
00127
00128 OglGui::GetOglImageByIdInterface* mGetOglImageByIdI;
00129 };
00130
00131 }
00132 }
00133 }
00134
00135 #endif