CDialogGuiComp.h
Go to the documentation of this file.
1 #ifndef iqtgui_CDialogGuiComp_included
2 #define iqtgui_CDialogGuiComp_included
3 
4 
5 // ACF includes
7 #include <imod/TModelWrap.h>
8 #include <iqtgui/IDialog.h>
11 
12 
13 namespace iqtgui
14 {
15 
16 
22  public QObject,
23  public icomp::CComponentBase,
24  virtual public iqtgui::IDialog
25 {
26  Q_OBJECT
27 public:
29  typedef QObject BaseClass2;
30 
31  I_BEGIN_COMPONENT(CDialogGuiComp);
32  I_REGISTER_INTERFACE(iqtgui::IDialog);
33  I_REGISTER_SUBELEMENT(Command);
34  I_REGISTER_SUBELEMENT_INTERFACE(Command, ibase::ICommandsProvider, GetCommandsProvider);
35  I_REGISTER_SUBELEMENT_INTERFACE(Command, imod::IModel, GetCommandsProvider);
36  I_REGISTER_SUBELEMENT_INTERFACE(Command, istd::IChangeable, GetCommandsProvider);
37  I_ASSIGN(m_guiCompPtr, "Gui", "UI to show in the dialog", true, "Gui");
38  I_ASSIGN(m_dialogTitleAttrPtr, "DialogTitle", "Title for the dialog", false, "DialogTitle");
39  I_ASSIGN(m_dialogIconPathAttrPtr, "DialogIconPath", "Icon path for the dialog", false, "IconPath");
40  I_ASSIGN(m_menuNameAttrPtr, "MenuName", "Name of the menu for the action group", true, "MenuName");
41  I_ASSIGN(m_menuDescriptionAttrPtr, "MenuDescription", "Description for the action group", true, "");
42  I_ASSIGN(m_rootMenuNameAttrPtr, "RootMenu", "Name of the root command", true, "");
43  I_ASSIGN(m_initialDialogSizeAttrPtr, "DialogSize", "Initial size of the dialog. The value is proportion of dialog size to desktop size", false, 0.5);
44  I_ASSIGN(m_isModalAttrPtr, "IsModal", "Modality of the dialog", true, true);
45  I_ASSIGN(m_dialogButtonsAttrPtr, "DialogButtons", "Dialog buttons. See QDialogButtonBox::StandardButton for details", true, QDialogButtonBox::Ok);
46  I_END_COMPONENT;
47 
49 
50  // reimplemented (iqtgui::IDialog)
51  virtual int ExecuteDialog(IGuiObject* parentPtr);
52 
53 protected:
54  virtual iqtgui::CGuiComponentDialog* CreateComponentDialog(int buttons, IGuiObject* parentPtr) const;
55  virtual void OnRetranslate();
56 
57  // reimplemented (icomp::CComponentBase)
58  virtual void OnComponentCreated();
59 
60  // reimplemented (QObject)
61  virtual bool eventFilter(QObject* sourcePtr, QEvent* eventPtr);
62 
63 protected Q_SLOTS:
64  void OnCommandActivated();
65 
66 private:
67  class CommandsProvider: virtual public ibase::ICommandsProvider
68  {
69  public:
70  CommandsProvider();
71 
72  void SetParent(CDialogGuiComp* parentPtr);
73 
74  // reimplemented (ibase::ICommandsProvider)
75  virtual const ibase::IHierarchicalCommand* GetCommands() const;
76 
77  private:
78  CDialogGuiComp* m_parentPtr;
79  };
80 
81 
82  template <class InterfaceType>
83  static InterfaceType* GetCommandsProvider(CDialogGuiComp& parent)
84  {
85  return &parent.m_commandsProvider;
86  }
87 
88 private:
89  I_REF(iqtgui::IGuiObject, m_guiCompPtr);
90  I_TEXTATTR(m_dialogTitleAttrPtr);
91  I_ATTR(QString, m_dialogIconPathAttrPtr);
92  I_TEXTATTR(m_menuNameAttrPtr);
93  I_TEXTATTR(m_menuDescriptionAttrPtr);
94  I_TEXTATTR(m_rootMenuNameAttrPtr);
95  I_ATTR(double, m_initialDialogSizeAttrPtr);
96  I_ATTR(bool, m_isModalAttrPtr);
97  I_ATTR(int, m_dialogButtonsAttrPtr);
98 
99  iqtgui::CHierarchicalCommand m_rootCommand;
100  iqtgui::CHierarchicalCommand m_rootMenuCommand;
101  iqtgui::CHierarchicalCommand m_dialogCommand;
102 
103  imod::TModelWrap<CommandsProvider> m_commandsProvider;
104 
105  QDialog* m_dialogPtr;
106 };
107 
108 
109 } // namespace iqtgui
110 
111 
112 #endif // !iqtgui_CDialogGuiComp_included
113 
virtual int ExecuteDialog(IGuiObject *parentPtr)
Execute dialog instance.
Implementation of hierarchical command based on QAction from Qt.
Base class for component implementation.
icomp::CComponentBase BaseClass
Interface for a provider of the heriarchical commands.
Common interface for data model objects, which can be changed.
Definition: IChangeable.h:24
Common interface to define the hierarchical graph structures.
Common interface for GUI objects using in component context.
Definition: IGuiObject.h:25
virtual bool eventFilter(QObject *sourcePtr, QEvent *eventPtr)
Class to display an ACF GUI component in a dialog.
virtual void OnRetranslate()
virtual iqtgui::CGuiComponentDialog * CreateComponentDialog(int buttons, IGuiObject *parentPtr) const
Common interface for model objects, that supports Model/Observer design pattern.
Definition: IModel.h:23
Dialog based representation of any UI-Component.
Interface for a dialog widget.
Definition: IDialog.h:17
virtual void OnComponentCreated()

© 2007-2017 Witold Gantzke and Kirill Lepskiy