CCommandBasedSelectionControllerComp.h
Go to the documentation of this file.
1 #ifndef iqtgui_CCommandBasedSelectionControllerComp_included
2 #define iqtgui_CCommandBasedSelectionControllerComp_included
3 
4 
5 // ACF includes
7 #include <icomp/CComponentBase.h>
10 #include <iprm/ISelectionParam.h>
11 #include <iqtgui/IIconProvider.h>
13 
14 
15 namespace iqtgui
16 {
17 
18 
24  public QObject,
25  public ibase::TLocalizableWrap<icomp::CComponentBase>,
26  protected imod::TSingleModelObserverBase<iprm::ISelectionParam>,
27  virtual public ibase::ICommandsProvider
28 {
29  Q_OBJECT
30 public:
33 
34  I_BEGIN_COMPONENT(CCommandBasedSelectionControllerComp);
35  I_REGISTER_INTERFACE(ibase::ICommandsProvider);
36  I_ASSIGN(m_commandSelectionCompPtr, "CommandsSelection", "Commands selector and contstraints provider", true, "CommandsSelection");
37  I_ASSIGN_TO(m_commandSelectionModelCompPtr, m_commandSelectionCompPtr, true);
38  I_ASSIGN(m_actionIconsProviderCompPtr, "ActionIcons", "Icons for the region actions", false, "ActionIcons");
39  I_ASSIGN(m_noSelectionCommandAttrPtr, "UnselectActionName", "The name of the unselect action", false, "Deselect");
40  I_ASSIGN(m_menuNameAttrPtr, "MenuName", "Name of the menu for the action group", true, "Selection");
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_showInToolBarAttrPtr, "ShowInToolBar", "If enabled, the action will be shown in the application's tool bar", false, false);
44  I_ASSIGN(m_commandPriorityAttrPtr, "CommandPriority", "Defines the used command priority for the menu", true, 100);
45  I_END_COMPONENT;
46 
48 
49  // reimpemented (ibase::ICommandsProvider)
50  virtual const ibase::IHierarchicalCommand* GetCommands() const;
51 
52 protected:
53  // reimplemented (ibase::TLocalizableWrap)
54  virtual void OnLanguageChanged();
55 
56  // reimpemented (imod::CSingleModelObserverBase)
57  virtual void OnUpdate(const istd::IChangeable::ChangeSet& changeSet);
58 
59  // reimpemented (icomp::IComponent)
60  virtual void OnComponentCreated();
61  virtual void OnComponentDestroyed();
62 
63 private Q_SLOTS:
64  void OnCommandActivated();
65 
66 private:
67  void BuildCommands();
68 
69 protected:
70  I_REF(iprm::ISelectionParam, m_commandSelectionCompPtr);
71  I_REF(imod::IModel, m_commandSelectionModelCompPtr);
72  I_REF(iqtgui::IIconProvider, m_actionIconsProviderCompPtr);
73  I_TEXTATTR(m_noSelectionCommandAttrPtr);
74  I_TEXTATTR(m_menuNameAttrPtr);
75  I_TEXTATTR(m_menuDescriptionAttrPtr);
76  I_TEXTATTR(m_rootMenuNameAttrPtr);
77  I_ATTR(bool, m_showInToolBarAttrPtr);
78  I_ATTR(int, m_commandPriorityAttrPtr);
79 
83 };
84 
85 
86 } // namespace iqtgui
87 
88 
89 #endif // !iqtgui_CCommandBasedSelectionControllerComp_included
90 
91 
Implementation of hierarchical command based on QAction from Qt.
This interface provides acces to an icon.
Definition: IIconProvider.h:21
imod::TSingleModelObserverBase< iprm::ISelectionParam > BaseClass2
virtual void OnUpdate(const istd::IChangeable::ChangeSet &changeSet)
Called on update of observed model.
Basic implementation for a single model observer with binding to concrete data object interface...
virtual const ibase::IHierarchicalCommand * GetCommands() const
Get list of menu commands.
ibase::TLocalizableWrap< icomp::CComponentBase > BaseClass
Interface for a provider of the heriarchical commands.
Common interface to define the hierarchical graph structures.
Command-based selection parameter (iprm::ISelectionParam) controller.
Common interface for model objects, that supports Model/Observer design pattern.
Definition: IModel.h:23
Set of change flags (its IDs).
Definition: IChangeable.h:30
Interface allowing to select single option from list of options.
I_TEXTATTR(m_noSelectionCommandAttrPtr)

© 2007-2017 Witold Gantzke and Kirill Lepskiy