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

TableControlBarWindow.h

Go to the documentation of this file.
00001 #ifndef VideoExcel_TableControlBarWindow_h
00002 #define VideoExcel_TableControlBarWindow_h
00003 
00004 #include "TableWindow.h"
00005 #include "GridWindow.h"
00006 #include "OglGui/Button.h"
00007 #include "OglGui/CheckBox.h"
00008 
00009 namespace Impala {
00010 namespace Application {
00011 namespace VideoExcel {
00012 
00013 class TableControlBarWindow :   public OglGui::Window,
00014                                 OglGui::ButtonListener,
00015                                 OglGui::CheckBoxListener
00016 {
00017 public:
00018     typedef OglGui::Window                          Window;
00019     typedef OglGui::Button                          Button;
00020     typedef OglGui::CheckBox                        CheckBox;
00021 
00022     TableControlBarWindow(Window* parent, TableWindow *table, GridWindow *grid,
00023                           int width, int height) :
00024         Window(parent, width, height)
00025     {
00026         Init(table, grid, width, height);
00027     }
00028 
00029     TableControlBarWindow(Window* parent, TableWindow *table, GridWindow* grid,
00030                           int x, int y, int width, int height) :
00031         Window(parent, x, y, width, height)
00032     {
00033         Init(table, grid, width, height);
00034     }
00035 
00036 // Listeners
00037 
00038     virtual void CheckBoxEvent(CheckBox *src, bool checked, void *userData)
00039     {
00040         int idx = (long long)userData;
00041         switch (idx)
00042         {
00043             case CHECK_GRID:
00044                 SwitchMode(checked);
00045                 break;
00046             case CHECK_ZOOM:
00047                 mTable->SetAutoZoom(checked);
00048                 break;
00049             case CHECK_PREVIEW:
00050                 mTable->SetShowPreview(checked);
00051                 break;
00052         }
00053     }
00054 
00055     virtual void ButtonSelectionEvent(Button *src, void* userData)
00056     {
00057         if (userData == (void*) BUTTON_RESETFILTERS)
00058         {
00059             ILOG_DEBUG("Reset filters");
00060             mTable->ResetFilters();
00061         }
00062     }
00063 
00064     void SwitchMode(bool to_grid)
00065     {
00066         if (to_grid)
00067         {
00068             mTable->SetVisible(false);
00069             mGrid->SetVisible(true);
00070             mHorZoom->SetVisible(false);
00071             mGrid->SetListenTableUpdates(true);
00072             mTable->SetListenTableUpdates(false);
00073             mGrid->UpdateScrollFromSourceEvent();
00074             mGrid->UpdateNumberOfRowsEvent();
00075             mGrid->UpdateRowsEvent();
00076         }
00077         else
00078         {
00079             mHorZoom->SetVisible(true);
00080             mGrid->SetVisible(false);
00081             mTable->SetVisible(true);
00082             mGrid->SetListenTableUpdates(false);
00083             mTable->SetListenTableUpdates(true);
00084             mTable->UpdateScrollFromSourceEvent();
00085             mTable->UpdateNumberOfRowsEvent();
00086             mTable->UpdateRowsEvent();
00087         }
00088     }
00089 
00090 private :
00091 
00092     void Init(TableWindow *table, GridWindow *grid, int w, int h)
00093     {
00094         mTable = table;
00095         mGrid  = grid;
00096 
00097         SetBorderType(1);
00098         SetBorderFillShaded(DEEP_SHADE_UP);
00099 
00100         Button *b = new Button(this, 120, 28, "reset filters");
00101         b->SetButtonListener(this, BUTTON_RESETFILTERS);
00102 
00103         CheckBox *c = new CheckBox(this, 130, 28, "display as grid");
00104         c->SetCheckBoxListener(this, CHECK_GRID);
00105 
00106         mHorZoom = new CheckBox(this, 130, 28, "horizontal zoom");
00107         mHorZoom->SetCheckBoxListener(this, CHECK_ZOOM);
00108         c = new CheckBox(this, 130, 28, "detailed preview");
00109         c->SetCheckBoxListener(this, CHECK_PREVIEW);     
00110     }
00111 
00112     TableWindow*    mTable;
00113     GridWindow*     mGrid;
00114     CheckBox*       mHorZoom;
00115 
00116     static const int CHECK_GRID = 3;
00117     static const int CHECK_ZOOM = 1;
00118     static const int CHECK_PREVIEW = 2;
00119     static const int BUTTON_RESETFILTERS = 4;
00120 
00121     ILOG_VAR_DEC;
00122 };
00123 
00124 ILOG_VAR_INIT(TableControlBarWindow, Application.VideoExcel);
00125 
00126 } // namespace VideoExcel
00127 } // namespace Application
00128 } // namespace Impala
00129 #endif // TableControlBarWindow_h

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