1///////////////////////////////////////////////////////////////////////////// 2// Name: contrib/samples/ogl/ogledit/view.h 3// Purpose: View-related classes 4// Author: Julian Smart 5// Modified by: 6// Created: 12/07/98 7// RCS-ID: $Id: view.h 37440 2006-02-10 11:59:52Z ABX $ 8// Copyright: (c) Julian Smart 9// Licence: wxWindows licence 10///////////////////////////////////////////////////////////////////////////// 11 12#ifndef _OGLSAMPLE_VIEW_H_ 13#define _OGLSAMPLE_VIEW_H_ 14 15#include "doc.h" 16#include "wx/ogl/ogl.h" 17 18class MyCanvas: public wxShapeCanvas 19{ 20// DECLARE_DYNAMIC_CLASS(wxShapeCanvas) 21 protected: 22 public: 23 wxView *view; 24 25 MyCanvas(wxView *view, wxWindow *parent = NULL, wxWindowID id = wxID_ANY, 26 const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, 27 long style = wxRETAINED); 28 ~MyCanvas(void); 29 30 void OnMouseEvent(wxMouseEvent& event); 31 void OnPaint(wxPaintEvent& event); 32 33 virtual void OnLeftClick(double x, double y, int keys = 0); 34 virtual void OnRightClick(double x, double y, int keys = 0); 35 36 virtual void OnDragLeft(bool draw, double x, double y, int keys=0); // Erase if draw false 37 virtual void OnBeginDragLeft(double x, double y, int keys=0); 38 virtual void OnEndDragLeft(double x, double y, int keys=0); 39 40 virtual void OnDragRight(bool draw, double x, double y, int keys=0); // Erase if draw false 41 virtual void OnBeginDragRight(double x, double y, int keys=0); 42 virtual void OnEndDragRight(double x, double y, int keys=0); 43 44DECLARE_EVENT_TABLE() 45}; 46 47class DiagramView: public wxView 48{ 49 DECLARE_DYNAMIC_CLASS(DiagramView) 50 private: 51 public: 52 wxFrame *frame; 53 MyCanvas *canvas; 54 55 DiagramView(void) { canvas = NULL; frame = NULL; }; 56 ~DiagramView(void) {}; 57 58 bool OnCreate(wxDocument *doc, long flags); 59 void OnDraw(wxDC *dc); 60 void OnUpdate(wxView *sender, wxObject *hint = NULL); 61 bool OnClose(bool deleteWindow = true); 62 63 wxShape *FindSelectedShape(void); 64 65 void OnCut(wxCommandEvent& event); 66 void OnChangeBackgroundColour(wxCommandEvent& event); 67 void OnEditLabel(wxCommandEvent& event); 68 69DECLARE_EVENT_TABLE() 70}; 71 72#endif 73 // _OGLSAMPLE_VIEW_H_ 74