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 
29 #include "ArmarXWidgetController.h"
30 
31 namespace 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
armarx::ArmarXComponentWidgetControllerTemplate::getWidgetIcon
QIcon getWidgetIcon() const final override
Implement this function to supply an icon for the menu.
Definition: ArmarXComponentWidgetController.h:79
armarx::ArmarXComponentWidgetControllerTemplate::getWidgetCategoryIcon
QIcon getWidgetCategoryIcon() const final override
Implement this function to supply an icon for the category.
Definition: ArmarXComponentWidgetController.h:85
armarx::ArmarXComponentWidgetControllerTemplate::getWidgetName
QString getWidgetName() const final override
Implement this function to specify the default name of your Widget.
Definition: ArmarXComponentWidgetController.h:73
armarx::ArmarXWidgetController
Definition: ArmarXWidgetController.h:52
armarx::ArmarXComponentWidgetControllerTemplate
Definition: ArmarXComponentWidgetController.h:69
armarx::ArmarXComponentWidgetController::getDefaultName
std::string getDefaultName() const override
Retrieve default name of component.
Definition: ArmarXComponentWidgetController.cpp:38
armarx::ArmarXComponentWidgetController::ArmarXComponentWidgetController
ArmarXComponentWidgetController()
Definition: ArmarXComponentWidgetController.cpp:31
armarx::ArmarXComponentWidgetController::GuiWindow
friend class GuiWindow
Definition: ArmarXComponentWidgetController.h:40
armarx::ArmarXComponentWidgetController::createInstance
static ArmarXWidgetControllerPtr createInstance()
Definition: ArmarXComponentWidgetController.h:48
Component.h
armarx::Component
Baseclass for all ArmarX ManagedIceObjects requiring properties.
Definition: Component.h:91
ArmarXWidgetController.h
IceUtil::Handle< ArmarXWidgetController >
armarx::ArmarXComponentWidgetController
Definition: ArmarXComponentWidgetController.h:38
armarx::ArmarXComponentWidgetController::onClose
bool onClose() override
If you overwrite this method, make sure to call this implementation at the end of your implementation...
Definition: ArmarXComponentWidgetController.cpp:44
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:27