00001 #ifndef MediaTable_TableControlBarWindow_h
00002 #define MediaTable_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 MediaTable {
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, int width, int height) :
00023 Window(parent, width, height)
00024 {
00025 Init(table, width, height);
00026 }
00027
00028 TableControlBarWindow(Window* parent, TableWindow *table, int x, int y, int width, int height) :
00029 Window(parent, x, y, width, height)
00030 {
00031 Init(table, width, height);
00032 }
00033
00034
00035
00036 virtual void CheckBoxEvent(CheckBox *src, bool checked, void *userData)
00037 {
00038 int idx = (long long)userData;
00039 switch (idx)
00040 {
00041 case CHECK_ZOOM:
00042 mTable->SetAutoZoom(checked);
00043 break;
00044 case CHECK_PREVIEW:
00045 mTable->SetShowPreview(checked);
00046 break;
00047 case CHECK_VZOOM:
00048 mTable->SetColumnCondense(checked);
00049 break;
00050 }
00051 }
00052
00053 virtual void ButtonSelectionEvent(Button *src, void* userData)
00054 {
00055 if (userData == (void*) BUTTON_RESETFILTERS)
00056 {
00057 ILOG_DEBUG("Reset filters");
00058 mTable->ResetFilters();
00059 }
00060 }
00061
00062 private :
00063
00064 void Init(TableWindow *table, int w, int h)
00065 {
00066 mTable = table;
00067
00068 SetBorderType(1);
00069 SetBorderFillShaded(DEEP_SHADE_UP);
00070
00071 Button *b = new Button(this, 120, 28, "reset filters");
00072 b->SetButtonListener(this, BUTTON_RESETFILTERS);
00073
00074 mHorZoom = new CheckBox(this, 130, 28, "horizontal zoom", true);
00075 mHorZoom->SetCheckBoxListener(this, CHECK_ZOOM);
00076 CheckBox* c = new CheckBox(this, 130, 28, "vertical zoom", true);
00077 c->SetCheckBoxListener(this, CHECK_VZOOM);
00078 c = new CheckBox(this, 130, 28, "detailed preview");
00079 c->SetCheckBoxListener(this, CHECK_PREVIEW);
00080
00081
00082
00083 mTable->SetAutoZoom(true);
00084 mTable->SetColumnCondense(true);
00085 }
00086
00087 TableWindow* mTable;
00088 CheckBox* mHorZoom;
00089
00090 static const int CHECK_ZOOM = 1;
00091 static const int CHECK_PREVIEW = 2;
00092 static const int CHECK_VZOOM = 3;
00093 static const int BUTTON_RESETFILTERS = 4;
00094
00095 ILOG_VAR_DEC;
00096 };
00097
00098 ILOG_VAR_INIT(TableControlBarWindow, Application.MediaTable);
00099
00100 }
00101 }
00102 }
00103 #endif // TableControlBarWindow_h