mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-22 10:59:29 +02:00
* patch for tpairsplitter by Paul Ishenin
git-svn-id: trunk@10712 -
This commit is contained in:
parent
bd072c89f7
commit
7dcb45bc1f
@ -480,29 +480,6 @@ Begin
|
||||
Result:=SetWindowOrgEx(dc, P.x-dX, P.y-dY, @P);
|
||||
end;
|
||||
|
||||
function TWidgetSet.PairSplitterAddSide(SplitterHandle, SideHandle: hWnd;
|
||||
Side: integer): Boolean;
|
||||
begin
|
||||
Result:=false;
|
||||
end;
|
||||
|
||||
function TWidgetSet.PairSplitterGetInterfaceInfo: boolean;
|
||||
begin
|
||||
Result:=false;
|
||||
end;
|
||||
|
||||
function TWidgetSet.PairSplitterRemoveSide(SplitterHandle, SideHandle: hWnd;
|
||||
Side: integer): Boolean;
|
||||
begin
|
||||
Result:=false;
|
||||
end;
|
||||
|
||||
function TWidgetSet.PairSplitterSetPosition(SplitterHandle: hWnd;
|
||||
var NewPosition: integer): Boolean;
|
||||
begin
|
||||
Result:=false;
|
||||
end;
|
||||
|
||||
Function TWidgetSet.PromptUser(const DialogCaption, DialogMessage : String;
|
||||
DialogType : longint; Buttons : PLongint;
|
||||
ButtonCount, DefaultIndex, EscapeResult : Longint) : Longint;
|
||||
|
@ -333,27 +333,6 @@ begin
|
||||
Result := WidgetSet.MoveWindowOrgEx(DC, dX, dY);
|
||||
end;
|
||||
|
||||
function PairSplitterAddSide(SplitterHandle, SideHandle: hWnd;
|
||||
Side: integer): Boolean;
|
||||
begin
|
||||
Result:=WidgetSet.PairSplitterAddSide(SplitterHandle,SideHandle,Side);
|
||||
end;
|
||||
|
||||
function PairSplitterGetInterfaceInfo: boolean;
|
||||
begin
|
||||
Result:=WidgetSet.PairSplitterGetInterfaceInfo;
|
||||
end;
|
||||
|
||||
function PairSplitterRemoveSide(SplitterHandle, SideHandle: hWnd;Side: integer): Boolean;
|
||||
begin
|
||||
Result:=WidgetSet.PairSplitterRemoveSide(SplitterHandle,SideHandle, Side);
|
||||
end;
|
||||
|
||||
function PairSplitterSetPosition(SplitterHandle: hWnd; var NewPosition: integer): Boolean;
|
||||
begin
|
||||
Result:=WidgetSet.PairSplitterSetPosition(SplitterHandle,NewPosition);
|
||||
end;
|
||||
|
||||
function PromptUser(const DialogMessage : String; DialogType : longint; Buttons : PLongint;
|
||||
ButtonCount, DefaultIndex, EscapeResult : Longint) : Longint;
|
||||
begin
|
||||
|
@ -97,10 +97,6 @@ function LoadStockPixmap(StockID: longint) : HBitmap; {$IFDEF IF_BASE_MEMBER}vir
|
||||
|
||||
function MoveWindowOrgEx(dc : hdc; dX,dY : Integer): boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
|
||||
|
||||
function PairSplitterAddSide(SplitterHandle, SideHandle: hWnd; Side: integer): Boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
|
||||
function PairSplitterGetInterfaceInfo: boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
|
||||
function PairSplitterRemoveSide(SplitterHandle, SideHandle: hWnd; Side: integer): Boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
|
||||
function PairSplitterSetPosition(SplitterHandle: hWnd; var NewPosition: integer): Boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
|
||||
function PromptUser(const DialogCaption, DialogMessage : String; DialogType : longint; Buttons : PLongint; ButtonCount, DefaultIndex, EscapeResult : Longint) : Longint;{$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
|
||||
function PromptUserAtXY(const DialogCaption, DialogMessage : String; DialogType : longint; Buttons : PLongint; ButtonCount, DefaultIndex, EscapeResult : Longint; X, Y : Longint) : Longint;{$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
|
||||
|
||||
|
@ -1529,29 +1529,6 @@ begin
|
||||
Result:=inherited MoveWindowOrgEx(DC, dX, dY);
|
||||
end;
|
||||
|
||||
function TCarbonWidgetSet.PairSplitterAddSide(SplitterHandle, SideHandle: hWnd;
|
||||
Side: integer): Boolean;
|
||||
begin
|
||||
Result:=inherited PairSplitterAddSide(SplitterHandle, SideHandle, Side);
|
||||
end;
|
||||
|
||||
function TCarbonWidgetSet.PairSplitterGetInterfaceInfo: Boolean;
|
||||
begin
|
||||
Result:=inherited PairSplitterGetInterfaceInfo;
|
||||
end;
|
||||
|
||||
function TCarbonWidgetSet.PairSplitterRemoveSide(SplitterHandle,
|
||||
SideHandle: hWnd; Side: integer): Boolean;
|
||||
begin
|
||||
Result:=inherited PairSplitterRemoveSide(SplitterHandle, SideHandle, Side);
|
||||
end;
|
||||
|
||||
function TCarbonWidgetSet.PairSplitterSetPosition(SplitterHandle: hWnd;
|
||||
var NewPosition: integer): Boolean;
|
||||
begin
|
||||
Result:=inherited PairSplitterSetPosition(SplitterHandle, NewPosition);
|
||||
end;
|
||||
|
||||
function TCarbonWidgetSet.PeekMessage(var lpMsg: TMsg; Handle: HWND;
|
||||
wMsgFilterMin, wMsgFilterMax, wRemoveMsg: UINT): Boolean;
|
||||
begin
|
||||
|
@ -150,10 +150,6 @@ function MessageBox(hWnd: HWND; lpText, lpCaption: PChar; uType: Cardinal): inte
|
||||
function MoveToEx(DC: HDC; X, Y: Integer; OldPoint: PPoint): Boolean; override;
|
||||
function MoveWindowOrgEx(DC: HDC; dX, dY: Integer): Boolean; override;
|
||||
|
||||
function PairSplitterAddSide(SplitterHandle, SideHandle: hWnd; Side: integer): Boolean; override;
|
||||
function PairSplitterGetInterfaceInfo: Boolean; override;
|
||||
function PairSplitterRemoveSide(SplitterHandle, SideHandle: hWnd; Side: integer): Boolean; override;
|
||||
function PairSplitterSetPosition(SplitterHandle: hWnd; var NewPosition: integer): Boolean; override;
|
||||
function PeekMessage(var lpMsg : TMsg; Handle : HWND; wMsgFilterMin, wMsgFilterMax,wRemoveMsg : UINT): Boolean; override;
|
||||
function PolyBezier(DC: HDC; Points: PPoint; NumPts: Integer; Filled, Continuous: boolean): boolean; override;
|
||||
function Polygon(DC: HDC; Points: PPoint; NumPts: Integer; Winding: boolean): boolean; override;
|
||||
|
@ -355,7 +355,7 @@ uses
|
||||
// GtkWSImgList,
|
||||
// GtkWSMaskEdit,
|
||||
GtkWSMenus,
|
||||
// GtkWSPairSplitter,
|
||||
GtkWSPairSplitter,
|
||||
GtkWSSpin,
|
||||
GtkWSStdCtrls,
|
||||
// GtkWSToolwin,
|
||||
|
@ -5194,8 +5194,7 @@ begin
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
function TGtkWidgetSet.CreatePairSplitter(PairSplitterObject: TObject
|
||||
): PGtkWidget;
|
||||
function TGtkWidgetSet.CreateStatusBar(StatusBar: TObject): PGtkWidget;
|
||||
|
||||
Create a TStatusBar widget set
|
||||
------------------------------------------------------------------------------}
|
||||
|
@ -7007,58 +7007,6 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
function TGtkWidgetSet.PairSplitterAddSide(SplitterHandle, SideHandle: hWnd;
|
||||
Side: integer): Boolean;
|
||||
------------------------------------------------------------------------------}
|
||||
function TGtkWidgetSet.PairSplitterAddSide(SplitterHandle, SideHandle: hWnd;
|
||||
Side: integer): Boolean;
|
||||
begin
|
||||
Result:=false;
|
||||
if (SplitterHandle=0) or (SideHandle=0) or (Side<0) or (Side>1) then exit;
|
||||
if Side=0 then
|
||||
gtk_paned_add1(PGtkPaned(SplitterHandle),PGtkWidget(SideHandle))
|
||||
else
|
||||
gtk_paned_add2(PGtkPaned(SplitterHandle),PGtkWidget(SideHandle));
|
||||
Result:=true;
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
function TGtkWidgetSet.PairSplitterGetInterfaceInfo: Boolean;
|
||||
------------------------------------------------------------------------------}
|
||||
function TGtkWidgetSet.PairSplitterGetInterfaceInfo: Boolean;
|
||||
begin
|
||||
Result:=true;
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
function TGtkWidgetSet.PairSplitterRemoveSide(SplitterHandle, SideHandle: hWnd;
|
||||
Side: integer): Boolean;
|
||||
------------------------------------------------------------------------------}
|
||||
function TGtkWidgetSet.PairSplitterRemoveSide(SplitterHandle, SideHandle: hWnd;
|
||||
Side: integer): Boolean;
|
||||
begin
|
||||
Result:=false;
|
||||
DebugLn('WARNING: TGtkWidgetSet.PairSplitterRemoveSide not implemented');
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
function TGtkWidgetSet.PairSplitterSetPosition(SplitterHandle: hWnd;
|
||||
var NewPosition: integer): Boolean;
|
||||
|
||||
Negative values for NewPosition will only read the value
|
||||
------------------------------------------------------------------------------}
|
||||
function TGtkWidgetSet.PairSplitterSetPosition(SplitterHandle: hWnd;
|
||||
var NewPosition: integer): Boolean;
|
||||
begin
|
||||
Result:=false;
|
||||
if (SplitterHandle=0) then exit;
|
||||
if NewPosition>=0 then
|
||||
gtk_paned_set_position(PGtkPaned(SplitterHandle),NewPosition);
|
||||
NewPosition:=PGtkPaned(SplitterHandle)^.child1_size;
|
||||
Result:=true;
|
||||
end;
|
||||
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Function: PeekMessage
|
||||
|
@ -150,10 +150,6 @@ function MessageBox(hWnd: HWND; lpText, lpCaption: PChar; uType: Cardinal): inte
|
||||
function MoveToEx(DC: HDC; X, Y: Integer; OldPoint: PPoint): Boolean; override;
|
||||
function MoveWindowOrgEx(DC: HDC; dX, dY: Integer): Boolean; override;
|
||||
|
||||
function PairSplitterAddSide(SplitterHandle, SideHandle: hWnd; Side: integer): Boolean; override;
|
||||
function PairSplitterGetInterfaceInfo: Boolean; override;
|
||||
function PairSplitterRemoveSide(SplitterHandle, SideHandle: hWnd; Side: integer): Boolean; override;
|
||||
function PairSplitterSetPosition(SplitterHandle: hWnd; var NewPosition: integer): Boolean; override;
|
||||
function PeekMessage(var lpMsg : TMsg; Handle : HWND; wMsgFilterMin, wMsgFilterMax,wRemoveMsg : UINT): Boolean; override;
|
||||
function PolyBezier(DC: HDC; Points: PPoint; NumPts: Integer; Filled, Continuous: boolean): boolean; override;
|
||||
function Polygon(DC: HDC; Points: PPoint; NumPts: Integer; Winding: boolean): boolean; override;
|
||||
|
@ -45,6 +45,8 @@ type
|
||||
private
|
||||
protected
|
||||
public
|
||||
class function AddSide(ASplitter: TCustomPairSplitter; ASide: TPairSplitterSide; Side: integer): Boolean; override;
|
||||
class function SetPosition(ASplitter: TCustomPairSplitter; var NewPosition: integer): Boolean; override;
|
||||
end;
|
||||
|
||||
{ TGtkWSPairSplitter }
|
||||
@ -57,6 +59,41 @@ type
|
||||
|
||||
|
||||
implementation
|
||||
uses
|
||||
WSProc, gtk;
|
||||
|
||||
{ TGtkWSCustomPairSplitter }
|
||||
|
||||
class function TGtkWSCustomPairSplitter.AddSide(ASplitter: TCustomPairSplitter;
|
||||
ASide: TPairSplitterSide; Side: integer): Boolean;
|
||||
begin
|
||||
Result:=false;
|
||||
|
||||
if not (WSCheckHandleAllocated(ASplitter, 'AddSide - splitter') and
|
||||
WSCheckHandleAllocated(ASide, 'AddSide - side'))
|
||||
then Exit;
|
||||
|
||||
if (Side<0) or (Side>1) then exit;
|
||||
|
||||
if Side=0 then
|
||||
gtk_paned_add1(PGtkPaned(ASplitter.Handle),PGtkWidget(ASide.Handle))
|
||||
else
|
||||
gtk_paned_add2(PGtkPaned(ASPlitter.Handle),PGtkWidget(ASide.Handle));
|
||||
|
||||
Result:=true;
|
||||
end;
|
||||
|
||||
class function TGtkWSCustomPairSplitter.SetPosition(
|
||||
ASplitter: TCustomPairSplitter; var NewPosition: integer): Boolean;
|
||||
begin
|
||||
Result:=false;
|
||||
if not WSCheckHandleAllocated(ASplitter, 'SetPosition')
|
||||
then Exit;
|
||||
if NewPosition>=0 then
|
||||
gtk_paned_set_position(PGtkPaned(ASplitter.Handle),NewPosition);
|
||||
NewPosition:=PGtkPaned(ASplitter.Handle)^.child1_size;
|
||||
Result:=true;
|
||||
end;
|
||||
|
||||
initialization
|
||||
|
||||
@ -67,7 +104,7 @@ initialization
|
||||
// which actually implement something
|
||||
////////////////////////////////////////////////////
|
||||
// RegisterWSComponent(TPairSplitterSide, TGtkWSPairSplitterSide);
|
||||
// RegisterWSComponent(TCustomPairSplitter, TGtkWSCustomPairSplitter);
|
||||
RegisterWSComponent(TCustomPairSplitter, TGtkWSCustomPairSplitter);
|
||||
// RegisterWSComponent(TPairSplitter, TGtkWSPairSplitter);
|
||||
////////////////////////////////////////////////////
|
||||
end.
|
||||
end.
|
||||
|
@ -271,7 +271,7 @@ Uses
|
||||
// Win32WSImgList,
|
||||
// Win32WSMaskEdit,
|
||||
Win32WSMenus,
|
||||
// Win32WSPairSplitter,
|
||||
Win32WSPairSplitter,
|
||||
Win32WSSpin,
|
||||
Win32WSStdCtrls,
|
||||
// Win32WSToolwin,
|
||||
|
@ -32,8 +32,6 @@ uses
|
||||
////////////////////////////////////////////////////
|
||||
// To get as little as posible circles,
|
||||
// uncomment only when needed for registration
|
||||
////////////////////////////////////////////////////
|
||||
// PairSplitter,
|
||||
////////////////////////////////////////////////////
|
||||
WSPairSplitter, WSLCLClasses;
|
||||
|
||||
@ -63,7 +61,6 @@ type
|
||||
public
|
||||
end;
|
||||
|
||||
|
||||
implementation
|
||||
|
||||
initialization
|
||||
@ -78,4 +75,4 @@ initialization
|
||||
// RegisterWSComponent(TCustomPairSplitter, TWin32WSCustomPairSplitter);
|
||||
// RegisterWSComponent(TPairSplitter, TWin32WSPairSplitter);
|
||||
////////////////////////////////////////////////////
|
||||
end.
|
||||
end.
|
||||
|
@ -2156,30 +2156,6 @@ begin
|
||||
Result:=inherited MoveWindowOrgEx(DC, dX, dY);
|
||||
end;
|
||||
|
||||
function TWinCEWidgetSet.PairSplitterAddSide(SplitterHandle, SideHandle: hWnd;
|
||||
Side: integer): Boolean;
|
||||
begin
|
||||
Result:=inherited PairSplitterAddSide(SplitterHandle, SideHandle, Side);
|
||||
end;
|
||||
|
||||
function TWinCEWidgetSet.PairSplitterGetInterfaceInfo: Boolean;
|
||||
begin
|
||||
Result:=inherited PairSplitterGetInterfaceInfo;
|
||||
end;
|
||||
|
||||
function TWinCEWidgetSet.PairSplitterRemoveSide(SplitterHandle,
|
||||
SideHandle: hWnd; Side: integer): Boolean;
|
||||
begin
|
||||
Result:=inherited PairSplitterRemoveSide(SplitterHandle, SideHandle, Side);
|
||||
end;
|
||||
|
||||
function TWinCEWidgetSet.PairSplitterSetPosition(SplitterHandle: hWnd;
|
||||
var NewPosition: integer): Boolean;
|
||||
begin
|
||||
Result:=inherited PairSplitterSetPosition(SplitterHandle, NewPosition);
|
||||
end;
|
||||
|
||||
|
||||
function TWinCEWidgetSet.PolyBezier(DC: HDC; Points: PPoint; NumPts: Integer;
|
||||
Filled, Continuous: boolean): boolean;
|
||||
begin
|
||||
|
@ -167,12 +167,7 @@ function LineTo(DC: HDC; X, Y: Integer): Boolean; override;
|
||||
|
||||
function MessageBox(hWnd: HWND; lpText, lpCaption: PChar; uType: Cardinal): integer; override;
|
||||
function MoveToEx(DC: HDC; X, Y: Integer; OldPoint: PPoint): Boolean; override;
|
||||
{function MoveWindowOrgEx(DC: HDC; dX, dY: Integer): Boolean; override;
|
||||
|
||||
function PairSplitterAddSide(SplitterHandle, SideHandle: hWnd; Side: integer): Boolean; override;
|
||||
function PairSplitterGetInterfaceInfo: Boolean; override;
|
||||
function PairSplitterRemoveSide(SplitterHandle, SideHandle: hWnd; Side: integer): Boolean; override;
|
||||
function PairSplitterSetPosition(SplitterHandle: hWnd; var NewPosition: integer): Boolean; override;}
|
||||
{function MoveWindowOrgEx(DC: HDC; dX, dY: Integer): Boolean; override;}
|
||||
function PeekMessage(var lpMsg : TMsg; Handle : HWND; wMsgFilterMin, wMsgFilterMax,wRemoveMsg : UINT): Boolean; override;
|
||||
//function PolyBezier(DC: HDC; Points: PPoint; NumPts: Integer; Filled, Continuous: boolean): boolean; override;
|
||||
function Polygon(DC: HDC; Points: PPoint; NumPts: Integer; Winding: boolean): boolean; override;
|
||||
|
@ -104,7 +104,6 @@ type
|
||||
procedure UpdatePosition;
|
||||
procedure CreateSides;
|
||||
procedure Loaded; override;
|
||||
class function IsSupportedByInterface: boolean;
|
||||
function ChildClassAllowed(ChildClass: TClass): boolean; override;
|
||||
public
|
||||
property Sides[Index: integer]: TPairSplitterSide read GetSides;
|
||||
@ -138,7 +137,9 @@ type
|
||||
procedure Register;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
WSPairSplitter, extctrls;
|
||||
|
||||
procedure Register;
|
||||
begin
|
||||
RegisterComponents('Additional',[TPairSplitter]);
|
||||
@ -234,7 +235,7 @@ begin
|
||||
if FPosition<0 then
|
||||
FPosition:=0;
|
||||
if HandleAllocated and (not (csLoading in ComponentState)) then
|
||||
PairSplitterSetPosition(Handle,FPosition);
|
||||
TWSCustomPairSplitterClass(WidgetSetClass).SetPosition(Self, FPosition);
|
||||
end;
|
||||
|
||||
procedure TCustomPairSplitter.SetSplitterType(const AValue: TPairSplitterType);
|
||||
@ -256,7 +257,7 @@ begin
|
||||
if FSides[i]=nil then begin
|
||||
FSides[i]:=ASide;
|
||||
if HandleAllocated then
|
||||
PairSplitterAddSide(Handle,ASide.Handle,i);
|
||||
TWSCustomPairSplitterClass(WidgetSetClass).AddSide(Self, ASide, i);
|
||||
break;
|
||||
end;
|
||||
inc(i);
|
||||
@ -273,7 +274,7 @@ begin
|
||||
for i:=Low(FSides) to High(FSides) do
|
||||
if FSides[i]=ASide then begin
|
||||
if HandleAllocated and ASide.HandleAllocated then
|
||||
PairSplitterRemoveSide(Handle,ASide.Handle,i);
|
||||
TWSCustomPairSplitterClass(WidgetSetClass).RemoveSide(Self, ASide, i);
|
||||
FSides[i]:=nil;
|
||||
end;
|
||||
// if the user deletes a side at designtime, autocreate a new one
|
||||
@ -312,9 +313,9 @@ begin
|
||||
inherited CreateWnd;
|
||||
for i:=Low(FSides) to High(FSides) do
|
||||
if FSides[i]<>nil then
|
||||
PairSplitterAddSide(Handle,FSides[i].Handle,i);
|
||||
TWSCustomPairSplitterClass(WidgetSetClass).AddSide(Self, FSides[i], i);
|
||||
APosition:=FPosition;
|
||||
PairSplitterSetPosition(Handle,APosition);
|
||||
TWSCustomPairSplitterClass(WidgetSetClass).SetPosition(Self, APosition);
|
||||
if not (csLoading in ComponentState) then
|
||||
FPosition:=APosition;
|
||||
end;
|
||||
@ -323,9 +324,10 @@ procedure TCustomPairSplitter.UpdatePosition;
|
||||
var
|
||||
CurPosition: Integer;
|
||||
begin
|
||||
if HandleAllocated then begin
|
||||
if HandleAllocated then
|
||||
begin
|
||||
CurPosition:=-1;
|
||||
PairSplitterSetPosition(Handle,CurPosition);
|
||||
TWSCustomPairSplitterClass(WidgetSetClass).SetPosition(Self, CurPosition);
|
||||
FPosition:=CurPosition;
|
||||
end;
|
||||
end;
|
||||
@ -354,17 +356,13 @@ begin
|
||||
inherited Loaded;
|
||||
CreateSides;
|
||||
if HandleAllocated then
|
||||
PairSplitterSetPosition(Handle,FPosition);
|
||||
end;
|
||||
|
||||
class function TCustomPairSplitter.IsSupportedByInterface: boolean;
|
||||
begin
|
||||
Result:=PairSplitterGetInterfaceInfo;
|
||||
TWSCustomPairSplitterClass(WidgetSetClass).SetPosition(Self, FPosition);
|
||||
end;
|
||||
|
||||
function TCustomPairSplitter.ChildClassAllowed(ChildClass: TClass): boolean;
|
||||
begin
|
||||
Result:=ChildClass.InheritsFrom(TPairSplitterSide);
|
||||
Result := ChildClass.InheritsFrom(TPairSplitterSide) or
|
||||
ChildClass.InheritsFrom(TSplitter);
|
||||
end;
|
||||
|
||||
end.
|
||||
|
@ -43,10 +43,7 @@ uses
|
||||
////////////////////////////////////////////////////
|
||||
// To get as little as posible circles,
|
||||
// uncomment only when needed for registration
|
||||
////////////////////////////////////////////////////
|
||||
// PairSplitter,
|
||||
////////////////////////////////////////////////////
|
||||
WSLCLClasses, WSControls;
|
||||
PairSplitter, WSLCLClasses, WSControls;
|
||||
|
||||
type
|
||||
{ TWSPairSplitterSide }
|
||||
@ -57,7 +54,11 @@ type
|
||||
{ TWSCustomPairSplitter }
|
||||
|
||||
TWSCustomPairSplitter = class(TWSWinControl)
|
||||
class function AddSide(ASplitter: TCustomPairSplitter; ASide: TPairSplitterSide; Side: integer): Boolean; virtual;
|
||||
class function RemoveSide(ASplitter: TCustomPairSplitter; ASide: TPairSplitterSide; Side: integer): Boolean; virtual;
|
||||
class function SetPosition(ASplitter: TCustomPairSplitter; var NewPosition: integer): Boolean; virtual;
|
||||
end;
|
||||
TWSCustomPairSplitterClass = class of TWSCustomPairSplitter;
|
||||
|
||||
{ TWSPairSplitter }
|
||||
|
||||
@ -66,6 +67,98 @@ type
|
||||
|
||||
|
||||
implementation
|
||||
uses
|
||||
WSProc, Controls, ExtCtrls;
|
||||
|
||||
function GetInternalSplitter(ASplitter: TCustomPairSplitter): TSplitter;
|
||||
var
|
||||
i: integer;
|
||||
begin
|
||||
Result := nil;
|
||||
for i := 0 to ASplitter.ControlCount - 1 do
|
||||
if ASplitter.Controls[i] is TSplitter then
|
||||
begin
|
||||
Result := TSplitter(ASplitter.Controls[i]);
|
||||
break;
|
||||
end;
|
||||
end;
|
||||
|
||||
{ TWSCustomPairSplitter }
|
||||
|
||||
class function TWSCustomPairSplitter.AddSide(ASplitter: TCustomPairSplitter;
|
||||
ASide: TPairSplitterSide; Side: integer): Boolean;
|
||||
var
|
||||
InternalSplitter: TSplitter;
|
||||
begin
|
||||
// this implementation can be common for all widgetsets and should be
|
||||
// overrided only if widgetset support such controls itself
|
||||
|
||||
Result := False;
|
||||
if not (WSCheckHandleAllocated(ASplitter, 'AddSide - splitter') and
|
||||
WSCheckHandleAllocated(ASide, 'AddSide - side'))
|
||||
then Exit;
|
||||
|
||||
if (Side < 0) or (Side > 1) then exit;
|
||||
|
||||
if Side = 0 then
|
||||
begin
|
||||
if ASplitter.SplitterType = pstHorizontal then
|
||||
ASide.Align := alLeft else
|
||||
ASide.Align := alTop;
|
||||
end else
|
||||
begin
|
||||
InternalSplitter := GetInternalSplitter(ASplitter);
|
||||
if InternalSplitter = nil then
|
||||
begin
|
||||
InternalSplitter := TSplitter.Create(ASplitter);
|
||||
InternalSplitter.Parent := ASplitter;
|
||||
InternalSplitter.Align := ASplitter.Sides[0].Align;
|
||||
end;
|
||||
if ASplitter.SplitterType = pstHorizontal then
|
||||
InternalSplitter.Left := ASplitter.Sides[0].Width + 1 else
|
||||
InternalSplitter.Top := ASplitter.Sides[0].Height + 1;
|
||||
ASide.Align := alClient;
|
||||
end;
|
||||
|
||||
Result := True;
|
||||
end;
|
||||
|
||||
class function TWSCustomPairSplitter.RemoveSide(ASplitter: TCustomPairSplitter;
|
||||
ASide: TPairSplitterSide; Side: integer): Boolean;
|
||||
begin
|
||||
Result := False;
|
||||
end;
|
||||
|
||||
class function TWSCustomPairSplitter.SetPosition(
|
||||
ASplitter: TCustomPairSplitter; var NewPosition: integer): Boolean;
|
||||
var
|
||||
InternalSplitter: TSplitter;
|
||||
begin
|
||||
Result := False;
|
||||
if not WSCheckHandleAllocated(ASplitter, 'SetPosition')
|
||||
then Exit;
|
||||
|
||||
if NewPosition >= 0 then
|
||||
begin
|
||||
InternalSplitter := GetInternalSplitter(ASplitter);
|
||||
if ASplitter.SplitterType = pstHorizontal then
|
||||
begin
|
||||
ASplitter.Sides[0].Width := NewPosition;
|
||||
if InternalSplitter <> nil then
|
||||
InternalSplitter.Left := NewPosition + 1;
|
||||
end else
|
||||
begin
|
||||
ASplitter.Sides[0].Height := NewPosition;
|
||||
if InternalSplitter <> nil then
|
||||
InternalSplitter.Top := NewPosition + 1;
|
||||
end;
|
||||
end;
|
||||
if ASplitter.SplitterType = pstHorizontal then
|
||||
NewPosition := ASplitter.Sides[0].Width else
|
||||
NewPosition := ASplitter.Sides[0].Height;
|
||||
|
||||
Result := True;
|
||||
end;
|
||||
|
||||
initialization
|
||||
|
||||
@ -74,7 +167,7 @@ initialization
|
||||
// which actually implement something
|
||||
////////////////////////////////////////////////////
|
||||
// RegisterWSComponent(TPairSplitterSide, TWSPairSplitterSide);
|
||||
// RegisterWSComponent(TCustomPairSplitter, TWSCustomPairSplitter);
|
||||
RegisterWSComponent(TCustomPairSplitter, TWSCustomPairSplitter);
|
||||
// RegisterWSComponent(TPairSplitter, TWSPairSplitter);
|
||||
////////////////////////////////////////////////////
|
||||
end.
|
||||
end.
|
||||
|
Loading…
Reference in New Issue
Block a user