You've already forked lazarus-ccr
SpkToolbar: Apply conventional source formatting
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5383 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -418,11 +418,13 @@ type
|
|||||||
property OnTabChanged: TNotifyEvent read FOnTabChanged write FOnTabChanged;
|
property OnTabChanged: TNotifyEvent read FOnTabChanged write FOnTabChanged;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
uses
|
uses
|
||||||
LCLIntf, Themes;
|
LCLIntf, Themes;
|
||||||
|
|
||||||
|
|
||||||
{ TSpkToolbarDispatch }
|
{ TSpkToolbarDispatch }
|
||||||
|
|
||||||
function TSpkToolbarDispatch.ClientToScreen(Point: T2DIntPoint): T2DIntPoint;
|
function TSpkToolbarDispatch.ClientToScreen(Point: T2DIntPoint): T2DIntPoint;
|
||||||
@ -478,21 +480,20 @@ begin
|
|||||||
FToolbar.NotifyVisualsChanged;
|
FToolbar.NotifyVisualsChanged;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
{ TSpkToolbar }
|
{ TSpkToolbar }
|
||||||
|
|
||||||
function TSpkToolbar.AtLeastOneTabVisible: boolean;
|
function TSpkToolbar.AtLeastOneTabVisible: boolean;
|
||||||
|
|
||||||
var
|
var
|
||||||
i: integer;
|
i: integer;
|
||||||
TabVisible: boolean;
|
TabVisible: boolean;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
Result := FTabs.Count > 0;
|
Result := FTabs.Count > 0;
|
||||||
if Result then
|
if Result then
|
||||||
begin
|
begin
|
||||||
TabVisible := False;
|
TabVisible := False;
|
||||||
i := FTabs.Count - 1;
|
i := FTabs.Count - 1;
|
||||||
while (i >= 0) and not (TabVisible) do
|
while (i >= 0) and not TabVisible do
|
||||||
begin
|
begin
|
||||||
TabVisible := FTabs[i].Visible;
|
TabVisible := FTabs[i].Visible;
|
||||||
Dec(i);
|
Dec(i);
|
||||||
@ -588,7 +589,6 @@ end;
|
|||||||
procedure TSpkToolbar.DefineProperties(Filer: TFiler);
|
procedure TSpkToolbar.DefineProperties(Filer: TFiler);
|
||||||
begin
|
begin
|
||||||
inherited DefineProperties(Filer);
|
inherited DefineProperties(Filer);
|
||||||
|
|
||||||
Filer.DefineProperty('Tabs', FTabs.ReadNames, FTabs.WriteNames, True);
|
Filer.DefineProperty('Tabs', FTabs.ReadNames, FTabs.WriteNames, True);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -596,13 +596,11 @@ destructor TSpkToolbar.Destroy;
|
|||||||
begin
|
begin
|
||||||
// Release the fields
|
// Release the fields
|
||||||
FTabs.Free;
|
FTabs.Free;
|
||||||
|
|
||||||
FAppearance.Free;
|
FAppearance.Free;
|
||||||
|
|
||||||
// Release the internal fields
|
// Release the internal fields
|
||||||
FTemporary.Free;
|
FTemporary.Free;
|
||||||
FBuffer.Free;
|
FBuffer.Free;
|
||||||
|
|
||||||
FToolbarDispatch.Free;
|
FToolbarDispatch.Free;
|
||||||
|
|
||||||
{$IFDEF DELAYRUNTIMER}
|
{$IFDEF DELAYRUNTIMER}
|
||||||
@ -615,7 +613,6 @@ end;
|
|||||||
procedure TSpkToolbar.EndUpdate;
|
procedure TSpkToolbar.EndUpdate;
|
||||||
begin
|
begin
|
||||||
FUpdating := False;
|
FUpdating := False;
|
||||||
|
|
||||||
ValidateMetrics;
|
ValidateMetrics;
|
||||||
ValidateBuffer;
|
ValidateBuffer;
|
||||||
Repaint;
|
Repaint;
|
||||||
@ -638,10 +635,8 @@ var
|
|||||||
i: integer;
|
i: integer;
|
||||||
begin
|
begin
|
||||||
inherited;
|
inherited;
|
||||||
|
for i := 0 to FTabs.Count - 1 do
|
||||||
if FTabs.Count > 0 then
|
Proc(FTabs.Items[i]);
|
||||||
for i := 0 to FTabs.Count - 1 do
|
|
||||||
Proc(FTabs.Items[i]);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TSpkToolbar.GetColor: TColor;
|
function TSpkToolbar.GetColor: TColor;
|
||||||
@ -681,9 +676,7 @@ begin
|
|||||||
InternalBeginUpdate;
|
InternalBeginUpdate;
|
||||||
|
|
||||||
if FTabs.ListState = lsNeedsProcessing then
|
if FTabs.ListState = lsNeedsProcessing then
|
||||||
begin
|
|
||||||
FTabs.ProcessNames(self.Owner);
|
FTabs.ProcessNames(self.Owner);
|
||||||
end;
|
|
||||||
|
|
||||||
InternalEndUpdate;
|
InternalEndUpdate;
|
||||||
|
|
||||||
@ -975,7 +968,6 @@ end;
|
|||||||
procedure TSpkToolbar.NotifyAppearanceChanged;
|
procedure TSpkToolbar.NotifyAppearanceChanged;
|
||||||
begin
|
begin
|
||||||
SetMetricsInvalid;
|
SetMetricsInvalid;
|
||||||
|
|
||||||
if not (FInternalUpdating or FUpdating) then
|
if not (FInternalUpdating or FUpdating) then
|
||||||
Repaint;
|
Repaint;
|
||||||
end;
|
end;
|
||||||
@ -983,7 +975,6 @@ end;
|
|||||||
procedure TSpkToolbar.NotifyMetricsChanged;
|
procedure TSpkToolbar.NotifyMetricsChanged;
|
||||||
begin
|
begin
|
||||||
SetMetricsInvalid;
|
SetMetricsInvalid;
|
||||||
|
|
||||||
if not (FInternalUpdating or FUpdating) then
|
if not (FInternalUpdating or FUpdating) then
|
||||||
Repaint;
|
Repaint;
|
||||||
end;
|
end;
|
||||||
@ -1025,7 +1016,6 @@ end;
|
|||||||
procedure TSpkToolbar.NotifyVisualsChanged;
|
procedure TSpkToolbar.NotifyVisualsChanged;
|
||||||
begin
|
begin
|
||||||
SetBufferInvalid;
|
SetBufferInvalid;
|
||||||
|
|
||||||
if not (FInternalUpdating or FUpdating) then
|
if not (FInternalUpdating or FUpdating) then
|
||||||
Repaint;
|
Repaint;
|
||||||
end;
|
end;
|
||||||
@ -1081,7 +1071,6 @@ procedure TSpkToolbar.SetColor(const Value: TColor);
|
|||||||
begin
|
begin
|
||||||
inherited Color := Value;
|
inherited Color := Value;
|
||||||
SetBufferInvalid;
|
SetBufferInvalid;
|
||||||
|
|
||||||
if not (FInternalUpdating or FUpdating) then
|
if not (FInternalUpdating or FUpdating) then
|
||||||
Repaint;
|
Repaint;
|
||||||
end;
|
end;
|
||||||
@ -1091,7 +1080,6 @@ begin
|
|||||||
FDisabledImages := Value;
|
FDisabledImages := Value;
|
||||||
FTabs.DisabledImages := Value;
|
FTabs.DisabledImages := Value;
|
||||||
SetMetricsInvalid;
|
SetMetricsInvalid;
|
||||||
|
|
||||||
if not (FInternalUpdating or FUpdating) then
|
if not (FInternalUpdating or FUpdating) then
|
||||||
Repaint;
|
Repaint;
|
||||||
end;
|
end;
|
||||||
@ -1101,7 +1089,6 @@ begin
|
|||||||
FDisabledLargeImages := Value;
|
FDisabledLargeImages := Value;
|
||||||
FTabs.DisabledLargeImages := Value;
|
FTabs.DisabledLargeImages := Value;
|
||||||
SetMetricsInvalid;
|
SetMetricsInvalid;
|
||||||
|
|
||||||
if not (FInternalUpdating or FUpdating) then
|
if not (FInternalUpdating or FUpdating) then
|
||||||
Repaint;
|
Repaint;
|
||||||
end;
|
end;
|
||||||
@ -1111,7 +1098,6 @@ begin
|
|||||||
FImages := Value;
|
FImages := Value;
|
||||||
FTabs.Images := Value;
|
FTabs.Images := Value;
|
||||||
SetMetricsInvalid;
|
SetMetricsInvalid;
|
||||||
|
|
||||||
if not (FInternalUpdating or FUpdating) then
|
if not (FInternalUpdating or FUpdating) then
|
||||||
Repaint;
|
Repaint;
|
||||||
end;
|
end;
|
||||||
@ -1121,7 +1107,6 @@ begin
|
|||||||
FLargeImages := Value;
|
FLargeImages := Value;
|
||||||
FTabs.LargeImages := Value;
|
FTabs.LargeImages := Value;
|
||||||
SetMetricsInvalid;
|
SetMetricsInvalid;
|
||||||
|
|
||||||
if not (FInternalUpdating or FUpdating) then
|
if not (FInternalUpdating or FUpdating) then
|
||||||
Repaint;
|
Repaint;
|
||||||
end;
|
end;
|
||||||
@ -1272,14 +1257,12 @@ begin
|
|||||||
if (FTabIndex > -1) then
|
if (FTabIndex > -1) then
|
||||||
FTabs[FTabIndex].ExecOnClick;
|
FTabs[FTabIndex].ExecOnClick;
|
||||||
|
|
||||||
|
|
||||||
//Tabs don't need MouseUp
|
//Tabs don't need MouseUp
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSpkToolbar.SetAppearance(const Value: TSpkToolbarAppearance);
|
procedure TSpkToolbar.SetAppearance(const Value: TSpkToolbarAppearance);
|
||||||
begin
|
begin
|
||||||
FAppearance.Assign(Value);
|
FAppearance.Assign(Value);
|
||||||
|
|
||||||
SetBufferInvalid;
|
SetBufferInvalid;
|
||||||
if not (FInternalUpdating or FUpdating) then
|
if not (FInternalUpdating or FUpdating) then
|
||||||
Repaint;
|
Repaint;
|
||||||
@ -1316,6 +1299,7 @@ procedure TSpkToolbar.ValidateBuffer;
|
|||||||
FocusedAppearance.Tab.GradientFromColor,
|
FocusedAppearance.Tab.GradientFromColor,
|
||||||
FocusedAppearance.Tab.GradientToColor,
|
FocusedAppearance.Tab.GradientToColor,
|
||||||
FocusedAppearance.Tab.GradientType);
|
FocusedAppearance.Tab.GradientType);
|
||||||
|
|
||||||
TGuiTools.DrawAARoundCorner(FBuffer,
|
TGuiTools.DrawAARoundCorner(FBuffer,
|
||||||
{$IFDEF EnhancedRecordSupport}
|
{$IFDEF EnhancedRecordSupport}
|
||||||
T2DIntPoint.Create(0, ToolbarTabCaptionsHeight),
|
T2DIntPoint.Create(0, ToolbarTabCaptionsHeight),
|
||||||
@ -1325,6 +1309,7 @@ procedure TSpkToolbar.ValidateBuffer;
|
|||||||
ToolbarCornerRadius,
|
ToolbarCornerRadius,
|
||||||
cpLeftTop,
|
cpLeftTop,
|
||||||
FocusedAppearance.Tab.BorderColor);
|
FocusedAppearance.Tab.BorderColor);
|
||||||
|
|
||||||
TGuiTools.DrawAARoundCorner(FBuffer,
|
TGuiTools.DrawAARoundCorner(FBuffer,
|
||||||
{$IFDEF EnhancedRecordSupport}
|
{$IFDEF EnhancedRecordSupport}
|
||||||
T2DIntPoint.Create(self.Width - ToolbarCornerRadius, ToolbarTabCaptionsHeight),
|
T2DIntPoint.Create(self.Width - ToolbarCornerRadius, ToolbarTabCaptionsHeight),
|
||||||
@ -1334,6 +1319,7 @@ procedure TSpkToolbar.ValidateBuffer;
|
|||||||
ToolbarCornerRadius,
|
ToolbarCornerRadius,
|
||||||
cpRightTop,
|
cpRightTop,
|
||||||
FocusedAppearance.Tab.BorderColor);
|
FocusedAppearance.Tab.BorderColor);
|
||||||
|
|
||||||
TGuiTools.DrawAARoundCorner(FBuffer,
|
TGuiTools.DrawAARoundCorner(FBuffer,
|
||||||
{$IFDEF EnhancedRecordSupport}
|
{$IFDEF EnhancedRecordSupport}
|
||||||
T2DIntPoint.Create(0, self.Height - ToolbarCornerRadius),
|
T2DIntPoint.Create(0, self.Height - ToolbarCornerRadius),
|
||||||
@ -1343,6 +1329,7 @@ procedure TSpkToolbar.ValidateBuffer;
|
|||||||
ToolbarCornerRadius,
|
ToolbarCornerRadius,
|
||||||
cpLeftBottom,
|
cpLeftBottom,
|
||||||
FocusedAppearance.Tab.BorderColor);
|
FocusedAppearance.Tab.BorderColor);
|
||||||
|
|
||||||
TGuiTools.DrawAARoundCorner(FBuffer,
|
TGuiTools.DrawAARoundCorner(FBuffer,
|
||||||
{$IFDEF EnhancedRecordSupport}
|
{$IFDEF EnhancedRecordSupport}
|
||||||
T2DIntPoint.Create(self.Width - ToolbarCornerRadius, self.Height - ToolbarCornerRadius),
|
T2DIntPoint.Create(self.Width - ToolbarCornerRadius, self.Height - ToolbarCornerRadius),
|
||||||
@ -1352,11 +1339,14 @@ procedure TSpkToolbar.ValidateBuffer;
|
|||||||
ToolbarCornerRadius,
|
ToolbarCornerRadius,
|
||||||
cpRightBottom,
|
cpRightBottom,
|
||||||
FocusedAppearance.Tab.BorderColor);
|
FocusedAppearance.Tab.BorderColor);
|
||||||
|
|
||||||
TGuiTools.DrawVLine(FBuffer, 0, ToolbarTabCaptionsHeight +
|
TGuiTools.DrawVLine(FBuffer, 0, ToolbarTabCaptionsHeight +
|
||||||
ToolbarCornerRadius, self.Height - ToolbarCornerRadius,
|
ToolbarCornerRadius, self.Height - ToolbarCornerRadius,
|
||||||
FocusedAppearance.Tab.BorderColor);
|
FocusedAppearance.Tab.BorderColor);
|
||||||
|
|
||||||
TGuiTools.DrawHLine(FBuffer, ToolbarCornerRadius, self.Width - ToolbarCornerRadius,
|
TGuiTools.DrawHLine(FBuffer, ToolbarCornerRadius, self.Width - ToolbarCornerRadius,
|
||||||
self.Height - 1, FocusedAppearance.Tab.BorderColor);
|
self.Height - 1, FocusedAppearance.Tab.BorderColor);
|
||||||
|
|
||||||
TGuiTools.DrawVLine(FBuffer, self.Width - 1, ToolbarTabCaptionsHeight +
|
TGuiTools.DrawVLine(FBuffer, self.Width - 1, ToolbarTabCaptionsHeight +
|
||||||
ToolbarCornerRadius, self.Height - ToolbarCornerRadius,
|
ToolbarCornerRadius, self.Height - ToolbarCornerRadius,
|
||||||
FocusedAppearance.Tab.BorderColor);
|
FocusedAppearance.Tab.BorderColor);
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -15,88 +15,95 @@ unit spkt_BaseItem;
|
|||||||
|
|
||||||
interface
|
interface
|
||||||
|
|
||||||
uses Graphics, Classes, Controls,
|
uses
|
||||||
SpkMath, spkt_Appearance, spkt_Dispatch, spkt_Types;
|
Graphics, Classes, Controls,
|
||||||
|
SpkMath, spkt_Appearance, spkt_Dispatch, spkt_Types;
|
||||||
|
|
||||||
type TSpkItemSize = (isLarge, isNormal);
|
type
|
||||||
TSpkItemTableBehaviour = (tbBeginsRow, tbBeginsColumn, tbContinuesRow);
|
TSpkItemSize = (isLarge, isNormal);
|
||||||
TSpkItemGroupBehaviour = (gbSingleItem, gbBeginsGroup, gbContinuesGroup, gbEndsGroup);
|
|
||||||
|
|
||||||
TSpkBaseItem = class abstract(TSpkComponent)
|
TSpkItemTableBehaviour = (tbBeginsRow, tbBeginsColumn, tbContinuesRow);
|
||||||
private
|
|
||||||
protected
|
|
||||||
FRect : T2DIntRect;
|
|
||||||
FToolbarDispatch : TSpkBaseToolbarDispatch;
|
|
||||||
FAppearance : TSpkToolbarAppearance;
|
|
||||||
FImages : TImageList;
|
|
||||||
FDisabledImages : TImageList;
|
|
||||||
FLargeImages : TImageList;
|
|
||||||
FDisabledLargeImages : TImageList;
|
|
||||||
FVisible : boolean;
|
|
||||||
FEnabled : boolean;
|
|
||||||
|
|
||||||
procedure SetVisible(const Value: boolean); virtual;
|
TSpkItemGroupBehaviour = (gbSingleItem, gbBeginsGroup, gbContinuesGroup, gbEndsGroup);
|
||||||
procedure SetEnabled(const Value: boolean); virtual;
|
|
||||||
procedure SetRect(const Value: T2DIntRect); virtual;
|
|
||||||
procedure SetImages(const Value: TImageList); virtual;
|
|
||||||
procedure SetDisabledImages(const Value : TImageList); virtual;
|
|
||||||
procedure SetLargeImages(const Value: TImageList); virtual;
|
|
||||||
procedure SetDisabledLargeImages(const Value: TImageList); virtual;
|
|
||||||
procedure SetAppearance(const Value: TSpkToolbarAppearance);
|
|
||||||
public
|
|
||||||
constructor Create(AOwner : TComponent); override;
|
|
||||||
destructor Destroy; override;
|
|
||||||
|
|
||||||
procedure MouseLeave; virtual; abstract;
|
TSpkBaseItem = class abstract(TSpkComponent)
|
||||||
procedure MouseDown(Button: TMouseButton; Shift: TShiftState;
|
private
|
||||||
X, Y: Integer); virtual; abstract;
|
protected
|
||||||
procedure MouseMove(Shift: TShiftState; X, Y: Integer); virtual; abstract;
|
FRect: T2DIntRect;
|
||||||
procedure MouseUp(Button: TMouseButton; Shift: TShiftState;
|
FToolbarDispatch: TSpkBaseToolbarDispatch;
|
||||||
X, Y: Integer); virtual; abstract;
|
FAppearance: TSpkToolbarAppearance;
|
||||||
|
FImages: TImageList;
|
||||||
|
FDisabledImages: TImageList;
|
||||||
|
FLargeImages: TImageList;
|
||||||
|
FDisabledLargeImages: TImageList;
|
||||||
|
FVisible: boolean;
|
||||||
|
FEnabled: boolean;
|
||||||
|
|
||||||
function GetWidth : integer; virtual; abstract;
|
procedure SetVisible(const Value: boolean); virtual;
|
||||||
function GetTableBehaviour : TSpkItemTableBehaviour; virtual; abstract;
|
procedure SetEnabled(const Value: boolean); virtual;
|
||||||
function GetGroupBehaviour : TSpkItemGroupBehaviour; virtual; abstract;
|
procedure SetRect(const Value: T2DIntRect); virtual;
|
||||||
function GetSize : TSpkItemSize; virtual; abstract;
|
procedure SetImages(const Value: TImageList); virtual;
|
||||||
procedure Draw(ABuffer : TBitmap; ClipRect : T2DIntRect); virtual; abstract;
|
procedure SetDisabledImages(const Value: TImageList); virtual;
|
||||||
|
procedure SetLargeImages(const Value: TImageList); virtual;
|
||||||
|
procedure SetDisabledLargeImages(const Value: TImageList); virtual;
|
||||||
|
procedure SetAppearance(const Value: TSpkToolbarAppearance);
|
||||||
|
|
||||||
property ToolbarDispatch : TSpkBaseToolbarDispatch read FToolbarDispatch write FToolbarDispatch;
|
public
|
||||||
property Appearance : TSpkToolbarAppearance read FAppearance write SetAppearance;
|
constructor Create(AOwner: TComponent); override;
|
||||||
property Images : TImageList read FImages write SetImages;
|
destructor Destroy; override;
|
||||||
property DisabledImages : TImageList read FDisabledImages write SetDisabledImages;
|
|
||||||
property LargeImages : TImageList read FLargeImages write SetLargeImages;
|
|
||||||
property DisabledLargeImages : TImageList read FDisabledLargeImages write SetDisabledLargeImages;
|
|
||||||
|
|
||||||
property Rect : T2DIntRect read FRect write SetRect;
|
procedure MouseLeave; virtual; abstract;
|
||||||
published
|
procedure MouseDown(Button: TMouseButton; Shift: TShiftState;
|
||||||
property Visible : boolean read FVisible write SetVisible;
|
X, Y: Integer); virtual; abstract;
|
||||||
property Enabled : boolean read FEnabled write SetEnabled;
|
procedure MouseMove(Shift: TShiftState; X, Y: Integer); virtual; abstract;
|
||||||
end;
|
procedure MouseUp(Button: TMouseButton; Shift: TShiftState;
|
||||||
|
X, Y: Integer); virtual; abstract;
|
||||||
|
|
||||||
|
function GetWidth: integer; virtual; abstract;
|
||||||
|
function GetTableBehaviour: TSpkItemTableBehaviour; virtual; abstract;
|
||||||
|
function GetGroupBehaviour: TSpkItemGroupBehaviour; virtual; abstract;
|
||||||
|
function GetSize: TSpkItemSize; virtual; abstract;
|
||||||
|
|
||||||
|
procedure Draw(ABuffer: TBitmap; ClipRect: T2DIntRect); virtual; abstract;
|
||||||
|
|
||||||
|
property ToolbarDispatch: TSpkBaseToolbarDispatch read FToolbarDispatch write FToolbarDispatch;
|
||||||
|
property Appearance: TSpkToolbarAppearance read FAppearance write SetAppearance;
|
||||||
|
property Images: TImageList read FImages write SetImages;
|
||||||
|
property DisabledImages: TImageList read FDisabledImages write SetDisabledImages;
|
||||||
|
property LargeImages: TImageList read FLargeImages write SetLargeImages;
|
||||||
|
property DisabledLargeImages: TImageList read FDisabledLargeImages write SetDisabledLargeImages;
|
||||||
|
property Rect: T2DIntRect read FRect write SetRect;
|
||||||
|
|
||||||
|
published
|
||||||
|
property Visible: boolean read FVisible write SetVisible;
|
||||||
|
property Enabled: boolean read FEnabled write SetEnabled;
|
||||||
|
end;
|
||||||
|
|
||||||
|
TSpkBaseItemClass = class of TSpkBaseItem;
|
||||||
|
|
||||||
type TSpkBaseItemClass = class of TSpkBaseItem;
|
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
{ TSpkBaseItem }
|
{ TSpkBaseItem }
|
||||||
|
|
||||||
constructor TSpkBaseItem.Create(AOwner : TComponent);
|
constructor TSpkBaseItem.Create(AOwner: TComponent);
|
||||||
begin
|
begin
|
||||||
inherited Create(AOwner);
|
inherited Create(AOwner);
|
||||||
|
|
||||||
{$IFDEF EnhancedRecordSupport}
|
{$IFDEF EnhancedRecordSupport}
|
||||||
FRect:=T2DIntRect.create(0, 0, 0, 0);
|
FRect := T2DIntRect.Create(0, 0, 0, 0);
|
||||||
{$ELSE}
|
{$ELSE}
|
||||||
FRect.create(0, 0, 0, 0);
|
FRect.Create(0, 0, 0, 0);
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
FToolbarDispatch:=nil;
|
FToolbarDispatch := nil;
|
||||||
FAppearance:=nil;
|
FAppearance := nil;
|
||||||
FImages:=nil;
|
FImages := nil;
|
||||||
FDisabledImages:=nil;
|
FDisabledImages := nil;
|
||||||
FLargeImages:=nil;
|
FLargeImages := nil;
|
||||||
FDisabledLargeImages:=nil;
|
FDisabledLargeImages := nil;
|
||||||
FVisible:=true;
|
FVisible := true;
|
||||||
FEnabled:=true;
|
FEnabled := true;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
destructor TSpkBaseItem.Destroy;
|
destructor TSpkBaseItem.Destroy;
|
||||||
@ -108,9 +115,8 @@ end;
|
|||||||
procedure TSpkBaseItem.SetAppearance(const Value: TSpkToolbarAppearance);
|
procedure TSpkBaseItem.SetAppearance(const Value: TSpkToolbarAppearance);
|
||||||
begin
|
begin
|
||||||
FAppearance := Value;
|
FAppearance := Value;
|
||||||
|
if Assigned(FToolbarDispatch) then
|
||||||
if assigned(FToolbarDispatch) then
|
FToolbarDispatch.NotifyMetricsChanged;
|
||||||
FToolbarDispatch.NotifyMetricsChanged;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSpkBaseItem.SetDisabledImages(const Value: TImageList);
|
procedure TSpkBaseItem.SetDisabledImages(const Value: TImageList);
|
||||||
@ -120,17 +126,17 @@ end;
|
|||||||
|
|
||||||
procedure TSpkBaseItem.SetDisabledLargeImages(const Value: TImageList);
|
procedure TSpkBaseItem.SetDisabledLargeImages(const Value: TImageList);
|
||||||
begin
|
begin
|
||||||
FDisabledLargeImages:=Value;
|
FDisabledLargeImages := Value;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSpkBaseItem.SetEnabled(const Value: boolean);
|
procedure TSpkBaseItem.SetEnabled(const Value: boolean);
|
||||||
begin
|
begin
|
||||||
if Value<>FEnabled then
|
if Value <> FEnabled then
|
||||||
begin
|
begin
|
||||||
FEnabled:=Value;
|
FEnabled := Value;
|
||||||
if FToolbarDispatch<>nil then
|
if FToolbarDispatch<>nil then
|
||||||
FToolbarDispatch.NotifyVisualsChanged;
|
FToolbarDispatch.NotifyVisualsChanged;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSpkBaseItem.SetImages(const Value: TImageList);
|
procedure TSpkBaseItem.SetImages(const Value: TImageList);
|
||||||
@ -150,12 +156,12 @@ end;
|
|||||||
|
|
||||||
procedure TSpkBaseItem.SetVisible(const Value: boolean);
|
procedure TSpkBaseItem.SetVisible(const Value: boolean);
|
||||||
begin
|
begin
|
||||||
if Value<>FVisible then
|
if Value <> FVisible then
|
||||||
begin
|
begin
|
||||||
FVisible:=Value;
|
FVisible := Value;
|
||||||
if FToolbarDispatch<>nil then
|
if FToolbarDispatch <> nil then
|
||||||
FToolbarDispatch.NotifyMetricsChanged;
|
FToolbarDispatch.NotifyMetricsChanged;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -12,7 +12,6 @@ type
|
|||||||
TSpkCustomCheckbox = class;
|
TSpkCustomCheckbox = class;
|
||||||
|
|
||||||
TSpkCheckboxActionLink = class(TSpkButtonActionLink)
|
TSpkCheckboxActionLink = class(TSpkButtonActionLink)
|
||||||
private
|
|
||||||
protected
|
protected
|
||||||
procedure SetChecked(Value: Boolean); override;
|
procedure SetChecked(Value: Boolean); override;
|
||||||
public
|
public
|
||||||
@ -98,7 +97,8 @@ procedure TSpkCheckboxActionLink.SetChecked(Value: Boolean);
|
|||||||
var
|
var
|
||||||
cb: TSpkCustomCheckbox;
|
cb: TSpkCustomCheckbox;
|
||||||
begin
|
begin
|
||||||
if IsCheckedLinked then begin
|
if IsCheckedLinked then
|
||||||
|
begin
|
||||||
cb := TSpkCustomCheckbox(FClient);
|
cb := TSpkCustomCheckbox(FClient);
|
||||||
cb.Checked := Value;
|
cb.Checked := Value;
|
||||||
end;
|
end;
|
||||||
@ -120,7 +120,8 @@ end;
|
|||||||
procedure TSpkCustomCheckbox.ActionChange(Sender: TObject);
|
procedure TSpkCustomCheckbox.ActionChange(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
if Sender is TCustomAction then
|
if Sender is TCustomAction then
|
||||||
with TCustomAction(Sender) do begin
|
with TCustomAction(Sender) do
|
||||||
|
begin
|
||||||
if (Self.Caption = '') or (Self.Caption = GetDefaultCaption) then
|
if (Self.Caption = '') or (Self.Caption = GetDefaultCaption) then
|
||||||
Self.Caption := Caption;
|
Self.Caption := Caption;
|
||||||
if (Self.Enabled = True) then
|
if (Self.Enabled = True) then
|
||||||
@ -148,7 +149,7 @@ end;
|
|||||||
|
|
||||||
procedure TSpkCustomCheckbox.CalcRects;
|
procedure TSpkCustomCheckbox.CalcRects;
|
||||||
var
|
var
|
||||||
RectVector : T2DIntVector;
|
RectVector: T2DIntVector;
|
||||||
begin
|
begin
|
||||||
ConstructRect(FButtonRect);
|
ConstructRect(FButtonRect);
|
||||||
{$IFDEF EnhancedRecordSupport}
|
{$IFDEF EnhancedRecordSupport}
|
||||||
@ -179,12 +180,12 @@ end;
|
|||||||
|
|
||||||
procedure TSpkCustomCheckbox.ConstructRect(var BtnRect: T2DIntRect);
|
procedure TSpkCustomCheckbox.ConstructRect(var BtnRect: T2DIntRect);
|
||||||
var
|
var
|
||||||
BtnWidth : integer;
|
BtnWidth: integer;
|
||||||
Bitmap : TBitmap;
|
Bitmap: TBitmap;
|
||||||
TextWidth: Integer;
|
TextWidth: Integer;
|
||||||
begin
|
begin
|
||||||
{$IFDEF EnhancedRecordSupport}
|
{$IFDEF EnhancedRecordSupport}
|
||||||
BtnRect:=T2DIntRect.Create(0, 0, 0, 0);
|
BtnRect := T2DIntRect.Create(0, 0, 0, 0);
|
||||||
{$ELSE}
|
{$ELSE}
|
||||||
BtnRect.Create(0, 0, 0, 0);
|
BtnRect.Create(0, 0, 0, 0);
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
@ -195,7 +196,7 @@ begin
|
|||||||
exit;
|
exit;
|
||||||
|
|
||||||
Bitmap := FToolbarDispatch.GetTempBitmap;
|
Bitmap := FToolbarDispatch.GetTempBitmap;
|
||||||
if not(assigned(Bitmap)) then
|
if not Assigned(Bitmap) then
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
Bitmap.Canvas.Font.Assign(FAppearance.Element.CaptionFont);
|
Bitmap.Canvas.Font.Assign(FAppearance.Element.CaptionFont);
|
||||||
@ -246,7 +247,8 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
// Border
|
// Border
|
||||||
if (FButtonState = bsIdle) and (not(FHideFrameWhenIdle)) then begin
|
if (FButtonState = bsIdle) and (not(FHideFrameWhenIdle)) then
|
||||||
|
begin
|
||||||
with FAppearance.Element do
|
with FAppearance.Element do
|
||||||
TButtonTools.DrawButton(
|
TButtonTools.DrawButton(
|
||||||
ABuffer,
|
ABuffer,
|
||||||
@ -265,7 +267,8 @@ begin
|
|||||||
ClipRect
|
ClipRect
|
||||||
);
|
);
|
||||||
end else
|
end else
|
||||||
if (FButtonState=bsBtnHottrack) then begin
|
if (FButtonState=bsBtnHottrack) then
|
||||||
|
begin
|
||||||
with FAppearance.Element do
|
with FAppearance.Element do
|
||||||
TButtonTools.DrawButton(
|
TButtonTools.DrawButton(
|
||||||
ABuffer,
|
ABuffer,
|
||||||
@ -284,7 +287,8 @@ begin
|
|||||||
ClipRect
|
ClipRect
|
||||||
);
|
);
|
||||||
end else
|
end else
|
||||||
if (FButtonState = bsBtnPressed) then begin
|
if (FButtonState = bsBtnPressed) then
|
||||||
|
begin
|
||||||
with FAppearance.Element do
|
with FAppearance.Element do
|
||||||
TButtonTools.DrawButton(
|
TButtonTools.DrawButton(
|
||||||
ABuffer,
|
ABuffer,
|
||||||
@ -305,11 +309,13 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
// Checkbox
|
// Checkbox
|
||||||
if ThemeServices.ThemesEnabled then begin
|
if ThemeServices.ThemesEnabled then
|
||||||
|
begin
|
||||||
te := ThemeServices.GetElementDetails(tbCheckboxCheckedNormal);
|
te := ThemeServices.GetElementDetails(tbCheckboxCheckedNormal);
|
||||||
h := ThemeServices.GetDetailSize(te).cy;
|
h := ThemeServices.GetDetailSize(te).cy;
|
||||||
end else
|
end else
|
||||||
h := GetSystemMetrics(SM_CYMENUCHECK);
|
h := GetSystemMetrics(SM_CYMENUCHECK);
|
||||||
|
|
||||||
if (FGroupBehaviour in [gbContinuesGroup, gbEndsGroup]) then
|
if (FGroupBehaviour in [gbContinuesGroup, gbEndsGroup]) then
|
||||||
x := FButtonRect.Left + SmallButtonHalfBorderWidth + SmallButtonPadding
|
x := FButtonRect.Left + SmallButtonHalfBorderWidth + SmallButtonPadding
|
||||||
else
|
else
|
||||||
@ -350,40 +356,40 @@ end;
|
|||||||
|
|
||||||
function TSpkCustomCheckbox.GetChecked: Boolean;
|
function TSpkCustomCheckbox.GetChecked: Boolean;
|
||||||
begin
|
begin
|
||||||
result := (FState = cbChecked);
|
Result := (FState = cbChecked);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TSpkCustomCheckbox.GetDefaultCaption: String;
|
function TSpkCustomCheckbox.GetDefaultCaption: String;
|
||||||
begin
|
begin
|
||||||
result := 'Checkbox';
|
Result := 'Checkbox';
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TSpkCustomCheckbox.GetGroupBehaviour: TSpkItemGroupBehaviour;
|
function TSpkCustomCheckbox.GetGroupBehaviour: TSpkItemGroupBehaviour;
|
||||||
begin
|
begin
|
||||||
result := FGroupBehaviour;
|
Result := FGroupBehaviour;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TSpkCustomCheckbox.GetSize: TSpkItemSize;
|
function TSpkCustomCheckbox.GetSize: TSpkItemSize;
|
||||||
begin
|
begin
|
||||||
result := isNormal;
|
Result := isNormal;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TSpkCustomCheckbox.GetTableBehaviour: TSpkItemTableBehaviour;
|
function TSpkCustomCheckbox.GetTableBehaviour: TSpkItemTableBehaviour;
|
||||||
begin
|
begin
|
||||||
result := FTableBehaviour;
|
Result := FTableBehaviour;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TSpkCustomCheckbox.GetWidth: integer;
|
function TSpkCustomCheckbox.GetWidth: integer;
|
||||||
var
|
var
|
||||||
BtnRect, DropRect : T2DIntRect;
|
BtnRect, DropRect: T2DIntRect;
|
||||||
begin
|
begin
|
||||||
result := -1;
|
Result := -1;
|
||||||
if FToolbarDispatch = nil then
|
if FToolbarDispatch = nil then
|
||||||
exit;
|
exit;
|
||||||
if FAppearance = nil then
|
if FAppearance = nil then
|
||||||
exit;
|
exit;
|
||||||
ConstructRect(BtnRect);
|
ConstructRect(BtnRect);
|
||||||
result := BtnRect.Right + 1;
|
Result := BtnRect.Right + 1;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSpkCustomCheckbox.MouseDown(Button: TMouseButton; Shift: TShiftState;
|
procedure TSpkCustomCheckbox.MouseDown(Button: TMouseButton; Shift: TShiftState;
|
||||||
@ -452,7 +458,8 @@ end;
|
|||||||
|
|
||||||
procedure TSpkCustomCheckbox.SetState(AValue:TCheckboxState);
|
procedure TSpkCustomCheckbox.SetState(AValue:TCheckboxState);
|
||||||
begin
|
begin
|
||||||
if AValue <> FState then begin
|
if AValue <> FState then
|
||||||
|
begin
|
||||||
FState := AValue;
|
FState := AValue;
|
||||||
if Assigned(FToolbarDispatch) then
|
if Assigned(FToolbarDispatch) then
|
||||||
FToolbarDispatch.NotifyVisualsChanged;
|
FToolbarDispatch.NotifyVisualsChanged;
|
||||||
@ -477,6 +484,7 @@ end;
|
|||||||
|
|
||||||
|
|
||||||
{ TSpkRadioButton }
|
{ TSpkRadioButton }
|
||||||
|
|
||||||
constructor TSpkRadioButton.Create(AOwner: TComponent);
|
constructor TSpkRadioButton.Create(AOwner: TComponent);
|
||||||
begin
|
begin
|
||||||
inherited Create(AOwner);
|
inherited Create(AOwner);
|
||||||
@ -485,7 +493,7 @@ end;
|
|||||||
|
|
||||||
function TSpkRadioButton.GetDefaultCaption: string;
|
function TSpkRadioButton.GetDefaultCaption: string;
|
||||||
begin
|
begin
|
||||||
result := 'RadioButton';
|
Result := 'RadioButton';
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSpkRadioButton.SetState(AValue: TCheckboxState);
|
procedure TSpkRadioButton.SetState(AValue: TCheckboxState);
|
||||||
@ -500,7 +508,8 @@ var
|
|||||||
i: Integer;
|
i: Integer;
|
||||||
pane: TSpkPane;
|
pane: TSpkPane;
|
||||||
begin
|
begin
|
||||||
if (Parent is TSpkPane) then begin
|
if (Parent is TSpkPane) then
|
||||||
|
begin
|
||||||
pane := TSpkPane(Parent);
|
pane := TSpkPane(Parent);
|
||||||
for i:=0 to pane.Items.Count-1 do
|
for i:=0 to pane.Items.Count-1 do
|
||||||
if (pane.items[i] is TSpkRadioButton) and (pane.items[i] <> self) then
|
if (pane.items[i] is TSpkRadioButton) and (pane.items[i] <> self) then
|
||||||
|
@ -266,7 +266,6 @@ uses
|
|||||||
|
|
||||||
procedure SpkInitLayoutConsts(FromDPI: Integer; ToDPI: Integer = 0);
|
procedure SpkInitLayoutConsts(FromDPI: Integer; ToDPI: Integer = 0);
|
||||||
begin
|
begin
|
||||||
|
|
||||||
if not(DPI_AWARE) then
|
if not(DPI_AWARE) then
|
||||||
ToDPI := FromDPI;
|
ToDPI := FromDPI;
|
||||||
|
|
||||||
@ -391,21 +390,21 @@ initialization
|
|||||||
// Sprawdzanie poprawnoœci
|
// Sprawdzanie poprawnoœci
|
||||||
|
|
||||||
// £uk du¿ego przycisku
|
// £uk du¿ego przycisku
|
||||||
assert(LARGEBUTTON_RADIUS * 2 <= LARGEBUTTON_DROPDOWN_FIELD_SIZE);
|
Assert(LARGEBUTTON_RADIUS * 2 <= LARGEBUTTON_DROPDOWN_FIELD_SIZE);
|
||||||
|
|
||||||
// Tafla, wersja z jednym wierszem
|
// Tafla, wersja z jednym wierszem
|
||||||
assert(PANE_ROW_HEIGHT +
|
Assert(PANE_ROW_HEIGHT +
|
||||||
PANE_ONE_ROW_TOPPADDING +
|
PANE_ONE_ROW_TOPPADDING +
|
||||||
PANE_ONE_ROW_BOTTOMPADDING <= MAX_ELEMENT_HEIGHT);
|
PANE_ONE_ROW_BOTTOMPADDING <= MAX_ELEMENT_HEIGHT);
|
||||||
|
|
||||||
// Tafla, wersja z dwoma wierszami
|
// Tafla, wersja z dwoma wierszami
|
||||||
assert(2*PANE_ROW_HEIGHT +
|
Assert(2*PANE_ROW_HEIGHT +
|
||||||
PANE_TWO_ROWS_TOPPADDING +
|
PANE_TWO_ROWS_TOPPADDING +
|
||||||
PANE_TWO_ROWS_VSPACER +
|
PANE_TWO_ROWS_VSPACER +
|
||||||
PANE_TWO_ROWS_BOTTOMPADDING <= MAX_ELEMENT_HEIGHT);
|
PANE_TWO_ROWS_BOTTOMPADDING <= MAX_ELEMENT_HEIGHT);
|
||||||
|
|
||||||
// Tafla, wersja z trzema wierszami
|
// Tafla, wersja z trzema wierszami
|
||||||
assert(3*PANE_ROW_HEIGHT +
|
Assert(3*PANE_ROW_HEIGHT +
|
||||||
PANE_THREE_ROWS_TOPPADDING +
|
PANE_THREE_ROWS_TOPPADDING +
|
||||||
2*PANE_THREE_ROWS_VSPACER +
|
2*PANE_THREE_ROWS_VSPACER +
|
||||||
PANE_THREE_ROWS_BOTTOMPADDING <= MAX_ELEMENT_HEIGHT);
|
PANE_THREE_ROWS_BOTTOMPADDING <= MAX_ELEMENT_HEIGHT);
|
||||||
|
@ -15,32 +15,30 @@ unit spkt_Dispatch;
|
|||||||
|
|
||||||
interface
|
interface
|
||||||
|
|
||||||
uses Classes, Controls, Graphics,
|
uses
|
||||||
SpkMath;
|
Classes, Controls, Graphics,
|
||||||
|
SpkMath;
|
||||||
|
|
||||||
type TSpkBaseDispatch = class abstract(TObject)
|
type
|
||||||
private
|
TSpkBaseDispatch = class abstract(TObject)
|
||||||
protected
|
private
|
||||||
public
|
protected
|
||||||
end;
|
public
|
||||||
|
end;
|
||||||
|
|
||||||
type TSpkBaseAppearanceDispatch = class abstract(TSpkBaseDispatch)
|
TSpkBaseAppearanceDispatch = class abstract(TSpkBaseDispatch)
|
||||||
private
|
public
|
||||||
protected
|
procedure NotifyAppearanceChanged; virtual; abstract;
|
||||||
public
|
end;
|
||||||
procedure NotifyAppearanceChanged; virtual; abstract;
|
|
||||||
end;
|
|
||||||
|
|
||||||
type TSpkBaseToolbarDispatch = class abstract(TSpkBaseAppearanceDispatch)
|
TSpkBaseToolbarDispatch = class abstract(TSpkBaseAppearanceDispatch)
|
||||||
private
|
public
|
||||||
protected
|
procedure NotifyItemsChanged; virtual; abstract;
|
||||||
public
|
procedure NotifyMetricsChanged; virtual; abstract;
|
||||||
procedure NotifyItemsChanged; virtual; abstract;
|
procedure NotifyVisualsChanged; virtual; abstract;
|
||||||
procedure NotifyMetricsChanged; virtual; abstract;
|
function GetTempBitmap: TBitmap; virtual; abstract;
|
||||||
procedure NotifyVisualsChanged; virtual; abstract;
|
function ClientToScreen(Point: T2DIntPoint): T2DIntPoint; virtual; abstract;
|
||||||
function GetTempBitmap : TBitmap; virtual; abstract;
|
end;
|
||||||
function ClientToScreen(Point : T2DIntPoint) : T2DIntPoint; virtual; abstract;
|
|
||||||
end;
|
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
|
@ -14,12 +14,14 @@ unit spkt_Exceptions;
|
|||||||
|
|
||||||
interface
|
interface
|
||||||
|
|
||||||
uses SysUtils;
|
uses
|
||||||
|
SysUtils;
|
||||||
|
|
||||||
type InternalException = class(Exception);
|
type
|
||||||
AssignException = class(Exception);
|
InternalException = class(Exception);
|
||||||
RuntimeException = class(Exception);
|
AssignException = class(Exception);
|
||||||
ListException = class(Exception);
|
RuntimeException = class(Exception);
|
||||||
|
ListException = class(Exception);
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
|
@ -15,45 +15,48 @@ unit spkt_Items;
|
|||||||
|
|
||||||
interface
|
interface
|
||||||
|
|
||||||
uses Classes, Controls, SysUtils, Dialogs,
|
uses
|
||||||
spkt_Appearance, spkt_Dispatch, spkt_BaseItem, spkt_Types,
|
Classes, Controls, SysUtils, Dialogs,
|
||||||
spkt_Buttons, spkt_Checkboxes;
|
spkt_Appearance, spkt_Dispatch, spkt_BaseItem, spkt_Types,
|
||||||
|
spkt_Buttons, spkt_Checkboxes;
|
||||||
|
|
||||||
type TSpkItems = class(TSpkCollection)
|
type
|
||||||
private
|
TSpkItems = class(TSpkCollection)
|
||||||
FToolbarDispatch : TSpkBaseToolbarDispatch;
|
private
|
||||||
FAppearance : TSpkToolbarAppearance;
|
FToolbarDispatch: TSpkBaseToolbarDispatch;
|
||||||
FImages : TImageList;
|
FAppearance: TSpkToolbarAppearance;
|
||||||
FDisabledImages : TImageList;
|
FImages: TImageList;
|
||||||
FLargeImages : TImageList;
|
FDisabledImages: TImageList;
|
||||||
FDisabledLargeImages : TImageList;
|
FLargeImages: TImageList;
|
||||||
|
FDisabledLargeImages: TImageList;
|
||||||
|
|
||||||
// *** Gettery i settery ***
|
// *** Gettery i settery ***
|
||||||
procedure SetToolbarDispatch(const Value: TSpkBaseToolbarDispatch);
|
procedure SetToolbarDispatch(const Value: TSpkBaseToolbarDispatch);
|
||||||
function GetItems(index: integer): TSpkBaseItem; reintroduce;
|
function GetItems(AIndex: integer): TSpkBaseItem; reintroduce;
|
||||||
procedure SetAppearance(const Value: TSpkToolbarAppearance);
|
procedure SetAppearance(const Value: TSpkToolbarAppearance);
|
||||||
procedure SetImages(const Value: TImageList);
|
procedure SetImages(const Value: TImageList);
|
||||||
procedure SetDisabledImages(const Value : TImageList);
|
procedure SetDisabledImages(const Value: TImageList);
|
||||||
procedure SetLargeImages(const Value : TImageList);
|
procedure SetLargeImages(const Value: TImageList);
|
||||||
procedure SetDisabledLargeImages(const Value : TImageList);
|
procedure SetDisabledLargeImages(const Value: TImageList);
|
||||||
public
|
|
||||||
function AddLargeButton : TSpkLargeButton;
|
|
||||||
function AddSmallButton : TSpkSmallButton;
|
|
||||||
function AddCheckbox: TSpkCheckbox;
|
|
||||||
function AddRadioButton: TSpkRadioButton;
|
|
||||||
|
|
||||||
// *** Reakcja na zmiany listy ***
|
public
|
||||||
procedure Notify(Item: TComponent; Operation : TOperation); override;
|
function AddLargeButton: TSpkLargeButton;
|
||||||
procedure Update; override;
|
function AddSmallButton: TSpkSmallButton;
|
||||||
|
function AddCheckbox: TSpkCheckbox;
|
||||||
|
function AddRadioButton: TSpkRadioButton;
|
||||||
|
|
||||||
property Items[index : integer] : TSpkBaseItem read GetItems; default;
|
// *** Reakcja na zmiany listy ***
|
||||||
property ToolbarDispatch : TSpkBaseToolbarDispatch read FToolbarDispatch write SetToolbarDispatch;
|
procedure Notify(Item: TComponent; Operation: TOperation); override;
|
||||||
property Appearance : TSpkToolbarAppearance read FAppearance write SetAppearance;
|
procedure Update; override;
|
||||||
property Images : TImageList read FImages write SetImages;
|
|
||||||
property DisabledImages : TImageList read FDisabledImages write SetDisabledImages;
|
property Items[index: integer]: TSpkBaseItem read GetItems; default;
|
||||||
property LargeImages : TImageList read FLargeImages write SetLargeImages;
|
property ToolbarDispatch: TSpkBaseToolbarDispatch read FToolbarDispatch write SetToolbarDispatch;
|
||||||
property DisabledLargeImages : TImageList read FDisabledLargeImages write SetDisabledLargeImages;
|
property Appearance: TSpkToolbarAppearance read FAppearance write SetAppearance;
|
||||||
end;
|
property Images: TImageList read FImages write SetImages;
|
||||||
|
property DisabledImages: TImageList read FDisabledImages write SetDisabledImages;
|
||||||
|
property LargeImages: TImageList read FLargeImages write SetLargeImages;
|
||||||
|
property DisabledLargeImages: TImageList read FDisabledLargeImages write SetDisabledLargeImages;
|
||||||
|
end;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
@ -87,47 +90,45 @@ begin
|
|||||||
AddItem(Result);
|
AddItem(Result);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TSpkItems.GetItems(index: integer): TSpkBaseItem;
|
function TSpkItems.GetItems(AIndex: integer): TSpkBaseItem;
|
||||||
begin
|
begin
|
||||||
result:=TSpkBaseItem(inherited Items[index]);
|
Result := TSpkBaseItem(inherited Items[AIndex]);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSpkItems.Notify(Item: TComponent;
|
procedure TSpkItems.Notify(Item: TComponent; Operation: TOperation);
|
||||||
Operation : TOperation);
|
|
||||||
begin
|
begin
|
||||||
inherited Notify(Item, Operation);
|
inherited Notify(Item, Operation);
|
||||||
|
|
||||||
case Operation of
|
case Operation of
|
||||||
opInsert: begin
|
opInsert:
|
||||||
// Ustawienie dyspozytora na nil spowoduje, ¿e podczas
|
begin
|
||||||
// przypisywania w³asnoœci nie bêd¹ wo³ane metody Notify*
|
// Ustawienie dyspozytora na nil spowoduje, ¿e podczas
|
||||||
TSpkBaseItem(Item).ToolbarDispatch:=nil;
|
// przypisywania w³asnoœci nie bêd¹ wo³ane metody Notify*
|
||||||
|
TSpkBaseItem(Item).ToolbarDispatch := nil;
|
||||||
|
TSpkBaseItem(Item).Appearance := FAppearance;
|
||||||
|
TSpkBaseItem(Item).Images := FImages;
|
||||||
|
TSpkBaseItem(Item).DisabledImages := FDisabledImages;
|
||||||
|
TSpkBaseItem(Item).LargeImages := FLargeImages;
|
||||||
|
TSpkBaseItem(Item).DisabledLargeImages := FDisabledLargeImages;
|
||||||
|
TSpkBaseItem(Item).ToolbarDispatch := FToolbarDispatch;
|
||||||
|
end;
|
||||||
|
|
||||||
TSpkBaseItem(Item).Appearance:=FAppearance;
|
opRemove:
|
||||||
TSpkBaseItem(Item).Images:=FImages;
|
if not (csDestroying in Item.ComponentState) then
|
||||||
TSpkBaseItem(Item).DisabledImages:=FDisabledImages;
|
begin
|
||||||
TSpkBaseItem(Item).LargeImages:=FLargeImages;
|
TSpkBaseItem(Item).ToolbarDispatch := nil;
|
||||||
TSpkBaseItem(Item).DisabledLargeImages:=FDisabledLargeImages;
|
TSpkBaseItem(Item).Appearance := nil;
|
||||||
TSpkBaseItem(Item).ToolbarDispatch:=FToolbarDispatch;
|
TSpkBaseItem(Item).Images := nil;
|
||||||
end;
|
TSpkBaseItem(Item).DisabledImages := nil;
|
||||||
opRemove: begin
|
TSpkBaseItem(Item).LargeImages := nil;
|
||||||
if not(csDestroying in Item.ComponentState) then
|
TSpkBaseItem(Item).DisabledLargeImages := nil;
|
||||||
begin
|
end;
|
||||||
TSpkBaseItem(Item).ToolbarDispatch:=nil;
|
|
||||||
TSpkBaseItem(Item).Appearance:=nil;
|
|
||||||
TSpkBaseItem(Item).Images:=nil;
|
|
||||||
TSpkBaseItem(Item).DisabledImages:=nil;
|
|
||||||
TSpkBaseItem(Item).LargeImages:=nil;
|
|
||||||
TSpkBaseItem(Item).DisabledLargeImages:=nil;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSpkItems.SetAppearance(const Value: TSpkToolbarAppearance);
|
procedure TSpkItems.SetAppearance(const Value: TSpkToolbarAppearance);
|
||||||
|
var
|
||||||
var i: Integer;
|
i: Integer;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
FAppearance := Value;
|
FAppearance := Value;
|
||||||
for i := 0 to Count - 1 do
|
for i := 0 to Count - 1 do
|
||||||
@ -135,9 +136,8 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSpkItems.SetDisabledImages(const Value: TImageList);
|
procedure TSpkItems.SetDisabledImages(const Value: TImageList);
|
||||||
|
var
|
||||||
var i: Integer;
|
i: Integer;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
FDisabledImages := Value;
|
FDisabledImages := Value;
|
||||||
for i := 0 to Count - 1 do
|
for i := 0 to Count - 1 do
|
||||||
@ -145,9 +145,8 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSpkItems.SetDisabledLargeImages(const Value: TImageList);
|
procedure TSpkItems.SetDisabledLargeImages(const Value: TImageList);
|
||||||
|
var
|
||||||
var i: Integer;
|
i: Integer;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
FDisabledLargeImages := Value;
|
FDisabledLargeImages := Value;
|
||||||
for i := 0 to Count - 1 do
|
for i := 0 to Count - 1 do
|
||||||
@ -155,9 +154,8 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSpkItems.SetImages(const Value: TImageList);
|
procedure TSpkItems.SetImages(const Value: TImageList);
|
||||||
|
var
|
||||||
var i: Integer;
|
i: Integer;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
FImages := Value;
|
FImages := Value;
|
||||||
for i := 0 to Count - 1 do
|
for i := 0 to Count - 1 do
|
||||||
@ -165,9 +163,8 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSpkItems.SetLargeImages(const Value: TImageList);
|
procedure TSpkItems.SetLargeImages(const Value: TImageList);
|
||||||
|
var
|
||||||
var i: Integer;
|
i: Integer;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
FLargeImages := Value;
|
FLargeImages := Value;
|
||||||
for i := 0 to Count - 1 do
|
for i := 0 to Count - 1 do
|
||||||
@ -175,9 +172,8 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSpkItems.SetToolbarDispatch(const Value: TSpkBaseToolbarDispatch);
|
procedure TSpkItems.SetToolbarDispatch(const Value: TSpkBaseToolbarDispatch);
|
||||||
|
var
|
||||||
var i : integer;
|
i : integer;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
FToolbarDispatch := Value;
|
FToolbarDispatch := Value;
|
||||||
for i := 0 to Count - 1 do
|
for i := 0 to Count - 1 do
|
||||||
@ -187,8 +183,7 @@ end;
|
|||||||
procedure TSpkItems.Update;
|
procedure TSpkItems.Update;
|
||||||
begin
|
begin
|
||||||
inherited Update;
|
inherited Update;
|
||||||
|
if Assigned(FToolbarDispatch) then
|
||||||
if assigned(FToolbarDispatch) then
|
|
||||||
FToolbarDispatch.NotifyItemsChanged;
|
FToolbarDispatch.NotifyItemsChanged;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -18,25 +18,24 @@ interface
|
|||||||
uses
|
uses
|
||||||
Graphics, SysUtils, SpkMath, SpkGUITools;
|
Graphics, SysUtils, SpkMath, SpkGUITools;
|
||||||
|
|
||||||
type TButtonTools = class sealed(TObject)
|
type
|
||||||
private
|
TButtonTools = class sealed(TObject)
|
||||||
protected
|
public
|
||||||
public
|
class procedure DrawButton(Bitmap: TBitmap;
|
||||||
class procedure DrawButton(Bitmap: TBitmap;
|
Rect: T2DIntRect;
|
||||||
Rect: T2DIntRect;
|
FrameColor,
|
||||||
FrameColor,
|
InnerLightColor,
|
||||||
InnerLightColor,
|
InnerDarkColor,
|
||||||
InnerDarkColor,
|
GradientFrom,
|
||||||
GradientFrom,
|
GradientTo: TColor;
|
||||||
GradientTo: TColor;
|
GradientKind: TBackgroundKind;
|
||||||
GradientKind: TBackgroundKind;
|
LeftEdgeOpen,
|
||||||
LeftEdgeOpen,
|
RightEdgeOpen,
|
||||||
RightEdgeOpen,
|
TopEdgeOpen,
|
||||||
TopEdgeOpen,
|
BottomEdgeOpen: boolean;
|
||||||
BottomEdgeOpen: boolean;
|
Radius: integer;
|
||||||
Radius: integer;
|
ClipRect: T2DIntRect);
|
||||||
ClipRect: T2DIntRect);
|
end;
|
||||||
end;
|
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
@ -46,13 +45,12 @@ class procedure TButtonTools.DrawButton(Bitmap: TBitmap;
|
|||||||
Rect: T2DIntRect; FrameColor, InnerLightColor, InnerDarkColor, GradientFrom,
|
Rect: T2DIntRect; FrameColor, InnerLightColor, InnerDarkColor, GradientFrom,
|
||||||
GradientTo: TColor; GradientKind: TBackgroundKind; LeftEdgeOpen,
|
GradientTo: TColor; GradientKind: TBackgroundKind; LeftEdgeOpen,
|
||||||
RightEdgeOpen, TopEdgeOpen, BottomEdgeOpen: boolean; Radius: integer;
|
RightEdgeOpen, TopEdgeOpen, BottomEdgeOpen: boolean; Radius: integer;
|
||||||
ClipRect : T2DIntRect);
|
ClipRect: T2DIntRect);
|
||||||
|
|
||||||
var
|
var
|
||||||
x1, x2, y1, y2: integer;
|
x1, x2, y1, y2: integer;
|
||||||
LeftClosed, TopClosed, RightClosed, BottomClosed: byte;
|
LeftClosed, TopClosed, RightClosed, BottomClosed: byte;
|
||||||
begin
|
begin
|
||||||
if (Rect.Width <6 ) or (Rect.Height < 6) or
|
if (Rect.Width < 6) or (Rect.Height < 6) or
|
||||||
(Rect.Width < 2*Radius) or (Rect.Height < 2*Radius) then exit;
|
(Rect.Width < 2*Radius) or (Rect.Height < 2*Radius) then exit;
|
||||||
|
|
||||||
if LeftEdgeOpen then LeftClosed := 0 else LeftClosed := 1;
|
if LeftEdgeOpen then LeftClosed := 0 else LeftClosed := 1;
|
||||||
|
@ -14,86 +14,104 @@ unit spkt_Types;
|
|||||||
|
|
||||||
interface
|
interface
|
||||||
|
|
||||||
uses Controls, Classes, ContNrs, SysUtils, Dialogs,
|
uses
|
||||||
spkt_Exceptions;
|
Controls, Classes, ContNrs, SysUtils, Dialogs,
|
||||||
|
spkt_Exceptions;
|
||||||
|
|
||||||
type TSpkListState = (lsNeedsProcessing, lsReady);
|
type
|
||||||
|
TSpkListState = (lsNeedsProcessing, lsReady);
|
||||||
|
|
||||||
type TSpkCollection = class(TPersistent)
|
TSpkCollection = class(TPersistent)
|
||||||
private
|
protected
|
||||||
protected
|
FList: TFPObjectList;
|
||||||
FList : TFPObjectList;
|
FNames: TStringList;
|
||||||
FNames : TStringList;
|
FListState: TSpkListState;
|
||||||
FListState : TSpkListState;
|
FRootComponent: TComponent;
|
||||||
FRootComponent : TComponent;
|
|
||||||
|
|
||||||
// *** Metody reakcji na zmiany w liœcie ***
|
// *** Metody reakcji na zmiany w liœcie ***
|
||||||
// *** Methods responding to changes in list ***
|
// *** Methods responding to changes in list ***
|
||||||
procedure Notify(Item : TComponent; Operation : TOperation); virtual;
|
procedure Notify(Item: TComponent; Operation: TOperation); virtual;
|
||||||
procedure Update; virtual;
|
procedure Update; virtual;
|
||||||
|
|
||||||
// *** Wewnêtrzne metody dodawania i wstawiania elementów ***
|
// *** Wewnêtrzne metody dodawania i wstawiania elementów ***
|
||||||
// *** Gettery i settery ***
|
// *** Gettery i settery ***
|
||||||
|
|
||||||
// *** Internal methods for adding and inserting elements ***
|
// *** Internal methods for adding and inserting elements ***
|
||||||
// *** Getters and setters ***
|
// *** Getters and setters ***
|
||||||
function GetItems(index: integer): TComponent; virtual;
|
function GetItems(AIndex: integer): TComponent; virtual;
|
||||||
public
|
|
||||||
// *** Konstruktor, destruktor ***
|
|
||||||
constructor Create(RootComponent : TComponent); reintroduce; virtual;
|
|
||||||
destructor Destroy; override;
|
|
||||||
|
|
||||||
// *** Obs³uga listy ***
|
public
|
||||||
// *** List operations ***
|
// *** Konstruktor, destruktor ***
|
||||||
procedure AddItem(AItem: TComponent);
|
constructor Create(ARootComponent : TComponent); reintroduce; virtual;
|
||||||
procedure InsertItem(index: integer; AItem: TComponent);
|
destructor Destroy; override;
|
||||||
procedure Clear;
|
|
||||||
function Count: integer;
|
|
||||||
procedure Delete(index: integer); virtual;
|
|
||||||
function IndexOf(Item: TComponent) : integer;
|
|
||||||
procedure Remove(Item: TComponent); virtual;
|
|
||||||
procedure RemoveReference(Item: TComponent);
|
|
||||||
procedure Exchange(item1, item2: integer);
|
|
||||||
procedure Move(IndexFrom, IndexTo: integer);
|
|
||||||
|
|
||||||
// *** Reader, writer i obs³uga designtime i DFM ***
|
// *** Obs³uga listy ***
|
||||||
// *** Reader, writer and operation designtime and DFM
|
// *** List operations ***
|
||||||
procedure WriteNames(Writer: TWriter); virtual;
|
procedure AddItem(AItem: TComponent);
|
||||||
procedure ReadNames(Reader: TReader); virtual;
|
procedure InsertItem(AIndex: integer; AItem: TComponent);
|
||||||
procedure ProcessNames(Owner: TComponent); virtual;
|
procedure Clear;
|
||||||
|
function Count: integer;
|
||||||
|
procedure Delete(AIndex: integer); virtual;
|
||||||
|
function IndexOf(Item: TComponent) : integer;
|
||||||
|
procedure Remove(Item: TComponent); virtual;
|
||||||
|
procedure RemoveReference(Item: TComponent);
|
||||||
|
procedure Exchange(item1, item2: integer);
|
||||||
|
procedure Move(IndexFrom, IndexTo: integer);
|
||||||
|
|
||||||
property ListState : TSpkListState read FListState;
|
// *** Reader, writer i obs³uga designtime i DFM ***
|
||||||
property Items[index : integer] : TComponent read GetItems; default;
|
// *** Reader, writer and operation designtime and DFM
|
||||||
property RootComponent: TComponent read FRootComponent;
|
procedure WriteNames(Writer: TWriter); virtual;
|
||||||
end;
|
procedure ReadNames(Reader: TReader); virtual;
|
||||||
|
procedure ProcessNames(Owner: TComponent); virtual;
|
||||||
|
|
||||||
type TSpkComponent = class(TComponent)
|
property ListState: TSpkListState read FListState;
|
||||||
private
|
property Items[index: integer] : TComponent read GetItems; default;
|
||||||
protected
|
property RootComponent: TComponent read FRootComponent;
|
||||||
FParent : TComponent;
|
end;
|
||||||
FCollection: TSpkCollection;
|
|
||||||
public
|
TSpkComponent = class(TComponent)
|
||||||
// *** Obs³uga parenta ***
|
protected
|
||||||
// *** Parent operations ***
|
FParent: TComponent;
|
||||||
function HasParent : boolean; override;
|
FCollection: TSpkCollection;
|
||||||
function GetParentComponent : TComponent; override;
|
public
|
||||||
procedure SetParentComponent(Value : TComponent); override;
|
// *** Obs³uga parenta ***
|
||||||
|
// *** Parent operations ***
|
||||||
|
function HasParent: boolean; override;
|
||||||
|
function GetParentComponent: TComponent; override;
|
||||||
|
procedure SetParentComponent(Value: TComponent); override;
|
||||||
|
|
||||||
|
property Parent: TComponent read FParent write SetParentComponent;
|
||||||
|
property Collection: TSpkCollection read FCollection;
|
||||||
|
end;
|
||||||
|
|
||||||
property Parent : TComponent read FParent write SetParentComponent;
|
|
||||||
property Collection: TSpkCollection read FCollection;
|
|
||||||
end;
|
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
{ TSpkCollection }
|
{ TSpkCollection }
|
||||||
|
|
||||||
|
constructor TSpkCollection.Create(ARootComponent: TComponent);
|
||||||
|
begin
|
||||||
|
inherited Create;
|
||||||
|
FRootComponent := ARootComponent;
|
||||||
|
FNames := TStringList.Create;
|
||||||
|
FList := TFPObjectList.Create(False);
|
||||||
|
FListState := lsReady;
|
||||||
|
end;
|
||||||
|
|
||||||
|
destructor TSpkCollection.Destroy;
|
||||||
|
begin
|
||||||
|
FNames.Free;
|
||||||
|
FList.Free;
|
||||||
|
inherited;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TSpkCollection.AddItem(AItem: TComponent);
|
procedure TSpkCollection.AddItem(AItem: TComponent);
|
||||||
begin
|
begin
|
||||||
// Ta metoda mo¿e byæ wywo³ywana bez przetworzenia nazw (w szczególnoœci, metoda
|
// Ta metoda mo¿e byæ wywo³ywana bez przetworzenia nazw (w szczególnoœci, metoda
|
||||||
// przetwarzaj¹ca nazwy korzysta z AddItem)
|
// przetwarzaj¹ca nazwy korzysta z AddItem)
|
||||||
|
|
||||||
// This method can be recalling untreated names (in particular, the method
|
// This method can be recalling untreated names (in particular, the method
|
||||||
// uses the name przetwarzaj¹ca AddItem) --- ???
|
// uses the name przetwarzaj¹ca AddItem) --- ???
|
||||||
|
|
||||||
Notify(AItem, opInsert);
|
Notify(AItem, opInsert);
|
||||||
FList.Add(AItem);
|
FList.Add(AItem);
|
||||||
@ -112,49 +130,31 @@ end;
|
|||||||
|
|
||||||
function TSpkCollection.Count: integer;
|
function TSpkCollection.Count: integer;
|
||||||
begin
|
begin
|
||||||
result := FList.Count;
|
Result := FList.Count;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
constructor TSpkCollection.Create(RootComponent : TComponent);
|
procedure TSpkCollection.Delete(AIndex: integer);
|
||||||
begin
|
begin
|
||||||
inherited Create;
|
if (AIndex < 0) or (AIndex >= FList.count) then
|
||||||
FRootComponent := RootComponent;
|
|
||||||
FNames := TStringList.create;
|
|
||||||
FList := TFPObjectList.create(False);
|
|
||||||
FListState := lsReady;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TSpkCollection.Delete(index: integer);
|
|
||||||
begin
|
|
||||||
if (index < 0) or (index >= FList.count) then
|
|
||||||
raise InternalException.Create('TSpkCollection.Delete: Illegal index!');
|
raise InternalException.Create('TSpkCollection.Delete: Illegal index!');
|
||||||
//raise InternalException.Create('TSpkCollection.Delete: Nieprawid³owy indeks!');
|
|
||||||
|
|
||||||
Notify(TComponent(FList[index]), opRemove);
|
Notify(TComponent(FList[AIndex]), opRemove);
|
||||||
FList.Delete(index);
|
FList.Delete(AIndex);
|
||||||
Update;
|
Update;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
destructor TSpkCollection.Destroy;
|
|
||||||
begin
|
|
||||||
FNames.Destroy;
|
|
||||||
FList.Destroy;
|
|
||||||
inherited;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TSpkCollection.Exchange(item1, item2: integer);
|
procedure TSpkCollection.Exchange(item1, item2: integer);
|
||||||
begin
|
begin
|
||||||
FList.Exchange(item1, item2);
|
FList.Exchange(item1, item2);
|
||||||
Update;
|
Update;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TSpkCollection.GetItems(index: integer): TComponent;
|
function TSpkCollection.GetItems(AIndex: integer): TComponent;
|
||||||
begin
|
begin
|
||||||
if (index < 0) or (index >= FList.Count) then
|
if (AIndex < 0) or (AIndex >= FList.Count) then
|
||||||
raise InternalException.Create('TSpkCollection.Delete: Illegal index!');
|
raise InternalException.Create('TSpkCollection.Delete: Illegal index!');
|
||||||
//raise InternalException.create('TSpkCollection.GetItems: Nieprawid³owy indeks!');
|
|
||||||
|
|
||||||
result := TComponent(FList[index]);
|
Result := TComponent(FList[AIndex]);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TSpkCollection.IndexOf(Item: TComponent): integer;
|
function TSpkCollection.IndexOf(Item: TComponent): integer;
|
||||||
@ -162,14 +162,13 @@ begin
|
|||||||
result := FList.IndexOf(Item);
|
result := FList.IndexOf(Item);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSpkCollection.InsertItem(index: integer; AItem: TComponent);
|
procedure TSpkCollection.InsertItem(AIndex: integer; AItem: TComponent);
|
||||||
begin
|
begin
|
||||||
if (index < 0) or (index > FList.Count) then
|
if (AIndex < 0) or (AIndex > FList.Count) then
|
||||||
raise InternalException.Create('TSpkCollection.Delete: Illegal index!');
|
raise InternalException.Create('TSpkCollection.Delete: Illegal index!');
|
||||||
//raise InternalException.Create('TSpkCollection.Insert: Nieprawid³owy indeks!');
|
|
||||||
|
|
||||||
Notify(AItem, opInsert);
|
Notify(AItem, opInsert);
|
||||||
FList.Insert(index, AItem);
|
FList.Insert(AIndex, AItem);
|
||||||
if AItem is TSpkComponent then
|
if AItem is TSpkComponent then
|
||||||
TSpkComponent(AItem).FCollection := self;
|
TSpkComponent(AItem).FCollection := self;
|
||||||
Update;
|
Update;
|
||||||
@ -181,7 +180,6 @@ begin
|
|||||||
(indexTo < 0) or (indexTo >= FList.Count)
|
(indexTo < 0) or (indexTo >= FList.Count)
|
||||||
then
|
then
|
||||||
raise InternalException.Create('TSpkCollection.Delete: Illegal index!');
|
raise InternalException.Create('TSpkCollection.Delete: Illegal index!');
|
||||||
//raise InternalException.Create('TSpkCollection.Move: Nieprawid³owy indeks!');
|
|
||||||
|
|
||||||
FList.Move(IndexFrom, IndexTo);
|
FList.Move(IndexFrom, IndexTo);
|
||||||
Update;
|
Update;
|
||||||
@ -242,7 +240,7 @@ end;
|
|||||||
|
|
||||||
procedure TSpkCollection.Update;
|
procedure TSpkCollection.Update;
|
||||||
begin
|
begin
|
||||||
//
|
//
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSpkCollection.WriteNames(Writer: TWriter);
|
procedure TSpkCollection.WriteNames(Writer: TWriter);
|
||||||
@ -255,16 +253,17 @@ begin
|
|||||||
Writer.WriteListEnd;
|
Writer.WriteListEnd;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
{ TSpkComponent }
|
{ TSpkComponent }
|
||||||
|
|
||||||
function TSpkComponent.GetParentComponent: TComponent;
|
function TSpkComponent.GetParentComponent: TComponent;
|
||||||
begin
|
begin
|
||||||
result := FParent;
|
Result := FParent;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TSpkComponent.HasParent: boolean;
|
function TSpkComponent.HasParent: boolean;
|
||||||
begin
|
begin
|
||||||
result := FParent<>nil;
|
Result := (FParent <> nil);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSpkComponent.SetParentComponent(Value: TComponent);
|
procedure TSpkComponent.SetParentComponent(Value: TComponent);
|
||||||
|
Binary file not shown.
@ -5,11 +5,10 @@ unit spkte_AppearanceEditor;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
LCLIntf, LCLType, LMessages, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
LCLIntf, LCLType, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||||||
Dialogs, ExtCtrls, StdCtrls, ComCtrls, Buttons, Spin,
|
Dialogs, ExtCtrls, StdCtrls, ComCtrls, Buttons, Spin,
|
||||||
SpkGUITools, SpkXMLParser,
|
SpkGUITools, SpkXMLParser, SpkToolbar,
|
||||||
spkt_Buttons, spkt_BaseItem, spkt_Pane, spkt_Types, spkt_Tab, SpkToolbar,
|
spkt_Buttons, spkt_Pane, spkt_Tab, spkt_Appearance;
|
||||||
spkt_Appearance;
|
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user