]> git.saurik.com Git - wxWidgets.git/blobdiff - contrib/src/ogl/canvas.cpp
Rework modal dialog code to not depend on now obsolete wxDIALOG_MODAL flag.
[wxWidgets.git] / contrib / src / ogl / canvas.cpp
index aa04b2d01caf76d019063087fe79fb4b3067b6dc..6c3bb4d561d90a3ad0986860bac63c81e957bd0b 100644 (file)
 #include <wx/wx.h>
 #endif
 
-#include <wx/wxexpr.h>
+#if wxUSE_PROLOGIO
+#include <wx/deprecated/wxexpr.h>
+#endif
 
 #ifdef new
 #undef new
 #endif
 
-#if wxUSE_IOSTREAMH
-#include <iostream.h>
-#else
-#include <iostream>
-#endif
-
 #include <ctype.h>
 #include <math.h>
 #include <stdlib.h>
 
-#include <wx/ogl/basic.h>
-#include <wx/ogl/basicp.h>
-#include <wx/ogl/canvas.h>
-#include <wx/ogl/ogldiag.h>
-#include <wx/ogl/misc.h>
-#include <wx/ogl/lines.h>
-#include <wx/ogl/composit.h>
+#include "wx/ogl/ogl.h"
 
 #define CONTROL_POINT_SIZE       6
 
@@ -68,9 +58,15 @@ BEGIN_EVENT_TABLE(wxShapeCanvas, wxScrolledWindow)
     EVT_MOUSE_EVENTS(wxShapeCanvas::OnMouseEvent)
 END_EVENT_TABLE()
 
+const wxChar* wxShapeCanvasNameStr = wxT("shapeCanvas");
+
 // Object canvas
-wxShapeCanvas::wxShapeCanvas(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style):
-  wxScrolledWindow(parent, id, pos, size, style)
+wxShapeCanvas::wxShapeCanvas(wxWindow *parent, wxWindowID id,
+                             const wxPoint& pos,
+                             const wxSize& size,
+                             long style,
+                             const wxString& name):
+  wxScrolledWindow(parent, id, pos, size, style, name)
 {
   m_shapeDiagram = NULL;
   m_dragState = NoDragging;
@@ -86,16 +82,17 @@ wxShapeCanvas::~wxShapeCanvas()
 {
 }
 
-void wxShapeCanvas::OnPaint(wxPaintEvent& event)
+void wxShapeCanvas::OnPaint(wxPaintEvent& WXUNUSED(event))
 {
     wxPaintDC dc(this);
 
     PrepareDC(dc);
 
+    dc.SetBackground(wxBrush(GetBackgroundColour(), wxSOLID));
     dc.Clear();
 
-       if (GetDiagram())
-               GetDiagram()->Redraw(dc);
+    if (GetDiagram())
+        GetDiagram()->Redraw(dc);
 }
 
 void wxShapeCanvas::OnMouseEvent(wxMouseEvent& event)
@@ -396,10 +393,10 @@ wxShape *wxShapeCanvas::FindShape(double x, double y, int *attachment, wxClassIn
   //     the other objects
   // (b) to find the control points FIRST if they exist
 
-  wxNode *current = GetDiagram()->GetShapeList()->Last();
+  wxNode *current = GetDiagram()->GetShapeList()->GetLast();
   while (current)
   {
-    wxShape *object = (wxShape *)current->Data();
+    wxShape *object = (wxShape *)current->GetData();
 
     double dist;
     int temp_attachment;
@@ -429,13 +426,13 @@ wxShape *wxShapeCanvas::FindShape(double x, double y, int *attachment, wxClassIn
       }
     }
     if (current)
-      current = current->Previous();
+      current = current->GetPrevious();
   }
 
-  current = GetDiagram()->GetShapeList()->Last();
+  current = GetDiagram()->GetShapeList()->GetLast();
   while (current)
   {
-    wxShape *object = (wxShape *)current->Data();
+    wxShape *object = (wxShape *)current->GetData();
     double dist;
     int temp_attachment;
 
@@ -452,7 +449,6 @@ wxShape *wxShapeCanvas::FindShape(double x, double y, int *attachment, wxClassIn
         // Check for division in case line straddles divisions (i.e. is not wholly contained).
         if (!nearest_object || !(object->IsKindOf(CLASSINFO(wxDivisionShape)) || WhollyContains(object, nearest_object)))
         {
-          nearest = dist;
           nearest_object = object;
           nearest_attachment = temp_attachment;
           current = NULL;
@@ -460,7 +456,7 @@ wxShape *wxShapeCanvas::FindShape(double x, double y, int *attachment, wxClassIn
       }
     }
     if (current)
-      current = current->Previous();
+      current = current->GetPrevious();
   }
 
   *attachment = nearest_attachment;
@@ -472,35 +468,35 @@ wxShape *wxShapeCanvas::FindShape(double x, double y, int *attachment, wxClassIn
  *
  */
 
-void wxShapeCanvas::OnLeftClick(double x, double y, int keys)
+void wxShapeCanvas::OnLeftClick(double WXUNUSED(x), double WXUNUSED(y), int WXUNUSED(keys))
 {
 }
 
-void wxShapeCanvas::OnRightClick(double x, double y, int keys)
+void wxShapeCanvas::OnRightClick(double WXUNUSED(x), double WXUNUSED(y), int WXUNUSED(keys))
 {
 }
 
-void wxShapeCanvas::OnDragLeft(bool draw, double x, double y, int keys)
+void wxShapeCanvas::OnDragLeft(bool WXUNUSED(draw), double WXUNUSED(x), double WXUNUSED(y), int WXUNUSED(keys))
 {
 }
 
-void wxShapeCanvas::OnBeginDragLeft(double x, double y, int keys)
+void wxShapeCanvas::OnBeginDragLeft(double WXUNUSED(x), double WXUNUSED(y), int WXUNUSED(keys))
 {
 }
 
-void wxShapeCanvas::OnEndDragLeft(double x, double y, int keys)
+void wxShapeCanvas::OnEndDragLeft(double WXUNUSED(x), double WXUNUSED(y), int WXUNUSED(keys))
 {
 }
 
-void wxShapeCanvas::OnDragRight(bool draw, double x, double y, int keys)
+void wxShapeCanvas::OnDragRight(bool WXUNUSED(draw), double WXUNUSED(x), double WXUNUSED(y), int WXUNUSED(keys))
 {
 }
 
-void wxShapeCanvas::OnBeginDragRight(double x, double y, int keys)
+void wxShapeCanvas::OnBeginDragRight(double WXUNUSED(x), double WXUNUSED(y), int WXUNUSED(keys))
 {
 }
 
-void wxShapeCanvas::OnEndDragRight(double x, double y, int keys)
+void wxShapeCanvas::OnEndDragRight(double WXUNUSED(x), double WXUNUSED(y), int WXUNUSED(keys))
 {
 }