Fixed 5 bugs in wxImage and Blit
Removed warning messages Some more clientdata fiddleing Added bitmap support to wxTreeCtrl Fixed some bugs in wxTreeCtrl Added licence.txt to /docs/gtk/ git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@968 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1130,8 +1130,14 @@ wxDocTemplate *wxDocManager::FindTemplateForPath(const wxString& path)
|
||||
// How to implement in wxWindows? Must extend the file selector
|
||||
// dialog or implement own; OR match the extension to the
|
||||
// template extension.
|
||||
|
||||
#ifdef __WXMSW__
|
||||
wxDocTemplate *wxDocManager::SelectDocumentPath(wxDocTemplate **templates,
|
||||
int noTemplates, wxString& path, long WXUNUSED(flags), bool WXUNUSED(save))
|
||||
#else
|
||||
wxDocTemplate *wxDocManager::SelectDocumentPath(wxDocTemplate **WXUNUSED(templates),
|
||||
int WXUNUSED(noTemplates), wxString& path, long WXUNUSED(flags), bool WXUNUSED(save))
|
||||
#endif
|
||||
{
|
||||
// We can only have multiple filters in Windows
|
||||
#ifdef __WXMSW__
|
||||
|
@@ -834,7 +834,7 @@ bool wxBMPHandler::LoadFile( wxImage *image, const wxString& name )
|
||||
|
||||
for (i = 0; i < absolute; i++)
|
||||
{
|
||||
+linepos++;
|
||||
linepos++;
|
||||
byte = getc(file);
|
||||
ptr[poffset] = cmap[byte].r;
|
||||
ptr[poffset + 1] = cmap[byte].g;
|
||||
|
@@ -420,17 +420,17 @@ wxStreamBase::~wxStreamBase()
|
||||
{
|
||||
}
|
||||
|
||||
size_t wxStreamBase::OnSysRead(void *buffer, size_t size)
|
||||
size_t wxStreamBase::OnSysRead(void *WXUNUSED(buffer), size_t WXUNUSED(size))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
size_t wxStreamBase::OnSysWrite(const void *buffer, size_t bufsize)
|
||||
size_t wxStreamBase::OnSysWrite(const void *WXUNUSED(buffer), size_t WXUNUSED(bufsize))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
off_t wxStreamBase::OnSysSeek(off_t seek, wxSeekMode mode)
|
||||
off_t wxStreamBase::OnSysSeek(off_t WXUNUSED(seek), wxSeekMode WXUNUSED(mode))
|
||||
{
|
||||
return wxInvalidOffset;
|
||||
}
|
||||
|
@@ -338,7 +338,7 @@ void wxSingleChoiceDialog::OnOK(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
m_selection = listBox->GetSelection();
|
||||
m_stringSelection = listBox->GetStringSelection();
|
||||
m_clientData = listBox->GetClientData(m_selection);
|
||||
m_clientData = (char*)listBox->GetClientData(m_selection);
|
||||
}
|
||||
|
||||
EndModal(wxID_OK);
|
||||
@@ -351,7 +351,7 @@ void wxSingleChoiceDialog::OnListBoxDClick(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
m_selection = listBox->GetSelection();
|
||||
m_stringSelection = listBox->GetStringSelection();
|
||||
m_clientData = listBox->GetClientData(m_selection);
|
||||
m_clientData = (char*)listBox->GetClientData(m_selection);
|
||||
}
|
||||
|
||||
EndModal(wxID_OK);
|
||||
|
@@ -27,6 +27,7 @@
|
||||
#include "wx/intl.h"
|
||||
#include "wx/dynarray.h"
|
||||
#include "wx/dcclient.h"
|
||||
#include "wx/imaglist.h"
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// array types
|
||||
@@ -165,6 +166,7 @@ wxGenericTreeItem::wxGenericTreeItem(wxGenericTreeItem *parent,
|
||||
|
||||
m_isCollapsed = TRUE;
|
||||
m_hasHilight = FALSE;
|
||||
m_hasPlus = FALSE;
|
||||
|
||||
m_parent = parent;
|
||||
|
||||
@@ -227,14 +229,17 @@ void wxGenericTreeItem::SetCross( int x, int y )
|
||||
void wxGenericTreeItem::GetSize( int &x, int &y )
|
||||
{
|
||||
// FIXME what does this all mean??
|
||||
if ( y < m_y + 10 ) y = m_y +10;
|
||||
if ( y < m_y ) y = m_y;
|
||||
int width = m_x + m_width;
|
||||
if (width > x) x = width;
|
||||
|
||||
size_t count = m_children.Count();
|
||||
for ( size_t n = 0; n < count; n++ )
|
||||
if (IsExpanded())
|
||||
{
|
||||
m_children[n]->GetSize( x, y );
|
||||
size_t count = m_children.Count();
|
||||
for ( size_t n = 0; n < count; n++ )
|
||||
{
|
||||
m_children[n]->GetSize( x, y );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -402,7 +407,7 @@ void wxTreeCtrl::SetItemHasChildren(const wxTreeItemId& item, bool has)
|
||||
// item status inquiries
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
bool wxTreeCtrl::IsVisible(const wxTreeItemId& item) const
|
||||
bool wxTreeCtrl::IsVisible(const wxTreeItemId& WXUNUSED(item)) const
|
||||
{
|
||||
wxFAIL_MSG("not implemented");
|
||||
|
||||
@@ -767,18 +772,18 @@ void wxTreeCtrl::SelectItem(const wxTreeItemId& itemId)
|
||||
}
|
||||
}
|
||||
|
||||
void wxTreeCtrl::EnsureVisible(const wxTreeItemId& item)
|
||||
void wxTreeCtrl::EnsureVisible(const wxTreeItemId& WXUNUSED(item))
|
||||
{
|
||||
wxFAIL_MSG("not implemented");
|
||||
}
|
||||
|
||||
void wxTreeCtrl::ScrollTo(const wxTreeItemId& item)
|
||||
void wxTreeCtrl::ScrollTo(const wxTreeItemId& WXUNUSED(item))
|
||||
{
|
||||
wxFAIL_MSG("not implemented");
|
||||
}
|
||||
|
||||
wxTextCtrl *wxTreeCtrl::EditLabel(const wxTreeItemId& item,
|
||||
wxClassInfo* textCtrlClass)
|
||||
wxTextCtrl *wxTreeCtrl::EditLabel( const wxTreeItemId& WXUNUSED(item),
|
||||
wxClassInfo* WXUNUSED(textCtrlClass) )
|
||||
{
|
||||
wxFAIL_MSG("not implemented");
|
||||
|
||||
@@ -792,13 +797,13 @@ wxTextCtrl *wxTreeCtrl::GetEditControl() const
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void wxTreeCtrl::EndEditLabel(const wxTreeItemId& item, bool discardChanges)
|
||||
void wxTreeCtrl::EndEditLabel(const wxTreeItemId& WXUNUSED(item), bool WXUNUSED(discardChanges))
|
||||
{
|
||||
wxFAIL_MSG("not implemented");
|
||||
}
|
||||
|
||||
void wxTreeCtrl::SortChildren(const wxTreeItemId& item,
|
||||
wxTreeItemCmpFunc *cmpFunction)
|
||||
void wxTreeCtrl::SortChildren( const wxTreeItemId& WXUNUSED(item),
|
||||
wxTreeItemCmpFunc *WXUNUSED(cmpFunction))
|
||||
{
|
||||
wxFAIL_MSG("not implemented");
|
||||
}
|
||||
@@ -863,7 +868,7 @@ void wxTreeCtrl::PaintLevel( wxGenericTreeItem *item, wxDC &dc, int level, int &
|
||||
int exposed_x = dc.LogicalToDeviceX( 0 );
|
||||
int exposed_y = dc.LogicalToDeviceY( item->GetY()-2 );
|
||||
|
||||
if (IsExposed( exposed_x, exposed_y, 1000, m_lineHeight+4 ))
|
||||
if (IsExposed( exposed_x, exposed_y, 10000, m_lineHeight+4 )) // 10000 = very much
|
||||
{
|
||||
int startX = horizX;
|
||||
int endX = horizX + 10;
|
||||
@@ -888,19 +893,33 @@ void wxTreeCtrl::PaintLevel( wxGenericTreeItem *item, wxDC &dc, int level, int &
|
||||
{
|
||||
dc.SetTextForeground( wxSystemSettings::GetSystemColour( wxSYS_COLOUR_HIGHLIGHTTEXT ) );
|
||||
dc.SetBrush( *m_hilightBrush );
|
||||
long tw, th;
|
||||
dc.GetTextExtent( item->GetText(), &tw, &th );
|
||||
|
||||
long text_w = 0;
|
||||
long text_h = 0;
|
||||
dc.GetTextExtent( item->GetText(), &text_w, &text_h );
|
||||
|
||||
int image_h = 0;
|
||||
int image_w = 0;
|
||||
if (item->GetImage() != -1)
|
||||
{
|
||||
m_imageListNormal->GetSize( item->GetImage(), image_w, image_h );
|
||||
image_w += 4;
|
||||
}
|
||||
|
||||
if (m_hasFocus)
|
||||
{
|
||||
dc.SetPen( *wxBLACK_PEN );
|
||||
dc.DrawRectangle( item->GetX()-2, item->GetY()-2, tw+4, th+4 );
|
||||
}
|
||||
else
|
||||
{
|
||||
dc.SetPen( *wxTRANSPARENT_PEN );
|
||||
dc.DrawRectangle( item->GetX()-2, item->GetY()-2, tw+4, th+4 );
|
||||
|
||||
dc.DrawRectangle( item->GetX()-2, item->GetY()-2, image_w+text_w+4, text_h+4 );
|
||||
|
||||
if (item->GetImage() != -1)
|
||||
{
|
||||
dc.SetClippingRegion( item->GetX(), item->GetY(), image_w-2, text_h );
|
||||
m_imageListNormal->Draw( item->GetImage(), dc, item->GetX(), item->GetY()-1, wxIMAGELIST_DRAW_TRANSPARENT );
|
||||
dc.DestroyClippingRegion();
|
||||
}
|
||||
dc.DrawText( item->GetText(), item->GetX(), item->GetY() );
|
||||
dc.DrawText( item->GetText(), image_w+item->GetX(), item->GetY() );
|
||||
|
||||
dc.SetPen( *wxBLACK_PEN );
|
||||
dc.SetTextForeground( *wxBLACK );
|
||||
@@ -910,10 +929,29 @@ void wxTreeCtrl::PaintLevel( wxGenericTreeItem *item, wxDC &dc, int level, int &
|
||||
{
|
||||
dc.SetBrush( *wxWHITE_BRUSH );
|
||||
dc.SetPen( *wxTRANSPARENT_PEN );
|
||||
long tw, th;
|
||||
dc.GetTextExtent( item->GetText(), &tw, &th );
|
||||
dc.DrawRectangle( item->GetX()-2, item->GetY()-2, tw+4, th+4 );
|
||||
dc.DrawText( item->GetText(), item->GetX(), item->GetY() );
|
||||
|
||||
long text_w = 0;
|
||||
long text_h = 0;
|
||||
dc.GetTextExtent( item->GetText(), &text_w, &text_h );
|
||||
|
||||
int image_h = 0;
|
||||
int image_w = 0;
|
||||
if (item->GetImage() != -1)
|
||||
{
|
||||
m_imageListNormal->GetSize( item->GetImage(), image_w, image_h );
|
||||
image_w += 4;
|
||||
}
|
||||
|
||||
dc.DrawRectangle( item->GetX()-2, item->GetY()-2, image_w+text_w+4, text_h+4 );
|
||||
|
||||
if (item->GetImage() != -1)
|
||||
{
|
||||
dc.SetClippingRegion( item->GetX(), item->GetY(), image_w-2, text_h );
|
||||
m_imageListNormal->Draw( item->GetImage(), dc, item->GetX(), item->GetY()-1, wxIMAGELIST_DRAW_TRANSPARENT );
|
||||
dc.DestroyClippingRegion();
|
||||
}
|
||||
|
||||
dc.DrawText( item->GetText(), image_w+item->GetX(), item->GetY() );
|
||||
dc.SetPen( *wxBLACK_PEN );
|
||||
}
|
||||
}
|
||||
|
@@ -452,10 +452,10 @@ wxBitmap::wxBitmap( const wxImage &image )
|
||||
|
||||
if (image.HasMask())
|
||||
{
|
||||
if ((r == r_mask) && (b = b_mask) && (g = g_mask))
|
||||
gdk_image_put_pixel( mask_image, x, y, 0 );
|
||||
else
|
||||
if ((r == r_mask) && (b == b_mask) && (g == g_mask))
|
||||
gdk_image_put_pixel( mask_image, x, y, 1 );
|
||||
else
|
||||
gdk_image_put_pixel( mask_image, x, y, 0 );
|
||||
}
|
||||
|
||||
switch (render_depth)
|
||||
|
@@ -476,7 +476,7 @@ void wxPaintDC::DrawIcon( const wxIcon &icon, long x, long y, bool useMask )
|
||||
}
|
||||
|
||||
bool wxPaintDC::Blit( long xdest, long ydest, long width, long height,
|
||||
wxDC *source, long xsrc, long ysrc, int WXUNUSED(logical_func), bool WXUNUSED(useMask) )
|
||||
wxDC *source, long xsrc, long ysrc, int WXUNUSED(logical_func), bool useMask )
|
||||
{
|
||||
if (!Ok()) return FALSE;
|
||||
|
||||
@@ -485,16 +485,35 @@ bool wxPaintDC::Blit( long xdest, long ydest, long width, long height,
|
||||
if (csrc->m_isMemDC)
|
||||
{
|
||||
wxMemoryDC* srcDC = (wxMemoryDC*)source;
|
||||
GdkBitmap* bmap = srcDC->m_selected.GetBitmap();
|
||||
GdkPixmap* bmap = srcDC->m_selected.GetPixmap();
|
||||
if (bmap)
|
||||
{
|
||||
gdk_draw_bitmap( m_window, m_textGC, bmap,
|
||||
long xx = XLOG2DEV(xdest);
|
||||
long yy = YLOG2DEV(ydest);
|
||||
|
||||
GdkBitmap *mask = (GdkBitmap *) NULL;
|
||||
if (srcDC->m_selected.GetMask()) mask = srcDC->m_selected.GetMask()->GetBitmap();
|
||||
|
||||
if (useMask && mask)
|
||||
{
|
||||
gdk_gc_set_clip_mask( m_penGC, mask );
|
||||
gdk_gc_set_clip_origin( m_penGC, xx, yy );
|
||||
}
|
||||
|
||||
gdk_draw_pixmap( m_window, m_penGC, bmap,
|
||||
source->DeviceToLogicalX(xsrc),
|
||||
source->DeviceToLogicalY(ysrc),
|
||||
XLOG2DEV(xdest),
|
||||
YLOG2DEV(ydest),
|
||||
xx,
|
||||
yy,
|
||||
source->DeviceToLogicalXRel(width),
|
||||
source->DeviceToLogicalYRel(height) );
|
||||
|
||||
if (useMask && mask)
|
||||
{
|
||||
gdk_gc_set_clip_mask( m_penGC, (GdkBitmap *) NULL );
|
||||
gdk_gc_set_clip_origin( m_penGC, 0, 0 );
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
@@ -452,10 +452,10 @@ wxBitmap::wxBitmap( const wxImage &image )
|
||||
|
||||
if (image.HasMask())
|
||||
{
|
||||
if ((r == r_mask) && (b = b_mask) && (g = g_mask))
|
||||
gdk_image_put_pixel( mask_image, x, y, 0 );
|
||||
else
|
||||
if ((r == r_mask) && (b == b_mask) && (g == g_mask))
|
||||
gdk_image_put_pixel( mask_image, x, y, 1 );
|
||||
else
|
||||
gdk_image_put_pixel( mask_image, x, y, 0 );
|
||||
}
|
||||
|
||||
switch (render_depth)
|
||||
|
@@ -476,7 +476,7 @@ void wxPaintDC::DrawIcon( const wxIcon &icon, long x, long y, bool useMask )
|
||||
}
|
||||
|
||||
bool wxPaintDC::Blit( long xdest, long ydest, long width, long height,
|
||||
wxDC *source, long xsrc, long ysrc, int WXUNUSED(logical_func), bool WXUNUSED(useMask) )
|
||||
wxDC *source, long xsrc, long ysrc, int WXUNUSED(logical_func), bool useMask )
|
||||
{
|
||||
if (!Ok()) return FALSE;
|
||||
|
||||
@@ -485,16 +485,35 @@ bool wxPaintDC::Blit( long xdest, long ydest, long width, long height,
|
||||
if (csrc->m_isMemDC)
|
||||
{
|
||||
wxMemoryDC* srcDC = (wxMemoryDC*)source;
|
||||
GdkBitmap* bmap = srcDC->m_selected.GetBitmap();
|
||||
GdkPixmap* bmap = srcDC->m_selected.GetPixmap();
|
||||
if (bmap)
|
||||
{
|
||||
gdk_draw_bitmap( m_window, m_textGC, bmap,
|
||||
long xx = XLOG2DEV(xdest);
|
||||
long yy = YLOG2DEV(ydest);
|
||||
|
||||
GdkBitmap *mask = (GdkBitmap *) NULL;
|
||||
if (srcDC->m_selected.GetMask()) mask = srcDC->m_selected.GetMask()->GetBitmap();
|
||||
|
||||
if (useMask && mask)
|
||||
{
|
||||
gdk_gc_set_clip_mask( m_penGC, mask );
|
||||
gdk_gc_set_clip_origin( m_penGC, xx, yy );
|
||||
}
|
||||
|
||||
gdk_draw_pixmap( m_window, m_penGC, bmap,
|
||||
source->DeviceToLogicalX(xsrc),
|
||||
source->DeviceToLogicalY(ysrc),
|
||||
XLOG2DEV(xdest),
|
||||
YLOG2DEV(ydest),
|
||||
xx,
|
||||
yy,
|
||||
source->DeviceToLogicalXRel(width),
|
||||
source->DeviceToLogicalYRel(height) );
|
||||
|
||||
if (useMask && mask)
|
||||
{
|
||||
gdk_gc_set_clip_mask( m_penGC, (GdkBitmap *) NULL );
|
||||
gdk_gc_set_clip_origin( m_penGC, 0, 0 );
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user