Prechádzať zdrojové kódy

ENH: Added designer plugin corresponding to ctkMatrixWidget

Note that an icon should be added
Jean-Christophe Fillion-Robin 15 rokov pred
rodič
commit
bd5dd3fdb6

+ 3 - 0
Libs/Widgets/Plugins/CMakeLists.txt

@@ -33,6 +33,8 @@ SET(PLUGIN_SRCS
   ctkExtensionFactory.h
   ctkFittedTextBrowserPlugin.cpp
   ctkFittedTextBrowserPlugin.h
+  ctkMatrixWidgetPlugin.cpp
+  ctkMatrixWidgetPlugin.h
   ctkMenuButtonPlugin.cpp
   ctkMenuButtonPlugin.h
   ctkRangeSliderPlugin.cpp
@@ -61,6 +63,7 @@ SET(PLUGIN_MOC_SRCS
   ctkDynamicSpacerPlugin.h
   ctkExtensionFactory.h
   ctkFittedTextBrowserPlugin.h
+  ctkMatrixWidgetPlugin.h
   ctkMenuButtonPlugin.h
   ctkRangeSliderPlugin.h
   ctkRangeWidgetPlugin.h

+ 69 - 0
Libs/Widgets/Plugins/ctkMatrixWidgetPlugin.cpp

@@ -0,0 +1,69 @@
+/*=========================================================================
+
+  Library:   CTK
+ 
+  Copyright (c) 2010  Kitware Inc.
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+      http://www.commontk.org/LICENSE
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+ 
+=========================================================================*/
+
+// CTK includes
+#include "ctkMatrixWidgetPlugin.h"
+#include "ctkMatrixWidget.h"
+
+//-----------------------------------------------------------------------------
+ctkMatrixWidgetPlugin::ctkMatrixWidgetPlugin(QObject *_parent)
+        : QObject(_parent)
+{
+
+}
+
+//-----------------------------------------------------------------------------
+QWidget *ctkMatrixWidgetPlugin::createWidget(QWidget *_parent)
+{
+  ctkMatrixWidget* _widget = new ctkMatrixWidget(_parent);
+  return _widget;
+}
+
+//-----------------------------------------------------------------------------
+QString ctkMatrixWidgetPlugin::domXml() const
+{
+  return "<widget class=\"ctkMatrixWidget\" \
+          name=\"CTKMatrixWidget\">\n"
+          "</widget>\n";
+}
+
+// --------------------------------------------------------------------------
+// QIcon ctkMatrixWidgetPlugin::icon() const
+// {
+//   return QIcon(":/Icons/matrix.png");
+// }
+
+//-----------------------------------------------------------------------------
+QString ctkMatrixWidgetPlugin::includeFile() const
+{
+  return "ctkMatrixWidget.h";
+}
+
+//-----------------------------------------------------------------------------
+bool ctkMatrixWidgetPlugin::isContainer() const
+{
+  return false;
+}
+
+//-----------------------------------------------------------------------------
+QString ctkMatrixWidgetPlugin::name() const
+{
+  return "ctkMatrixWidget";
+}

+ 45 - 0
Libs/Widgets/Plugins/ctkMatrixWidgetPlugin.h

@@ -0,0 +1,45 @@
+/*=========================================================================
+
+  Library:   CTK
+ 
+  Copyright (c) 2010  Kitware Inc.
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+      http://www.commontk.org/LICENSE
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+ 
+=========================================================================*/
+
+#ifndef __ctkMatrixWidgetPlugin_h
+#define __ctkMatrixWidgetPlugin_h
+
+// CTK includes
+#include "ctkWidgetsAbstractPlugin.h"
+
+class CTK_WIDGETS_PLUGINS_EXPORT ctkMatrixWidgetPlugin :
+  public QObject,
+  public ctkWidgetsAbstractPlugin
+{
+  Q_OBJECT
+
+public:
+  ctkMatrixWidgetPlugin(QObject *_parent = 0);
+
+  QWidget *createWidget(QWidget *_parent);
+  QString  domXml() const;
+//   QIcon    icon() const;
+  QString  includeFile() const;
+  bool     isContainer() const;
+  QString  name() const;
+
+};
+
+#endif

+ 2 - 0
Libs/Widgets/Plugins/ctkWidgetsPlugins.h

@@ -35,6 +35,7 @@
 #include "ctkDoubleSliderPlugin.h"
 #include "ctkDynamicSpacerPlugin.h"
 #include "ctkFittedTextBrowserPlugin.h"
+#include "ctkMatrixWidgetPlugin.h"
 #include "ctkMenuButtonPlugin.h"
 #include "ctkRangeSliderPlugin.h"
 #include "ctkRangeWidgetPlugin.h"
@@ -62,6 +63,7 @@ public:
             << new ctkDoubleSliderPlugin
             << new ctkDynamicSpacerPlugin
             << new ctkFittedTextBrowserPlugin
+            << new ctkMatrixWidgetPlugin
             << new ctkMenuButtonPlugin
             << new ctkRangeSliderPlugin
             << new ctkRangeWidgetPlugin