00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef __WXCANSELECT_H__
00016 #define __WXCANSELECT_H__
00017
00018 #ifndef WX_PRECOMP
00019 #include "wx/wx.h"
00020 #endif
00021
00022 #include "wx/canvas/candefs.h"
00023 #include "wx/canvas/canobj.h"
00024 #include "wx/canvas/canprim.h"
00025 #include "wx/canvas/rectangle.h"
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041 class A2DCANVASDLLEXP a2dWidgetButton: public a2dWindowMM
00042 {
00043
00044 public:
00045
00046 enum WidgetMode
00047 {
00048 Boundingbox,
00049 BoundingboxSize,
00050 ScaledContent,
00051 ScaledContentKeepAspect,
00052 };
00053
00054
00055 a2dWidgetButton( a2dCanvasObject* parent, int buttonId, double x, double y, double w, double h, WidgetMode mode = Boundingbox );
00056
00057 a2dWidgetButton( const a2dWidgetButton& other, CloneOptions options );
00058
00059
00060 ~a2dWidgetButton();
00061
00062 virtual a2dObject* Clone( CloneOptions options ) const;
00063
00064
00065 virtual void SetParent( a2dCanvasObject* parent ) { m_parent = parent; }
00066
00067 virtual a2dEvtHandler* GetParentEvtHandler() { return m_parent; }
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079 void SetContentObject( a2dCanvasObject* content ) { m_content = content; }
00080
00081
00082 a2dCanvasObject* GetContentObject() { return m_content; }
00083
00084
00085 void SetContentBorder( double contentBorder ) { m_contentBorder = contentBorder; }
00086
00087
00088 double GetContentBorder() { return m_contentBorder; }
00089
00090
00091 void SetSelectedStroke( const a2dStroke& selectedStroke ) { m_selectedStroke = selectedStroke; }
00092
00093 void SetSelectedFill( const a2dFill& selectedFill ) { m_selectedFill = selectedFill; }
00094
00095
00096 void SetHighLightStroke( const a2dStroke& highLightStroke ) { m_highLightStroke = highLightStroke; }
00097
00098
00099 void SetHighLightFill( const a2dFill& highLightFill ) { m_highLightFill = highLightFill; }
00100
00101
00102 int GetButtonId() { return m_buttonId; }
00103
00104
00105 protected:
00106
00107 void DoWalker( wxObject* parent, a2dWalkerIOHandler& handler );
00108
00109 virtual void DrawHighLighted( a2dIterC& ic );
00110
00111 virtual void Render( a2dIterC& ic, OVERLAP clipparent );
00112 virtual bool DoUpdate( UpdateMode mode, const a2dBoundingBox& childbox, const a2dBoundingBox& clipbox, const a2dBoundingBox& propbox );
00113 virtual a2dBoundingBox DoGetUnTransformedBbox( a2dBboxFlags flags = a2dCANOBJ_BBOX_NON ) const;
00114 virtual void DoRender( a2dIterC& ic, OVERLAP clipparent );
00115
00116 bool DoIsHitWorld( a2dIterC& ic, a2dHitEvent& hitEvent );
00117
00118
00119 DECLARE_CLASS(a2dWidgetButton)
00120 A2D_DECLARE_EVENT_TABLE()
00121
00122
00123 void OnEnterObject(a2dCanvasObjectMouseEvent &event);
00124
00125
00126 void OnLeaveObject(a2dCanvasObjectMouseEvent &event);
00127
00128
00129 void OnCanvasObjectMouseEvent( a2dCanvasObjectMouseEvent& event );
00130
00131
00132 protected:
00133
00134
00135 a2dStroke m_selectedStroke;
00136
00137
00138 a2dFill m_selectedFill;
00139
00140
00141 a2dStroke m_highLightStroke;
00142
00143
00144 a2dFill m_highLightFill;
00145
00146
00147 int m_buttonId;
00148
00149
00150 WidgetMode m_mode;
00151
00152
00153 double m_contentBorder;
00154
00155
00156 a2dCanvasObjectPtr m_content;
00157
00158
00159
00160 a2dCanvasObject* m_parent;
00161
00162
00163 a2dAffineMatrix m_contentWorld;
00164 };
00165
00166
00167
00168
00169
00170
00171
00172 class A2DCANVASDLLEXP a2dWidgetButtonGroup: public a2dCanvasObject
00173 {
00174 public:
00175
00176
00177 a2dWidgetButtonGroup( a2dCanvasObject* parent, double x, double y, float extra=0 );
00178
00179 ~a2dWidgetButtonGroup();
00180
00181 virtual a2dEvtHandler* GetParentEvtHandler() { return m_parent.Get(); }
00182
00183
00184 void SetSingleSelect( bool singleSelect ) { m_singleSelect = singleSelect; }
00185
00186
00187 virtual void SetParent( a2dCanvasObject* parent ) { m_parent = parent; }
00188
00189
00190 protected:
00191
00192 virtual void DoRender( a2dIterC& ic, OVERLAP clipparent );
00193
00194
00195 DECLARE_CLASS(a2dWidgetButtonGroup)
00196 A2D_DECLARE_EVENT_TABLE()
00197
00198 void OnAnyButton(wxCommandEvent &event);
00199
00200
00201 protected:
00202
00203
00204 bool m_singleSelect;
00205
00206 a2dCanvasObjectPtr m_parent;
00207 };
00208
00209
00210
00211
00212
00213 class A2DCANVASDLLEXP a2dWidgetButtonCommand: public a2dWidgetButton
00214 {
00215 public:
00216
00217
00218 a2dWidgetButtonCommand( a2dCanvasObject* parent, int buttonId, double x, double y, double w, double h, WidgetMode mode = Boundingbox );
00219
00220 ~a2dWidgetButtonCommand();
00221
00222
00223
00224
00225 void SetCanvasCommand( class a2dCommand* command );
00226
00227
00228
00229
00230
00231
00232 void SetEvent( wxEvent *event );
00233
00234
00235
00236
00237
00238
00239
00240
00241 void SetClientData( wxClientData *clientData ) { m_clientData = clientData; }
00242
00243
00244 protected:
00245
00246
00247 DECLARE_CLASS(a2dWidgetButtonCommand)
00248 A2D_DECLARE_EVENT_TABLE()
00249
00250 void OnAnyChoice(wxCommandEvent &event);
00251
00252
00253 protected:
00254
00255
00256 class a2dCommand* m_docviewCommand;
00257
00258 wxEvent *m_event;
00259
00260 wxClientData *m_clientData;
00261 };
00262
00263 #endif
00264