]>
git.saurik.com Git - wxWidgets.git/blob - contrib/samples/ogl/studio/view.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: contrib/samples/ogl/studio/view.h
3 // Purpose: View-related classes
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _STUDIO_VIEW_H_
13 #define _STUDIO_VIEW_H_
16 #include "wx/ogl/ogl.h"
19 class csCanvas
: public wxShapeCanvas
21 DECLARE_CLASS(csCanvas
)
24 csCanvas(csDiagramView
*view
, wxWindow
*parent
= NULL
, wxWindowID id
= wxID_ANY
,
25 const wxPoint
& pos
= wxDefaultPosition
, const wxSize
& size
= wxDefaultSize
,
26 long style
= wxRETAINED
);
29 void DrawOutline(wxDC
& dc
, double x1
, double y1
, double x2
, double y2
);
31 void OnMouseEvent(wxMouseEvent
& event
);
32 void OnPaint(wxPaintEvent
& event
);
34 virtual void OnLeftClick(double x
, double y
, int keys
= 0);
35 virtual void OnRightClick(double x
, double y
, int keys
= 0);
37 virtual void OnDragLeft(bool draw
, double x
, double y
, int keys
=0); // Erase if draw false
38 virtual void OnBeginDragLeft(double x
, double y
, int keys
=0);
39 virtual void OnEndDragLeft(double x
, double y
, int keys
=0);
41 virtual void OnDragRight(bool draw
, double x
, double y
, int keys
=0); // Erase if draw false
42 virtual void OnBeginDragRight(double x
, double y
, int keys
=0);
43 virtual void OnEndDragRight(double x
, double y
, int keys
=0);
45 inline csDiagramView
* GetView() const { return m_view
; }
46 inline void SetView(csDiagramView
* view
) { m_view
= view
; }
49 csDiagramView
* m_view
;
54 class csDiagramView
: public wxView
56 DECLARE_DYNAMIC_CLASS(csDiagramView
)
58 csDiagramView(void) { canvas
= NULL
; frame
= NULL
; };
61 bool OnCreate(wxDocument
*doc
, long flags
);
62 void OnDraw(wxDC
*dc
);
63 void OnUpdate(wxView
*sender
, wxObject
*hint
= NULL
);
64 bool OnClose(bool deleteWindow
= true);
65 void OnSelectAll(wxCommandEvent
& event
);
67 wxShape
*FindFirstSelectedShape(void);
69 // Scans the canvas for selections (doesn't use m_selections)
70 void FindSelectedShapes(wxList
& selections
, wxClassInfo
* toFind
= NULL
);
72 // The selections in the order in which they were selected
73 inline wxList
& GetSelectionList() const { return (wxList
&) m_selections
; }
75 // Adds or removes shape from m_selections
76 void SelectShape(wxShape
* shape
, bool select
);
78 // Apply point size to current shapes
79 void ApplyPointSize(int pointSize
);
81 // Make the point size combobox reflect this
82 void ReflectPointSize(int pointSize
);
84 // Make the arrow toggle button reflect the state of the line
85 void ReflectArrowState(wxLineShape
* lineShape
);
87 // Do a cut operation for the given list of shapes
88 void DoCut(wxList
& shapes
);
90 // Do a general command
91 void DoCmd(wxList
& shapes
, wxList
& oldShapes
, int cmd
, const wxString
& op
);
93 // Select or deselect all
94 void SelectAll(bool select
= true);
97 void OnCut(wxCommandEvent
& event
);
98 void OnCopy(wxCommandEvent
& event
);
99 void OnPaste(wxCommandEvent
& event
);
100 void OnDuplicate(wxCommandEvent
& event
);
101 void OnClear(wxCommandEvent
& event
);
102 void OnChangeBackgroundColour(wxCommandEvent
& event
);
103 void OnEditProperties(wxCommandEvent
& event
);
104 void OnPointSizeComboSel(wxCommandEvent
& event
);
105 void OnPointSizeComboText(wxCommandEvent
& event
);
106 void OnToggleArrowTool(wxCommandEvent
& event
);
107 void OnZoomSel(wxCommandEvent
& event
);
108 void OnAlign(wxCommandEvent
& event
);
109 void OnNewLinePoint(wxCommandEvent
& event
);
110 void OnCutLinePoint(wxCommandEvent
& event
);
111 void OnStraightenLines(wxCommandEvent
& event
);
114 void OnToggleArrowToolUpdate(wxUpdateUIEvent
& event
);
115 void OnEditPropertiesUpdate(wxUpdateUIEvent
& event
);
116 void OnCutUpdate(wxUpdateUIEvent
& event
);
117 void OnClearUpdate(wxUpdateUIEvent
& event
);
118 void OnCopyUpdate(wxUpdateUIEvent
& event
);
119 void OnPasteUpdate(wxUpdateUIEvent
& event
);
120 void OnDuplicateUpdate(wxUpdateUIEvent
& event
);
121 void OnAlignUpdate(wxUpdateUIEvent
& event
);
122 void OnNewLinePointUpdate(wxUpdateUIEvent
& event
);
123 void OnCutLinePointUpdate(wxUpdateUIEvent
& event
);
124 void OnStraightenLinesUpdate(wxUpdateUIEvent
& event
);
125 void OnUndoUpdate(wxUpdateUIEvent
& event
);
126 void OnRedoUpdate(wxUpdateUIEvent
& event
);
128 DECLARE_EVENT_TABLE()
131 wxMDIChildFrame
* frame
;