00001
00002
00003
00004
00005
00006
00007
00008 #ifndef FLICKRMODULE_H
00009 #define FLICKRMODULE_H
00010
00011 #include "../TableDataSourceFlickrPhotoList.h"
00012 #include "../RemoteRetriever.h"
00013
00014 namespace Impala { namespace Application { namespace MediaTable {
00015
00016 class FlickrModule : public TableDataSourceModule {
00017 public:
00018 FlickrModule() : TableDataSourceModule("Flickr") {}
00019
00020 void ButtonSelectionEvent(OglGui::Button *src, void *userData)
00021 {
00022 if(src->GetLabel() == "New " + GetName())
00023 {
00024 StoreConfigWindowValues();
00025 if(mStringValues["Name"] == "")
00026 {
00027 SetErrorMessage(mConfigWindow, "Name can not be empty.");
00028 return;
00029 }
00030 DoHandleNewTableDataSource();
00031 delete mConfigWindow;
00032 DoReleaseConfigWindow();
00033 }
00034 else
00035 TableDataSourceModule::ButtonSelectionEvent(src, userData);
00036 }
00037
00038 void ModuleSelected()
00039 {
00040 DrawConfigWindow();
00041 OglGui::GroupBox* grp = new OglGui::GroupBox(mConfigWindow, mConfigWindow->W()-2, 362, "");
00042
00043 AddTextField(grp, "Name");
00044 AddTextField(grp, "Flickr API URL", "");
00045
00046 (new OglGui::Button(grp, grp->W()-4, 26, "New "+GetName(), BEV_ETCHED))
00047 ->SetButtonListener(this);
00048
00049 grp->RepositionViewports();
00050 grp->ScaleChildren();
00051 }
00052
00053 TableDataSource* NewTableDataSource()
00054 {
00055 TableDataSource* source;
00056 source = new TableDataSourceFlickrPhotoList(mStringValues["Flickr API URL"]);
00057 TableDataStore* store = TableDataStore::GetInstance();
00058 store->AddTableDataSource(mStringValues["Name"], source);
00059 return source;
00060 }
00061 };
00062
00063 } } }
00064
00065 #endif // FLICKRMODULE_H