MatOCAD Logo

Main Page | Class Hierarchy | Class List | Directories | File List | Class Members | File Members | Related Pages

wxResizeableControl Class Reference

Class for moveable and resizable child windows. More...

#include <resizec.h>

Inherited by TBasePanel, and wxPictureControl.

Inheritance diagram for wxResizeableControl:

Inheritance graph
[legend]
Collaboration diagram for wxResizeableControl:

Collaboration graph
[legend]
List of all members.

Public Types

enum  SizeMoveModes {
  Top = 0, Bottom, Left, Right,
  TopLeft, BottomLeft, TopRight, BottomRight,
  MoveWin, MaxMode
}
 Flags for resize mode. More...
enum  SizeRads { SizeXRad = 5, SizeYRad = 5 }
 Size box dimension. More...

Public Member Functions

 wxResizeableControl ()
 Ctor.
 wxResizeableControl (wxWindow *AParent, int AnId, const wxPoint &pos, const wxSize &size, long style=0, const wxString &name=wxPanelNameStr)
 Ctor.
virtual ~wxResizeableControl ()
 Dtor.
virtual void Paint (wxDC &WXUNUSED(dc), bool WXUNUSED(Printing), wxSize &WXUNUSED(size))
 Paint function for printing and screen output.
virtual wxSize GetOriginalSize ()
 Returns original size of control.
virtual float GetRatio ()
 Returns with/height ration.
wxZoomDataGetZoomData ()
 Returns the zoom data object.
void SetZoom (float Zoom)
 Set new zoom.
void SetCurrentZoom (float Zoom)
 Set new zoom factor, but do not resize/move.
void DrawFocusRect (wxDC &dc, wxRect rct)
 Same as FocusRectCoord but with wxRect parameter.
void DoSetSize (int x, int y, int width, int height, int sizeFlags=wxSIZE_AUTO)
 Make sure the zoom data gets updated when the window is moved.
void OnP (wxPaintEvent &event)
void OnSetCursor (wxSetCursorEvent &event)
 Responds to set cursor event.
void OnLButtonUp (wxMouseEvent &event)
 Responds to left button up event.
void OnLButtonDown (wxMouseEvent &event)
 Responds to left button down event.
void OnMouseMove (wxMouseEvent &event)
 Responds to mouse move event.
void OnKillFocus (wxFocusEvent &event)
 Kill focus event hides the size rectangles.
void OnSetFocus (wxFocusEvent &event)
 Set focus event draws size rectangles.
void OnEditCut (wxCommandEvent &ce)
 Cut event deletes the window.
void OnKeyDown (wxKeyEvent &event)
 Key down event of WXK_DELETE deletes the window.
void OnSize (wxSizeEvent &event)
 Reponds to size event.
void OnMove (wxMoveEvent &event)
 Reponds to move event.
bool Destroy ()
 Delete this window, let parent know.

Protected Member Functions

void FocusRectCoord (wxDC &DC, wxCoord x1, wxCoord y1, wxCoord w, wxCoord h)
 Function that draws a focus rectangle.
int GetSizeX (int Mode)
 Returns x size.
int GetSizeY (int Mode)
 Returns y size.
void DrawMoveRect (wxPoint hp, int Mode, float Ratio=0)
 Draw ored rectangle of current new size (redraw to remove).
wxRect NewRect (wxPoint hp, int Mode, float Ratio=0)
 Return new rectangle size, based on mouse position hp.
void DrawSizeRect (wxDC &dc)
 Draw size boxes for resize.
int PointInSizeRect (wxPoint hp)
 Determine in which size box the pouse position hp is if any.

Protected Attributes

wxZoomData m_zoomData
 Zoom data.
wxCursor m_csr
 Current cursor.
long m_curId
 Current cursor id (-1 for non-stock cursor).
int m_capt
 Flag for mouse capture.
wxPoint m_curpos
 Cached mouse cursor positions.
wxPoint m_lastcurpos
int m_movemode
 Saved move mode from left button down.
bool m_hasfocus
 Flags for focus and move state.
bool m_moved

Detailed Description

Class for moveable and resizable child windows.

This class draws resize rectangles on each side and corner when focused. Dragging these rectangles resizes the window.

This class needs to be overloaded and Paint() defined with the graphics rendering.

This would make a perfect abstract class, but the definition of wxDynamicCast() doesn't allow this.

Definition at line 90 of file resizec.h.


Member Enumeration Documentation

enum wxResizeableControl::SizeMoveModes
 

Flags for resize mode.

Enumerator:
Top 
Bottom 
Left 
Right 
TopLeft 
BottomLeft 
TopRight 
BottomRight 
MoveWin 
MaxMode 

Definition at line 94 of file resizec.h.

enum wxResizeableControl::SizeRads
 

Size box dimension.

Enumerator:
SizeXRad 
SizeYRad 

Definition at line 108 of file resizec.h.


Constructor & Destructor Documentation

wxResizeableControl::wxResizeableControl  )  [inline]
 

Ctor.

Definition at line 114 of file resizec.h.

