wxArt2D
sttoolmes.h
Go to the documentation of this file.
1 /*! \file wx/canvas/sttoolmes.h
2  \brief stack based tools for measuring
3 
4  Tools to measure things on the view.
5 
6  \author Klaas Holwerda
7 
8  Copyright: 2001-2004 (c) Klaas Holwerda
9 
10  Licence: wxWidgets Licence
11 
12  RCS-ID: $Id: sttoolmes.h,v 1.1 2007/07/07 08:17:53 titato Exp $
13 */
14 
15 #ifndef __A2DMEASURE_H__
16 #define __A2DMEASURE_H__
17 
18 #ifndef WX_PRECOMP
19 #include "wx/wx.h"
20 #endif
21 
22 #include "wx/canvas/sttool.h"
23 
24 
25 ////@begin control identifiers
26 #define SYMBOL_A2DMEASUREDLG_STYLE wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX
27 #define SYMBOL_A2DMEASUREDLG_TITLE _("Measure")
28 #define SYMBOL_A2DMEASUREDLG_SIZE wxSize(400, 300)
29 #define SYMBOL_A2DMEASUREDLG_POSITION wxDefaultPosition
30 ////@end control identifiers
31 
32 /*!
33  * Compatibility
34  */
35 
36 #ifndef wxCLOSE_BOX
37 #define wxCLOSE_BOX 0x1000
38 #endif
39 #ifndef wxFIXED_MINSIZE
40 #define wxFIXED_MINSIZE 0
41 #endif
42 
43 /*!
44  * a2dMeasureDlg class declaration
45  */
46 
47 class a2dMeasureDlg: public wxDialog
48 {
49  DECLARE_DYNAMIC_CLASS( a2dMeasureDlg )
50  DECLARE_EVENT_TABLE()
51 
52 public:
53  /// Constructors
54  a2dMeasureDlg( );
55  ~a2dMeasureDlg( );
56  a2dMeasureDlg( a2dHabitat* habitat, wxWindow* parent, wxWindowID id = -1, const wxString& caption = SYMBOL_A2DMEASUREDLG_TITLE, const wxPoint& pos = SYMBOL_A2DMEASUREDLG_POSITION, const wxSize& size = SYMBOL_A2DMEASUREDLG_SIZE, long style = SYMBOL_A2DMEASUREDLG_STYLE );
57 
58  /// Creation
59  bool Create( wxWindow* parent, wxWindowID id = -1, const wxString& caption = SYMBOL_A2DMEASUREDLG_TITLE, const wxPoint& pos = SYMBOL_A2DMEASUREDLG_POSITION, const wxSize& size = SYMBOL_A2DMEASUREDLG_SIZE, long style = SYMBOL_A2DMEASUREDLG_STYLE );
60 
61  /// Creates the controls and sizers
62  void CreateControls();
63 
64 ////@begin a2dMeasureDlg event handler declarations
65 
66  /// wxEVT_CLOSE_WINDOW event handler for ID_DIALOG
67  void OnCloseWindow( wxCloseEvent& event );
68 
69  /// wxEVT_IDLE event handler for ID_DIALOG
70  void OnIdle( wxIdleEvent& event );
71 
72  /// wxEVT_COMMAND_TEXT_ENTER event handler for ID_X
73  void OnXEnter( wxCommandEvent& event );
74 
75  /// wxEVT_UPDATE_UI event handler for ID_X
76  void OnXUpdate( wxUpdateUIEvent& event );
77 
78  /// wxEVT_COMMAND_TEXT_ENTER event handler for ID_Y
79  void OnYEnter( wxCommandEvent& event );
80 
81  /// wxEVT_UPDATE_UI event handler for ID_Y
82  void OnYUpdate( wxUpdateUIEvent& event );
83 
84  /// wxEVT_COMMAND_LISTBOX_SELECTED event handler for ID_LISTBOX
85  void OnListboxSelected( wxCommandEvent& event );
86 
87  /// wxEVT_UPDATE_UI event handler for ID_LISTBOX
88  void OnListboxUpdate( wxUpdateUIEvent& event );
89 
90  /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_HIDE
91  void OnHideClick( wxCommandEvent& event );
92 
93  /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_CLEAR
94  void OnClearClick( wxCommandEvent& event );
95 
96  /// wxEVT_UPDATE_UI event handler for ID_SUM
97  void OnSumUpdate( wxUpdateUIEvent& event );
98 
99 ////@end a2dMeasureDlg event handler declarations
100 
101 ////@begin a2dMeasureDlg member function declarations
102 
103  /// Retrieves bitmap resources
104  wxBitmap GetBitmapResource( const wxString& name );
105 
106  /// Retrieves icon resources
107  wxIcon GetIconResource( const wxString& name );
108 ////@end a2dMeasureDlg member function declarations
109 
110  /// Should we show tooltips?
111  static bool ShowToolTips();
112 
113  void AppendMeasure( double x, double y );
114 
115  void OnComEvent( a2dComEvent& event );
116  void OnDoEvent( a2dCommandProcessorEvent& event );
117 
118 ////@begin a2dMeasureDlg member variables
119  wxTextCtrl* m_x;
120  wxTextCtrl* m_y;
121  wxListBox* m_lb;
122  wxButton* m_hide;
123  wxButton* m_clear;
124  wxTextCtrl* m_sum;
125 
126  a2dVertexList m_vertexes;
127 
128  a2dHabitat* m_habitat;
129 
130 ////@end a2dMeasureDlg member variables
131 };
132 
133 
134 //!Interactive Selection of an Object.
135 /*!Either with just one click or draging a rectangle to select many.
136 
137 \remark Left Click and/or drag.
138 \remark Shift Down to Un select.
139 
140 \sa a2dStToolContr
141 
142 */
143 class A2DCANVASDLLEXP a2dMeasureTool: public a2dDrawPolylineLTool
144 {
145 public:
146 
147  //! push this tool on the tools stack
148  /*! \ingroup commandid
149  */
151 
152  a2dMeasureTool( a2dStToolContr* controller );
153  ~a2dMeasureTool();
154 
155  bool ZoomSave() {return true;};
156 
157 protected:
158 
159  virtual void GenerateAnotation();
160 
161  //! character handling
162  void OnChar( wxKeyEvent& event );
163 
164  void OnMouseEvent( wxMouseEvent& event );
165 
166  virtual wxString GetCommandGroupName() { return _( "Measure Tool" ); }
167 
168 public:
169 
170  DECLARE_CLASS( a2dMeasureTool )
171  DECLARE_EVENT_TABLE()
172 };
173 
174 #endif /* __A2DMEASURE_H__ */
175 
176 
177 
wxIcon GetIconResource(const wxString &name)
Retrieves icon resources.
Definition: sttoolmes.cpp:189
virtual wxString GetCommandGroupName()
return the command group name for commands of a derived class
Definition: sttoolmes.h:166
a2dMeasureDlg()
Constructors.
Definition: sttoolmes.cpp:70
static bool ShowToolTips()
Should we show tooltips?
Definition: sttoolmes.cpp:171
bool Create(wxWindow *parent, wxWindowID id=-1, const wxString &caption=SYMBOL_A2DMEASUREDLG_TITLE, const wxPoint &pos=SYMBOL_A2DMEASUREDLG_POSITION, const wxSize &size=SYMBOL_A2DMEASUREDLG_SIZE, long style=SYMBOL_A2DMEASUREDLG_STYLE)
Creation.
Definition: sttoolmes.cpp:93
void OnClearClick(wxCommandEvent &event)
wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_CLEAR
Definition: sttoolmes.cpp:292
void OnSumUpdate(wxUpdateUIEvent &event)
wxEVT_UPDATE_UI event handler for ID_SUM
Definition: sttoolmes.cpp:303
vertex list of line and arc segments.
Definition: polyver.h:600
void OnCloseWindow(wxCloseEvent &event)
wxEVT_CLOSE_WINDOW event handler for ID_DIALOG
Definition: sttoolmes.cpp:313
void OnListboxSelected(wxCommandEvent &event)
wxEVT_COMMAND_LISTBOX_SELECTED event handler for ID_LISTBOX
Definition: sttoolmes.cpp:265
void OnXEnter(wxCommandEvent &event)
wxEVT_COMMAND_TEXT_ENTER event handler for ID_X
Definition: sttoolmes.cpp:197
Interactive Selection of an Object.
Definition: sttoolmes.h:143
The a2dStToolContr is a Tool Controller specialized for working with a2dCanvasView.
Definition: sttool.h:485
void OnYUpdate(wxUpdateUIEvent &event)
wxEVT_UPDATE_UI event handler for ID_Y
Definition: sttoolmes.cpp:256
static const a2dCommandId COMID_PushTool_Measure
push this tool on the tools stack
Definition: sttoolmes.h:150
void CreateControls()
Creates the controls and sizers.
Definition: sttoolmes.cpp:116
Each a2dCommand is given a command id at construction.
Definition: comevt.h:99
defines common settinsg for a habitat for a set of a2dCameleons.
Definition: canglob.h:439
void OnYEnter(wxCommandEvent &event)
wxEVT_COMMAND_TEXT_ENTER event handler for ID_Y
Definition: sttoolmes.cpp:231
void OnIdle(wxIdleEvent &event)
wxEVT_IDLE event handler for ID_DIALOG
Definition: sttoolmes.cpp:322
void OnListboxUpdate(wxUpdateUIEvent &event)
wxEVT_UPDATE_UI event handler for ID_LISTBOX
Definition: sttoolmes.cpp:274
void OnHideClick(wxCommandEvent &event)
wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_HIDE
Definition: sttoolmes.cpp:283
bool ZoomSave()
save to zoom while drawing
Definition: sttoolmes.h:155
Event sent to a2dCommandProcessor.
Definition: comevt.h:701
see a2dComEvent
Definition: gen.h:371
void OnXUpdate(wxUpdateUIEvent &event)
wxEVT_UPDATE_UI event handler for ID_X
Definition: sttoolmes.cpp:222
Interactive drawing of a polyline.
Definition: sttool.h:1806
stack based tools controller and tools for drawing and editing.
virtual void GenerateAnotation()
to display a string along with a tool drawing.
Definition: sttool.cpp:1346
wxBitmap GetBitmapResource(const wxString &name)
Retrieves bitmap resources.
Definition: sttoolmes.cpp:180
sttoolmes.h Source File -- Sun Oct 12 2014 17:04:25 -- Sun Oct 12 2014 -- 1.8.5 -- wxArt2D -- . -- Main Page Reference Documentation