#endif
#ifdef __WXMOTIF__
+#ifdef __VMS__
+#pragma message disable nosimpint
+#endif
#include <Xm/Xm.h>
+#ifdef __VMS__
+#pragma message enable nosimpint
+#endif
#endif
-#if !USE_SHARED_LIBRARY
IMPLEMENT_CLASS(wxColourDatabase, wxList)
IMPLEMENT_DYNAMIC_CLASS(wxFontList, wxList)
IMPLEMENT_DYNAMIC_CLASS(wxPenList, wxList)
IMPLEMENT_DYNAMIC_CLASS(wxResourceCache, wxList)
IMPLEMENT_ABSTRACT_CLASS(wxDCBase, wxObject)
-#endif
wxRect::wxRect(const wxPoint& topLeft, const wxPoint& bottomRight)
{
// wxFontPool = new XFontPool;
#endif
- wxNORMAL_FONT = new wxFont (12, wxMODERN, wxNORMAL, wxNORMAL);
- wxSMALL_FONT = new wxFont (10, wxSWISS, wxNORMAL, wxNORMAL);
- wxITALIC_FONT = new wxFont (12, wxROMAN, wxITALIC, wxNORMAL);
- wxSWISS_FONT = new wxFont (12, wxSWISS, wxNORMAL, wxNORMAL);
+ // why under MSW fonts shouldn't have the standard system size?
+#ifdef __WXMSW__
+ static const int sizeFont = 10;
+#else
+ static const int sizeFont = 12;
+#endif
+
+ wxNORMAL_FONT = new wxFont (sizeFont, wxMODERN, wxNORMAL, wxNORMAL);
+ wxSMALL_FONT = new wxFont (sizeFont - 2, wxSWISS, wxNORMAL, wxNORMAL);
+ wxITALIC_FONT = new wxFont (sizeFont, wxROMAN, wxITALIC, wxNORMAL);
+ wxSWISS_FONT = new wxFont (sizeFont, wxSWISS, wxNORMAL, wxNORMAL);
wxRED_PEN = new wxPen ("RED", 1, wxSOLID);
wxCYAN_PEN = new wxPen ("CYAN", 1, wxSOLID);
wxBitmapList::~wxBitmapList ()
{
-#if defined(__WXMSW__) || defined(__WXMOTIF__)
wxNode *node = First ();
while (node)
{
delete bitmap;
node = next;
}
-#endif
}
// Pen and Brush lists
wxPenList::~wxPenList ()
{
-#if defined(__WXMSW__) || defined(__WXMOTIF__)
wxNode *node = First ();
while (node)
{
delete pen;
node = next;
}
-#endif
}
void wxPenList::AddPen (wxPen * pen)
for (wxNode * node = First (); node; node = node->Next ())
{
wxPen *each_pen = (wxPen *) node->Data ();
- if (each_pen && each_pen->GetVisible() &&
+ if (each_pen &&
+ each_pen->GetVisible() &&
each_pen->GetWidth () == width &&
each_pen->GetStyle () == style &&
each_pen->GetColour ().Red () == colour.Red () &&
// returning a pointer to an automatic variable and hanging on to it
// (dangling pointer).
pen->SetVisible(TRUE);
+
return pen;
}
wxBrushList::~wxBrushList ()
{
-#if defined(__WXMSW__) || defined(__WXMOTIF__)
wxNode *node = First ();
while (node)
{
delete brush;
node = next;
}
-#endif
}
void wxBrushList::AddBrush (wxBrush * brush)
for (wxNode * node = First (); node; node = node->Next ())
{
wxBrush *each_brush = (wxBrush *) node->Data ();
- if (each_brush && each_brush->GetVisible() &&
+ if (each_brush &&
+ each_brush->GetVisible() &&
each_brush->GetStyle () == style &&
each_brush->GetColour ().Red () == colour.Red () &&
each_brush->GetColour ().Green () == colour.Green () &&
each_brush->GetColour ().Blue () == colour.Blue ())
return each_brush;
}
+
// Yes, we can return a pointer to this in a later FindOrCreateBrush call,
// because we created it within FindOrCreateBrush. Safeguards against
// returning a pointer to an automatic variable and hanging on to it
// (dangling pointer).
wxBrush *brush = new wxBrush (colour, style);
+
brush->SetVisible(TRUE);
+
return brush;
}
wxFontList::~wxFontList ()
{
- wxNode *node = First ();
- while (node)
+ wxNode *node = First ();
+ while (node)
{
- // Only delete objects that are 'visible', i.e.
- // that have been created using FindOrCreate...,
- // where the pointers are expected to be shared
- // (and therefore not deleted by any one part of an app).
- wxFont *font = (wxFont *) node->Data ();
- wxNode *next = node->Next ();
- if (font->GetVisible())
- delete font;
- node = next;
-}
+ // Only delete objects that are 'visible', i.e.
+ // that have been created using FindOrCreate...,
+ // where the pointers are expected to be shared
+ // (and therefore not deleted by any one part of an app).
+ wxFont *font = (wxFont *) node->Data ();
+ wxNode *next = node->Next ();
+ if (font->GetVisible())
+ delete font;
+ node = next;
+ }
}
void wxFontList::AddFont (wxFont * font)
}
wxFont *wxFontList::
- FindOrCreateFont (int PointSize, int FamilyOrFontId, int Style, int Weight, bool underline, const wxString& Face)
+ FindOrCreateFont (int PointSize, int FamilyOrFontId, int Style, int Weight, bool underline, const wxString& Face, wxFontEncoding encoding)
{
for (wxNode * node = First (); node; node = node->Next ())
{
wxFont *each_font = (wxFont *) node->Data ();
- if (each_font && each_font->GetVisible() && each_font->Ok() &&
+ if (each_font &&
+ each_font->GetVisible() &&
+ each_font->Ok() &&
each_font->GetPointSize () == PointSize &&
each_font->GetStyle () == Style &&
each_font->GetWeight () == Weight &&
each_font->GetUnderlined () == underline &&
- //#if defined(__X__)
- // each_font->GetFontId () == FamilyOrFontId) /* New font system */
- //#else
#if defined(__WXGTK__)
(each_font->GetFamily() == FamilyOrFontId ||
- (each_font->GetFamily() == wxSWISS && FamilyOrFontId == wxDEFAULT)) &&
+ (each_font->GetFamily() == wxSWISS && FamilyOrFontId == wxDEFAULT)) &&
#else
each_font->GetFamily() == FamilyOrFontId &&
#endif
- ((each_font->GetFaceName() == wxT("")) || each_font->GetFaceName() == Face))
- //#endif
+ ((each_font->GetFaceName() == wxT("")) || each_font->GetFaceName() == Face) &&
+ (encoding == wxFONTENCODING_DEFAULT || each_font->GetEncoding() == encoding))
return each_font;
}
- wxFont *font = new wxFont (PointSize, FamilyOrFontId, Style, Weight, underline, Face);
+ wxFont *font = new wxFont (PointSize, FamilyOrFontId, Style, Weight, underline, Face, encoding);
+
font->SetVisible(TRUE);
+
return font;
}