1 | using System.Drawing;
|
---|
2 | using System.Runtime.Serialization;
|
---|
3 |
|
---|
4 | using ToolBox.Formatting;
|
---|
5 |
|
---|
6 | namespace Netron.Diagramming.Core {
|
---|
7 | public interface ITextStyle : ISerializable, IVersion {
|
---|
8 | // ------------------------------------------------------------------
|
---|
9 | /// <summary>
|
---|
10 | /// Occurs when the text style is changed.
|
---|
11 | /// </summary>
|
---|
12 | // ------------------------------------------------------------------
|
---|
13 | event TextStyleChangedEventHandler TextStyleChanged;
|
---|
14 |
|
---|
15 | #region Properties
|
---|
16 |
|
---|
17 | // ------------------------------------------------------------------
|
---|
18 | /// <summary>
|
---|
19 | /// Gets or sets the number of decimal places to use when a TextFormat
|
---|
20 | /// other than 'String' is specified.
|
---|
21 | /// </summary>
|
---|
22 | // ------------------------------------------------------------------
|
---|
23 | int DecimalPlaces {
|
---|
24 | get;
|
---|
25 | set;
|
---|
26 | }
|
---|
27 |
|
---|
28 | // ------------------------------------------------------------------
|
---|
29 | /// <summary>
|
---|
30 | /// Gets or sets the formatting to apply to the text.
|
---|
31 | /// </summary>
|
---|
32 | // ------------------------------------------------------------------
|
---|
33 | TextFormat TextFormat {
|
---|
34 | get;
|
---|
35 | set;
|
---|
36 | }
|
---|
37 |
|
---|
38 | // ------------------------------------------------------------------
|
---|
39 | /// <summary>
|
---|
40 | /// Gets the format of the string.
|
---|
41 | /// </summary>
|
---|
42 | // ------------------------------------------------------------------
|
---|
43 | StringFormat StringFormat {
|
---|
44 | get;
|
---|
45 | }
|
---|
46 |
|
---|
47 | // ------------------------------------------------------------------
|
---|
48 | /// <summary>
|
---|
49 | /// Gets or sets the horizontal alignment of the text.
|
---|
50 | /// </summary>
|
---|
51 | // ------------------------------------------------------------------
|
---|
52 | StringAlignment HorizontalAlignment {
|
---|
53 | get;
|
---|
54 | set;
|
---|
55 | }
|
---|
56 |
|
---|
57 | // ------------------------------------------------------------------
|
---|
58 | /// <summary>
|
---|
59 | /// Gets or sets the vertical alignment of the text.
|
---|
60 | /// </summary>
|
---|
61 | // ------------------------------------------------------------------
|
---|
62 | StringAlignment VerticalAlignment {
|
---|
63 | get;
|
---|
64 | set;
|
---|
65 | }
|
---|
66 |
|
---|
67 | // ------------------------------------------------------------------
|
---|
68 | /// <summary>
|
---|
69 | /// Gets or sets the text's font.
|
---|
70 | /// </summary>
|
---|
71 | // ------------------------------------------------------------------
|
---|
72 | Font Font {
|
---|
73 | get;
|
---|
74 | set;
|
---|
75 | }
|
---|
76 |
|
---|
77 | // ------------------------------------------------------------------
|
---|
78 | /// <summary>
|
---|
79 | /// Gets or sets the text's font size.
|
---|
80 | /// </summary>
|
---|
81 | // ------------------------------------------------------------------
|
---|
82 | float FontSize {
|
---|
83 | get;
|
---|
84 | set;
|
---|
85 | }
|
---|
86 |
|
---|
87 | // ------------------------------------------------------------------
|
---|
88 | /// <summary>
|
---|
89 | /// Gets or sets the text's color.
|
---|
90 | /// </summary>
|
---|
91 | // ------------------------------------------------------------------
|
---|
92 | Color FontColor {
|
---|
93 | get;
|
---|
94 | set;
|
---|
95 | }
|
---|
96 |
|
---|
97 | // ------------------------------------------------------------------
|
---|
98 | /// <summary>
|
---|
99 | /// Gets or sets if the text is underlined.
|
---|
100 | /// </summary>
|
---|
101 | // ------------------------------------------------------------------
|
---|
102 | bool IsUnderlined {
|
---|
103 | get;
|
---|
104 | set;
|
---|
105 | }
|
---|
106 |
|
---|
107 | // ------------------------------------------------------------------
|
---|
108 | /// <summary>
|
---|
109 | /// Gets or sets if the text is bold.
|
---|
110 | /// </summary>
|
---|
111 | // ------------------------------------------------------------------
|
---|
112 | bool IsBold {
|
---|
113 | get;
|
---|
114 | set;
|
---|
115 | }
|
---|
116 |
|
---|
117 | // ------------------------------------------------------------------
|
---|
118 | /// <summary>
|
---|
119 | /// Gets or sets if the text is italic.
|
---|
120 | /// </summary>
|
---|
121 | // ------------------------------------------------------------------
|
---|
122 | bool IsItalic {
|
---|
123 | get;
|
---|
124 | set;
|
---|
125 | }
|
---|
126 |
|
---|
127 | #endregion
|
---|
128 |
|
---|
129 | #region Methods
|
---|
130 |
|
---|
131 | // ------------------------------------------------------------------
|
---|
132 | /// <summary>
|
---|
133 | /// Gets the brush that's used to draw our text to a GDI+ graphics
|
---|
134 | /// surface.
|
---|
135 | /// </summary>
|
---|
136 | /// <returns>Brush</returns>
|
---|
137 | // ------------------------------------------------------------------
|
---|
138 | Brush GetBrush();
|
---|
139 |
|
---|
140 | // ------------------------------------------------------------------
|
---|
141 | /// <summary>
|
---|
142 | /// Applies the formatting specified by TextFormatting to the text
|
---|
143 | /// specified.
|
---|
144 | /// </summary>
|
---|
145 | /// <param name="text">string: The un-formatted text.</param>
|
---|
146 | /// <returns>string: The formatted text.</returns>
|
---|
147 | // ------------------------------------------------------------------
|
---|
148 | string GetFormattedText(string text);
|
---|
149 |
|
---|
150 | #endregion
|
---|
151 | }
|
---|
152 | }
|
---|