00001 #ifndef Impala_Visualization_StatusbarOverlayWindow_h
00002 #define Impala_Visualization_StatusbarOverlayWindow_h
00003
00004 #include "Basis/String.h"
00005
00006 #include "OglGui/Window.h"
00007 #include "OglGui/StaticText.h"
00008 #include "OglGui/ProgressBar.h"
00009 #include "OglGui/RepeatTimer.h"
00010
00011 namespace Impala {
00012 namespace Visualization {
00013
00014
00015
00016 class StatusOverlayWindow : public OglGui::Window,
00017 OglGui::RepeatTimer
00018 {
00019
00020 public:
00021 typedef OglGui::Window Window;
00022 typedef OglGui::ProgressBar ProgressBar;
00023 typedef OglGui::StaticText StaticText;
00024
00025 StatusOverlayWindow(Window *p) :
00026 Window(p,p->W()/3.0,p->H()/4.0,p->W()/3.0,48),
00027 RepeatTimer(1200, 1200)
00028 {
00029 mParent = p;
00030 SetVisible(false);
00031
00032 SetRoundness(15,15,15,15);
00033 SetBorderType(4);
00034 SetBorderFillShaded(2);
00035 mProgressBar = new ProgressBar(this,0,14,W(),20);
00036 mMin = new StaticText(this,5,0,40,14,"MIN");
00037 mMax = new StaticText(this,W()-45,0,40,14,"MAX");
00038 mCur = new StaticText(this,5,0,W()-10,14,"CUR");
00039 mTitle = new StaticText(this,5,34,W()-10,14,"Particulating Splines");
00040
00041
00042 ConnectTo(p, OglGui::TOBOTTOM | OglGui::TOLEFTRIGHT);
00043 mMin->ConnectTo(this, OglGui::TOLEFTRIGHT);
00044 mMax->ConnectTo(this, OglGui::TORIGHT);
00045 mCur->ConnectTo(this, OglGui::TOLEFTRIGHT);
00046 mTitle->ConnectTo(this, OglGui::TOLEFTRIGHT);
00047 mProgressBar->ConnectTo(this, OglGui::TOLEFTRIGHT);
00048 }
00049
00050 void ShowStatus(String message, double value, int min, int max)
00051 {
00052 if (min > max)
00053 {
00054 max = max + min;
00055 min = max - min;
00056 max = max - min;
00057 }
00058 oglSys.SetAlwaysDraw(GetOGLWND(), 1);
00059 mTitle->SetText(message);
00060 mMax->SetText(MakeString(max));
00061 mMin->SetText(MakeString(min));
00062 mCur->SetText(MakeString(value));
00063 double d = (double)(value - min) / (double)max;
00064 mProgressBar->SetColors(oglLIGHTGREY, oglDARKGREEN);
00065 mProgressBar->SetVisible(true);
00066 mProgressBar->SetProgress(d * 100);
00067 StartRepeatTime();
00068 SetVisible(true);
00069 }
00070
00071 void ShowStatus(String message, bool value)
00072 {
00073 SetVisible(true);
00074 oglSys.SetAlwaysDraw(GetOGLWND(), 1);
00075 mTitle->SetText(message);
00076 mMax->SetText("");
00077 mMin->SetText("");
00078 mProgressBar->SetVisible(true);
00079 mCur->SetText(value ? "enabled" : "disabled");
00080 if (value)
00081 mProgressBar->SetColors(oglDARKGREEN, oglDARKGREEN);
00082 else
00083 mProgressBar->SetColors(oglDARKRED, oglDARKRED);
00084 mProgressBar->SetProgress(100);
00085 StartRepeatTime();
00086 }
00087
00088 void ShowStatus(String message, String value, ULONG color=0)
00089 {
00090 SetVisible(true);
00091 oglSys.SetAlwaysDraw(GetOGLWND(), 1);
00092 mTitle->SetText(message);
00093 mMax->SetText("");
00094 mMin->SetText("");
00095 mCur->SetText(value);
00096 mProgressBar->SetProgress(100);
00097 mProgressBar->SetVisible(color > 0);
00098 if (color > 0)
00099 mProgressBar->SetColors(color, color);
00100 StartRepeatTime();
00101 }
00102
00103
00104 void HideStatus()
00105 {
00106 SetVisible(false);
00107 oglSys.SetAlwaysDraw(GetOGLWND(), 0);
00108
00109 GetParent()->UpdateScene();
00110 }
00111
00112 private:
00113 virtual void DisplayFunc()
00114 {
00115 if (RepeatTime())
00116 HideStatus();
00117 }
00118
00119 Window* mParent;
00120 ProgressBar* mProgressBar;
00121 StaticText* mMin;
00122 StaticText* mCur;
00123 StaticText* mMax;
00124 StaticText* mTitle;
00125 };
00126
00127 }
00128 }
00129
00130 #endif