wxShapeFramework  1.13.0 beta
wxSFBitmapShape Class Reference

Class encapsulating the bitmap shape. The shape can display and control files stored in formats supported by wxBitmap class loaded from a file or created from XPM image. More...

#include <BitmapShape.h>

Inheritance diagram for wxSFBitmapShape:
Collaboration diagram for wxSFBitmapShape:

List of all members.

Public Member Functions

 XS_DECLARE_CLONABLE_CLASS (wxSFBitmapShape)
 wxSFBitmapShape (void)
 Default constructor.
 wxSFBitmapShape (const wxRealPoint &pos, const wxString &bitmapPath, wxSFDiagramManager *manager)
 User contructor.
 wxSFBitmapShape (const wxSFBitmapShape &obj)
 Copy constructor.
virtual ~wxSFBitmapShape (void)
 Destructor.
wxString GetBitmapPath ()
 Get full name of a source BMP file.
void EnableScale (bool canscale)
 Enable/disable scaling mode of the bitmap.
bool CanScale ()
 Get information about the possibility of the shape scaling.
bool CreateFromFile (const wxString &file, wxBitmapType type=wxBITMAP_TYPE_BMP)
 Load a bitmap from the file.
bool CreateFromXPM (const char *const *bits)
 Load a bitmap from the XPM structure.
virtual void Scale (double x, double y, bool children=sfWITHCHILDREN)
 Scale the bitmap shape in both directions. The function can be overrided if neccessary.
virtual void OnBeginHandle (wxSFShapeHandle &handle)
 Event handler called when the user started to drag the shape handle. The function can be overrided if neccessary.
virtual void OnHandle (wxSFShapeHandle &handle)
 Event handler called during dragging of the shape handle. The function can be overrided if neccessary.
virtual void OnEndHandle (wxSFShapeHandle &handle)
 Event handler called when the user finished dragging of the shape handle. The function can be overrided if neccessary.

Protected Member Functions

void RescaleImage (const wxRealPoint &size)
 Rescale the bitmap shape so it will fit the given extent. The shape position is not involved (the left-top bitmap corner is not moved).
virtual void DrawNormal (wxDC &dc)
 Draw the shape in the normal way. The function can be overrided if neccessary.
virtual void DrawHover (wxDC &dc)
 Draw the shape in the hower mode (the mouse cursor is above the shape). The function can be overrided if neccessary.
virtual void DrawHighlighted (wxDC &dc)
 Draw the shape in the highlighted mode (another shape is dragged over this shape and this shape will accept the dragged one if it will be dropped on it). The function can be overrided if neccessary.
virtual wxXmlNode * Serialize (wxXmlNode *node)
 Serialize shape's properties to the given XML node.
virtual void Deserialize (wxXmlNode *node)
 Deserialize shape's properties from the given XML node.

Protected Attributes

wxString m_sBitmapPath
 String containing the full bitmap file name.
wxBitmap m_Bitmap
 Currently processed (modified) bitmap.
wxBitmap m_OriginalBitmap
 Original archived bitmap.
bool m_fCanScale
bool m_fRescaleInProgress
wxRealPoint m_nPrevPos

Private Member Functions

void MarkSerializableDataMembers ()
 Initialize serializable properties.

Detailed Description

Class encapsulating the bitmap shape. The shape can display and control files stored in formats supported by wxBitmap class loaded from a file or created from XPM image.


Constructor & Destructor Documentation

Default constructor.

wxSFBitmapShape::wxSFBitmapShape ( const wxRealPoint &  pos,
const wxString &  bitmapPath,
wxSFDiagramManager manager 
)

User contructor.

Parameters:
posInitial position
bitmapPathBMP file name
managerPointer of parent manager

Copy constructor.

Parameters:
objSource shape
virtual wxSFBitmapShape::~wxSFBitmapShape ( void  ) [virtual]

Destructor.


Member Function Documentation

bool wxSFBitmapShape::CanScale ( ) [inline]

Get information about the possibility of the shape scaling.

Returns:
TRUE if the shape can be scaled, otherwise FALSE
bool wxSFBitmapShape::CreateFromFile ( const wxString &  file,
wxBitmapType  type = wxBITMAP_TYPE_BMP 
)

Load a bitmap from the file.

