46
46
//GetPainter().CreateBackgroundTexture(m_BackgroundTexture);
47
hscrollbar = new HScrollBar (NUX_TRACKER_LOCATION);
48
vscrollbar = new VScrollBar (NUX_TRACKER_LOCATION);
47
_hscrollbar = new HScrollBar (NUX_TRACKER_LOCATION);
48
_vscrollbar = new VScrollBar (NUX_TRACKER_LOCATION);
49
// _hscrollbar and _vscrollbar have to be parented so they are correctly
50
// rendered and so that GetRootGeometry/GetAbsoluteGeometry returns the
51
// correct Geometry. This is necessary in embedded mode.
52
_hscrollbar->SetParentObject (this);
53
_vscrollbar->SetParentObject (this);
55
_hscrollbar->SetReconfigureParentLayoutOnGeometryChange(false);
56
_vscrollbar->SetReconfigureParentLayoutOnGeometryChange(false);
50
58
SetMinimumSize (30, 30);
51
59
SetGeometry (Geometry (0, 0, 400, 200) );
53
hscrollbar->OnScrollLeft.connect ( sigc::mem_fun (this, &ScrollView::ScrollLeft) );
54
hscrollbar->OnScrollRight.connect ( sigc::mem_fun (this, &ScrollView::ScrollRight) );
55
vscrollbar->OnScrollUp.connect ( sigc::mem_fun (this, &ScrollView::ScrollUp) );
56
vscrollbar->OnScrollDown.connect ( sigc::mem_fun (this, &ScrollView::ScrollDown) );
61
_hscrollbar->OnScrollLeft.connect ( sigc::mem_fun (this, &ScrollView::ScrollLeft) );
62
_hscrollbar->OnScrollRight.connect ( sigc::mem_fun (this, &ScrollView::ScrollRight) );
63
_vscrollbar->OnScrollUp.connect ( sigc::mem_fun (this, &ScrollView::ScrollUp) );
64
_vscrollbar->OnScrollDown.connect ( sigc::mem_fun (this, &ScrollView::ScrollDown) );
58
// hscrollbar and vscrollbar have to be parented so they are correctly
59
// rendered and so that GetRootGeometry/GetAbsoluteGeometry returns the
60
// correct Geometry. This is necessary in embedded mode.
61
hscrollbar->SetParentObject (this);
62
vscrollbar->SetParentObject (this);
66
mouse_wheel.connect(sigc::mem_fun(this, &ScrollView::RecvMouseWheel));
67
_vscrollbar->mouse_wheel.connect(sigc::mem_fun(this, &ScrollView::RecvMouseWheel));
75
80
ChildFocusChanged.connect (sigc::mem_fun (this, &ScrollView::OnChildFocusChanged));
82
SetAcceptMouseWheelEvent(true);
80
ScrollView::SetVScrollBar (VScrollBar* newVScrollBar)
85
// customization for Unity
86
void ScrollView::SetVScrollBar (VScrollBar* newVScrollBar)
84
// disconnect old vscrollbar
85
vscrollbar->OnScrollUp.connect (sigc::mem_fun (this,
90
// disconnect old _vscrollbar
91
_vscrollbar->OnScrollUp.connect (sigc::mem_fun (this,
86
92
&ScrollView::ScrollUp));
87
vscrollbar->OnScrollDown.connect (sigc::mem_fun (this,
93
_vscrollbar->OnScrollDown.connect (sigc::mem_fun (this,
88
94
&ScrollView::ScrollDown));
89
if (vscrollbar->OwnsTheReference ())
91
vscrollbar->UnReference ();
95
vscrollbar->Dispose ();
95
_vscrollbar->UnReference ();
99
vscrollbar = newVScrollBar;
101
vscrollbar->Reference ();
102
vscrollbar->SetParentObject (this);
104
// connect new vscrollbar
105
vscrollbar->OnScrollUp.connect (sigc::mem_fun (this,
98
_vscrollbar = newVScrollBar;
100
_vscrollbar->Reference ();
101
_vscrollbar->SetParentObject (this);
102
_vscrollbar->SetReconfigureParentLayoutOnGeometryChange(false);
104
// connect new _vscrollbar
105
_vscrollbar->OnScrollUp.connect (sigc::mem_fun (this,
106
106
&ScrollView::ScrollUp));
107
vscrollbar->OnScrollDown.connect (sigc::mem_fun (this,
107
_vscrollbar->OnScrollDown.connect (sigc::mem_fun (this,
108
108
&ScrollView::ScrollDown));
111
111
ScrollView::~ScrollView()
113
113
// Delete all the interface object: This is a problem... The widget should be destroy by there associated parameters
114
if (hscrollbar->OwnsTheReference ())
116
hscrollbar->UnReference ();
120
hscrollbar->Dispose ();
123
if (vscrollbar->OwnsTheReference ())
125
vscrollbar->UnReference ();
129
vscrollbar->Dispose ();
114
_hscrollbar->UnReference ();
115
_vscrollbar->UnReference ();
133
void ScrollView::OnChildFocusChanged (Area *parent, Area *child)
118
void ScrollView::OnChildFocusChanged (/*Area *parent,*/ Area *child)
135
120
if (child->IsView ())
200
184
if (m_vertical_scrollbar_enable)
201
ret = vscrollbar->ProcessEvent (event, ret, ProcEvInfo);
185
ret = _vscrollbar->ProcessEvent (event, ret, ProcEvInfo);
203
187
if (m_horizontal_scrollbar_enable)
204
ret = hscrollbar->ProcessEvent (event, ret, ProcEvInfo);
188
ret = _hscrollbar->ProcessEvent (event, ret, ProcEvInfo);
206
190
// The child layout get the Mouse down button only if the MouseDown happened inside the client view Area
207
191
Geometry viewGeometry = Geometry (m_ViewX, m_ViewY, m_ViewWidth, m_ViewHeight);
224
208
ret = m_CompositionLayout->ProcessEvent (mod_event, ret, ProcEvInfo);
229
211
ret = PostProcessEvent2 (event, ret, 0);
215
Area* ScrollView::FindAreaUnderMouse(const Point& mouse_position, NuxEventType event_type)
217
// Test if the mouse is inside the ScrollView.
218
// The last parameter of TestMousePointerInclusion is a boolean used to test if the case
219
// of mouse wheel events. If that boolean value is true, then TestMousePointerInclusion
220
// returns true only if the mouse pointer is over this area and the the area accepts
221
// mouse wheel events (see Area::SetAcceptMouseWheelEvent)
222
bool mouse_inside = TestMousePointerInclusionFilterMouseWheel(mouse_position, event_type);
224
if(mouse_inside == false)
226
// The mouse pointer is not over this Area. return NULL.
232
// Recursively go over the ui element that are managed by this ScrollView and look
233
// for the area that is below the mouse.
235
// Test the vertical scrollbar
236
found_area = _vscrollbar->FindAreaUnderMouse(mouse_position, event_type);
237
NUX_RETURN_VALUE_IF_NOTNULL(found_area, found_area);
239
// Test the horizontal scrollbar
240
found_area = _hscrollbar->FindAreaUnderMouse(mouse_position, event_type);
241
NUX_RETURN_VALUE_IF_NOTNULL(found_area, found_area);
243
// If the code gets here, it means that no area has been found yet.
244
// Test the layout of the ScrollView
245
return View::FindAreaUnderMouse(mouse_position, event_type);
233
248
bool ScrollView::SetLayout (Layout *layout)
235
250
if(View::SetLayout(layout) == false)
249
264
Geometry base = GetGeometry ();
251
266
if (m_CompositionLayout)
252
m_CompositionLayout->NeedRedraw();
267
m_CompositionLayout->QueueDraw();
254
269
GetPainter().PaintBackground (GfxContext, base);
256
271
if (m_vertical_scrollbar_enable)
258
vscrollbar->NeedRedraw();
273
_vscrollbar->QueueDraw();
261
276
if (m_horizontal_scrollbar_enable)
263
hscrollbar->NeedRedraw();
278
_hscrollbar->QueueDraw();
266
281
GfxContext.PopClippingRectangle();
288
303
if (m_vertical_scrollbar_enable)
290
vscrollbar->ProcessDraw (GfxContext, force_draw);
305
_vscrollbar->ProcessDraw (GfxContext, force_draw);
293
308
if (m_horizontal_scrollbar_enable)
295
hscrollbar->ProcessDraw (GfxContext, force_draw);
310
_hscrollbar->ProcessDraw (GfxContext, force_draw);
298
313
GfxContext.PopClippingRectangle();
360
375
void ScrollView::PreLayoutManagement()
377
// Reset the client view to the top left corner of the container.
378
_delta_x = _delta_y = 0;
362
379
// Give the managed layout the same size and position as the Control.
364
381
Geometry geo = GetGeometry();
365
int ScrollBarWidth = vscrollbar->GetBaseWidth();
366
int ScrollBarHeight = hscrollbar->GetBaseHeight();
382
int ScrollBarWidth = _vscrollbar->GetBaseWidth();
383
int ScrollBarHeight = _hscrollbar->GetBaseHeight();
368
385
nuxAssertMsg (ScrollBarWidth > 0, TEXT ("[ScrollView::PreLayoutManagement] Invalid scrollbar width.") );
369
386
nuxAssertMsg (ScrollBarHeight > 0, TEXT ("[ScrollView::PreLayoutManagement] Invalid scrollbar height.") );
423
440
if (m_vertical_scrollbar_enable == false)
425
442
// If there is no vertical scrollbar, take all the width available.
426
hscrollbar->SetBaseWidth (GetBaseWidth() - 2 * m_border);
443
_hscrollbar->SetBaseWidth (GetBaseWidth() - 2 * m_border);
429
hscrollbar->SetBaseWidth (GetBaseWidth() - ScrollBarWidth - 2 * m_border);
446
_hscrollbar->SetBaseWidth (GetBaseWidth() - ScrollBarWidth - 2 * m_border);
431
hscrollbar->SetBaseX (geo.x + m_border);
432
hscrollbar->SetBaseY (geo.y + geo.GetHeight() - hscrollbar->GetBaseHeight() - m_border);
433
hscrollbar->ComputeChildLayout();
448
_hscrollbar->SetBaseX (geo.x + m_border);
449
_hscrollbar->SetBaseY (geo.y + geo.GetHeight() - _hscrollbar->GetBaseHeight() - m_border);
450
_hscrollbar->ComputeChildLayout();
437
454
// The horizontal scrollbar won't be visible but give it a proper size anyway.
438
hscrollbar->SetBaseWidth (GetBaseWidth() - ScrollBarWidth - 2 * m_border);
439
hscrollbar->SetBaseX (geo.x + m_border);
440
hscrollbar->SetBaseY (geo.y + geo.GetHeight() - hscrollbar->GetBaseHeight() - m_border);
441
hscrollbar->ComputeChildLayout();
455
_hscrollbar->SetBaseWidth (GetBaseWidth() - ScrollBarWidth - 2 * m_border);
456
_hscrollbar->SetBaseX (geo.x + m_border);
457
_hscrollbar->SetBaseY (geo.y + geo.GetHeight() - _hscrollbar->GetBaseHeight() - m_border);
458
_hscrollbar->ComputeChildLayout();
448
465
if (m_horizontal_scrollbar_enable == false)
450
467
// If there is no horizontal scrollbar, take all the width available.
451
vscrollbar->SetBaseHeight (GetBaseHeight() - m_top_border - m_border);
468
_vscrollbar->SetBaseHeight (GetBaseHeight() - m_top_border - m_border);
454
vscrollbar->SetBaseHeight (GetBaseHeight() - ScrollBarHeight - m_top_border - m_border);
471
_vscrollbar->SetBaseHeight (GetBaseHeight() - ScrollBarHeight - m_top_border - m_border);
456
vscrollbar->SetBaseX (geo.x + geo.GetWidth() - ScrollBarWidth - m_border);
457
vscrollbar->SetBaseY (geo.y + m_top_border);
458
vscrollbar->ComputeChildLayout();
473
_vscrollbar->SetBaseX (geo.x + geo.GetWidth() - ScrollBarWidth - m_border);
474
_vscrollbar->SetBaseY (geo.y + m_top_border);
475
_vscrollbar->ComputeChildLayout();
462
479
// The vertical scrollbar won't be visible but give it a proper size anyway.
463
vscrollbar->SetBaseHeight (GetBaseHeight() - ScrollBarHeight - m_top_border - m_border);
464
vscrollbar->SetBaseX (geo.x + geo.GetWidth() - ScrollBarWidth - m_border);
465
vscrollbar->SetBaseY (geo.y + m_top_border);
466
vscrollbar->ComputeChildLayout();
480
_vscrollbar->SetBaseHeight (GetBaseHeight() - ScrollBarHeight - m_top_border - m_border);
481
_vscrollbar->SetBaseX (geo.x + geo.GetWidth() - ScrollBarWidth - m_border);
482
_vscrollbar->SetBaseY (geo.y + m_top_border);
483
_vscrollbar->ComputeChildLayout();
486
503
if (m_horizontal_scrollbar_enable)
487
ScrollBarHeight = hscrollbar->GetBaseHeight();
504
ScrollBarHeight = _hscrollbar->GetBaseHeight();
489
506
if (m_vertical_scrollbar_enable)
490
ScrollBarWidth = vscrollbar->GetBaseWidth();
507
ScrollBarWidth = _vscrollbar->GetBaseWidth();
492
hscrollbar->SetContainerSize (GetBaseX() + m_border + m_ViewContentLeftMargin,
509
_hscrollbar->SetContainerSize (GetBaseX() + m_border + m_ViewContentLeftMargin,
493
510
GetBaseY() + m_top_border + m_ViewContentTopMargin,
494
511
GetBaseWidth() - ScrollBarWidth - 2 * m_border - m_ViewContentRightMargin - m_ViewContentLeftMargin,
495
512
GetBaseHeight() - ScrollBarHeight - m_top_border - m_border - m_ViewContentBottomMargin - m_ViewContentTopMargin);
499
516
if (m_CompositionLayout)
501
hscrollbar->SetContentSize (m_CompositionLayout->GetBaseX(), m_CompositionLayout->GetBaseY(),
518
_hscrollbar->SetContentSize (m_CompositionLayout->GetBaseX(), m_CompositionLayout->GetBaseY(),
502
519
m_CompositionLayout->GetBaseWidth(), m_CompositionLayout->GetBaseHeight() );
506
hscrollbar->SetContentSize (GetBaseX() + m_border + m_ViewContentLeftMargin,
523
_hscrollbar->SetContentSize (GetBaseX() + m_border + m_ViewContentLeftMargin,
507
524
GetBaseY() + m_top_border + m_ViewContentTopMargin, 0, 0);
510
hscrollbar->SetContentOffset (_delta_x, _delta_y);
527
_hscrollbar->SetContentOffset (_delta_x, _delta_y);
514
hscrollbar->SetContentSize (GetBaseX() + m_border + m_ViewContentLeftMargin,
531
_hscrollbar->SetContentSize (GetBaseX() + m_border + m_ViewContentLeftMargin,
515
532
GetBaseY() + m_top_border + m_ViewContentTopMargin, 0, 0);
516
hscrollbar->SetContentOffset (0, 0);
533
_hscrollbar->SetContentOffset (0, 0);
519
vscrollbar->SetContainerSize (GetBaseX() + m_border + m_ViewContentLeftMargin,
536
_vscrollbar->SetContainerSize (GetBaseX() + m_border + m_ViewContentLeftMargin,
520
537
GetBaseY() + m_top_border + m_ViewContentTopMargin,
521
538
GetBaseWidth() - ScrollBarWidth - 2 * m_border - m_ViewContentRightMargin - m_ViewContentLeftMargin,
522
539
GetBaseHeight() - ScrollBarHeight - m_top_border - m_border - m_ViewContentBottomMargin - m_ViewContentTopMargin);
526
543
if (m_CompositionLayout)
528
vscrollbar->SetContentSize (m_CompositionLayout->GetBaseX(), m_CompositionLayout->GetBaseY(),
545
_vscrollbar->SetContentSize (m_CompositionLayout->GetBaseX(), m_CompositionLayout->GetBaseY(),
529
546
m_CompositionLayout->GetBaseWidth(), m_CompositionLayout->GetBaseHeight() );
533
vscrollbar->SetContentSize (GetBaseX() + m_border + m_ViewContentLeftMargin,
550
_vscrollbar->SetContentSize (GetBaseX() + m_border + m_ViewContentLeftMargin,
534
551
GetBaseY() + m_top_border + m_ViewContentTopMargin, 0, 0);
537
vscrollbar->SetContentOffset (_delta_x, _delta_y);
554
_vscrollbar->SetContentOffset (_delta_x, _delta_y);
541
vscrollbar->SetContentSize (GetBaseX() + m_border + m_ViewContentLeftMargin,
558
_vscrollbar->SetContentSize (GetBaseX() + m_border + m_ViewContentLeftMargin,
542
559
GetBaseY() + m_top_border + m_ViewContentTopMargin, 0, 0);
543
vscrollbar->SetContentOffset (0, 0);
560
_vscrollbar->SetContentOffset (0, 0);
546
563
// I may not be necessary to call this function here since ComputePosition2 was called on ComputePosition2
605
622
if (m_horizontal_scrollbar_enable)
607
624
if (m_vertical_scrollbar_enable == false)
608
hscrollbar->SetBaseWidth (GetBaseWidth() - 2 * m_border);
625
_hscrollbar->SetBaseWidth (GetBaseWidth() - 2 * m_border);
610
hscrollbar->SetBaseWidth (GetBaseWidth() - ScrollbarWidth - 2 * m_border);
627
_hscrollbar->SetBaseWidth (GetBaseWidth() - ScrollbarWidth - 2 * m_border);
612
hscrollbar->SetBaseX (geo.x + m_border);
613
hscrollbar->SetBaseY (geo.y + geo.GetHeight() - hscrollbar->GetBaseHeight() - m_border);
614
hscrollbar->ComputeChildLayout();
629
_hscrollbar->SetBaseX (geo.x + m_border);
630
_hscrollbar->SetBaseY (geo.y + geo.GetHeight() - _hscrollbar->GetBaseHeight() - m_border);
631
_hscrollbar->ComputeChildLayout();
617
hscrollbar->SetContainerSize (GetBaseX() + m_border + m_ViewContentLeftMargin,
634
_hscrollbar->SetContainerSize (GetBaseX() + m_border + m_ViewContentLeftMargin,
618
635
GetBaseY() + m_top_border + m_ViewContentTopMargin,
619
636
GetBaseWidth() - ScrollbarWidth - 2 * m_border - m_ViewContentRightMargin - m_ViewContentLeftMargin,
620
637
GetBaseHeight() - ScrollbarHeight - m_top_border - m_border - m_ViewContentBottomMargin - m_ViewContentTopMargin);
622
639
if (m_CompositionLayout)
624
hscrollbar->SetContentSize (m_CompositionLayout->GetBaseX(), m_CompositionLayout->GetBaseY(),
641
_hscrollbar->SetContentSize (m_CompositionLayout->GetBaseX(), m_CompositionLayout->GetBaseY(),
625
642
m_CompositionLayout->GetBaseWidth(), m_CompositionLayout->GetBaseHeight() );
629
hscrollbar->SetContentSize (GetBaseX() + m_border + m_ViewContentLeftMargin,
646
_hscrollbar->SetContentSize (GetBaseX() + m_border + m_ViewContentLeftMargin,
630
647
GetBaseY() + m_top_border + m_ViewContentTopMargin, 0, 0);
633
hscrollbar->SetContentOffset (_delta_x, _delta_y);
650
_hscrollbar->SetContentOffset (_delta_x, _delta_y);
637
hscrollbar->SetBaseWidth (GetBaseWidth() - ScrollbarWidth - 2 * m_border);
638
hscrollbar->SetBaseX (geo.x + m_border);
639
hscrollbar->SetBaseY (geo.y + geo.GetHeight() - hscrollbar->GetBaseHeight() - m_border);
640
hscrollbar->ComputeChildLayout();
654
_hscrollbar->SetBaseWidth (GetBaseWidth() - ScrollbarWidth - 2 * m_border);
655
_hscrollbar->SetBaseX (geo.x + m_border);
656
_hscrollbar->SetBaseY (geo.y + geo.GetHeight() - _hscrollbar->GetBaseHeight() - m_border);
657
_hscrollbar->ComputeChildLayout();
643
hscrollbar->SetContainerSize (GetBaseX() + m_border + m_ViewContentLeftMargin,
660
_hscrollbar->SetContainerSize (GetBaseX() + m_border + m_ViewContentLeftMargin,
644
661
GetBaseY() + m_top_border + m_ViewContentTopMargin,
645
662
GetBaseWidth() - ScrollbarWidth - 2 * m_border - m_ViewContentRightMargin - m_ViewContentLeftMargin,
646
663
GetBaseHeight() - ScrollbarHeight - m_top_border - m_border - m_ViewContentBottomMargin - m_ViewContentTopMargin);
647
hscrollbar->SetContentSize (GetBaseX() + m_border + m_ViewContentLeftMargin,
664
_hscrollbar->SetContentSize (GetBaseX() + m_border + m_ViewContentLeftMargin,
648
665
GetBaseY() + m_top_border + m_ViewContentTopMargin, 0, 0);
649
hscrollbar->SetContentOffset (0, 0);
666
_hscrollbar->SetContentOffset (0, 0);
654
671
if (m_vertical_scrollbar_enable)
656
673
if (m_horizontal_scrollbar_enable == false)
657
vscrollbar->SetBaseHeight (GetBaseHeight() - m_top_border - m_border);
674
_vscrollbar->SetBaseHeight (GetBaseHeight() - m_top_border - m_border);
659
vscrollbar->SetBaseHeight (GetBaseHeight() - ScrollbarHeight - m_top_border - m_border);
676
_vscrollbar->SetBaseHeight (GetBaseHeight() - ScrollbarHeight - m_top_border - m_border);
661
vscrollbar->SetBaseX (geo.x + geo.GetWidth() - ScrollbarWidth - m_border);
662
vscrollbar->SetBaseY (geo.y + m_top_border);
663
vscrollbar->ComputeChildLayout();
678
_vscrollbar->SetBaseX (geo.x + geo.GetWidth() - ScrollbarWidth - m_border);
679
_vscrollbar->SetBaseY (geo.y + m_top_border);
680
_vscrollbar->ComputeChildLayout();
666
vscrollbar->SetContainerSize (GetBaseX() + m_border + m_ViewContentLeftMargin,
683
_vscrollbar->SetContainerSize (GetBaseX() + m_border + m_ViewContentLeftMargin,
667
684
GetBaseY() + m_top_border + m_ViewContentTopMargin,
668
685
GetBaseWidth() - ScrollbarWidth - 2 * m_border - m_ViewContentRightMargin - m_ViewContentLeftMargin,
669
686
GetBaseHeight() - ScrollbarHeight - m_top_border - m_border - m_ViewContentBottomMargin - m_ViewContentTopMargin);
671
688
if (m_CompositionLayout)
673
vscrollbar->SetContentSize (m_CompositionLayout->GetBaseX(), m_CompositionLayout->GetBaseY(),
690
_vscrollbar->SetContentSize (m_CompositionLayout->GetBaseX(), m_CompositionLayout->GetBaseY(),
674
691
m_CompositionLayout->GetBaseWidth(), m_CompositionLayout->GetBaseHeight() );
678
vscrollbar->SetContentSize (GetBaseX() + m_border + m_ViewContentLeftMargin,
695
_vscrollbar->SetContentSize (GetBaseX() + m_border + m_ViewContentLeftMargin,
679
696
GetBaseY() + m_top_border + m_ViewContentTopMargin, 0, 0);
682
vscrollbar->SetContentOffset (_delta_x, _delta_y);
699
_vscrollbar->SetContentOffset (_delta_x, _delta_y);
686
vscrollbar->SetBaseHeight (GetBaseHeight() - ScrollbarHeight - m_top_border - m_border);
687
vscrollbar->SetBaseX (geo.x + geo.GetWidth() - ScrollbarWidth - m_border);
688
vscrollbar->SetBaseY (geo.y + m_top_border);
689
vscrollbar->ComputeChildLayout();
703
_vscrollbar->SetBaseHeight (GetBaseHeight() - ScrollbarHeight - m_top_border - m_border);
704
_vscrollbar->SetBaseX (geo.x + geo.GetWidth() - ScrollbarWidth - m_border);
705
_vscrollbar->SetBaseY (geo.y + m_top_border);
706
_vscrollbar->ComputeChildLayout();
692
vscrollbar->SetContainerSize (GetBaseX() + m_border + m_ViewContentLeftMargin,
709
_vscrollbar->SetContainerSize (GetBaseX() + m_border + m_ViewContentLeftMargin,
693
710
GetBaseY() + m_top_border + m_ViewContentTopMargin,
694
711
GetBaseWidth() - ScrollbarWidth - 2 * m_border - m_ViewContentRightMargin - m_ViewContentLeftMargin,
695
712
GetBaseHeight() - ScrollbarHeight - m_top_border - m_border - m_ViewContentBottomMargin - m_ViewContentTopMargin);
696
vscrollbar->SetContentSize (GetBaseX() + m_border + m_ViewContentLeftMargin,
713
_vscrollbar->SetContentSize (GetBaseX() + m_border + m_ViewContentLeftMargin,
697
714
GetBaseY() + m_top_border + m_ViewContentTopMargin, 0, 0);
698
vscrollbar->SetContentOffset (0, 0);
715
_vscrollbar->SetContentOffset (0, 0);
701
718
if (m_CompositionLayout)
766
783
if (m_horizontal_scrollbar_enable)
768
785
if (m_vertical_scrollbar_enable == false)
769
hscrollbar->SetBaseWidth (GetBaseWidth() - 2 * m_border);
786
_hscrollbar->SetBaseWidth (GetBaseWidth() - 2 * m_border);
771
hscrollbar->SetBaseWidth (GetBaseWidth() - w - 2 * m_border);
788
_hscrollbar->SetBaseWidth (GetBaseWidth() - w - 2 * m_border);
773
hscrollbar->SetBaseX (geo.x + m_border);
774
hscrollbar->SetBaseY (geo.y + geo.GetHeight() - hscrollbar->GetBaseHeight() - m_border);
775
hscrollbar->ComputeChildLayout();
790
_hscrollbar->SetBaseX (geo.x + m_border);
791
_hscrollbar->SetBaseY (geo.y + geo.GetHeight() - _hscrollbar->GetBaseHeight() - m_border);
792
_hscrollbar->ComputeChildLayout();
778
795
// Vertical scrollbar Geometry
779
796
if (m_vertical_scrollbar_enable)
781
798
if (m_horizontal_scrollbar_enable == false)
782
vscrollbar->SetBaseHeight (GetBaseHeight() - m_top_border - m_border);
799
_vscrollbar->SetBaseHeight (GetBaseHeight() - m_top_border - m_border);
784
vscrollbar->SetBaseHeight (GetBaseHeight() - h - m_top_border - m_border);
801
_vscrollbar->SetBaseHeight (GetBaseHeight() - h - m_top_border - m_border);
786
vscrollbar->SetBaseX (geo.x + geo.GetWidth() - w - m_border);
787
vscrollbar->SetBaseY (geo.y + m_top_border);
788
vscrollbar->ComputeChildLayout();
803
_vscrollbar->SetBaseX (geo.x + geo.GetWidth() - w - m_border);
804
_vscrollbar->SetBaseY (geo.y + m_top_border);
805
_vscrollbar->ComputeChildLayout();
791
808
if (m_CompositionLayout)
969
vscrollbar->SetContentOffset (_delta_x, _delta_y);
970
vscrollbar->NeedRedraw();
986
_vscrollbar->SetContentOffset (_delta_x, _delta_y);
987
_vscrollbar->QueueDraw();
992
void ScrollView::RecvMouseWheel(int x, int y, int wheel_delta, long button_flags, unsigned long key_flags)
994
// nux can't tell the difference between horizontal and vertical mouse wheel events
995
// so we are only going to support vertical
998
ScrollDown (abs (wheel_delta / NUX_MOUSEWHEEL_DELTA), m_MouseWheelScrollSize);
1002
ScrollUp (abs (wheel_delta / NUX_MOUSEWHEEL_DELTA), m_MouseWheelScrollSize);
1007
bool ScrollView::AcceptKeyNavFocus()