projects
/
wxWidgets.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fixing a few typos, wxAny copy constructor implementation, making wxAnyList available...
[wxWidgets.git]
/
src
/
x11
/
dcclient.cpp
diff --git
a/src/x11/dcclient.cpp
b/src/x11/dcclient.cpp
index 68164906c92e6b0bf205ad29d5ab20d6ba5a6b65..3f127c442b8cadd29f1543ef6b2601a49e2dfe9a 100644
(file)
--- a/
src/x11/dcclient.cpp
+++ b/
src/x11/dcclient.cpp
@@
-62,7
+62,7
@@
#define IS_16_PIX_HATCH(s) ((s)!=wxCROSSDIAG_HATCH && (s)!=wxHORIZONTAL_HATCH && (s)!=wxVERTICAL_HATCH)
static Pixmap hatches[num_hatches];
#define IS_16_PIX_HATCH(s) ((s)!=wxCROSSDIAG_HATCH && (s)!=wxHORIZONTAL_HATCH && (s)!=wxVERTICAL_HATCH)
static Pixmap hatches[num_hatches];
-static Pixmap *hatch_bitmap =
(Pixmap *)
NULL;
+static Pixmap *hatch_bitmap = NULL;
//-----------------------------------------------------------------------------
// constants
//-----------------------------------------------------------------------------
// constants
@@
-183,7
+183,7
@@
wxWindowDCImpl::wxWindowDCImpl( wxDC* owner, wxWindow *window )
m_font = window->GetFont();
m_font = window->GetFont();
- m_x11window = (WXWindow*) window->GetMainWindow();
+ m_x11window = (WXWindow*) window->
X11
GetMainWindow();
// not realized ?
if (!m_x11window)
// not realized ?
if (!m_x11window)
@@
-222,19
+222,19
@@
wxWindowDCImpl::~wxWindowDCImpl()
void wxWindowDCImpl::Init()
{
void wxWindowDCImpl::Init()
{
- m_display =
(WXDisplay *)
NULL;
- m_penGC =
(WXGC *)
NULL;
- m_brushGC =
(WXGC *)
NULL;
- m_textGC =
(WXGC *)
NULL;
- m_bgGC =
(WXGC *)
NULL;
- m_cmap =
(WXColormap *)
NULL;
+ m_display = NULL;
+ m_penGC = NULL;
+ m_brushGC = NULL;
+ m_textGC = NULL;
+ m_bgGC = NULL;
+ m_cmap = NULL;
m_isMemDC = false;
m_isScreenDC = false;
m_isMemDC = false;
m_isScreenDC = false;
- m_x11window =
(WXWindow*)
NULL;
+ m_x11window = NULL;
#if wxUSE_UNICODE
m_context = wxTheApp->GetPangoContext();
#if wxUSE_UNICODE
m_context = wxTheApp->GetPangoContext();
- m_fontdesc =
(PangoFontDescription *)
NULL;
+ m_fontdesc = NULL;
#endif
}
#endif
}
@@
-345,7
+345,7
@@
void wxWindowDCImpl::SetUpDC()
void wxWindowDCImpl::DoGetSize( int* width, int* height ) const
{
void wxWindowDCImpl::DoGetSize( int* width, int* height ) const
{
- wxCHECK_RET( m_window,
_
T("GetSize() doesn't work without window") );
+ wxCHECK_RET( m_window,
wx
T("GetSize() doesn't work without window") );
m_window->GetSize(width, height);
}
m_window->GetSize(width, height);
}
@@
-1291,7
+1291,7
@@
void wxWindowDCImpl::DoDrawBitmap( const wxBitmap &bitmap,
// wxUSE_NANOX/!wxUSE_NANOX
bool wxWindowDCImpl::DoBlit( wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
// wxUSE_NANOX/!wxUSE_NANOX
bool wxWindowDCImpl::DoBlit( wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
- wxDC *source, wxCoord xsrc, wxCoord ysrc,
+ wxDC *source, wxCoord xsrc, wxCoord ysrc,
wxRasterOperationMode logical_func, bool useMask,
wxCoord xsrcMask, wxCoord ysrcMask )
{
wxRasterOperationMode logical_func, bool useMask,
wxCoord xsrcMask, wxCoord ysrcMask )
{
@@
-1570,8
+1570,8
@@
void wxWindowDCImpl::DoDrawText( const wxString &text, wxCoord x, wxCoord y )
PangoLayout *layout = pango_layout_new(m_context);
pango_layout_set_font_description(layout, m_fontdesc);
PangoLayout *layout = pango_layout_new(m_context);
pango_layout_set_font_description(layout, m_fontdesc);
- const wx
CharBuffer data = wxConvUTF8.cWC2MB( text
);
- pango_layout_set_text(layout,
(const char*) data, strlen( (const char*) data
));
+ const wx
ScopedCharBuffer data(text.utf8_str()
);
+ pango_layout_set_text(layout,
data, data.length(
));
// Measure layout.
int w,h;
// Measure layout.
int w,h;
@@
-1658,7
+1658,9
@@
void wxWindowDCImpl::DoGetTextExtent( const wxString &string, wxCoord *width, wx
wxCoord *descent, wxCoord *externalLeading,
const wxFont *font ) const
{
wxCoord *descent, wxCoord *externalLeading,
const wxFont *font ) const
{
- wxCHECK_RET( IsOk(), wxT("invalid dc") );
+ // Do not test for DC validity here, querying text extents is supposed to
+ // work even with a non-initialized wxMemoryDC. And the code below does
+ // actually work in this case.
if (string.empty())
{
if (string.empty())
{
@@
-1675,8
+1677,8
@@
void wxWindowDCImpl::DoGetTextExtent( const wxString &string, wxCoord *width, wx
else
pango_layout_set_font_description(layout, m_fontdesc);
else
pango_layout_set_font_description(layout, m_fontdesc);
- const wx
CharBuffer data = wxConvUTF8.cWC2MB( string
);
- pango_layout_set_text(layout,
(const char*) data, strlen( (const char*) data
));
+ const wx
ScopedCharBuffer data(string.utf8_str()
);
+ pango_layout_set_text(layout,
data, data.length(
));
// Measure text.
int w,h;
// Measure text.
int w,h;
@@
-1721,7
+1723,8
@@
void wxWindowDCImpl::DoGetTextExtent( const wxString &string, wxCoord *width, wx
wxCoord wxWindowDCImpl::GetCharWidth() const
{
wxCoord wxWindowDCImpl::GetCharWidth() const
{
- wxCHECK_MSG( IsOk(), 0, wxT("invalid dc") );
+ // Do not test for DC validity here for the same reasons as in
+ // DoGetTextExtent() above.
#if wxUSE_UNICODE
PangoLayout *layout = pango_layout_new( m_context );
#if wxUSE_UNICODE
PangoLayout *layout = pango_layout_new( m_context );
@@
-1755,7
+1758,8
@@
wxCoord wxWindowDCImpl::GetCharWidth() const
wxCoord wxWindowDCImpl::GetCharHeight() const
{
wxCoord wxWindowDCImpl::GetCharHeight() const
{
- wxCHECK_MSG( IsOk(), 0, wxT("invalid dc") );
+ // Do not test for DC validity here for the same reasons as in
+ // DoGetTextExtent() above.
#if wxUSE_UNICODE
PangoLayout *layout = pango_layout_new( m_context );
#if wxUSE_UNICODE
PangoLayout *layout = pango_layout_new( m_context );
@@
-1913,7
+1917,7
@@
void wxWindowDCImpl::SetPen( const wxPen &pen )
default:
{
lineStyle = LineSolid;
default:
{
lineStyle = LineSolid;
- req_dash =
(wxX11Dash*)
NULL;
+ req_dash = NULL;
req_nb_dash = 0;
break;
}
req_nb_dash = 0;
break;
}
@@
-2351,12
+2355,12
@@
IMPLEMENT_ABSTRACT_CLASS(wxClientDCImpl, wxWindowDCImpl)
wxClientDCImpl::wxClientDCImpl( wxDC *owner, wxWindow *window )
: wxWindowDCImpl( owner, window )
{
wxClientDCImpl::wxClientDCImpl( wxDC *owner, wxWindow *window )
: wxWindowDCImpl( owner, window )
{
- wxCHECK_RET( window,
_
T("NULL window in wxClientDC::wxClientDC") );
+ wxCHECK_RET( window,
wx
T("NULL window in wxClientDC::wxClientDC") );
m_x11window = (WXWindow*) window->GetClientAreaWindow();
// Adjust the client area when the wxWindow is not using 2 X11 windows.
m_x11window = (WXWindow*) window->GetClientAreaWindow();
// Adjust the client area when the wxWindow is not using 2 X11 windows.
- if (m_x11window == (WXWindow*) window->GetMainWindow())
+ if (m_x11window == (WXWindow*) window->
X11
GetMainWindow())
{
wxPoint ptOrigin = window->GetClientAreaOrigin();
SetDeviceOrigin(ptOrigin.x, ptOrigin.y);
{
wxPoint ptOrigin = window->GetClientAreaOrigin();
SetDeviceOrigin(ptOrigin.x, ptOrigin.y);
@@
-2367,7
+2371,7
@@
wxClientDCImpl::wxClientDCImpl( wxDC *owner, wxWindow *window )
void wxClientDCImpl::DoGetSize(int *width, int *height) const
{
void wxClientDCImpl::DoGetSize(int *width, int *height) const
{
- wxCHECK_RET( m_window,
_
T("GetSize() doesn't work without window") );
+ wxCHECK_RET( m_window,
wx
T("GetSize() doesn't work without window") );
m_window->GetClientSize( width, height );
}
m_window->GetClientSize( width, height );
}
@@
-2410,7
+2414,7
@@
public:
// display
wxDCModule()
{
// display
wxDCModule()
{
- AddDependency(wxClassInfo::FindClass(
_
T("wxX11DisplayModule")));
+ AddDependency(wxClassInfo::FindClass(
wx
T("wxX11DisplayModule")));
}
bool OnInit() { wxInitGCPool(); return true; }
}
bool OnInit() { wxInitGCPool(); return true; }