Line data Source code
1 : /* File: gui_type_resource.h; Copyright and License: see below */
2 :
3 : #ifndef GUI_TYPE_RESOURCE_H
4 : #define GUI_TYPE_RESOURCE_H
5 :
6 : /* public file for the doxygen documentation: */
7 : /*! \file
8 : * \brief Data objects needed to display an element type: name and icon
9 : *
10 : * This data object is a gobject to be able to store it in a GListModel like GListStore.
11 : */
12 :
13 : #include "entity/data_table.h"
14 : #include "entity/data_relationship_type.h"
15 : #include "entity/data_feature_type.h"
16 : #include "entity/data_classifier_type.h"
17 : #include "entity/data_diagram_type.h"
18 : #include "entity/data_type.h"
19 : #include "gui_gdk.h"
20 : #include <glib-object.h>
21 : #include <stdint.h>
22 :
23 : G_BEGIN_DECLS
24 :
25 : /*
26 : * Type declaration.
27 : */
28 : #define GUI_TYPE_TYPE_RESOURCE gui_type_resource_get_type()
29 0 : G_DECLARE_FINAL_TYPE (GuiTypeResource, gui_type_resource, GUI, TYPE_RESOURCE, GObject)
30 :
31 : /*!
32 : * \brief attributes of the type resource
33 : *
34 : * The notation of the struct name is required by glib
35 : */
36 : struct _GuiTypeResource {
37 : GObject parent_instance; /*!< glib parent object */
38 : data_type_t type_id; /*!< element type for which this type resource applies */
39 : const char * name; /*!< display name */
40 : GdkTexture * icon; /*!< icon to be displayed */
41 : };
42 :
43 : /*
44 : * Method definitions.
45 : */
46 : GuiTypeResource *gui_type_resource_new (void);
47 :
48 : G_END_DECLS
49 :
50 : typedef struct _GuiTypeResource gui_type_resource_t;
51 :
52 : /*!
53 : * \brief initializes the gui_type_resource_t struct
54 : *
55 : * \param this_ pointer to own object attributes
56 : * \param type type id
57 : * \param name name of the type
58 : * \param icon icon of the type
59 : */
60 : static inline void gui_type_resource_init_diagram ( gui_type_resource_t *this_,
61 : data_diagram_type_t type,
62 : const char * name,
63 : GdkTexture * icon
64 : );
65 :
66 : /*!
67 : * \brief initializes the gui_type_resource_t struct
68 : *
69 : * \param this_ pointer to own object attributes
70 : * \param type type id
71 : * \param name name of the type
72 : * \param icon icon of the type
73 : */
74 : static inline void gui_type_resource_init_classifier ( gui_type_resource_t *this_,
75 : data_classifier_type_t type,
76 : const char * name,
77 : GdkTexture * icon
78 : );
79 :
80 : /*!
81 : * \brief initializes the gui_type_resource_t struct
82 : *
83 : * \param this_ pointer to own object attributes
84 : * \param type type id
85 : * \param name name of the type
86 : * \param icon icon of the type
87 : */
88 : static inline void gui_type_resource_init_feature ( gui_type_resource_t *this_,
89 : data_feature_type_t type,
90 : const char * name,
91 : GdkTexture * icon
92 : );
93 :
94 : /*!
95 : * \brief initializes the gui_type_resource_t struct
96 : *
97 : * \param this_ pointer to own object attributes
98 : * \param type type id
99 : * \param name name of the type
100 : * \param icon icon of the type
101 : */
102 : static inline void gui_type_resource_init_relationship ( gui_type_resource_t *this_,
103 : data_relationship_type_t type,
104 : const char * name,
105 : GdkTexture * icon
106 : );
107 :
108 : /*!
109 : * \brief initializes the gui_type_resource_t struct with a copy
110 : *
111 : * parent_instance is not modified.
112 : *
113 : * \param this_ pointer to own object attributes
114 : * \param original pointer to object attributes to copy
115 : */
116 : static inline void gui_type_resource_replace ( gui_type_resource_t *this_, const gui_type_resource_t *original );
117 :
118 : /*!
119 : * \brief destroys the gui_type_resource_t struct
120 : *
121 : * \param this_ pointer to own object attributes
122 : */
123 : static inline void gui_type_resource_destroy ( gui_type_resource_t *this_ );
124 :
125 : /*!
126 : * \brief checks if two gui_type_resource_t are equal
127 : *
128 : * This function can be used as type GEqualFunc
129 : *
130 : * \param this_ pointer to own object attributes
131 : * \param that pointer to other object attributes
132 : * \return TRUE if equal
133 : */
134 : gboolean gui_type_resource_equal( const gui_type_resource_t *this_, const gui_type_resource_t *that );
135 :
136 : /*!
137 : * \brief gets the type
138 : *
139 : * \param this_ pointer to own object attributes
140 : * \return type_id of this gui_type_resource_t
141 : */
142 : static inline const data_type_t * gui_type_resource_get_type_id ( const gui_type_resource_t *this_ );
143 :
144 : /*!
145 : * \brief gets the name
146 : *
147 : * \param this_ pointer to own object attributes
148 : * \return name of this gui_type_resource_t
149 : */
150 : static inline const char * gui_type_resource_get_name ( const gui_type_resource_t *this_ );
151 :
152 : /*!
153 : * \brief gets the icon
154 : *
155 : * GdkTexture cannot be const because most gtk functions require mutable GdkTexture as parameter.
156 : *
157 : * \param this_ pointer to own object attributes
158 : * \return icon of this gui_type_resource_t
159 : */
160 : static inline GdkTexture * gui_type_resource_get_icon ( const gui_type_resource_t *this_ );
161 :
162 : #include "gui_type_resource.inl"
163 :
164 : #endif /* GUI_TYPE_RESOURCE_H */
165 :
166 :
167 : /*
168 : Copyright 2020-2025 Andreas Warnke
169 :
170 : Licensed under the Apache License, Version 2.0 (the "License");
171 : you may not use this file except in compliance with the License.
172 : You may obtain a copy of the License at
173 :
174 : http://www.apache.org/licenses/LICENSE-2.0
175 :
176 : Unless required by applicable law or agreed to in writing, software
177 : distributed under the License is distributed on an "AS IS" BASIS,
178 : WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
179 : See the License for the specific language governing permissions and
180 : limitations under the License.
181 : */
|