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