wxShapeFramework
1.13.0 beta
|
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>
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. |
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.
wxSFBitmapShape::wxSFBitmapShape | ( | void | ) |
Default constructor.
wxSFBitmapShape::wxSFBitmapShape | ( | const wxRealPoint & | pos, |
const wxString & | bitmapPath, | ||
wxSFDiagramManager * | manager | ||
) |
User contructor.
pos | Initial position |
bitmapPath | BMP file name |
manager | Pointer of parent manager |
wxSFBitmapShape::wxSFBitmapShape | ( | const wxSFBitmapShape & | obj | ) |
Copy constructor.
obj | Source shape |
virtual wxSFBitmapShape::~wxSFBitmapShape | ( | void | ) | [virtual] |
Destructor.
bool wxSFBitmapShape::CanScale | ( | ) | [inline] |
Get information about the possibility of the shape scaling.
bool wxSFBitmapShape::CreateFromFile | ( | const wxString & | file, |
wxBitmapType | type = wxBITMAP_TYPE_BMP |
||
) |
Load a bitmap from the file.
file | File name (absolute or relative) |
type | Bitmap type (see the wxBitmap class reference) |
bool wxSFBitmapShape::CreateFromXPM | ( | const char *const * | bits | ) |
Load a bitmap from the XPM structure.
bits | Buffer with the image bits |
virtual void wxSFBitmapShape::Deserialize | ( | wxXmlNode * | node | ) | [protected, virtual] |
Deserialize shape's properties from the given XML node.
node | Source XML node containig the shape's property nodes |
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.
dc | Reference 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.
dc | Reference 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.
dc | Reference 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.
canscale | Set TRUE if the bitmap shape could be scaled |
wxString wxSFBitmapShape::GetBitmapPath | ( | ) | [inline] |
Get full name of a source BMP file.
void wxSFBitmapShape::MarkSerializableDataMembers | ( | ) | [private] |
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.
handle | Reference 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.
handle | Reference 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.
handle | Reference 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).
size | New 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.
x | Scale ratio in the horizontal direction |
y | Scale ratio in the vertical direction |
children | TRUE 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.
node | Pointer to XML node where the shape's property nodes will be append to |
Reimplemented from wxSFShapeBase.
wxBitmap wxSFBitmapShape::m_Bitmap [protected] |
Currently processed (modified) bitmap.
bool wxSFBitmapShape::m_fCanScale [protected] |
bool wxSFBitmapShape::m_fRescaleInProgress [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.