libxpm exists and use that? What about PNGs? Can we use gdk
as per wxGTK? Probably not.
+- Work out why XFreeFont in font.cpp produces a segv. This is
+ currently commented out, which presumably causes a memory leak.
+
- wxRegion
- Bitmap versions of widgets (wxBitmapButton etc.)
typedef void* WXFontStructPtr;
typedef void* WXGC;
typedef void* WXRegion;
+typedef void* WXFont;
#endif
#endif
int m_currentStyle ;
int m_currentFill ;
int m_autoSetting ; // See comment in dcclient.cpp
+ WXFont m_oldFont;
};
class WXDLLEXPORT wxPaintDC: public wxWindowDC
wxStatusBar::~wxStatusBar(void)
{
-#ifdef __WXMSW__
+ // #ifdef __WXMSW__
SetFont(wxNullFont);
-#endif
+ // #endif
if ( m_statusWidths )
delete[] m_statusWidths;
for ( i = 0; i < m_nFields; i ++ )
DrawField(dc, i);
+
+ dc.SetFont(wxNullFont);
}
void wxStatusBar::DrawFieldText(wxDC& dc, int i)
m_red = the_colour->Red ();
m_green = the_colour->Green ();
m_blue = the_colour->Blue ();
+ m_pixel = the_colour->m_pixel;
m_isInit = TRUE;
}
else
m_blue = 0;
m_isInit = FALSE;
}
-/* TODO
- m_pixel = PALETTERGB (m_red, m_green, m_blue);
-*/
}
wxColour::~wxColour ()
m_red = the_colour->Red ();
m_green = the_colour->Green ();
m_blue = the_colour->Blue ();
+ m_pixel = the_colour->m_pixel;
m_isInit = TRUE;
}
else
m_blue = 0;
m_isInit = FALSE;
}
-/* TODO
- m_pixel = PALETTERGB (m_red, m_green, m_blue);
-*/
+
return (*this);
}
m_green = g;
m_blue = b;
m_isInit = TRUE;
-/* TODO
- m_pixel = PALETTERGB (m_red, m_green, m_blue);
-*/
+ m_pixel = -1;
}
// Allocate a colour, or nearest colour, using the given display.
m_userRegion = (WXRegion) 0;
m_pixmap = (WXPixmap) 0;
m_autoSetting = 0;
+ m_oldFont = (WXFont) 0;
};
wxWindowDC::wxWindowDC( wxWindow *window )
}
m_backgroundPixel = (int) gcvalues.background;
+
+ // Get the current Font so we can set it back later
+ XGCValues valReturn;
+ XGetGCValues((Display*) m_display, (GC) m_gc, GCFont, &valReturn);
+ m_oldFont = (WXFont) valReturn.font;
};
wxWindowDC::~wxWindowDC(void)
{
+ if ((m_oldFont != (WXFont) 0) && ((long) m_oldFont != -1))
+ {
+ XSetFont ((Display*) m_display, (GC) m_gc, (Font) m_oldFont);
+
+ if (m_window && m_window->GetBackingPixmap())
+ XSetFont ((Display*) m_display,(GC) m_gcBacking, (Font) m_oldFont);
+ }
+
if (m_gc)
XFreeGC ((Display*) m_display, (GC) m_gc);
m_gc = (WXGC) 0;
m_font = font;
if (!m_font.Ok())
+ {
+ if ((m_oldFont != (WXFont) 0) && ((long) m_oldFont != -1))
+ {
+ XSetFont ((Display*) m_display, (GC) m_gc, (Font) m_oldFont);
+
+ if (m_window && m_window->GetBackingPixmap())
+ XSetFont ((Display*) m_display,(GC) m_gcBacking, (Font) m_oldFont);
+ }
return;
+ }
WXFontStructPtr pFontStruct = m_font.FindOrCreateFontStruct(m_userScaleY*m_logicalScaleY);
if (!Ok()) return;
m_pen = pen;
- if (m_pen.Ok())
+ if (!m_pen.Ok())
return;
wxBitmap oldStipple = m_currentStipple;
while (node)
{
XFontStruct* fontStruct = (XFontStruct*) node->Data();
- XFreeFont((Display*) wxGetDisplay, fontStruct);
+ // TODO: why does freeing the font produce a segv???
+ // Commenting it out will result in memory leaks, and
+ // maybe X resource problems, who knows...
+ // XFreeFont((Display*) wxGetDisplay, fontStruct);
node = node->Next();
}
m_fontsByScale.Clear();
if (!font)
font = LoadQueryFont(120, wxDEFAULT, wxNORMAL, wxNORMAL,
M_FONTDATA->m_underlined);
+ wxASSERT_MSG( (font != (XFontStruct*) NULL), "Could not allocate even a default font -- something is wrong." );
}
if (font)
{
#endif
#include "wx/settings.h"
+#include "wx/gdicmn.h"
wxColour wxSystemSettings::GetSystemColour(int index)
{
- // TODO
- return wxColour();
+ switch (index)
+ {
+ case wxSYS_COLOUR_SCROLLBAR:
+ // case wxSYS_COLOUR_DESKTOP: // Same as wxSYS_COLOUR_BACKGROUND
+ case wxSYS_COLOUR_BACKGROUND:
+ case wxSYS_COLOUR_ACTIVECAPTION:
+ case wxSYS_COLOUR_INACTIVECAPTION:
+ case wxSYS_COLOUR_MENU:
+ case wxSYS_COLOUR_WINDOW:
+ case wxSYS_COLOUR_WINDOWFRAME:
+ case wxSYS_COLOUR_ACTIVEBORDER:
+ case wxSYS_COLOUR_INACTIVEBORDER:
+ case wxSYS_COLOUR_BTNFACE:
+ // case wxSYS_COLOUR_3DFACE: // Same as wxSYS_COLOUR_BTNFACE
+ case wxSYS_COLOUR_GRAYTEXT:
+ {
+ return wxColour("LIGHT GREY");
+ }
+ case wxSYS_COLOUR_BTNSHADOW:
+ // case wxSYS_COLOUR_3DSHADOW: // Same as wxSYS_COLOUR_BTNSHADOW
+ {
+ return wxColour("GREY");
+ }
+ case wxSYS_COLOUR_3DDKSHADOW:
+ {
+ return *wxBLACK;
+ }
+ case wxSYS_COLOUR_HIGHLIGHT:
+ case wxSYS_COLOUR_BTNHIGHLIGHT:
+ // case wxSYS_COLOUR_3DHIGHLIGHT: // Same as wxSYS_COLOUR_BTNHIGHLIGHT
+ {
+ return *wxWHITE;
+ }
+ case wxSYS_COLOUR_3DLIGHT:
+ {
+ return wxColour("LIGHT GREY");
+ }
+ case wxSYS_COLOUR_MENUTEXT:
+ case wxSYS_COLOUR_WINDOWTEXT:
+ case wxSYS_COLOUR_CAPTIONTEXT:
+ case wxSYS_COLOUR_INACTIVECAPTIONTEXT:
+ case wxSYS_COLOUR_INFOTEXT:
+ {
+ return *wxBLACK;
+ }
+ case wxSYS_COLOUR_HIGHLIGHTTEXT:
+ {
+ return *wxWHITE;
+ }
+ case wxSYS_COLOUR_INFOBK:
+ case wxSYS_COLOUR_APPWORKSPACE:
+ {
+ return *wxWHITE;
+ }
+ }
+ return *wxWHITE;
}
wxFont wxSystemSettings::GetSystemFont(int index)
{
- // TODO
switch (index)
{
- case wxSYS_DEVICE_DEFAULT_FONT:
- {
- break;
- }
- case wxSYS_DEFAULT_PALETTE:
- {
- break;
- }
case wxSYS_SYSTEM_FIXED_FONT:
{
+ return wxFont(12, wxMODERN, wxNORMAL, wxNORMAL, FALSE);
break;
}
+ case wxSYS_DEVICE_DEFAULT_FONT:
case wxSYS_SYSTEM_FONT:
- {
- break;
- }
- default:
case wxSYS_DEFAULT_GUI_FONT:
+ default:
{
+ return wxFont(12, wxSWISS, wxNORMAL, wxNORMAL, FALSE);
break;
}
}
XtAddEventHandler ((Widget) m_drawingArea, PointerMotionHintMask | EnterWindowMask | LeaveWindowMask | FocusChangeMask,
False, (XtEventHandler) wxCanvasEnterLeave, (XtPointer) this);
- return TRUE;
+ SetSize(pos.x, pos.y, size.x, size.y);
+
+ return TRUE;
}
void wxWindow::SetFocus()
if (eraseBack)
{
wxClientDC dc(this);
+ wxBrush backgroundBrush(GetBackgroundColour(), wxSOLID);
+ dc.SetBackground(backgroundBrush);
dc.Clear();
}
void wxWindow::Clear()
{
- wxClientDC dc(this);
+ wxClientDC dc(this);
wxBrush brush(GetBackgroundColour(), wxSOLID);
dc.SetBackground(brush);
dc.Clear();