00001 #ifndef Impala_Visualization_OptionsLook_h
00002 #define Impala_Visualization_OptionsLook_h
00003
00004 #ifndef OglGui_Window_h
00005 #include "OglGui/Window.h"
00006 #endif
00007
00008 #ifndef Impala_Basis_CmdOptions_h
00009 #include "Basis/CmdOptions.h"
00010 #endif
00011
00012 namespace Impala {
00013 namespace Visualization {
00014
00015 void
00016 DoOptionsLook(OglGui::Window* wnd, String base)
00017 {
00018 if (base.empty())
00019 return;
00020
00021 CmdOptions& options = CmdOptions::GetInstance();
00022
00023 int brdType = options.GetInt(base+"BorderType",10);
00024 if (brdType != 10)
00025 wnd->SetBorderType(brdType);
00026
00027 std::string colStr = options.GetString(base+"Bg");
00028 if (!colStr.empty())
00029 wnd->SetBackground(OglColorStr(colStr.c_str()));
00030
00031 std::string brdStr = options.GetString(base+"BorderBg");
00032 if (!brdStr.empty())
00033 wnd->SetBorderBackground(OglColorStr(brdStr.c_str()));
00034
00035 int colShade = options.GetInt(base+"Shade",10);
00036 float colShOpac = options.GetDouble(base+"ShadeOpacity",0.5);
00037 if (colShade != 10 && colShade != 0)
00038 {
00039 wnd->SetBorderFillShaded(colShade);
00040 wnd->SetBorderFillOpacity(colShOpac);
00041 }
00042 }
00043
00044 void
00045 OptionsLook(OglGui::Window* wnd, String base, String special="")
00046 {
00047
00048 CmdOptions& options = CmdOptions::GetInstance();
00049 if (!base.empty())
00050 DoOptionsLook(wnd, base);
00051 if (!special.empty())
00052 DoOptionsLook(wnd, special);
00053 }
00054
00055
00056 void OptionsLooks(OglGui::Window* wnd, String special="")
00057 {
00058 OGLWND* oglWnd = wnd->GetOGLWND();
00059 LIST *obj;
00060
00061
00062
00063 if (!special.empty())
00064 OptionsLook(wnd,special);
00065 else
00066 OptionsLook(wnd, wnd->GuiGeneralName(), wnd->GuiName());
00067 for (obj=oglWnd->wndList; obj; obj = obj->next)
00068 {
00069 oglWnd = (OGLWND*) obj->info;
00070
00071 OglGui::Window* child;
00072 if (child = (OglGui::Window*) OglGui::OglWindow::GetOglWindow(oglWnd))
00073 {
00074 if (!child->GuiName().empty())
00075 OptionsLooks(child,child->GuiName());
00076 else
00077 OptionsLooks(child);
00078 if (!special.empty())
00079 {
00080 OptionsLooks(child,special);
00081 if (!child->GuiGeneralName().empty())
00082 OptionsLook(child, special + "." + child->GuiGeneralName());
00083 if (!child->GuiName().empty())
00084 OptionsLooks(child,special + "." + child->GuiName());
00085 }
00086 }
00087 }
00088 }
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125 }
00126 }
00127 #endif