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

ImageDirModule.h

Go to the documentation of this file.
00001 /*
00002  * ImageDirModule.h
00003  *
00004  *  Created on: 30-sep-2009
00005  *      Author: dodijk
00006  */
00007 
00008 #ifndef IMAGEDIRMODULE_H
00009 #define IMAGEDIRMODULE_H
00010 
00011 #include "../TableDataSourceImageDir.h"
00012 
00013 namespace Impala { namespace Application { namespace MediaTable {
00014 
00015 class ImageDirModule : public TableDataSourceModule {
00016 public:
00017         ImageDirModule() : TableDataSourceModule("ImageDir") {}
00018 
00019         void ButtonSelectionEvent(OglGui::Button *src, void *userData)
00020         {
00021                 if(src->GetLabel() == "New " + GetName())
00022                 {
00023                         StoreConfigWindowValues();
00024                         if(mStringValues["Name"] == "")
00025                         {
00026                                 SetErrorMessage(mConfigWindow, "Name can not be empty.");
00027                                 return;
00028                         }
00029                         if(mStringValues["Directory"] == "")
00030                         {
00031                                 SetErrorMessage(mConfigWindow, "Directory can not be empty.");
00032                                 return;
00033                         } else {
00034                                 // TODO: Check if folder exists?
00035                         }
00036                         DoHandleNewTableDataSource();
00037                         delete mConfigWindow;
00038                         DoReleaseConfigWindow();
00039                 }
00040                 else
00041                         TableDataSourceModule::ButtonSelectionEvent(src, userData);
00042     }
00043 
00044         void ModuleSelected()
00045         {
00046                 DrawConfigWindow();
00047                 OglGui::GroupBox* grp = new OglGui::GroupBox(mConfigWindow, mConfigWindow->W()-2, 362, "");
00048 
00049                 AddTextField(grp, "Name");
00050                 AddTextField(grp, "Directory");
00051 
00052                 (new OglGui::Button(grp, grp->W()-4, 26, "New "+GetName(), BEV_ETCHED))
00053                         ->SetButtonListener(this);
00054 
00055                 grp->RepositionViewports();
00056                 grp->ScaleChildren();
00057         }
00058 
00059         TableDataSource* NewTableDataSource()
00060         {
00061                 TableDataSource* source;
00062                 source = new TableDataSourceImageDir(mStringValues["Directory"]);
00063                 TableDataStore* store = TableDataStore::GetInstance();
00064                 store->AddTableDataSource(mStringValues["Name"], source);
00065                 return source;
00066         }
00067 };
00068 
00069 } } }  /* Namespace Impala::Application::MediaTable */
00070 
00071 #endif /* IMAGEDIRMODULE_H */

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