Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TGuiBldGeometryFrame.cxx
Go to the documentation of this file.
1// @(#)root/guibuilder:$Id$
2// Author: Valeriy Onuchin, Lucie Flekova 12/09/04
3
4/*************************************************************************
5 * Copyright (C) 1995-2004, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12#include "TGuiBldEditor.h"
13#include "TGuiBldHintsEditor.h"
14#include "TGuiBldNameFrame.h"
15#include "TGResourcePool.h"
16#include "TGLabel.h"
17#include "TGButtonGroup.h"
18#include "TGNumberEntry.h"
19#include "TG3DLine.h"
21#include "TRootGuiBuilder.h"
22#include "TGuiBldDragManager.h"
23#include "TGFrame.h"
24
25/** \class TGuiBldGeometryFrame
26 \ingroup guibuilder
27*/
28
30
31////////////////////////////////////////////////////////////////////////////////
32/// Constructor.
33
35 : TGVerticalFrame(p, 1, 1)
36{
37 fEditor = ed;
40 fSelected = fEditor->GetSelected();
41 fEditDisabled = 1;
43
44 TGGroupFrame *fGroupFrame = new TGGroupFrame(this, "Size");
45
46 TGHorizontalFrame *hf = new TGHorizontalFrame(fGroupFrame);
47
48 hf->AddFrame(new TGLabel(hf, " Width "), new TGLayoutHints(kLHintsLeft |
49 kLHintsCenterY, 2, 2, 2, 2));
50 fNEWidth = new TGNumberEntry(hf, 0.0, 4, -1, (TGNumberFormat::EStyle)5);
52 2, 2, 2, 2));
53
54 hf->AddFrame(new TGLabel(hf, " Height "), new TGLayoutHints(kLHintsLeft |
55 kLHintsCenterY, 2, 2, 2, 2));
56 fNEHeight = new TGNumberEntry(hf, 0.0, 4, -1, (TGNumberFormat::EStyle)5);
58 2, 2, 2, 2));
59
61 0, 0, 5, 0));
62
64
65 fNEWidth->GetNumberEntry()->Connect("ReturnPressed()", "TGuiBldGeometryFrame",
66 this, "ResizeSelected()");
67 fNEWidth->Connect("ValueSet(Long_t)", "TGuiBldGeometryFrame", this,
68 "ResizeSelected()");
69 fNEHeight->GetNumberEntry()->Connect("ReturnPressed()", "TGuiBldGeometryFrame",
70 this, "ResizeSelected()");
71 fNEHeight->Connect("ValueSet(Long_t)", "TGuiBldGeometryFrame", this,
72 "ResizeSelected()");
73
74 if (!fSelected) {
75 fNEWidth->SetNumber(0);
76 fNEHeight->SetNumber(0);
77 }
78 else {
79 fNEWidth->SetNumber(fSelected->GetWidth());
80 fNEHeight->SetNumber(fSelected->GetHeight());
81 }
82}
83
84////////////////////////////////////////////////////////////////////////////////
85/// Resize and redraw selected frame.
86
88{
89 if (!fEditor)
90 return;
91
92 fSelected = fEditor->GetSelected();
93
94 if (!fSelected)
95 return;
96
97 Int_t w = fNEWidth->GetIntNumber();
98 Int_t h = fNEHeight->GetIntNumber();
99
100 if ((w > 0) && (h > 0)) {
101 fSelected->MoveResize(fSelected->GetX(), fSelected->GetY(), w, h);
102 fClient->NeedRedraw(fSelected, kTRUE);
103 TGWindow *root = (TGWindow*)fClient->GetRoot();
104 fClient->NeedRedraw(root, kTRUE);
105 fDragManager->DrawGrabRectangles(fSelected);
106 if (fBuilder) {
107 fClient->NeedRedraw(fBuilder, kTRUE);
108 }
109 } else {
110 fNEWidth->SetNumber(fSelected->GetWidth());
111 fNEHeight->SetNumber(fSelected->GetHeight());
112 }
113}
114
115////////////////////////////////////////////////////////////////////////////////
116/// Update number entries when new frame selected.
117
119{
120 if (!frame) {
121 fNEWidth->SetNumber(0);
122 fNEHeight->SetNumber(0);
123 } else {
124 fNEWidth->SetNumber(frame->GetWidth());
125 fNEHeight->SetNumber(frame->GetHeight());
126 }
127}
128
129
#define h(i)
Definition RSha256.hxx:106
int Int_t
Definition RtypesCore.h:45
constexpr Bool_t kTRUE
Definition RtypesCore.h:100
#define ClassImp(name)
Definition Rtypes.h:377
@ kDeepCleanup
Definition TGFrame.h:42
@ kLHintsExpandY
Definition TGLayout.h:31
@ kLHintsLeft
Definition TGLayout.h:24
@ kLHintsCenterY
Definition TGLayout.h:28
@ kLHintsTop
Definition TGLayout.h:27
@ kLHintsExpandX
Definition TGLayout.h:30
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void w
R__EXTERN TVirtualDragManager * gDragManager
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=nullptr)
Add frame to the composite frame using the specified layout hints.
Definition TGFrame.cxx:1117
void SetCleanup(Int_t mode=kLocalCleanup) override
Turn on automatic cleanup of child frames in dtor.
Definition TGFrame.cxx:1072
TGFrame(const TGFrame &)=delete
UInt_t GetHeight() const
Definition TGFrame.h:225
UInt_t GetWidth() const
Definition TGFrame.h:224
A composite frame with a border and a title.
Definition TGFrame.h:522
A composite frame that layout their children in horizontal way.
Definition TGFrame.h:385
This class handles GUI labels.
Definition TGLabel.h:24
This class describes layout hints used by the layout classes.
Definition TGLayout.h:50
TGNumberEntry is a number entry input widget with up/down buttons.
TGClient * fClient
Connection to display server.
Definition TGObject.h:25
TGVerticalFrame(const TGWindow *p=nullptr, UInt_t w=1, UInt_t h=1, UInt_t options=kChildFrame, Pixel_t back=GetDefaultFrameBackground())
Definition TGFrame.h:376
ROOT GUI Window base class.
Definition TGWindow.h:23
UInt_t fEditDisabled
flags used for "guibuilding"
Definition TGWindow.h:32
The property editor.
TRootGuiBuilder * fBuilder
void ResizeSelected()
Resize and redraw selected frame.
void ChangeSelected(TGFrame *frame)
Update number entries when new frame selected.
TGuiBldGeometryFrame(const TGWindow *p, TGuiBldEditor *editor)
Constructor.
TGuiBldDragManager * fDragManager
static TGuiBuilder * Instance()
return an instance of TGuiBuilder object