]> git.saurik.com Git - wxWidgets.git/blame - contrib/samples/ogl/studio/view.h
Use "Base" version of wxBell on OS/2.
[wxWidgets.git] / contrib / samples / ogl / studio / view.h
CommitLineData
1fc25a89
JS
1/////////////////////////////////////////////////////////////////////////////
2// Name: view.h
3// Purpose: View-related classes
4// Author: Julian Smart
5// Modified by:
6// Created: 12/07/98
7// RCS-ID: $Id$
8// Copyright: (c) Julian Smart
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _STUDIO_VIEW_H_
13#define _STUDIO_VIEW_H_
14
ab7ce33c 15#if defined(__GNUG__) && !defined(__APPLE__)
1fc25a89
JS
16// #pragma interface "view.h"
17#endif
18
19#include "doc.h"
20#include <wx/ogl/ogl.h>
21
22class csDiagramView;
23class csCanvas: public wxShapeCanvas
24{
25DECLARE_CLASS(csCanvas)
26 public:
27
28 csCanvas(csDiagramView *view, wxWindow *parent = NULL, wxWindowID id = -1,
29 const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
30 long style = wxRETAINED);
31 ~csCanvas(void);
32
33 void DrawOutline(wxDC& dc, double x1, double y1, double x2, double y2);
34
35 void OnMouseEvent(wxMouseEvent& event);
36 void OnPaint(wxPaintEvent& event);
37
38 virtual void OnLeftClick(double x, double y, int keys = 0);
39 virtual void OnRightClick(double x, double y, int keys = 0);
40
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);
44
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);
48
49 inline csDiagramView* GetView() const { return m_view; }
50 inline void SetView(csDiagramView* view) { m_view = view; }
51
52 protected:
53 csDiagramView* m_view;
54
55DECLARE_EVENT_TABLE()
56};
57
58class csDiagramView: public wxView
59{
60 DECLARE_DYNAMIC_CLASS(csDiagramView)
61 public:
62 csDiagramView(void) { canvas = NULL; frame = NULL; };
63 ~csDiagramView(void);
64
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);
70
71 wxShape *FindFirstSelectedShape(void);
72
73 // Scans the canvas for selections (doesn't use m_selections)
74 void FindSelectedShapes(wxList& selections, wxClassInfo* toFind = NULL);
75
76 // The selections in the order in which they were selected
77 inline wxList& GetSelectionList() const { return (wxList&) m_selections; }
78
79 // Adds or removes shape from m_selections
80 void SelectShape(wxShape* shape, bool select);
81
82 // Apply point size to current shapes
83 void ApplyPointSize(int pointSize);
84
85 // Make the point size combobox reflect this
86 void ReflectPointSize(int pointSize);
87
88 // Make the arrow toggle button reflect the state of the line
89 void ReflectArrowState(wxLineShape* lineShape);
90
91 // Do a cut operation for the given list of shapes
92 void DoCut(wxList& shapes);
93
94 // Do a general command
95 void DoCmd(wxList& shapes, wxList& oldShapes, int cmd, const wxString& op);
96
97 // Select or deselect all
98 void SelectAll(bool select = TRUE);
99
100// Event handlers
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);
116
117// UI update handles
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);
131
132DECLARE_EVENT_TABLE()
133
134public:
135 wxFrame* frame;
136 csCanvas* canvas;
137 wxList m_selections;
138};
139
140#endif
141 // _STUDIO_VIEW_H_