Logo ROOT   6.10/09
Reference Guide
TG3DLine.cxx
Go to the documentation of this file.
1 // @(#)root/gui:$Id$
2 // Author: Fons Rademakers 6/09/2000
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2000, 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 // TGHorizontal3DLine and TGVertical3DLine //
15 // //
16 // A horizontal 3D line is a line that typically separates a toolbar //
17 // from the menubar. //
18 // A vertical 3D line is a line that can be used to separate groups of //
19 // widgets. //
20 // //
21 //////////////////////////////////////////////////////////////////////////
22 
23 #include "TG3DLine.h"
24 #include "Riostream.h"
25 
26 
29 
30 ////////////////////////////////////////////////////////////////////////////////
31 /// constructor
32 
34  UInt_t options, Pixel_t back) :
35  TGFrame(p, w, h, options, back)
36 {
37  SetWindowName();
38  fEditDisabled = kEditDisableHeight;
39 }
40 
41 ////////////////////////////////////////////////////////////////////////////////
42 /// constructor
43 
45  UInt_t options, Pixel_t back) :
46  TGFrame(p, w, h, options, back)
47 {
48  SetWindowName();
50 }
51 
52 ////////////////////////////////////////////////////////////////////////////////
53 /// Save an vertical 3D line as a C++ statement(s) on output stream out.
54 
55 void TGHorizontal3DLine::SavePrimitive(std::ostream &out, Option_t *option /*= ""*/)
56 {
58 
59  out << " TGHorizontal3DLine *";
60  out << GetName() << " = new TGHorizontal3DLine(" << fParent->GetName()
61  << "," << GetWidth() << "," << GetHeight();
62 
64  if (!GetOptions()) {
65  out << ");" << std::endl;
66  } else {
67  out << "," << GetOptionString() << ");" << std::endl;
68  }
69  } else {
70  out << "," << GetOptionString() << ",ucolor);" << std::endl;
71  }
72  if (option && strstr(option, "keep_names"))
73  out << " " << GetName() << "->SetName(\"" << GetName() << "\");" << std::endl;
74 }
75 
76 ////////////////////////////////////////////////////////////////////////////////
77 /// Save an vertical 3D line as a C++ statement(s) on output stream out.
78 
79 void TGVertical3DLine::SavePrimitive(std::ostream &out, Option_t *option /*= ""*/)
80 {
82 
83  out << " TGVertical3DLine *";
84  out << GetName() << " = new TGVertical3DLine(" << fParent->GetName()
85  << "," << GetWidth() << "," << GetHeight();
86 
88  if (!GetOptions()) {
89  out << ");" << std::endl;
90  } else {
91  out << "," << GetOptionString() <<");" << std::endl;
92  }
93  } else {
94  out << "," << GetOptionString() << ",ucolor);" << std::endl;
95  }
96  if (option && strstr(option, "keep_names"))
97  out << " " << GetName() << "->SetName(\"" << GetName() << "\");" << std::endl;
98 }
const TGWindow * fParent
Definition: TGWindow.h:37
virtual UInt_t GetOptions() const
Definition: TGFrame.h:244
const char Option_t
Definition: RtypesCore.h:62
UInt_t GetHeight() const
Definition: TGFrame.h:272
TH1 * h
Definition: legend2.C:5
Pixel_t fBackground
Definition: TGFrame.h:142
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save an vertical 3D line as a C++ statement(s) on output stream out.
Definition: TG3DLine.cxx:55
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save an vertical 3D line as a C++ statement(s) on output stream out.
Definition: TG3DLine.cxx:79
UInt_t GetWidth() const
Definition: TGFrame.h:271
ULong_t Pixel_t
Definition: GuiTypes.h:39
static Pixel_t GetDefaultFrameBackground()
Get default frame background.
Definition: TGFrame.cxx:665
virtual const char * GetName() const
Return unique name, used in SavePrimitive methods.
Definition: TGWindow.cxx:221
unsigned int UInt_t
Definition: RtypesCore.h:42
TGVertical3DLine(const TGWindow *p=0, UInt_t w=2, UInt_t h=4, UInt_t options=kChildFrame, Pixel_t back=GetDefaultFrameBackground())
constructor
Definition: TG3DLine.cxx:44
#define ClassImp(name)
Definition: Rtypes.h:336
UInt_t fEditDisabled
Definition: TGWindow.h:41
void SaveUserColor(std::ostream &out, Option_t *)
Save a user color in a C++ macro file - used in SavePrimitive().
Definition: TGFrame.cxx:2433
TString GetOptionString() const
Returns a frame option string - used in SavePrimitive().
Definition: TGFrame.cxx:2460
virtual void SetWindowName(const char *name=0)
Set window name.
Definition: TGWindow.cxx:118