mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-08 02:19:57 +02:00
statusbar:
- better fix for statusbar jumping (from top to bottom) - add SizeGrip property and implement it for win32 (0001705) git-svn-id: trunk@14591 -
This commit is contained in:
parent
63d551e608
commit
9642488f11
@ -121,6 +121,7 @@ type
|
||||
FHandleObjectNeedsUpdate: boolean;
|
||||
FHandleUpdatePanelIndex: integer; // which panel in the handle object needs update
|
||||
FOnCreatePanelClass: TSBCreatePanelClassEvent;
|
||||
FSizeGrip: Boolean;
|
||||
FUpdateLock: integer; // set by BeginUpdate/EndUpdate
|
||||
FPanels: TStatusPanels;
|
||||
FSimpleText: String;
|
||||
@ -129,6 +130,7 @@ type
|
||||
procedure SetPanels(Value: TStatusPanels);
|
||||
procedure SetSimpleText(const Value : String);
|
||||
procedure SetSimplePanel(Value : Boolean);
|
||||
procedure SetSizeGrip(const AValue: Boolean);
|
||||
protected
|
||||
procedure CreateWnd; override;
|
||||
procedure DestroyWnd; override;
|
||||
@ -149,6 +151,7 @@ type
|
||||
procedure InvalidatePanel(PanelIndex: integer; PanelParts: TPanelParts); virtual;
|
||||
procedure BeginUpdate;
|
||||
procedure EndUpdate;
|
||||
function SizeGripEnabled: Boolean;
|
||||
function UpdatingStatusBar: boolean;
|
||||
property Canvas: TCanvas read FCanvas;
|
||||
published
|
||||
@ -159,6 +162,7 @@ type
|
||||
property Panels: TStatusPanels read FPanels write SetPanels;
|
||||
property SimpleText: String read FSimpleText write SetSimpleText;
|
||||
property SimplePanel: Boolean read FSimplePanel write SetSimplePanel default True;
|
||||
property SizeGrip: Boolean read FSizeGrip write SetSizeGrip default True;
|
||||
property Visible default true;
|
||||
property Color default clBtnFace;
|
||||
property OnClick;
|
||||
|
@ -25,6 +25,7 @@ begin
|
||||
TControlCanvas(FCanvas).Control := Self;
|
||||
ControlStyle := [csCaptureMouse, csClickEvents, csDoubleClicks, csOpaque];
|
||||
FSimplePanel := True;
|
||||
FSizeGrip := True;
|
||||
FPanels := CreatePanels;
|
||||
Color := clBtnFace;
|
||||
Align := alBottom;
|
||||
@ -41,7 +42,7 @@ begin
|
||||
begin
|
||||
FSimpleText := Value;
|
||||
if HandleAllocated and FSimplePanel then
|
||||
TWSStatusBarClass(WidgetSetClass).SetPanelText(Self,0);
|
||||
TWSStatusBarClass(WidgetSetClass).SetPanelText(Self, 0);
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -55,6 +56,15 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TStatusBar.SetSizeGrip(const AValue: Boolean);
|
||||
begin
|
||||
if FSizeGrip = AValue then
|
||||
Exit;
|
||||
FSizeGrip := AValue;
|
||||
if HandleAllocated then
|
||||
TWSStatusBarClass(WidgetSetClass).SetSizeGrip(Self, AValue);
|
||||
end;
|
||||
|
||||
procedure TStatusBar.SetPanels(Value: TStatusPanels);
|
||||
begin
|
||||
FPanels.Assign(Value);
|
||||
@ -167,6 +177,14 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function TStatusBar.SizeGripEnabled: Boolean;
|
||||
begin
|
||||
Result := (Parent <> nil) and
|
||||
(Parent is TCustomForm) and
|
||||
(TCustomForm(Parent).BorderStyle in [bsSizeable, bsSizeToolWin]) and
|
||||
(Align = alBottom);
|
||||
end;
|
||||
|
||||
function TStatusBar.UpdatingStatusBar: boolean;
|
||||
begin
|
||||
Result:=FUpdateLock>0;
|
||||
|
@ -2152,9 +2152,6 @@ begin
|
||||
ThemeServices.UpdateThemes;
|
||||
ThemeServices.IntfDoOnThemeChange;
|
||||
end;
|
||||
WM_SIZE:
|
||||
if lWinControl is TStatusBar then
|
||||
WinProcess := False;
|
||||
|
||||
{ >= WM_USER }
|
||||
|
||||
|
@ -46,11 +46,12 @@ type
|
||||
private
|
||||
protected
|
||||
public
|
||||
class function CreateHandle(const AWinControl: TWinControl;
|
||||
class function CreateHandle(const AWinControl: TWinControl;
|
||||
const AParams: TCreateParams): HWND; override;
|
||||
class procedure Update(const AStatusBar: TStatusBar); override;
|
||||
class procedure PanelUpdate(const AStatusBar: TStatusBar; PanelIndex: integer); override;
|
||||
class procedure SetPanelText(const AStatusBar: TStatusBar; PanelIndex: integer); override;
|
||||
class procedure SetSizeGrip(const AStatusBar: TStatusBar; SizeGrip: Boolean); override;
|
||||
class procedure SetText(const AWinControl: TWinControl; const AText: string); override;
|
||||
class procedure GetPreferredSize(const AWinControl: TWinControl;
|
||||
var PreferredWidth, PreferredHeight: integer;
|
||||
@ -314,7 +315,7 @@ begin
|
||||
Windows.SendMessage(StatusBar.Handle, SB_SETTEXT, 255, WPARAM(PChar('')));
|
||||
exit;
|
||||
end;
|
||||
Getmem(Rights, StatusBar.Panels.Count * sizeof(integer));
|
||||
Getmem(Rights, StatusBar.Panels.Count * SizeOf(integer));
|
||||
try
|
||||
CurrentRight := 0;
|
||||
for PanelIndex := 0 to StatusBar.Panels.Count-2 do begin
|
||||
@ -371,6 +372,12 @@ end;
|
||||
|
||||
class function TWin32WSStatusBar.CreateHandle(const AWinControl: TWinControl;
|
||||
const AParams: TCreateParams): HWND;
|
||||
const
|
||||
GripFlags: array[Boolean] of DWord =
|
||||
(
|
||||
{ - grip } 0,
|
||||
{ + grip } SBARS_SIZEGRIP
|
||||
);
|
||||
var
|
||||
Params: TCreateWindowExParams;
|
||||
begin
|
||||
@ -379,6 +386,7 @@ begin
|
||||
// customization of Params
|
||||
with Params do
|
||||
begin
|
||||
Flags := Flags or CCS_NOPARENTALIGN or GripFlags[TStatusBar(AWinControl).SizeGrip and TStatusBar(AWinControl).SizeGripEnabled];
|
||||
pClassName := STATUSCLASSNAME;
|
||||
WindowTitle := StrCaption;
|
||||
if ThemeServices.ThemesEnabled then
|
||||
@ -423,6 +431,18 @@ begin
|
||||
UpdateStatusBarPanel(AStatusBar.Panels[PanelIndex]);
|
||||
end;
|
||||
|
||||
class procedure TWin32WSStatusBar.SetSizeGrip(const AStatusBar: TStatusBar;
|
||||
SizeGrip: Boolean);
|
||||
var
|
||||
AStyle: Long;
|
||||
begin
|
||||
if not WSCheckHandleAllocated(AStatusBar, 'SetSizeGrip') then
|
||||
Exit;
|
||||
AStyle := GetWindowLong(AStatusBar.Handle, GWL_STYLE);
|
||||
if ((AStyle and SBARS_SIZEGRIP) <> 0) <> (SizeGrip and AStatusBar.SizeGripEnabled) then
|
||||
RecreateWnd(AStatusBar);
|
||||
end;
|
||||
|
||||
class procedure TWin32WSStatusBar.SetText(const AWinControl: TWinControl;
|
||||
const AText: string);
|
||||
begin
|
||||
|
@ -57,6 +57,7 @@ type
|
||||
TWSStatusBar = class(TWSWinControl)
|
||||
class procedure PanelUpdate(const AStatusBar: TStatusBar; PanelIndex: integer); virtual;
|
||||
class procedure SetPanelText(const AStatusBar: TStatusBar; PanelIndex: integer); virtual;
|
||||
class procedure SetSizeGrip(const AStatusBar: TStatusBar; SizeGrip: Boolean); virtual;
|
||||
class procedure Update(const AStatusBar: TStatusBar); virtual;
|
||||
end;
|
||||
|
||||
@ -205,6 +206,11 @@ class procedure TWSStatusBar.SetPanelText(const AStatusBar: TStatusBar; PanelInd
|
||||
begin
|
||||
end;
|
||||
|
||||
class procedure TWSStatusBar.SetSizeGrip(const AStatusBar: TStatusBar;
|
||||
SizeGrip: Boolean);
|
||||
begin
|
||||
end;
|
||||
|
||||
class procedure TWSStatusBar.Update(const AStatusBar: TStatusBar);
|
||||
begin
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user