diff options
author | graemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf> | 2007-08-08 17:55:40 +0000 |
---|---|---|
committer | graemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf> | 2007-08-08 17:55:40 +0000 |
commit | c6c911f4d302861488f8fe1477d812a3055d8409 (patch) | |
tree | d01af41dc0d1e59f8ef9693347cc79ac29fcad1e /src | |
parent | 713b26ce03fc19f38ab6191bbd9e6c83e208884e (diff) | |
download | fpGUI-c6c911f4d302861488f8fe1477d812a3055d8409.tar.xz |
* Replaced the use of TRect with TfpgRect in gui_scrollbar
* Minor code formatting changes in gui_scrollbar.pas
* Fixed the painting of the little square in the bottom right corner of TfpgMemo and TfpgListView when both scrollbars are shown.
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/gui_listview.pas | 16 | ||||
-rw-r--r-- | src/gui/gui_memo.pas | 8 | ||||
-rw-r--r-- | src/gui/gui_scrollbar.pas | 55 |
3 files changed, 49 insertions, 30 deletions
diff --git a/src/gui/gui_listview.pas b/src/gui/gui_listview.pas index be3790da..12f8a2a8 100644 --- a/src/gui/gui_listview.pas +++ b/src/gui/gui_listview.pas @@ -929,14 +929,16 @@ begin if ShowHeaders then PaintHeaders; - // this paints the small square remaining below the vscrollbar and to the right of the hscrollbar - if FVScrollBar.Visible and FHScrollBar.Visible then begin - Canvas.Color := clButtonFace; - Canvas.FillRectangle(Width - 2 - FVScrollBar.Width, - Height - 2 - FHScrollBar.Height, - Width - 2, - Height - 2); + // The little square in the bottom right corner + if FHScrollBar.Visible and FVScrollBar.Visible then + begin + Canvas.SetColor(clButtonFace); + Canvas.FillRectangle(FHScrollBar.Left+FHScrollBar.Width, + FVScrollBar.Top+FVScrollBar.Height, + FVScrollBar.Width, + FHScrollBar.Height); end; + fpgStyle.DrawControlFrame(Canvas, 0,0,Width,Height); diff --git a/src/gui/gui_memo.pas b/src/gui/gui_memo.pas index 3f0915bc..1e7d3635 100644 --- a/src/gui/gui_memo.pas +++ b/src/gui/gui_memo.pas @@ -696,9 +696,11 @@ begin // The little square in the bottom right corner if FHScrollBar.Visible and FVScrollBar.Visible then begin - Canvas.SetColor(clWindowBackground); - Canvas.FillRectangle(FHScrollBar.Width, FVScrollBar.Height, - FVScrollBar.Width, FHScrollBar.Height); + Canvas.SetColor(clButtonFace); + Canvas.FillRectangle(FHScrollBar.Left+FHScrollBar.Width, + FVScrollBar.Top+FVScrollBar.Height, + FVScrollBar.Width, + FHScrollBar.Height); end; Canvas.EndDraw; diff --git a/src/gui/gui_scrollbar.pas b/src/gui/gui_scrollbar.pas index af53954a..6f16b2c7 100644 --- a/src/gui/gui_scrollbar.pas +++ b/src/gui/gui_scrollbar.pas @@ -43,7 +43,7 @@ type FSliderDragPos: TfpgCoord; FSliderDragStart: TfpgCoord; FScrollTimer: TfpgTimer; - FActiveButtonRect: TRect; + FActiveButtonRect: TfpgRect; FMousePosition: TPoint; procedure ScrollTimer(Sender: TObject); procedure DrawButton(x, y, w, h: TfpgCoord; const imgname: string; Pressed: Boolean = False); @@ -124,25 +124,36 @@ end; procedure TfpgScrollBar.SetMax(const AValue: integer); begin - if AValue = FMax then Exit; - if AValue < FMin then FMax := FMin - else FMax := AValue; - if FPosition > FMax then SetPosition(FMax); + if AValue = FMax then + Exit; + if AValue < FMin then + FMax := FMin + else + FMax := AValue; + if FPosition > FMax then + SetPosition(FMax); end; procedure TfpgScrollBar.SetMin(const AValue: integer); begin - if AValue = FMin then Exit; - if AValue > FMax then FMin := FMax - else FMin := AValue; - if FPosition < FMin then SetPosition(FMin); + if AValue = FMin then + Exit; + if AValue > FMax then + FMin := FMax + else + FMin := AValue; + if FPosition < FMin then + SetPosition(FMin); end; procedure TfpgScrollBar.SetPosition(const AValue: integer); begin - if AValue < FMin then FPosition := FMin - else if AValue > FMax then FPosition := FMax - else FPosition := AValue; + if AValue < FMin then + FPosition := FMin + else if AValue > FMax then + FPosition := FMax + else + FPosition := AValue; end; procedure TfpgScrollBar.ScrollTimer(Sender: TObject); @@ -153,13 +164,17 @@ begin and (FMousePosition.Y < FActiveButtonRect.Bottom) and (FMousePosition.Y > FActiveButtonRect.Top) then begin - if FStartBtnPressed then begin + if FStartBtnPressed then + begin PositionChange(-FScrollStep); - if Position = FMin then FScrollTimer.Enabled := False; + if Position = FMin then + FScrollTimer.Enabled := False; end; - if FEndBtnPressed then begin + if FEndBtnPressed then + begin PositionChange(FScrollStep); - if Position = FMax then FScrollTimer.Enabled := False; + if Position = FMax then + FScrollTimer.Enabled := False; end; end else @@ -246,13 +261,13 @@ begin begin PositionChange(-FScrollStep); FStartBtnPressed := True; - FActiveButtonRect := Rect(0, 0, Width, Width); + FActiveButtonRect.SetRect(0, 0, Width, Width); end else if y >= Height - Width then begin PositionChange(FScrollStep); FEndBtnPressed := True; - FActiveButtonRect := Rect(0,Height-Width, Width, Height); + FActiveButtonRect.SetRect(0,Height-Width, Width, Height); end else if (y >= Width + FSliderPos) and (y <= Width + FSliderPos + FSliderLength) then begin @@ -266,13 +281,13 @@ begin begin PositionChange(-FScrollStep); FStartBtnPressed := True; - FActiveButtonRect := Rect(0, 0, Height, Height); + FActiveButtonRect.SetRect(0, 0, Height, Height); end else if x >= Width - Height then begin PositionChange(FScrollStep); FEndBtnPressed := True; - FActiveButtonRect := Rect(Width-Height, 0, Width, Height); + FActiveButtonRect.SetRect(Width-Height, 0, Width, Height); end else if (x >= Height + FSliderPos) and (x <= Height + FSliderPos + FSliderLength) then begin |