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\class TGHorizontal3DLine
15\ingroup guiwidgets
16
17A horizontal 3D line is a line that typically separates a toolbar
18from the menubar.
19
20\class TGVertical3DLine
21\ingroup guiwidgets
22
23A vertical 3D line is a line that can be used to separate groups of
24widgets.
25
26*/
27
28#include "TG3DLine.h"
29#include "TVirtualX.h"
30
31#include <iostream>
32
33
36
37////////////////////////////////////////////////////////////////////////////////
38/// constructor
39
41 UInt_t options, Pixel_t back) :
42 TGFrame(p, w, h, options, back)
43{
46}
47
48////////////////////////////////////////////////////////////////////////////////
49/// draw border
50
52{
53 gVirtualX->DrawLine(fId, GetShadowGC()(), 0, 0, fWidth-2, 0);
54 gVirtualX->DrawLine(fId, GetHilightGC()(), 0, 1, fWidth-1, 1);
55 gVirtualX->DrawLine(fId, GetHilightGC()(), fWidth-1, 0, fWidth-1, 1);
56}
57
58
59////////////////////////////////////////////////////////////////////////////////
60/// Save an vertical 3D line as a C++ statement(s) on output stream out.
61
62void TGHorizontal3DLine::SavePrimitive(std::ostream &out, Option_t *option /*= ""*/)
63{
65
66 out << " TGHorizontal3DLine *";
67 out << GetName() << " = new TGHorizontal3DLine(" << fParent->GetName()
68 << "," << GetWidth() << "," << GetHeight();
69
71 if (!GetOptions()) {
72 out << ");" << std::endl;
73 } else {
74 out << "," << GetOptionString() << ");" << std::endl;
75 }
76 } else {
77 out << "," << GetOptionString() << ",ucolor);" << std::endl;
78 }
79 if (option && strstr(option, "keep_names"))
80 out << " " << GetName() << "->SetName(\"" << GetName() << "\");" << std::endl;
81}
82
83////////////////////////////////////////////////////////////////////////////////
84/// constructor
85
87 UInt_t options, Pixel_t back) :
88 TGFrame(p, w, h, options, back)
89{
92}
93
94////////////////////////////////////////////////////////////////////////////////
95/// draw border
96
98{
99 gVirtualX->DrawLine(fId, GetShadowGC()(), 0, 0, 0, fHeight-2);
100 gVirtualX->DrawLine(fId, GetHilightGC()(), 1, 0, 1, fHeight-1);
101 gVirtualX->DrawLine(fId, GetHilightGC()(), 0, fHeight-1, 1, fHeight-1);
102}
103
104////////////////////////////////////////////////////////////////////////////////
105/// Save an vertical 3D line as a C++ statement(s) on output stream out.
106
107void TGVertical3DLine::SavePrimitive(std::ostream &out, Option_t *option /*= ""*/)
108{
110
111 out << " TGVertical3DLine *";
112 out << GetName() << " = new TGVertical3DLine(" << fParent->GetName()
113 << "," << GetWidth() << "," << GetHeight();
114
116 if (!GetOptions()) {
117 out << ");" << std::endl;
118 } else {
119 out << "," << GetOptionString() <<");" << std::endl;
120 }
121 } else {
122 out << "," << GetOptionString() << ",ucolor);" << std::endl;
123 }
124 if (option && strstr(option, "keep_names"))
125 out << " " << GetName() << "->SetName(\"" << GetName() << "\");" << std::endl;
126}
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:377
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t option
#define gVirtualX
Definition TVirtualX.h:337
A subclasses of TGWindow, and is used as base class for some simple widgets (buttons,...
Definition TGFrame.h:80
UInt_t fHeight
frame height
Definition TGFrame.h:88
static const TGGC & GetHilightGC()
Get highlight color graphics context.
Definition TGFrame.cxx:755
static Pixel_t GetDefaultFrameBackground()
Get default frame background.
Definition TGFrame.cxx:683
virtual UInt_t GetOptions() const
Definition TGFrame.h:197
TString GetOptionString() const
Returns a frame option string - used in SavePrimitive().
Definition TGFrame.cxx:2506
static const TGGC & GetShadowGC()
Get shadow color graphics context.
Definition TGFrame.cxx:765
UInt_t fWidth
frame width
Definition TGFrame.h:87
UInt_t GetHeight() const
Definition TGFrame.h:225
UInt_t GetWidth() const
Definition TGFrame.h:224
void SaveUserColor(std::ostream &out, Option_t *)
Save a user color in a C++ macro file - used in SavePrimitive().
Definition TGFrame.cxx:2479
Pixel_t fBackground
frame background color
Definition TGFrame.h:95
A horizontal 3D line is a line that typically separates a toolbar from the menubar.
Definition TG3DLine.h:18
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save an vertical 3D line as a C++ statement(s) on output stream out.
Definition TG3DLine.cxx:62
void DrawBorder() override
draw border
Definition TG3DLine.cxx:51
TGHorizontal3DLine(const TGWindow *p=nullptr, UInt_t w=4, UInt_t h=2, UInt_t options=kChildFrame, Pixel_t back=GetDefaultFrameBackground())
constructor
Definition TG3DLine.cxx:40
Handle_t fId
X11/Win32 Window identifier.
Definition TGObject.h:24
A vertical 3D line is a line that can be used to separate groups of widgets.
Definition TG3DLine.h:33
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save an vertical 3D line as a C++ statement(s) on output stream out.
Definition TG3DLine.cxx:107
void DrawBorder() override
draw border
Definition TG3DLine.cxx:97
TGVertical3DLine(const TGWindow *p=nullptr, UInt_t w=2, UInt_t h=4, UInt_t options=kChildFrame, Pixel_t back=GetDefaultFrameBackground())
constructor
Definition TG3DLine.cxx:86
ROOT GUI Window base class.
Definition TGWindow.h:23
const TGWindow * fParent
Parent window.
Definition TGWindow.h:28
@ kEditDisableHeight
window height cannot be edited
Definition TGWindow.h:62
@ kEditDisableWidth
window width cannot be edited
Definition TGWindow.h:63
virtual void SetWindowName(const char *name=nullptr)
Set window name.
Definition TGWindow.cxx:129
const char * GetName() const override
Return unique name, used in SavePrimitive methods.
Definition TGWindow.cxx:336
UInt_t fEditDisabled
flags used for "guibuilding"
Definition TGWindow.h:32