summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/fpg_listbox.pas46
1 files changed, 36 insertions, 10 deletions
diff --git a/src/gui/fpg_listbox.pas b/src/gui/fpg_listbox.pas
index ce1480dc..11baed01 100644
--- a/src/gui/fpg_listbox.pas
+++ b/src/gui/fpg_listbox.pas
@@ -63,6 +63,10 @@ type
procedure SetPopupFrame(const AValue: boolean);
procedure UpdateScrollbarCoords;
procedure SetAutoHeight(const AValue: boolean);
+ function GetScrollBarPage: integer;
+ procedure SetScrollBarPage(const AValue: integer);
+ function GetScrollBarWidth: integer;
+ procedure SetScrollBarWidth(const AValue: integer);
protected
FFont: TfpgFont;
FScrollBar: TfpgScrollBar;
@@ -74,7 +78,6 @@ type
procedure UpdateScrollBar;
procedure FollowFocus;
function ListHeight: TfpgCoord;
- function ScrollBarWidth: TfpgCoord;
function PageLength: integer;
procedure ScrollBarMove(Sender: TObject; APosition: integer);
procedure DrawItem(num: integer; rect: TfpgRect; flags: integer); virtual;
@@ -90,6 +93,8 @@ type
procedure HandleShow; override;
procedure HandlePaint; override;
property AutoHeight: boolean read FAutoHeight write SetAutoHeight default False;
+ property ScrollBarPage: Integer read GetScrollBarPage write SetScrollBarPage;
+ property ScrollBarWidth: Integer read GetScrollBarWidth write SetScrollBarWidth;
property FocusItem: integer read FFocusItem write SetFocusItem;
property FontDesc: string read GetFontDesc write SetFontDesc;
property HotTrack: boolean read FHotTrack write FHotTrack default False;
@@ -105,6 +110,7 @@ type
function RowHeight: integer; virtual;
procedure SetFirstItem(item: integer);
property Font: TfpgFont read FFont;
+ property VisibleItems: integer read PageLength;
property OnChange: TNotifyEvent read FOnChange write FOnChange;
property OnKeyPress; // to allow to detect return or tab key has been pressed
property OnScroll: TNotifyEvent read FOnScroll write FOnScroll;
@@ -147,6 +153,8 @@ type
property Items;
property ParentShowHint;
property PopupFrame;
+ property ScrollBarPage;
+ property ScrollBarWidth;
property ShowHint;
property TabOrder;
property Text;
@@ -416,6 +424,33 @@ begin
Height := (Succ(PageLength) * RowHeight) + (2 * FMargin);
end;
+function TfpgBaseListBox.GetScrollBarPage: integer;
+begin
+ Result:= FScrollBar.PageSize;
+end;
+
+procedure TfpgBaseListBox.SetScrollBarPage(const AValue: integer);
+begin
+ if AValue= FScrollBar.PageSize then
+ Exit; //==>
+ FScrollBar.PageSize:= AValue;
+end;
+
+function TfpgBaseListBox.GetScrollBarWidth: integer;
+begin
+ if FScrollBar.Visible then
+ result := FScrollBar.Width
+ else
+ result := 0;
+end;
+
+procedure TfpgBaseListBox.SetScrollBarWidth(const AValue: integer);
+begin
+ if AValue = FScrollBar.Width then
+ Exit; //==>
+ FScrollBar.Width := AValue;
+end;
+
procedure TfpgBaseListBox.MsgPaint(var msg: TfpgMessageRec);
begin
// Optimising painting and preventing OnPaint from firing if not needed
@@ -482,14 +517,6 @@ begin
result := height - (2*FMargin);
end;
-function TfpgBaseListBox.ScrollBarWidth: TfpgCoord;
-begin
- if FScrollBar.Visible then
- result := FScrollBar.Width
- else
- result := 0;
-end;
-
function TfpgBaseListBox.PageLength: integer;
begin
result := (ListHeight div RowHeight)-1; // component height minus 1 line
@@ -1280,4 +1307,3 @@ begin
end;
end.
-