Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
window_manager.C File Reference

Detailed Description

Demonstrates usage of EVE window-manager.

#include "TEveWindow.h"
#include "TEveViewer.h"
#include "TEveManager.h"
#include "TEveBrowser.h"
#include "TEveGedEditor.h"
#include "TCanvas.h"
#include "TGTab.h"
void PackTest();
void DetailTest();
void TabsTest();
{
TEveUtil::Macro("pointset.C");
gDebug = 1;
}
void PackTest()
{
TEveWindowFrame *frame = 0;
TEveViewer *v = 0;
TEveWindowPack *pack1 = slot->MakePack();
pack1->SetShowTitleBar(kFALSE);
pack1->SetHorizontal();
// Embedded viewer.
slot = pack1->NewSlot();
v = new TEveViewer("BarViewer");
v->SpawnGLEmbeddedViewer(gEve->GetEditor());
slot->ReplaceWindow(v);
v->SetElementName("Bar Embedded Viewer");
v->AddScene(gEve->GetEventScene());
slot = pack1->NewSlot();
TEveWindowPack *pack2 = slot->MakePack();
pack2->SetShowTitleBar(kFALSE);
slot = pack2->NewSlot();
slot->StartEmbedding();
TCanvas *can = new TCanvas("Root Canvas");
can->ToggleEditor();
slot->StopEmbedding();
// SA viewer.
slot = pack2->NewSlot();
v = new TEveViewer("FooViewer");
v->SpawnGLViewer(gEve->GetEditor());
slot->ReplaceWindow(v);
v->AddScene(gEve->GetEventScene());
}
void DetailTest()
{
TEveWindowFrame *frame = 0;
TEveWindowPack *pack1 = slot->MakePack();
pack1->SetShowTitleBar(kFALSE);
pack1->SetElementName("Detail");
pack1->SetHorizontal();
// left slot
slot = pack1->NewSlot();
frame = slot->MakeFrame();
frame->SetElementName("Latex Frame");
hf->SetCleanup(kLocalCleanup);
{
guiFrame->SetCleanup(kDeepCleanup);
guiFrame->AddFrame(new TGLabel(guiFrame, "Press Button:"), new TGLayoutHints(kLHintsLeft, 2, 2, 0, 0));
TGTextButton *b = new TGTextButton(guiFrame, "TestButton");
TRootEmbeddedCanvas *ec = new TRootEmbeddedCanvas("Embeddedcanvas", hf, 220);
double fontsize = 0.07;
double x = 0.02;
double y = 1 - 1 * fontsize;
TLatex *latex = new TLatex(x, y, "Legend:");
latex->SetTextSize(fontsize);
latex->Draw();
y -= 2 * fontsize;
// legend
latex->DrawLatex(x, y, "greek letter #Delta#eta_{out}");
y -= fontsize;
latex->DrawLatex(x, y, "#color[5]{+} marker");
y -= fontsize;
latex->DrawLatex(x, y, "#color[5]{+} marker");
y -= fontsize;
latex->DrawLatex(x, y, "#color[4]{+} marker");
y -= fontsize;
latex->DrawLatex(x, y, "#color[5]{#bullet} marker");
y -= fontsize;
latex->DrawLatex(x, y, "#color[4]{#bullet} marker some text");
y -= fontsize;
latex->DrawLatex(x, y, "#color[2]{#Box} square");
y -= fontsize;
latex->DrawLatex(x, y, "#color[5]{#Box} color");
}
cf->MapSubwindows();
cf->Layout();
cf->MapWindow();
// viewer slot
TEveWindowSlot *slot2 = pack1->NewSlotWithWeight(3);
TEveViewer *viewer = new TEveViewer("DetailView", "DetailView");
TGLEmbeddedViewer *embeddedViewer = viewer->SpawnGLEmbeddedViewer();
slot2->ReplaceWindow(viewer);
viewer->AddScene(gEve->GetEventScene());
}
void TabsTest()
{
TRandom r(0);
TEveWindowFrame *frame = 0;
TEveViewer *v = 0;
TEveWindowTab *tab1 = slot->MakeTab();
tab1->SetElementName("Tabs");
tab1->SetShowTitleBar(kFALSE);
// horizontal text views
slot = tab1->NewSlot();
TEveWindowPack *pack1 = slot->MakePack();
for (int i = 0; i < 4; ++i) {
Int_t weight = r.Uniform(3, 7);
slot = pack1->NewSlotWithWeight(weight);
frame = slot->MakeFrame();
frame->SetElementName(Form("FrameInPack %d", i));
TGTextView *text_view = new TGTextView(cf, 200, 400);
for (Int_t l = 0; l < weight; l++) {
text_view->AddLine(Form("slot[%d] add line %d here ", i, l));
}
text_view->Update();
text_view->SetWidth(text_view->ReturnLongestLineWidth() + 20);
text_view->Layout();
cf->MapSubwindows();
cf->Layout();
cf->MapWindow();
}
// canvas tab
slot = tab1->NewSlot();
frame = slot->MakeFrame(new TRootEmbeddedCanvas());
frame->SetElementName("Embedded Canvas");
// neseted 2nd leveltabs
slot = tab1->NewSlot();
slot->SetShowTitleBar(kFALSE);
TEveWindowTab *tab2 = slot->MakeTab();
tab2->SetElementName("Nested");
tab2->SetShowTitleBar(kFALSE);
slot = tab2->NewSlot();
slot->SetShowTitleBar(kFALSE);
slot = tab2->NewSlot();
slot->SetShowTitleBar(kFALSE);
}
#define b(i)
Definition RSha256.hxx:100
int Int_t
Definition RtypesCore.h:45
constexpr Bool_t kFALSE
Definition RtypesCore.h:94
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
R__EXTERN TEveManager * gEve
@ kLocalCleanup
Definition TGFrame.h:41
@ kDeepCleanup
Definition TGFrame.h:42
@ kLHintsExpandY
Definition TGLayout.h:31
@ kLHintsLeft
Definition TGLayout.h:24
@ kLHintsExpandX
Definition TGLayout.h:30
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t r
Int_t gDebug
Definition TROOT.cxx:597
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
Definition TString.cxx:2489
const char * tab1
const char * tab2
The Canvas class.
Definition TCanvas.h:23
void SetElementName(const char *name) override
Virtual function for setting of name of an element.
TEveViewerList * GetViewers() const
TEveBrowser * GetBrowser() const
TEveGedEditor * GetEditor() const
Returns main object editor.
static TEveManager * Create(Bool_t map_window=kTRUE, Option_t *opt="FIV")
If global TEveManager* gEve is not set initialize it.
TEveScene * GetEventScene() const
static void Macro(const char *mac)
Execute macro 'mac'. Do not reload the macro.
Definition TEveUtil.cxx:164
void AddElement(TEveElement *el) override
Call base-class implementation.
Eve representation of TGLViewer.
Definition TEveViewer.h:31
Encapsulates TGFrame into an eve-window.
Definition TEveWindow.h:336
TGCompositeFrame * GetGUICompositeFrame()
Returns the registered top-frame of this eve-window dynamic-casted to composite-frame.
Encapsulates TGPack into an eve-window.
Definition TEveWindow.h:361
Description of TEveWindowSlot.
Definition TEveWindow.h:302
Encapsulates TGTab into an eve-window.
Definition TEveWindow.h:396
static TEveWindowSlot * CreateWindowInTab(TGTab *tab, TEveWindow *eve_parent=nullptr)
Create a new tab in a given tab-widget and populate it with a default window-slot.
void SetShowTitleBar(Bool_t x)
Set display state of the title-bar.
The base class for composite widgets (menu bars, list boxes, etc.).
Definition TGFrame.h:287
Minimal GL-viewer that can be embedded in a standard ROOT frames.
This class handles GUI labels.
Definition TGLabel.h:24
This class describes layout hints used by the layout classes.
Definition TGLayout.h:50
virtual Bool_t SetTab(Int_t tabIndex, Bool_t emit=kTRUE)
Brings the composite frame with the index tabIndex to the front and generate the following event if t...
Definition TGTab.cxx:558
Yield an action as soon as it is clicked.
Definition TGButton.h:142
A TGTextView is a text viewer widget.
Definition TGTextView.h:22
A composite frame that layout their children in vertical way.
Definition TGFrame.h:374
To draw Mathematical Formula.
Definition TLatex.h:18
This is the base class for the ROOT Random number generators.
Definition TRandom.h:27
TGTab * GetTabRight() const
This class creates a TGCanvas in which a TCanvas is created.
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17
TLine l
Definition textangle.C:4
Author
Matevz Tadel

Definition in file window_manager.C.