// Ron Lee on 10.4.02: virtual size / auto scrollbars et al.
// Created: 01/02/97
// RCS-ID: $Id$
-// Copyright: (c) wxWindows team
+// Copyright: (c) wxWidgets team
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
IMPLEMENT_CLASS(wxScrolledWindow, wxGenericScrolledWindow)
/*
- TODO PROPERTIES
- style wxHSCROLL | wxVSCROLL
+ TODO PROPERTIES
+ style wxHSCROLL | wxVSCROLL
*/
// ----------------------------------------------------------------------------
virtual bool ProcessEvent(wxEvent& event);
- void ResetDrawnFlag() { m_hasDrawnWindow = FALSE; }
+ void ResetDrawnFlag() { m_hasDrawnWindow = false; }
private:
wxScrollHelper *m_scrollHelper;
// anything in the window. We set it to true here but reset it to false in
// wxScrolledWindow::OnPaint() handler (which wouldn't be called if the
// user code defined OnPaint() in the derived class)
- m_hasDrawnWindow = TRUE;
+ m_hasDrawnWindow = true;
// pass it on to the real handler
bool processed = wxEvtHandler::ProcessEvent(event);
{
m_scrollHelper->HandleOnSize((wxSizeEvent &)event);
- return TRUE;
+ return true;
}
if ( processed )
// OnDraw() below (from HandleOnPaint)
if ( m_hasDrawnWindow )
{
- return TRUE;
+ return true;
}
}
- // reset the skipped flag to FALSE as it might have been set to TRUE in
+ // reset the skipped flag to false as it might have been set to true in
// ProcessEvent() above
- event.Skip(FALSE);
+ event.Skip(false);
if ( evType == wxEVT_PAINT )
{
m_scrollHelper->HandleOnPaint((wxPaintEvent &)event);
- return TRUE;
+ return true;
}
if ( evType == wxEVT_SCROLLWIN_TOP ||
return !event.GetSkipped();
}
- return FALSE;
+ return false;
}
// ----------------------------------------------------------------------------
m_yScrollLinesPerPage = 0;
m_xScrollingEnabled =
- m_yScrollingEnabled = TRUE;
+ m_yScrollingEnabled = true;
m_scaleX =
m_scaleY = 1.0;
m_targetWindow->SetVirtualSize( w, h );
if (do_refresh && !noRefresh)
- m_targetWindow->Refresh(TRUE, GetScrollRect());
+ m_targetWindow->Refresh(true, GetScrollRect());
#ifndef __WXUNIVERSAL__
// If the target is not the same as the window with the scrollbars,
m_win->SetScrollPos(wxVERTICAL, m_yScrollPosition);
}
- bool needsRefresh = FALSE;
+ bool needsRefresh = false;
int dx = 0,
dy = 0;
if (orient == wxHORIZONTAL)
}
else
{
- needsRefresh = TRUE;
+ needsRefresh = true;
}
}
else
}
else
{
- needsRefresh = TRUE;
+ needsRefresh = true;
}
}
if ( needsRefresh )
{
- m_targetWindow->Refresh(TRUE, GetScrollRect());
+ m_targetWindow->Refresh(true, GetScrollRect());
}
else
{
nScrollInc = noPositions - m_xScrollPosition; // As +ve as we can go
}
else
- m_targetWindow->Refresh(TRUE, GetScrollRect());
+ m_targetWindow->Refresh(true, GetScrollRect());
}
else
{
else
{
// VZ: why do we do this? (FIXME)
- m_targetWindow->Refresh(TRUE, GetScrollRect());
+ m_targetWindow->Refresh(true, GetScrollRect());
}
}
{
m_xScrollLines = 0;
m_xScrollPosition = 0;
- m_win->SetScrollbar (wxHORIZONTAL, 0, 0, 0, FALSE);
+ m_win->SetScrollbar (wxHORIZONTAL, 0, 0, 0, false);
}
else
{
m_targetWindow->ScrollWindow( m_xScrollPixelsPerLine * (oldXScroll - m_xScrollPosition), 0,
GetScrollRect() );
else
- m_targetWindow->Refresh(TRUE, GetScrollRect());
+ m_targetWindow->Refresh(true, GetScrollRect());
}
if (oldYScroll != m_yScrollPosition)
m_targetWindow->ScrollWindow( 0, m_yScrollPixelsPerLine * (oldYScroll-m_yScrollPosition),
GetScrollRect() );
else
- m_targetWindow->Refresh(TRUE, GetScrollRect());
+ m_targetWindow->Refresh(true, GetScrollRect());
}
}
*y = m_yScrollPosition;
}
+#if WXWIN_COMPATIBILITY_2_2
+
+void wxScrollHelper::ViewStart(int *x, int *y) const
+{
+ GetViewStart( x, y );
+}
+
+#endif // WXWIN_COMPATIBILITY_2_2
+
void wxScrollHelper::DoCalcScrolledPosition(int x, int y, int *xx, int *yy) const
{
if ( xx )
orient
);
m_timerAutoScroll->Start(50); // FIXME: make configurable
+#else
+ wxUnusedVar(pos);
#endif
}
}
newEvent.SetPosition(0);
newEvent.SetOrientation(wxVERTICAL);
- newEvent.m_eventObject = m_win;
+ newEvent.SetEventObject(m_win);
if (event.IsPageScroll())
{
if (lines > 0)
- newEvent.m_eventType = wxEVT_SCROLLWIN_PAGEUP;
+ newEvent.SetEventType(wxEVT_SCROLLWIN_PAGEUP);
else
- newEvent.m_eventType = wxEVT_SCROLLWIN_PAGEDOWN;
+ newEvent.SetEventType(wxEVT_SCROLLWIN_PAGEDOWN);
m_win->GetEventHandler()->ProcessEvent(newEvent);
}
{
lines *= event.GetLinesPerAction();
if (lines > 0)
- newEvent.m_eventType = wxEVT_SCROLLWIN_LINEUP;
+ newEvent.SetEventType(wxEVT_SCROLLWIN_LINEUP);
else
- newEvent.m_eventType = wxEVT_SCROLLWIN_LINEDOWN;
+ newEvent.SetEventType(wxEVT_SCROLLWIN_LINEDOWN);
int times = abs(lines);
for (; times > 0; times--)
{
m_targetWindow = this;
- bool ok = wxPanel::Create(parent, id, pos, size, style, name);
+ bool ok = wxPanel::Create(parent, id, pos, size, style|wxHSCROLL|wxVSCROLL, name);
return ok;
}
CalcScrolledPosition(0,0, &x,&y);
GetVirtualSize(&w, &h);
GetSizer()->SetDimension(x, y, w, h);
- return TRUE;
+ return true;
}
// fall back to default for LayoutConstraints