Logo ROOT  
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 "TVirtualX.h"
25 
26 #include <iostream>
27 
28 
31 
32 ////////////////////////////////////////////////////////////////////////////////
33 /// constructor
34 
36  UInt_t options, Pixel_t back) :
37  TGFrame(p, w, h, options, back)
38 {
39  SetWindowName();
41 }
42 
43 ////////////////////////////////////////////////////////////////////////////////
44 /// draw border
45 
47 {
48  gVirtualX->DrawLine(fId, GetShadowGC()(), 0, 0, fWidth-2, 0);
49  gVirtualX->DrawLine(fId, GetHilightGC()(), 0, 1, fWidth-1, 1);
50  gVirtualX->DrawLine(fId, GetHilightGC()(), fWidth-1, 0, fWidth-1, 1);
51 }
52 
53 
54 ////////////////////////////////////////////////////////////////////////////////
55 /// Save an vertical 3D line as a C++ statement(s) on output stream out.
56 
57 void TGHorizontal3DLine::SavePrimitive(std::ostream &out, Option_t *option /*= ""*/)
58 {
60 
61  out << " TGHorizontal3DLine *";
62  out << GetName() << " = new TGHorizontal3DLine(" << fParent->GetName()
63  << "," << GetWidth() << "," << GetHeight();
64 
66  if (!GetOptions()) {
67  out << ");" << std::endl;
68  } else {
69  out << "," << GetOptionString() << ");" << std::endl;
70  }
71  } else {
72  out << "," << GetOptionString() << ",ucolor);" << std::endl;
73  }
74  if (option && strstr(option, "keep_names"))
75  out << " " << GetName() << "->SetName(\"" << GetName() << "\");" << std::endl;
76 }
77 
78 ////////////////////////////////////////////////////////////////////////////////
79 /// constructor
80 
82  UInt_t options, Pixel_t back) :
83  TGFrame(p, w, h, options, back)
84 {
85  SetWindowName();
87 }
88 
89 ////////////////////////////////////////////////////////////////////////////////
90 /// draw border
91 
93 {
94  gVirtualX->DrawLine(fId, GetShadowGC()(), 0, 0, 0, fHeight-2);
95  gVirtualX->DrawLine(fId, GetHilightGC()(), 1, 0, 1, fHeight-1);
96  gVirtualX->DrawLine(fId, GetHilightGC()(), 0, fHeight-1, 1, fHeight-1);
97 }
98 
99 ////////////////////////////////////////////////////////////////////////////////
100 /// Save an vertical 3D line as a C++ statement(s) on output stream out.
101 
102 void TGVertical3DLine::SavePrimitive(std::ostream &out, Option_t *option /*= ""*/)
103 {
104  if (fBackground != GetDefaultFrameBackground()) SaveUserColor(out, option);
105 
106  out << " TGVertical3DLine *";
107  out << GetName() << " = new TGVertical3DLine(" << fParent->GetName()
108  << "," << GetWidth() << "," << GetHeight();
109 
111  if (!GetOptions()) {
112  out << ");" << std::endl;
113  } else {
114  out << "," << GetOptionString() <<");" << std::endl;
115  }
116  } else {
117  out << "," << GetOptionString() << ",ucolor);" << std::endl;
118  }
119  if (option && strstr(option, "keep_names"))
120  out << " " << GetName() << "->SetName(\"" << GetName() << "\");" << std::endl;
121 }
TGWindow::SetWindowName
virtual void SetWindowName(const char *name=0)
Set window name.
Definition: TGWindow.cxx:118
TGFrame::GetHeight
UInt_t GetHeight() const
Definition: TGFrame.h:250
TGWindow
Definition: TGWindow.h:31
TGHorizontal3DLine
Definition: TG3DLine.h:29
gVirtualX
#define gVirtualX
Definition: TVirtualX.h:338
Pixel_t
ULong_t Pixel_t
Definition: GuiTypes.h:39
ClassImp
#define ClassImp(name)
Definition: Rtypes.h:364
TGFrame::fWidth
UInt_t fWidth
Definition: TGFrame.h:112
TGWindow::kEditDisableHeight
@ kEditDisableHeight
Definition: TGWindow.h:63
TGHorizontal3DLine::DrawBorder
virtual void DrawBorder()
draw border
Definition: TG3DLine.cxx:46
TGFrame::GetDefaultFrameBackground
static Pixel_t GetDefaultFrameBackground()
Get default frame background.
Definition: TGFrame.cxx:668
TVirtualX.h
TGHorizontal3DLine::SavePrimitive
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:57
TGVertical3DLine
Definition: TG3DLine.h:44
TGFrame
Definition: TGFrame.h:105
TGFrame::GetWidth
UInt_t GetWidth() const
Definition: TGFrame.h:249
TGFrame::GetOptionString
TString GetOptionString() const
Returns a frame option string - used in SavePrimitive().
Definition: TGFrame.cxx:2465
TGFrame::GetOptions
virtual UInt_t GetOptions() const
Definition: TGFrame.h:222
TGFrame::GetHilightGC
static const TGGC & GetHilightGC()
Get highlight color graphics context.
Definition: TGFrame.cxx:740
TGHorizontal3DLine::TGHorizontal3DLine
TGHorizontal3DLine(const TGWindow *p=0, UInt_t w=4, UInt_t h=2, UInt_t options=kChildFrame, Pixel_t back=GetDefaultFrameBackground())
constructor
Definition: TG3DLine.cxx:35
TG3DLine.h
Option_t
const typedef char Option_t
Definition: RtypesCore.h:66
h
#define h(i)
Definition: RSha256.hxx:124
TGWindow::GetName
virtual const char * GetName() const
Return unique name, used in SavePrimitive methods.
Definition: TGWindow.cxx:317
TGObject::fId
Handle_t fId
Definition: TGObject.h:36
TGFrame::SaveUserColor
void SaveUserColor(std::ostream &out, Option_t *)
Save a user color in a C++ macro file - used in SavePrimitive().
Definition: TGFrame.cxx:2438
unsigned int
TGVertical3DLine::SavePrimitive
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:102
TGFrame::GetShadowGC
static const TGGC & GetShadowGC()
Get shadow color graphics context.
Definition: TGFrame.cxx:750
TGWindow::kEditDisableWidth
@ kEditDisableWidth
Definition: TGWindow.h:64
TGFrame::fHeight
UInt_t fHeight
Definition: TGFrame.h:113
TGVertical3DLine::DrawBorder
virtual void DrawBorder()
draw border
Definition: TG3DLine.cxx:92
TGFrame::fBackground
Pixel_t fBackground
Definition: TGFrame.h:120
TGWindow::fEditDisabled
UInt_t fEditDisabled
Definition: TGWindow.h:40
TGWindow::fParent
const TGWindow * fParent
Definition: TGWindow.h:36
TGVertical3DLine::TGVertical3DLine
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:81