fixes to work in M

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2821 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 1999-06-17 21:40:49 +00:00
parent edccf4281b
commit 4005cc780c
3 changed files with 31 additions and 16 deletions

View File

@ -125,6 +125,7 @@ MyFrame::MyFrame(void) :
m_lwin->SetFocus(); m_lwin->SetFocus();
Clear(); Clear();
#if 0
// create and set the background bitmap (this will result in a lattice) // create and set the background bitmap (this will result in a lattice)
static const int sizeBmp = 10; static const int sizeBmp = 10;
wxBitmap *bitmap = new wxBitmap(sizeBmp, sizeBmp); wxBitmap *bitmap = new wxBitmap(sizeBmp, sizeBmp);
@ -140,6 +141,7 @@ MyFrame::MyFrame(void) :
dcMem.SelectObject( wxNullBitmap ); dcMem.SelectObject( wxNullBitmap );
m_lwin->SetBackgroundBitmap(bitmap); m_lwin->SetBackgroundBitmap(bitmap);
#endif // 0
}; };
void void
@ -236,7 +238,9 @@ MyFrame::AddSampleText(wxLayoutList *llist)
void void
MyFrame::Clear(void) MyFrame::Clear(void)
{ {
m_lwin->Clear(wxROMAN,16,wxNORMAL,wxNORMAL, false); wxColour colBg(0, 255, 255);
m_lwin->Clear(wxROMAN,16,wxNORMAL,wxNORMAL, false, wxGREEN, &colBg);
} }

View File

@ -153,11 +153,6 @@ wxLayoutWindow::wxLayoutWindow(wxWindow *parent)
m_bitmap = new wxBitmap(4,4); m_bitmap = new wxBitmap(4,4);
m_bitmapSize = wxPoint(4,4); m_bitmapSize = wxPoint(4,4);
m_llist = new wxLayoutList(); m_llist = new wxLayoutList();
#ifdef __WXMSW__
SetAutoDeleteSelection(true);
#else
SetAutoDeleteSelection(false);
#endif
m_BGbitmap = NULL; m_BGbitmap = NULL;
m_ScrollToCursor = false; m_ScrollToCursor = false;
SetWrapMargin(0); SetWrapMargin(0);
@ -173,13 +168,20 @@ wxLayoutWindow::wxLayoutWindow(wxWindow *parent)
wxCaret *caret = new wxCaret(this, 2, 20); wxCaret *caret = new wxCaret(this, 2, 20);
SetCaret(caret); SetCaret(caret);
m_llist->SetCaret(caret); m_llist->SetCaret(caret);
caret->Show();
#endif // WXLAYOUT_USE_CARET #endif // WXLAYOUT_USE_CARET
m_HaveFocus = FALSE;
m_HandCursor = FALSE; m_HandCursor = FALSE;
m_CursorVisibility = -1; m_CursorVisibility = -1;
SetCursor(wxCURSOR_IBEAM); SetCursor(wxCURSOR_IBEAM);
SetDirty(); SetDirty();
// at least under Windows, this should be the default behaviour
#ifdef __WXMSW__
m_AutoDeleteSelection = TRUE;
#else // !Windows
m_AutoDeleteSelection = FALSE;
#endif // Win/!Win
} }
wxLayoutWindow::~wxLayoutWindow() wxLayoutWindow::~wxLayoutWindow()
@ -206,7 +208,12 @@ wxLayoutWindow::Clear(int family,
ResizeScrollbars(true); ResizeScrollbars(true);
SetDirty(); SetDirty();
SetModified(false); SetModified(false);
wxScrolledWindow::Clear();
#ifdef WXLAYOUT_USE_CARET
if ( m_CursorVisibility == 1 )
GetCaret()->Show();
#endif // WXLAYOUT_USE_CARET
DoPaint((wxRect *)NULL); DoPaint((wxRect *)NULL);
} }
@ -331,7 +338,7 @@ wxLayoutWindow::OnMouse(int eventId, wxMouseEvent& event)
if(m_CursorVisibility != 0) if(m_CursorVisibility != 0)
{ {
// draw a thick cursor for editable windows with focus // draw a thick cursor for editable windows with focus
m_llist->DrawCursor(dc, m_HaveFocus && IsEditable(), offset); m_llist->DrawCursor(dc, m_HaveFocus && IsEditable(), offset);
} }
@ -720,12 +727,13 @@ void
wxLayoutWindow::DoPaint(const wxRect *updateRect) wxLayoutWindow::DoPaint(const wxRect *updateRect)
{ {
#ifdef __WXGTK__ #ifdef __WXGTK__
// Calling Refresh() causes bad flicker under wxGTK!!!
InternalPaint(updateRect); InternalPaint(updateRect);
#else // Causes bad flicker under wxGTK!!! #else
// shouldn't specify the update rectangle if it doesn't include all the
// changed locations - otherwise, they won't be repainted at all because
// the system clips the display to the update rect
Refresh(FALSE); //, updateRect); Refresh(FALSE); //, updateRect);
if ( !::UpdateWindow(GetHwnd()) )
wxLogLastError("UpdateWindow");
#endif #endif
} }
@ -764,6 +772,7 @@ wxLayoutWindow::InternalPaint(const wxRect *updateRect)
m_llist->Layout(dc); m_llist->Layout(dc);
ResizeScrollbars(); ResizeScrollbars();
} }
/* Check whether the window has grown, if so, we need to reallocate /* Check whether the window has grown, if so, we need to reallocate
the bitmap to be larger. */ the bitmap to be larger. */
if(x1 > m_bitmapSize.x || y1 > m_bitmapSize.y) if(x1 > m_bitmapSize.x || y1 > m_bitmapSize.y)
@ -779,7 +788,7 @@ wxLayoutWindow::InternalPaint(const wxRect *updateRect)
} }
m_memDC->SetDeviceOrigin(0,0); m_memDC->SetDeviceOrigin(0,0);
m_memDC->SetBrush(wxBrush(m_llist->GetDefaultStyleInfo().GetBGColour(),wxSOLID)); m_memDC->SetBackground(wxBrush(m_llist->GetDefaultStyleInfo().GetBGColour(),wxSOLID));
m_memDC->SetPen(wxPen(m_llist->GetDefaultStyleInfo().GetBGColour(), m_memDC->SetPen(wxPen(m_llist->GetDefaultStyleInfo().GetBGColour(),
0,wxTRANSPARENT)); 0,wxTRANSPARENT));
m_memDC->SetLogicalFunction(wxCOPY); m_memDC->SetLogicalFunction(wxCOPY);
@ -855,7 +864,7 @@ wxLayoutWindow::InternalPaint(const wxRect *updateRect)
#ifdef WXLAYOUT_USE_CARET #ifdef WXLAYOUT_USE_CARET
// show the caret back after everything is redrawn // show the caret back after everything is redrawn
m_caret->Show(); GetCaret()->Show();
#endif // WXLAYOUT_USE_CARET #endif // WXLAYOUT_USE_CARET
ResetDirty(); ResetDirty();

