Debian Codegraph @

pencil/include/draw/draw_diagram_label.h

raw
1 /* File: draw_diagram_label.h; Copyright and License: see below */
2
3 #ifndef DRAW_DIAGRAM_LABEL_H
4 #define DRAW_DIAGRAM_LABEL_H
5
6 /* public file for the doxygen documentation: */
7 /*!
8 * \file
9 * \brief Draws types or stereotypes and titles of diagrams
10 */
11
12 #include "draw/draw_stereotype_icon.h"
13 #include "pencil_size.h"
14 #include "geometry/geometry_h_align.h"
15 #include "geometry/geometry_v_align.h"
16 #include "geometry/geometry_rectangle.h"
17 #include "geometry/geometry_dimensions.h"
18 #include "entity/data_diagram.h"
19 #include "set/data_profile_part.h"
20 #include "utf8stream/utf8stream_writemem.h"
21 #include <cairo.h>
22 #include <stdint.h>
23
24 /*!
25 * \brief attributes of the draw label functions
26 *
27 * \note This class is stateless.
28 * It may either be instantiated once and used many times or be instantiated per use.
29 */
30 struct draw_diagram_label_struct {
31 char text_buffer[ DATA_DIAGRAM_MAX_STEREOTYPE_SIZE + 4 ]; /*!< +4 for a left and a right guillemets */
32 utf8stream_writemem_t text_builder; /*!< a pair of utf8stream_writer_t and universal_memory_output_stream_t to build an output text */
33 draw_stereotype_icon_t image_renderer; /*!< own instance of stereotype image renderer */
34 };
35
36 typedef struct draw_diagram_label_struct draw_diagram_label_t;
37
38 /*!
39 * \brief initializes the draw_diagram_label_t
40 *
41 * \param this_ pointer to own object attributes
42 */
43 void draw_diagram_label_init( draw_diagram_label_t *this_ );
44
45 /*!
46 * \brief destroys the draw_diagram_label_t
47 *
48 * \param this_ pointer to own object attributes
49 */
50 void draw_diagram_label_destroy( draw_diagram_label_t *this_ );
51
52 /*!
53 * \brief determines the dimensions of the stereotype and name of the diagram.
54 *
55 * \param this_ pointer to own object attributes
56 * \param diagram the diagram to draw
57 * \param profile profile-part that provides the stereotype definition of the element to be drawn
58 * \param proposed_bounds proposed bounds for the text width and height
59 * \param pencil_size set of sizes and colors for drawing lines and text
60 * \param font_layout pango layout object to determine the font metrics in the current cairo drawing context
61 * \param out_label_dim width and height of the type and name is returned. NULL is not permitted.
62 */
63 void draw_diagram_label_get_type_and_name_dimensions( draw_diagram_label_t *this_,
64 const data_diagram_t *diagram,
65 const data_profile_part_t *profile,
66 const geometry_dimensions_t *proposed_bounds,
67 const pencil_size_t *pencil_size,
68 PangoLayout *font_layout,
69 geometry_dimensions_t *out_label_dim
70 );
71
72 /*!
73 * \brief renders stereotype and name of the diagram.
74 *
75 * \param this_ pointer to own object attributes
76 * \param diagram the diagram to draw
77 * \param profile profile-part that provides the stereotype definition of the element to be drawn
78 * \param color color to draw text and to use as default for stereotype-image strokes
79 * \param label_box the rectangle where to draw to
80 * \param pencil_size set of sizes and colors for drawing lines and text
81 * \param font_layout pango layout object to determine the font metrics in the current cairo drawing context
82 * \param cr the cairo drawing context.
83 */
84 void draw_diagram_label_draw_type_and_name( draw_diagram_label_t *this_,
85 const data_diagram_t *diagram,
86 const data_profile_part_t *profile,
87 const GdkRGBA *color,
88 const geometry_rectangle_t *label_box,
89 const pencil_size_t *pencil_size,
90 PangoLayout *font_layout,
91 cairo_t *cr
92 );
93
94 #endif /* DRAW_DIAGRAM_LABEL_H */
95
96
97 /*
98 Copyright 2019-2026 Andreas Warnke
99
100 Licensed under the Apache License, Version 2.0 (the "License");
101 you may not use this file except in compliance with the License.
102 You may obtain a copy of the License at
103
104 http://www.apache.org/licenses/LICENSE-2.0
105
106 Unless required by applicable law or agreed to in writing, software
107 distributed under the License is distributed on an "AS IS" BASIS,
108 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
109 See the License for the specific language governing permissions and
110 limitations under the License.
111 */