summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGraeme Geldenhuys <graemeg@gmail.com>2014-07-10 23:03:39 +0100
committerGraeme Geldenhuys <graemeg@gmail.com>2014-07-10 23:03:39 +0100
commita872f4ef99ec514dea6dbcc3cc895193c30c6364 (patch)
treee504eb8061b99a48c30143257a14f2fd5a6cc301 /src
parent290c2d07bb8ff29b1024bf99217cfe05d409c6cc (diff)
downloadfpGUI-a872f4ef99ec514dea6dbcc3cc895193c30c6364.tar.xz
scrollframe: code formatting and design time painting
Diffstat (limited to 'src')
-rw-r--r--src/gui/fpg_scrollframe.pas69
1 files changed, 45 insertions, 24 deletions
diff --git a/src/gui/fpg_scrollframe.pas b/src/gui/fpg_scrollframe.pas
index ca36520a..008832ce 100644
--- a/src/gui/fpg_scrollframe.pas
+++ b/src/gui/fpg_scrollframe.pas
@@ -65,35 +65,34 @@ type
TfpgASFrameClass = class of TfpgAutoSizingFrame;
- TfpgScrollFrame = class (TfpgFrame)
+ TfpgScrollFrame = class(TfpgFrame)
private
- FContentFrame : TfpgAutoSizingFrame;
- FVisibleArea : TfpgEmbeddingFrame;
- FHScrollBar : TfpgScrollBar;
- FVScrollBar : TfpgScrollBar;
- FScrollBarStyle : TfpgScrollStyle;
- function GetXOffset: integer;
- function GetYOffset: integer;
- procedure SetXOffset (x: integer);
- procedure SetYOffset (y: integer);
+ FContentFrame: TfpgAutoSizingFrame;
+ FVisibleArea: TfpgEmbeddingFrame;
+ FHScrollBar: TfpgScrollBar;
+ FVScrollBar: TfpgScrollBar;
+ FScrollBarStyle: TfpgScrollStyle;
+ function GetXOffset: integer;
+ function GetYOffset: integer;
+ procedure SetXOffset(x: integer);
+ procedure SetYOffset(y: integer);
protected
- procedure HandleMouseScroll(x, y: integer; shiftstate: TShiftState;
- delta: smallint); override;
- procedure HandleMouseHorizScroll(x, y: integer; shiftstate: TShiftState;
- delta: smallint); override;
- procedure HandleResize(awidth, aheight: TfpgCoord); override;
- procedure HandleShow; override;
- procedure HScrollBarMove(Sender: TObject; position: integer);
- procedure VScrollBarMove(Sender: TObject; position: integer);
- procedure UpdateScrollbars; virtual;
- property XOffset : integer read GetXOffset write SetXOffset; // these do not...
- property YOffset : integer read GetYOffset write SetYOffset; // ...updatewindowposition
+ procedure HandleMouseScroll(x, y: integer; shiftstate: TShiftState; delta: smallint); override;
+ procedure HandleMouseHorizScroll(x, y: integer; shiftstate: TShiftState; delta: smallint); override;
+ procedure HandleResize(awidth, aheight: TfpgCoord); override;
+ procedure HandleShow; override;
+ procedure HandlePaint; override;
+ procedure HScrollBarMove(Sender: TObject; position: integer);
+ procedure VScrollBarMove(Sender: TObject; position: integer);
+ procedure UpdateScrollbars; virtual;
+ property XOffset: integer read GetXOffset write SetXOffset; // these do not...
+ property YOffset: integer read GetYOffset write SetYOffset; // ...updatewindowposition
public
constructor Create (AOwner: TComponent); override;
constructor Create (AOwner: TComponent; ContentFrameType: TfpgASFrameClass); virtual;
- procedure AfterCreate; override;
- procedure SetContentFrameType(AContentFrameType: TfpgASFrameClass);
- property ContentFrame : TfpgAutoSizingFrame read FContentFrame write FContentFrame;
+ procedure AfterCreate; override;
+ procedure SetContentFrameType(AContentFrameType: TfpgASFrameClass);
+ property ContentFrame: TfpgAutoSizingFrame read FContentFrame write FContentFrame;
end;
@@ -267,6 +266,28 @@ begin
UpdateScrollBars;
end;
+procedure TfpgScrollFrame.HandlePaint;
+begin
+ if csDesigning in ComponentState then
+ begin
+ // clear background rectangle
+ Canvas.Clear(clDarkGray);
+ // When designing, don't draw colors
+ // but draw an outline
+ Canvas.SetLineStyle(1, lsDash);
+ Canvas.DrawRectangle(GetClientRect);
+ Canvas.SetLineStyle(1, lsSolid);
+ Canvas.Color := clUIDesignerGreen;
+ Canvas.DrawLine(0, 0, Width, Height);
+ Canvas.DrawLine(Width, 0, 0, Height);
+ Canvas.TextColor := clShadow1;
+ Canvas.DrawText(5, 5, Name + ': ' + ClassName);
+ Exit; //==>
+ end;
+
+ inherited HandlePaint;
+end;
+
procedure TfpgScrollFrame.HScrollBarMove (Sender: TObject; position: integer);
begin
if position = XOffset then