Logo ROOT  
Reference Guide
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"
20 #include "TGuiBldGeometryFrame.h"
21 #include "TRootGuiBuilder.h"
22 #include "TGuiBldDragManager.h"
23 #include "TGFrame.h"
24 
26 
27 ////////////////////////////////////////////////////////////////////////////////
28 /// Constructor.
29 
31  : TGVerticalFrame(p, 1, 1)
32 {
33  fEditor = ed;
37  fEditDisabled = 1;
39 
40  TGGroupFrame *fGroupFrame = new TGGroupFrame(this, "Size");
41 
42  TGHorizontalFrame *hf = new TGHorizontalFrame(fGroupFrame);
43 
44  hf->AddFrame(new TGLabel(hf, " Width "), new TGLayoutHints(kLHintsLeft |
45  kLHintsCenterY, 2, 2, 2, 2));
46  fNEWidth = new TGNumberEntry(hf, 0.0, 4, -1, (TGNumberFormat::EStyle)5);
48  2, 2, 2, 2));
49 
50  hf->AddFrame(new TGLabel(hf, " Height "), new TGLayoutHints(kLHintsLeft |
51  kLHintsCenterY, 2, 2, 2, 2));
52  fNEHeight = new TGNumberEntry(hf, 0.0, 4, -1, (TGNumberFormat::EStyle)5);
54  2, 2, 2, 2));
55 
56  fGroupFrame->AddFrame(hf, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY,
57  0, 0, 5, 0));
58 
59  AddFrame(fGroupFrame, new TGLayoutHints(kLHintsExpandX | kLHintsTop));
60 
61  fNEWidth->GetNumberEntry()->Connect("ReturnPressed()", "TGuiBldGeometryFrame",
62  this, "ResizeSelected()");
63  fNEWidth->Connect("ValueSet(Long_t)", "TGuiBldGeometryFrame", this,
64  "ResizeSelected()");
65  fNEHeight->GetNumberEntry()->Connect("ReturnPressed()", "TGuiBldGeometryFrame",
66  this, "ResizeSelected()");
67  fNEHeight->Connect("ValueSet(Long_t)", "TGuiBldGeometryFrame", this,
68  "ResizeSelected()");
69 
70  if (!fSelected) {
71  fNEWidth->SetNumber(0);
72  fNEHeight->SetNumber(0);
73  }
74  else {
77  }
78 }
79 
80 ////////////////////////////////////////////////////////////////////////////////
81 /// Resize and redraw selected frame.
82 
84 {
85  if (!fEditor)
86  return;
87 
89 
90  if (!fSelected)
91  return;
92 
95 
96  if ((w > 0) && (h > 0)) {
99  TGWindow *root = (TGWindow*)fClient->GetRoot();
100  fClient->NeedRedraw(root, kTRUE);
102  if (fBuilder) {
104  }
105  } else {
108  }
109 }
110 
111 ////////////////////////////////////////////////////////////////////////////////
112 /// Update number entries when new frame selected.
113 
115 {
116  if (!frame) {
117  fNEWidth->SetNumber(0);
118  fNEHeight->SetNumber(0);
119  } else {
120  fNEWidth->SetNumber(frame->GetWidth());
121  fNEHeight->SetNumber(frame->GetHeight());
122  }
123 }
124 
125 
TGFrame::GetHeight
UInt_t GetHeight() const
Definition: TGFrame.h:250
TGWindow
Definition: TGWindow.h:31
kTRUE
const Bool_t kTRUE
Definition: RtypesCore.h:91
kLHintsTop
@ kLHintsTop
Definition: TGLayout.h:34
ClassImp
#define ClassImp(name)
Definition: Rtypes.h:364
kLHintsLeft
@ kLHintsLeft
Definition: TGLayout.h:31
TGLabel
Definition: TGLabel.h:32
TGuiBldGeometryFrame
Definition: TGuiBldGeometryFrame.h:34
gDragManager
R__EXTERN TVirtualDragManager * gDragManager
Definition: TVirtualDragManager.h:82
TRootGuiBuilder
Definition: TRootGuiBuilder.h:65
TGuiBldGeometryFrame::ChangeSelected
void ChangeSelected(TGFrame *frame)
Update number entries when new frame selected.
Definition: TGuiBldGeometryFrame.cxx:114
TGuiBldDragManager::DrawGrabRectangles
void DrawGrabRectangles(TGWindow *win=0)
Draw small grab rectangles around grabbed/selected/frame.
Definition: TGuiBldDragManager.cxx:1523
TGHorizontalFrame
Definition: TGFrame.h:423
TGNumberEntry::GetNumberEntry
TGNumberEntryField * GetNumberEntry() const
Definition: TGNumberEntry.h:268
TGuiBldGeometryFrame::TGuiBldGeometryFrame
TGuiBldGeometryFrame(const TGWindow *p, TGuiBldEditor *editor)
Constructor.
Definition: TGuiBldGeometryFrame.cxx:30
TGFrame
Definition: TGFrame.h:105
TGFrame::GetWidth
UInt_t GetWidth() const
Definition: TGFrame.h:249
TGuiBldEditor.h
TGuiBldGeometryFrame::fNEWidth
TGNumberEntry * fNEWidth
Definition: TGuiBldGeometryFrame.h:42
TG3DLine.h
TGuiBldGeometryFrame.h
TGuiBldGeometryFrame::ResizeSelected
void ResizeSelected()
Resize and redraw selected frame.
Definition: TGuiBldGeometryFrame.cxx:83
TGNumberEntry::SetNumber
virtual void SetNumber(Double_t val)
Definition: TGNumberEntry.h:186
kLHintsCenterY
@ kLHintsCenterY
Definition: TGLayout.h:35
h
#define h(i)
Definition: RSha256.hxx:106
TGVerticalFrame
Definition: TGFrame.h:412
TGFrame.h
TGuiBldEditor::GetSelected
TGFrame * GetSelected() const
Definition: TGuiBldEditor.h:69
TGLayoutHints
Definition: TGLayout.h:57
TGGroupFrame
Definition: TGFrame.h:587
TGButtonGroup.h
TGuiBldGeometryFrame::fEditor
TGuiBldEditor * fEditor
Definition: TGuiBldGeometryFrame.h:39
kLHintsExpandY
@ kLHintsExpandY
Definition: TGLayout.h:38
TGuiBldNameFrame.h
TGFrame::GetX
Int_t GetX() const
Definition: TGFrame.h:256
TGuiBldGeometryFrame::fSelected
TGFrame * fSelected
Definition: TGuiBldGeometryFrame.h:44
TGuiBldEditor
Definition: TGuiBldEditor.h:39
TGLabel.h
TGClient::NeedRedraw
void NeedRedraw(TGWindow *w, Bool_t force=kFALSE)
Set redraw flags.
Definition: TGClient.cxx:373
TQObject::Connect
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.
Definition: TQObject.cxx:866
TGObject::fClient
TGClient * fClient
Definition: TGObject.h:37
TGFrame::MoveResize
virtual void MoveResize(Int_t x, Int_t y, UInt_t w=0, UInt_t h=0)
Move and/or resize the frame.
Definition: TGFrame.cxx:614
kDeepCleanup
@ kDeepCleanup
Definition: TGFrame.h:51
TGFrame::GetY
Int_t GetY() const
Definition: TGFrame.h:257
TGuiBldGeometryFrame::fBuilder
TRootGuiBuilder * fBuilder
Definition: TGuiBldGeometryFrame.h:40
TGuiBldHintsEditor.h
TGNumberEntry::GetIntNumber
virtual Long_t GetIntNumber() const
Definition: TGNumberEntry.h:209
TGNumberEntry.h
kLHintsExpandX
@ kLHintsExpandX
Definition: TGLayout.h:37
TGResourcePool.h
TGCompositeFrame::SetCleanup
virtual void SetCleanup(Int_t mode=kLocalCleanup)
Turn on automatic cleanup of child frames in dtor.
Definition: TGFrame.cxx:1057
TGNumberEntry
Definition: TGNumberEntry.h:157
TGWindow::fEditDisabled
UInt_t fEditDisabled
Definition: TGWindow.h:40
TGClient::GetRoot
const TGWindow * GetRoot() const
Returns current root (i.e.
Definition: TGClient.cxx:225
TGCompositeFrame::AddFrame
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=0)
Add frame to the composite frame using the specified layout hints.
Definition: TGFrame.cxx:1102
TGuiBldDragManager.h
TGNumberFormat::EStyle
EStyle
Definition: TGNumberEntry.h:33
TGuiBldGeometryFrame::fNEHeight
TGNumberEntry * fNEHeight
Definition: TGuiBldGeometryFrame.h:43
TRootGuiBuilder.h
TGuiBldDragManager
Definition: TGuiBldDragManager.h:58
TGuiBuilder::Instance
static TGuiBuilder * Instance()
return an instance of TGuiBuilder object
Definition: TGuiBuilder.cxx:147
int
TGuiBldGeometryFrame::fDragManager
TGuiBldDragManager * fDragManager
Definition: TGuiBldGeometryFrame.h:41