1 /////////////////////////////////////////////////////////////////////////////
2 // Name: gtk/scrolwin.cpp
3 // Purpose: wxScrolledWindow implementation
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart and Markus Holzem
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
12 // ============================================================================
14 // ============================================================================
16 // ----------------------------------------------------------------------------
18 // ----------------------------------------------------------------------------
21 #pragma implementation "scrolwin.h"
24 // For compilers that support precompilation, includes "wx.h".
25 #include "wx/wxprec.h"
32 #include "wx/dcclient.h"
34 #include "wx/gtk/scrolwin.h"
38 #include "wx/gtk/win_gtk.h"
40 // ----------------------------------------------------------------------------
42 // ----------------------------------------------------------------------------
44 BEGIN_EVENT_TABLE(wxScrolledWindow
, wxPanel
)
45 EVT_SCROLLWIN(wxScrolledWindow::OnScroll
)
46 EVT_SIZE(wxScrolledWindow::OnSize
)
47 EVT_PAINT(wxScrolledWindow::OnPaint
)
48 EVT_CHAR(wxScrolledWindow::OnChar
)
51 IMPLEMENT_DYNAMIC_CLASS(wxScrolledWindow
, wxPanel
)
53 // ============================================================================
55 // ============================================================================
57 //-----------------------------------------------------------------------------
59 //-----------------------------------------------------------------------------
61 extern bool g_blockEventsOnDrag
;
63 //-----------------------------------------------------------------------------
65 //-----------------------------------------------------------------------------
67 extern void wxapp_install_idle_handler();
70 //-----------------------------------------------------------------------------
71 // "value_changed" from m_vAdjust
72 //-----------------------------------------------------------------------------
74 static void gtk_scrolled_window_vscroll_callback( GtkAdjustment
*adjust
, wxScrolledWindow
*win
)
77 wxapp_install_idle_handler();
79 if (g_blockEventsOnDrag
) return;
81 if (!win
->m_hasVMT
) return;
83 win
->GtkVScroll( adjust
->value
);
86 //-----------------------------------------------------------------------------
87 // "value_changed" from m_hAdjust
88 //-----------------------------------------------------------------------------
90 static void gtk_scrolled_window_hscroll_callback( GtkAdjustment
*adjust
, wxScrolledWindow
*win
)
93 wxapp_install_idle_handler();
95 if (g_blockEventsOnDrag
) return;
96 if (!win
->m_hasVMT
) return;
98 win
->GtkHScroll( adjust
->value
);
101 //-----------------------------------------------------------------------------
102 // InsertChild for wxScrolledWindow
103 //-----------------------------------------------------------------------------
105 static void wxInsertChildInScrolledWindow( wxWindow
* parent
, wxWindow
* child
)
107 // The window might have been scrolled already, do we
108 // have to adapt the position.
109 GtkPizza
*pizza
= GTK_PIZZA(parent
->m_wxwindow
);
110 child
->m_x
+= pizza
->xoffset
;
111 child
->m_y
+= pizza
->yoffset
;
113 gtk_pizza_put( GTK_PIZZA(parent
->m_wxwindow
),
114 GTK_WIDGET(child
->m_widget
),
121 // ----------------------------------------------------------------------------
122 // wxScrolledWindow creation
123 // ----------------------------------------------------------------------------
125 void wxScrolledWindow::Init()
127 m_xScrollPixelsPerLine
= 0;
128 m_yScrollPixelsPerLine
= 0;
129 m_xScrollingEnabled
= TRUE
;
130 m_yScrollingEnabled
= TRUE
;
131 m_xScrollPosition
= 0;
132 m_yScrollPosition
= 0;
135 m_xScrollLinesPerPage
= 0;
136 m_yScrollLinesPerPage
= 0;
137 m_targetWindow
= (wxWindow
*) NULL
;
140 m_hasScrolling
= TRUE
;
143 bool wxScrolledWindow::Create(wxWindow
*parent
,
148 const wxString
& name
)
152 if (!PreCreation( parent
, pos
, size
) ||
153 !CreateBase( parent
, id
, pos
, size
, style
, wxDefaultValidator
, name
))
155 wxFAIL_MSG( wxT("wxWindow creation failed") );
159 m_insertCallback
= wxInsertChildInScrolledWindow
;
161 m_targetWindow
= this;
163 m_widget
= gtk_scrolled_window_new( (GtkAdjustment
*) NULL
, (GtkAdjustment
*) NULL
);
164 GTK_WIDGET_UNSET_FLAGS( m_widget
, GTK_CAN_FOCUS
);
166 GtkScrolledWindow
*scrolledWindow
= GTK_SCROLLED_WINDOW(m_widget
);
168 GtkScrolledWindowClass
*scroll_class
= GTK_SCROLLED_WINDOW_CLASS( GTK_OBJECT_GET_CLASS(m_widget
) );
169 scroll_class
->scrollbar_spacing
= 0;
171 gtk_scrolled_window_set_policy( scrolledWindow
, GTK_POLICY_AUTOMATIC
, GTK_POLICY_AUTOMATIC
);
173 m_hAdjust
= gtk_range_get_adjustment( GTK_RANGE(scrolledWindow
->hscrollbar
) );
174 m_vAdjust
= gtk_range_get_adjustment( GTK_RANGE(scrolledWindow
->vscrollbar
) );
176 m_wxwindow
= gtk_pizza_new();
178 gtk_container_add( GTK_CONTAINER(m_widget
), m_wxwindow
);
180 GtkPizza
*pizza
= GTK_PIZZA(m_wxwindow
);
182 if (HasFlag(wxRAISED_BORDER
))
184 gtk_pizza_set_shadow_type( pizza
, GTK_MYSHADOW_OUT
);
186 else if (HasFlag(wxSUNKEN_BORDER
))
188 gtk_pizza_set_shadow_type( pizza
, GTK_MYSHADOW_IN
);
190 else if (HasFlag(wxSIMPLE_BORDER
))
192 gtk_pizza_set_shadow_type( pizza
, GTK_MYSHADOW_THIN
);
196 gtk_pizza_set_shadow_type( pizza
, GTK_MYSHADOW_NONE
);
199 GTK_WIDGET_SET_FLAGS( m_wxwindow
, GTK_CAN_FOCUS
);
200 m_acceptsFocus
= TRUE
;
202 // I _really_ don't want scrollbars in the beginning
203 m_vAdjust
->lower
= 0.0;
204 m_vAdjust
->upper
= 1.0;
205 m_vAdjust
->value
= 0.0;
206 m_vAdjust
->step_increment
= 1.0;
207 m_vAdjust
->page_increment
= 1.0;
208 gtk_signal_emit_by_name( GTK_OBJECT(m_vAdjust
), "changed" );
209 m_hAdjust
->lower
= 0.0;
210 m_hAdjust
->upper
= 1.0;
211 m_hAdjust
->value
= 0.0;
212 m_hAdjust
->step_increment
= 1.0;
213 m_hAdjust
->page_increment
= 1.0;
214 gtk_signal_emit_by_name( GTK_OBJECT(m_hAdjust
), "changed" );
216 // Handlers for new scrollbar values
220 gtk_widget_show( m_wxwindow
);
223 m_parent
->DoAddChild( this );
232 // ----------------------------------------------------------------------------
233 // setting scrolling parameters
234 // ----------------------------------------------------------------------------
237 * pixelsPerUnitX/pixelsPerUnitY: number of pixels per unit (e.g. pixels per text line)
238 * noUnitsX/noUnitsY: : no. units per scrollbar
240 void wxScrolledWindow::SetScrollbars (int pixelsPerUnitX
, int pixelsPerUnitY
,
241 int noUnitsX
, int noUnitsY
,
242 int xPos
, int yPos
, bool noRefresh
)
244 m_xScrollPixelsPerLine
= pixelsPerUnitX
;
245 m_yScrollPixelsPerLine
= pixelsPerUnitY
;
246 m_xScrollPosition
= xPos
;
247 m_yScrollPosition
= yPos
;
248 m_xScrollLines
= noUnitsX
;
249 m_yScrollLines
= noUnitsY
;
251 m_hAdjust
->lower
= 0.0;
252 m_hAdjust
->upper
= noUnitsX
;
253 m_hAdjust
->value
= xPos
;
254 m_hAdjust
->step_increment
= 1.0;
255 m_hAdjust
->page_increment
= 2.0;
257 m_vAdjust
->lower
= 0.0;
258 m_vAdjust
->upper
= noUnitsY
;
259 m_vAdjust
->value
= yPos
;
260 m_vAdjust
->step_increment
= 1.0;
261 m_vAdjust
->page_increment
= 2.0;
266 void wxScrolledWindow::AdjustScrollbars()
269 m_targetWindow
->GetClientSize( &w
, &h
);
271 if (m_xScrollPixelsPerLine
== 0)
272 m_hAdjust
->page_size
= 1.0;
274 m_hAdjust
->page_size
= (w
/ m_xScrollPixelsPerLine
);
276 if (m_yScrollPixelsPerLine
== 0)
277 m_vAdjust
->page_size
= 1.0;
279 m_vAdjust
->page_size
= (h
/ m_yScrollPixelsPerLine
);
281 m_xScrollLinesPerPage
= (int)(m_hAdjust
->page_size
+ 0.5);
282 m_yScrollLinesPerPage
= (int)(m_vAdjust
->page_size
+ 0.5);
284 gtk_signal_emit_by_name( GTK_OBJECT(m_vAdjust
), "changed" );
285 gtk_signal_emit_by_name( GTK_OBJECT(m_hAdjust
), "changed" );
288 // ----------------------------------------------------------------------------
289 // target window handling
290 // ----------------------------------------------------------------------------
292 void wxScrolledWindow::SetTargetWindow( wxWindow
*target
)
294 wxASSERT_MSG( target
, wxT("target window must not be NULL") );
295 m_targetWindow
= target
;
298 wxWindow
*wxScrolledWindow::GetTargetWindow()
300 return m_targetWindow
;
303 // Override this function if you don't want to have wxScrolledWindow
304 // automatically change the origin according to the scroll position.
305 void wxScrolledWindow::PrepareDC(wxDC
& dc
)
307 dc
.SetDeviceOrigin( -m_xScrollPosition
* m_xScrollPixelsPerLine
,
308 -m_yScrollPosition
* m_yScrollPixelsPerLine
);
311 void wxScrolledWindow::GetScrollPixelsPerUnit (int *x_unit
, int *y_unit
) const
314 *x_unit
= m_xScrollPixelsPerLine
;
316 *y_unit
= m_yScrollPixelsPerLine
;
319 int wxScrolledWindow::GetScrollPageSize(int orient
) const
321 if ( orient
== wxHORIZONTAL
)
322 return m_xScrollLinesPerPage
;
324 return m_yScrollLinesPerPage
;
327 void wxScrolledWindow::SetScrollPageSize(int orient
, int pageSize
)
329 if ( orient
== wxHORIZONTAL
)
330 m_xScrollLinesPerPage
= pageSize
;
332 m_yScrollLinesPerPage
= pageSize
;
335 void wxScrolledWindow::OnScroll(wxScrollWinEvent
& event
)
337 int orient
= event
.GetOrientation();
339 int nScrollInc
= CalcScrollInc(event
);
340 if (nScrollInc
== 0) return;
342 if (orient
== wxHORIZONTAL
)
344 int newPos
= m_xScrollPosition
+ nScrollInc
;
345 SetScrollPos(wxHORIZONTAL
, newPos
, TRUE
);
349 int newPos
= m_yScrollPosition
+ nScrollInc
;
350 SetScrollPos(wxVERTICAL
, newPos
, TRUE
);
353 if (orient
== wxHORIZONTAL
)
355 m_xScrollPosition
+= nScrollInc
;
359 m_yScrollPosition
+= nScrollInc
;
362 if (orient
== wxHORIZONTAL
)
364 if (m_xScrollingEnabled
)
365 m_targetWindow
->ScrollWindow(-m_xScrollPixelsPerLine
* nScrollInc
, 0, (const wxRect
*) NULL
);
367 m_targetWindow
->Refresh();
371 if (m_yScrollingEnabled
)
372 m_targetWindow
->ScrollWindow(0, -m_yScrollPixelsPerLine
* nScrollInc
, (const wxRect
*) NULL
);
374 m_targetWindow
->Refresh();
378 void wxScrolledWindow::Scroll( int x_pos
, int y_pos
)
383 if (((x_pos
== -1) || (x_pos
== m_xScrollPosition
)) &&
384 ((y_pos
== -1) || (y_pos
== m_yScrollPosition
))) return;
386 if ((x_pos
!= -1) && (m_xScrollPixelsPerLine
))
388 int max
= (int)(m_hAdjust
->upper
- m_hAdjust
->page_size
+ 0.5);
389 if (max
< 0) max
= 0;
390 if (x_pos
> max
) x_pos
= max
;
391 if (x_pos
< 0) x_pos
= 0;
393 int old_x
= m_xScrollPosition
;
394 m_xScrollPosition
= x_pos
;
395 m_hAdjust
->value
= x_pos
;
397 m_targetWindow
->ScrollWindow( (old_x
-m_xScrollPosition
)*m_xScrollPixelsPerLine
, 0 );
399 // Just update the scrollbar, don't send any wxWindows event
400 GtkHDisconnectEvent();
401 gtk_signal_emit_by_name( GTK_OBJECT(m_hAdjust
), "value_changed" );
405 if ((y_pos
!= -1) && (m_yScrollPixelsPerLine
))
407 int max
= (int)(m_vAdjust
->upper
- m_vAdjust
->page_size
+ 0.5);
408 if (max
< 0) max
= 0;
409 if (y_pos
> max
) y_pos
= max
;
410 if (y_pos
< 0) y_pos
= 0;
412 int old_y
= m_yScrollPosition
;
413 m_yScrollPosition
= y_pos
;
414 m_vAdjust
->value
= y_pos
;
416 m_targetWindow
->ScrollWindow( 0, (old_y
-m_yScrollPosition
)*m_yScrollPixelsPerLine
);
418 // Just update the scrollbar, don't send any wxWindows event
419 GtkVDisconnectEvent();
420 gtk_signal_emit_by_name( GTK_OBJECT(m_vAdjust
), "value_changed" );
425 void wxScrolledWindow::GtkVScroll( float value
)
430 if (m_yScrollPixelsPerLine
== 0)
433 int y_pos
= (int)(value
+0.5);
435 if (y_pos
== m_yScrollPosition
)
438 GtkScrolledWindow
*scrolledWindow
= GTK_SCROLLED_WINDOW(m_widget
);
439 GtkRange
*range
= GTK_RANGE(scrolledWindow
->vscrollbar
);
441 wxEventType command
= wxEVT_SCROLLWIN_THUMBTRACK
;
442 if (range
->scroll_type
== GTK_SCROLL_STEP_BACKWARD
) command
= wxEVT_SCROLLWIN_LINEUP
;
443 else if (range
->scroll_type
== GTK_SCROLL_STEP_FORWARD
) command
= wxEVT_SCROLLWIN_LINEDOWN
;
444 else if (range
->scroll_type
== GTK_SCROLL_PAGE_BACKWARD
) command
= wxEVT_SCROLLWIN_PAGEUP
;
445 else if (range
->scroll_type
== GTK_SCROLL_PAGE_FORWARD
) command
= wxEVT_SCROLLWIN_PAGEDOWN
;
447 wxScrollWinEvent
event( command
, y_pos
, wxVERTICAL
);
448 event
.SetEventObject( this );
449 GetEventHandler()->ProcessEvent( event
);
452 void wxScrolledWindow::GtkHScroll( float value
)
457 if (m_xScrollPixelsPerLine
== 0)
460 int x_pos
= (int)(value
+0.5);
462 if (x_pos
== m_xScrollPosition
)
465 GtkScrolledWindow
*scrolledWindow
= GTK_SCROLLED_WINDOW(m_widget
);
466 GtkRange
*range
= GTK_RANGE(scrolledWindow
->hscrollbar
);
468 wxEventType command
= wxEVT_SCROLLWIN_THUMBTRACK
;
469 if (range
->scroll_type
== GTK_SCROLL_STEP_BACKWARD
) command
= wxEVT_SCROLLWIN_LINEUP
;
470 else if (range
->scroll_type
== GTK_SCROLL_STEP_FORWARD
) command
= wxEVT_SCROLLWIN_LINEDOWN
;
471 else if (range
->scroll_type
== GTK_SCROLL_PAGE_BACKWARD
) command
= wxEVT_SCROLLWIN_PAGEUP
;
472 else if (range
->scroll_type
== GTK_SCROLL_PAGE_FORWARD
) command
= wxEVT_SCROLLWIN_PAGEDOWN
;
474 wxScrollWinEvent
event( command
, x_pos
, wxHORIZONTAL
);
475 event
.SetEventObject( this );
476 GetEventHandler()->ProcessEvent( event
);
479 void wxScrolledWindow::EnableScrolling (bool x_scroll
, bool y_scroll
)
481 m_xScrollingEnabled
= x_scroll
;
482 m_yScrollingEnabled
= y_scroll
;
485 void wxScrolledWindow::GetVirtualSize (int *x
, int *y
) const
488 *x
= m_xScrollPixelsPerLine
* m_xScrollLines
;
490 *y
= m_yScrollPixelsPerLine
* m_yScrollLines
;
493 // Where the current view starts from
494 void wxScrolledWindow::GetViewStart (int *x
, int *y
) const
497 *x
= m_xScrollPosition
;
499 *y
= m_yScrollPosition
;
502 void wxScrolledWindow::CalcScrolledPosition(int x
, int y
, int *xx
, int *yy
) const
505 *xx
= x
- m_xScrollPosition
* m_xScrollPixelsPerLine
;
507 *yy
= y
- m_yScrollPosition
* m_yScrollPixelsPerLine
;
510 void wxScrolledWindow::CalcUnscrolledPosition(int x
, int y
, int *xx
, int *yy
) const
513 *xx
= x
+ m_xScrollPosition
* m_xScrollPixelsPerLine
;
515 *yy
= y
+ m_yScrollPosition
* m_yScrollPixelsPerLine
;
518 int wxScrolledWindow::CalcScrollInc(wxScrollWinEvent
& event
)
520 int pos
= event
.GetPosition();
521 int orient
= event
.GetOrientation();
524 if (event
.GetEventType() == wxEVT_SCROLLWIN_TOP
)
526 if (orient
== wxHORIZONTAL
)
527 nScrollInc
= - m_xScrollPosition
;
529 nScrollInc
= - m_yScrollPosition
;
531 if (event
.GetEventType() == wxEVT_SCROLLWIN_BOTTOM
)
533 if (orient
== wxHORIZONTAL
)
534 nScrollInc
= m_xScrollLines
- m_xScrollPosition
;
536 nScrollInc
= m_yScrollLines
- m_yScrollPosition
;
538 if (event
.GetEventType() == wxEVT_SCROLLWIN_LINEUP
)
542 if (event
.GetEventType() == wxEVT_SCROLLWIN_LINEDOWN
)
546 if (event
.GetEventType() == wxEVT_SCROLLWIN_PAGEUP
)
548 if (orient
== wxHORIZONTAL
)
549 nScrollInc
= -GetScrollPageSize(wxHORIZONTAL
);
551 nScrollInc
= -GetScrollPageSize(wxVERTICAL
);
553 if (event
.GetEventType() == wxEVT_SCROLLWIN_PAGEDOWN
)
555 if (orient
== wxHORIZONTAL
)
556 nScrollInc
= GetScrollPageSize(wxHORIZONTAL
);
558 nScrollInc
= GetScrollPageSize(wxVERTICAL
);
560 if ((event
.GetEventType() == wxEVT_SCROLLWIN_THUMBTRACK
) ||
561 (event
.GetEventType() == wxEVT_SCROLLWIN_THUMBRELEASE
))
563 if (orient
== wxHORIZONTAL
)
564 nScrollInc
= pos
- m_xScrollPosition
;
566 nScrollInc
= pos
- m_yScrollPosition
;
569 if (orient
== wxHORIZONTAL
)
571 if (m_xScrollPixelsPerLine
> 0)
573 int max
= (int)(m_hAdjust
->upper
- m_hAdjust
->page_size
+ 0.5);
574 if (max
< 0) max
= 0;
576 if ( (m_xScrollPosition
+ nScrollInc
) < 0 )
577 nScrollInc
= -m_xScrollPosition
; // As -ve as we can go
578 else if ( (m_xScrollPosition
+ nScrollInc
) > max
)
579 nScrollInc
= max
- m_xScrollPosition
; // As +ve as we can go
582 m_targetWindow
->Refresh();
586 if (m_yScrollPixelsPerLine
> 0)
588 int max
= (int)(m_vAdjust
->upper
- m_vAdjust
->page_size
+ 0.5);
589 if (max
< 0) max
= 0;
591 if ( (m_yScrollPosition
+ nScrollInc
) < 0 )
592 nScrollInc
= -m_yScrollPosition
; // As -ve as we can go
593 else if ( (m_yScrollPosition
+ nScrollInc
) > max
)
594 nScrollInc
= max
- m_yScrollPosition
; // As +ve as we can go
597 m_targetWindow
->Refresh();
603 void wxScrolledWindow::SetScrollPos( int orient
, int pos
, bool WXUNUSED(refresh
) )
605 wxCHECK_RET( m_widget
!= NULL
, wxT("invalid window") );
607 wxCHECK_RET( m_wxwindow
!= NULL
, wxT("window needs client area for scrolling") );
609 if (orient
== wxHORIZONTAL
)
611 int max
= (int)(m_hAdjust
->upper
- m_hAdjust
->page_size
+ 0.5);
612 if (max
< 0) max
= 0;
614 if (pos
> max
) pos
= 0;
615 if (pos
< 0) pos
= 0;
617 if (pos
== (int)(m_hAdjust
->value
+0.5)) return;
618 m_hAdjust
->value
= pos
;
622 int max
= (int)(m_vAdjust
->upper
- m_vAdjust
->page_size
+ 0.5);
623 if (max
< 0) max
= 0;
625 if (pos
> max
) pos
= 0;
626 if (pos
< 0) pos
= 0;
628 if (pos
== (int)(m_vAdjust
->value
+0.5)) return;
629 m_vAdjust
->value
= pos
;
632 if (m_wxwindow
->window
)
634 if (orient
== wxHORIZONTAL
)
636 // Just update the scrollbar, don't send any wxWindows event
637 GtkHDisconnectEvent();
638 gtk_signal_emit_by_name( GTK_OBJECT(m_hAdjust
), "value_changed" );
643 // Just update the scrollbar, don't send any wxWindows event
644 GtkVDisconnectEvent();
645 gtk_signal_emit_by_name( GTK_OBJECT(m_vAdjust
), "value_changed" );
651 void wxScrolledWindow::GtkVConnectEvent()
653 gtk_signal_connect( GTK_OBJECT(m_vAdjust
), "value_changed",
654 (GtkSignalFunc
) gtk_scrolled_window_vscroll_callback
, (gpointer
) this );
657 void wxScrolledWindow::GtkHConnectEvent()
659 gtk_signal_connect( GTK_OBJECT(m_hAdjust
), "value_changed",
660 (GtkSignalFunc
) gtk_scrolled_window_hscroll_callback
, (gpointer
) this );
663 void wxScrolledWindow::GtkHDisconnectEvent()
665 gtk_signal_disconnect_by_func( GTK_OBJECT(m_hAdjust
),
666 (GtkSignalFunc
) gtk_scrolled_window_hscroll_callback
, (gpointer
) this );
669 void wxScrolledWindow::GtkVDisconnectEvent()
671 gtk_signal_disconnect_by_func( GTK_OBJECT(m_vAdjust
),
672 (GtkSignalFunc
) gtk_scrolled_window_vscroll_callback
, (gpointer
) this );
675 // ----------------------------------------------------------------------------
677 // ----------------------------------------------------------------------------
679 // Default OnSize resets scrollbars, if any
680 void wxScrolledWindow::OnSize(wxSizeEvent
& WXUNUSED(event
))
682 #if wxUSE_CONSTRAINTS
690 // This calls OnDraw, having adjusted the origin according to the current
692 void wxScrolledWindow::OnPaint(wxPaintEvent
& WXUNUSED(event
))
700 // kbd handling: notice that we use OnChar() and not OnKeyDown() for
701 // compatibility here - if we used OnKeyDown(), the programs which process
702 // arrows themselves in their OnChar() would never get the message and like
703 // this they always have the priority
704 void wxScrolledWindow::OnChar(wxKeyEvent
& event
)
706 int stx
, sty
, // view origin
707 szx
, szy
, // view size (total)
708 clix
, cliy
; // view size (on screen)
710 ViewStart(&stx
, &sty
);
711 GetClientSize(&clix
, &cliy
);
712 GetVirtualSize(&szx
, &szy
);
714 if( m_xScrollPixelsPerLine
)
716 clix
/= m_xScrollPixelsPerLine
;
717 szx
/= m_xScrollPixelsPerLine
;
724 if( m_yScrollPixelsPerLine
)
726 cliy
/= m_yScrollPixelsPerLine
;
727 szy
/= m_yScrollPixelsPerLine
;
735 int xScrollOld
= GetScrollPos(wxHORIZONTAL
),
736 yScrollOld
= GetScrollPos(wxVERTICAL
);
739 switch ( event
.KeyCode() )
743 dsty
= sty
- (5 * cliy
/ 6);
744 Scroll(-1, (dsty
== -1) ? 0 : dsty
);
749 Scroll(-1, sty
+ (5 * cliy
/ 6));
753 Scroll(0, event
.ControlDown() ? 0 : -1);
757 Scroll(szx
- clix
, event
.ControlDown() ? szy
- cliy
: -1);
782 int xScroll
= GetScrollPos(wxHORIZONTAL
);
783 if ( xScroll
!= xScrollOld
)
785 wxScrollWinEvent
event(wxEVT_SCROLLWIN_THUMBTRACK
, xScroll
,
787 event
.SetEventObject(this);
788 GetEventHandler()->ProcessEvent(event
);
791 int yScroll
= GetScrollPos(wxVERTICAL
);
792 if ( yScroll
!= yScrollOld
)
794 wxScrollWinEvent
event(wxEVT_SCROLLWIN_THUMBTRACK
, yScroll
,
796 event
.SetEventObject(this);
797 GetEventHandler()->ProcessEvent(event
);