00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef __WXRECTPRIM_H__
00016 #define __WXRECTPRIM_H__
00017
00018 #ifndef WX_PRECOMP
00019 #include "wx/wx.h"
00020 #endif
00021
00022 #include "wx/image.h"
00023 #include "wx/canvas/candefs.h"
00024 #include "wx/canvas/canobj.h"
00025
00026 class A2DARTBASEDLLEXP a2dVpath;
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039 class A2DCANVASDLLEXP a2dRectMM: public a2dCanvasObject
00040 {
00041
00042 A2D_DECLARE_EVENT_TABLE()
00043
00044 public:
00045
00046 a2dRectMM();
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057 a2dRectMM( double x, double y, double w, double h , double radius=0, double contourwidth = 0 );
00058
00059
00060
00061
00062
00063
00064
00065
00066 a2dRectMM( const a2dPoint2D& p1, const a2dPoint2D& p2, double radius=0, double contourwidth = 0 );
00067
00068
00069
00070
00071
00072
00073
00074 a2dRectMM( const a2dBoundingBox& bbox, double radius=0, double contourwidth = 0 );
00075
00076 a2dRectMM( const a2dRectMM& rec, CloneOptions options );
00077
00078 ~a2dRectMM();
00079
00080
00081 void SetMin( double minx, double miny ) { m_minx = minx; m_miny = miny; SetPending(true); }
00082
00083
00084 void SetMax( double maxx, double maxy ) { m_maxx = maxx; m_maxy = maxy; SetPending(true); }
00085
00086
00087
00088
00089
00090 void SetWidth( double w) { m_maxx = m_minx + w; SetPending(true); }
00091
00092
00093
00094
00095
00096 void SetHeight( double h) { m_maxy = m_miny + h; SetPending(true); }
00097
00098
00099 double GetWidth() const { return m_maxx - m_minx; }
00100
00101
00102 double GetHeight() const { return m_maxy - m_miny; }
00103
00104
00105 void SetBorder(double width) { m_border = width; SetPending(true); }
00106
00107
00108 double GetBorder() const { return m_border; }
00109
00110 virtual a2dObject* Clone( CloneOptions options ) const;
00111
00112
00113 void SetContourWidth(double width) { m_contourwidth = width; SetPending(true); }
00114
00115
00116 double GetContourWidth() const { return m_contourwidth; }
00117
00118
00119
00120
00121
00122 void SetRadius( double radius ) { m_radius = radius; SetPending(true); }
00123
00124
00125 double GetRadius() const { return m_radius; }
00126
00127 #if wxART2D_USE_CVGIO
00128 virtual void DoSave( wxObject* parent, a2dIOHandlerXmlSerOut &out, a2dXmlSer_flag xmlparts , a2dObjectList* towrite );
00129
00130 void DoLoad( wxObject* parent, a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts );
00131 #endif //wxART2D_USE_CVGIO
00132
00133 a2dVertexList* GetAsPolygon();
00134
00135 a2dCanvasObjectList* GetAsCanvasVpaths( bool transform = true );
00136
00137 bool GeneratePins( a2dPinClass* toConnectTo, a2dConnectTask task, double x, double y );
00138 void OnHandleEvent(a2dHandleMouseEvent &event);
00139
00140 bool DoUpdate( UpdateMode mode, const a2dBoundingBox& childbox, const a2dBoundingBox& clipbox, const a2dBoundingBox& propbox );
00141
00142 DECLARE_DYNAMIC_CLASS(a2dRectMM)
00143
00144 protected:
00145
00146 virtual void EditFeedback( a2dIterC& ic, const a2dFeedbackId *id, a2dCanvasObject *currentEdit=0, int depth=INT_MAX, a2dCanvasObjectFlagsMask flags=0, double x=0, double y=0 );
00147
00148 virtual bool DoStartEdit( wxUint16 editmode, wxEditStyle editstyle );
00149
00150 void DoRender( a2dIterC& ic, OVERLAP clipparent );
00151 bool DoIsHitWorld( a2dIterC& ic, a2dHitEvent& hitEvent );
00152 a2dBoundingBox DoGetUnTransformedBbox( a2dBboxFlags flags = a2dCANOBJ_BBOX_NON ) const;
00153
00154
00155 double m_radius;
00156
00157
00158 double m_contourwidth;
00159
00160
00161 double m_minx;
00162
00163
00164 double m_miny;
00165
00166
00167 double m_maxx;
00168
00169
00170 double m_maxy;
00171
00172 bool m_flipIn;
00173
00174
00175 double m_border;
00176
00177
00178 private:
00179
00180 a2dRectMM( const a2dRectMM &other );
00181 };
00182
00183
00184
00185
00186
00187
00188
00189 class A2DCANVASDLLEXP a2dWindowMM: public a2dRectMM
00190 {
00191
00192 A2D_DECLARE_EVENT_TABLE()
00193
00194 public:
00195
00196 enum a2dWindowMMStyle
00197 {
00198 SUNKEN=0x0001,
00199 RAISED=0x0002
00200 };
00201 enum a2dWindowMMState
00202 {
00203 NON =0x0000,
00204 DISABLED=0x0001,
00205 SELECTED=0x0002,
00206 FOCUS =0x0004,
00207 HOVER =0x0008,
00208 ALL =0xFFFF
00209 };
00210
00211 a2dWindowMM();
00212
00213
00214
00215
00216
00217
00218
00219
00220 a2dWindowMM( double x, double y, double w, double h );
00221
00222
00223
00224
00225
00226
00227 a2dWindowMM( const a2dPoint2D& p1, const a2dPoint2D& p2 );
00228
00229
00230
00231
00232
00233 a2dWindowMM( const a2dBoundingBox& bbox );
00234
00235 a2dWindowMM( const a2dWindowMM& rec, CloneOptions options );
00236
00237 ~a2dWindowMM();
00238
00239
00240 void SetStyle( long style ) { m_style = style; }
00241
00242
00243 long GetStyle() { return m_style;}
00244
00245
00246 void Init();
00247
00248 virtual a2dObject* Clone( CloneOptions options ) const;
00249
00250 #if wxART2D_USE_CVGIO
00251 virtual void DoSave( wxObject* parent, a2dIOHandlerXmlSerOut &out, a2dXmlSer_flag xmlparts , a2dObjectList* towrite );
00252
00253 void DoLoad( wxObject* parent, a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts );
00254 #endif //wxART2D_USE_CVGIO
00255
00256 bool DoUpdate( UpdateMode mode, const a2dBoundingBox& childbox, const a2dBoundingBox& clipbox, const a2dBoundingBox& propbox );
00257
00258 DECLARE_DYNAMIC_CLASS(a2dWindowMM)
00259
00260 protected:
00261
00262 void OnEnterObject(a2dCanvasObjectMouseEvent &event);
00263
00264 void OnLeaveObject(a2dCanvasObjectMouseEvent &event);
00265
00266 void DoRender( a2dIterC& ic, OVERLAP clipparent );
00267
00268 long m_style;
00269 long m_state;
00270
00271 a2dStroke m_backStroke;
00272 a2dStroke m_darkStroke;
00273 a2dStroke m_lightStroke;
00274 a2dStroke m_whiteStroke;
00275 a2dStroke m_blackStroke;
00276 a2dStroke m_hoverStroke;
00277
00278
00279 private:
00280
00281 a2dWindowMM( const a2dWindowMM &other );
00282 };
00283
00284
00285 class A2DCANVASDLLEXP a2dWidgetButton;
00286
00287 class A2DCANVASDLLEXP a2dRectWindowT2: public a2dRectMM
00288 {
00289
00290 A2D_DECLARE_EVENT_TABLE()
00291
00292 public:
00293
00294 a2dRectWindowT2();
00295
00296
00297
00298
00299
00300
00301
00302
00303
00304
00305 a2dRectWindowT2( a2dCanvasObject* parent, double x, double y, double w, double h , double radius=0 );
00306
00307
00308
00309
00310
00311
00312
00313
00314 a2dRectWindowT2( a2dCanvasObject* parent, const a2dPoint2D& p1, const a2dPoint2D& p2, double radius=0 );
00315
00316
00317
00318
00319
00320
00321
00322 a2dRectWindowT2( a2dCanvasObject* parent, const a2dBoundingBox& bbox, double radius=0 );
00323
00324
00325 a2dRectWindowT2( const a2dRectWindowT2& rec, CloneOptions options );
00326
00327
00328 ~a2dRectWindowT2();
00329
00330
00331 void Init( a2dCanvasObject* parent );
00332
00333
00334 void OnCloseWindow(wxCommandEvent &event);
00335
00336 virtual a2dObject* Clone( CloneOptions options ) const;
00337
00338 #if wxART2D_USE_CVGIO
00339 virtual void DoSave( wxObject* parent, a2dIOHandlerXmlSerOut &out, a2dXmlSer_flag xmlparts , a2dObjectList* towrite );
00340
00341 void DoLoad( wxObject* parent, a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts );
00342 #endif //wxART2D_USE_CVGIO
00343
00344 bool DoUpdate( UpdateMode mode, const a2dBoundingBox& childbox, const a2dBoundingBox& clipbox, const a2dBoundingBox& propbox );
00345
00346
00347 a2dSmrtPtr<a2dText>& GetTitle() { return m_title; }
00348
00349
00350 void SetTitle( a2dText* textObj );
00351
00352
00353 void SetTitle( const wxString& title);
00354
00355
00356 virtual void SetParent( a2dCanvasObject* parent ) { m_parent = parent; }
00357
00358
00359 void DoWalker( wxObject* parent, a2dWalkerIOHandler& handler );
00360 bool ProcessCanvasObjectEvent( a2dIterC& ic, a2dHitEvent& hitEvent );
00361 void DoAddPending( a2dIterC& ic );
00362 bool Update( a2dCanvasObject::UpdateMode mode );
00363 void Render( a2dIterC& ic, OVERLAP clipparent );
00364
00365
00366 DECLARE_DYNAMIC_CLASS(a2dRectWindowT2)
00367
00368 protected:
00369
00370 virtual bool DoStartEdit( wxUint16 editmode, wxEditStyle editstyle );
00371
00372 void DoRender( a2dIterC& ic, OVERLAP clipparent );
00373
00374 a2dCanvasObjectPtr m_titleObj;
00375
00376
00377 a2dSmrtPtr<a2dText> m_title;
00378
00379
00380 a2dFill m_titleFill;
00381
00382 a2dStroke m_titleStroke;
00383
00384
00385 a2dSmrtPtr<a2dWidgetButton> m_close;
00386
00387
00388 a2dCanvasObject* m_parent;
00389
00390
00391 mutable double m_titleheight;
00392
00393
00394 static double m_initialTitleHeight;
00395
00396 private:
00397
00398 a2dRectWindowT2( const a2dRectWindowT2 &other );
00399 };
00400
00401 class A2DCANVASDLLEXP a2dRectWindow: public a2dWindowMM
00402 {
00403
00404 A2D_DECLARE_EVENT_TABLE()
00405
00406 public:
00407
00408 a2dRectWindow();
00409
00410
00411
00412
00413
00414
00415
00416
00417
00418
00419 a2dRectWindow( a2dCanvasObject* parent, double x, double y, double w, double h );
00420
00421
00422
00423
00424
00425
00426
00427
00428 a2dRectWindow( a2dCanvasObject* parent, const a2dPoint2D& p1, const a2dPoint2D& p2 );
00429
00430
00431
00432
00433
00434
00435
00436 a2dRectWindow( a2dCanvasObject* parent, const a2dBoundingBox& bbox );
00437
00438 a2dRectWindow( const a2dRectWindow& rec, CloneOptions options );
00439
00440 ~a2dRectWindow();
00441
00442 void Init( a2dCanvasObject* parent );
00443
00444 void OnCloseWindow(wxCommandEvent &event);
00445
00446 virtual a2dObject* Clone( CloneOptions options ) const;
00447
00448 #if wxART2D_USE_CVGIO
00449 virtual void DoSave( wxObject* parent, a2dIOHandlerXmlSerOut &out, a2dXmlSer_flag xmlparts , a2dObjectList* towrite );
00450
00451 void DoLoad( wxObject* parent, a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts );
00452 #endif //wxART2D_USE_CVGIO
00453
00454 bool DoUpdate( UpdateMode mode, const a2dBoundingBox& childbox, const a2dBoundingBox& clipbox, const a2dBoundingBox& propbox );
00455
00456 a2dSmrtPtr<a2dText>& GetTitle() { return m_title; }
00457
00458
00459 void SetTitle( a2dText* textObj );
00460
00461
00462 void SetTitle( const wxString& title);
00463
00464
00465 a2dSmrtPtr<a2dWindowMM>& GetCanvas() { return m_canvas; }
00466
00467
00468 void SetCanvas( a2dWindowMM* canvas );
00469
00470
00471 virtual void SetParent( a2dCanvasObject* parent ) { m_parent = parent; }
00472
00473 DECLARE_DYNAMIC_CLASS(a2dRectWindow)
00474
00475 protected:
00476
00477 virtual bool DoStartEdit( wxUint16 editmode, wxEditStyle editstyle );
00478
00479 void DoRender( a2dIterC& ic, OVERLAP clipparent );
00480
00481
00482 a2dSmrtPtr<a2dText> m_title;
00483
00484
00485 a2dFill m_titleFill;
00486
00487 a2dStroke m_titleStroke;
00488
00489
00490 a2dSmrtPtr<a2dWidgetButton> m_close;
00491
00492
00493 a2dCanvasObject* m_parent;
00494
00495
00496 a2dSmrtPtr<a2dWindowMM> m_canvas;
00497
00498
00499 mutable double m_titleheight;
00500
00501
00502 static double m_initialTitleHeight;
00503
00504 private:
00505
00506 a2dRectWindow( const a2dRectWindow &other );
00507 };
00508
00509 #endif
00510