OverlayTextBox.h
1 //##################################################################################################
2 //
3 // Ceetron Desktop Components
4 // Component: Visualization
5 //
6 // --------------------------------------------------------------------------------------------
7 // Copyright (C) 2011, Ceetron AS
8 // This is UNPUBLISHED PROPRIETARY SOURCE CODE of Ceetron AS. The contents of this file may
9 // not be disclosed to third parties, copied or duplicated in any form, in whole or in part,
10 // without the prior written permission of Ceetron AS.
11 //##################################################################################################
12 
13 #pragma once
14 
15 #include "CeeVisualization/Base.h"
16 #include "CeeVisualization/OverlayItem.h"
17 #include "CeeCore/Str.h"
18 
19 namespace cee {
20 class Color3f;
21 
22 namespace vis {
23 class Font;
24 
25 //==================================================================================================
26 //
27 // A text box that can be used as an overlay item in a view
28 //
29 //==================================================================================================
30 class CEE_VIS_EXPORT OverlayTextBox : public OverlayItem
31 {
32 public:
33 
36  {
37  LEFT,
39  RIGHT
40  };
41 
42  OverlayTextBox(Font* font);
43  virtual ~OverlayTextBox();
44 
45  virtual unsigned int width() const;
46  virtual unsigned int height() const;
47  void setSize(unsigned int width, unsigned int height);
48 
49  virtual int priority() const;
50  virtual void setPriority(int priority);
51 
52  void setSizeToFitText();
53 
54  void setFont(Font* font);
55 
56  Str text() const;
57  void setText(const Str& text);
58 
59  Color3f textColor() const;
60  void setTextColor(const Color3f& color);
61 
62  Color3f backgroundColor() const;
63  void setBackgroundColor(const Color3f& color);
64 
65  float backgroundOpacity() const;
66  void setBackgroundOpacity(float opacity);
67 
68  Color3f borderColor() const;
69  void setBorderColor(const Color3f& color);
70 
71  float borderWidth() const;
72  void setBorderWidth(float width);
73 
74  bool drawBackground() const;
75  void setDrawBackground(bool drawBackground);
76 
77  bool drawBorder() const;
78  void setDrawBorder(bool drawBorder);
79 
80  TextBoxContentAlignment textContentAlignment() const;
81  void setTextContentAlignment(TextBoxContentAlignment alignment);
82 
83 private:
84  virtual cvf::OverlayItem* internal_cvfOverlayItem();
85 
86 private:
87  CEE_PRIVATE_IMPL(OverlayTextBox);
88  CEE_DISALLOW_COPY_AND_ASSIGN(OverlayTextBox);
89 };
90 
91 } // namespace vis
92 } // namespace cee
Namespace cee contains all functionality and structures under the Core component. ...
Definition: AppComponent.cpp:26
TextBoxContentAlignment
Alignment of text content within a text box.
Definition: OverlayTextBox.h:35
Align center.
Definition: OverlayTextBox.h:38
A general unicode based string class.
Definition: Str.h:28
Abstract interface for overlay items.
Definition: OverlayItem.h:31
Class for storing an RGB color triplet.
Definition: Color3f.h:25
Align left.
Definition: OverlayTextBox.h:37
A view overlay item capable of showing a text with optional border and background.
Definition: OverlayTextBox.h:30
A font used for text drawing.
Definition: Font.h:30