#include #include #include #include #include #include class MyFrame : public TGMainFrame { public: MyFrame(const TGWindow *p, UInt_t w, UInt_t h); ~MyFrame(); private: void CreateFrame(TGCompositeFrame*, const Int_t w=200); private: TGListBox *fFilesListBox; TGTextButton *fBut; ClassDef(MyFrame, 0) }; MyFrame::~MyFrame(){ Cleanup(); } MyFrame::MyFrame(const TGWindow *p, UInt_t w, UInt_t h) : TGMainFrame(p, w, h){ TGVerticalFrame *vframe = new TGVerticalFrame(this); CreateFrame(vframe); SetCleanup(kDeepCleanup); AddFrame(vframe, new TGLayoutHints(kLHintsExpandX|kLHintsExpandY|kLHintsCenterY,5,5,5,5)); SetMWMHints(kMWMDecorAll,kMWMFuncAll,kMWMInputModeless); MapSubwindows(); Resize(GetDefaultSize()); MapWindow(); Resize(300,100); } void MyFrame::CreateFrame(TGCompositeFrame *parent, const Int_t frameWidth){ TGHorizontalFrame *hframe = new TGHorizontalFrame(parent); TGVerticalFrame *vframe = new TGVerticalFrame(hframe, frameWidth, 100, kVerticalFrame); fFilesListBox = new TGListBox(vframe); fFilesListBox->SetMultipleSelections(true); vframe->AddFrame(fFilesListBox, new TGLayoutHints(kLHintsNormal|kLHintsExpandY|kLHintsExpandX,2,2,2,2)); gClient->NeedRedraw(fFilesListBox->GetContainer()); TString str("A long entry for a TGListBox, would like to be able to see a scroll-bar ?"); fFilesListBox->AddEntry(str,0); fFilesListBox->Layout(); fBut = new TGTextButton(vframe,"Button"); fBut->SetTextJustify(36); fBut->SetMargins(1,1,1,1); fBut->SetWrapLength(-1); vframe->AddFrame(fBut, new TGLayoutHints(kLHintsCenterX|kLHintsExpandX,2,2,2,2)); hframe->AddFrame(vframe, new TGLayoutHints(kLHintsExpandY|kLHintsExpandX,2,2,2,2)); parent->AddFrame(hframe, new TGLayoutHints(kLHintsExpandX|kLHintsCenterY,2,2,2,2)); } void simple(){ new MyFrame(gClient->GetRoot(), 300, 200); }