Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TFrameEditor.cxx
Go to the documentation of this file.
1// @(#)root/ged:$Id$
2// Author: Ilka Antcheva 08/03/05
3
4/*************************************************************************
5 * Copyright (C) 1995-2002, 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
13
14/** \class TFrameEditor
15 \ingroup ged
16
17Editor of frame objects.
18
19Frame border can be set to sunken, raised or no border.
20Border size can be set for sunken or rized frames (1-15 pixels).
21
22*/
23
24#include "TFrameEditor.h"
25#include "TGedEditor.h"
26#include "TGComboBox.h"
27#include "TGButtonGroup.h"
28#include "TGLabel.h"
29#include "TFrame.h"
30#include "TVirtualPad.h"
31
33
37};
38
39
40////////////////////////////////////////////////////////////////////////////////
41/// Constructor of TFrame editor GUI.
42
44 Int_t height, UInt_t options, Pixel_t back)
45 : TGedFrame(p, width, height, options | kVerticalFrame, back)
46{
47 TGCompositeFrame *f2 = new TGCompositeFrame(this, 80, 20, kHorizontalFrame);
48 TGButtonGroup *bgr = new TGButtonGroup(f2,3,1,3,0, "Frame Border Mode");
50 fBmode = new TGRadioButton(bgr, " Sunken", 77);
51 fBmode->SetToolTipText("Set a sunken border of the frame");
52 fBmode0 = new TGRadioButton(bgr, " No border", 78);
53 fBmode0->SetToolTipText("Set no border of the frame");
54 fBmode1 = new TGRadioButton(bgr, " Raised", 79);
55 fBmode1->SetToolTipText("Set a raised border of the frame");
56 bgr->SetButton(79, kTRUE);
57 fBmodelh = new TGLayoutHints(kLHintsLeft, 0,0,3,0);
59 bgr->Show();
61 f2->AddFrame(bgr, new TGLayoutHints(kLHintsCenterY | kLHintsLeft, 4, 1, 0, 0));
62 AddFrame(f2, new TGLayoutHints(kLHintsTop, 1, 1, 0, 0));
63
64 TGCompositeFrame *f3 = new TGCompositeFrame(this, 80, 20, kHorizontalFrame);
65 TGLabel *fSizeLbl = new TGLabel(f3, "Size:");
66 f3->AddFrame(fSizeLbl, new TGLayoutHints(kLHintsCenterY | kLHintsLeft, 6, 1, 0, 0));
68 fBsize->Resize(92, 20);
69 f3->AddFrame(fBsize, new TGLayoutHints(kLHintsLeft, 13, 1, 0, 0));
70 fBsize->Associate(this);
71 AddFrame(f3, new TGLayoutHints(kLHintsTop, 1, 1, 0, 0));
72}
73
74////////////////////////////////////////////////////////////////////////////////
75/// Destructor of frame editor.
76
78{
79 // children of TGButonGroup are not deleted
80 delete fBmode;
81 delete fBmode0;
82 delete fBmode1;
83 delete fBmodelh;
84}
85
86////////////////////////////////////////////////////////////////////////////////
87/// Connect signals to slots.
88
90{
91 fBmode->Connect("Toggled(Bool_t)","TFrameEditor",this,"DoBorderMode()");
92 fBmode0->Connect("Toggled(Bool_t)","TFrameEditor",this,"DoBorderMode()");
93 fBmode1->Connect("Toggled(Bool_t)","TFrameEditor",this,"DoBorderMode()");
94 fBsize->Connect("Selected(Int_t)", "TFrameEditor", this, "DoBorderSize(Int_t)");
95
96 fInit = kFALSE;
97}
98
99////////////////////////////////////////////////////////////////////////////////
100/// Pick up the frame attributes.
101
103{
104 fFrame = (TFrame *)obj;
105
106 Int_t par;
107
108 par = fFrame->GetBorderMode();
109 if (par == -1) fBmode->SetState(kButtonDown, kTRUE);
110 else if (par == 1) fBmode1->SetState(kButtonDown, kTRUE);
112
113 par = fFrame->GetBorderSize();
114 if (par < 1) par = 1;
115 if (par > 16) par = 16;
116 fBsize->Select(par, kFALSE);
117
119}
120
121////////////////////////////////////////////////////////////////////////////////
122/// Slot connected to the border mode settings.
123
125{
126 Int_t mode = 0;
127 if (fBmode->GetState() == kButtonDown) mode = -1;
128 else if (fBmode0->GetState() == kButtonDown) mode = 0;
129 else mode = 1;
130
131 if (!mode) {
133 } else {
135 }
137 Update();
138 gPad->Modified();
139 gPad->Update();
140}
141
142////////////////////////////////////////////////////////////////////////////////
143/// Slot connected to the border size settings.
144
146{
148 Update();
149}
@ kChildFrame
Definition GuiTypes.h:379
@ kVerticalFrame
Definition GuiTypes.h:381
@ kFitWidth
Definition GuiTypes.h:386
@ kHorizontalFrame
Definition GuiTypes.h:382
ULong_t Pixel_t
Pixel value.
Definition GuiTypes.h:40
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
constexpr Bool_t kFALSE
Definition RtypesCore.h:101
constexpr Bool_t kTRUE
Definition RtypesCore.h:100
#define ClassImp(name)
Definition Rtypes.h:377
EFrameWid
@ kFR_BSIZE
@ kFR_BMODE
@ kButtonDown
Definition TGButton.h:54
@ kLHintsLeft
Definition TGLayout.h:24
@ kLHintsCenterY
Definition TGLayout.h:28
@ kLHintsTop
Definition TGLayout.h:27
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char mode
Option_t Option_t width
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t height
#define gPad
Editor of frame objects.
TFrame * fFrame
TGRadioButton * fBmode
set sinken frame border mode
TGLineWidthComboBox * fBsize
set frame border size
virtual void DoBorderMode()
Slot connected to the border mode settings.
virtual void DoBorderSize(Int_t size)
Slot connected to the border size settings.
virtual ~TFrameEditor()
Destructor of frame editor.
TGRadioButton * fBmode0
set no border
virtual void SetModel(TObject *obj)
Pick up the frame attributes.
TFrameEditor(const TGWindow *p=nullptr, Int_t width=140, Int_t height=30, UInt_t options=kChildFrame, Pixel_t back=GetDefaultFrameBackground())
Constructor of TFrame editor GUI.
TGLayoutHints * fBmodelh
layout hints for border mode buttons
virtual void ConnectSignals2Slots()
Connect signals to slots.
TGRadioButton * fBmode1
set raised frame border mode
Define a Frame.
Definition TFrame.h:19
Organizes TGButton widgets in a group.
virtual void SetLayoutHints(TGLayoutHints *l, TGButton *button=nullptr)
Set layout hints for the specified button or if button=0 for all buttons.
virtual void SetRadioButtonExclusive(Bool_t flag=kTRUE)
If enable is kTRUE, this button group will treat radio buttons as mutually exclusive,...
virtual void Show()
Show group of buttons.
virtual void SetButton(Int_t id, Bool_t down=kTRUE)
Sets the button with id to be on/down, and if this is an exclusive group, all other button in the gro...
virtual void SetToolTipText(const char *text, Long_t delayms=400)
Set tool tip text associated with this button.
Definition TGButton.cxx:445
virtual EButtonState GetState() const
Definition TGButton.h:112
virtual void Select(Int_t id, Bool_t emit=kTRUE)
Make the selected item visible in the combo box window and emit signals according to the second param...
virtual void SetEnabled(Bool_t on=kTRUE)
Set state of combo box. If kTRUE=enabled, kFALSE=disabled.
The base class for composite widgets (menu bars, list boxes, etc.).
Definition TGFrame.h:287
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=nullptr)
Add frame to the composite frame using the specified layout hints.
Definition TGFrame.cxx:1117
void ChangeOptions(UInt_t options) override
Change composite frame options. Options is an OR of the EFrameTypes.
Definition TGFrame.cxx:1043
void Resize(UInt_t w=0, UInt_t h=0) override
Resize the frame.
Definition TGFrame.cxx:605
This class handles GUI labels.
Definition TGLabel.h:24
This class describes layout hints used by the layout classes.
Definition TGLayout.h:50
The TGLineWidthComboBox user callable and it creates a combobox for selecting the line width.
Definition TGComboBox.h:158
Selects different options.
Definition TGButton.h:321
void SetState(EButtonState state, Bool_t emit=kFALSE) override
Set radio button state.
virtual void Associate(const TGWindow *w)
Definition TGWidget.h:72
ROOT GUI Window base class.
Definition TGWindow.h:23
Base frame for implementing GUI - a service class.
Definition TGedFrame.h:27
Bool_t fInit
init flag for setting signals/slots
Definition TGedFrame.h:47
virtual void Update()
Update the current pad when an attribute is changed via GUI.
Definition TGedFrame.cxx:72
Mother of all ROOT objects.
Definition TObject.h:41
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:869
Short_t GetBorderSize() const
Definition TWbox.h:41
Short_t GetBorderMode() const
Definition TWbox.h:40
virtual void SetBorderMode(Short_t bordermode)
Definition TWbox.h:51
virtual void SetBorderSize(Short_t bordersize)
Definition TWbox.h:52