Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

jAPIbuilderView.h

Go to the documentation of this file.
00001 //---------------------------------------------------------------------------
00002 
00003 #ifndef jBuilderViewH
00004 #define jBuilderViewH
00005 //---------------------------------------------------------------------------
00006 
00007 #include <vcl.h>
00008 #include <vector.h>
00009 
00010 #define SPRITEVIEW_BEGIN            0
00011 //#define SPRITEVIEW_ID               1
00012 #define SPRITEVIEW_END              2
00013 //#define SPRITEVIEW_BMPPATH          3
00014 #define SPRITEVIEW_DIMENSION        4
00015 #define SPRITEVIEW_SHOWIMAGE        5
00016 #define SPRITEVIEW_IMAGEORIGINAL    6
00017 #define SPRITEVIEW_VISIBLE          7
00018 #define SPRITEVIEW_TRANSPARENCY     8    
00019 
00020 #define SCENEVIEW_BEGIN         0
00021 //#define SCENEVIEW_RECT          1
00022 #define SCENEVIEW_END           2
00023 #define SCENEVIEW_SPRITES       3
00024 
00025 class jBitmap;
00026 
00027 //----------------------------------------------------------------
00028 //
00029 // jBuilderSprite
00030 // 
00031 //----------------------------------------------------------------
00032 
00033 class jBuilderSprite
00034 {
00035         bool    __fastcall init();
00036         bool    __fastcall deinit();
00037 
00038         bool    __fastcall writeTag(int _tag, TStream * _str);        
00039 
00040         public:
00041         jBuilderSprite();
00042         ~jBuilderSprite();
00043 
00044         TRect rect;
00045 
00046         void    * object;
00047 
00048         jBitmap * bitmap;
00049         int     transparency;
00050         bool    visible;
00051 
00052         bool    __fastcall copy(jBuilderSprite * _sprite);
00053 
00054         bool    __fastcall setBitmap(jBitmap * _bitmap, bool _autoSize);
00055         bool    __fastcall drawSelection(TCanvas * _canvas);
00056         bool    __fastcall rectContains(int _x, int _y, int & _ctrlPoint);
00057         bool    __fastcall bitmapContains(int _x, int _y);
00058         bool    __fastcall collision(TRect & _rect);
00059         bool    __fastcall moveTo(int X, int Y);
00060         bool    __fastcall sizeTo(int _ctrlPoint, int _posX, int _posY, bool _absolute);
00061         bool    __fastcall saveToStream(TStream * _str, bool _saveImage);
00062         bool    __fastcall loadFromStream(TStream * _str, jBitmap * _image);
00063 };
00064 
00065 enum ViewStatus {selected, moving, sizeBegin, sizing, none};
00066 
00067 class jBuilderView
00068 {
00069         bool    freezed;
00070         jBitmap * buffer;
00071         jBitmap * background;
00072 
00073         ViewStatus status;
00074         int controlPointSelection;
00075         vector<jBuilderSprite *> sprites;
00076 
00077         bool    __fastcall init();
00078         bool    __fastcall deinit();
00079 
00080         bool    __fastcall drawBuffer();
00081 
00082         bool    __fastcall writeTag(int _tag, TStream * _str);
00083         int     __fastcall addSprite(jBitmap * _bitmap, TRect _rect, void * _object = NULL);        
00084         jBuilderSprite * __fastcall spriteAt(int _x, int _y, int & _ctrlPoint, int & _ref, bool _transparency);
00085 
00086         bool    __fastcall moveSelection(TCanvas * _canvas, int X, int Y);
00087         bool    __fastcall sizeSelection(TCanvas * _canvas, int ctrlPoint, int X, int Y);
00088 
00089         public:
00090 
00091         jBuilderView();
00092         ~jBuilderView();
00093 
00094         int     __fastcall indexSelection;
00095 
00096         int     __fastcall backgroundWidth();
00097         int     __fastcall backgroundHeight();
00098 
00099         bool    __fastcall setBackground(jBitmap * _bitmap);
00100 
00101         bool    __fastcall clear();
00102         bool    __fastcall clearSprites();
00103 
00104         int     __fastcall addSprite(jBitmap * _bitmap, const TPoint & _point, const TRect & _viewRect, void * _object = NULL);
00105 
00106         bool    __fastcall removeSprite(int _num);
00107         bool    __fastcall removeSelection();
00108 
00109         bool    __fastcall drawFetched(TCanvas * _canvas, TRect rect);
00110 //        bool    __fastcall draw(TCanvas * _canvas, TRect rect);        
00111 
00112         bool    __fastcall drawSelection(TCanvas * _canvas, int _num);
00113         bool    __fastcall drawSelection();
00114 
00115         bool    __fastcall setTransparency(int _transparency);
00116         bool    __fastcall setTransparency(int _num, int _transparency);
00117 
00118         bool    __fastcall setImage(jBitmap * _bmp, bool _force);
00119         bool    __fastcall setImage(int _num, jBitmap * _bmp, bool _force);
00120 
00121         bool    __fastcall setVisible(bool _visible);
00122         bool    __fastcall setVisible(int _num, bool _visible);
00123 
00124         void *  __fastcall getObject(int _num);
00125         int     __fastcall getSprite(const TPoint & _point, const TRect & _viewRect);
00126         jBuilderSprite * __fastcall spriteAt(int _num);
00127         jBuilderSprite * __fastcall spriteSelected();
00128 
00129         void    __fastcall evtMouseDown(TCanvas * Canvas, TMouseButton Button, TShiftState Shift, const TPoint & _point, const TRect & _viewRect);
00130         void    __fastcall evtMouseMove(TCanvas * Canvas, TShiftState Shift, const TPoint & _point, const TRect & _viewRect);
00131         void    __fastcall evtMouseUp(TCanvas * Canvas, TMouseButton Button, TShiftState Shift, const TPoint & _point, const TRect & _viewRect);
00132 
00133         bool    __fastcall moveForward(int _num);
00134         bool    __fastcall moveForward();
00135         bool    __fastcall moveBackward(int _num);
00136         bool    __fastcall moveBackward();
00137         bool    __fastcall moveToFront(int _num);
00138         bool    __fastcall moveToFront();
00139         bool    __fastcall moveToBack(int _num);
00140         bool    __fastcall moveToBack();
00141 
00142         bool    __fastcall loadFromStream(TStream * _str, vector<jBitmap *> * _bmps);
00143         bool    __fastcall saveToStream(TStream * _str, bool _saveimages);                              
00144 };
00145 
00146 #endif

Generated on Sat Nov 15 10:52:34 2003 for JAPI by doxygen 1.3.4