Added code for erasing the small square between scrollbars.
Corrected window size if scrollbars is removed/added. Reduce flicker in scrollbars. Prevent scrollbars from jumping back to original position if the mouse just barely left the scrollbar. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14872 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -42,6 +42,7 @@
|
|||||||
#include "wx/univ/renderer.h"
|
#include "wx/univ/renderer.h"
|
||||||
#include "wx/univ/inphand.h"
|
#include "wx/univ/inphand.h"
|
||||||
#include "wx/univ/theme.h"
|
#include "wx/univ/theme.h"
|
||||||
|
#include "wx/log.h"
|
||||||
|
|
||||||
#define WXDEBUG_SCROLLBAR
|
#define WXDEBUG_SCROLLBAR
|
||||||
|
|
||||||
@@ -388,7 +389,7 @@ void wxScrollBar::UpdateThumb()
|
|||||||
}
|
}
|
||||||
#endif // WXDEBUG_SCROLLBAR
|
#endif // WXDEBUG_SCROLLBAR
|
||||||
|
|
||||||
Refresh(TRUE, &rect);
|
Refresh(FALSE, &rect);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_elementsState[n] &= ~wxCONTROL_DIRTY;
|
m_elementsState[n] &= ~wxCONTROL_DIRTY;
|
||||||
|
@@ -4145,6 +4145,8 @@ bool wxWin32ScrollBarInputHandler::HandleMouseMove(wxInputConsumer *control,
|
|||||||
// if we're scrolling the scrollbar because the arrow or the shaft was
|
// if we're scrolling the scrollbar because the arrow or the shaft was
|
||||||
// pressed, check that the mouse stays on the same scrollbar element
|
// pressed, check that the mouse stays on the same scrollbar element
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
// Always let thumb jump back if we leave the scrollbar
|
||||||
if ( event.Moving() )
|
if ( event.Moving() )
|
||||||
{
|
{
|
||||||
ht = m_renderer->HitTestScrollbar(scrollbar, event.GetPosition());
|
ht = m_renderer->HitTestScrollbar(scrollbar, event.GetPosition());
|
||||||
@@ -4153,6 +4155,21 @@ bool wxWin32ScrollBarInputHandler::HandleMouseMove(wxInputConsumer *control,
|
|||||||
{
|
{
|
||||||
ht = wxHT_NOWHERE;
|
ht = wxHT_NOWHERE;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
// Jump back only if we get far away from it
|
||||||
|
wxPoint pos = event.GetPosition();
|
||||||
|
if (scrollbar->HasFlag( wxVERTICAL ))
|
||||||
|
{
|
||||||
|
if (pos.x > -20 && pos.x < scrollbar->GetSize().x+20)
|
||||||
|
pos.x = 5;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (pos.y > -20 && pos.y < scrollbar->GetSize().y+20)
|
||||||
|
pos.y = 5;
|
||||||
|
}
|
||||||
|
ht = m_renderer->HitTestScrollbar(scrollbar, pos );
|
||||||
|
#endif
|
||||||
|
|
||||||
// if we're dragging the thumb and the mouse stays in the scrollbar, it
|
// if we're dragging the thumb and the mouse stays in the scrollbar, it
|
||||||
// is still ok - we only want to catch the case when the mouse leaves
|
// is still ok - we only want to catch the case when the mouse leaves
|
||||||
|
@@ -843,8 +843,12 @@ void wxWindow::SetScrollbar(int orient,
|
|||||||
// give the window a chance to relayout
|
// give the window a chance to relayout
|
||||||
if ( hasClientSizeChanged )
|
if ( hasClientSizeChanged )
|
||||||
{
|
{
|
||||||
|
#if wxUSE_TWO_WINDOWS
|
||||||
|
wxWindowNative::SetSize( GetSize() );
|
||||||
|
#else
|
||||||
wxSizeEvent event(GetSize());
|
wxSizeEvent event(GetSize());
|
||||||
(void)GetEventHandler()->ProcessEvent(event);
|
(void)GetEventHandler()->ProcessEvent(event);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -734,7 +734,7 @@ bool wxApp::ProcessXEvent(WXEvent* _event)
|
|||||||
{
|
{
|
||||||
if (!win->IsEnabled())
|
if (!win->IsEnabled())
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
// Here we check if the top level window is
|
// Here we check if the top level window is
|
||||||
// disabled, which is one aspect of modality.
|
// disabled, which is one aspect of modality.
|
||||||
wxWindow *tlw = win;
|
wxWindow *tlw = win;
|
||||||
|
@@ -40,6 +40,7 @@
|
|||||||
#include "wx/module.h"
|
#include "wx/module.h"
|
||||||
#include "wx/menuitem.h"
|
#include "wx/menuitem.h"
|
||||||
#include "wx/log.h"
|
#include "wx/log.h"
|
||||||
|
#include "wx/univ/renderer.h"
|
||||||
|
|
||||||
#if wxUSE_DRAG_AND_DROP
|
#if wxUSE_DRAG_AND_DROP
|
||||||
#include "wx/dnd.h"
|
#include "wx/dnd.h"
|
||||||
@@ -837,15 +838,13 @@ void wxWindowX11::DoSetClientSize(int width, int height)
|
|||||||
{
|
{
|
||||||
xwindow = (Window) m_clientWindow;
|
xwindow = (Window) m_clientWindow;
|
||||||
|
|
||||||
if (HasFlag( wxSUNKEN_BORDER) || HasFlag( wxRAISED_BORDER))
|
wxWindow *window = (wxWindow*) this;
|
||||||
|
wxRenderer *renderer = window->GetRenderer();
|
||||||
|
if (renderer)
|
||||||
{
|
{
|
||||||
width -= 4;
|
wxRect border = renderer->GetBorderDimensions( (wxBorder)(m_windowStyle & wxBORDER_MASK) );
|
||||||
height -= 4;
|
width -= border.x + border.width;
|
||||||
} else
|
height -= border.y + border.height;
|
||||||
if (HasFlag( wxSIMPLE_BORDER ))
|
|
||||||
{
|
|
||||||
width -= 2;
|
|
||||||
height -= 2;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
XResizeWindow( wxGlobalDisplay(), xwindow, width, height );
|
XResizeWindow( wxGlobalDisplay(), xwindow, width, height );
|
||||||
@@ -872,26 +871,22 @@ void wxWindowX11::DoMoveWindow(int x, int y, int width, int height)
|
|||||||
{
|
{
|
||||||
xwindow = (Window) m_clientWindow;
|
xwindow = (Window) m_clientWindow;
|
||||||
|
|
||||||
if (HasFlag( wxSUNKEN_BORDER) || HasFlag( wxRAISED_BORDER))
|
wxWindow *window = (wxWindow*) this;
|
||||||
|
wxRenderer *renderer = window->GetRenderer();
|
||||||
|
if (renderer)
|
||||||
{
|
{
|
||||||
x = 2;
|
wxRect border = renderer->GetBorderDimensions( (wxBorder)(m_windowStyle & wxBORDER_MASK) );
|
||||||
y = 2;
|
x = border.x;
|
||||||
width -= 4;
|
y = border.y;
|
||||||
height -= 4;
|
width -= border.x + border.width;
|
||||||
} else
|
height -= border.y + border.height;
|
||||||
if (HasFlag( wxSIMPLE_BORDER ))
|
}
|
||||||
{
|
else
|
||||||
x = 1;
|
|
||||||
y = 1;
|
|
||||||
width -= 2;
|
|
||||||
height -= 2;
|
|
||||||
} else
|
|
||||||
{
|
{
|
||||||
x = 0;
|
x = 0;
|
||||||
y = 0;
|
y = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxWindow *window = (wxWindow*) this;
|
|
||||||
wxScrollBar *sb = window->GetScrollbar( wxHORIZONTAL );
|
wxScrollBar *sb = window->GetScrollbar( wxHORIZONTAL );
|
||||||
if (sb && sb->IsShown())
|
if (sb && sb->IsShown())
|
||||||
{
|
{
|
||||||
@@ -1139,6 +1134,37 @@ void wxWindowX11::SendPaintEvents()
|
|||||||
|
|
||||||
void wxWindowX11::SendNcPaintEvents()
|
void wxWindowX11::SendNcPaintEvents()
|
||||||
{
|
{
|
||||||
|
wxWindow *window = (wxWindow*) this;
|
||||||
|
|
||||||
|
// All this for drawing the small square between the scrollbars.
|
||||||
|
int width = 0;
|
||||||
|
int height = 0;
|
||||||
|
int x = 0;
|
||||||
|
int y = 0;
|
||||||
|
wxScrollBar *sb = window->GetScrollbar( wxHORIZONTAL );
|
||||||
|
if (sb && sb->IsShown())
|
||||||
|
{
|
||||||
|
height = sb->GetSize().y;
|
||||||
|
y = sb->GetPosition().y;
|
||||||
|
|
||||||
|
sb = window->GetScrollbar( wxVERTICAL );
|
||||||
|
if (sb && sb->IsShown())
|
||||||
|
{
|
||||||
|
width = sb->GetSize().x;
|
||||||
|
x = sb->GetPosition().x;
|
||||||
|
|
||||||
|
Display *xdisplay = wxGlobalDisplay();
|
||||||
|
Window xwindow = (Window) GetMainWindow();
|
||||||
|
Colormap cm = (Colormap) wxTheApp->GetMainColormap( wxGetDisplay() );
|
||||||
|
wxColour colour = wxSystemSettings::GetColour(wxSYS_COLOUR_APPWORKSPACE);
|
||||||
|
colour.CalcPixel( (WXColormap) cm );
|
||||||
|
|
||||||
|
XSetForeground( xdisplay, g_eraseGC, colour.GetPixel() );
|
||||||
|
|
||||||
|
XFillRectangle( xdisplay, xwindow, g_eraseGC, x, y, width, height );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
wxNcPaintEvent nc_paint_event( GetId() );
|
wxNcPaintEvent nc_paint_event( GetId() );
|
||||||
nc_paint_event.SetEventObject( this );
|
nc_paint_event.SetEventObject( this );
|
||||||
GetEventHandler()->ProcessEvent( nc_paint_event );
|
GetEventHandler()->ProcessEvent( nc_paint_event );
|
||||||
|
Reference in New Issue
Block a user