wxResizeableControl::wxResizeableControl wxWindow *  AParent,
int  AnId,
const wxPoint &  pos,
const wxSize &  size,
long  style = 0,
const wxString &  name = wxPanelNameStr
 

Ctor.

Definition at line 93 of file resizec.cpp.

virtual wxResizeableControl::~wxResizeableControl  )  [inline, virtual]
 

Dtor.

Definition at line 120 of file resizec.h.


Member Function Documentation

bool wxResizeableControl::Destroy  ) 
 

Delete this window, let parent know.

Definition at line 432 of file resizec.cpp.

Referenced by OnEditCut().

void wxResizeableControl::DoSetSize int  x,
int  y,
int  width,
int  height,
int  sizeFlags = wxSIZE_AUTO
[inline]
 

Make sure the zoom data gets updated when the window is moved.

Definition at line 148 of file resizec.h.

References m_zoomData, wxZoomData::Move(), and wxZoomData::SetSize().

void wxResizeableControl::DrawFocusRect wxDC &  dc,
wxRect  rct
[inline]
 

Same as FocusRectCoord but with wxRect parameter.

Definition at line 143 of file resizec.h.

References FocusRectCoord().

Referenced by DrawMoveRect().

void wxResizeableControl::DrawMoveRect wxPoint  hp,
int  Mode,
float  Ratio = 0
[protected]
 

Draw ored rectangle of current new size (redraw to remove).

Definition at line 122 of file resizec.cpp.

References DrawFocusRect(), and NewRect().

Referenced by OnLButtonUp(), and OnMouseMove().

void wxResizeableControl::DrawSizeRect wxDC &  dc  )  [protected]
 

Draw size boxes for resize.

Definition at line 243 of file resizec.cpp.

References GetSizeX(), GetSizeY(), SizeXRad, and SizeYRad.

Referenced by OnKillFocus(), OnP(), wxPictureControl::OnPaint(), and OnSetFocus().

void wxResizeableControl::FocusRectCoord wxDC &  DC,
wxCoord  x1,
wxCoord  y1,
wxCoord  w,
wxCoord  h
[protected]
 

Function that draws a focus rectangle.

Definition at line 107 of file resizec.cpp.

Referenced by DrawFocusRect().

virtual wxSize wxResizeableControl::GetOriginalSize  )  [inline, virtual]
 

Returns original size of control.

Reimplemented in wxBitmapControl.

Definition at line 124 of file resizec.h.

Referenced by wxPictureControl::OnRevert().

virtual float wxResizeableControl::GetRatio  )  [inline, virtual]
 

Returns with/height ration.

Reimplemented in wxBitmapControl.

Definition at line 126 of file resizec.h.

Referenced by OnLButtonUp(), and OnMouseMove().

int wxResizeableControl::GetSizeX int  Mode  )  [protected]
 

Returns x size.

Definition at line 398 of file resizec.cpp.

References Bottom, BottomLeft, BottomRight, Left, Right, Top, TopLeft, and TopRight.

Referenced by DrawSizeRect(), and PointInSizeRect().

int wxResizeableControl::GetSizeY int  Mode  )  [protected]
 

Returns y size.

Definition at line 415 of file resizec.cpp.

References Bottom, BottomLeft, BottomRight, Left, Right, Top, TopLeft, and TopRight.

Referenced by DrawSizeRect(), and PointInSizeRect().

wxZoomData& wxResizeableControl::GetZoomData  )  [inline]
 

Returns the zoom data object.

Definition at line 131 of file resizec.h.

References m_zoomData.

wxRect wxResizeableControl::NewRect wxPoint  hp,
int  Mode,
float  Ratio = 0
[protected]
 

Return new rectangle size, based on mouse position hp.

Definition at line 147 of file resizec.cpp.

References Bottom, BottomLeft, BottomRight, Left, m_curpos, MoveWin, Right, Top, TopLeft, and TopRight.

Referenced by DrawMoveRect(), and OnLButtonUp().

void wxResizeableControl::OnEditCut wxCommandEvent &  ce  ) 
 

Cut event deletes the window.

Reimplemented in wxPictureControl.

Definition at line 522 of file resizec.cpp.

References Destroy().

void wxResizeableControl::OnKeyDown wxKeyEvent &  event  ) 
 

Key down event of WXK_DELETE deletes the window.

Reimplemented in TBasePanel.

void wxResizeableControl::OnKillFocus wxFocusEvent &  event  ) 
 

Kill focus event hides the size rectangles.

Definition at line 440 of file resizec.cpp.

References DrawSizeRect(), and m_hasfocus.

void wxResizeableControl::OnLButtonDown wxMouseEvent &  event  ) 
 

Responds to left button down event.

Definition at line 321 of file resizec.cpp.

References m_capt, m_curpos, m_hasfocus, m_lastcurpos, m_moved, m_movemode, MoveWin, and PointInSizeRect().

void wxResizeableControl::OnLButtonUp wxMouseEvent &  event  ) 
 

Responds to left button up event.

Definition at line 373 of file resizec.cpp.

References DrawMoveRect(), GetRatio(), m_capt, m_lastcurpos, m_moved, m_movemode, MoveWin, and NewRect().

