Mainpoint-related fixes, not fixed conn bug yet.
[dia.git] / objects / UML / class.h
blobdac34a5234121a0638df090044eaac63c48904fe
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.
18 #ifndef CLASS_H
19 #define CLASS_H
21 #include "object.h"
22 #include "element.h"
23 #include "connectionpoint.h"
24 #include "widgets.h"
26 #include "uml.h"
28 /* The number of regular connectionpoints on the class (not cps for
29 * attributes and operands and not the mainpoint). */
30 #define UMLCLASS_CONNECTIONPOINTS 8
31 #define UMLCLASS_WRAP_AFTER_CHAR 40
33 /* The code behind the following preprocessor symbol should stay disabled until
34 * the dynamic relocation of connection points (caused by attribute and
35 * operation changes) is taken into account. It probably has other issues we are
36 * not aware of yet. Some more information maybe available at
37 * http://bugzilla.gnome.org/show_bug.cgi?id=303301
39 * Enabling 29/7 2005: Not known to cause any problems.
41 #define UML_MAINPOINT 1
44 typedef struct _UMLClass UMLClass;
45 typedef struct _UMLClassDialog UMLClassDialog;
47 struct _UMLClass {
48 Element element;
50 #ifdef UML_MAINPOINT
51 ConnectionPoint connections[UMLCLASS_CONNECTIONPOINTS + 1];
52 #else
53 ConnectionPoint connections[UMLCLASS_CONNECTIONPOINTS];
54 #endif
56 /* Class info: */
58 real font_height;
59 real abstract_font_height;
60 real polymorphic_font_height;
61 real classname_font_height;
62 real abstract_classname_font_height;
63 real comment_font_height;
65 DiaFont *normal_font;
66 DiaFont *abstract_font;
67 DiaFont *polymorphic_font;
68 DiaFont *classname_font;
69 DiaFont *abstract_classname_font;
70 DiaFont *comment_font;
72 char *name;
73 char *stereotype; /* NULL if no stereotype */
74 char *comment; /* Comments on the class */
75 int abstract;
76 int suppress_attributes;
77 int suppress_operations;
78 int visible_attributes; /* ie. don't draw strings. */
79 int visible_operations;
80 int visible_comments;
82 int wrap_operations; /* wrap operations with many parameters */
83 int wrap_after_char;
85 Color line_color;
86 Color fill_color;
87 Color text_color;
89 /* Attributes: */
90 GList *attributes;
92 /* Operators: */
93 GList *operations;
95 /* Template: */
96 int template;
97 GList *formal_params;
99 /* Calculated variables: */
101 real namebox_height;
102 char *stereotype_string;
104 real attributesbox_height;
105 GList *attributes_strings;
107 real operationsbox_height;
108 GList *operations_strings;
109 GList *operations_wrappos;
110 int max_wrapped_line_width;
112 real templates_height;
113 real templates_width;
114 int num_templates;
115 char **templates_strings;
117 /* Dialog: */
118 UMLClassDialog *properties_dialog;
120 /** Until GtkList replaced by something better, set this when being
121 * destroyed, and don't do umlclass_calculate_data when it is set.
122 * This is to avoid a half-way destroyed list being updated.
124 gboolean destroyed;
127 struct _UMLClassDialog {
128 GtkWidget *dialog;
130 GtkEntry *classname;
131 GtkEntry *stereotype;
132 GtkEntry *comment;
134 GtkToggleButton *abstract_class;
135 GtkToggleButton *attr_vis;
136 GtkToggleButton *attr_supp;
137 GtkToggleButton *op_vis;
138 GtkToggleButton *op_supp;
139 GtkToggleButton *comments_vis;
140 GtkToggleButton *op_wrap;
141 DiaFontSelector *normal_font;
142 DiaFontSelector *abstract_font;
143 DiaFontSelector *polymorphic_font;
144 DiaFontSelector *classname_font;
145 DiaFontSelector *abstract_classname_font;
146 DiaFontSelector *comment_font;
147 GtkSpinButton *normal_font_height;
148 GtkSpinButton *abstract_font_height;
149 GtkSpinButton *polymorphic_font_height;
150 GtkSpinButton *classname_font_height;
151 GtkSpinButton *abstract_classname_font_height;
152 GtkSpinButton *comment_font_height;
153 GtkSpinButton *wrap_after_char;
154 DiaColorSelector *text_color;
155 DiaColorSelector *line_color;
156 DiaColorSelector *fill_color;
157 GtkLabel *max_length_label;
159 GList *disconnected_connections;
160 GList *added_connections;
161 GList *deleted_connections;
163 GtkList *attributes_list;
164 GtkListItem *current_attr;
165 GtkEntry *attr_name;
166 GtkEntry *attr_type;
167 GtkEntry *attr_value;
168 GtkEntry *attr_comment;
169 GtkMenu *attr_visible;
170 GtkOptionMenu *attr_visible_button;
171 GtkToggleButton *attr_class_scope;
173 GtkList *operations_list;
174 GtkListItem *current_op;
175 GtkEntry *op_name;
176 GtkEntry *op_type;
177 GtkEntry *op_stereotype;
178 GtkEntry *op_comment;
180 GtkMenu *op_visible;
181 GtkOptionMenu *op_visible_button;
182 GtkToggleButton *op_class_scope;
183 GtkMenu *op_inheritance_type;
184 GtkOptionMenu *op_inheritance_type_button;
185 GtkToggleButton *op_query;
187 GtkList *parameters_list;
188 GtkListItem *current_param;
189 GtkEntry *param_name;
190 GtkEntry *param_type;
191 GtkEntry *param_value;
192 GtkEntry *param_comment;
193 GtkMenu *param_kind;
194 GtkOptionMenu *param_kind_button;
195 GtkWidget *param_new_button;
196 GtkWidget *param_delete_button;
197 GtkWidget *param_up_button;
198 GtkWidget *param_down_button;
200 GtkList *templates_list;
201 GtkListItem *current_templ;
202 GtkToggleButton *templ_template;
203 GtkEntry *templ_name;
204 GtkEntry *templ_type;
207 extern GtkWidget *umlclass_get_properties(UMLClass *umlclass, gboolean is_default);
208 extern ObjectChange *umlclass_apply_props_from_dialog(UMLClass *umlclass, GtkWidget *widget);
209 extern void umlclass_calculate_data(UMLClass *umlclass);
210 extern void umlclass_update_data(UMLClass *umlclass);
212 #endif /* CLASS_H */