00001 #ifndef OglGui_InfoViewer_h 00002 #define OglGui_InfoViewer_h 00003 00004 #ifndef OglGui_TitledWindow_h 00005 #include "OglGui/TitledWindow.h" 00006 #endif 00007 00008 #ifndef OglGui_TextEdit_h 00009 #include "OglGui/TextEdit.h" 00010 #endif 00011 00012 namespace OglGui { 00013 00014 class InfoViewer : public TitledWindow 00015 { 00016 public: 00017 InfoViewer(Window *parent, int x, int y, int width, int height, 00018 strconst title="Info", strconst fName="README.txt") : 00019 TitledWindow(parent, x, y, width, height, title, 1) 00020 { 00021 Init(fName); 00022 } 00023 00024 TextEdit* Editor() 00025 { 00026 return mEditor; 00027 } 00028 00029 private: 00030 void Init(strconst fName) 00031 { 00032 mEditor = new TextEdit(this, 0, 0, 10, 10, "", 3); 00033 mEditor->SetBackground(0); 00034 mEditor->SetBorderBackground(0x80ffffff); 00035 mEditor->Editable(false); 00036 mEditor->SetBorderFillShaded(2); 00037 this->SetRoundness(0,0,0,0); 00038 this->SetContentPane(mEditor); 00039 if (!mEditor->ReadFile(fName)) 00040 { 00041 char buf[2048]; 00042 sprintf(buf, "File : [%s] not found", fName.c_str()); 00043 mEditor->SetText(buf); 00044 } 00045 } 00046 00047 TextEdit *mEditor; 00048 }; 00049 } 00050 #endif