CConsoleGui.h
Go to the documentation of this file.
1 #ifndef iview_CConsoleGui_included
2 #define iview_CConsoleGui_included
3 
4 
5 // ACF includes
8 #include <iview/CConsoleBase.h>
9 #include <iview/CViewport.h>
10 #include <iview/IShapeStatusInfo.h>
11 
12 
13 // Forward declarations
14 class QVBoxLayout;
15 class QGridLayout;
16 class QHBoxLayout;
17 class QScrollBar;
18 class QStatusBar;
19 class QLabel;
20 
21 
22 namespace iview
23 {
24 
25 
27  public iview::CConsoleBase,
29 {
30  Q_OBJECT
31  Q_ENUMS(FitMode)
32 
33  Q_PROPERTY(bool ZoomToFit READ IsZoomToFit WRITE SetZoomToFit)
34  Q_PROPERTY(bool GridVisible READ IsGridVisible WRITE SetGridVisible)
35  Q_PROPERTY(bool RulerVisible READ IsRulerVisible WRITE SetRulerVisible)
36  Q_PROPERTY(bool GridInMm READ IsGridInMm WRITE SetGridInMm)
40  Q_PROPERTY(bool ZoomButtonsVisible READ AreZoomsVisible WRITE SetZoomsVisible)
48  Q_PROPERTY(FitMode FitMode READ GetFitMode WRITE SetFitMode)
49 
50 public:
51  typedef iview::CConsoleBase BaseClass;
52 
54  {
60  };
61 
62  explicit CConsoleGui(QWidget* parent = NULL);
63 
67  void SetShapeStatusInfo(IShapeStatusInfo* shapeStatusInfoPtr);
68 
69  bool IsFullScreenMode() const;
70  void SetFullScreenMode(bool isFullScreen);
71 
72  void RetranslateGui();
73 
74  // reimplemented (iview::CConsoleBase)
75  virtual const CViewport& GetView() const;
76  virtual CViewport& GetViewRef();
77  virtual void UpdateCursorInfo(const QString& infoText);
78 
79  // reimplemented (ibase::ICommandsProvider)
80  virtual const ibase::IHierarchicalCommand* GetCommands() const;
81 
82 public Q_SLOTS:
83  void OnZoomIn();
84  void OnZoomOut();
85  void OnZoomReset();
86  void OnZoomToFit(bool state);
87  void OnFitContentsToView();
88  void OnPointsNone();
89  void OnPoinsMove();
90  void OnPointsAdd();
91  void OnPointsSub();
92  void OnShowScrollbars(bool state);
93  void OnShowGrid(bool state);
94  void OnShowRuler(bool state);
95  void OnShowGridInMm(bool state);
96  void OnHScrollbarChanged(int newPos);
97  void OnVScrollbarChanged(int newPos);
98  void UpdateView();
99 
100 Q_SIGNALS:
101  bool selectionChanged(const iview::IShapeView& view, const istd::CIndex2d& position, const iview::IInteractiveShape& shape, bool state);
102  bool mouseClicked(const iview::IShapeView& view, const istd::CIndex2d& position, Qt::MouseButton buttonType, bool state, const iview::IInteractiveShape* shapePtr);
103 
104 protected:
105  void UpdateZoomInOutState();
106  void UpdateScrollbarsValues();
107 
108  // events
109  virtual bool OnWheelEvent(QWheelEvent* eventPtr);
110  virtual bool OnMouseDoubleClickEvent(QEvent* eventPtr);
111  virtual bool OnKeyPressEvent(QKeyEvent* eventPtr);
112 
113  // reimplemented (iview::CConsoleBase)
114  virtual void UpdateEditModeButtons();
115  virtual void UpdateButtonsState();
116  virtual void UpdateComponentsPosition();
117  virtual void UpdateCommands();
118  virtual bool OnSelectChange(const iview::IShapeView& view, const istd::CIndex2d& position, const iview::IInteractiveShape& shape, bool state);
119  virtual bool OnViewMouseButton(const iview::IShapeView& view, const istd::CIndex2d& position, Qt::MouseButton buttonType, bool state, const iview::IInteractiveShape* shapePtr);
120  virtual void OnBoundingBoxChanged();
121 
122  // reimplemented (QObject)
123  virtual bool eventFilter(QObject* sourcePtr, QEvent* eventPtr);
124 
126 
127 private:
128  bool ConnectSignalSlots();
129 
130  QVBoxLayout* m_mainLayoutPtr;
131  QGridLayout* m_centerLayoutPtr;
132 
133  QScrollBar* m_verticalScrollbarPtr;
134  QScrollBar* m_horizontalScrollbarPtr;
135 
136  // commands
137  iqtgui::CHierarchicalCommand m_rootCommands;
138  iqtgui::CHierarchicalCommand m_commands;
139 
140  iqtgui::CHierarchicalCommand m_gridVisibleCommand;
141  iqtgui::CHierarchicalCommand m_rulerVisibleCommand;
142  iqtgui::CHierarchicalCommand m_gridInMmVisibleCommand;
143  iqtgui::CHierarchicalCommand m_scrollVisibleCommand;
144 
145  iqtgui::CHierarchicalCommand m_zoomInCommand;
146  iqtgui::CHierarchicalCommand m_zoomOutCommand;
147  iqtgui::CHierarchicalCommand m_zoomResetCommand;
148  iqtgui::CHierarchicalCommand m_zoomToFitCommand;
149 
150  iqtgui::CHierarchicalCommand m_pointsSelectCommand;
151  iqtgui::CHierarchicalCommand m_pointsMoveCommand;
152  iqtgui::CHierarchicalCommand m_pointsAddCommand;
153  iqtgui::CHierarchicalCommand m_pointsSubCommand;
154 
155  IShapeStatusInfo* m_shapeStatusInfoPtr;
156 
157  bool m_isFullScreenMode;
158  bool m_isViewMaximized;
159  QWidget* m_viewWidget;
160  iview::CScreenTransform m_savedTransform;
161 };
162 
163 
164 // inline methods
165 
166 // view access
167 
168 inline const CViewport& CConsoleGui::GetView() const
169 {
170  Q_ASSERT(m_viewPtr != NULL);
171 
172  return *m_viewPtr;
173 }
174 
175 
177 {
178  Q_ASSERT(m_viewPtr != NULL);
179 
180  return *m_viewPtr;
181 }
182 
183 
184 } // namespace iview
185 
186 
187 #endif // !iview_CConsoleGui_included
188 
189 
190 
void SetRulerButtonVisible(bool state=true)
Implementation of hierarchical command based on QAction from Qt.
bool IsScrollbarsButtonVisible() const
bool IsMmButtonVisible() const
bool ZoomToFitButtonsVisible
Definition: CConsoleGui.h:41
void UpdateZoomInOutState()
bool IsGridInMm() const
bool ScrollbarsButtonVisible
Definition: CConsoleGui.h:44
bool IsButtonsPanelVisible() const
virtual bool OnViewMouseButton(const iview::IShapeView &view, const istd::CIndex2d &position, Qt::MouseButton buttonType, bool state, const iview::IInteractiveShape *shapePtr)
void SetGridButtonVisible(bool state=true)
virtual void UpdateComponentsPosition()
Recalculates position of all components.
void SetButtonsPanelVertical(bool state=true)
bool mouseClicked(const iview::IShapeView &view, const istd::CIndex2d &position, Qt::MouseButton buttonType, bool state, const iview::IInteractiveShape *shapePtr)
bool IsRulerButtonVisible() const
virtual bool OnWheelEvent(QWheelEvent *eventPtr)
bool ArePolylineButtonsVisible() const
virtual bool eventFilter(QObject *sourcePtr, QEvent *eventPtr)
virtual bool OnKeyPressEvent(QKeyEvent *eventPtr)
CConsoleGui(QWidget *parent=NULL)
bool IsZoomToFit() const
Index implementation for addressing elements in 2D-space.
Definition: CIndex2d.h:20
Common interface for a general shape view implementations.
Definition: IShapeView.h:24
bool IsButtonsPanelVertical() const
virtual const ibase::IHierarchicalCommand * GetCommands() const
Get list of menu commands.
bool AreUserModeButtonsVisible() const
bool UserModeButtonsVisible
Definition: CConsoleGui.h:43
void OnVScrollbarChanged(int newPos)
bool selectionChanged(const iview::IShapeView &view, const istd::CIndex2d &position, const iview::IInteractiveShape &shape, bool state)
virtual void UpdateCursorInfo(const QString &infoText)
virtual const CViewport & GetView() const
Get access to internal view implementation.
Definition: CConsoleGui.h:168
void OnFitContentsToView()
void SetShapeStatusInfo(IShapeStatusInfo *shapeStatusInfoPtr)
Set status info object for the console shapes.
Common interface for all display console shapes which can interacts with user.
Interface for a provider of the heriarchical commands.
virtual void UpdateButtonsState()
Recalculates enabling flags for buttons.
void OnShowGridInMm(bool state)
virtual bool OnMouseDoubleClickEvent(QEvent *eventPtr)
void SetFitMode(FitMode mode)
void SetZoomToFit(bool state=true)
void OnZoomToFit(bool state)
virtual void UpdateEditModeButtons()
Update state of edit mode buttons.
void SetRulerVisible(bool state=true)
bool IsRulerVisible() const
virtual bool OnSelectChange(const iview::IShapeView &view, const istd::CIndex2d &position, const iview::IInteractiveShape &shape, bool state)
void SetScrollbarsVisible(bool state=true)
bool AreScrollbarsVisible() const
void OnHScrollbarChanged(int newPos)
bool AreZoomsVisible() const
iview::CViewport * m_viewPtr
Definition: CConsoleGui.h:125
Common interface to define the hierarchical graph structures.
FitMode GetFitMode() const
FitMode
Control fitting mode, to fit area of interest (AOI) to display.
Definition: CConsoleBase.h:34
#define NULL
Definition: istd.h:64
bool PolylineButtonsVisible
Definition: CConsoleGui.h:42
void OnShowRuler(bool state)
bool IsGridButtonVisible() const
void OnShowGrid(bool state)
void OnShowScrollbars(bool state)
virtual void OnBoundingBoxChanged()
void SetGridInMm(bool state=true)
void SetZoomToFitVisible(bool state=true)
void SetZoomsVisible(bool state=true)
Interface for access local bitmap information.
void SetUserModeButtonsVisible(bool state=true)
bool IsFullScreenMode() const
virtual CViewport & GetViewRef()
Get access to internal view implementation.
Definition: CConsoleGui.h:176
void SetPolylineButtonsVisible(bool state=true)
void SetGridVisible(bool state=true)
bool IsGridVisible() const
void SetScrollbarsButtonVisible(bool state=true)
void SetMmButtonVisible(bool state=true)
void SetFullScreenMode(bool isFullScreen)
virtual void UpdateCommands()
Recalculate menu commands.
void UpdateScrollbarsValues()
void SetButtonsPanelVisible(bool state=true)
bool IsZoomToFitVisible() const

© 2007-2017 Witold Gantzke and Kirill Lepskiy