wxMotif: wxWindow/Client/PaintDC starting to work.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@769 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -11,6 +11,9 @@ Updated: 21/9/98
|
||||
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.)
|
||||
|
@@ -901,6 +901,7 @@ typedef void* WXPixmap;
|
||||
typedef void* WXFontStructPtr;
|
||||
typedef void* WXGC;
|
||||
typedef void* WXRegion;
|
||||
typedef void* WXFont;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@@ -118,6 +118,7 @@ protected:
|
||||
int m_currentStyle ;
|
||||
int m_currentFill ;
|
||||
int m_autoSetting ; // See comment in dcclient.cpp
|
||||
WXFont m_oldFont;
|
||||
};
|
||||
|
||||
class WXDLLEXPORT wxPaintDC: public wxWindowDC
|
||||
|
@@ -62,9 +62,9 @@ wxStatusBar::wxStatusBar(void)
|
||||
|
||||
wxStatusBar::~wxStatusBar(void)
|
||||
{
|
||||
#ifdef __WXMSW__
|
||||
// #ifdef __WXMSW__
|
||||
SetFont(wxNullFont);
|
||||
#endif
|
||||
// #endif
|
||||
|
||||
if ( m_statusWidths )
|
||||
delete[] m_statusWidths;
|
||||
@@ -178,6 +178,8 @@ void wxStatusBar::OnPaint(wxPaintEvent& WXUNUSED(event) )
|
||||
|
||||
for ( i = 0; i < m_nFields; i ++ )
|
||||
DrawField(dc, i);
|
||||
|
||||
dc.SetFont(wxNullFont);
|
||||
}
|
||||
|
||||
void wxStatusBar::DrawFieldText(wxDC& dc, int i)
|
||||
|
@@ -73,6 +73,7 @@ wxColour::wxColour (const wxString& col)
|
||||
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
|
||||
@@ -82,9 +83,6 @@ wxColour::wxColour (const wxString& col)
|
||||
m_blue = 0;
|
||||
m_isInit = FALSE;
|
||||
}
|
||||
/* TODO
|
||||
m_pixel = PALETTERGB (m_red, m_green, m_blue);
|
||||
*/
|
||||
}
|
||||
|
||||
wxColour::~wxColour ()
|
||||
@@ -99,6 +97,7 @@ wxColour& wxColour::operator = (const wxString& col)
|
||||
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
|
||||
@@ -108,9 +107,7 @@ wxColour& wxColour::operator = (const wxString& col)
|
||||
m_blue = 0;
|
||||
m_isInit = FALSE;
|
||||
}
|
||||
/* TODO
|
||||
m_pixel = PALETTERGB (m_red, m_green, m_blue);
|
||||
*/
|
||||
|
||||
return (*this);
|
||||
}
|
||||
|
||||
@@ -120,9 +117,7 @@ void wxColour::Set (unsigned char r, unsigned char g, unsigned char b)
|
||||
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.
|
||||
|
@@ -89,6 +89,7 @@ wxWindowDC::wxWindowDC(void)
|
||||
m_userRegion = (WXRegion) 0;
|
||||
m_pixmap = (WXPixmap) 0;
|
||||
m_autoSetting = 0;
|
||||
m_oldFont = (WXFont) 0;
|
||||
};
|
||||
|
||||
wxWindowDC::wxWindowDC( wxWindow *window )
|
||||
@@ -136,10 +137,23 @@ 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;
|
||||
@@ -1323,7 +1337,16 @@ void wxWindowDC::SetFont( const wxFont &font )
|
||||
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);
|
||||
|
||||
@@ -1339,7 +1362,7 @@ void wxWindowDC::SetPen( const wxPen &pen )
|
||||
if (!Ok()) return;
|
||||
|
||||
m_pen = pen;
|
||||
if (m_pen.Ok())
|
||||
if (!m_pen.Ok())
|
||||
return;
|
||||
|
||||
wxBitmap oldStipple = m_currentStipple;
|
||||
|
@@ -56,7 +56,10 @@ wxFontRefData::~wxFontRefData()
|
||||
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();
|
||||
@@ -290,6 +293,7 @@ WXFontStructPtr wxFont::FindOrCreateFontStruct(double scale)
|
||||
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)
|
||||
{
|
||||
|
@@ -18,37 +18,83 @@
|
||||
#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;
|
||||
}
|
||||
}
|
||||
|
@@ -419,7 +419,9 @@ bool wxWindow::Create(wxWindow *parent, wxWindowID id,
|
||||
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()
|
||||
@@ -759,6 +761,8 @@ void wxWindow::Refresh(bool eraseBack, const wxRectangle *rect)
|
||||
if (eraseBack)
|
||||
{
|
||||
wxClientDC dc(this);
|
||||
wxBrush backgroundBrush(GetBackgroundColour(), wxSOLID);
|
||||
dc.SetBackground(backgroundBrush);
|
||||
dc.Clear();
|
||||
}
|
||||
|
||||
@@ -1553,7 +1557,7 @@ void wxWindow::OnDefaultAction(wxControl *initiatingItem)
|
||||
|
||||
void wxWindow::Clear()
|
||||
{
|
||||
wxClientDC dc(this);
|
||||
wxClientDC dc(this);
|
||||
wxBrush brush(GetBackgroundColour(), wxSOLID);
|
||||
dc.SetBackground(brush);
|
||||
dc.Clear();
|
||||
|
Reference in New Issue
Block a user