1. modified wxMSW::wxCaret to use client coords

2. fixed uninit m_curXXX vars leading to a crash in wxMSW
3. fixed wxWindow::DoDrawBackground() for empty update region


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/wxUNIVERSAL@8406 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2000-09-23 23:28:48 +00:00
parent 025f9ba319
commit b5366def43
5 changed files with 31 additions and 8 deletions

View File

@@ -158,7 +158,10 @@ void wxCaret::DoMove()
wxASSERT_MSG( wxWindow::FindFocus() == GetWindow(), wxASSERT_MSG( wxWindow::FindFocus() == GetWindow(),
wxT("how did we lose focus?") ); wxT("how did we lose focus?") );
CALL_CARET_API(SetCaretPos, (m_x, m_y)); // for compatibility with the generic version, the coordinates are
// client ones
wxPoint pt = GetWindow()->GetClientAreaOrigin();
CALL_CARET_API(SetCaretPos, (m_x + pt.x, m_y + pt.y));
} }
//else: we don't have caret right now, nothing to do (this does happen) //else: we don't have caret right now, nothing to do (this does happen)
} }

View File

@@ -71,6 +71,10 @@ void wxTextCtrl::Init()
m_isEditable = TRUE; m_isEditable = TRUE;
m_ofsHorz = 0; m_ofsHorz = 0;
m_curPos =
m_curRow =
m_curLine = 0;
} }
bool wxTextCtrl::Create(wxWindow *parent, bool wxTextCtrl::Create(wxWindow *parent,
@@ -90,7 +94,9 @@ bool wxTextCtrl::Create(wxWindow *parent,
// FIXME use renderer // FIXME use renderer
wxCaret *caret = new wxCaret(this, 1, GetCharHeight()); wxCaret *caret = new wxCaret(this, 1, GetCharHeight());
#ifndef __WXMSW__
caret->SetBlinkTime(0); caret->SetBlinkTime(0);
#endif // __WXMSW__
SetCaret(caret); SetCaret(caret);
SetCursor(wxCURSOR_IBEAM); SetCursor(wxCURSOR_IBEAM);

View File

@@ -17,7 +17,7 @@
// headers // headers
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// For compilers that support precompilation, includes "wx.h". // for compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h" #include "wx/wxprec.h"
#ifdef __BORLANDC__ #ifdef __BORLANDC__
@@ -40,8 +40,11 @@
#include "wx/univ/colschem.h" #include "wx/univ/colschem.h"
#include "wx/univ/theme.h" #include "wx/univ/theme.h"
// define this for tons of debugging messages // ----------------------------------------------------------------------------
#undef DEBUG_MOUSE // constants (to be removed)
// ----------------------------------------------------------------------------
static const wxCoord BORDER_THICKNESS = 10;
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// wxGTKRenderer: draw the GUI elements in GTK style // wxGTKRenderer: draw the GUI elements in GTK style
@@ -676,12 +679,14 @@ void wxGTKRenderer::DrawBorder(wxDC& dc,
int WXUNUSED(flags), int WXUNUSED(flags),
wxRect *rectIn) wxRect *rectIn)
{ {
size_t width;
wxRect rect = rectTotal; wxRect rect = rectTotal;
switch ( border ) switch ( border )
{ {
case wxBORDER_SUNKEN: case wxBORDER_SUNKEN:
for ( int width = 0; width < 10; width++ ) for ( width = 0; width < BORDER_THICKNESS; width++ )
{ {
DrawAntiShadedRect(dc, &rect, m_penDarkGrey, m_penHighlight); DrawAntiShadedRect(dc, &rect, m_penDarkGrey, m_penHighlight);
DrawShadedRect(dc, &rect, m_penBlack, m_penLightGrey); DrawShadedRect(dc, &rect, m_penBlack, m_penLightGrey);
@@ -693,8 +698,10 @@ void wxGTKRenderer::DrawBorder(wxDC& dc,
break; break;
case wxBORDER_RAISED: case wxBORDER_RAISED:
for ( int width = 0; width < 10; width++ ) for ( width = 0; width < BORDER_THICKNESS; width++ )
{
DrawRaisedBorder(dc, &rect); DrawRaisedBorder(dc, &rect);
}
break; break;
case wxBORDER_DOUBLE: case wxBORDER_DOUBLE:

View File

@@ -170,10 +170,10 @@ public:
virtual wxRect GetTextTotalArea(const wxTextCtrl *text, virtual wxRect GetTextTotalArea(const wxTextCtrl *text,
const wxRect& rect) const wxRect& rect)
{ return rect; } { wxRect rectTotal = rect; rectTotal.Inflate(1); return rectTotal; }
virtual wxRect GetTextClientArea(const wxTextCtrl *text, virtual wxRect GetTextClientArea(const wxTextCtrl *text,
const wxRect& rect) const wxRect& rect)
{ return rect; } { wxRect rectText = rect; rectText.Inflate(-1); return rectText; }
protected: protected:
// common part of DrawLabel() and DrawItem() // common part of DrawLabel() and DrawItem()

View File

@@ -205,6 +205,13 @@ void wxWindow::OnPaint(wxPaintEvent& event)
bool wxWindow::DoDrawBackground(wxDC& dc) bool wxWindow::DoDrawBackground(wxDC& dc)
{ {
wxRect rect = GetUpdateRegion().GetBox(); wxRect rect = GetUpdateRegion().GetBox();
if ( !rect.width && !rect.height )
{
wxSize size = GetSize();
rect.width = size.x;
rect.height = size.y;
}
if ( GetBackgroundBitmap().Ok() ) if ( GetBackgroundBitmap().Ok() )
{ {
// get the bitmap and the flags // get the bitmap and the flags