00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #include <TSystem.h>
00011 #include <TGButton.h>
00012 #include <TGLabel.h>
00013 #include <TGPicture.h>
00014 #include <TGIcon.h>
00015 #include <TGResourcePool.h>
00016
00017 #include "GTitleFrame.h"
00018
00019
00020
00021
00022
00023
00024
00025 GTitleFrame::GTitleFrame(const TGWindow *p, const char *mainText,
00026 const char *subText, UInt_t w, UInt_t h,
00027 UInt_t options) : TGCompositeFrame(p, w, h, options)
00028 {
00029
00030
00031
00032 Pixel_t col;
00033 TString fontname("-*-times-bold-r-*-*-24-*-*-*-*-*-*-*");
00034 gClient->GetColorByName("red", col);
00035
00036
00037 TString theLeftLogoFilename = StrDup(gProgPath);
00038 theLeftLogoFilename.Append("/icons/left.xpm");
00039 fLeftIconPicture = (TGPicture *)gClient->GetPicture(theLeftLogoFilename);
00040 fLeftIcon = new TGIcon(this, fLeftIconPicture,
00041 fLeftIconPicture->GetWidth(),
00042 fLeftIconPicture->GetHeight());
00043 fLeftLogoLayout = new TGLayoutHints(kLHintsLeft, 0, 0, 0, 0);
00044 AddFrame(fLeftIcon, fLeftLogoLayout);
00045
00046 TString theRightLogoFilename = StrDup(gProgPath);
00047 theRightLogoFilename.Append("/anim/anim01.xpm");
00048 fRightIconPicture = (TGPicture *)gClient->GetPicture(theRightLogoFilename);
00049 fRightIcon = new TGIcon(this, fRightIconPicture,
00050 fRightIconPicture->GetWidth(),
00051 fRightIconPicture->GetHeight());
00052 fRightLogoLayout = new TGLayoutHints(kLHintsRight, 0, 0, 0, 0);
00053 AddFrame(fRightIcon, fRightLogoLayout);
00054
00055
00056 fTextFrameLayout = new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 0, 0, 0, 0);
00057 fTextLabelLayout = new TGLayoutHints(kLHintsTop | kLHintsExpandX, 10, 10, 10, 10);
00058 fTextFrame = new TGCompositeFrame(this, 0, 0, kVerticalFrame);
00059 fTextLabel1 = new TGLabel(fTextFrame, mainText);
00060 fTextLabel1->SetTextFont(fontname.Data());
00061 fTextLabel1->SetTextColor(col);
00062
00063 fTextLabel2 = new TGLabel(fTextFrame, subText);
00064 fTextLabel2->SetTextFont(fontname.Data());
00065 fTextLabel2->SetTextColor(col);
00066 fTextFrame->AddFrame(fTextLabel1, fTextLabelLayout);
00067 fTextFrame->AddFrame(fTextLabel2, fTextLabelLayout);
00068
00069 AddFrame(fTextFrame, fTextFrameLayout);
00070 }
00071
00072
00073 void GTitleFrame::ChangeRightLogo(Int_t frame)
00074 {
00075
00076
00077 Char_t name[12];
00078 TString theRightLogoFilename = StrDup(gProgPath);
00079 sprintf(name,"%02d.xpm",frame);
00080 theRightLogoFilename.Append("/anim/anim");
00081 theRightLogoFilename.Append(name);
00082 gClient->FreePicture(fRightIconPicture);
00083 fRightIconPicture = (TGPicture *)gClient->GetPicture(theRightLogoFilename);
00084 fRightIcon->SetPicture(fRightIconPicture);
00085 }
00086
00087
00088 GTitleFrame::~GTitleFrame()
00089 {
00090
00091
00092 gClient->FreePicture(fLeftIconPicture);
00093 gClient->FreePicture(fRightIconPicture);
00094 delete fTextLabel1;
00095 delete fTextLabel2;
00096 delete fTextFrame;
00097 delete fTextLabelLayout;
00098 delete fTextFrameLayout;
00099 delete fLeftLogoLayout;
00100 delete fRightLogoLayout;
00101 }
00102