Debian Codegraph @

pencil/include/draw/draw_classifier_label.h

raw
1 /* File: draw_classifier_label.h; Copyright and License: see below */
2
3 #ifndef DRAW_CLASSIFIER_LABEL_H
4 #define DRAW_CLASSIFIER_LABEL_H
5
6 /* public file for the doxygen documentation: */
7 /*!
8 * \file
9 * \brief Draws titles, stereotypes, underscores; performs linebreaks
10 *
11 * This class does not show stereotype images, only their textual representation.
12 */
13
14 #include "draw/draw_line_breaker.h"
15 #include "pencil_size.h"
16 #include "geometry/geometry_h_align.h"
17 #include "geometry/geometry_v_align.h"
18 #include "geometry/geometry_rectangle.h"
19 #include "geometry/geometry_dimensions.h"
20 #include "data_rules.h"
21 #include "set/data_visible_classifier.h"
22 #include "utf8stream/utf8stream_writemem.h"
23 #include <cairo.h>
24 #include <stdint.h>
25
26 /*!
27 * \brief attributes of the draw label functions
28 *
29 * \note This class is stateless.
30 * It may either be instantiated once and used many times or be instantiated per use.
31 */
32 struct draw_classifier_label_struct {
33 char text_buffer[ ( DATA_CLASSIFIER_MAX_NAME_SIZE + 1 ) * 4 ]; /*!< +1 for colon, x4 because any character may be followed by a 3-byte space */
34 utf8stream_writemem_t text_builder; /*!< a pair of utf8stream_writer_t and universal_memory_output_stream_t to build an output text */
35 draw_line_breaker_t linebr; /*!< An object to insert zero-width spaces (a 3 byte utf8 sequence) wherever a linebreak is allowed */
36 };
37
38 typedef struct draw_classifier_label_struct draw_classifier_label_t;
39
40 /*!
41 * \brief initializes the draw_classifier_label_t
42 *
43 * \param this_ pointer to own object attributes
44 */
45 void draw_classifier_label_init( draw_classifier_label_t *this_ );
46
47 /*!
48 * \brief destroys the draw_classifier_label_t
49 *
50 * \param this_ pointer to own object attributes
51 */
52 void draw_classifier_label_destroy( draw_classifier_label_t *this_ );
53
54 /*!
55 * \brief determines the dimensions of the stereotype-as-text and name of the classifier.
56 *
57 * \param this_ pointer to own object attributes
58 * \param visible_classifier the visible_classifier consisting of diagramelement and classifier to draw
59 * \param with_stereotype false if no stereotype label shall be printed because an icon is shown instead
60 * \param proposed_bounds proposed bounds for the text width and height
61 * \param pencil_size set of sizes and colors for drawing lines and text
62 * \param font_layout pango layout object to determine the font metrics in the current cairo drawing context
63 * \param out_label_dim width and height of the type and name is returned. NULL is not permitted.
64 */
65 void draw_classifier_label_get_stereotype_and_name_dimensions( draw_classifier_label_t *this_,
66 const data_visible_classifier_t *visible_classifier,
67 bool with_stereotype,
68 const geometry_dimensions_t *proposed_bounds,
69 const pencil_size_t *pencil_size,
70 PangoLayout *font_layout,
71 geometry_dimensions_t *out_label_dim
72 );
73
74 /*!
75 * \brief renders stereotype-as-text and name of the classifier.
76 *
77 * \param this_ pointer to own object attributes
78 * \param visible_classifier the visible_classifier consisting of diagramelement and classifier to draw
79 * \param with_stereotype false if no stereotype label shall be printed because an icon is shown instead
80 * \param color color to draw text
81 * \param label_box the rectangle where to draw to
82 * \param pencil_size set of sizes and colors for drawing lines and text
83 * \param font_layout pango layout object to determine the font metrics in the current cairo drawing context
84 * \param cr the cairo drawing context.
85 */
86 void draw_classifier_label_draw_stereotype_and_name( draw_classifier_label_t *this_,
87 const data_visible_classifier_t *visible_classifier,
88 bool with_stereotype,
89 const GdkRGBA *color,
90 const geometry_rectangle_t *label_box,
91 const pencil_size_t *pencil_size,
92 PangoLayout *font_layout,
93 cairo_t *cr
94 );
95
96 #endif /* DRAW_CLASSIFIER_LABEL_H */
97
98
99 /*
100 Copyright 2019-2026 Andreas Warnke
101
102 Licensed under the Apache License, Version 2.0 (the "License");
103 you may not use this file except in compliance with the License.
104 You may obtain a copy of the License at
105
106 http://www.apache.org/licenses/LICENSE-2.0
107
108 Unless required by applicable law or agreed to in writing, software
109 distributed under the License is distributed on an "AS IS" BASIS,
110 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
111 See the License for the specific language governing permissions and
112 limitations under the License.
113 */