89 text.TText::Copy(*
this);
97 src.TText::Copy(*
this);
112 *
reinterpret_cast<std::wstring*
>(((
TText&)obj).fWcsTitle) = *
reinterpret_cast<const std::wstring*
>(
fWcsTitle);
114 delete reinterpret_cast<std::wstring*
>(((
TText&)obj).fWcsTitle);
130 return reinterpret_cast<std::wstring *
>(
fWcsTitle)->c_str();
143 if (!
gPad)
return 9999;
147 ptx =
gPad->UtoAbsPixel(
fX);
148 pty =
gPad->VtoAbsPixel(
fY);
155 Int_t cBoxX[5], cBoxY[5];
225 auto &parent = *
gPad;
228 static Bool_t resize,turn;
241 Int_t ax = 0, ay = 0, bx, by, cx, cy;
243 Int_t cBoxX[4], cBoxY[4], part;
245 Bool_t opaque = parent.OpaqueMoving();
253 px1 = parent.UtoAbsPixel(
fX);
254 py1 = parent.VtoAbsPixel(
fY);
256 px1 = parent.XtoAbsPixel(parent.XtoPad(
fX));
257 py1 = parent.YtoAbsPixel(parent.YtoPad(
fY));
268 div = ((cBoxX[3]-cBoxX[0])*co-(cBoxY[3]-cBoxY[0])*si);
270 part = (
Int_t)(3*((px-cBoxX[0])*co-(py-cBoxY[0])*si)/ div);
287 parent.SetCursor(
kMove);
312 if (dtheta<0) theta = -theta;
314 if (theta<0) theta += 360;
315 if (right) {theta = theta+180;
if (theta>=360) theta -= 360;}
322 case 1 : ax = px1; ay = py1;
break;
323 case 2 : ax = px1+
Int_t(si*
h/2); ay = py1+
Int_t(co*
h/2);
break;
324 case 3 : ax = px1+
Int_t(si*
h*3/2); ay = py1+
Int_t(co*
h*3/2);
break;
329 case 1 : ax = px1-
Int_t(co*
w/2); ay = py1+
Int_t(si*
w/2);
break;
330 case 2 : ax = px1-
Int_t(co*
w/2+si*
h/2); ay = py1+
Int_t(si*
w/2+co*
h/2);
break;
331 case 3 : ax = px1-
Int_t(co*
w/2+si*
h*3/2); ay = py1+
Int_t(si*
w/2+co*
h*3/2);
break;
336 case 1 : ax = px1-
Int_t(co*
w); ay = py1+
Int_t(si*
w);
break;
337 case 2 : ax = px1-
Int_t(co*
w+si*
h/2); ay = py1+
Int_t(si*
w+co*
h/2);
break;
338 case 3 : ax = px1-
Int_t(co*
w+si*
h*3/2); ay = py1+
Int_t(si*
w+co*
h*3/2);
break;
349 lambda =
Double_t(((px-bx)*(cx-bx)+(py-by)*(cy-by)))/
Double_t(((cx-bx)*(cx-bx)+(cy-by)*(cy-by)));
353 if (Size<4) Size = 4;
357 dx = px - pxold; px1 += dx;
358 dy = py - pyold; py1 += dy;
364 parent.ShowGuidelines(
this, event,
't',
false);
365 if (!resize && !turn)
366 parent.ShowGuidelines(
this, event,
'i',
true);
367 parent.ShowGuidelines(
this, event, !resize && !turn);
369 parent.ModifiedUpdate();
373 pxold = px; pyold = py;
378 parent.ShowGuidelines(
this, event, !resize && !turn);
384 parent.Modified(
kTRUE);
392 event = parent.GetCanvasImp()->RequestLocator(px, py);
414 UInt_t cBoxW = 0, cBoxH = 0;
419 auto pp =
gPad->GetPainter();
426 case 1 : Dx = 0 ;
break;
427 case 2 : Dx = cBoxW/2;
break;
428 case 3 : Dx = cBoxW ;
break;
431 case 1 : Dy = 0 ;
break;
432 case 2 : Dy = cBoxH/2;
break;
433 case 3 : Dy = cBoxH ;
break;
440 cBoxY[1] =
y-cBoxH+Dy;
441 cBoxX[2] =
x+cBoxW-Dx;
442 cBoxY[2] =
y-cBoxH+Dy;
443 cBoxX[3] =
x+cBoxW-Dx;
450 for (
int i=0; i<4 ; i++) {
451 Int_t hcBoxX = cBoxX[i];
452 Int_t hcBoxY = cBoxY[i];
453 cBoxX[i] = (
Int_t)((hcBoxX-
x)*cosTheta-(hcBoxY-
y)*sinTheta+
x);
454 cBoxY[i] = (
Int_t)((hcBoxX-
x)*sinTheta+(hcBoxY-
y)*cosTheta+
y);
475 Int_t cBoxX[4], cBoxY[4];
478 ptx =
gPad->UtoAbsPixel(
fX);
479 pty =
gPad->VtoAbsPixel(
fY);
489 for (
Int_t i=1; i<4; i++) {
490 if (cBoxX[i] <
x1)
x1 = cBoxX[i];
491 if (cBoxX[i] >
x2)
x2 = cBoxX[i];
492 if (cBoxY[i] <
y1)
y1 = cBoxY[i];
493 if (cBoxY[i] >
y2)
y2 = cBoxY[i];
499 auto pp =
gPad->GetPainter();
517 auto pp =
gPad->GetPainter();
535 auto pp =
gPad->GetPainter();
552 auto pp =
gPad->GetPainter();
569 auto pp =
gPad->GetPainter();
586 auto pp =
gPad->GetPainter();
617 Int_t cBoxX[4], cBoxY[4];
623 auto pp =
gPad->GetPainter();
628 pp->SetAttLine({(
Style_t)1, 1, 1});
629 for (
int p1 = 0; p1 < 4; ++p1) {
630 int p2 = (p1 + 1) % 4;
631 pp->DrawLine(
gPad->AbsPixeltoX(cBoxX[p1]),
632 gPad->AbsPixeltoY(cBoxY[p1]),
633 gPad->AbsPixeltoX(cBoxX[p2]),
634 gPad->AbsPixeltoY(cBoxY[p2]));
639 Int_t ix = 0, iy = 0;
643 case 1 : ix = 0 ; iy = 0 ;
break;
644 case 2 : ix = 0 ; iy = 1 ;
break;
645 case 3 : ix = 1 ; iy = 1 ;
break;
650 case 1 : ix = 0 ; iy = 3 ;
break;
651 case 2 : ix = 0 ; iy = 2 ;
break;
652 case 3 : ix = 1 ; iy = 2 ;
break;
657 case 1 : ix = 3 ; iy = 3 ;
break;
658 case 2 : ix = 2 ; iy = 3 ;
break;
659 case 3 : ix = 2 ; iy = 2 ;
break;
663 Double_t mX =
gPad->AbsPixeltoX((cBoxX[ix]+cBoxX[iy])/2);
664 Double_t mY =
gPad->AbsPixeltoY((cBoxY[ix]+cBoxY[iy])/2);
665 pp->SetAttMarker({(
Color_t)1, 24, 0.7});
666 pp->DrawPolyMarker(1, &mX, &mY);
723 out,
Class(),
"text",
729 out <<
" text->SetNDC();\n";
747 char *mb_title =
new char[MB_CUR_MAX * wcslen(title) + 1]();
749 size_t length = wcslen(title);
750 for (
size_t i = 0; i <
length; i++) {
751 const int n = wctomb(p, title[i]);
791 Int_t Dx = 0, Dy = 0;
798 case 1: Dx = 0;
break;
799 case 2: Dx =
w / 2;
break;
800 case 3: Dx =
w;
break;
804 case 1: Dy =
h;
break;
805 case 2: Dy =
h / 2;
break;
806 case 3: Dy = 0;
break;
809 bbox.fX =
gPad->UtoPixel(
GetX()) - Dx;
810 bbox.fY =
gPad->VtoPixel(
GetY()) - Dy;
short Style_t
Style number (short)
bool Bool_t
Boolean (0=false, 1=true) (bool)
int Int_t
Signed integer 4 bytes (int)
short Color_t
Color number (short)
short Version_t
Class version identifier (short)
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int)
float Float_t
Float 4 bytes (float)
short Short_t
Signed Short integer 2 bytes (short)
double Double_t
Double 8 bytes.
const char Option_t
Option string (const char)
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void w
Option_t Option_t SetTextSize
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h length
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t UChar_t len
Option_t Option_t TPoint TPoint const char x2
Option_t Option_t TPoint TPoint const char x1
Option_t Option_t TPoint TPoint angle
Option_t Option_t TPoint TPoint const char y2
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t src
Option_t Option_t TPoint TPoint DrawText
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t height
Option_t Option_t TPoint TPoint const char text
Option_t Option_t TPoint TPoint const char y1
Abstract base class for elements drawn in the editor.
Double_t GetYCoord(const Int_t y, Bool_t is_ndc=kFALSE, Bool_t is_absolute=kFALSE)
Can return ndc or normal values Also one can specify to use absolute coordinates for input parameter ...
Double_t GetXCoord(const Int_t x, Bool_t is_ndc=kFALSE, Bool_t is_absolute=kFALSE)
Return user X coordinate for pixel X value Can return ndc or normal values Also one can specify to us...
virtual Float_t GetTextSize() const
Return the text size.
virtual void Modify()
Change current text attributes if necessary.
virtual Short_t GetTextAlign() const
Return the text alignment.
virtual Font_t GetTextFont() const
Return the text font.
Float_t fTextAngle
Text angle.
TAttText()
AttText default constructor.
virtual Color_t GetTextColor() const
Return the text color.
virtual void Streamer(TBuffer &)
virtual void SetTextAngle(Float_t tangle=0)
Set the text angle.
virtual Float_t GetTextAngle() const
Return the text angle.
virtual void SaveTextAttributes(std::ostream &out, const char *name, Int_t alidef=12, Float_t angdef=0, Int_t coldef=1, Int_t fondef=61, Float_t sizdef=1)
Save text attributes as C++ statement(s) on output stream out.
Short_t fTextAlign
Text alignment.
void Copy(TAttText &atttext) const
Copy this text attributes to a new TAttText.
virtual Float_t GetTextSizePixels(TVirtualPad &pad) const
Return the text size in pixels for specified pad.
Float_t fTextSize
Text size.
Buffer base class used for serializing objects.
virtual Version_t ReadVersion(UInt_t *start=nullptr, UInt_t *bcnt=nullptr, const TClass *cl=nullptr)=0
virtual Int_t ReadClassBuffer(const TClass *cl, void *pointer, const TClass *onfile_class=nullptr)=0
virtual Int_t WriteClassBuffer(const TClass *cl, void *pointer)=0
void Copy(TObject &named) const override
Copy this to obj.
void Streamer(TBuffer &) override
Stream an object of class TObject.
const char * GetTitle() const override
Returns title of object.
virtual void SetName(const char *name)
Set the name of the TNamed.
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
virtual void AppendPad(Option_t *option="")
Append graphics object to current pad.
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
static void SavePrimitiveDraw(std::ostream &out, const char *variable_name, Option_t *option=nullptr)
Save invocation of primitive Draw() method Skipped if option contains "nodraw" string.
TObject()
TObject constructor.
static void SavePrimitiveConstructor(std::ostream &out, TClass *cl, const char *variable_name, const char *constructor_agrs="", Bool_t empty_line=kTRUE)
Save object constructor in the output stream "out".
@ kCanDelete
if object in a list can be deleted
@ kMustCleanup
if object destructor must call RecursiveRemove()
static void IndentLevel()
Functions used by ls() to indent an object hierarchy.
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
Double_t fY
Y position of text (left,center,etc..)
const void * GetWcsTitle(void) const
Returns the text as UNICODE.
Rectangle_t GetBBox() override
Return the "bounding Box" of the Box.
void Copy(TObject &text) const override
Copy this text to text.
TText & operator=(const TText &src)
Assignment operator.
virtual void GetBoundingBox(UInt_t &w, UInt_t &h, Bool_t angle=kFALSE)
Return text size in pixels.
virtual void SetY(Double_t y)
virtual void PaintControlBox(Int_t x, Int_t y, Double_t theta)
Paint the text control box.
virtual TText * DrawText(Double_t x, Double_t y, const char *text)
Draw this text with new coordinates.
void * fWcsTitle
!Used by TMathText
Double_t fX
X position of text (left,center,etc..)
~TText() override
Text default destructor.
virtual void PaintTextNDC(Double_t u, Double_t v, const char *text)
Draw this text with new coordinates in NDC.
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save primitive as a C++ statement(s) on output stream out.
void ls(Option_t *option="") const override
List this text with its attributes.
virtual void PaintText(Double_t x, Double_t y, const char *text)
Draw this text with new coordinates.
virtual void GetTextExtent(UInt_t &w, UInt_t &h, const char *text) const
Return text extent for string text.
virtual void GetTextAscentDescent(UInt_t &a, UInt_t &d, const char *text) const
Return text ascent and descent for string text.
@ kTextNDC
The text position is in the NDC space.
Int_t DistancetoPrimitive(Int_t px, Int_t py) override
Compute distance from point px,py to a string.
TPoint GetBBoxCenter() override
Return the point given by Alignment as 'center'.
virtual void SetX(Double_t x)
virtual void GetTextAdvance(UInt_t &a, const char *text, const Bool_t kern=kTRUE) const
Return text advance for string text if kern is true (default) kerning is taken into account.
void Paint(Option_t *option="") override
Paint this text with its current attributes.
void SetBBoxCenterY(const Int_t y) override
Set Y coordinate of the point given by Alignment as 'center'.
virtual void SetNDC(Bool_t isNDC=kTRUE)
Set NDC mode on if isNDC = kTRUE, off otherwise.
void Print(Option_t *option="") const override
Dump this text with its attributes.
virtual void GetControlBox(Int_t x, Int_t y, Double_t theta, Int_t cBoxX[4], Int_t cBoxY[4])
Return the text control box.
void SetBBoxCenterX(const Int_t x) override
Set X coordinate of the point given by Alignment as 'center'.
void Streamer(TBuffer &) override
Stream an object of class TText.
virtual TText * DrawTextNDC(Double_t x, Double_t y, const char *text)
Draw this text with new coordinates in NDC.
virtual void SetMbTitle(const wchar_t *title=L"")
Change (i.e. set) the title of the TNamed.
void ExecuteEvent(Int_t event, Int_t px, Int_t py) override
Execute action corresponding to one event.
Double_t ACos(Double_t)
Returns the principal value of the arc cosine of x, expressed in radians.
Bool_t IsInside(T xp, T yp, Int_t np, T *x, T *y)
Function which returns kTRUE if point xp,yp lies inside the polygon defined by the np points in array...
Double_t ASin(Double_t)
Returns the principal value of the arc sine of x, expressed in radians.
Double_t Sqrt(Double_t x)
Returns the square root of x.
Double_t Cos(Double_t)
Returns the cosine of an angle of x radians.
Double_t Sin(Double_t)
Returns the sine of an angle of x radians.
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.
Rectangle structure (maps to the X11 XRectangle structure)