23 class MyMainFrame :
public TGMainFrame {
26 MyMainFrame(
const TGWindow *p, UInt_t w, UInt_t h);
27 virtual ~MyMainFrame();
31 ClassDef(MyMainFrame, 0)
35 void MyMainFrame::DoSave()
37 Printf(
"Save in progress...");
42 MyMainFrame::MyMainFrame(
const TGWindow *p, UInt_t w, UInt_t h) :
47 TGHorizontalFrame *fHf =
new TGHorizontalFrame(
this, 50, 50);
49 TGVerticalFrame *fV1 =
new TGVerticalFrame(fHf, 10, 10, kFixedWidth);
50 TGVerticalFrame *fV2 =
new TGVerticalFrame(fHf, 10, 10);
51 TGCompositeFrame *fFleft =
new TGCompositeFrame(fV1, 10, 10, kSunkenFrame);
52 TGCompositeFrame *fFright =
new TGCompositeFrame(fV2, 10, 10, kSunkenFrame);
54 TGLabel *fLleft =
new TGLabel(fFleft,
"Left Frame");
55 TGLabel *fLright =
new TGLabel(fFright,
"Right Frame");
57 fFleft->AddFrame(fLleft,
new TGLayoutHints(kLHintsLeft | kLHintsCenterY,
59 fFright->AddFrame(fLright,
new TGLayoutHints(kLHintsLeft | kLHintsCenterY,
62 fV1->AddFrame(fFleft,
new TGLayoutHints(kLHintsExpandX | kLHintsExpandY,
64 fV2->AddFrame(fFright,
new TGLayoutHints(kLHintsExpandX | kLHintsExpandY,
67 fV1->Resize(fFleft->GetDefaultWidth()+20, fV1->GetDefaultHeight());
68 fV2->Resize(fFright->GetDefaultWidth(), fV1->GetDefaultHeight());
69 fHf->AddFrame(fV1,
new TGLayoutHints(kLHintsLeft | kLHintsExpandY));
71 TGVSplitter *splitter =
new TGVSplitter(fHf,2,2);
72 splitter->SetFrame(fV1, kTRUE);
73 fHf->AddFrame(splitter,
new TGLayoutHints(kLHintsLeft | kLHintsExpandY));
75 fHf->AddFrame(fV2,
new TGLayoutHints(kLHintsRight | kLHintsExpandX |
77 AddFrame(fHf,
new TGLayoutHints(kLHintsRight | kLHintsExpandX |
81 TGVerticalFrame *vframe =
new TGVerticalFrame(
this, 10, 10);
82 TGCompositeFrame *cframe2 =
new TGCompositeFrame(vframe, 170, 20,
83 kHorizontalFrame | kFixedWidth);
84 TGTextButton *save =
new TGTextButton(cframe2,
"&Save");
85 cframe2->AddFrame(save,
new TGLayoutHints(kLHintsTop | kLHintsExpandX,
87 save->Connect(
"Clicked()",
"MyMainFrame",
this,
"DoSave()");
88 save->SetToolTipText(
"Click on the button to save the application as C++ macro");
90 TGTextButton *exit =
new TGTextButton(cframe2,
"&Exit ",
"gApplication->Terminate(0)");
91 cframe2->AddFrame(exit,
new TGLayoutHints(kLHintsTop | kLHintsExpandX,
93 vframe->AddFrame(cframe2,
new TGLayoutHints(kLHintsExpandX, 2, 2, 5, 1));
94 AddFrame(vframe,
new TGLayoutHints(kLHintsExpandX, 2, 2, 5, 1));
97 SetCleanup(kDeepCleanup);
100 SetWindowName(
"Vertical Splitter");
101 SetWMSizeHints(350, 200, 600, 400, 0, 0);
103 Resize(GetDefaultSize());
109 MyMainFrame::~MyMainFrame()
116 void MyMainFrame::CloseWindow()
123 void splitterVertical()
126 new MyMainFrame(gClient->GetRoot(), 350, 200);