summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorgraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2007-10-18 17:16:10 +0000
committergraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2007-10-18 17:16:10 +0000
commit4a7af72768eefb23afe566cce52cce3788425dfa (patch)
tree61dbb7547a4732648dc60ceb60c28ff7386da7fb /src/gui
parent98851de91fc5f661087e2859a516b323de6a3c8a (diff)
downloadfpGUI-4a7af72768eefb23afe566cce52cce3788425dfa.tar.xz
* Horizontal scrollbar now also support clicking between the left/right buttons and the slider but to scroll bigger steps.
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/gui_scrollbar.pas36
1 files changed, 33 insertions, 3 deletions
diff --git a/src/gui/gui_scrollbar.pas b/src/gui/gui_scrollbar.pas
index e3033d0b..e1199167 100644
--- a/src/gui/gui_scrollbar.pas
+++ b/src/gui/gui_scrollbar.pas
@@ -292,8 +292,24 @@ begin
Canvas.FillRectangle(0, FSliderPos + FSliderLength, Width, Height - Width - FSliderPos);
Canvas.SetColor(clScrollBar);
end;
+ end
+ else
+ begin
+ if PrevAreaPressed then
+ begin
+ Canvas.SetColor(clShadow1);
+ Canvas.FillRectangle(Height, 0, FSliderPos, Height);
+ Canvas.SetColor(clScrollBar);
+ end
+ else if NextAreaPressed then
+ begin
+ Canvas.SetColor(clShadow1);
+ Canvas.FillRectangle(FSliderPos + FSliderLength, 0, Width - Height - FSliderPos, Height);
+ Canvas.SetColor(clScrollBar);
+ end;
end;
+ // Paint the slider button
if Orientation = orVertical then
begin
Canvas.DrawButtonFace(0, Width + FSliderPos, Width, FSliderLength, [btnIsEmbedded]);
@@ -328,12 +344,12 @@ begin
FEndBtnPressed := True;
FActiveButtonRect.SetRect(0,Height-Width, Width, Height);
end
- else if (y >= Width + FSliderPos) and (y <= Width + FSliderPos + FSliderLength) then
+ else if (y >= (Width + FSliderPos)) and (y <= Width + FSliderPos + FSliderLength) then
begin
FSliderDragging := True;
FSliderDragPos := y;
end
- else if (y > Width) and (y < Width + FSliderPos) then
+ else if (y > Width) and (y < (Width + FSliderPos)) then
begin
// Clicked between Up button and Slider
PrevAreaPressed := True;
@@ -350,20 +366,34 @@ begin
begin
if x <= Height then
begin
+ // Left button has been pressed
PositionChange(-FScrollStep);
FStartBtnPressed := True;
FActiveButtonRect.SetRect(0, 0, Height, Height);
end
else if x >= Width - Height then
begin
+ // Right button has been pressed
PositionChange(FScrollStep);
FEndBtnPressed := True;
FActiveButtonRect.SetRect(Width-Height, 0, Width, Height);
end
- else if (x >= Height + FSliderPos) and (x <= Height + FSliderPos + FSliderLength) then
+ else if (x >= (Height + FSliderPos)) and (x <= Height + FSliderPos + FSliderLength) then
begin
FSliderDragging := True;
FSliderDragPos := x;
+ end
+ else if (x > Height) and (x < (Height + FSliderPos)) then
+ begin
+ // Clicked between Left button and Slider
+ PrevAreaPressed := True;
+ PositionChange(-(FScrollStep * 5));
+ end
+ else if (x < (Width - Height)) and (x > (Height + FSliderPos + FSliderLength)) then
+ begin
+ // Clicked between the Right button and Slider
+ NextAreaPressed := True;
+ PositionChange(FScrollStep * 5);
end;
end;