// Created: 12/07/98
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
-#ifdef __GNUG__
-#pragma implementation "divided.h"
-#endif
-
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#endif
#ifndef WX_PRECOMP
-#include <wx/wx.h>
+#include "wx/wx.h"
#endif
-#include <wx/wxexpr.h>
+#if wxUSE_PROLOGIO
+#include "wx/deprecated/wxexpr.h"
+#endif
+
+#include "wx/ogl/ogl.h"
-#include <wx/ogl/basic.h>
-#include <wx/ogl/basicp.h>
-#include <wx/ogl/canvas.h>
-#include <wx/ogl/divided.h>
-#include <wx/ogl/lines.h>
-#include <wx/ogl/misc.h>
class wxDividedShapeControlPoint: public wxControlPoint
{
if (m_pen) dc.SetPen(* m_pen);
- if (m_textColour) dc.SetTextForeground(* m_textColour);
+ dc.SetTextForeground(m_textColour);
#ifdef __WXMSW__
// For efficiency, don't do this under X - doesn't make
if (!formatted)
{
FormatRegionText();
- formatted = TRUE;
+ formatted = true;
}
*/
if (GetDisableLabel()) return;
double yMargin = 2;
dc.SetBackgroundMode(wxTRANSPARENT);
- wxNode *node = GetRegions().GetFirst();
+ wxObjectList::compatibility_iterator node = GetRegions().GetFirst();
while (node)
{
wxShapeRegion *region = (wxShapeRegion *)node->GetData();
dc.SetFont(* region->GetFont());
- dc.SetTextForeground(* region->GetActualColourObject());
+ dc.SetTextForeground(region->GetActualColourObject());
double proportion =
region->m_regionProportionY < 0.0 ? defaultProportion : region->m_regionProportionY;
}
}
-void wxDividedShape::SetSize(double w, double h, bool recursive)
+void wxDividedShape::SetSize(double w, double h, bool WXUNUSED(recursive))
{
SetAttachmentSize(w, h);
m_width = w;
// double leftX = (double)(m_xpos - (m_width / 2.0));
// double rightX = (double)(m_xpos + (m_width / 2.0));
- wxNode *node = GetRegions().GetFirst();
+ wxObjectList::compatibility_iterator node = GetRegions().GetFirst();
while (node)
{
wxShapeRegion *region = (wxShapeRegion *)node->GetData();
// Left or right.
else
{
- int i = 0;
- bool isLeft = FALSE;
- if (attachment < (n+1))
- {
- i = attachment-1;
- isLeft = FALSE;
- }
- else
- {
- i = (totalNumberAttachments - attachment - 1);
- isLeft = TRUE;
- }
- wxNode *node = GetRegions().Item(i);
+ bool isLeft = !(attachment < (n+1));
+ int i = (isLeft) ? (totalNumberAttachments - attachment - 1) : (attachment-1);
+ wxObjectList::compatibility_iterator node = GetRegions().Item(i);
if (node)
{
wxShapeRegion *region = (wxShapeRegion *)node->GetData();
{
*x = m_xpos;
*y = m_ypos;
- return FALSE;
+ return false;
}
}
- return TRUE;
+ return true;
}
int wxDividedShape::GetNumberOfAttachments() const
int n = (GetRegions().GetCount() * 2) + 2;
int maxN = n - 1;
- wxNode *node = m_attachmentPoints.GetFirst();
+ wxObjectList::compatibility_iterator node = m_attachmentPoints.GetFirst();
while (node)
{
wxAttachmentPoint *point = (wxAttachmentPoint *)node->GetData();
return maxN + 1;
}
-bool wxDividedShape::AttachmentIsValid(int attachment)
+bool wxDividedShape::AttachmentIsValid(int attachment) const
{
int totalNumberAttachments = (GetRegions().GetCount() * 2) + 2;
if (attachment >= totalNumberAttachments)
return wxShape::AttachmentIsValid(attachment);
}
else if (attachment >= 0)
- return TRUE;
+ return true;
else
- return FALSE;
+ return false;
}
void wxDividedShape::Copy(wxShape& copy)
double currentY = (double)(GetY() - (m_height / 2.0));
double maxY = (double)(GetY() + (m_height / 2.0));
- wxNode *node = GetRegions().GetFirst();
+ wxObjectList::compatibility_iterator node = GetRegions().GetFirst();
int i = 0;
while (node)
{
double currentY = (double)(GetY() - (m_height / 2.0));
double maxY = (double)(GetY() + (m_height / 2.0));
- wxNode *node = m_controlPoints.GetFirst();
+ wxObjectList::compatibility_iterator node = m_controlPoints.GetFirst();
int i = 0;
while (node)
{
wxControlPoint *controlPoint = (wxControlPoint *)node->GetData();
if (controlPoint->IsKindOf(CLASSINFO(wxDividedShapeControlPoint)))
{
- wxNode *node1 = GetRegions().Item(i);
+ wxObjectList::compatibility_iterator node1 = GetRegions().Item(i);
wxShapeRegion *region = (wxShapeRegion *)node1->GetData();
double proportion = region->m_regionProportionY;
wxEndBusyCursor();
- dialog->Show(TRUE);
+ dialog->Show(true);
node = GetRegions().GetFirst();
i = 0;
}
// Implement resizing of divided object division
-void wxDividedShapeControlPoint::OnDragLeft(bool draw, double x, double y, int keys, int attachment)
+void wxDividedShapeControlPoint::OnDragLeft(bool WXUNUSED(draw), double WXUNUSED(x), double y, int WXUNUSED(keys), int WXUNUSED(attachment))
{
wxClientDC dc(GetCanvas());
GetCanvas()->PrepareDC(dc);
dc.SetLogicalFunction(OGLRBLF);
- wxPen dottedPen(wxColour(0, 0, 0), 1, wxDOT);
+ wxPen dottedPen(*wxBLACK, 1, wxDOT);
dc.SetPen(dottedPen);
dc.SetBrush((* wxTRANSPARENT_BRUSH));
dc.DrawLine(WXROUND(x1), WXROUND(y1), WXROUND(x2), WXROUND(y2));
}
-void wxDividedShapeControlPoint::OnBeginDragLeft(double x, double y, int keys, int attachment)
+void wxDividedShapeControlPoint::OnBeginDragLeft(double WXUNUSED(x), double y, int WXUNUSED(keys), int WXUNUSED(attachment))
{
wxClientDC dc(GetCanvas());
GetCanvas()->PrepareDC(dc);
wxDividedShape *dividedObject = (wxDividedShape *)m_shape;
dc.SetLogicalFunction(OGLRBLF);
- wxPen dottedPen(wxColour(0, 0, 0), 1, wxDOT);
+ wxPen dottedPen(*wxBLACK, 1, wxDOT);
dc.SetPen(dottedPen);
dc.SetBrush((* wxTRANSPARENT_BRUSH));
m_canvas->CaptureMouse();
}
-void wxDividedShapeControlPoint::OnEndDragLeft(double x, double y, int keys, int attachment)
+void wxDividedShapeControlPoint::OnEndDragLeft(double WXUNUSED(x), double y, int WXUNUSED(keys), int WXUNUSED(attachment))
{
wxClientDC dc(GetCanvas());
GetCanvas()->PrepareDC(dc);
wxDividedShape *dividedObject = (wxDividedShape *)m_shape;
- wxNode *node = dividedObject->GetRegions().Item(regionId);
+ wxObjectList::compatibility_iterator node = dividedObject->GetRegions().Item(regionId);
if (!node)
return;
// Save values
double thisRegionTop = 0.0;
- double thisRegionBottom = 0.0;
double nextRegionBottom = 0.0;
node = dividedObject->GetRegions().GetFirst();
if (region == thisRegion)
{
thisRegionTop = currentY;
- thisRegionBottom = actualY;
if (node->GetNext())
nextRegion = (wxShapeRegion *)node->GetNext()->GetData();
}
wxShapeRegion *region = (wxShapeRegion *)node->GetData();
if (region->GetText())
{
- wxChar *s = copystring(region->GetText());
- dividedObject->FormatText(dc, s, i);
- delete[] s;
+ wxString s(region->GetText());
+ dividedObject->FormatText(dc, s.c_str(), i);
}
node = node->GetNext();
i++;