00001 /* 00002 * TableDataSourceModule.h 00003 * 00004 * Created on: 26-aug-2009 00005 * Author: dodijk 00006 */ 00007 00008 #ifndef TABLEDATASOURCEMODULE_H 00009 #define TABLEDATASOURCEMODULE_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/TextField.h" 00020 00021 namespace Impala { namespace Application { namespace MediaTable { 00022 00023 class TableDataSourceModule; 00024 00025 class TableDataSourceModuleListener : public ConfigWindowModuleListener { 00026 public: 00027 TableDataSourceModuleListener() : ConfigWindowModuleListener("TableDataSourceModule") {} 00028 00029 virtual void HandleNewTableDataSource(TableDataSourceModule* module) {} 00030 }; 00031 00032 class TableDataSourceModule : 00033 public ConfigWindowModule, 00034 public OglGui::ButtonListener 00035 { 00036 public: 00037 TableDataSourceModule(std::string name) : ConfigWindowModule("TableDataSourceModule", name) { 00038 mErrorMessage = 0; 00039 } 00040 00041 // Event listener for contributing to a configuration window 00042 bool ContributeToConfigurationWindow(OglGui::Window* wnd, OglGui::Window* grp) { 00043 mConfigWindow = grp->GetParent(); 00044 (new OglGui::Button(grp, grp->W()-4, 26, GetName(), BEV_ETCHED))->SetButtonListener(this); 00045 return true; 00046 } 00047 00048 virtual void ButtonSelectionEvent(OglGui::Button *src, void *userData) 00049 { 00050 if(src->GetLabel() == GetName()) 00051 ModuleSelected(); 00052 } 00053 00054 virtual TableDataSource* NewTableDataSource() { return 0;} 00055 00056 virtual void ModuleSelected() { 00057 /* This event is fired when the module is selected in the configuration window. */ 00058 } 00059 00060 void DoHandleNewTableDataSource() { 00061 for (std::vector<ModuleListener*>::iterator it=mListeners.begin() ; it != mListeners.end(); it++ ) 00062 ((TableDataSourceModuleListener*) (*it))->HandleNewTableDataSource(this); 00063 } 00064 00065 ILOG_VAR_DEC; 00066 }; 00067 00068 ILOG_VAR_INIT(TableDataSourceModule, Application.MediaTable); 00069 00070 } } } /* Namespace Impala::Application::MediaTable */ 00071 00072 #endif /* TABLEDATASOURCEMODULE_H */