]>
git.saurik.com Git - wxWidgets.git/blob - contrib/samples/ogl/studio/view.h
1 /////////////////////////////////////////////////////////////////////////////
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_
15 #if defined(__GNUG__) && !defined(__APPLE__)
16 // #pragma interface "view.h"
20 #include <wx/ogl/ogl.h>
23 class csCanvas
: public wxShapeCanvas
25 DECLARE_CLASS(csCanvas
)
28 csCanvas(csDiagramView
*view
, wxWindow
*parent
= NULL
, wxWindowID id
= -1,
29 const wxPoint
& pos
= wxDefaultPosition
, const wxSize
& size
= wxDefaultSize
,
30 long style
= wxRETAINED
);
33 void DrawOutline(wxDC
& dc
, double x1
, double y1
, double x2
, double y2
);
35 void OnMouseEvent(wxMouseEvent
& event
);
36 void OnPaint(wxPaintEvent
& event
);
38 virtual void OnLeftClick(double x
, double y
, int keys
= 0);
39 virtual void OnRightClick(double x
, double y
, int keys
= 0);
41 virtual void OnDragLeft(bool draw
, double x
, double y
, int keys
=0); // Erase if draw false
42 virtual void OnBeginDragLeft(double x
, double y
, int keys
=0);
43 virtual void OnEndDragLeft(double x
, double y
, int keys
=0);
45 virtual void OnDragRight(bool draw
, double x
, double y
, int keys
=0); // Erase if draw false
46 virtual void OnBeginDragRight(double x
, double y
, int keys
=0);
47 virtual void OnEndDragRight(double x
, double y
, int keys
=0);
49 inline csDiagramView
* GetView() const { return m_view
; }
50 inline void SetView(csDiagramView
* view
) { m_view
= view
; }
53 csDiagramView
* m_view
;
58 class csDiagramView
: public wxView
60 DECLARE_DYNAMIC_CLASS(csDiagramView
)
62 csDiagramView(void) { canvas
= NULL
; frame
= NULL
; };
65 bool OnCreate(wxDocument
*doc
, long flags
);
66 void OnDraw(wxDC
*dc
);
67 void OnUpdate(wxView
*sender
, wxObject
*hint
= NULL
);
68 bool OnClose(bool deleteWindow
= TRUE
);
69 void OnSelectAll(wxCommandEvent
& event
);
71 wxShape
*FindFirstSelectedShape(void);
73 // Scans the canvas for selections (doesn't use m_selections)
74 void FindSelectedShapes(wxList
& selections
, wxClassInfo
* toFind
= NULL
);
76 // The selections in the order in which they were selected
77 inline wxList
& GetSelectionList() const { return (wxList
&) m_selections
; }
79 // Adds or removes shape from m_selections
80 void SelectShape(wxShape
* shape
, bool select
);
82 // Apply point size to current shapes
83 void ApplyPointSize(int pointSize
);
85 // Make the point size combobox reflect this
86 void ReflectPointSize(int pointSize
);
88 // Make the arrow toggle button reflect the state of the line
89 void ReflectArrowState(wxLineShape
* lineShape
);
91 // Do a cut operation for the given list of shapes
92 void DoCut(wxList
& shapes
);
94 // Do a general command
95 void DoCmd(wxList
& shapes
, wxList
& oldShapes
, int cmd
, const wxString
& op
);
97 // Select or deselect all
98 void SelectAll(bool select
= TRUE
);
101 void OnCut(wxCommandEvent
& event
);
102 void OnCopy(wxCommandEvent
& event
);
103 void OnPaste(wxCommandEvent
& event
);
104 void OnDuplicate(wxCommandEvent
& event
);
105 void OnClear(wxCommandEvent
& event
);
106 void OnChangeBackgroundColour(wxCommandEvent
& event
);
107 void OnEditProperties(wxCommandEvent
& event
);
108 void OnPointSizeComboSel(wxCommandEvent
& event
);
109 void OnPointSizeComboText(wxCommandEvent
& event
);
110 void OnToggleArrowTool(wxCommandEvent
& event
);
111 void OnZoomSel(wxCommandEvent
& event
);
112 void OnAlign(wxCommandEvent
& event
);
113 void OnNewLinePoint(wxCommandEvent
& event
);
114 void OnCutLinePoint(wxCommandEvent
& event
);
115 void OnStraightenLines(wxCommandEvent
& event
);
118 void OnToggleArrowToolUpdate(wxUpdateUIEvent
& event
);
119 void OnEditPropertiesUpdate(wxUpdateUIEvent
& event
);
120 void OnCutUpdate(wxUpdateUIEvent
& event
);
121 void OnClearUpdate(wxUpdateUIEvent
& event
);
122 void OnCopyUpdate(wxUpdateUIEvent
& event
);
123 void OnPasteUpdate(wxUpdateUIEvent
& event
);
124 void OnDuplicateUpdate(wxUpdateUIEvent
& event
);
125 void OnAlignUpdate(wxUpdateUIEvent
& event
);
126 void OnNewLinePointUpdate(wxUpdateUIEvent
& event
);
127 void OnCutLinePointUpdate(wxUpdateUIEvent
& event
);
128 void OnStraightenLinesUpdate(wxUpdateUIEvent
& event
);
129 void OnUndoUpdate(wxUpdateUIEvent
& event
);
130 void OnRedoUpdate(wxUpdateUIEvent
& event
);
132 DECLARE_EVENT_TABLE()
135 wxMDIChildFrame
* frame
;