Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
04c037d8
Kaydet (Commit)
04c037d8
authored
May 07, 2015
tarafından
Tomaž Vajngerl
Kaydeden (comit)
Jan Holesovsky
May 07, 2015
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
refactor ScrollBar to use RenderContext
Change-Id: I8707fa934d729d96e019ad5d0688299bf88954c4
üst
4c329456
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
121 additions
and
120 deletions
+121
-120
scrbar.hxx
include/vcl/scrbar.hxx
+2
-2
scrbar.cxx
vcl/source/control/scrbar.cxx
+119
-118
No files found.
include/vcl/scrbar.hxx
Dosyayı görüntüle @
04c037d8
...
@@ -76,13 +76,13 @@ private:
...
@@ -76,13 +76,13 @@ private:
SAL_DLLPRIVATE
long
ImplCalcThumbPos
(
long
nPixPos
);
SAL_DLLPRIVATE
long
ImplCalcThumbPos
(
long
nPixPos
);
SAL_DLLPRIVATE
long
ImplCalcThumbPosPix
(
long
nPos
);
SAL_DLLPRIVATE
long
ImplCalcThumbPosPix
(
long
nPos
);
SAL_DLLPRIVATE
void
ImplCalc
(
bool
bUpdate
=
true
);
SAL_DLLPRIVATE
void
ImplCalc
(
bool
bUpdate
=
true
);
SAL_DLLPRIVATE
void
ImplDraw
(
sal_uInt16
nDrawFlags
,
OutputDevice
*
pOutDev
);
SAL_DLLPRIVATE
void
ImplDraw
(
vcl
::
RenderContext
&
rRenderContext
,
sal_uInt16
nDrawFlags
);
using
Window
::
ImplScroll
;
using
Window
::
ImplScroll
;
SAL_DLLPRIVATE
long
ImplScroll
(
long
nNewPos
,
bool
bCallEndScroll
);
SAL_DLLPRIVATE
long
ImplScroll
(
long
nNewPos
,
bool
bCallEndScroll
);
SAL_DLLPRIVATE
long
ImplDoAction
(
bool
bCallEndScroll
);
SAL_DLLPRIVATE
long
ImplDoAction
(
bool
bCallEndScroll
);
SAL_DLLPRIVATE
void
ImplDoMouseAction
(
const
Point
&
rPos
,
bool
bCallAction
=
true
);
SAL_DLLPRIVATE
void
ImplDoMouseAction
(
const
Point
&
rPos
,
bool
bCallAction
=
true
);
SAL_DLLPRIVATE
void
ImplInvert
();
SAL_DLLPRIVATE
void
ImplInvert
();
SAL_DLLPRIVATE
bool
ImplDrawNative
(
sal_uInt16
nDrawFlags
);
SAL_DLLPRIVATE
bool
ImplDrawNative
(
vcl
::
RenderContext
&
rRenderContext
,
sal_uInt16
nDrawFlags
);
SAL_DLLPRIVATE
void
ImplDragThumb
(
const
Point
&
rMousePos
);
SAL_DLLPRIVATE
void
ImplDragThumb
(
const
Point
&
rMousePos
);
SAL_DLLPRIVATE
Size
getCurrentCalcSize
()
const
;
SAL_DLLPRIVATE
Size
getCurrentCalcSize
()
const
;
DECL_DLLPRIVATE_LINK
(
ImplTimerHdl
,
Timer
*
);
DECL_DLLPRIVATE_LINK
(
ImplTimerHdl
,
Timer
*
);
...
...
vcl/source/control/scrbar.cxx
Dosyayı görüntüle @
04c037d8
...
@@ -231,7 +231,7 @@ void ScrollBar::ImplUpdateRects( bool bUpdate )
...
@@ -231,7 +231,7 @@ void ScrollBar::ImplUpdateRects( bool bUpdate )
nDraw
|=
SCRBAR_DRAW_PAGE2
;
nDraw
|=
SCRBAR_DRAW_PAGE2
;
if
(
aOldThumbRect
!=
maThumbRect
)
if
(
aOldThumbRect
!=
maThumbRect
)
nDraw
|=
SCRBAR_DRAW_THUMB
;
nDraw
|=
SCRBAR_DRAW_THUMB
;
I
mplDraw
(
nDraw
,
this
);
I
nvalidate
(
);
}
}
}
}
...
@@ -448,26 +448,27 @@ void ScrollBar::Draw( OutputDevice* pDev, const Point& rPos, const Size& /* rSiz
...
@@ -448,26 +448,27 @@ void ScrollBar::Draw( OutputDevice* pDev, const Point& rPos, const Size& /* rSiz
maPage1Rect
+=
aPos
;
maPage1Rect
+=
aPos
;
maPage2Rect
+=
aPos
;
maPage2Rect
+=
aPos
;
ImplDraw
(
SCRBAR_DRAW_ALL
,
pDev
);
ImplDraw
(
*
pDev
,
SCRBAR_DRAW_ALL
);
pDev
->
Pop
();
pDev
->
Pop
();
mbCalcSize
=
true
;
mbCalcSize
=
true
;
}
}
bool
ScrollBar
::
ImplDrawNative
(
sal_uInt16
nDrawFlags
)
bool
ScrollBar
::
ImplDrawNative
(
vcl
::
RenderContext
&
rRenderContext
,
sal_uInt16
nDrawFlags
)
{
{
ScrollbarValue
scrValue
;
ScrollbarValue
scrValue
;
bool
bNativeOK
=
IsNativeControlSupported
(
CTRL_SCROLLBAR
,
PART_ENTIRE_CONTROL
);
bool
bNativeOK
=
rRenderContext
.
IsNativeControlSupported
(
CTRL_SCROLLBAR
,
PART_ENTIRE_CONTROL
);
if
(
!
bNativeOK
)
if
(
!
bNativeOK
)
return
false
;
return
false
;
bool
bHorz
=
(
GetStyle
()
&
WB_HORZ
)
!=
0
;
bool
bHorz
=
(
GetStyle
()
&
WB_HORZ
)
!=
0
;
// Draw the entire background if the control supports it
// Draw the entire background if the control supports it
if
(
IsNativeControlSupported
(
CTRL_SCROLLBAR
,
bHorz
?
PART_DRAW_BACKGROUND_HORZ
:
PART_DRAW_BACKGROUND_VERT
)
)
if
(
rRenderContext
.
IsNativeControlSupported
(
CTRL_SCROLLBAR
,
bHorz
?
PART_DRAW_BACKGROUND_HORZ
:
PART_DRAW_BACKGROUND_VERT
)
)
{
{
ControlState
nState
=
(
IsEnabled
()
?
ControlState
::
ENABLED
:
ControlState
::
NONE
)
|
(
HasFocus
()
?
ControlState
::
FOCUSED
:
ControlState
::
NONE
);
ControlState
nState
=
(
IsEnabled
()
?
ControlState
::
ENABLED
:
ControlState
::
NONE
)
|
(
HasFocus
()
?
ControlState
::
FOCUSED
:
ControlState
::
NONE
);
scrValue
.
mnMin
=
mnMinRange
;
scrValue
.
mnMin
=
mnMinRange
;
scrValue
.
mnMax
=
mnMaxRange
;
scrValue
.
mnMax
=
mnMaxRange
;
...
@@ -484,91 +485,90 @@ bool ScrollBar::ImplDrawNative( sal_uInt16 nDrawFlags )
...
@@ -484,91 +485,90 @@ bool ScrollBar::ImplDrawNative( sal_uInt16 nDrawFlags )
scrValue
.
mnPage1State
=
nState
|
((
mnStateFlags
&
SCRBAR_STATE_PAGE1_DOWN
)
?
ControlState
::
PRESSED
:
ControlState
::
NONE
);
scrValue
.
mnPage1State
=
nState
|
((
mnStateFlags
&
SCRBAR_STATE_PAGE1_DOWN
)
?
ControlState
::
PRESSED
:
ControlState
::
NONE
);
scrValue
.
mnPage2State
=
nState
|
((
mnStateFlags
&
SCRBAR_STATE_PAGE2_DOWN
)
?
ControlState
::
PRESSED
:
ControlState
::
NONE
);
scrValue
.
mnPage2State
=
nState
|
((
mnStateFlags
&
SCRBAR_STATE_PAGE2_DOWN
)
?
ControlState
::
PRESSED
:
ControlState
::
NONE
);
if
(
IsMouseOver
()
)
if
(
IsMouseOver
()
)
{
{
Rectangle
*
pRect
=
ImplFindPartRect
(
GetPointerPosPixel
()
);
Rectangle
*
pRect
=
ImplFindPartRect
(
GetPointerPosPixel
()
);
if
(
pRect
)
if
(
pRect
)
{
{
if
(
pRect
==
&
maThumbRect
)
if
(
pRect
==
&
maThumbRect
)
scrValue
.
mnThumbState
|=
ControlState
::
ROLLOVER
;
scrValue
.
mnThumbState
|=
ControlState
::
ROLLOVER
;
else
if
(
pRect
==
&
maBtn1Rect
)
else
if
(
pRect
==
&
maBtn1Rect
)
scrValue
.
mnButton1State
|=
ControlState
::
ROLLOVER
;
scrValue
.
mnButton1State
|=
ControlState
::
ROLLOVER
;
else
if
(
pRect
==
&
maBtn2Rect
)
else
if
(
pRect
==
&
maBtn2Rect
)
scrValue
.
mnButton2State
|=
ControlState
::
ROLLOVER
;
scrValue
.
mnButton2State
|=
ControlState
::
ROLLOVER
;
else
if
(
pRect
==
&
maPage1Rect
)
else
if
(
pRect
==
&
maPage1Rect
)
scrValue
.
mnPage1State
|=
ControlState
::
ROLLOVER
;
scrValue
.
mnPage1State
|=
ControlState
::
ROLLOVER
;
else
if
(
pRect
==
&
maPage2Rect
)
else
if
(
pRect
==
&
maPage2Rect
)
scrValue
.
mnPage2State
|=
ControlState
::
ROLLOVER
;
scrValue
.
mnPage2State
|=
ControlState
::
ROLLOVER
;
}
}
}
}
Rectangle
aCtrlRegion
;
Rectangle
aCtrlRegion
;
aCtrlRegion
.
Union
(
maBtn1Rect
);
aCtrlRegion
.
Union
(
maBtn1Rect
);
aCtrlRegion
.
Union
(
maBtn2Rect
);
aCtrlRegion
.
Union
(
maBtn2Rect
);
aCtrlRegion
.
Union
(
maPage1Rect
);
aCtrlRegion
.
Union
(
maPage1Rect
);
aCtrlRegion
.
Union
(
maPage2Rect
);
aCtrlRegion
.
Union
(
maPage2Rect
);
aCtrlRegion
.
Union
(
maThumbRect
);
aCtrlRegion
.
Union
(
maThumbRect
);
Rectangle
aRequestedRegion
(
Point
(
0
,
0
),
GetOutputSizePixel
());
Rectangle
aRequestedRegion
(
Point
(
0
,
0
),
rRenderContext
.
GetOutputSizePixel
());
// if the actual native control region is smaller then the region that
// if the actual native control region is smaller then the region that
// we requested the control to draw in, then draw a background rectangle
// we requested the control to draw in, then draw a background rectangle
// to avoid drawing artifacts in the uncovered region
// to avoid drawing artifacts in the uncovered region
if
(
aCtrlRegion
.
GetWidth
()
<
aRequestedRegion
.
GetWidth
()
||
if
(
aCtrlRegion
.
GetWidth
()
<
aRequestedRegion
.
GetWidth
()
||
aCtrlRegion
.
GetHeight
()
<
aRequestedRegion
.
GetHeight
())
aCtrlRegion
.
GetHeight
()
<
aRequestedRegion
.
GetHeight
())
{
{
Color
aFaceColor
=
GetSettings
().
GetStyleSettings
().
GetFaceColor
();
Color
aFaceColor
=
rRenderContext
.
GetSettings
().
GetStyleSettings
().
GetFaceColor
();
SetFillColor
(
aFaceColor
);
rRenderContext
.
SetFillColor
(
aFaceColor
);
SetLineColor
(
aFaceColor
);
rRenderContext
.
SetLineColor
(
aFaceColor
);
DrawRect
(
aRequestedRegion
);
rRenderContext
.
DrawRect
(
aRequestedRegion
);
}
}
bNativeOK
=
DrawNativeControl
(
CTRL_SCROLLBAR
,
(
bHorz
?
PART_DRAW_BACKGROUND_HORZ
:
PART_DRAW_BACKGROUND_VERT
),
bNativeOK
=
rRenderContext
.
DrawNativeControl
(
CTRL_SCROLLBAR
,
(
bHorz
?
PART_DRAW_BACKGROUND_HORZ
:
PART_DRAW_BACKGROUND_VERT
),
aCtrlRegion
,
nState
,
scrValue
,
OUString
()
);
aCtrlRegion
,
nState
,
scrValue
,
OUString
()
);
}
}
else
else
{
{
if
(
(
nDrawFlags
&
SCRBAR_DRAW_PAGE1
)
||
(
nDrawFlags
&
SCRBAR_DRAW_PAGE2
)
)
if
(
(
nDrawFlags
&
SCRBAR_DRAW_PAGE1
)
||
(
nDrawFlags
&
SCRBAR_DRAW_PAGE2
)
)
{
{
sal_uInt32
part1
=
bHorz
?
PART_TRACK_HORZ_LEFT
:
PART_TRACK_VERT_UPPER
;
sal_uInt32
part1
=
bHorz
?
PART_TRACK_HORZ_LEFT
:
PART_TRACK_VERT_UPPER
;
sal_uInt32
part2
=
bHorz
?
PART_TRACK_HORZ_RIGHT
:
PART_TRACK_VERT_LOWER
;
sal_uInt32
part2
=
bHorz
?
PART_TRACK_HORZ_RIGHT
:
PART_TRACK_VERT_LOWER
;
Rectangle
aCtrlRegion1
(
maPage1Rect
);
Rectangle
aCtrlRegion1
(
maPage1Rect
);
Rectangle
aCtrlRegion2
(
maPage2Rect
);
Rectangle
aCtrlRegion2
(
maPage2Rect
);
ControlState
nState1
=
(
IsEnabled
()
?
ControlState
::
ENABLED
:
ControlState
::
NONE
)
|
(
HasFocus
()
?
ControlState
::
FOCUSED
:
ControlState
::
NONE
);
ControlState
nState1
=
(
IsEnabled
()
?
ControlState
::
ENABLED
:
ControlState
::
NONE
)
|
(
HasFocus
()
?
ControlState
::
FOCUSED
:
ControlState
::
NONE
);
ControlState
nState2
=
nState1
;
ControlState
nState2
=
nState1
;
nState1
|=
((
mnStateFlags
&
SCRBAR_STATE_PAGE1_DOWN
)
?
ControlState
::
PRESSED
:
ControlState
::
NONE
);
nState1
|=
((
mnStateFlags
&
SCRBAR_STATE_PAGE1_DOWN
)
?
ControlState
::
PRESSED
:
ControlState
::
NONE
);
nState2
|=
((
mnStateFlags
&
SCRBAR_STATE_PAGE2_DOWN
)
?
ControlState
::
PRESSED
:
ControlState
::
NONE
);
nState2
|=
((
mnStateFlags
&
SCRBAR_STATE_PAGE2_DOWN
)
?
ControlState
::
PRESSED
:
ControlState
::
NONE
);
if
(
IsMouseOver
()
)
if
(
IsMouseOver
()
)
{
{
Rectangle
*
pRect
=
ImplFindPartRect
(
GetPointerPosPixel
()
);
Rectangle
*
pRect
=
ImplFindPartRect
(
GetPointerPosPixel
()
);
if
(
pRect
)
if
(
pRect
)
{
{
if
(
pRect
==
&
maPage1Rect
)
if
(
pRect
==
&
maPage1Rect
)
nState1
|=
ControlState
::
ROLLOVER
;
nState1
|=
ControlState
::
ROLLOVER
;
else
if
(
pRect
==
&
maPage2Rect
)
else
if
(
pRect
==
&
maPage2Rect
)
nState2
|=
ControlState
::
ROLLOVER
;
nState2
|=
ControlState
::
ROLLOVER
;
}
}
}
}
if
(
nDrawFlags
&
SCRBAR_DRAW_PAGE1
)
if
(
nDrawFlags
&
SCRBAR_DRAW_PAGE1
)
bNativeOK
=
DrawNativeControl
(
CTRL_SCROLLBAR
,
part1
,
aCtrlRegion1
,
nState1
,
bNativeOK
=
rRenderContext
.
DrawNativeControl
(
CTRL_SCROLLBAR
,
part1
,
aCtrlRegion1
,
nState1
,
scrValue
,
OUString
());
scrValue
,
OUString
()
);
if
(
nDrawFlags
&
SCRBAR_DRAW_PAGE2
)
if
(
nDrawFlags
&
SCRBAR_DRAW_PAGE2
)
bNativeOK
=
DrawNativeControl
(
CTRL_SCROLLBAR
,
part2
,
aCtrlRegion2
,
nState2
,
bNativeOK
=
rRenderContext
.
DrawNativeControl
(
CTRL_SCROLLBAR
,
part2
,
aCtrlRegion2
,
nState2
,
scrValue
,
OUString
());
scrValue
,
OUString
()
);
}
}
if
(
(
nDrawFlags
&
SCRBAR_DRAW_BTN1
)
||
(
nDrawFlags
&
SCRBAR_DRAW_BTN2
)
)
if
(
(
nDrawFlags
&
SCRBAR_DRAW_BTN1
)
||
(
nDrawFlags
&
SCRBAR_DRAW_BTN2
)
)
{
{
sal_uInt32
part1
=
bHorz
?
PART_BUTTON_LEFT
:
PART_BUTTON_UP
;
sal_uInt32
part1
=
bHorz
?
PART_BUTTON_LEFT
:
PART_BUTTON_UP
;
sal_uInt32
part2
=
bHorz
?
PART_BUTTON_RIGHT
:
PART_BUTTON_DOWN
;
sal_uInt32
part2
=
bHorz
?
PART_BUTTON_RIGHT
:
PART_BUTTON_DOWN
;
Rectangle
aCtrlRegion1
(
maBtn1Rect
);
Rectangle
aCtrlRegion1
(
maBtn1Rect
);
Rectangle
aCtrlRegion2
(
maBtn2Rect
);
Rectangle
aCtrlRegion2
(
maBtn2Rect
);
ControlState
nState1
=
HasFocus
()
?
ControlState
::
FOCUSED
:
ControlState
::
NONE
;
ControlState
nState1
=
HasFocus
()
?
ControlState
::
FOCUSED
:
ControlState
::
NONE
;
ControlState
nState2
=
nState1
;
ControlState
nState2
=
nState1
;
if
(
!
Window
::
IsEnabled
()
||
!
IsEnabled
()
)
if
(
!
Window
::
IsEnabled
()
||
!
IsEnabled
()
)
nState1
=
(
nState2
&=
~
ControlState
::
ENABLED
);
nState1
=
(
nState2
&=
~
ControlState
::
ENABLED
);
else
else
nState1
=
(
nState2
|=
ControlState
::
ENABLED
);
nState1
=
(
nState2
|=
ControlState
::
ENABLED
);
...
@@ -576,171 +576,169 @@ bool ScrollBar::ImplDrawNative( sal_uInt16 nDrawFlags )
...
@@ -576,171 +576,169 @@ bool ScrollBar::ImplDrawNative( sal_uInt16 nDrawFlags )
nState1
|=
((
mnStateFlags
&
SCRBAR_STATE_BTN1_DOWN
)
?
ControlState
::
PRESSED
:
ControlState
::
NONE
);
nState1
|=
((
mnStateFlags
&
SCRBAR_STATE_BTN1_DOWN
)
?
ControlState
::
PRESSED
:
ControlState
::
NONE
);
nState2
|=
((
mnStateFlags
&
SCRBAR_STATE_BTN2_DOWN
)
?
ControlState
::
PRESSED
:
ControlState
::
NONE
);
nState2
|=
((
mnStateFlags
&
SCRBAR_STATE_BTN2_DOWN
)
?
ControlState
::
PRESSED
:
ControlState
::
NONE
);
if
(
mnStateFlags
&
SCRBAR_STATE_BTN1_DISABLE
)
if
(
mnStateFlags
&
SCRBAR_STATE_BTN1_DISABLE
)
nState1
&=
~
ControlState
::
ENABLED
;
nState1
&=
~
ControlState
::
ENABLED
;
if
(
mnStateFlags
&
SCRBAR_STATE_BTN2_DISABLE
)
if
(
mnStateFlags
&
SCRBAR_STATE_BTN2_DISABLE
)
nState2
&=
~
ControlState
::
ENABLED
;
nState2
&=
~
ControlState
::
ENABLED
;
if
(
IsMouseOver
()
)
if
(
IsMouseOver
()
)
{
{
Rectangle
*
pRect
=
ImplFindPartRect
(
GetPointerPosPixel
()
);
Rectangle
*
pRect
=
ImplFindPartRect
(
GetPointerPosPixel
()
);
if
(
pRect
)
if
(
pRect
)
{
{
if
(
pRect
==
&
maBtn1Rect
)
if
(
pRect
==
&
maBtn1Rect
)
nState1
|=
ControlState
::
ROLLOVER
;
nState1
|=
ControlState
::
ROLLOVER
;
else
if
(
pRect
==
&
maBtn2Rect
)
else
if
(
pRect
==
&
maBtn2Rect
)
nState2
|=
ControlState
::
ROLLOVER
;
nState2
|=
ControlState
::
ROLLOVER
;
}
}
}
}
if
(
nDrawFlags
&
SCRBAR_DRAW_BTN1
)
if
(
nDrawFlags
&
SCRBAR_DRAW_BTN1
)
bNativeOK
=
DrawNativeControl
(
CTRL_SCROLLBAR
,
part1
,
aCtrlRegion1
,
nState1
,
bNativeOK
=
rRenderContext
.
DrawNativeControl
(
CTRL_SCROLLBAR
,
part1
,
aCtrlRegion1
,
nState1
,
scrValue
,
OUString
());
scrValue
,
OUString
()
);
if
(
nDrawFlags
&
SCRBAR_DRAW_BTN2
)
if
(
nDrawFlags
&
SCRBAR_DRAW_BTN2
)
bNativeOK
=
DrawNativeControl
(
CTRL_SCROLLBAR
,
part2
,
aCtrlRegion2
,
nState2
,
bNativeOK
=
rRenderContext
.
DrawNativeControl
(
CTRL_SCROLLBAR
,
part2
,
aCtrlRegion2
,
nState2
,
scrValue
,
OUString
());
scrValue
,
OUString
()
);
}
}
if
(
(
nDrawFlags
&
SCRBAR_DRAW_THUMB
)
&&
!
maThumbRect
.
IsEmpty
()
)
if
(
(
nDrawFlags
&
SCRBAR_DRAW_THUMB
)
&&
!
maThumbRect
.
IsEmpty
()
)
{
{
ControlState
nState
=
IsEnabled
()
?
ControlState
::
ENABLED
:
ControlState
::
NONE
;
ControlState
nState
=
IsEnabled
()
?
ControlState
::
ENABLED
:
ControlState
::
NONE
;
Rectangle
aCtrlRegion
(
maThumbRect
);
Rectangle
aCtrlRegion
(
maThumbRect
);
if
(
mnStateFlags
&
SCRBAR_STATE_THUMB_DOWN
)
if
(
mnStateFlags
&
SCRBAR_STATE_THUMB_DOWN
)
nState
|=
ControlState
::
PRESSED
;
nState
|=
ControlState
::
PRESSED
;
if
(
HasFocus
()
)
if
(
HasFocus
()
)
nState
|=
ControlState
::
FOCUSED
;
nState
|=
ControlState
::
FOCUSED
;
if
(
IsMouseOver
()
)
if
(
IsMouseOver
()
)
{
{
Rectangle
*
pRect
=
ImplFindPartRect
(
GetPointerPosPixel
()
);
Rectangle
*
pRect
=
ImplFindPartRect
(
GetPointerPosPixel
()
);
if
(
pRect
)
if
(
pRect
)
{
{
if
(
pRect
==
&
maThumbRect
)
if
(
pRect
==
&
maThumbRect
)
nState
|=
ControlState
::
ROLLOVER
;
nState
|=
ControlState
::
ROLLOVER
;
}
}
}
}
bNativeOK
=
DrawNativeControl
(
CTRL_SCROLLBAR
,
(
bHorz
?
PART_THUMB_HORZ
:
PART_THUMB_VERT
),
bNativeOK
=
rRenderContext
.
DrawNativeControl
(
CTRL_SCROLLBAR
,
(
bHorz
?
PART_THUMB_HORZ
:
PART_THUMB_VERT
),
aCtrlRegion
,
nState
,
scrValue
,
OUString
()
);
aCtrlRegion
,
nState
,
scrValue
,
OUString
()
);
}
}
}
}
return
bNativeOK
;
return
bNativeOK
;
}
}
void
ScrollBar
::
ImplDraw
(
sal_uInt16
nDrawFlags
,
OutputDevice
*
pOutDev
)
void
ScrollBar
::
ImplDraw
(
vcl
::
RenderContext
&
rRenderContext
,
sal_uInt16
nDrawFlags
)
{
{
DecorationView
aDecoView
(
pOutDev
);
DecorationView
aDecoView
(
&
rRenderContext
);
Rectangle
aTempRect
;
Rectangle
aTempRect
;
sal_uInt16
nStyle
;
sal_uInt16
nStyle
;
const
StyleSettings
&
rStyleSettings
=
pOutDev
->
GetSettings
().
GetStyleSettings
();
const
StyleSettings
&
rStyleSettings
=
rRenderContext
.
GetSettings
().
GetStyleSettings
();
SymbolType
eSymbolType
;
SymbolType
eSymbolType
;
bool
bEnabled
=
IsEnabled
();
bool
bEnabled
=
IsEnabled
();
// Finish some open calculations (if any)
// Finish some open calculations (if any)
if
(
mbCalcSize
)
if
(
mbCalcSize
)
ImplCalc
(
false
);
ImplCalc
(
false
);
vcl
::
Window
*
pWin
=
NULL
;
vcl
::
Window
*
pWin
=
NULL
;
if
(
pOutDev
->
GetOutDevType
()
==
OUTDEV_WINDOW
)
if
(
rRenderContext
.
GetOutDevType
()
==
OUTDEV_WINDOW
)
pWin
=
static_cast
<
vcl
::
Window
*>
(
pOutDev
);
pWin
=
static_cast
<
vcl
::
Window
*>
(
&
rRenderContext
);
// Draw the entire control if the native theme engine needs it
// Draw the entire control if the native theme engine needs it
if
(
nDrawFlags
&&
pWin
&&
pWin
->
IsNativeControlSupported
(
CTRL_SCROLLBAR
,
PART_DRAW_BACKGROUND_HORZ
)
)
if
(
nDrawFlags
&&
pWin
&&
rRenderContext
.
IsNativeControlSupported
(
CTRL_SCROLLBAR
,
PART_DRAW_BACKGROUND_HORZ
)
)
{
{
ImplDrawNative
(
SCRBAR_DRAW_BACKGROUND
);
ImplDrawNative
(
rRenderContext
,
SCRBAR_DRAW_BACKGROUND
);
return
;
return
;
}
}
if
(
(
nDrawFlags
&
SCRBAR_DRAW_BTN1
)
&&
(
!
pWin
||
!
ImplDrawNative
(
SCRBAR_DRAW_BTN1
)
)
)
if
((
nDrawFlags
&
SCRBAR_DRAW_BTN1
)
&&
(
!
pWin
||
!
ImplDrawNative
(
rRenderContext
,
SCRBAR_DRAW_BTN1
))
)
{
{
nStyle
=
BUTTON_DRAW_NOLIGHTBORDER
;
nStyle
=
BUTTON_DRAW_NOLIGHTBORDER
;
if
(
mnStateFlags
&
SCRBAR_STATE_BTN1_DOWN
)
if
(
mnStateFlags
&
SCRBAR_STATE_BTN1_DOWN
)
nStyle
|=
BUTTON_DRAW_PRESSED
;
nStyle
|=
BUTTON_DRAW_PRESSED
;
aTempRect
=
aDecoView
.
DrawButton
(
maBtn1Rect
,
nStyle
);
aTempRect
=
aDecoView
.
DrawButton
(
maBtn1Rect
,
nStyle
);
ImplCalcSymbolRect
(
aTempRect
);
ImplCalcSymbolRect
(
aTempRect
);
nStyle
=
0
;
nStyle
=
0
;
if
(
(
mnStateFlags
&
SCRBAR_STATE_BTN1_DISABLE
)
||
!
bEnabled
)
if
(
(
mnStateFlags
&
SCRBAR_STATE_BTN1_DISABLE
)
||
!
bEnabled
)
nStyle
|=
SYMBOL_DRAW_DISABLE
;
nStyle
|=
SYMBOL_DRAW_DISABLE
;
if
(
rStyleSettings
.
GetOptions
()
&
STYLE_OPTION_SCROLLARROW
)
if
(
rStyleSettings
.
GetOptions
()
&
STYLE_OPTION_SCROLLARROW
)
{
{
if
(
GetStyle
()
&
WB_HORZ
)
if
(
GetStyle
()
&
WB_HORZ
)
eSymbolType
=
SymbolType
::
ARROW_LEFT
;
eSymbolType
=
SymbolType
::
ARROW_LEFT
;
else
else
eSymbolType
=
SymbolType
::
ARROW_UP
;
eSymbolType
=
SymbolType
::
ARROW_UP
;
}
}
else
else
{
{
if
(
GetStyle
()
&
WB_HORZ
)
if
(
GetStyle
()
&
WB_HORZ
)
eSymbolType
=
SymbolType
::
SPIN_LEFT
;
eSymbolType
=
SymbolType
::
SPIN_LEFT
;
else
else
eSymbolType
=
SymbolType
::
SPIN_UP
;
eSymbolType
=
SymbolType
::
SPIN_UP
;
}
}
aDecoView
.
DrawSymbol
(
aTempRect
,
eSymbolType
,
rStyleSettings
.
GetButtonTextColor
(),
nStyle
);
aDecoView
.
DrawSymbol
(
aTempRect
,
eSymbolType
,
rStyleSettings
.
GetButtonTextColor
(),
nStyle
);
}
}
if
(
(
nDrawFlags
&
SCRBAR_DRAW_BTN2
)
&&
(
!
pWin
||
!
ImplDrawNative
(
SCRBAR_DRAW_BTN2
)
)
)
if
(
(
nDrawFlags
&
SCRBAR_DRAW_BTN2
)
&&
(
!
pWin
||
!
ImplDrawNative
(
rRenderContext
,
SCRBAR_DRAW_BTN2
))
)
{
{
nStyle
=
BUTTON_DRAW_NOLIGHTBORDER
;
nStyle
=
BUTTON_DRAW_NOLIGHTBORDER
;
if
(
mnStateFlags
&
SCRBAR_STATE_BTN2_DOWN
)
if
(
mnStateFlags
&
SCRBAR_STATE_BTN2_DOWN
)
nStyle
|=
BUTTON_DRAW_PRESSED
;
nStyle
|=
BUTTON_DRAW_PRESSED
;
aTempRect
=
aDecoView
.
DrawButton
(
maBtn2Rect
,
nStyle
);
aTempRect
=
aDecoView
.
DrawButton
(
maBtn2Rect
,
nStyle
);
ImplCalcSymbolRect
(
aTempRect
);
ImplCalcSymbolRect
(
aTempRect
);
nStyle
=
0
;
nStyle
=
0
;
if
(
(
mnStateFlags
&
SCRBAR_STATE_BTN2_DISABLE
)
||
!
bEnabled
)
if
(
(
mnStateFlags
&
SCRBAR_STATE_BTN2_DISABLE
)
||
!
bEnabled
)
nStyle
|=
SYMBOL_DRAW_DISABLE
;
nStyle
|=
SYMBOL_DRAW_DISABLE
;
if
(
rStyleSettings
.
GetOptions
()
&
STYLE_OPTION_SCROLLARROW
)
if
(
rStyleSettings
.
GetOptions
()
&
STYLE_OPTION_SCROLLARROW
)
{
{
if
(
GetStyle
()
&
WB_HORZ
)
if
(
GetStyle
()
&
WB_HORZ
)
eSymbolType
=
SymbolType
::
ARROW_RIGHT
;
eSymbolType
=
SymbolType
::
ARROW_RIGHT
;
else
else
eSymbolType
=
SymbolType
::
ARROW_DOWN
;
eSymbolType
=
SymbolType
::
ARROW_DOWN
;
}
}
else
else
{
{
if
(
GetStyle
()
&
WB_HORZ
)
if
(
GetStyle
()
&
WB_HORZ
)
eSymbolType
=
SymbolType
::
SPIN_RIGHT
;
eSymbolType
=
SymbolType
::
SPIN_RIGHT
;
else
else
eSymbolType
=
SymbolType
::
SPIN_DOWN
;
eSymbolType
=
SymbolType
::
SPIN_DOWN
;
}
}
aDecoView
.
DrawSymbol
(
aTempRect
,
eSymbolType
,
rStyleSettings
.
GetButtonTextColor
(),
nStyle
);
aDecoView
.
DrawSymbol
(
aTempRect
,
eSymbolType
,
rStyleSettings
.
GetButtonTextColor
(),
nStyle
);
}
}
pOutDev
->
SetLineColor
();
rRenderContext
.
SetLineColor
();
if
(
(
nDrawFlags
&
SCRBAR_DRAW_THUMB
)
&&
(
!
pWin
||
!
ImplDrawNative
(
SCRBAR_DRAW_THUMB
)
)
)
if
(
(
nDrawFlags
&
SCRBAR_DRAW_THUMB
)
&&
(
!
pWin
||
!
ImplDrawNative
(
rRenderContext
,
SCRBAR_DRAW_THUMB
))
)
{
{
if
(
!
maThumbRect
.
IsEmpty
()
)
if
(
!
maThumbRect
.
IsEmpty
()
)
{
{
if
(
bEnabled
)
if
(
bEnabled
)
{
{
nStyle
=
BUTTON_DRAW_NOLIGHTBORDER
;
nStyle
=
BUTTON_DRAW_NOLIGHTBORDER
;
aTempRect
=
aDecoView
.
DrawButton
(
maThumbRect
,
nStyle
);
aTempRect
=
aDecoView
.
DrawButton
(
maThumbRect
,
nStyle
);
}
}
else
else
{
{
pOutDev
->
SetFillColor
(
rStyleSettings
.
GetCheckedColor
()
);
rRenderContext
.
SetFillColor
(
rStyleSettings
.
GetCheckedColor
()
);
pOutDev
->
DrawRect
(
maThumbRect
);
rRenderContext
.
DrawRect
(
maThumbRect
);
}
}
}
}
}
}
if
(
(
nDrawFlags
&
SCRBAR_DRAW_PAGE1
)
&&
(
!
pWin
||
!
ImplDrawNative
(
SCRBAR_DRAW_PAGE1
)
)
)
if
(
(
nDrawFlags
&
SCRBAR_DRAW_PAGE1
)
&&
(
!
pWin
||
!
ImplDrawNative
(
rRenderContext
,
SCRBAR_DRAW_PAGE1
))
)
{
{
if
(
mnStateFlags
&
SCRBAR_STATE_PAGE1_DOWN
)
if
(
mnStateFlags
&
SCRBAR_STATE_PAGE1_DOWN
)
pOutDev
->
SetFillColor
(
rStyleSettings
.
GetShadowColor
()
);
rRenderContext
.
SetFillColor
(
rStyleSettings
.
GetShadowColor
()
);
else
else
pOutDev
->
SetFillColor
(
rStyleSettings
.
GetCheckedColor
()
);
rRenderContext
.
SetFillColor
(
rStyleSettings
.
GetCheckedColor
()
);
pOutDev
->
DrawRect
(
maPage1Rect
);
rRenderContext
.
DrawRect
(
maPage1Rect
);
}
}
if
(
(
nDrawFlags
&
SCRBAR_DRAW_PAGE2
)
&&
(
!
pWin
||
!
ImplDrawNative
(
SCRBAR_DRAW_PAGE2
)
)
)
if
(
(
nDrawFlags
&
SCRBAR_DRAW_PAGE2
)
&&
(
!
pWin
||
!
ImplDrawNative
(
rRenderContext
,
SCRBAR_DRAW_PAGE2
))
)
{
{
if
(
mnStateFlags
&
SCRBAR_STATE_PAGE2_DOWN
)
if
(
mnStateFlags
&
SCRBAR_STATE_PAGE2_DOWN
)
pOutDev
->
SetFillColor
(
rStyleSettings
.
GetShadowColor
()
);
rRenderContext
.
SetFillColor
(
rStyleSettings
.
GetShadowColor
()
);
else
else
pOutDev
->
SetFillColor
(
rStyleSettings
.
GetCheckedColor
()
);
rRenderContext
.
SetFillColor
(
rStyleSettings
.
GetCheckedColor
()
);
pOutDev
->
DrawRect
(
maPage2Rect
);
rRenderContext
.
DrawRect
(
maPage2Rect
);
}
}
}
}
...
@@ -858,7 +856,7 @@ void ScrollBar::ImplDoMouseAction( const Point& rMousePos, bool bCallAction )
...
@@ -858,7 +856,7 @@ void ScrollBar::ImplDoMouseAction( const Point& rMousePos, bool bCallAction )
}
}
if
(
nOldStateFlags
!=
mnStateFlags
)
if
(
nOldStateFlags
!=
mnStateFlags
)
I
mplDraw
(
mnDragDraw
,
this
);
I
nvalidate
(
);
if
(
bAction
)
if
(
bAction
)
ImplDoAction
(
false
);
ImplDoAction
(
false
);
}
}
...
@@ -947,8 +945,11 @@ void ScrollBar::MouseButtonDown( const MouseEvent& rMEvt )
...
@@ -947,8 +945,11 @@ void ScrollBar::MouseButtonDown( const MouseEvent& rMEvt )
if
(
mpData
)
if
(
mpData
)
{
{
mpData
->
mbHide
=
true
;
// disable focus blinking
mpData
->
mbHide
=
true
;
// disable focus blinking
if
(
HasFocus
()
)
if
(
HasFocus
())
ImplDraw
(
SCRBAR_DRAW_THUMB
,
this
);
// paint without focus
{
mnStateFlags
|=
SCRBAR_DRAW_THUMB
;
// paint without focus
Invalidate
();
}
}
}
if
(
mnVisibleSize
<
mnMaxRange
-
mnMinRange
)
if
(
mnVisibleSize
<
mnMaxRange
-
mnMinRange
)
...
@@ -975,7 +976,7 @@ void ScrollBar::MouseButtonDown( const MouseEvent& rMEvt )
...
@@ -975,7 +976,7 @@ void ScrollBar::MouseButtonDown( const MouseEvent& rMEvt )
}
}
mnStateFlags
|=
SCRBAR_STATE_THUMB_DOWN
;
mnStateFlags
|=
SCRBAR_STATE_THUMB_DOWN
;
I
mplDraw
(
mnDragDraw
,
this
);
I
nvalidate
(
);
}
}
}
}
else
if
(
bPage
&&
(
!
HitTestNativeControl
(
CTRL_SCROLLBAR
,
bHorizontal
?
PART_TRACK_HORZ_AREA
:
PART_TRACK_VERT_AREA
,
else
if
(
bPage
&&
(
!
HitTestNativeControl
(
CTRL_SCROLLBAR
,
bHorizontal
?
PART_TRACK_HORZ_AREA
:
PART_TRACK_VERT_AREA
,
...
@@ -1028,7 +1029,7 @@ void ScrollBar::Tracking( const TrackingEvent& rTEvt )
...
@@ -1028,7 +1029,7 @@ void ScrollBar::Tracking( const TrackingEvent& rTEvt )
SCRBAR_STATE_PAGE1_DOWN
|
SCRBAR_STATE_PAGE2_DOWN
|
SCRBAR_STATE_PAGE1_DOWN
|
SCRBAR_STATE_PAGE2_DOWN
|
SCRBAR_STATE_THUMB_DOWN
);
SCRBAR_STATE_THUMB_DOWN
);
if
(
nOldStateFlags
!=
mnStateFlags
)
if
(
nOldStateFlags
!=
mnStateFlags
)
I
mplDraw
(
mnDragDraw
,
this
);
I
nvalidate
(
);
mnDragDraw
=
0
;
mnDragDraw
=
0
;
// Restore the old ThumbPosition when canceled
// Restore the old ThumbPosition when canceled
...
@@ -1122,7 +1123,7 @@ void ScrollBar::KeyInput( const KeyEvent& rKEvt )
...
@@ -1122,7 +1123,7 @@ void ScrollBar::KeyInput( const KeyEvent& rKEvt )
void
ScrollBar
::
Paint
(
vcl
::
RenderContext
&
rRenderContext
,
const
Rectangle
&
)
void
ScrollBar
::
Paint
(
vcl
::
RenderContext
&
rRenderContext
,
const
Rectangle
&
)
{
{
ImplDraw
(
SCRBAR_DRAW_ALL
,
&
rRenderContext
);
ImplDraw
(
rRenderContext
,
SCRBAR_DRAW_ALL
);
}
}
void
ScrollBar
::
Resize
()
void
ScrollBar
::
Resize
()
...
@@ -1176,7 +1177,7 @@ void ScrollBar::LoseFocus()
...
@@ -1176,7 +1177,7 @@ void ScrollBar::LoseFocus()
{
{
if
(
mpData
)
if
(
mpData
)
mpData
->
maTimer
.
Stop
();
mpData
->
maTimer
.
Stop
();
I
mplDraw
(
SCRBAR_DRAW_THUMB
,
this
);
I
nvalidate
(
);
Control
::
LoseFocus
();
Control
::
LoseFocus
();
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment