0026936: Drawbacks of inlining in new type system in OCCT 7.0 -- automatic
[occt.git] / src / AIS / AIS_TextLabel.hxx
1 // Created on: 2014-11-10
2 // Copyright (c) 2014 OPEN CASCADE SAS
3 //
4 // This file is part of Open CASCADE Technology software library.
5 //
6 // This library is free software; you can redistribute it and/or modify it under
7 // the terms of the GNU Lesser General Public License version 2.1 as published
8 // by the Free Software Foundation, with special exception defined in the file
9 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
10 // distribution for complete text of the license and disclaimer of any warranty.
11 //
12 // Alternatively, this file may be used under the terms of Open CASCADE
13 // commercial license or contractual agreement.
14
15 #ifndef _AIS_TextLabel_HeaderFile
16 #define _AIS_TextLabel_HeaderFile
17
18 #include <AIS_InteractiveObject.hxx>
19
20 #include <gp_Pnt.hxx>
21 #include <gp_Ax2.hxx>
22 #include <Graphic3d_VerticalTextAlignment.hxx>
23 #include <Graphic3d_HorizontalTextAlignment.hxx>
24 #include <Font_FontAspect.hxx>
25 #include <TCollection_ExtendedString.hxx>
26
27 //! Presentation of the text.
28 class AIS_TextLabel : public AIS_InteractiveObject
29 {
30 public:
31
32   //! Default constructor
33   Standard_EXPORT AIS_TextLabel();
34
35   //! Setup color of entire text.
36   Standard_EXPORT virtual void SetColor (const Quantity_Color& theColor) Standard_OVERRIDE;
37
38   //! Setup color of entire text.
39   Standard_EXPORT virtual void SetColor (const Quantity_NameOfColor theColor) Standard_OVERRIDE;
40
41   //! Setup text.
42   Standard_EXPORT void SetText (const TCollection_ExtendedString& theText);
43
44   //! Setup position.
45   Standard_EXPORT void SetPosition (const gp_Pnt& thePosition);
46
47   //! Setup horizontal justification.
48   Standard_EXPORT void SetHJustification (const Graphic3d_HorizontalTextAlignment theHJust);
49
50   //! Setup vertical justification.
51   Standard_EXPORT void SetVJustification (const Graphic3d_VerticalTextAlignment theVJust);
52
53   //! Setup angle.
54   Standard_EXPORT void SetAngle (const Standard_Real theAngle);
55
56   //! Setup zoomable property.
57   Standard_EXPORT void SetZoomable (const Standard_Boolean theIsZoomable);
58
59   //! Setup height.
60   Standard_EXPORT void SetHeight (const Standard_Real theHeight);
61
62   //! Setup font aspect.
63   Standard_EXPORT void SetFontAspect (const Font_FontAspect theFontAspect);
64
65   //! Setup font.
66   Standard_EXPORT void SetFont (Standard_CString theFont);
67
68   //! Setup label orientation in the model 3D space.
69   Standard_EXPORT void SetOrientation3D (const gp_Ax2& theOrientation);
70
71   //! Reset label orientation in the model 3D space.
72   Standard_EXPORT void UnsetOrientation3D ();
73
74   //! Returns position.
75   Standard_EXPORT const gp_Pnt& Position() const;
76
77   //! Returns label orientation in the model 3D space.
78   Standard_EXPORT const gp_Ax2& Orientation3D() const;
79
80   //! Returns true if the current text placement mode uses text orientation in the model 3D space.
81   Standard_EXPORT Standard_Boolean HasOrientation3D() const;
82
83   //! Define the display type of the text.
84   //!
85   //! TODT_NORMAL     Default display. Text only.
86   //! TODT_SUBTITLE   There is a subtitle under the text.
87   //! TODT_DEKALE     The text is displayed with a 3D style.
88   //! TODT_BLEND      The text is displayed in XOR.
89   //! TODT_DIMENSION  Dimension line under text will be invisible.
90   Standard_EXPORT void SetDisplayType (const Aspect_TypeOfDisplayText theDisplayType);
91
92   //! Modifies the colour of the subtitle for the TODT_SUBTITLE TextDisplayType
93   //! and the colour of backgroubd for the TODT_DEKALE TextDisplayType.
94   Standard_EXPORT void SetColorSubTitle (const Quantity_Color& theColor);
95
96 private:
97
98   //! Compute
99   Standard_EXPORT virtual void Compute (const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,
100                                         const Handle(Prs3d_Presentation)&           thePresentation,
101                                         const Standard_Integer                      theMode) Standard_OVERRIDE;
102
103   //! Compute selection
104   Standard_EXPORT virtual void ComputeSelection (const Handle(SelectMgr_Selection)& theSelection,
105                                                  const Standard_Integer             theMode) Standard_OVERRIDE;
106
107 protected:
108
109   TCollection_ExtendedString myText;
110   TCollection_AsciiString    myFont;
111   Font_FontAspect            myFontAspect;
112   gp_Ax2                     myOrientation3D;
113   Standard_Boolean           myHasOrientation3D;
114
115 public:
116
117   //! CASCADE RTTI
118   DEFINE_STANDARD_RTTIEXT(AIS_TextLabel,AIS_InteractiveObject);
119
120 };
121
122 DEFINE_STANDARD_HANDLE(AIS_TextLabel, AIS_InteractiveObject)
123
124 #endif // _AIS_TextLabel_HeaderFile