void wxResizeableControl::OnMouseMove wxMouseEvent &  event  ) 
 

Responds to mouse move event.

Definition at line 349 of file resizec.cpp.

References DrawMoveRect(), GetRatio(), m_capt, m_curpos, m_lastcurpos, m_moved, m_movemode, and OnSetCursor().

void wxResizeableControl::OnMove wxMoveEvent &  event  ) 
 

Reponds to move event.

Definition at line 535 of file resizec.cpp.

References m_zoomData, and wxZoomData::Move().

void wxResizeableControl::OnP wxPaintEvent &  event  ) 
 

Definition at line 449 of file resizec.cpp.

References DrawSizeRect(), m_hasfocus, and Paint().

void wxResizeableControl::OnSetCursor wxSetCursorEvent &  event  ) 
 

Responds to set cursor event.

Definition at line 274 of file resizec.cpp.

References Bottom, BottomLeft, BottomRight, Left, m_csr, m_curId, m_hasfocus, MoveWin, PointInSizeRect(), Right, Top, TopLeft, and TopRight.

Referenced by OnMouseMove().

void wxResizeableControl::OnSetFocus wxFocusEvent &  event  ) 
 

Set focus event draws size rectangles.

Definition at line 458 of file resizec.cpp.

References DrawSizeRect(), and m_hasfocus.

void wxResizeableControl::OnSize wxSizeEvent &  event  ) 
 

Reponds to size event.

Reimplemented in PnlGraphFrame, Graph3DFrame, PnlFunzione, and wxPictureControl.

Definition at line 527 of file resizec.cpp.

References m_zoomData, and wxZoomData::SetSize().

virtual void wxResizeableControl::Paint wxDC &  WXUNUSED(dc),
bool   WXUNUSED(Printing),
wxSize &  WXUNUSED(size)
[inline, virtual]
 

Paint function for printing and screen output.

Definition at line 122 of file resizec.h.

Referenced by OnP(), and wxPictureControl::OnPaint().

int wxResizeableControl::PointInSizeRect wxPoint  hp  )  [protected]
 

Determine in which size box the pouse position hp is if any.

Definition at line 131 of file resizec.cpp.

References GetSizeX(), GetSizeY(), MoveWin, SizeXRad, and SizeYRad.

Referenced by OnLButtonDown(), and OnSetCursor().

void wxResizeableControl::SetCurrentZoom float  Zoom  )  [inline]
 

Set new zoom factor, but do not resize/move.

Definition at line 138 of file resizec.h.

References m_zoomData, and wxZoomData::SetCurrentZoom().

void wxResizeableControl::SetZoom float  Zoom  )  [inline]
 

Set new zoom.

Definition at line 133 of file resizec.h.

References m_zoomData, and wxZoomData::SetZoomSize().


Member Data Documentation

int wxResizeableControl::m_capt [protected]
 

Flag for mouse capture.

Definition at line 198 of file resizec.h.

Referenced by OnLButtonDown(), OnLButtonUp(), and OnMouseMove().

wxCursor wxResizeableControl::m_csr [protected]
 

Current cursor.

necessary for MSW fake stock cursors (e.g. wxCURSOR_SIZING) together with wxSetCursorEvent(), as the current cursor is not buffered in this case and temporary cursors are automatically unloaded from windows (provided my cursor patch that prevents cursor memory leaks will get implemented)

Definition at line 194 of file resizec.h.

Referenced by OnSetCursor().

long wxResizeableControl::m_curId [protected]
 

Current cursor id (-1 for non-stock cursor).

Definition at line 196 of file resizec.h.

Referenced by OnSetCursor().

wxPoint wxResizeableControl::m_curpos [protected]
 

Cached mouse cursor positions.

Definition at line 200 of file resizec.h.

Referenced by NewRect(), OnLButtonDown(), and OnMouseMove().

bool wxResizeableControl::m_hasfocus [protected]
 

Flags for focus and move state.

Definition at line 204 of file resizec.h.

Referenced by OnKillFocus(), OnLButtonDown(), OnP(), wxPictureControl::OnPaint(), OnSetCursor(), and OnSetFocus().

wxPoint wxResizeableControl::m_lastcurpos [protected]
 

Definition at line 200 of file resizec.h.

Referenced by OnLButtonDown(), OnLButtonUp(), and OnMouseMove().

bool wxResizeableControl::m_moved [protected]
 

Definition at line 204 of file resizec.h.

Referenced by OnLButtonDown(), OnLButtonUp(), and OnMouseMove().

int wxResizeableControl::m_movemode [protected]
 

Saved move mode from left button down.

Definition at line 202 of file resizec.h.

Referenced by OnLButtonDown(), OnLButtonUp(), and OnMouseMove().

wxZoomData wxResizeableControl::m_zoomData [protected]
 

Zoom data.

Definition at line 187 of file resizec.h.

Referenced by DoSetSize(), GetZoomData(), OnMove(), OnSize(), SetCurrentZoom(), and SetZoom().


The documentation for this class was generated from the following files:

 

SourceForge Logo