ArmarXComponentWidgetController.h
Go to the documentation of this file.
1/*
2* This file is part of ArmarX.
3*
4* ArmarX is free software; you can redistribute it and/or modify
5* it under the terms of the GNU General Public License version 2 as
6* published by the Free Software Foundation.
7*
8* ArmarX is distributed in the hope that it will be useful, but
9* WITHOUT ANY WARRANTY; without even the implied warranty of
10* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11* GNU General Public License for more details.
12*
13* You should have received a copy of the GNU General Public License
14* along with this program. If not, see <http://www.gnu.org/licenses/>.
15*
16* @package ArmarX::
17* @author Mirko Waechter ( mirko.waechter at kit dot edu)
18* @date 2012
19* @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20* GNU General Public License
21*/
22
23#pragma once
24
25#include <QIcon>
26
28
30
31namespace armarx
32{
33 /**
34 \class ArmarXComponentWidgetController
35
36 \ingroup ArmarXGuiBase
37 */
39 {
40 friend class GuiWindow;
41
42 public:
44 std::string getDefaultName() const override;
45
46 template <typename Class>
49 {
51 ArmarXWidgetControllerPtr::dynamicCast(Component::create<Class>());
52 return ptr;
53 }
54
55 protected:
56 /*!
57 * \brief If you overwrite this method, make sure to call this
58 * implementation at the end of your implementation with ArmarXComponentWidgetController::onClose().
59 */
60 bool onClose() override;
61
62 private:
63 std::string uuid;
64 };
65
67
68 template <class Derived>
70 {
71 public:
72 QString
73 getWidgetName() const final override
74 {
75 return Derived::GetWidgetName();
76 }
77
78 QIcon
79 getWidgetIcon() const final override
80 {
81 return Derived::GetWidgetIcon();
82 }
83
84 QIcon
85 getWidgetCategoryIcon() const final override
86 {
87 return Derived::GetWidgetCategoryIcon();
88 }
89 };
90} // namespace armarx
QString getWidgetName() const final override
Implement this function to specify the default name of your Widget.
QIcon getWidgetIcon() const final override
Implement this function to supply an icon for the menu.
QIcon getWidgetCategoryIcon() const final override
Implement this function to supply an icon for the category.
bool onClose() override
If you overwrite this method, make sure to call this implementation at the end of your implementation...
std::string getDefaultName() const override
Retrieve default name of component.
Component()
Protected default constructor. Used for virtual inheritance. Use createManagedIceObject() instead.
Definition Component.cpp:66
static TPtr create(Ice::PropertiesPtr properties=Ice::createProperties(), const std::string &configName="", const std::string &configDomain="ArmarX")
Factory method for a component.
Definition Component.h:116
This file offers overloads of toIce() and fromIce() functions for STL container types.
IceUtil::Handle< ArmarXComponentWidgetController > ArmarXComponentWidgetControllerPtr
IceUtil::Handle< ArmarXWidgetController > ArmarXWidgetControllerPtr