Parameters:
fileFile name (absolute or relative)
typeBitmap type (see the wxBitmap class reference)
Returns:
TRUE on success, otherwise FALSE
bool wxSFBitmapShape::CreateFromXPM ( const char *const *  bits)

Load a bitmap from the XPM structure.

Parameters:
bitsBuffer with the image bits
Returns:
TRUE on success, otherwise FALSE
virtual void wxSFBitmapShape::Deserialize ( wxXmlNode *  node) [protected, virtual]

Deserialize shape's properties from the given XML node.

Parameters:
nodeSource XML node containig the shape's property nodes
See also:
wxSFShapeBase::Deserialize

Reimplemented from wxSFShapeBase.

virtual void wxSFBitmapShape::DrawHighlighted ( wxDC &  dc) [protected, virtual]

Draw the shape in the highlighted mode (another shape is dragged over this shape and this shape will accept the dragged one if it will be dropped on it). The function can be overrided if neccessary.

Parameters:
dcReference to device context where the shape will be drawn to

Reimplemented from wxSFRectShape.

virtual void wxSFBitmapShape::DrawHover ( wxDC &  dc) [protected, virtual]

Draw the shape in the hower mode (the mouse cursor is above the shape). The function can be overrided if neccessary.

Parameters:
dcReference to device context where the shape will be drawn to

Reimplemented from wxSFRectShape.

virtual void wxSFBitmapShape::DrawNormal ( wxDC &  dc) [protected, virtual]

Draw the shape in the normal way. The function can be overrided if neccessary.

Parameters:
dcReference to device context where the shape will be drawn to

Reimplemented from wxSFRectShape.

void wxSFBitmapShape::EnableScale ( bool  canscale) [inline]

Enable/disable scaling mode of the bitmap.

Parameters:
canscaleSet TRUE if the bitmap shape could be scaled
wxString wxSFBitmapShape::GetBitmapPath ( ) [inline]

Get full name of a source BMP file.

Returns:
String containig full file name

Initialize serializable properties.

Reimplemented from wxSFRectShape.

virtual void wxSFBitmapShape::OnBeginHandle ( wxSFShapeHandle handle) [virtual]

Event handler called when the user started to drag the shape handle. The function can be overrided if neccessary.

Parameters:
handleReference to the dragged shape handle

Reimplemented from wxSFRectShape.

virtual void wxSFBitmapShape::OnEndHandle ( wxSFShapeHandle handle) [virtual]

Event handler called when the user finished dragging of the shape handle. The function can be overrided if neccessary.

Parameters:
handleReference to the dragged shape handle

Reimplemented from wxSFShapeBase.

virtual void wxSFBitmapShape::OnHandle ( wxSFShapeHandle handle) [virtual]

Event handler called during dragging of the shape handle. The function can be overrided if neccessary.

Parameters:
handleReference to the dragged shape handle

Reimplemented from wxSFRectShape.

void wxSFBitmapShape::RescaleImage ( const wxRealPoint &  size) [protected]

Rescale the bitmap shape so it will fit the given extent. The shape position is not involved (the left-top bitmap corner is not moved).

Parameters:
sizeNew bitmap size
virtual void wxSFBitmapShape::Scale ( double  x,
double  y,
bool  children = sfWITHCHILDREN 
) [virtual]

Scale the bitmap shape in both directions. The function can be overrided if neccessary.

Parameters:
xScale ratio in the horizontal direction
yScale ratio in the vertical direction
childrenTRUE if the shape's children shoould be scaled as well, otherwise the shape will be updated after scaling via Update() function.

Reimplemented from wxSFRectShape.

virtual wxXmlNode* wxSFBitmapShape::Serialize ( wxXmlNode *  node) [protected, virtual]

Serialize shape's properties to the given XML node.

Parameters:
nodePointer to XML node where the shape's property nodes will be append to
See also:
wxSFShapeBase::Serialize

Reimplemented from wxSFShapeBase.


Member Data Documentation

wxBitmap wxSFBitmapShape::m_Bitmap [protected]

Currently processed (modified) bitmap.

bool wxSFBitmapShape::m_fCanScale [protected]
wxRealPoint wxSFBitmapShape::m_nPrevPos [protected]
wxBitmap wxSFBitmapShape::m_OriginalBitmap [protected]

Original archived bitmap.

wxString wxSFBitmapShape::m_sBitmapPath [protected]

String containing the full bitmap file name.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines