7 #ifndef CAFU_CHILDFRAME_VIEW_WIN_2D_HPP_INCLUDED
8 #define CAFU_CHILDFRAME_VIEW_WIN_2D_HPP_INCLUDED
10 #include "ChildFrameViewWin.hpp"
12 #include "../AxesInfo.hpp"
14 #include "Math3D/Vector3.hpp"
15 #include "Templates/Array.hpp"
48 const wxPoint&
GetRefPt()
const {
return m_RefPtWin; }
84 void SetZoom(
float NewZoom);
85 float GetZoom()
const {
return m_ZoomFactor; }
95 wxPoint
GetScrollPosXY()
const {
return wxPoint(GetScrollPos (wxHORIZONTAL), GetScrollPos (wxVERTICAL)); }
96 wxPoint
GetScrollRangeXY()
const {
return wxPoint(GetScrollRange(wxHORIZONTAL), GetScrollRange(wxVERTICAL)); }
97 wxPoint
GetClientCenter()
const {
const wxSize Size=GetClientSize();
return wxPoint(Size.x/2, Size.y/2); }
113 static bool RectIsIntersected(
const wxRect& Rect,
const wxPoint& A,
const wxPoint& B);
118 enum RightMBStateT { RMB_UP_IDLE, RMB_DOWN_UNDECIDED, RMB_DOWN_DRAGGING };
123 ViewTypeT m_ViewType;
125 wxBitmap m_BitmapMapOnly;
126 wxBitmap m_BitmapMapAndTools;
128 MouseGrabT m_MouseGrab;
129 RightMBStateT m_RightMBState;
130 wxPoint m_RDownPosWin;
133 void SetViewType(ViewTypeT NewViewType);
134 void ScrollWindow(
int AmountX,
int AmountY,
const wxRect* Rect=NULL);
135 void UpdateScrollbars();
136 int GetBestGridSpacing()
const;
138 void Render(
const wxRect& UpdateRect);
139 enum LayerT { TOOL_LAYER, MAP_AND_TOOL_LAYER };
140 void DoPaint(LayerT Layer, wxDC& dc, wxRegion* UpdateRegion=NULL);
143 void OnKeyDown (wxKeyEvent& KE);
144 void OnKeyUp (wxKeyEvent& KE);
145 void OnKeyChar (wxKeyEvent& KE);
146 void OnMouseLeftDown (wxMouseEvent& ME);
147 void OnMouseLeftUp (wxMouseEvent& ME);
148 void OnMouseMiddleDown (wxMouseEvent& ME);
149 void OnMouseMiddleUp (wxMouseEvent& ME);
150 void OnMouseRightDown (wxMouseEvent& ME);
151 void OnMouseRightUp (wxMouseEvent& ME);
152 void OnMouseWheel (wxMouseEvent& ME);
153 void OnMouseMove (wxMouseEvent& ME);
154 void OnScroll (wxScrollWinEvent& SE);
155 void OnContextMenu (wxContextMenuEvent& CE);
156 void OnPaint (wxPaintEvent& PE);
157 void OnSize (wxSizeEvent& SE);
158 void OnKillFocus (wxFocusEvent& FE);
159 void OnMouseCaptureLost(wxMouseCaptureLostEvent& ME);
161 DECLARE_EVENT_TABLE()
MapElemModDetailE
Definition: ObserverPattern.hpp:37
wxPoint WorldToTool(const Vector3fT &v) const
Transforms vector v from world to tool coordinates/space. This is the inverse of ToolToWorld().
Definition: ChildFrameViewWin2D.cpp:402
ViewTypeT GetViewType() const
Returns the view type of this view window.
Definition: ChildFrameViewWin2D.hpp:80
AxesInfoT GetAxesInfo() const
This method returns the axes info for this window. In the case of a 3D window, it computes the 2D axe...
Definition: ChildFrameViewWin2D.hpp:81
void NotifySubjectChanged_Modified(SubjectT *Subject, const ArrayT< MapElementT * > &MapElements, MapElemModDetailE Detail)
Definition: ChildFrameViewWin2D.cpp:195
wxPoint GetScrollPosXY() const
Conveniently return the positions of both scroll bars in a wxPoint.
Definition: ChildFrameViewWin2D.hpp:95
wxWindow * GetWindow()
This function is not const because we can mutate this(!) object via the returned pointer.
Definition: ChildFrameViewWin2D.cpp:284
This class defines if the associated view is currently being grabbed (for scrolling) with the mouse...
Definition: ChildFrameViewWin2D.hpp:30
void Notify_VarChanged(SubjectT *Subject, const cf::TypeSys::VarBaseT &Var)
Notifies the observer that a variable has changed.
Definition: ChildFrameViewWin2D.cpp:259
void NotifySubjectChanged_Deleted(SubjectT *Subject, const ArrayT< IntrusivePtrT< cf::GameSys::EntityT > > &Entities)
Notifies the observer that one or more entities have been deleted.
Definition: ChildFrameViewWin2D.cpp:183
EntityModDetailE
Definition: ObserverPattern.hpp:47
This class represents a child frame.
Definition: ChildFrame.hpp:55
wxPoint WindowToTool(const wxPoint &p) const
Transforms point p from window to tool coordinates/space. This is the inverse of ToolToWindow().
Definition: ChildFrameViewWin2D.cpp:373
void Deactivate()
Deactivates the mouse control.
Definition: ChildFrameViewWin2D.cpp:64
void NotifySubjectChanged_Selection(SubjectT *Subject, const ArrayT< MapElementT * > &OldSelection, const ArrayT< MapElementT * > &NewSelection)
Notifies the observer that the selection in the current subject has been changed. ...
Definition: ChildFrameViewWin2D.cpp:136
void Activate(const wxPoint &RefPt)
Activates mouse grabbing at the given reference point, or updates the reference point when mouse grab...
Definition: ChildFrameViewWin2D.cpp:48
wxPoint GetClientCenter() const
Returns the center point of the client area of this window.
Definition: ChildFrameViewWin2D.hpp:97
const wxPoint & GetRefPt() const
Returns the position of the reference point in window coordinates.
Definition: ChildFrameViewWin2D.hpp:48
ArrayT< MapElementT * > GetElementsAt(const wxPoint &Pixel, int Radius=3) const
This method returns all visible map elements at the given pixel in the 2D view window.
Definition: ChildFrameViewWin2D.cpp:352
bool IsActive() const
Returns whether the mouse control is active.
Definition: ChildFrameViewWin2D.hpp:45
void NotifySubjectChanged_Created(SubjectT *Subject, const ArrayT< IntrusivePtrT< cf::GameSys::EntityT > > &Entities)
Notifies the observer that one or more entities have been created.
Definition: ChildFrameViewWin2D.cpp:156
Vector3fT ToolToWorld(const wxPoint &p, float Third) const
Transforms point p from tool to world coordinates/space. This is the inverse of WorldToTool(). The value for the third axis of the returned vector is set to Third.
Definition: ChildFrameViewWin2D.cpp:387
This class represents a (superclass of a) 2D or 3D map view window.
Definition: ChildFrameViewWin.hpp:21
Definition: ObserverPattern.hpp:158
static bool RectIsIntersected(const wxRect &Rect, const wxPoint &A, const wxPoint &B)
Determines whether the given rectangle Rect is intersected by the line segment through points A and B...
Definition: ChildFrameViewWin2D.cpp:426
This class describes how the three world-space axes are mapped to the two screen- or window-space axe...
Definition: AxesInfo.hpp:15
void NotifySubjectChanged(SubjectT *Subject, MapDocOtherDetailT OtherDetail)
Notifies the observer that some other detail than those specifically addressed below has changed...
Definition: ChildFrameViewWin2D.cpp:130
This is the common base class for the VarT classes.
Definition: Variables.hpp:113
wxPoint GetScrollRangeXY() const
Conveniently return the ranges of both scroll bars in a wxPoint.
Definition: ChildFrameViewWin2D.hpp:96
wxPoint WorldToWindow(const Vector3fT &v) const
Transforms vector v from world to window coordinates/space. This is the inverse of WindowToWorld()...
Definition: ChildFrameViewWin2D.cpp:420
Definition: ChildFrameViewWin2D.hpp:24
Vector3fT WindowToWorld(const wxPoint &p, float Third) const
Transforms point p from window to world coordinates/space. This is the inverse of WorldToWindow()...
Definition: ChildFrameViewWin2D.cpp:414
void Notify_EntChanged(SubjectT *Subject, const ArrayT< IntrusivePtrT< MapEditor::CompMapEntityT > > &Entities, EntityModDetailE Detail)
Definition: ChildFrameViewWin2D.cpp:234
ViewWindow2DT(wxWindow *Parent, ChildFrameT *ChildFrame, ViewTypeT InitialViewType)
The constructor.
This is the base class for all elements ("objects") that can exist in a map.
Definition: MapElement.hpp:57
wxPoint ToolToWindow(const wxPoint &p) const
Transforms point p from tool to window coordinates/space. This is the inverse of WindowToTool().
Definition: ChildFrameViewWin2D.cpp:380