View File

@ -39,6 +39,7 @@ enum
WXLOWIN_MENU_DBLCLICK, WXLOWIN_MENU_DBLCLICK,
WXLOWIN_MENU_MDOWN, WXLOWIN_MENU_MDOWN,
WXLOWIN_MENU_LDOWN, WXLOWIN_MENU_LDOWN,
WXLOWIN_MENU_LCLICK = WXLOWIN_MENU_LDOWN,
WXLOWIN_MENU_LUP, WXLOWIN_MENU_LUP,
WXLOWIN_MENU_MOUSEMOVE, WXLOWIN_MENU_MOUSEMOVE,
WXLOWIN_MENU_LAST = WXLOWIN_MENU_MOUSEMOVE WXLOWIN_MENU_LAST = WXLOWIN_MENU_MOUSEMOVE
@ -82,7 +83,8 @@ public:
m_BGbitmap = bitmap; m_BGbitmap = bitmap;
} }
/// Enable or disable editing, i.e. processing of keystrokes. /// Enable or disable editing, i.e. processing of keystrokes.
void SetEditable(bool toggle) { m_Editable = toggle; } void SetEditable(bool toggle)
{ m_Editable = toggle; SetCursorVisibility(toggle); }
/// Query whether list can be edited by user. /// Query whether list can be edited by user.
bool IsEditable(void) const { return m_Editable; } bool IsEditable(void) const { return m_Editable; }
/** Sets cursor visibility, visible=1, invisible=0, /** Sets cursor visibility, visible=1, invisible=0,