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
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
57 0, 0, 5, 0));
58
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) {
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) {
119 } else {
120 fNEWidth->SetNumber(frame->GetWidth());
121 fNEHeight->SetNumber(frame->GetHeight());
122 }
123}
124
125
#define h(i)
Definition RSha256.hxx:106
const Bool_t kTRUE
Definition RtypesCore.h:91
#define ClassImp(name)
Definition Rtypes.h:364
@ kDeepCleanup
Definition TGFrame.h:50
@ kLHintsExpandY
Definition TGLayout.h:38
@ kLHintsLeft
Definition TGLayout.h:31
@ kLHintsCenterY
Definition TGLayout.h:35
@ kLHintsTop
Definition TGLayout.h:34
@ kLHintsExpandX
Definition TGLayout.h:37
R__EXTERN TVirtualDragManager * gDragManager
const TGWindow * GetRoot() const
Returns current root (i.e.
Definition TGClient.cxx:223
void NeedRedraw(TGWindow *w, Bool_t force=kFALSE)
Set redraw flags.
Definition TGClient.cxx:371
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=0)
Add frame to the composite frame using the specified layout hints.
Definition TGFrame.cxx:1102
virtual void SetCleanup(Int_t mode=kLocalCleanup)
Turn on automatic cleanup of child frames in dtor.
Definition TGFrame.cxx:1057
Int_t GetX() const
Definition TGFrame.h:255
UInt_t GetHeight() const
Definition TGFrame.h:249
Int_t GetY() const
Definition TGFrame.h:256
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
UInt_t GetWidth() const
Definition TGFrame.h:248
virtual void SetNumber(Double_t val)
TGNumberEntryField * GetNumberEntry() const
virtual Long_t GetIntNumber() const
TGClient * fClient
Definition TGObject.h:37
UInt_t fEditDisabled
Definition TGWindow.h:40
void DrawGrabRectangles(TGWindow *win=0)
Draw small grab rectangles around grabbed/selected/frame.
TGFrame * GetSelected() const
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
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