1 /* Dia -- an diagram creation/manipulation program
2 * Copyright (C) 1998 Alexander Larsson
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 * Purpose: This is the interface file for the class icon and dialog.
23 /** \file objects/UML/class.h Declaration of the 'UML - Class' type */
29 #include "connectionpoint.h"
34 #define DIA_OBJECT(x) (DiaObject*)(x)
36 /** The number of regular connectionpoints on the class (not cps for
37 * attributes and operands and not the mainpoint). */
38 #define UMLCLASS_CONNECTIONPOINTS 8
39 /** default wrap length for member functions */
40 #define UMLCLASS_WRAP_AFTER_CHAR 40
41 /** default wrap length for comments */
42 #define UMLCLASS_COMMENT_LINE_LENGTH 40
44 /* The code behind the following preprocessor symbol should stay disabled until
45 * the dynamic relocation of connection points (caused by attribute and
46 * operation changes) is taken into account. It probably has other issues we are
47 * not aware of yet. Some more information maybe available at
48 * http://bugzilla.gnome.org/show_bug.cgi?id=303301
50 * Enabling 29/7 2005: Not known to cause any problems.
51 * 7/11 2005: Still seeing problems after dialog update, needs work. --LC
52 * 18/1 2006: Can't make it break, enabling.
54 #define UML_MAINPOINT 1
57 typedef struct _UMLClass UMLClass
;
58 typedef struct _UMLClassDialog UMLClassDialog
;
61 * \brief The most complex object Dia has
63 * What should I say? Don't try this at home :)
66 Element element
; /**< inheritance */
68 /** static connection point storage, the mainpoint must be behind the dynamics in Element::connections */
70 ConnectionPoint connections
[UMLCLASS_CONNECTIONPOINTS
+ 1];
72 ConnectionPoint connections
[UMLCLASS_CONNECTIONPOINTS
];
78 real abstract_font_height
;
79 real polymorphic_font_height
;
80 real classname_font_height
;
81 real abstract_classname_font_height
;
82 real comment_font_height
;
85 DiaFont
*abstract_font
;
86 DiaFont
*polymorphic_font
;
87 DiaFont
*classname_font
;
88 DiaFont
*abstract_classname_font
;
89 DiaFont
*comment_font
;
92 char *stereotype
; /**< NULL if no stereotype */
93 char *comment
; /**< Comments on the class */
95 int suppress_attributes
;
96 int suppress_operations
;
97 int visible_attributes
; /**< ie. don't draw strings. */
98 int visible_operations
;
101 int wrap_operations
; /**< wrap operations with many parameters */
103 int comment_line_length
; /**< Maximum line length for comments */
104 int comment_tagging
; /**< bool: if the {documentation = } tag should be used */
110 /** Attributes: aka member variables */
113 /** Operators: aka member functions */
116 /** Template: if it's a template class */
118 /** Template parameters */
119 GList
*formal_params
;
121 /* Calculated variables: */
124 char *stereotype_string
;
126 real attributesbox_height
;
128 real operationsbox_height
;
130 GList *operations_wrappos;*/
131 int max_wrapped_line_width
;
133 real templates_height
;
134 real templates_width
;
137 UMLClassDialog
*properties_dialog
;
139 /** Until GtkList replaced by something better, set this when being
140 * destroyed, and don't do umlclass_calculate_data when it is set.
141 * This is to avoid a half-way destroyed list being updated.
147 * \brief Very special user interface for UMLClass parametrization
149 * There is a (too) tight coupling between the UMLClass and it's user interface.
150 * And the dialog is too huge in code as well as on screen.
152 struct _UMLClassDialog
{
156 GtkEntry
*stereotype
;
157 GtkTextView
*comment
;
159 GtkToggleButton
*abstract_class
;
160 GtkToggleButton
*attr_vis
;
161 GtkToggleButton
*attr_supp
;
162 GtkToggleButton
*op_vis
;
163 GtkToggleButton
*op_supp
;
164 GtkToggleButton
*comments_vis
;
165 GtkToggleButton
*op_wrap
;
166 DiaFontSelector
*normal_font
;
167 DiaFontSelector
*abstract_font
;
168 DiaFontSelector
*polymorphic_font
;
169 DiaFontSelector
*classname_font
;
170 DiaFontSelector
*abstract_classname_font
;
171 DiaFontSelector
*comment_font
;
172 GtkSpinButton
*normal_font_height
;
173 GtkSpinButton
*abstract_font_height
;
174 GtkSpinButton
*polymorphic_font_height
;
175 GtkSpinButton
*classname_font_height
;
176 GtkSpinButton
*abstract_classname_font_height
;
177 GtkSpinButton
*comment_font_height
;
178 GtkSpinButton
*wrap_after_char
;
179 GtkSpinButton
*comment_line_length
;
180 GtkToggleButton
*comment_tagging
;
181 DiaColorSelector
*text_color
;
182 DiaColorSelector
*line_color
;
183 DiaColorSelector
*fill_color
;
184 GtkLabel
*max_length_label
;
185 GtkLabel
*Comment_length_label
;
187 GList
*disconnected_connections
;
188 GList
*added_connections
;
189 GList
*deleted_connections
;
191 GtkList
*attributes_list
;
192 GtkListItem
*current_attr
;
195 GtkEntry
*attr_value
;
196 GtkTextView
*attr_comment
;
197 GtkMenu
*attr_visible
;
198 GtkOptionMenu
*attr_visible_button
;
199 GtkToggleButton
*attr_class_scope
;
201 GtkList
*operations_list
;
202 GtkListItem
*current_op
;
205 GtkEntry
*op_stereotype
;
206 GtkTextView
*op_comment
;
209 GtkOptionMenu
*op_visible_button
;
210 GtkToggleButton
*op_class_scope
;
211 GtkMenu
*op_inheritance_type
;
212 GtkOptionMenu
*op_inheritance_type_button
;
213 GtkToggleButton
*op_query
;
215 GtkList
*parameters_list
;
216 GtkListItem
*current_param
;
217 GtkEntry
*param_name
;
218 GtkEntry
*param_type
;
219 GtkEntry
*param_value
;
220 GtkTextView
*param_comment
;
222 GtkOptionMenu
*param_kind_button
;
223 GtkWidget
*param_new_button
;
224 GtkWidget
*param_delete_button
;
225 GtkWidget
*param_up_button
;
226 GtkWidget
*param_down_button
;
228 GtkList
*templates_list
;
229 GtkListItem
*current_templ
;
230 GtkToggleButton
*templ_template
;
231 GtkEntry
*templ_name
;
232 GtkEntry
*templ_type
;
235 extern GtkWidget
*umlclass_get_properties(UMLClass
*umlclass
, gboolean is_default
);
236 extern ObjectChange
*umlclass_apply_props_from_dialog(UMLClass
*umlclass
, GtkWidget
*widget
);
237 extern void umlclass_calculate_data(UMLClass
*umlclass
);
238 extern void umlclass_update_data(UMLClass
*umlclass
);
240 extern void umlclass_sanity_check(UMLClass
*c
, gchar
*msg
);