Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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{
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
57void 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{
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
102void TGVertical3DLine::SavePrimitive(std::ostream &out, Option_t *option /*= ""*/)
103{
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}
ULong_t Pixel_t
Pixel value.
Definition GuiTypes.h:40
#define h(i)
Definition RSha256.hxx:106
const char Option_t
Definition RtypesCore.h:66
#define ClassImp(name)
Definition Rtypes.h:364
#define gVirtualX
Definition TVirtualX.h:338
UInt_t fHeight
Definition TGFrame.h:112
static const TGGC & GetHilightGC()
Get highlight color graphics context.
Definition TGFrame.cxx:740
static Pixel_t GetDefaultFrameBackground()
Get default frame background.
Definition TGFrame.cxx:668
virtual UInt_t GetOptions() const
Definition TGFrame.h:221
TString GetOptionString() const
Returns a frame option string - used in SavePrimitive().
Definition TGFrame.cxx:2465
static const TGGC & GetShadowGC()
Get shadow color graphics context.
Definition TGFrame.cxx:750
UInt_t fWidth
Definition TGFrame.h:111
UInt_t GetHeight() const
Definition TGFrame.h:249
UInt_t GetWidth() const
Definition TGFrame.h:248
void SaveUserColor(std::ostream &out, Option_t *)
Save a user color in a C++ macro file - used in SavePrimitive().
Definition TGFrame.cxx:2438
Pixel_t fBackground
Definition TGFrame.h:119
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
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
virtual void DrawBorder()
draw border
Definition TG3DLine.cxx:46
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:81
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
virtual void DrawBorder()
draw border
Definition TG3DLine.cxx:92
virtual void SetWindowName(const char *name=0)
Set window name.
Definition TGWindow.cxx:128
virtual const char * GetName() const
Return unique name, used in SavePrimitive methods.
Definition TGWindow.cxx:335
const TGWindow * fParent
Definition TGWindow.h:36
@ kEditDisableHeight
Definition TGWindow.h:63
@ kEditDisableWidth
Definition TGWindow.h:64
UInt_t fEditDisabled
Definition TGWindow.h:40