#endif
// For compilers that support precompilation, includes "wx.h".
-#include <wx/wxprec.h>
+#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
m_textColour = wxBLACK;
m_textColourName = "BLACK";
m_visible = FALSE;
- m_clientData = NULL;
m_selected = FALSE;
m_attachmentMode = ATTACHMENT_MODE_NONE;
m_spaceAttachments = TRUE;
if (m_canvas)
m_canvas->RemoveShape(this);
- if (m_clientData) {
- delete m_clientData;
- m_clientData = NULL;
- }
-
GetEventHandler()->OnDelete();
}
void wxShape::NameRegions(const wxString& parentName)
{
int n = GetNumberOfTextRegions();
- char buf[100];
+ wxString buff;
for (int i = 0; i < n; i++)
{
if (parentName.Length() > 0)
- sprintf(buf, "%s.%d", (const char*) parentName, i);
+ buff << parentName << "." << i;
else
- sprintf(buf, "%d", i);
- SetRegionName(buf, i);
+ buff << i;
+ SetRegionName(buff, i);
}
wxNode *node = m_children.First();
int j = 0;
while (node)
{
+ buff.Empty();
wxShape *child = (wxShape *)node->Data();
if (parentName.Length() > 0)
- sprintf(buf, "%s.%d", (const char*) parentName, j);
+ buff << parentName << "." << j;
else
- sprintf(buf, "%d", j);
- child->NameRegions(buf);
+ buff << j;
+ child->NameRegions(buff);
node = node->Next();
j ++;
}
for (int i = 0; i < n; i++)
{
wxString name(GetRegionName(i));
- list.Add((const char*) name);
+ list.Add(name);
}
wxNode *node = m_children.First();
if (m_pen)
penWidth = m_pen->GetWidth();
- dc.SetPen(* g_oglWhiteBackgroundPen);
- dc.SetBrush(* g_oglWhiteBackgroundBrush);
+ dc.SetPen(GetBackgroundPen());
+ dc.SetBrush(GetBackgroundBrush());
+
dc.DrawRectangle(WXROUND(topLeftX - penWidth), WXROUND(topLeftY - penWidth),
WXROUND(maxX + penWidth*2.0 + 4.0), WXROUND(maxY + penWidth*2.0 + 4.0));
}
}
}
wxShapeTextLine *line =
- new wxShapeTextLine(the_x, the_y, (char*) (const char*) the_string);
+ new wxShapeTextLine(the_x, the_y, the_string);
m_text.Append(line);
node = node->next;
if (the_string)
{
wxShapeTextLine *line =
- new wxShapeTextLine(the_x, the_y, (char*) (const char*) the_string);
+ new wxShapeTextLine(the_x, the_y, the_string);
region->m_formattedText.Append(line);
}
node = node->next;
}
default:
{
- wxFAIL_MSG( "Unrecognised attachment point in GetBranchingAttachmentInfo." );
+ wxFAIL_MSG( wxT("Unrecognised attachment point in GetBranchingAttachmentInfo.") );
break;
}
}
}
default:
{
- wxFAIL_MSG( "Unrecognised attachment point in GetBranchingAttachmentPoint." );
+ wxFAIL_MSG( wxT("Unrecognised attachment point in GetBranchingAttachmentPoint.") );
break;
}
}
}
default:
{
- wxFAIL_MSG( "Unrecognised attachment point in GetBranchingAttachmentRoot." );
+ wxFAIL_MSG( wxT("Unrecognised attachment point in GetBranchingAttachmentRoot.") );
break;
}
}
}
}
+
+wxPen wxShape::GetBackgroundPen()
+{
+ if (GetCanvas())
+ {
+ wxColour c = GetCanvas()->GetBackgroundColour();
+ return wxPen(c, 1, wxSOLID);
+ }
+ return * g_oglWhiteBackgroundPen;
+}
+
+
+wxBrush wxShape::GetBackgroundBrush()
+{
+ if (GetCanvas())
+ {
+ wxColour c = GetCanvas()->GetBackgroundColour();
+ return wxBrush(c, wxSOLID);
+ }
+ return * g_oglWhiteBackgroundBrush;
+}
+