1. fatal typo in colour copying in wxStyleInfo ctor fixed

2. yet slightly better selection handling
3. scrollbars now appear when the window is resized and disappear too
   (it's somewhat strange still...)


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2735 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
1999-06-09 22:19:31 +00:00
parent 25889d3c43
commit 40c101af66
3 changed files with 57 additions and 1 deletions

View File

@@ -84,6 +84,8 @@ static const int Y_SCROLL_PAGE = 20;
// ----------------------------------------------------------------------------
BEGIN_EVENT_TABLE(wxLayoutWindow,wxScrolledWindow)
EVT_SIZE (wxLayoutWindow::OnSize)
EVT_PAINT (wxLayoutWindow::OnPaint)
EVT_CHAR (wxLayoutWindow::OnChar)
@@ -159,6 +161,11 @@ wxLayoutWindow::wxLayoutWindow(wxWindow *parent)
EnableScrolling(true, true);
m_maxx = max.x + X_SCROLL_PAGE;
m_maxy = max.y + Y_SCROLL_PAGE;
// no scrollbars initially (BTW, why then we do all the stuff above?)
m_hasHScrollbar =
m_hasVScrollbar = false;
m_Selecting = false;
#ifdef WXLAYOUT_USE_CARET
@@ -333,6 +340,10 @@ wxLayoutWindow::OnMouse(int eventId, wxMouseEvent& event)
}
break;
case WXLOWIN_MENU_RCLICK:
// remove the selection if mouse click is outside it (TODO)
break;
case WXLOWIN_MENU_DBLCLICK:
// select a word under cursor
m_llist->MoveCursorTo(cursorPos);
@@ -828,17 +839,35 @@ wxLayoutWindow::InternalPaint(const wxRect *updateRect)
}
}
void
wxLayoutWindow::OnSize(wxSizeEvent &event)
{
ResizeScrollbars();
event.Skip();
}
// change the range and position of scrollbars
void
wxLayoutWindow::ResizeScrollbars(bool exact)
{
wxPoint max = m_llist->GetSize();
wxSize size = GetClientSize();
WXLO_DEBUG(("ResizeScrollbars: max size = (%ld, %ld)",
(long int)max.x, (long int) max.y));
// in the absence of scrollbars we should compare with the client size
if ( !m_hasHScrollbar )
m_maxx = size.x - WXLO_ROFFSET;
if ( !m_hasVScrollbar )
m_maxy = size.y - WXLO_BOFFSET;
// check if the text hasn't become too big
// TODO why do we set both at once? they're independent...
if( max.x > m_maxx - WXLO_ROFFSET || max.y > m_maxy - WXLO_BOFFSET || exact )
{
// text became too large
if ( !exact )
{
// add an extra bit to the sizes to avoid future updates
@@ -852,9 +881,30 @@ wxLayoutWindow::ResizeScrollbars(bool exact)
m_ViewStartX, m_ViewStartY,
true);
m_hasHScrollbar =
m_hasVScrollbar = true;
m_maxx = max.x + X_SCROLL_PAGE;
m_maxy = max.y + Y_SCROLL_PAGE;
}
else
{
// check if the window hasn't become too big, thus making the scrollbars
// unnecessary
if ( m_hasHScrollbar && (max.x < size.x) )
{
// remove the horizontal scrollbar
SetScrollbars(0, -1, 0, -1, 0, -1, true);
m_hasHScrollbar = false;
}
if ( m_hasVScrollbar && (max.y < size.y) )
{
// remove the vertical scrollbar
SetScrollbars(-1, 0, -1, 0, -1, 0, true);
m_hasVScrollbar = false;
}
}
}
// ----------------------------------------------------------------------------