00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef LISTPOPUPMENU_H
00012 #define LISTPOPUPMENU_H
00013
00014 #include "umlnamespace.h"
00015 #include "icon_utils.h"
00016
00017 #include <kmenu.h>
00018
00019
00020 #include <QtCore/QHash>
00021
00022 class UMLView;
00023 class WidgetBase;
00024 class UMLWidget;
00025 class ClassifierWidget;
00026 class UMLCategory;
00027 class UMLObject;
00028
00037 class ListPopupMenu : public KMenu
00038 {
00039 Q_OBJECT
00040 Q_ENUMS(Menu_Type)
00041 public:
00042
00043 enum Menu_Type
00044 {
00045 mt_Model,
00046 mt_Logical_View,
00047 mt_UseCase_View,
00048 mt_Component_View,
00049 mt_Deployment_View,
00050 mt_EntityRelationship_Model,
00051 mt_UseCase_Diagram,
00052 mt_Sequence_Diagram,
00053 mt_Class_Diagram,
00054 mt_Collaboration_Diagram,
00055 mt_State_Diagram,
00056 mt_Activity_Diagram,
00057 mt_Component_Diagram,
00058 mt_Deployment_Diagram,
00059 mt_EntityRelationship_Diagram,
00060 mt_On_UseCase_Diagram,
00061 mt_On_Sequence_Diagram,
00062 mt_On_Class_Diagram,
00063 mt_On_Collaboration_Diagram,
00064 mt_On_State_Diagram,
00065 mt_On_Activity_Diagram,
00066 mt_On_Component_Diagram,
00067 mt_On_Deployment_Diagram,
00068 mt_On_EntityRelationship_Diagram,
00069 mt_Logical_Folder,
00070 mt_UseCase_Folder,
00071 mt_Component_Folder,
00072 mt_Deployment_Folder,
00073 mt_EntityRelationship_Folder,
00074 mt_Class,
00075 mt_Package,
00076 mt_Subsystem,
00077 mt_Component,
00078 mt_Node,
00079 mt_Artifact,
00080 mt_Interface,
00081 mt_Enum,
00082 mt_Entity,
00083 mt_Datatype,
00084 mt_Actor,
00085 mt_UseCase,
00086 mt_Attribute,
00087 mt_EntityAttribute,
00088 mt_EnumLiteral,
00089 mt_UniqueConstraint,
00090 mt_PrimaryKeyConstraint,
00091 mt_ForeignKeyConstraint,
00092 mt_CheckConstraint,
00093 mt_Object,
00094 mt_Category,
00095 mt_DisjointSpecialisation,
00096 mt_OverlappingSpecialisation,
00097 mt_Union,
00098 mt_Initial_State,
00099 mt_End_State,
00100 mt_State,
00101 mt_Junction,
00102 mt_DeepHistory,
00103 mt_ShallowHistory,
00104 mt_Choice,
00105 mt_StateFork,
00106 mt_StateJoin,
00107 mt_Activity,
00108 mt_Initial_Activity,
00109 mt_End_Activity,
00110 mt_Operation,
00111 mt_Template,
00112 mt_New_Parameter,
00113 mt_New_Operation,
00114 mt_New_Attribute,
00115 mt_New_Template,
00116 mt_New_EnumLiteral,
00117 mt_New_EntityAttribute,
00118 mt_New_UniqueConstraint,
00119 mt_New_PrimaryKeyConstraint,
00120 mt_New_ForeignKeyConstraint,
00121 mt_New_CheckConstraint,
00122 mt_Parameter_Selected,
00123 mt_Operation_Selected,
00124 mt_Attribute_Selected,
00125 mt_Template_Selected,
00126 mt_EnumLiteral_Selected,
00127 mt_EntityAttribute_Selected,
00128 mt_UniqueConstraint_Selected,
00129 mt_PrimaryKeyConstraint_Selected,
00130 mt_ForeignKeyConstraint_Selected,
00131 mt_CheckConstraint_Selected,
00132 mt_Association_Selected,
00133 mt_Show_Attributes,
00134 mt_Show_Attributes_Selection,
00135 mt_Show_Operations,
00136 mt_Show_Operations_Selection,
00137 mt_Show_Packages,
00138 mt_Show_Packages_Selection,
00139 mt_Show_Stereotypes,
00140 mt_Show_Stereotypes_Selection,
00141 mt_Visibility,
00142 mt_Visibility_Selection,
00143 mt_DrawAsCircle,
00144 mt_DrawAsCircle_Selection,
00145 mt_ChangeToClass,
00146 mt_ChangeToClass_Selection,
00147 mt_ChangeToInterface,
00148 mt_ChangeToInterface_Selection,
00149 mt_Rename_Object,
00150 mt_Select_Operation,
00151 mt_Anchor,
00152 mt_Properties,
00153 mt_Rename,
00154 mt_Delete,
00155 mt_Export_Image,
00156 mt_Import_Classes,
00157 mt_Import_Project,
00158 mt_Sequence_Number,
00159 mt_Cut,
00160 mt_Copy,
00161 mt_Paste,
00162 mt_Clear,
00163 mt_Redo,
00164 mt_Undo,
00165 mt_Link_Docs,
00166 mt_Show_Operation_Signature,
00167 mt_Show_Operation_Signature_Selection,
00168 mt_Show_Attribute_Signature,
00169 mt_Show_Attribute_Signature_Selection,
00170 mt_Message_Text,
00171 mt_Collaboration_Message,
00172 mt_FloatText,
00173 mt_MultiA,
00174 mt_MultiB,
00175 mt_Name,
00176 mt_FullAssociation,
00177 mt_AttributeAssociation,
00178 mt_RoleNameA,
00179 mt_RoleNameB,
00180 mt_Delete_Selection,
00181 mt_Reset_Label_Positions,
00182 mt_Line_Color,
00183 mt_Fill_Color,
00184 mt_Use_Fill_Color,
00185 mt_Default_Properties,
00186 mt_Rename_MultiA,
00187 mt_Rename_MultiB,
00188 mt_Rename_Name,
00189 mt_Rename_RoleAName,
00190 mt_Rename_RoleBName,
00191 mt_Change_Font,
00192 mt_Change_Font_Selection,
00193 mt_SnapToGrid,
00194 mt_ShowSnapGrid,
00195 mt_Activity_Selected,
00196 mt_New_Activity,
00197 mt_Up,
00198 mt_Down,
00199 mt_Branch,
00200 mt_Flip,
00201
00202 mt_Expand_All,
00203 mt_Collapse_All,
00204
00205 mt_Refactoring,
00206 mt_ViewCode,
00207 mt_Clone,
00208 mt_Show_Public_Only,
00209 mt_Show_Public_Only_Selection,
00210 mt_Externalize_Folder,
00211 mt_Internalize_Folder,
00212
00213 mt_AddInteractionOperand,
00214
00215 mt_Undefined = - 1
00216 };
00217
00218 explicit ListPopupMenu(QWidget* parent, Menu_Type type = mt_Undefined, UMLView* view = 0);
00219 ListPopupMenu(QWidget* parent, Uml::ListView_Type type, UMLObject* object);
00220 ListPopupMenu(QWidget* parent, UMLWidget* object, bool multi = false, bool unique = false);
00221
00222 ~ListPopupMenu();
00223
00224 static Uml::Object_Type convert_MT_OT(Menu_Type mt);
00225 static Uml::Diagram_Type convert_MT_DT(Menu_Type mt);
00226
00227
00228 QAction* getAction(Menu_Type idx);
00229
00230 void setActionEnabled(Menu_Type idx, bool value);
00231
00232
00233 Menu_Type getMenuType(QAction* action);
00234
00235 WidgetBase *ownerWidget() const;
00236
00237 private:
00238
00239 void insert(Menu_Type m);
00240 void insert(const Menu_Type m, KMenu* menu);
00241 void insert(const Menu_Type m, const QIcon & icon, const QString & text);
00242 void insert(const Menu_Type m, const QString & text, const bool checkable = false);
00243 void insert(const Menu_Type m, KMenu* menu, const QIcon & icon, const QString & text);
00244 void insert(const Menu_Type m, KMenu* menu, const QString & text, const bool checkable = false);
00245
00246 void insertStdItems(bool insertLeadingSeparator = true,
00247 Uml::Widget_Type type = Uml::wt_UMLWidget);
00248 void insertContainerItems(bool folderAndDiagrams);
00249 void insertAssocItem(const QString &label, Menu_Type mt);
00250 void insertSubmodelAction();
00251
00252 void makeMultiClassifierPopup(ClassifierWidget *c);
00253 void makeClassifierPopup(ClassifierWidget *c);
00254 KMenu* makeCategoryTypeMenu(UMLCategory* category);
00255
00256 void insertSubMenuNew(Menu_Type type);
00257 void insertSubMenuColor(bool fc);
00258
00259 void setupDiagramMenu(UMLView* view);
00260 void setupMenu(Menu_Type type);
00261
00262 void setActionChecked(Menu_Type idx, bool value);
00263
00264 union TriggerObject {
00265 UMLView* m_View;
00266 UMLObject* m_Object;
00267 UMLWidget* m_Widget;
00268 };
00269
00270 enum TriggerObjectType {
00271 tot_View,
00272 tot_Object,
00273 tot_Widget
00274 };
00275
00276 TriggerObject m_TriggerObject;
00277 TriggerObjectType m_TriggerObjectType;
00278
00279
00280 QHash<Menu_Type, QAction*> m_actions;
00281
00282 };
00283
00284 #endif