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 "ArmarXWidgetController.h"
26 
28 
29 #include <QIcon>
30 
31 
32 namespace armarx
33 {
34  /**
35  \class ArmarXComponentWidgetController
36 
37  \ingroup ArmarXGuiBase
38  */
41  virtual public Component
42  {
43  friend class GuiWindow;
44 
45  public:
47  std::string getDefaultName() const override;
48 
49  template <typename Class>
51  {
52  ArmarXWidgetControllerPtr ptr = ArmarXWidgetControllerPtr::dynamicCast(Component::create<Class>());
53  return ptr;
54  }
55 
56  protected:
57  /*!
58  * \brief If you overwrite this method, make sure to call this
59  * implementation at the end of your implementation with ArmarXComponentWidgetController::onClose().
60  */
61  bool onClose() override;
62 
63  private:
64  std::string uuid;
65  };
67 
68  template<class Derived>
71  {
72  public:
73  QString getWidgetName() const final override
74  {
75  return Derived::GetWidgetName();
76  }
77  QIcon getWidgetIcon() const final override
78  {
79  return Derived::GetWidgetIcon();
80  }
81  QIcon getWidgetCategoryIcon() const final override
82  {
83  return Derived::GetWidgetCategoryIcon();
84  }
85  };
86 }
87 
armarx::ArmarXComponentWidgetControllerTemplate::getWidgetIcon
QIcon getWidgetIcon() const final override
Implement this function to supply an icon for the menu.
Definition: ArmarXComponentWidgetController.h:77
armarx::ArmarXComponentWidgetControllerTemplate::getWidgetCategoryIcon
QIcon getWidgetCategoryIcon() const final override
Implement this function to supply an icon for the category.
Definition: ArmarXComponentWidgetController.h:81
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:51
armarx::ArmarXComponentWidgetControllerTemplate
Definition: ArmarXComponentWidgetController.h:69
armarx::ArmarXComponentWidgetController::getDefaultName
std::string getDefaultName() const override
Retrieve default name of component.
Definition: ArmarXComponentWidgetController.cpp:37
armarx::ArmarXComponentWidgetController::ArmarXComponentWidgetController
ArmarXComponentWidgetController()
Definition: ArmarXComponentWidgetController.cpp:30
armarx::ArmarXComponentWidgetController::GuiWindow
friend class GuiWindow
Definition: ArmarXComponentWidgetController.h:43
armarx::ArmarXComponentWidgetController::createInstance
static ArmarXWidgetControllerPtr createInstance()
Definition: ArmarXComponentWidgetController.h:50
Component.h
armarx::Component
Baseclass for all ArmarX ManagedIceObjects requiring properties.
Definition: Component.h:95
ArmarXWidgetController.h
IceUtil::Handle< ArmarXWidgetController >
armarx::ArmarXComponentWidgetController
Definition: ArmarXComponentWidgetController.h:39
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:42
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28