More progress on wxMotif, incl. wxTreeCtrl/wxListCtrl beginning to work

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1107 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
1998-12-04 10:30:39 +00:00
parent b2b3ccc524
commit a367b9b3f8
21 changed files with 182 additions and 93 deletions

View File

@@ -209,7 +209,11 @@ YYSTYPE yyvs[YYSTACKSIZE];
#define yystacksize YYSTACKSIZE
#line 118 "parser.y"
#ifdef IDE_INVOKED
#include "../common/doslex.c"
#else
#include "../common/lex_yy.c"
#endif
/*
void yyerror(s)

View File

@@ -685,6 +685,11 @@ wxListHeaderWindow::wxListHeaderWindow( wxWindow *win, wxWindowID id, wxListMain
m_isDraging = FALSE;
}
wxListHeaderWindow::~wxListHeaderWindow( void )
{
delete m_resizeCursor;
}
void wxListHeaderWindow::DoDrawRect( wxPaintDC *dc, int x, int y, int w, int h )
{
const int m_corner = 1;
@@ -751,7 +756,8 @@ void wxListHeaderWindow::DrawCurrent()
int y1 = 0;
int x2 = m_currentX-1;
int y2 = 0;
m_owner->GetClientSize( (int*)NULL, &y2 );
int dummy;
m_owner->GetClientSize( &dummy, &y2 );
ClientToScreen( &x1, &y1 );
m_owner->ClientToScreen( &x2, &y2 );
@@ -784,7 +790,8 @@ void wxListHeaderWindow::OnMouse( wxMouseEvent &event )
else
{
int size_x = 0;
GetClientSize( &size_x, (int*) NULL );
int dummy;
GetClientSize( &size_x, & dummy );
if (x > m_minX+7)
m_currentX = x;
else
@@ -947,7 +954,7 @@ wxListMainWindow::wxListMainWindow( void )
wxListMainWindow::wxListMainWindow( wxWindow *parent, wxWindowID id,
const wxPoint &pos, const wxSize &size,
long style, const wxString &name ) :
wxScrolledWindow( parent, id, pos, size, style, name )
wxScrolledWindow( parent, id, pos, size, style|wxHSCROLL|wxVSCROLL, name )
{
m_mode = style;
m_lines.DeleteContents( TRUE );
@@ -2227,6 +2234,8 @@ wxListCtrl::wxListCtrl(void)
m_imageListNormal = (wxImageList *) NULL;
m_imageListSmall = (wxImageList *) NULL;
m_imageListState = (wxImageList *) NULL;
m_mainWin = (wxListMainWindow*) NULL;
m_headerWin = (wxListHeaderWindow*) NULL;
}
wxListCtrl::~wxListCtrl(void)
@@ -2241,6 +2250,8 @@ bool wxListCtrl::Create( wxWindow *parent, wxWindowID id,
m_imageListNormal = (wxImageList *) NULL;
m_imageListSmall = (wxImageList *) NULL;
m_imageListState = (wxImageList *) NULL;
m_mainWin = (wxListMainWindow*) NULL;
m_headerWin = (wxListHeaderWindow*) NULL;
long s = style;
@@ -2710,22 +2721,34 @@ void wxListCtrl::OnIdle( wxIdleEvent &WXUNUSED(event) )
void wxListCtrl::SetBackgroundColour( const wxColour &colour )
{
m_mainWin->SetBackgroundColour( colour );
m_headerWin->SetBackgroundColour( colour );
m_mainWin->m_dirty = TRUE;
if (m_mainWin)
{
m_mainWin->SetBackgroundColour( colour );
m_mainWin->m_dirty = TRUE;
}
if (m_headerWin)
m_headerWin->SetBackgroundColour( colour );
}
void wxListCtrl::SetForegroundColour( const wxColour &colour )
{
m_mainWin->SetForegroundColour( colour );
m_headerWin->SetForegroundColour( colour );
m_mainWin->m_dirty = TRUE;
if (m_mainWin)
{
m_mainWin->SetForegroundColour( colour );
m_mainWin->m_dirty = TRUE;
}
if (m_headerWin)
m_headerWin->SetForegroundColour( colour );
}
void wxListCtrl::SetFont( const wxFont &font )
{
m_mainWin->SetFont( font );
m_headerWin->SetFont( font );
m_mainWin->m_dirty = TRUE;
if (m_mainWin)
{
m_mainWin->SetFont( font );
m_mainWin->m_dirty = TRUE;
}
if (m_headerWin)
m_headerWin->SetFont( font );
}

View File

@@ -328,7 +328,7 @@ bool wxTreeCtrl::Create(wxWindow *parent, wxWindowID id,
{
Init();
wxScrolledWindow::Create( parent, id, pos, size, style, name );
wxScrolledWindow::Create( parent, id, pos, size, style|wxHSCROLL|wxVSCROLL, name );
SetBackgroundColour( *wxWHITE );
m_dottedPen = wxPen( *wxBLACK, 0, 0 );
@@ -913,6 +913,7 @@ void wxTreeCtrl::PaintLevel( wxGenericTreeItem *item, wxDC &dc, int level, int &
if (item->HasHilight())
{
dc.SetTextForeground( wxSystemSettings::GetSystemColour( wxSYS_COLOUR_HIGHLIGHTTEXT ) );
dc.SetBrush( *m_hilightBrush );
long text_w = 0;
@@ -1154,7 +1155,6 @@ void wxTreeCtrl::RefreshLine( wxGenericTreeItem *item )
rect.y = dc.LogicalToDeviceY( item->GetY() - 2 );
rect.width = 1000;
rect.height = dc.GetCharHeight() + 6;
Refresh( TRUE, &rect );
}

View File

@@ -14,6 +14,7 @@
#endif
#include "wx/dc.h"
#include "wx/dcmemory.h"
#if !USE_SHARED_LIBRARY
IMPLEMENT_ABSTRACT_CLASS(wxDC, wxObject)
@@ -94,6 +95,31 @@ void wxDC::DrawIcon( const wxIcon &WXUNUSED(icon), long WXUNUSED(x), long WXUNUS
{
};
void wxDC::DrawBitmap( const wxBitmap& bitmap, long x, long y, bool useMask )
{
if (!bitmap.Ok())
return;
wxMemoryDC memDC;
memDC.SelectObject(bitmap);
/* Not sure if we need this. The mask should leave the
* masked areas as per the original background of this DC.
if (useMask)
{
// There might be transparent areas, so make these
// the same colour as this DC
memDC.SetBackground(* GetBackground());
memDC.Clear();
}
*/
Blit(x, y, bitmap.GetWidth(), bitmap.GetHeight(), & memDC, 0, 0, wxCOPY, useMask);
memDC.SelectObject(wxNullBitmap);
};
void wxDC::DrawPoint( wxPoint& point )
{
DrawPoint( point.x, point.y );

View File

@@ -172,7 +172,7 @@ wxWindowDC::~wxWindowDC(void)
};
void wxWindowDC::FloodFill( long WXUNUSED(x1), long WXUNUSED(y1),
wxColour* WXUNUSED(col), int WXUNUSED(style) )
const wxColour& WXUNUSED(col), int WXUNUSED(style) )
{
// TODO
};
@@ -1229,7 +1229,8 @@ void wxWindowDC::GetTextExtent( const wxString &string, long *width, long *heigh
if (!theFont->Ok())
{
// TODO: this should be an error log function
cerr << "wxWindows warning - set a valid font before calling GetTextExtent!\n";
wxFAIL_MSG("set a valid font before calling GetTextExtent!");
*width = -1;
*height = -1;
return;
@@ -1298,7 +1299,6 @@ void wxWindowDC::Clear(void)
int w, h;
if (m_window)
{
// TODO: should we get the virtual size?
m_window->GetSize(&w, &h);
if (m_window && m_window->GetBackingPixmap())
@@ -1330,6 +1330,24 @@ void wxWindowDC::Clear(void)
m_brush = saveBrush;
};
void wxWindowDC::Clear(const wxRect& rect)
{
if (!Ok()) return;
int x = rect.x; int y = rect.y;
int w = rect.width; int h = rect.height;
wxBrush saveBrush = m_brush;
SetBrush (m_backgroundBrush);
XFillRectangle ((Display*) m_display, (Pixmap) m_pixmap, (GC) m_gc, x, y, w, h);
if (m_window && m_window->GetBackingPixmap())
XFillRectangle ((Display*) m_display, (Pixmap) m_window->GetBackingPixmap(),(GC) m_gcBacking, x, y, w, h);
m_brush = saveBrush;
};
void wxWindowDC::SetFont( const wxFont &font )
{
if (!Ok()) return;

View File

@@ -69,7 +69,7 @@ wxColour wxSystemSettings::GetSystemColour(int index)
}
case wxSYS_COLOUR_HIGHLIGHTTEXT:
{
return *wxWHITE;
return *wxBLUE;
}
case wxSYS_COLOUR_INFOBK:
case wxSYS_COLOUR_APPWORKSPACE:

View File

@@ -488,7 +488,7 @@ int wxTextCtrl::overflow(int c)
// Verify that there are no characters in get area
if ( gptr() && gptr() < egptr() )
{
wxError("Who's trespassing my get area?","Internal error");
wxError("wxTextCtrl::overflow: Who's trespassing my get area?","Internal error");
return EOF;
}

View File

@@ -478,6 +478,7 @@ bool wxWindow::Create(wxWindow *parent, wxWindowID id,
// Without this, the cursor may not be restored properly
// (e.g. in splitter sample).
SetCursor(*wxSTANDARD_CURSOR);
SetFont(wxSystemSettings::GetSystemFont(wxSYS_DEFAULT_GUI_FONT));
SetSize(pos.x, pos.y, size.x, size.y);
return TRUE;
@@ -929,7 +930,10 @@ void wxWindow::Refresh(bool eraseBack, const wxRect *rect)
wxClientDC dc(this);
wxBrush backgroundBrush(GetBackgroundColour(), wxSOLID);
dc.SetBackground(backgroundBrush);
dc.Clear();
if (rect)
dc.Clear(*rect);
else
dc.Clear();
}
XSendEvent(display, thisWindow, False, ExposureMask, (XEvent *)&dummyEvent);

View File

@@ -394,6 +394,7 @@ wxBitmap wxBitmap::GetBitmapForDC(wxDC& dc) const
LPBITMAPINFO lpDib;
void *lpBits = NULL;
/*
wxASSERT( this->GetPalette() && this->GetPalette()->Ok() && (this->GetPalette()->GetHPALETTE() != 0) );
tmpBitmap.SetPalette(this->GetPalette());
@@ -401,6 +402,23 @@ wxBitmap wxBitmap::GetBitmapForDC(wxDC& dc) const
memDC.SetPalette(this->GetPalette());
hPal = (HPALETTE) this->GetPalette()->GetHPALETTE();
*/
if( this->GetPalette() && this->GetPalette()->Ok() && (this->GetPalette()->GetHPALETTE() != 0) )
{
tmpBitmap.SetPalette(this->GetPalette());
memDC.SelectObject(tmpBitmap);
memDC.SetPalette(this->GetPalette());
hPal = (HPALETTE) this->GetPalette()->GetHPALETTE();
}
else
{
hPal = (HPALETTE) ::GetStockObject(DEFAULT_PALETTE);
wxPalette palette;
palette.SetHPALETTE( (WXHPALETTE)hPal );
tmpBitmap.SetPalette( palette );
memDC.SelectObject(tmpBitmap);
memDC.SetPalette( palette );
}
// set the height negative because in a DIB the order of the lines is reversed
createDIB(this->GetWidth(), -this->GetHeight(), this->GetDepth(), hPal, &lpDib);

View File

@@ -50,7 +50,7 @@ wxWindowDC::~wxWindowDC(void)
};
void wxWindowDC::FloodFill( long WXUNUSED(x1), long WXUNUSED(y1),
wxColour* WXUNUSED(col), int WXUNUSED(style) )
const wxColour& WXUNUSED(col), int WXUNUSED(style) )
{
};