Commit bb3e070f authored by Ralf Habacker's avatar Ralf Habacker

Add class InterfaceWidget

parent b9e551ba
...@@ -401,6 +401,7 @@ set(libumlwidgets_SRCS ...@@ -401,6 +401,7 @@ set(libumlwidgets_SRCS
umlwidgets/floatingdashlinewidget.cpp umlwidgets/floatingdashlinewidget.cpp
umlwidgets/floatingtextwidget.cpp umlwidgets/floatingtextwidget.cpp
umlwidgets/forkjoinwidget.cpp umlwidgets/forkjoinwidget.cpp
umlwidgets/interfacewidget.cpp
umlwidgets/layoutgrid.cpp umlwidgets/layoutgrid.cpp
umlwidgets/linkwidget.cpp umlwidgets/linkwidget.cpp
umlwidgets/messagewidget.cpp umlwidgets/messagewidget.cpp
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#include "entitywidget.h" #include "entitywidget.h"
#include "floatingtextwidget.h" #include "floatingtextwidget.h"
#include "forkjoinwidget.h" #include "forkjoinwidget.h"
#include "interfacewidget.h"
#include "notewidget.h" #include "notewidget.h"
#include "objectwidget.h" #include "objectwidget.h"
#include "objectnodewidget.h" #include "objectnodewidget.h"
...@@ -208,7 +209,7 @@ void WidgetBasePopupMenu::insertSingleSelectionMenu(WidgetBase* widget) ...@@ -208,7 +209,7 @@ void WidgetBasePopupMenu::insertSingleSelectionMenu(WidgetBase* widget)
case WidgetBase::wt_Interface: case WidgetBase::wt_Interface:
{ {
ClassifierWidget* c = widget->asClassifierWidget(); InterfaceWidget* c = widget->asInterfaceWidget();
if (!c) if (!c)
break; break;
insertSubMenuNew(type); insertSubMenuNew(type);
......
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
#include "foreignkeyconstraint.h" #include "foreignkeyconstraint.h"
#include "forkjoinwidget.h" #include "forkjoinwidget.h"
#include "idchangelog.h" #include "idchangelog.h"
#include "interfacewidget.h"
#include "import_utils.h" #include "import_utils.h"
#include "layoutgenerator.h" #include "layoutgenerator.h"
#include "layoutgrid.h" #include "layoutgrid.h"
...@@ -3332,8 +3333,11 @@ void UMLScene::setClassWidgetOptions(ClassOptionsPage * page) ...@@ -3332,8 +3333,11 @@ void UMLScene::setClassWidgetOptions(ClassOptionsPage * page)
foreach(UMLWidget* pWidget, widgetList()) { foreach(UMLWidget* pWidget, widgetList()) {
uIgnoreZeroPointer(pWidget); uIgnoreZeroPointer(pWidget);
WidgetBase::WidgetType wt = pWidget->baseType(); WidgetBase::WidgetType wt = pWidget->baseType();
if (wt == WidgetBase::wt_Class || wt == WidgetBase::wt_Interface) { if (wt == WidgetBase::wt_Class) {
page->setWidget(static_cast<ClassifierWidget *>(pWidget)); page->setWidget(pWidget->asClassifierWidget());
page->apply();
} else if (wt == WidgetBase::wt_Interface) {
page->setWidget(pWidget->asInterfaceWidget());
page->apply(); page->apply();
} }
} }
......
/***************************************************************************
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* copyright (C) 2019 *
* Umbrello UML Modeller Authors <umbrello-devel@kde.org> *
***************************************************************************/
#include "interfacewidget.h"
InterfaceWidget::InterfaceWidget(UMLScene *scene, UMLClassifier *c)
: ClassifierWidget(scene, c)
{
}
InterfaceWidget::InterfaceWidget(UMLScene *scene, UMLPackage *p)
: ClassifierWidget(scene, p)
{
}
/***************************************************************************
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* copyright (C) 2019 *
* Umbrello UML Modeller Authors <umbrello-devel@kde.org> *
***************************************************************************/
#ifndef INTERFACEWIDGET_H
#define INTERFACEWIDGET_H
#include "classifierwidget.h"
/**
* Provides an interface widget
*
* The implementation is currently in @ref ClassifierWidget
* and should be moved to this class for easier implementation
*
* @author Ralf Habacker
*/
class InterfaceWidget : public ClassifierWidget
{
public:
InterfaceWidget(UMLScene * scene, UMLClassifier * c);
InterfaceWidget(UMLScene * scene, UMLPackage * p);
};
#endif // INTERFACEWIDGET_H
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
#include "floatingtextwidget.h" #include "floatingtextwidget.h"
#include "folder.h" #include "folder.h"
#include "forkjoinwidget.h" #include "forkjoinwidget.h"
#include "interfacewidget.h"
#include "messagewidget.h" #include "messagewidget.h"
#include "node.h" #include "node.h"
#include "nodewidget.h" #include "nodewidget.h"
...@@ -127,7 +128,7 @@ UMLWidget *createWidget(UMLScene *scene, UMLObject *o) ...@@ -127,7 +128,7 @@ UMLWidget *createWidget(UMLScene *scene, UMLObject *o)
newWidget = ow; newWidget = ow;
} else { } else {
UMLClassifier *c = o->asUMLClassifier(); UMLClassifier *c = o->asUMLClassifier();
ClassifierWidget* interfaceWidget = new ClassifierWidget(scene, c); InterfaceWidget* interfaceWidget = new InterfaceWidget(scene, c);
if (diagramType == Uml::DiagramType::Component || diagramType == Uml::DiagramType::Deployment) { if (diagramType == Uml::DiagramType::Component || diagramType == Uml::DiagramType::Deployment) {
interfaceWidget->setDrawAsCircle(true); interfaceWidget->setDrawAsCircle(true);
} }
...@@ -280,7 +281,7 @@ UMLWidget* makeWidgetFromXMI(const QString& tag, ...@@ -280,7 +281,7 @@ UMLWidget* makeWidgetFromXMI(const QString& tag,
widget = new ArtifactWidget(scene, o->asUMLArtifact()); widget = new ArtifactWidget(scene, o->asUMLArtifact());
} else if (tag == QLatin1String("interfacewidget")) { } else if (tag == QLatin1String("interfacewidget")) {
if (validateObjType(UMLObject::ot_Interface, o, id)) if (validateObjType(UMLObject::ot_Interface, o, id))
widget = new ClassifierWidget(scene, o->asUMLClassifier()); widget = new InterfaceWidget(scene, o->asUMLClassifier());
} else if (tag == QLatin1String("datatypewidget")) { } else if (tag == QLatin1String("datatypewidget")) {
if (validateObjType(UMLObject::ot_Datatype, o, id)) if (validateObjType(UMLObject::ot_Datatype, o, id))
widget = new DatatypeWidget(scene, o->asUMLClassifier()); widget = new DatatypeWidget(scene, o->asUMLClassifier());
......
...@@ -1299,7 +1299,7 @@ Icon_Utils::IconType WidgetBase::toIcon(WidgetBase::WidgetType wt) ...@@ -1299,7 +1299,7 @@ Icon_Utils::IconType WidgetBase::toIcon(WidgetBase::WidgetType wt)
#include "enumwidget.h" #include "enumwidget.h"
#include "floatingdashlinewidget.h" #include "floatingdashlinewidget.h"
#include "forkjoinwidget.h" #include "forkjoinwidget.h"
//#include "interfacewidget.h" #include "interfacewidget.h"
#include "messagewidget.h" #include "messagewidget.h"
#include "nodewidget.h" #include "nodewidget.h"
#include "notewidget.h" #include "notewidget.h"
...@@ -1328,7 +1328,7 @@ EntityWidget* WidgetBase::asEntityWidget() { return dynamic_cast<EntityWidget* > ...@@ -1328,7 +1328,7 @@ EntityWidget* WidgetBase::asEntityWidget() { return dynamic_cast<EntityWidget* >
EnumWidget* WidgetBase::asEnumWidget() { return dynamic_cast<EnumWidget* >(this); } EnumWidget* WidgetBase::asEnumWidget() { return dynamic_cast<EnumWidget* >(this); }
FloatingDashLineWidget* WidgetBase::asFloatingDashLineWidget() { return dynamic_cast<FloatingDashLineWidget*>(this); } FloatingDashLineWidget* WidgetBase::asFloatingDashLineWidget() { return dynamic_cast<FloatingDashLineWidget*>(this); }
ForkJoinWidget* WidgetBase::asForkJoinWidget() { return dynamic_cast<ForkJoinWidget* >(this); } ForkJoinWidget* WidgetBase::asForkJoinWidget() { return dynamic_cast<ForkJoinWidget* >(this); }
//InterfaceWidget* WidgetBase::asInterfaceWidget() { return dynamic_cast<InterfaceWidget* >(this); } InterfaceWidget* WidgetBase::asInterfaceWidget() { return dynamic_cast<InterfaceWidget* >(this); }
MessageWidget* WidgetBase::asMessageWidget() { return dynamic_cast<MessageWidget* >(this); } MessageWidget* WidgetBase::asMessageWidget() { return dynamic_cast<MessageWidget* >(this); }
NodeWidget* WidgetBase::asNodeWidget() { return dynamic_cast<NodeWidget* >(this); } NodeWidget* WidgetBase::asNodeWidget() { return dynamic_cast<NodeWidget* >(this); }
NoteWidget* WidgetBase::asNoteWidget() { return dynamic_cast<NoteWidget* >(this); } NoteWidget* WidgetBase::asNoteWidget() { return dynamic_cast<NoteWidget* >(this); }
......
...@@ -39,7 +39,7 @@ class EnumWidget; ...@@ -39,7 +39,7 @@ class EnumWidget;
class FloatingDashLineWidget; class FloatingDashLineWidget;
class FloatingTextWidget; class FloatingTextWidget;
class ForkJoinWidget; class ForkJoinWidget;
//class InterfaceWidget; class InterfaceWidget;
class MessageWidget; class MessageWidget;
class NodeWidget; class NodeWidget;
class NoteWidget; class NoteWidget;
...@@ -237,7 +237,7 @@ public: ...@@ -237,7 +237,7 @@ public:
EnumWidget* asEnumWidget(); EnumWidget* asEnumWidget();
FloatingDashLineWidget* asFloatingDashLineWidget(); FloatingDashLineWidget* asFloatingDashLineWidget();
ForkJoinWidget* asForkJoinWidget(); ForkJoinWidget* asForkJoinWidget();
//InterfaceWidget* asInterfaceWidget(); InterfaceWidget* asInterfaceWidget();
MessageWidget* asMessageWidget(); MessageWidget* asMessageWidget();
NodeWidget* asNodeWidget(); NodeWidget* asNodeWidget();
NoteWidget* asNoteWidget(); NoteWidget* asNoteWidget();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment