42class TGMdiTestSubclass {
54 TGMdiFrame *GetMdiFrame()
const {
return fMdiFrame; }
55 virtual Bool_t CloseWindow();
71 void HandleText(const
char *);
91 void HandleMenu(
Int_t id);
96TGAppMainFrame::TGAppMainFrame(const
TGWindow *
p,
int w,
int h)
113 TGMdiTestSubclass *t =
new TGMdiTestSubclass(fMainFrame, 320, 240);
114 mdiFrame = t->GetMdiFrame();
123 gClient->GetColorByName(
"red", ic);
131 mdiFrame->
Move(150, 200);
135 gClient->GetColorByName(
"green", ic);
145 mdiFrame->
Move(180, 220);
149 gClient->GetColorByName(
"blue", ic);
162 fListBox->
Resize(100, 70);
167 mdiFrame->
Move(400, 300);
174 new TGMdiHintTest(fMainFrame, 200, 200);
178 fMain->SetWindowName(
"MDI test");
179 fMain->SetClassHints(
"mdi test",
"mdi test");
184 fMain->Resize(640, 400);
186 fMain->MapSubwindows();
191void TGAppMainFrame::HandleMenu(
Int_t id)
196 case M_FILE_NEW:
new TGMdiFrame(fMainFrame, 200, 100);
break;
200 case M_FILE_EXIT: CloseWindow();
break;
206 case M_WINDOW_CASCADE: fMainFrame->
Cascade();
break;
210 case M_WINDOW_OPAQUE:
224void TGAppMainFrame::InitMenu()
256 fMenuFile->
Connect(
"Activated(Int_t)",
"TGAppMainFrame",
this,
"HandleMenu(Int_t)");
257 fMenuWindow->
Connect(
"Activated(Int_t)",
"TGAppMainFrame",
this,
"HandleMenu(Int_t)");
258 fMenuHelp->
Connect(
"Activated(Int_t)",
"TGAppMainFrame",
this,
"HandleMenu(Int_t)");
265void TGAppMainFrame::CloseWindow()
275 fMdiFrame->Connect(
"CloseWindow()",
"TGMdiTestSubclass",
this,
"CloseWindow()");
276 fMdiFrame->DontCallClose();
278 fCanvasWindow =
new TGCanvas(fMdiFrame, 400, 240);
280 fMdiFrame->GetWhitePixel());
281 fContainer->SetLayoutManager(
new TGTileLayout(fContainer, 8));
282 fCanvasWindow->SetContainer(fContainer);
284 for (
int i = 0; i < 256; ++i)
285 fCanvasWindow->AddFrame(
new TGFrame(fCanvasWindow->GetContainer(), 32, 32,
kOwnBackground, (i + 1) & 255),
290 fMdiFrame->SetWindowIcon(
gClient->GetPicture(
"ofolder_t.xpm"));
293Bool_t TGMdiTestSubclass::CloseWindow()
297 new TGMsgBox(
gClient->GetRoot(), fMdiFrame, fMdiFrame->GetWindowName(),
"Really want to close the window?",
301 return fMdiFrame->CloseWindow();
321 fMdiFrame->AddFrame(fClose, lh);
322 fMdiFrame->AddFrame(fMenu, lh);
323 fMdiFrame->AddFrame(fMin, lh);
324 fMdiFrame->AddFrame(fMax, lh);
325 fMdiFrame->AddFrame(
fSize, lh);
326 fMdiFrame->AddFrame(fHelp, lh);
334 fClose->
Connect(
"Clicked()",
"TGMdiHintTest",
this,
"HandleButtons()");
335 fMenu->
Connect(
"Clicked()",
"TGMdiHintTest",
this,
"HandleButtons()");
336 fMin->
Connect(
"Clicked()",
"TGMdiHintTest",
this,
"HandleButtons()");
337 fMax->
Connect(
"Clicked()",
"TGMdiHintTest",
this,
"HandleButtons()");
338 fSize->Connect(
"Clicked()",
"TGMdiHintTest",
this,
"HandleButtons()");
339 fHelp->
Connect(
"Clicked()",
"TGMdiHintTest",
this,
"HandleButtons()");
341 fWName =
new TGTextEntry(fMdiFrame, (
const char *)
"", 20);
345 fWName->
Connect(
"TextChanged(char*)",
"TGMdiHintTest",
this,
"HandleText(char*)");
350 fMdiFrame->SetWindowIcon(
gClient->GetPicture(
"app_t.xpm"));
352 fMdiFrame->MapSubwindows();
356void TGMdiHintTest::HandleButtons()
373 fMdiFrame->SetMdiHints(hints);
376void TGMdiHintTest::HandleText(
const char *)
383 new TGAppMainFrame(
gClient->GetRoot(), 640, 400);
389int main(
int argc,
char **argv)
#define RQ_OBJECT(sender_class)
R__EXTERN TApplication * gApplication
winID h TVirtualViewer3D TVirtualGLPainter p
This class creates the ROOT Application Environment that interfaces to the windowing system eventloop...
virtual void Terminate(Int_t status=0)
Terminate the application by call TSystem::Exit() unless application has been told to return from Run...
A frame containing two scrollbars (a horizontal and a vertical) and a viewport.
The base class for composite widgets (menu bars, list boxes, etc.).
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=nullptr)
Add frame to the composite frame using the specified layout hints.
void MapSubwindows() override
Map all sub windows that are part of the composite frame.
void Layout() override
Layout the elements of the composite frame.
A subclasses of TGWindow, and is used as base class for some simple widgets (buttons,...
Concrete class for horizontal slider.
TGHotString is a string with a "hot" character underlined.
This class describes layout hints used by the layout classes.
A listbox is a box, possibly with scrollbar, containing entries.
void Resize(UInt_t w, UInt_t h) override
Resize the listbox widget.
virtual void AddEntry(TGString *s, Int_t id)
Add entry with specified string and id to listbox.
virtual void SetMultipleSelections(Bool_t multi=kTRUE)
Defines top level windows that interact with the system Window Manager.
This file contains the TGMdiFrame class.
virtual void SetMdiHints(ULong_t mdihints)
Set MDI hints, also used to identify titlebar buttons.
void SetWindowName(const char *name) override
Set MDI window name (set titlebar title).
void Move(Int_t x, Int_t y) override
Move MDI window at position x, y.
This file contains the TGMdiMainFrame class.
Bool_t SetCurrent(TGMdiFrameList *newcurrent)
Set current (active) MDI child window (by frame list).
void SetResizeMode(Int_t mode=kMdiDefaultResizeMode)
Set MDI windows resize mode (opaque or transparent).
TGMdiFrame * GetCurrent() const
Return pointer on current (active) MDI child window.
virtual void ArrangeMinimized()
This is an attempt to an "smart" minimized window re-arrangement.
TGPopupMenu * GetWinListMenu() const
virtual void TileHorizontal()
virtual void TileVertical()
virtual Int_t Close(TGMdiFrame *frame)
Close MDI child window mdiframe.
TGFrame * GetContainer() const
The TGPicture class implements pictures and icons used in the different GUI elements and widgets.
Pixmap_t GetPicture() const
void AddText(Int_t pos, const char *text)
const char * GetString() const
Yield an action as soon as it is clicked.
A TGTextEntry is a one line text input widget.
TGTextBuffer * GetBuffer() const
This is a layout manager for the TGListView widget.
ROOT GUI Window base class.
virtual void SetBackgroundPixmap(Pixmap_t pixmap)
set background pixmap
Bool_t Connect(const char *signal, const char *receiver_class, void *receiver, const char *slot)
Non-static method is used to connect from the signal of this object to the receiver slot.