ctkMenuButtonPlugin.cpp

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Library:   CTK
00004  
00005   Copyright (c) 2010  Kitware Inc.
00006 
00007   Licensed under the Apache License, Version 2.0 (the "License");
00008   you may not use this file except in compliance with the License.
00009   You may obtain a copy of the License at
00010 
00011       http://www.commontk.org/LICENSE
00012 
00013   Unless required by applicable law or agreed to in writing, software
00014   distributed under the License is distributed on an "AS IS" BASIS,
00015   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00016   See the License for the specific language governing permissions and
00017   limitations under the License.
00018  
00019 =========================================================================*/
00020 
00021 // Qt includes
00022 #include <QMenu>
00023 
00024 // CTK includes
00025 #include "ctkMenuButtonPlugin.h"
00026 #include "ctkMenuButton.h"
00027 
00028 // --------------------------------------------------------------------------
00029 ctkMenuButtonPlugin::ctkMenuButtonPlugin(QObject *_parent)
00030         : QObject(_parent)
00031 {
00032 }
00033 
00034 // --------------------------------------------------------------------------
00035 QWidget *ctkMenuButtonPlugin::createWidget(QWidget *_parent)
00036 {
00037   ctkMenuButton* _widget = new ctkMenuButton(_parent);
00038   QMenu* dummyMenu = new QMenu(_widget);
00039   dummyMenu->addAction("foo");
00040   dummyMenu->addAction("bar");
00041   dummyMenu->addAction("barbarbarbarbarbarbarbarbarbar");
00042   _widget->setMenu(dummyMenu);
00043   return _widget;
00044 }
00045 
00046 // --------------------------------------------------------------------------
00047 QString ctkMenuButtonPlugin::domXml() const
00048 {
00049   return "<widget class=\"ctkMenuButton\" name=\"CTKMenuButton\">\n"
00050          " <property name=\"text\">"
00051          "  <string>MenuButton</string>"
00052          " </property>"
00053          "</widget>\n";
00054 }
00055 
00056 // --------------------------------------------------------------------------
00057 QIcon ctkMenuButtonPlugin::icon() const
00058 {
00059   return QIcon(":/Icons/combobox.png");
00060 }
00061 
00062 // --------------------------------------------------------------------------
00063 QString ctkMenuButtonPlugin::includeFile() const
00064 {
00065   return "ctkMenuButton.h";
00066 }
00067 
00068 // --------------------------------------------------------------------------
00069 bool ctkMenuButtonPlugin::isContainer() const
00070 {
00071   return false;
00072 }
00073 
00074 // --------------------------------------------------------------------------
00075 QString ctkMenuButtonPlugin::name() const
00076 {
00077   return "ctkMenuButton";
00078 }
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines