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,8 +635,6 @@ var
|
|||||||
i: integer;
|
i: integer;
|
||||||
begin
|
begin
|
||||||
inherited;
|
inherited;
|
||||||
|
|
||||||
if FTabs.Count > 0 then
|
|
||||||
for i := 0 to FTabs.Count - 1 do
|
for i := 0 to FTabs.Count - 1 do
|
||||||
Proc(FTabs.Items[i]);
|
Proc(FTabs.Items[i]);
|
||||||
end;
|
end;
|
||||||
@@ -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);
|
||||||
|
@@ -14,13 +14,16 @@ unit spkt_Appearance;
|
|||||||
|
|
||||||
interface
|
interface
|
||||||
|
|
||||||
uses Graphics, Classes, Forms, SysUtils,
|
uses
|
||||||
|
Graphics, Classes, Forms, SysUtils,
|
||||||
SpkGUITools, SpkXMLParser, SpkXMLTools,
|
SpkGUITools, SpkXMLParser, SpkXMLTools,
|
||||||
spkt_Dispatch, spkt_Exceptions, spkt_Const;
|
spkt_Dispatch, spkt_Exceptions, spkt_Const;
|
||||||
|
|
||||||
type
|
type
|
||||||
TSpkPaneStyle = (psRectangleFlat, psRectangleEtched, psRectangleRaised,
|
TSpkPaneStyle = (
|
||||||
psDividerFlat, psDividerEtched, psDividerRaised);
|
psRectangleFlat, psRectangleEtched, psRectangleRaised,
|
||||||
|
psDividerFlat, psDividerEtched, psDividerRaised
|
||||||
|
);
|
||||||
|
|
||||||
TSpkElementStyle = (esRounded, esRectangle);
|
TSpkElementStyle = (esRounded, esRectangle);
|
||||||
|
|
||||||
@@ -30,17 +33,18 @@ type
|
|||||||
spkMetroLight, spkMetroDark
|
spkMetroLight, spkMetroDark
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
{ TSpkTabAppearance }
|
||||||
|
|
||||||
TSpkTabAppearance = class(TPersistent)
|
TSpkTabAppearance = class(TPersistent)
|
||||||
private
|
private
|
||||||
FDispatch: TSpkBaseAppearanceDispatch;
|
FDispatch: TSpkBaseAppearanceDispatch;
|
||||||
protected
|
|
||||||
FTabHeaderFont: TFont;
|
FTabHeaderFont: TFont;
|
||||||
FBorderColor: TColor;
|
FBorderColor: TColor;
|
||||||
FGradientFromColor: TColor;
|
FGradientFromColor: TColor;
|
||||||
FGradientToColor: TColor;
|
FGradientToColor: TColor;
|
||||||
FGradientType: TBackgroundKind;
|
FGradientType: TBackgroundKind;
|
||||||
FInactiveHeaderFontColor: TColor;
|
FInactiveHeaderFontColor: TColor;
|
||||||
|
|
||||||
// Getter & setter methods
|
// Getter & setter methods
|
||||||
procedure SetHeaderFont(const Value: TFont);
|
procedure SetHeaderFont(const Value: TFont);
|
||||||
procedure SetBorderColor(const Value: TColor);
|
procedure SetBorderColor(const Value: TColor);
|
||||||
@@ -53,13 +57,15 @@ type
|
|||||||
// *** Konstruktor, destruktor, assign ***
|
// *** Konstruktor, destruktor, assign ***
|
||||||
// <remarks>Appearance musi mieæ assign, bo wystêpuje jako w³asnoœæ
|
// <remarks>Appearance musi mieæ assign, bo wystêpuje jako w³asnoœæ
|
||||||
// opublikowana.</remarks>
|
// opublikowana.</remarks>
|
||||||
procedure Assign(Source: TPersistent); override;
|
|
||||||
constructor Create(ADispatch: TSpkBaseAppearanceDispatch);
|
constructor Create(ADispatch: TSpkBaseAppearanceDispatch);
|
||||||
|
destructor Destroy; override;
|
||||||
|
procedure Assign(Source: TPersistent); override;
|
||||||
|
|
||||||
|
procedure LoadFromXML(Node: TSpkXMLNode);
|
||||||
procedure SaveToPascal(AList: TStrings);
|
procedure SaveToPascal(AList: TStrings);
|
||||||
procedure SaveToXML(Node: TSpkXMLNode);
|
procedure SaveToXML(Node: TSpkXMLNode);
|
||||||
procedure LoadFromXML(Node: TSpkXMLNode);
|
|
||||||
destructor Destroy; override;
|
|
||||||
procedure Reset(AStyle: TSpkStyle = spkOffice2007Blue);
|
procedure Reset(AStyle: TSpkStyle = spkOffice2007Blue);
|
||||||
|
|
||||||
published
|
published
|
||||||
property TabHeaderFont: TFont read FTabHeaderFont write SetHeaderFont;
|
property TabHeaderFont: TFont read FTabHeaderFont write SetHeaderFont;
|
||||||
property BorderColor: TColor read FBorderColor write SetBorderColor;
|
property BorderColor: TColor read FBorderColor write SetBorderColor;
|
||||||
@@ -69,10 +75,12 @@ type
|
|||||||
property InactiveTabHeaderFontColor: TColor read FInactiveHeaderFontColor write SetInactiveHeaderFontColor;
|
property InactiveTabHeaderFontColor: TColor read FInactiveHeaderFontColor write SetInactiveHeaderFontColor;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
type TSpkPaneAppearance = class(TPersistent)
|
|
||||||
|
{ TSpkPaneAppearance }
|
||||||
|
|
||||||
|
TSpkPaneAppearance = class(TPersistent)
|
||||||
private
|
private
|
||||||
FDispatch: TSpkBaseAppearanceDispatch;
|
FDispatch: TSpkBaseAppearanceDispatch;
|
||||||
protected
|
|
||||||
FCaptionFont: TFont;
|
FCaptionFont: TFont;
|
||||||
FBorderDarkColor: TColor;
|
FBorderDarkColor: TColor;
|
||||||
FBorderLightColor: TColor;
|
FBorderLightColor: TColor;
|
||||||
@@ -91,14 +99,17 @@ type TSpkPaneAppearance = class(TPersistent)
|
|||||||
procedure SetGradientType(const Value: TBackgroundKind);
|
procedure SetGradientType(const Value: TBackgroundKind);
|
||||||
procedure SetHotTrackBrightnessChange(const Value: Integer);
|
procedure SetHotTrackBrightnessChange(const Value: Integer);
|
||||||
procedure SetStyle(const Value: TSpkPaneStyle);
|
procedure SetStyle(const Value: TSpkPaneStyle);
|
||||||
|
|
||||||
public
|
public
|
||||||
constructor Create(ADispatch: TSpkBaseAppearanceDispatch);
|
constructor Create(ADispatch: TSpkBaseAppearanceDispatch);
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
procedure Assign(Source: TPersistent); override;
|
procedure Assign(Source: TPersistent); override;
|
||||||
|
|
||||||
|
procedure LoadFromXML(Node: TSpkXMLNode);
|
||||||
procedure SaveToPascal(AList: TStrings);
|
procedure SaveToPascal(AList: TStrings);
|
||||||
procedure SaveToXML(Node: TSpkXMLNode);
|
procedure SaveToXML(Node: TSpkXMLNode);
|
||||||
procedure LoadFromXML(Node: TSpkXMLNode);
|
|
||||||
procedure Reset(AStyle: TSpkStyle = spkOffice2007Blue);
|
procedure Reset(AStyle: TSpkStyle = spkOffice2007Blue);
|
||||||
|
|
||||||
published
|
published
|
||||||
property BorderDarkColor: TColor read FBorderDarkColor write SetBorderDarkColor;
|
property BorderDarkColor: TColor read FBorderDarkColor write SetBorderDarkColor;
|
||||||
property BorderLightColor: TColor read FBorderLightColor write SetBorderLightColor;
|
property BorderLightColor: TColor read FBorderLightColor write SetBorderLightColor;
|
||||||
@@ -111,6 +122,8 @@ type TSpkPaneAppearance = class(TPersistent)
|
|||||||
property Style: TSpkPaneStyle read FStyle write SetStyle default psRectangleEtched;
|
property Style: TSpkPaneStyle read FStyle write SetStyle default psRectangleEtched;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
{ TSpkElementAppearance }
|
||||||
TSpkElementAppearance = class(TPersistent)
|
TSpkElementAppearance = class(TPersistent)
|
||||||
private
|
private
|
||||||
FDispatch: TSpkBaseAppearanceDispatch;
|
FDispatch: TSpkBaseAppearanceDispatch;
|
||||||
@@ -162,14 +175,17 @@ type TSpkPaneAppearance = class(TPersistent)
|
|||||||
procedure SetIdleInnerDarkColor(const Value: TColor);
|
procedure SetIdleInnerDarkColor(const Value: TColor);
|
||||||
procedure SetIdleInnerLightColor(const Value: TColor);
|
procedure SetIdleInnerLightColor(const Value: TColor);
|
||||||
procedure SetStyle(const Value: TSpkElementStyle);
|
procedure SetStyle(const Value: TSpkElementStyle);
|
||||||
|
|
||||||
public
|
public
|
||||||
constructor Create(ADispatch: TSpkBaseAppearanceDispatch);
|
constructor Create(ADispatch: TSpkBaseAppearanceDispatch);
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
procedure Assign(Source: TPersistent); override;
|
procedure Assign(Source: TPersistent); override;
|
||||||
|
|
||||||
|
procedure LoadFromXML(Node: TSpkXMLNode);
|
||||||
procedure SaveToPascal(AList: TStrings);
|
procedure SaveToPascal(AList: TStrings);
|
||||||
procedure SaveToXML(Node: TSpkXMLNode);
|
procedure SaveToXML(Node: TSpkXMLNode);
|
||||||
procedure LoadFromXML(Node: TSpkXMLNode);
|
|
||||||
procedure Reset(AStyle: TSpkStyle = spkOffice2007Blue);
|
procedure Reset(AStyle: TSpkStyle = spkOffice2007Blue);
|
||||||
|
|
||||||
published
|
published
|
||||||
property CaptionFont: TFont read FCaptionFont write SetCaptionFont;
|
property CaptionFont: TFont read FCaptionFont write SetCaptionFont;
|
||||||
property IdleFrameColor: TColor read FIdleFrameColor write SetIdleFrameColor;
|
property IdleFrameColor: TColor read FIdleFrameColor write SetIdleFrameColor;
|
||||||
@@ -197,12 +213,14 @@ type TSpkPaneAppearance = class(TPersistent)
|
|||||||
property Style: TSpkElementStyle read FStyle write SetStyle;
|
property Style: TSpkElementStyle read FStyle write SetStyle;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
type TSpkToolbarAppearance = class;
|
|
||||||
|
{ TSpkToolbarAppearance }
|
||||||
|
|
||||||
|
TSpkToolbarAppearance = class;
|
||||||
|
|
||||||
TSpkToolbarAppearanceDispatch = class(TSpkBaseAppearanceDispatch)
|
TSpkToolbarAppearanceDispatch = class(TSpkBaseAppearanceDispatch)
|
||||||
private
|
private
|
||||||
FToolbarAppearance: TSpkToolbarAppearance;
|
FToolbarAppearance: TSpkToolbarAppearance;
|
||||||
protected
|
|
||||||
public
|
public
|
||||||
constructor Create(AToolbarAppearance: TSpkToolbarAppearance);
|
constructor Create(AToolbarAppearance: TSpkToolbarAppearance);
|
||||||
procedure NotifyAppearanceChanged; override;
|
procedure NotifyAppearanceChanged; override;
|
||||||
@@ -218,8 +236,6 @@ type TSpkToolbarAppearance = class;
|
|||||||
procedure SetElementAppearance(const Value: TSpkElementAppearance);
|
procedure SetElementAppearance(const Value: TSpkElementAppearance);
|
||||||
procedure SetPaneAppearance(const Value: TSpkPaneAppearance);
|
procedure SetPaneAppearance(const Value: TSpkPaneAppearance);
|
||||||
procedure SetTabAppearance(const Value: TSpkTabAppearance);
|
procedure SetTabAppearance(const Value: TSpkTabAppearance);
|
||||||
protected
|
|
||||||
//
|
|
||||||
public
|
public
|
||||||
constructor Create(ADispatch: TSpkBaseAppearanceDispatch); reintroduce;
|
constructor Create(ADispatch: TSpkBaseAppearanceDispatch); reintroduce;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
@@ -263,6 +279,20 @@ end;
|
|||||||
|
|
||||||
{ TSpkBaseToolbarAppearance }
|
{ TSpkBaseToolbarAppearance }
|
||||||
|
|
||||||
|
constructor TSpkTabAppearance.Create(ADispatch: TSpkBaseAppearanceDispatch);
|
||||||
|
begin
|
||||||
|
inherited Create;
|
||||||
|
FDispatch := ADispatch;
|
||||||
|
FTabHeaderFont := TFont.Create;
|
||||||
|
Reset;
|
||||||
|
end;
|
||||||
|
|
||||||
|
destructor TSpkTabAppearance.Destroy;
|
||||||
|
begin
|
||||||
|
FTabHeaderFont.Free;
|
||||||
|
inherited;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TSpkTabAppearance.Assign(Source: TPersistent);
|
procedure TSpkTabAppearance.Assign(Source: TPersistent);
|
||||||
var
|
var
|
||||||
SrcAppearance: TSpkTabAppearance;
|
SrcAppearance: TSpkTabAppearance;
|
||||||
@@ -280,31 +310,14 @@ begin
|
|||||||
if FDispatch <> nil then
|
if FDispatch <> nil then
|
||||||
FDispatch.NotifyAppearanceChanged;
|
FDispatch.NotifyAppearanceChanged;
|
||||||
end else
|
end else
|
||||||
raise AssignException.create('TSpkToolbarAppearance.Assign: Nie mogê przypisaæ obiektu '+Source.ClassName+' do TSpkToolbarAppearance!');
|
raise AssignException.Create('TSpkToolbarAppearance.Assign: Nie mogê przypisaæ obiektu '+Source.ClassName+' do TSpkToolbarAppearance!');
|
||||||
end;
|
|
||||||
|
|
||||||
constructor TSpkTabAppearance.Create(
|
|
||||||
ADispatch: TSpkBaseAppearanceDispatch);
|
|
||||||
begin
|
|
||||||
inherited Create;
|
|
||||||
FDispatch:=ADispatch;
|
|
||||||
|
|
||||||
FTabHeaderFont:=TFont.Create;
|
|
||||||
|
|
||||||
Reset;
|
|
||||||
end;
|
|
||||||
|
|
||||||
destructor TSpkTabAppearance.Destroy;
|
|
||||||
begin
|
|
||||||
FTabHeaderFont.Free;
|
|
||||||
inherited;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSpkTabAppearance.LoadFromXML(Node: TSpkXMLNode);
|
procedure TSpkTabAppearance.LoadFromXML(Node: TSpkXMLNode);
|
||||||
var
|
var
|
||||||
Subnode: TSpkXMLNode;
|
Subnode: TSpkXMLNode;
|
||||||
begin
|
begin
|
||||||
if not(assigned(Node)) then
|
if not Assigned(Node) then
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
Subnode := Node['TabHeaderFont',false];
|
Subnode := Node['TabHeaderFont',false];
|
||||||
@@ -312,19 +325,19 @@ begin
|
|||||||
TSpkXMLTools.Load(Subnode, FTabHeaderFont);
|
TSpkXMLTools.Load(Subnode, FTabHeaderFont);
|
||||||
|
|
||||||
Subnode := Node['BorderColor',false];
|
Subnode := Node['BorderColor',false];
|
||||||
if assigned(Subnode) then
|
if Assigned(Subnode) then
|
||||||
FBorderColor := Subnode.TextAsColor;
|
FBorderColor := Subnode.TextAsColor;
|
||||||
|
|
||||||
Subnode := Node['GradientFromColor',false];
|
Subnode := Node['GradientFromColor',false];
|
||||||
if assigned(Subnode) then
|
if Assigned(Subnode) then
|
||||||
FGradientFromColor := Subnode.TextAsColor;
|
FGradientFromColor := Subnode.TextAsColor;
|
||||||
|
|
||||||
Subnode := Node['GradientToColor',false];
|
Subnode := Node['GradientToColor',false];
|
||||||
if assigned(Subnode) then
|
if Assigned(Subnode) then
|
||||||
FGradientToColor := Subnode.TextAsColor;
|
FGradientToColor := Subnode.TextAsColor;
|
||||||
|
|
||||||
Subnode := Node['GradientType',false];
|
Subnode := Node['GradientType',false];
|
||||||
if assigned(Subnode) then
|
if Assigned(Subnode) then
|
||||||
FGradientType := TBackgroundKind(Subnode.TextAsInteger);
|
FGradientType := TBackgroundKind(Subnode.TextAsInteger);
|
||||||
|
|
||||||
Subnode := Node['InactiveTabHeaderFontColor', false];
|
Subnode := Node['InactiveTabHeaderFontColor', false];
|
||||||
@@ -453,7 +466,7 @@ end;
|
|||||||
|
|
||||||
procedure TSpkTabAppearance.SetHeaderFont(const Value: TFont);
|
procedure TSpkTabAppearance.SetHeaderFont(const Value: TFont);
|
||||||
begin
|
begin
|
||||||
FTabHeaderFont.assign(Value);
|
FTabHeaderFont.Assign(Value);
|
||||||
if FDispatch <> nil then
|
if FDispatch <> nil then
|
||||||
FDispatch.NotifyAppearanceChanged;
|
FDispatch.NotifyAppearanceChanged;
|
||||||
end;
|
end;
|
||||||
@@ -466,9 +479,24 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{ TSpkPaneAppearance }
|
{ TSpkPaneAppearance }
|
||||||
|
|
||||||
|
constructor TSpkPaneAppearance.Create(ADispatch: TSpkBaseAppearanceDispatch);
|
||||||
|
begin
|
||||||
|
inherited Create;
|
||||||
|
FDispatch := ADispatch;
|
||||||
|
FCaptionFont := TFont.Create;
|
||||||
|
FHotTrackBrightnessChange := 20;
|
||||||
|
FStyle := psRectangleEtched;
|
||||||
|
Reset;
|
||||||
|
end;
|
||||||
|
|
||||||
|
destructor TSpkPaneAppearance.Destroy;
|
||||||
|
begin
|
||||||
|
FCaptionFont.Free;
|
||||||
|
inherited Destroy;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TSpkPaneAppearance.Assign(Source: TPersistent);
|
procedure TSpkPaneAppearance.Assign(Source: TPersistent);
|
||||||
var
|
var
|
||||||
SrcAppearance: TSpkPaneAppearance;
|
SrcAppearance: TSpkPaneAppearance;
|
||||||
@@ -493,22 +521,6 @@ begin
|
|||||||
raise AssignException.create('TSpkPaneAppearance.Assign: Nie mogê przypisaæ obiektu '+Source.ClassName+' do TSpkPaneAppearance!');
|
raise AssignException.create('TSpkPaneAppearance.Assign: Nie mogê przypisaæ obiektu '+Source.ClassName+' do TSpkPaneAppearance!');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
constructor TSpkPaneAppearance.Create(ADispatch: TSpkBaseAppearanceDispatch);
|
|
||||||
begin
|
|
||||||
inherited Create;
|
|
||||||
FDispatch := ADispatch;
|
|
||||||
FCaptionFont := TFont.Create;
|
|
||||||
FHotTrackBrightnessChange := 20;
|
|
||||||
FStyle := psRectangleEtched;
|
|
||||||
Reset;
|
|
||||||
end;
|
|
||||||
|
|
||||||
destructor TSpkPaneAppearance.Destroy;
|
|
||||||
begin
|
|
||||||
FCaptionFont.Free;
|
|
||||||
inherited Destroy;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TSpkPaneAppearance.LoadFromXML(Node: TSpkXMLNode);
|
procedure TSpkPaneAppearance.LoadFromXML(Node: TSpkXMLNode);
|
||||||
var
|
var
|
||||||
Subnode: TSpkXMLNode;
|
Subnode: TSpkXMLNode;
|
||||||
@@ -735,6 +747,21 @@ end;
|
|||||||
|
|
||||||
{ TSpkElementAppearance }
|
{ TSpkElementAppearance }
|
||||||
|
|
||||||
|
constructor TSpkElementAppearance.Create(ADispatch: TSpkBaseAppearanceDispatch);
|
||||||
|
begin
|
||||||
|
inherited Create;
|
||||||
|
FDispatch := ADispatch;
|
||||||
|
FCaptionFont := TFont.Create;
|
||||||
|
FHotTrackBrightnessChange := 40;
|
||||||
|
Reset;
|
||||||
|
end;
|
||||||
|
|
||||||
|
destructor TSpkElementAppearance.Destroy;
|
||||||
|
begin
|
||||||
|
FCaptionFont.Free;
|
||||||
|
inherited Destroy;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TSpkElementAppearance.Assign(Source: TPersistent);
|
procedure TSpkElementAppearance.Assign(Source: TPersistent);
|
||||||
var
|
var
|
||||||
SrcAppearance: TSpkElementAppearance;
|
SrcAppearance: TSpkElementAppearance;
|
||||||
@@ -774,21 +801,6 @@ begin
|
|||||||
raise AssignException.create('TSpkElementAppearance.Assign: Nie mogê przypisaæ obiektu '+Source.ClassName+' do TSpkElementAppearance!');
|
raise AssignException.create('TSpkElementAppearance.Assign: Nie mogê przypisaæ obiektu '+Source.ClassName+' do TSpkElementAppearance!');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
constructor TSpkElementAppearance.Create(ADispatch: TSpkBaseAppearanceDispatch);
|
|
||||||
begin
|
|
||||||
inherited Create;
|
|
||||||
FDispatch := ADispatch;
|
|
||||||
FCaptionFont := TFont.Create;
|
|
||||||
FHotTrackBrightnessChange := 40;
|
|
||||||
Reset;
|
|
||||||
end;
|
|
||||||
|
|
||||||
destructor TSpkElementAppearance.Destroy;
|
|
||||||
begin
|
|
||||||
FCaptionFont.Free;
|
|
||||||
inherited Destroy;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TSpkElementAppearance.LoadFromXML(Node: TSpkXMLNode);
|
procedure TSpkElementAppearance.LoadFromXML(Node: TSpkXMLNode);
|
||||||
var
|
var
|
||||||
Subnode: TSpkXMLNode;
|
Subnode: TSpkXMLNode;
|
||||||
@@ -1323,6 +1335,7 @@ begin
|
|||||||
FDispatch.NotifyAppearanceChanged;
|
FDispatch.NotifyAppearanceChanged;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
{ TSpkToolbarAppearanceDispatch }
|
{ TSpkToolbarAppearanceDispatch }
|
||||||
|
|
||||||
constructor TSpkToolbarAppearanceDispatch.Create(
|
constructor TSpkToolbarAppearanceDispatch.Create(
|
||||||
@@ -1338,26 +1351,9 @@ if FToolbarAppearance<>nil then
|
|||||||
FToolbarAppearance.NotifyAppearanceChanged;
|
FToolbarAppearance.NotifyAppearanceChanged;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
{ TSpkToolbarAppearance }
|
{ TSpkToolbarAppearance }
|
||||||
|
|
||||||
procedure TSpkToolbarAppearance.Assign(Source: TPersistent);
|
|
||||||
var
|
|
||||||
Src: TSpkToolbarAppearance;
|
|
||||||
begin
|
|
||||||
if Source is TSpkToolbarAppearance then
|
|
||||||
begin
|
|
||||||
Src := TSpkToolbarAppearance(Source);
|
|
||||||
|
|
||||||
self.FTab.Assign(Src.Tab);
|
|
||||||
self.FPane.Assign(Src.Pane);
|
|
||||||
self.FElement.Assign(Src.Element);
|
|
||||||
|
|
||||||
if FDispatch <> nil then
|
|
||||||
FDispatch.NotifyAppearanceChanged;
|
|
||||||
end else
|
|
||||||
raise AssignException.create('TSpkToolbarAppearance.Assign: Nie mogê przypisaæ obiektu '+Source.ClassName+' do TSpkToolbarAppearance!');
|
|
||||||
end;
|
|
||||||
|
|
||||||
constructor TSpkToolbarAppearance.Create(ADispatch : TSpkBaseAppearanceDispatch);
|
constructor TSpkToolbarAppearance.Create(ADispatch : TSpkBaseAppearanceDispatch);
|
||||||
begin
|
begin
|
||||||
inherited Create;
|
inherited Create;
|
||||||
@@ -1377,34 +1373,51 @@ begin
|
|||||||
inherited;
|
inherited;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TSpkToolbarAppearance.Assign(Source: TPersistent);
|
||||||
|
var
|
||||||
|
Src: TSpkToolbarAppearance;
|
||||||
|
begin
|
||||||
|
if Source is TSpkToolbarAppearance then
|
||||||
|
begin
|
||||||
|
Src := TSpkToolbarAppearance(Source);
|
||||||
|
|
||||||
|
self.FTab.Assign(Src.Tab);
|
||||||
|
self.FPane.Assign(Src.Pane);
|
||||||
|
self.FElement.Assign(Src.Element);
|
||||||
|
|
||||||
|
if FDispatch <> nil then
|
||||||
|
FDispatch.NotifyAppearanceChanged;
|
||||||
|
end else
|
||||||
|
raise AssignException.create('TSpkToolbarAppearance.Assign: Nie mogê przypisaæ obiektu '+Source.ClassName+' do TSpkToolbarAppearance!');
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TSpkToolbarAppearance.LoadFromXML(Node: TSpkXMLNode);
|
procedure TSpkToolbarAppearance.LoadFromXML(Node: TSpkXMLNode);
|
||||||
|
var
|
||||||
var Subnode : TSpkXMLNode;
|
Subnode: TSpkXMLNode;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
Tab.Reset;
|
Tab.Reset;
|
||||||
Pane.Reset;
|
Pane.Reset;
|
||||||
Element.Reset;
|
Element.Reset;
|
||||||
|
|
||||||
if not(assigned(Node)) then
|
if not Assigned(Node) then
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
Subnode := Node['Tab', false];
|
Subnode := Node['Tab', false];
|
||||||
if assigned(Subnode) then
|
if Assigned(Subnode) then
|
||||||
Tab.LoadFromXML(Subnode);
|
Tab.LoadFromXML(Subnode);
|
||||||
|
|
||||||
Subnode := Node['Pane', false];
|
Subnode := Node['Pane', false];
|
||||||
if assigned(Subnode) then
|
if Assigned(Subnode) then
|
||||||
Pane.LoadFromXML(Subnode);
|
Pane.LoadFromXML(Subnode);
|
||||||
|
|
||||||
Subnode := Node['Element', false];
|
Subnode := Node['Element', false];
|
||||||
if assigned(Subnode) then
|
if Assigned(Subnode) then
|
||||||
Element.LoadFromXML(Subnode);
|
Element.LoadFromXML(Subnode);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSpkToolbarAppearance.NotifyAppearanceChanged;
|
procedure TSpkToolbarAppearance.NotifyAppearanceChanged;
|
||||||
begin
|
begin
|
||||||
if assigned(FDispatch) then
|
if Assigned(FDispatch) then
|
||||||
FDispatch.NotifyAppearanceChanged;
|
FDispatch.NotifyAppearanceChanged;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@@ -1423,7 +1436,7 @@ begin
|
|||||||
FTab.SaveToPascal(AList);
|
FTab.SaveToPascal(AList);
|
||||||
FPane.SaveToPascal(AList);
|
FPane.SaveToPascal(AList);
|
||||||
FElement.SaveToPascal(AList);
|
FElement.SaveToPascal(AList);
|
||||||
AList.ADd('end;');
|
AList.Add('end;');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSpkToolbarAppearance.SaveToXML(Node: TSpkXMLNode);
|
procedure TSpkToolbarAppearance.SaveToXML(Node: TSpkXMLNode);
|
||||||
|
@@ -15,11 +15,15 @@ unit spkt_BaseItem;
|
|||||||
|
|
||||||
interface
|
interface
|
||||||
|
|
||||||
uses Graphics, Classes, Controls,
|
uses
|
||||||
|
Graphics, Classes, Controls,
|
||||||
SpkMath, spkt_Appearance, spkt_Dispatch, spkt_Types;
|
SpkMath, spkt_Appearance, spkt_Dispatch, spkt_Types;
|
||||||
|
|
||||||
type TSpkItemSize = (isLarge, isNormal);
|
type
|
||||||
|
TSpkItemSize = (isLarge, isNormal);
|
||||||
|
|
||||||
TSpkItemTableBehaviour = (tbBeginsRow, tbBeginsColumn, tbContinuesRow);
|
TSpkItemTableBehaviour = (tbBeginsRow, tbBeginsColumn, tbContinuesRow);
|
||||||
|
|
||||||
TSpkItemGroupBehaviour = (gbSingleItem, gbBeginsGroup, gbContinuesGroup, gbEndsGroup);
|
TSpkItemGroupBehaviour = (gbSingleItem, gbBeginsGroup, gbContinuesGroup, gbEndsGroup);
|
||||||
|
|
||||||
TSpkBaseItem = class abstract(TSpkComponent)
|
TSpkBaseItem = class abstract(TSpkComponent)
|
||||||
@@ -43,6 +47,7 @@ type TSpkItemSize = (isLarge, isNormal);
|
|||||||
procedure SetLargeImages(const Value: TImageList); virtual;
|
procedure SetLargeImages(const Value: TImageList); virtual;
|
||||||
procedure SetDisabledLargeImages(const Value: TImageList); virtual;
|
procedure SetDisabledLargeImages(const Value: TImageList); virtual;
|
||||||
procedure SetAppearance(const Value: TSpkToolbarAppearance);
|
procedure SetAppearance(const Value: TSpkToolbarAppearance);
|
||||||
|
|
||||||
public
|
public
|
||||||
constructor Create(AOwner: TComponent); override;
|
constructor Create(AOwner: TComponent); override;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
@@ -58,6 +63,7 @@ type TSpkItemSize = (isLarge, isNormal);
|
|||||||
function GetTableBehaviour: TSpkItemTableBehaviour; virtual; abstract;
|
function GetTableBehaviour: TSpkItemTableBehaviour; virtual; abstract;
|
||||||
function GetGroupBehaviour: TSpkItemGroupBehaviour; virtual; abstract;
|
function GetGroupBehaviour: TSpkItemGroupBehaviour; virtual; abstract;
|
||||||
function GetSize: TSpkItemSize; virtual; abstract;
|
function GetSize: TSpkItemSize; virtual; abstract;
|
||||||
|
|
||||||
procedure Draw(ABuffer: TBitmap; ClipRect: T2DIntRect); virtual; abstract;
|
procedure Draw(ABuffer: TBitmap; ClipRect: T2DIntRect); virtual; abstract;
|
||||||
|
|
||||||
property ToolbarDispatch: TSpkBaseToolbarDispatch read FToolbarDispatch write FToolbarDispatch;
|
property ToolbarDispatch: TSpkBaseToolbarDispatch read FToolbarDispatch write FToolbarDispatch;
|
||||||
@@ -66,14 +72,15 @@ type TSpkItemSize = (isLarge, isNormal);
|
|||||||
property DisabledImages: TImageList read FDisabledImages write SetDisabledImages;
|
property DisabledImages: TImageList read FDisabledImages write SetDisabledImages;
|
||||||
property LargeImages: TImageList read FLargeImages write SetLargeImages;
|
property LargeImages: TImageList read FLargeImages write SetLargeImages;
|
||||||
property DisabledLargeImages: TImageList read FDisabledLargeImages write SetDisabledLargeImages;
|
property DisabledLargeImages: TImageList read FDisabledLargeImages write SetDisabledLargeImages;
|
||||||
|
|
||||||
property Rect: T2DIntRect read FRect write SetRect;
|
property Rect: T2DIntRect read FRect write SetRect;
|
||||||
|
|
||||||
published
|
published
|
||||||
property Visible: boolean read FVisible write SetVisible;
|
property Visible: boolean read FVisible write SetVisible;
|
||||||
property Enabled: boolean read FEnabled write SetEnabled;
|
property Enabled: boolean read FEnabled write SetEnabled;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
type TSpkBaseItemClass = class of TSpkBaseItem;
|
TSpkBaseItemClass = class of TSpkBaseItem;
|
||||||
|
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
@@ -84,9 +91,9 @@ 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;
|
||||||
@@ -108,8 +115,7 @@ 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;
|
||||||
|
|
||||||
|
@@ -21,19 +21,22 @@ uses
|
|||||||
SpkGUITools, SpkGraphTools, SpkMath,
|
SpkGUITools, SpkGraphTools, SpkMath,
|
||||||
spkt_Const, spkt_BaseItem, spkt_Exceptions, spkt_Tools;
|
spkt_Const, spkt_BaseItem, spkt_Exceptions, spkt_Tools;
|
||||||
|
|
||||||
type TSpkButtonState = (bsIdle,
|
type
|
||||||
|
TSpkButtonState = (
|
||||||
|
bsIdle,
|
||||||
bsBtnHottrack, bsBtnPressed,
|
bsBtnHottrack, bsBtnPressed,
|
||||||
bsDropdownHottrack, bsDropdownPressed);
|
bsDropdownHottrack, bsDropdownPressed
|
||||||
|
);
|
||||||
|
|
||||||
TSpkMouseButtonElement = (beNone, beButton, beDropdown);
|
TSpkMouseButtonElement = (beNone, beButton, beDropdown);
|
||||||
|
|
||||||
TSpkButtonKind = (bkButton, bkButtonDropdown, bkDropdown);
|
TSpkButtonKind = (bkButton, bkButtonDropdown, bkDropdown);
|
||||||
|
|
||||||
type TSpkBaseButton = class;
|
TSpkBaseButton = class;
|
||||||
|
|
||||||
TSpkButtonActionLink = class(TActionLink)
|
TSpkButtonActionLink = class(TActionLink)
|
||||||
private
|
|
||||||
protected
|
protected
|
||||||
FClient: TSpkBaseButton;
|
FClient: TSpkBaseButton;
|
||||||
|
|
||||||
procedure AssignClient(AClient: TObject); override;
|
procedure AssignClient(AClient: TObject); override;
|
||||||
function IsOnExecuteLinked: Boolean; override;
|
function IsOnExecuteLinked: Boolean; override;
|
||||||
procedure SetCaption(const Value: string); override;
|
procedure SetCaption(const Value: string); override;
|
||||||
@@ -55,44 +58,39 @@ type TSpkBaseButton = class;
|
|||||||
private
|
private
|
||||||
FMouseHoverElement: TSpkMouseButtonElement;
|
FMouseHoverElement: TSpkMouseButtonElement;
|
||||||
FMouseActiveElement: TSpkMouseButtonElement;
|
FMouseActiveElement: TSpkMouseButtonElement;
|
||||||
|
|
||||||
|
// Getters and Setters
|
||||||
|
function GetAction: TBasicAction;
|
||||||
|
procedure SetCaption(const Value: string);
|
||||||
|
procedure SetButtonKind(const Value: TSpkButtonKind);
|
||||||
|
procedure SetDropdownMenu(const Value: TPopupMenu);
|
||||||
|
|
||||||
protected
|
protected
|
||||||
FCaption: string;
|
FCaption: string;
|
||||||
FOnClick: TNotifyEvent;
|
FOnClick: TNotifyEvent;
|
||||||
|
|
||||||
FActionLink: TSpkButtonActionLink;
|
FActionLink: TSpkButtonActionLink;
|
||||||
|
|
||||||
FButtonState: TSpkButtonState;
|
FButtonState: TSpkButtonState;
|
||||||
|
|
||||||
FButtonRect: T2DIntRect;
|
FButtonRect: T2DIntRect;
|
||||||
FDropdownRect: T2DIntRect;
|
FDropdownRect: T2DIntRect;
|
||||||
|
|
||||||
FButtonKind: TSpkButtonKind;
|
FButtonKind: TSpkButtonKind;
|
||||||
FDropdownMenu: TPopupMenu;
|
FDropdownMenu: TPopupMenu;
|
||||||
|
|
||||||
// *** Obs³uga rysowania ***
|
// *** Obs³uga rysowania ***
|
||||||
|
|
||||||
/// <summary>Zadaniem metody w odziedziczonych klasach jest obliczenie
|
/// <summary>Zadaniem metody w odziedziczonych klasach jest obliczenie
|
||||||
/// rectów przycisku i menu dropdown w zale¿noœci od FButtonState</summary>
|
/// rectów przycisku i menu dropdown w zale¿noœci od FButtonState</summary>
|
||||||
procedure CalcRects; virtual; abstract;
|
procedure CalcRects; virtual; abstract;
|
||||||
|
|
||||||
function GetDropdownPoint: T2DIntPoint; virtual; abstract;
|
function GetDropdownPoint: T2DIntPoint; virtual; abstract;
|
||||||
|
|
||||||
// *** Obs³uga akcji ***
|
// *** Obs³uga akcji ***
|
||||||
|
|
||||||
procedure ActionChange(Sender: TObject; CheckDefaults: Boolean); virtual;
|
procedure ActionChange(Sender: TObject; CheckDefaults: Boolean); virtual;
|
||||||
procedure DoActionChange(Sender: TObject);
|
|
||||||
procedure Click; virtual;
|
procedure Click; virtual;
|
||||||
|
procedure DoActionChange(Sender: TObject);
|
||||||
function GetDefaultCaption: String; virtual;
|
function GetDefaultCaption: String; virtual;
|
||||||
|
|
||||||
// *** Gettery i settery ***
|
// Getters and Setters
|
||||||
|
|
||||||
procedure SetEnabled(const Value: boolean); override;
|
procedure SetEnabled(const Value: boolean); override;
|
||||||
procedure SetDropdownMenu(const Value : TPopupMenu);
|
|
||||||
procedure SetRect(const Value: T2DIntRect); override;
|
procedure SetRect(const Value: T2DIntRect); override;
|
||||||
procedure SetCaption(const Value : string);
|
|
||||||
procedure SetAction(const Value: TBasicAction); virtual;
|
procedure SetAction(const Value: TBasicAction); virtual;
|
||||||
procedure SetButtonKind(const Value : TSpkButtonKind);
|
|
||||||
function GetAction: TBasicAction;
|
|
||||||
|
|
||||||
property ButtonKind: TSpkButtonKind read FButtonKind write SetButtonKind;
|
property ButtonKind: TSpkButtonKind read FButtonKind write SetButtonKind;
|
||||||
property DropdownMenu: TPopupMenu read FDropdownMenu write SetDropdownMenu;
|
property DropdownMenu: TPopupMenu read FDropdownMenu write SetDropdownMenu;
|
||||||
@@ -111,8 +109,8 @@ type TSpkBaseButton = class;
|
|||||||
function GetRootComponent: TComponent;
|
function GetRootComponent: TComponent;
|
||||||
|
|
||||||
published
|
published
|
||||||
property Caption : string read FCaption write SetCaption;
|
|
||||||
property Action: TBasicAction read GetAction write SetAction;
|
property Action: TBasicAction read GetAction write SetAction;
|
||||||
|
property Caption: string read FCaption write SetCaption;
|
||||||
property OnClick: TNotifyEvent read FOnClick write FOnClick;
|
property OnClick: TNotifyEvent read FOnClick write FOnClick;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@@ -130,10 +128,10 @@ type TSpkBaseButton = class;
|
|||||||
public
|
public
|
||||||
constructor Create(AOwner: TComponent); override;
|
constructor Create(AOwner: TComponent); override;
|
||||||
procedure Draw(ABuffer: TBitmap; ClipRect: T2DIntRect); override;
|
procedure Draw(ABuffer: TBitmap; ClipRect: T2DIntRect); override;
|
||||||
function GetWidth: integer; override;
|
|
||||||
function GetTableBehaviour: TSpkItemTableBehaviour; override;
|
|
||||||
function GetGroupBehaviour: TSpkItemGroupBehaviour; override;
|
function GetGroupBehaviour: TSpkItemGroupBehaviour; override;
|
||||||
function GetSize: TSpkItemSize; override;
|
function GetSize: TSpkItemSize; override;
|
||||||
|
function GetTableBehaviour: TSpkItemTableBehaviour; override;
|
||||||
|
function GetWidth: integer; override;
|
||||||
published
|
published
|
||||||
property LargeImageIndex: TImageIndex read FLargeImageIndex write SetLargeImageIndex default -1;
|
property LargeImageIndex: TImageIndex read FLargeImageIndex write SetLargeImageIndex default -1;
|
||||||
property ButtonKind;
|
property ButtonKind;
|
||||||
@@ -151,31 +149,32 @@ type TSpkBaseButton = class;
|
|||||||
FHideFrameWhenIdle: boolean;
|
FHideFrameWhenIdle: boolean;
|
||||||
FShowCaption: boolean;
|
FShowCaption: boolean;
|
||||||
procedure ConstructRects(out BtnRect, DropRect: T2DIntRect);
|
procedure ConstructRects(out BtnRect, DropRect: T2DIntRect);
|
||||||
procedure SetImageIndex(const Value: TImageIndex);
|
|
||||||
procedure SetGroupBehaviour(const Value: TSpkItemGroupBehaviour);
|
procedure SetGroupBehaviour(const Value: TSpkItemGroupBehaviour);
|
||||||
procedure SetHideFrameWhenIdle(const Value: boolean);
|
procedure SetHideFrameWhenIdle(const Value: boolean);
|
||||||
procedure SetTableBehaviour(const Value: TSpkItemTableBehaviour);
|
procedure SetImageIndex(const Value: TImageIndex);
|
||||||
procedure SetShowCaption(const Value: boolean);
|
procedure SetShowCaption(const Value: boolean);
|
||||||
|
procedure SetTableBehaviour(const Value: TSpkItemTableBehaviour);
|
||||||
protected
|
protected
|
||||||
procedure CalcRects; override;
|
procedure CalcRects; override;
|
||||||
function GetDropdownPoint: T2DIntPoint; override;
|
function GetDropdownPoint: T2DIntPoint; override;
|
||||||
public
|
public
|
||||||
constructor Create(AOwner: TComponent); override;
|
constructor Create(AOwner: TComponent); override;
|
||||||
procedure Draw(ABuffer: TBitmap; ClipRect: T2DIntRect); override;
|
procedure Draw(ABuffer: TBitmap; ClipRect: T2DIntRect); override;
|
||||||
function GetWidth: integer; override;
|
|
||||||
function GetTableBehaviour: TSpkItemTableBehaviour; override;
|
|
||||||
function GetGroupBehaviour: TSpkItemGroupBehaviour; override;
|
function GetGroupBehaviour: TSpkItemGroupBehaviour; override;
|
||||||
function GetSize: TSpkItemSize; override;
|
function GetSize: TSpkItemSize; override;
|
||||||
|
function GetTableBehaviour: TSpkItemTableBehaviour; override;
|
||||||
|
function GetWidth: integer; override;
|
||||||
published
|
published
|
||||||
property ShowCaption: boolean read FShowCaption write SetShowCaption;
|
|
||||||
property TableBehaviour: TSpkItemTableBehaviour read FTableBehaviour write SetTableBehaviour;
|
|
||||||
property GroupBehaviour: TSpkItemGroupBehaviour read FGroupBehaviour write SetGroupBehaviour;
|
property GroupBehaviour: TSpkItemGroupBehaviour read FGroupBehaviour write SetGroupBehaviour;
|
||||||
property HideFrameWhenIdle: boolean read FHideFrameWhenIdle write SetHideFrameWhenIdle;
|
property HideFrameWhenIdle: boolean read FHideFrameWhenIdle write SetHideFrameWhenIdle;
|
||||||
property ImageIndex: TImageIndex read FImageIndex write SetImageIndex default -1;
|
property ImageIndex: TImageIndex read FImageIndex write SetImageIndex default -1;
|
||||||
|
property ShowCaption: boolean read FShowCaption write SetShowCaption;
|
||||||
|
property TableBehaviour: TSpkItemTableBehaviour read FTableBehaviour write SetTableBehaviour;
|
||||||
property ButtonKind;
|
property ButtonKind;
|
||||||
property DropdownMenu;
|
property DropdownMenu;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
uses
|
uses
|
||||||
@@ -191,15 +190,13 @@ end;
|
|||||||
|
|
||||||
function TSpkButtonActionLink.IsCaptionLinked: Boolean;
|
function TSpkButtonActionLink.IsCaptionLinked: Boolean;
|
||||||
begin
|
begin
|
||||||
Result := inherited IsCaptionLinked and
|
Result := inherited IsCaptionLinked and Assigned(FClient) and
|
||||||
Assigned(FClient) and
|
|
||||||
(FClient.Caption = (Action as TCustomAction).Caption);
|
(FClient.Caption = (Action as TCustomAction).Caption);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TSpkButtonActionLink.IsEnabledLinked: Boolean;
|
function TSpkButtonActionLink.IsEnabledLinked: Boolean;
|
||||||
begin
|
begin
|
||||||
Result := inherited IsEnabledLinked and
|
Result := inherited IsEnabledLinked and Assigned(FClient) and
|
||||||
Assigned(FClient) and
|
|
||||||
(FClient.Enabled = (Action as TCustomAction).Enabled);
|
(FClient.Enabled = (Action as TCustomAction).Enabled);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@@ -211,38 +208,40 @@ end;
|
|||||||
|
|
||||||
function TSpkButtonActionLink.IsImageIndexLinked: Boolean;
|
function TSpkButtonActionLink.IsImageIndexLinked: Boolean;
|
||||||
begin
|
begin
|
||||||
Result := (inherited IsImageIndexLinked) and
|
Result := inherited IsImageIndexLinked;
|
||||||
(
|
if (FClient is TSpkSmallButton) then
|
||||||
((FClient is TSpkSmallButton)
|
Result := Result and (TSpkSmallButton(FClient).ImageIndex = (Action as TCustomAction).ImageIndex)
|
||||||
and (TSpkSmallButton(FClient).ImageIndex = (Action as TCustomAction).ImageIndex))
|
else
|
||||||
or
|
if (FClient is TSpkLargeButton) then
|
||||||
((FClient is TSpkLargeButton)
|
Result := Result and (TSpkLargeButton(FClient).LargeImageIndex = (Action as TCustomAction).ImageIndex)
|
||||||
and (TSpkLargeButton(FClient).LargeImageIndex = (Action as TCustomAction).ImageIndex))
|
else
|
||||||
);
|
Result := false;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TSpkButtonActionLink.IsVisibleLinked: Boolean;
|
function TSpkButtonActionLink.IsVisibleLinked: Boolean;
|
||||||
begin
|
begin
|
||||||
Result := inherited IsVisibleLinked and
|
Result := inherited IsVisibleLinked and Assigned(FClient) and
|
||||||
Assigned(FClient) and
|
|
||||||
(FClient.Visible = (Action as TCustomAction).Visible);
|
(FClient.Visible = (Action as TCustomAction).Visible);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSpkButtonActionLink.SetCaption(const Value: string);
|
procedure TSpkButtonActionLink.SetCaption(const Value: string);
|
||||||
begin
|
begin
|
||||||
if IsCaptionLinked then FClient.Caption := Value;
|
if IsCaptionLinked then
|
||||||
|
FClient.Caption := Value;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSpkButtonActionLink.SetEnabled(Value: Boolean);
|
procedure TSpkButtonActionLink.SetEnabled(Value: Boolean);
|
||||||
begin
|
begin
|
||||||
if IsEnabledLinked then FClient.Enabled := Value;
|
if IsEnabledLinked then
|
||||||
|
FClient.Enabled := Value;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSpkButtonActionLink.SetImageIndex(Value: integer);
|
procedure TSpkButtonActionLink.SetImageIndex(Value: integer);
|
||||||
begin
|
begin
|
||||||
if IsImageIndexLinked then begin
|
if IsImageIndexLinked then begin
|
||||||
if (FClient is TSpkSmallButton) then
|
if (FClient is TSpkSmallButton) then
|
||||||
(TSpkSmallButton(FClient)).ImageIndex := Value;
|
(TSpkSmallButton(FClient)).ImageIndex := Value
|
||||||
|
else
|
||||||
if (FClient is TSpkLargeButton) then
|
if (FClient is TSpkLargeButton) then
|
||||||
(TSpkLargeButton(FClient)).LargeImageIndex := Value;
|
(TSpkLargeButton(FClient)).LargeImageIndex := Value;
|
||||||
end;
|
end;
|
||||||
@@ -250,16 +249,42 @@ end;
|
|||||||
|
|
||||||
procedure TSpkButtonActionLink.SetOnExecute(Value: TNotifyEvent);
|
procedure TSpkButtonActionLink.SetOnExecute(Value: TNotifyEvent);
|
||||||
begin
|
begin
|
||||||
if IsOnExecuteLinked then FClient.OnClick := Value;
|
if IsOnExecuteLinked then
|
||||||
|
FClient.OnClick := Value;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSpkButtonActionLink.SetVisible(Value: Boolean);
|
procedure TSpkButtonActionLink.SetVisible(Value: Boolean);
|
||||||
begin
|
begin
|
||||||
if IsVisibleLinked then FClient.Visible := Value;
|
if IsVisibleLinked then
|
||||||
|
FClient.Visible := Value;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
{ TSpkBaseButton }
|
{ TSpkBaseButton }
|
||||||
|
|
||||||
|
constructor TSpkBaseButton.Create(AOwner: TComponent);
|
||||||
|
begin
|
||||||
|
inherited Create(AOwner);
|
||||||
|
FCaption := GetDefaultCaption;
|
||||||
|
FButtonState := bsIdle;
|
||||||
|
FButtonKind := bkButton;
|
||||||
|
{$IFDEF EnhancedRecordSupport}
|
||||||
|
FButtonRect := T2DIntRect.Create(0, 0, 1, 1);
|
||||||
|
FDropdownRect := T2DIntRect.Create(0, 0, 1, 1);
|
||||||
|
{$ELSE}
|
||||||
|
FButtonRect.Create(0, 0, 1, 1);
|
||||||
|
FDropdownRect.Create(0, 0, 1, 1);
|
||||||
|
{$ENDIF}
|
||||||
|
FMouseHoverElement := beNone;
|
||||||
|
FMouseActiveElement := beNone;
|
||||||
|
end;
|
||||||
|
|
||||||
|
destructor TSpkBaseButton.Destroy;
|
||||||
|
begin
|
||||||
|
FreeAndNil(FActionLink);
|
||||||
|
inherited Destroy;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TSpkBaseButton.ActionChange(Sender: TObject; CheckDefaults: Boolean);
|
procedure TSpkBaseButton.ActionChange(Sender: TObject; CheckDefaults: Boolean);
|
||||||
begin
|
begin
|
||||||
if Sender is TCustomAction then
|
if Sender is TCustomAction then
|
||||||
@@ -284,29 +309,6 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
constructor TSpkBaseButton.Create(AOwner : TComponent);
|
|
||||||
begin
|
|
||||||
inherited Create(AOwner);
|
|
||||||
FCaption:=GetDefaultCaption;
|
|
||||||
FButtonState:=bsIdle;
|
|
||||||
FButtonKind:=bkButton;
|
|
||||||
{$IFDEF EnhancedRecordSupport}
|
|
||||||
FButtonRect:=T2DIntRect.Create(0, 0, 1, 1);
|
|
||||||
FDropdownRect:=T2DIntRect.Create(0, 0, 1, 1);
|
|
||||||
{$ELSE}
|
|
||||||
FButtonRect.Create(0, 0, 1, 1);
|
|
||||||
FDropdownRect.Create(0, 0, 1, 1);
|
|
||||||
{$ENDIF}
|
|
||||||
FMouseHoverElement:=beNone;
|
|
||||||
FMouseActiveElement:=beNone;
|
|
||||||
end;
|
|
||||||
|
|
||||||
destructor TSpkBaseButton.Destroy;
|
|
||||||
begin
|
|
||||||
FreeAndNil(FActionLink);
|
|
||||||
inherited Destroy;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TSpkBaseButton.Click;
|
procedure TSpkBaseButton.Click;
|
||||||
begin
|
begin
|
||||||
if Assigned(FOnClick) then
|
if Assigned(FOnClick) then
|
||||||
@@ -315,19 +317,21 @@ end;
|
|||||||
|
|
||||||
procedure TSpkBaseButton.DoActionChange(Sender: TObject);
|
procedure TSpkBaseButton.DoActionChange(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
if Sender = Action then ActionChange(Sender, False);
|
if Sender = Action then
|
||||||
|
ActionChange(Sender, False);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TSpkBaseButton.GetAction: TBasicAction;
|
function TSpkBaseButton.GetAction: TBasicAction;
|
||||||
begin
|
begin
|
||||||
if assigned(FActionLink) then
|
if Assigned(FActionLink) then
|
||||||
result:=FActionLink.Action else
|
Result := FActionLink.Action
|
||||||
result:=nil;
|
else
|
||||||
|
Result := nil;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TSpkBaseButton.GetDefaultCaption: String;
|
function TSpkBaseButton.GetDefaultCaption: String;
|
||||||
begin
|
begin
|
||||||
result := 'Button';
|
Result := 'Button';
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TSpkBaseButton.GetRootComponent: TComponent;
|
function TSpkBaseButton.GetRootComponent: TComponent;
|
||||||
@@ -348,8 +352,8 @@ begin
|
|||||||
result := tab.Collection.RootComponent;
|
result := tab.Collection.RootComponent;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSpkBaseButton.MouseDown(Button: TMouseButton; Shift: TShiftState; X,
|
procedure TSpkBaseButton.MouseDown(Button: TMouseButton; Shift: TShiftState;
|
||||||
Y: Integer);
|
X, Y: Integer);
|
||||||
begin
|
begin
|
||||||
if FEnabled then
|
if FEnabled then
|
||||||
begin
|
begin
|
||||||
@@ -362,7 +366,7 @@ if FEnabled then
|
|||||||
if FButtonState <> bsBtnPressed then
|
if FButtonState <> bsBtnPressed then
|
||||||
begin
|
begin
|
||||||
FButtonState := bsBtnPressed;
|
FButtonState := bsBtnPressed;
|
||||||
if assigned(FToolbarDispatch) then
|
if Assigned(FToolbarDispatch) then
|
||||||
FToolbarDispatch.NotifyVisualsChanged;
|
FToolbarDispatch.NotifyVisualsChanged;
|
||||||
end;
|
end;
|
||||||
end else
|
end else
|
||||||
@@ -371,7 +375,7 @@ if FEnabled then
|
|||||||
if FButtonState <> bsDropdownPressed then
|
if FButtonState <> bsDropdownPressed then
|
||||||
begin
|
begin
|
||||||
FButtonState := bsDropdownPressed;
|
FButtonState := bsDropdownPressed;
|
||||||
if assigned(FToolbarDispatch) then
|
if Assigned(FToolbarDispatch) then
|
||||||
FToolbarDispatch.NotifyVisualsChanged;
|
FToolbarDispatch.NotifyVisualsChanged;
|
||||||
end;
|
end;
|
||||||
end else
|
end else
|
||||||
@@ -380,7 +384,6 @@ if FEnabled then
|
|||||||
if FMouseHoverElement = beButton then
|
if FMouseHoverElement = beButton then
|
||||||
begin
|
begin
|
||||||
FMouseActiveElement := beButton;
|
FMouseActiveElement := beButton;
|
||||||
|
|
||||||
if FButtonState <> bsBtnPressed then
|
if FButtonState <> bsBtnPressed then
|
||||||
begin
|
begin
|
||||||
FButtonState := bsBtnPressed;
|
FButtonState := bsBtnPressed;
|
||||||
@@ -391,7 +394,6 @@ if FEnabled then
|
|||||||
if FMouseHoverElement = beDropdown then
|
if FMouseHoverElement = beDropdown then
|
||||||
begin
|
begin
|
||||||
FMouseActiveElement := beDropdown;
|
FMouseActiveElement := beDropdown;
|
||||||
|
|
||||||
if FButtonState <> bsDropdownPressed then
|
if FButtonState <> bsDropdownPressed then
|
||||||
begin
|
begin
|
||||||
FButtonState := bsDropdownPressed;
|
FButtonState := bsDropdownPressed;
|
||||||
@@ -400,7 +402,7 @@ if FEnabled then
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end
|
end // if FEnabled
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
FMouseHoverElement := beNone;
|
FMouseHoverElement := beNone;
|
||||||
@@ -408,8 +410,7 @@ else
|
|||||||
if FButtonState <> bsIdle then
|
if FButtonState <> bsIdle then
|
||||||
begin
|
begin
|
||||||
FButtonState := bsIdle;
|
FButtonState := bsIdle;
|
||||||
|
if Assigned(FToolbarDispatch) then
|
||||||
if assigned(FToolbarDispatch) then
|
|
||||||
FToolbarDispatch.NotifyVisualsChanged;
|
FToolbarDispatch.NotifyVisualsChanged;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@@ -430,14 +431,13 @@ if FEnabled then
|
|||||||
// Placeholder, gdyby zasz³a potrzeba obs³ugi tego zdarzenia
|
// Placeholder, gdyby zasz³a potrzeba obs³ugi tego zdarzenia
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if FButtonState <> bsIdle then
|
if FButtonState <> bsIdle then
|
||||||
begin
|
begin
|
||||||
FButtonState := bsIdle;
|
FButtonState := bsIdle;
|
||||||
if assigned(FToolbarDispatch) then
|
if Assigned(FToolbarDispatch) then
|
||||||
FToolbarDispatch.NotifyVisualsChanged;
|
FToolbarDispatch.NotifyVisualsChanged;
|
||||||
end;
|
end;
|
||||||
end
|
end // if FEnabled
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
FMouseHoverElement := beNone;
|
FMouseHoverElement := beNone;
|
||||||
@@ -445,33 +445,35 @@ else
|
|||||||
if FButtonState <> bsIdle then
|
if FButtonState <> bsIdle then
|
||||||
begin
|
begin
|
||||||
FButtonState := bsIdle;
|
FButtonState := bsIdle;
|
||||||
|
if Assigned(FToolbarDispatch) then
|
||||||
if assigned(FToolbarDispatch) then
|
|
||||||
FToolbarDispatch.NotifyVisualsChanged;
|
FToolbarDispatch.NotifyVisualsChanged;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSpkBaseButton.MouseMove(Shift: TShiftState; X, Y: Integer);
|
procedure TSpkBaseButton.MouseMove(Shift: TShiftState; X, Y: Integer);
|
||||||
|
var
|
||||||
var NewMouseHoverElement : TSpkMouseButtonElement;
|
NewMouseHoverElement: TSpkMouseButtonElement;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
if FEnabled then
|
if FEnabled then
|
||||||
begin
|
begin
|
||||||
{$IFDEF EnhancedRecordSupport}
|
{$IFDEF EnhancedRecordSupport}
|
||||||
if FButtonRect.Contains(T2DIntPoint.Create(X,Y)) then
|
if FButtonRect.Contains(T2DIntPoint.Create(X,Y)) then
|
||||||
{$ELSE}
|
{$ELSE}
|
||||||
if FButtonRect.Contains(X,Y) then
|
if FButtonRect.Contains(X,Y)
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
NewMouseHoverElement:=beButton else
|
then
|
||||||
|
NewMouseHoverElement := beButton
|
||||||
|
else
|
||||||
if (FButtonKind = bkButtonDropdown) and
|
if (FButtonKind = bkButtonDropdown) and
|
||||||
{$IFDEF EnhancedRecordSupport}
|
{$IFDEF EnhancedRecordSupport}
|
||||||
(FDropdownRect.Contains(T2DIntPoint.Create(X,Y))) then
|
(FDropdownRect.Contains(T2DIntPoint.Create(X,Y))) then
|
||||||
{$ELSE}
|
{$ELSE}
|
||||||
(FDropdownRect.Contains(X,Y)) then
|
(FDropdownRect.Contains(X,Y))
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
NewMouseHoverElement:=beDropdown else
|
then
|
||||||
|
NewMouseHoverElement := beDropdown
|
||||||
|
else
|
||||||
NewMouseHoverElement := beNone;
|
NewMouseHoverElement := beNone;
|
||||||
|
|
||||||
if FMouseActiveElement = beButton then
|
if FMouseActiveElement = beButton then
|
||||||
@@ -508,7 +510,6 @@ if FEnabled then
|
|||||||
begin
|
begin
|
||||||
// Z uwagi na uproszczon¹ obs³ugê myszy w przycisku, nie ma potrzeby
|
// Z uwagi na uproszczon¹ obs³ugê myszy w przycisku, nie ma potrzeby
|
||||||
// informowaæ poprzedniego elementu o tym, ¿e mysz opuœci³a jego obszar.
|
// informowaæ poprzedniego elementu o tym, ¿e mysz opuœci³a jego obszar.
|
||||||
|
|
||||||
if NewMouseHoverElement = beButton then
|
if NewMouseHoverElement = beButton then
|
||||||
begin
|
begin
|
||||||
if FButtonState <> bsBtnHottrack then
|
if FButtonState <> bsBtnHottrack then
|
||||||
@@ -530,7 +531,7 @@ if FEnabled then
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
FMouseHoverElement := NewMouseHoverElement;
|
FMouseHoverElement := NewMouseHoverElement;
|
||||||
end
|
end // if FEnabled
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
FMouseHoverElement := beNone;
|
FMouseHoverElement := beNone;
|
||||||
@@ -538,19 +539,17 @@ else
|
|||||||
if FButtonState <> bsIdle then
|
if FButtonState <> bsIdle then
|
||||||
begin
|
begin
|
||||||
FButtonState := bsIdle;
|
FButtonState := bsIdle;
|
||||||
|
if Assigned(FToolbarDispatch) then
|
||||||
if assigned(FToolbarDispatch) then
|
|
||||||
FToolbarDispatch.NotifyVisualsChanged;
|
FToolbarDispatch.NotifyVisualsChanged;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSpkBaseButton.MouseUp(Button: TMouseButton; Shift: TShiftState; X,
|
procedure TSpkBaseButton.MouseUp(Button: TMouseButton; Shift: TShiftState;
|
||||||
Y: Integer);
|
X, Y: Integer);
|
||||||
|
var
|
||||||
var ClearActive : boolean;
|
ClearActive: boolean;
|
||||||
DropPoint: T2DIntPoint;
|
DropPoint: T2DIntPoint;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
if FEnabled then
|
if FEnabled then
|
||||||
begin
|
begin
|
||||||
@@ -570,17 +569,17 @@ if FEnabled then
|
|||||||
begin
|
begin
|
||||||
Click;
|
Click;
|
||||||
FButtonState := bsBtnHottrack;
|
FButtonState := bsBtnHottrack;
|
||||||
if assigned(FToolbarDispatch) then
|
if Assigned(FToolbarDispatch) then
|
||||||
FToolbarDispatch.NotifyVisualsChanged;
|
FToolbarDispatch.NotifyVisualsChanged;
|
||||||
end else
|
end else
|
||||||
if FButtonKind = bkDropdown then
|
if FButtonKind = bkDropdown then
|
||||||
begin
|
begin
|
||||||
if assigned(FDropdownMenu) then
|
if Assigned(FDropdownMenu) then
|
||||||
begin
|
begin
|
||||||
DropPoint := FToolbarDispatch.ClientToScreen(GetDropdownPoint);
|
DropPoint := FToolbarDispatch.ClientToScreen(GetDropdownPoint);
|
||||||
FDropdownMenu.Popup(DropPoint.x, DropPoint.y);
|
FDropdownMenu.Popup(DropPoint.x, DropPoint.y);
|
||||||
FButtonState := bsBtnHottrack;
|
FButtonState := bsBtnHottrack;
|
||||||
if assigned(FToolbarDispatch) then
|
if Assigned(FToolbarDispatch) then
|
||||||
FToolbarDispatch.NotifyVisualsChanged;
|
FToolbarDispatch.NotifyVisualsChanged;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@@ -590,31 +589,29 @@ if FEnabled then
|
|||||||
begin
|
begin
|
||||||
// Zdarzenie zadzia³a tylko wtedy, gdy przycisk myszy zosta³ puszczony nad
|
// Zdarzenie zadzia³a tylko wtedy, gdy przycisk myszy zosta³ puszczony nad
|
||||||
// przyciskiem DropDown
|
// przyciskiem DropDown
|
||||||
|
|
||||||
if FMouseHoverElement = beDropDown then
|
if FMouseHoverElement = beDropDown then
|
||||||
begin
|
begin
|
||||||
if assigned(FDropdownMenu) then
|
if Assigned(FDropdownMenu) then
|
||||||
begin
|
begin
|
||||||
DropPoint := FToolbarDispatch.ClientToScreen(GetDropdownPoint);
|
DropPoint := FToolbarDispatch.ClientToScreen(GetDropdownPoint);
|
||||||
FDropdownMenu.Popup(DropPoint.x, DropPoint.y);
|
FDropdownMenu.Popup(DropPoint.x, DropPoint.y);
|
||||||
FButtonState := bsBtnHottrack;
|
FButtonState := bsBtnHottrack;
|
||||||
if assigned(FToolbarDispatch) then
|
if Assigned(FToolbarDispatch) then
|
||||||
FToolbarDispatch.NotifyVisualsChanged;
|
FToolbarDispatch.NotifyVisualsChanged;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if (ClearActive) and (FMouseActiveElement<>FMouseHoverElement) then
|
if ClearActive and (FMouseActiveElement <> FMouseHoverElement) then
|
||||||
begin
|
begin
|
||||||
// Z uwagi na uproszczon¹ obs³ugê, nie ma potrzeby informowaæ poprzedniego
|
// Z uwagi na uproszczon¹ obs³ugê, nie ma potrzeby informowaæ poprzedniego
|
||||||
// elementu o tym, ¿e mysz opuœci³a jego obszar.
|
// elementu o tym, ¿e mysz opuœci³a jego obszar.
|
||||||
|
|
||||||
if FMouseHoverElement = beButton then
|
if FMouseHoverElement = beButton then
|
||||||
begin
|
begin
|
||||||
if FButtonState <> bsBtnHottrack then
|
if FButtonState <> bsBtnHottrack then
|
||||||
begin
|
begin
|
||||||
FButtonState := bsBtnHottrack;
|
FButtonState := bsBtnHottrack;
|
||||||
if assigned(FToolbarDispatch) then
|
if Assigned(FToolbarDispatch) then
|
||||||
FToolbarDispatch.NotifyVisualsChanged;
|
FToolbarDispatch.NotifyVisualsChanged;
|
||||||
end;
|
end;
|
||||||
end else
|
end else
|
||||||
@@ -623,7 +620,7 @@ if FEnabled then
|
|||||||
if FButtonState <> bsDropdownHottrack then
|
if FButtonState <> bsDropdownHottrack then
|
||||||
begin
|
begin
|
||||||
FButtonState := bsDropdownHottrack;
|
FButtonState := bsDropdownHottrack;
|
||||||
if assigned(FToolbarDispatch) then
|
if Assigned(FToolbarDispatch) then
|
||||||
FToolbarDispatch.NotifyVisualsChanged;
|
FToolbarDispatch.NotifyVisualsChanged;
|
||||||
end;
|
end;
|
||||||
end else
|
end else
|
||||||
@@ -632,7 +629,7 @@ if FEnabled then
|
|||||||
if FButtonState <> bsIdle then
|
if FButtonState <> bsIdle then
|
||||||
begin
|
begin
|
||||||
FButtonState := bsIdle;
|
FButtonState := bsIdle;
|
||||||
if assigned(FToolbarDispatch) then
|
if Assigned(FToolbarDispatch) then
|
||||||
FToolbarDispatch.NotifyVisualsChanged;
|
FToolbarDispatch.NotifyVisualsChanged;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@@ -642,7 +639,7 @@ if FEnabled then
|
|||||||
begin
|
begin
|
||||||
FMouseActiveElement:=beNone;
|
FMouseActiveElement:=beNone;
|
||||||
end;
|
end;
|
||||||
end
|
end // if FEnabled
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
FMouseHoverElement := beNone;
|
FMouseHoverElement := beNone;
|
||||||
@@ -650,8 +647,7 @@ else
|
|||||||
if FButtonState <> bsIdle then
|
if FButtonState <> bsIdle then
|
||||||
begin
|
begin
|
||||||
FButtonState := bsIdle;
|
FButtonState := bsIdle;
|
||||||
|
if Assigned(FToolbarDispatch) then
|
||||||
if assigned(FToolbarDispatch) then
|
|
||||||
FToolbarDispatch.NotifyVisualsChanged;
|
FToolbarDispatch.NotifyVisualsChanged;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@@ -722,6 +718,7 @@ begin
|
|||||||
CalcRects;
|
CalcRects;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
{ TSpkLargeButton }
|
{ TSpkLargeButton }
|
||||||
|
|
||||||
procedure TSpkLargeButton.CalcRects;
|
procedure TSpkLargeButton.CalcRects;
|
||||||
@@ -1128,6 +1125,16 @@ end;
|
|||||||
|
|
||||||
{ TSpkSmallButton }
|
{ TSpkSmallButton }
|
||||||
|
|
||||||
|
constructor TSpkSmallButton.Create(AOwner: TComponent);
|
||||||
|
begin
|
||||||
|
inherited Create(AOwner);
|
||||||
|
FImageIndex := -1;
|
||||||
|
FTableBehaviour := tbContinuesRow;
|
||||||
|
FGroupBehaviour := gbSingleItem;
|
||||||
|
FHideFrameWhenIdle := false;
|
||||||
|
FShowCaption := true;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TSpkSmallButton.CalcRects;
|
procedure TSpkSmallButton.CalcRects;
|
||||||
var
|
var
|
||||||
RectVector: T2DIntVector;
|
RectVector: T2DIntVector;
|
||||||
@@ -1143,13 +1150,12 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSpkSmallButton.ConstructRects(out BtnRect, DropRect: T2DIntRect);
|
procedure TSpkSmallButton.ConstructRects(out BtnRect, DropRect: T2DIntRect);
|
||||||
|
var
|
||||||
var BtnWidth : integer;
|
BtnWidth: integer;
|
||||||
DropdownWidth: Integer;
|
DropdownWidth: Integer;
|
||||||
Bitmap: TBitmap;
|
Bitmap: TBitmap;
|
||||||
TextWidth: Integer;
|
TextWidth: Integer;
|
||||||
AdditionalPadding: Boolean;
|
AdditionalPadding: Boolean;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
{$IFDEF EnhancedRecordSupport}
|
{$IFDEF EnhancedRecordSupport}
|
||||||
BtnRect := T2DIntRect.Create(0, 0, 0, 0);
|
BtnRect := T2DIntRect.Create(0, 0, 0, 0);
|
||||||
@@ -1159,13 +1165,13 @@ BtnRect.Create(0, 0, 0, 0);
|
|||||||
DropRect.Create(0, 0, 0, 0);
|
DropRect.Create(0, 0, 0, 0);
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
if not(assigned(FToolbarDispatch)) then
|
if not Assigned(FToolbarDispatch) then
|
||||||
exit;
|
exit;
|
||||||
if not(assigned(FAppearance)) then
|
if not Assigned(FAppearance) then
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
Bitmap := FToolbarDispatch.GetTempBitmap;
|
Bitmap := FToolbarDispatch.GetTempBitmap;
|
||||||
if not(assigned(Bitmap)) then
|
if not Assigned(Bitmap) then
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
// *** Niezale¿nie od rodzaju, musi byæ miejsce dla ikony i/lub tekstu ***
|
// *** Niezale¿nie od rodzaju, musi byæ miejsce dla ikony i/lub tekstu ***
|
||||||
@@ -1183,7 +1189,7 @@ if FImageIndex<>-1 then
|
|||||||
// Tekst
|
// Tekst
|
||||||
if FShowCaption then
|
if FShowCaption then
|
||||||
begin
|
begin
|
||||||
Bitmap.Canvas.Font.assign(FAppearance.Element.CaptionFont);
|
Bitmap.Canvas.Font.Assign(FAppearance.Element.CaptionFont);
|
||||||
TextWidth := Bitmap.Canvas.TextWidth(FCaption);
|
TextWidth := Bitmap.Canvas.TextWidth(FCaption);
|
||||||
|
|
||||||
BtnWidth := BtnWidth + SmallButtonPadding + TextWidth;
|
BtnWidth := BtnWidth + SmallButtonPadding + TextWidth;
|
||||||
@@ -1199,15 +1205,18 @@ BtnWidth := Max(SmallButtonMinWidth, BtnWidth);
|
|||||||
|
|
||||||
// *** Dropdown ***
|
// *** Dropdown ***
|
||||||
case FButtonKind of
|
case FButtonKind of
|
||||||
bkButton: begin
|
bkButton:
|
||||||
|
begin
|
||||||
// Lewa krawêdŸ przycisku
|
// Lewa krawêdŸ przycisku
|
||||||
if FGroupBehaviour in [gbContinuesGroup, gbEndsGroup] then
|
if FGroupBehaviour in [gbContinuesGroup, gbEndsGroup] then
|
||||||
BtnWidth:=BtnWidth + SmallButtonHalfBorderWidth else
|
BtnWidth := BtnWidth + SmallButtonHalfBorderWidth
|
||||||
|
else
|
||||||
BtnWidth := BtnWidth + SmallButtonBorderWidth;
|
BtnWidth := BtnWidth + SmallButtonBorderWidth;
|
||||||
|
|
||||||
// Prawa krawêdŸ przycisku
|
// Prawa krawêdŸ przycisku
|
||||||
if (FGroupBehaviour in [gbBeginsGroup, gbContinuesGroup]) then
|
if (FGroupBehaviour in [gbBeginsGroup, gbContinuesGroup]) then
|
||||||
BtnWidth:=BtnWidth + SmallButtonHalfBorderWidth else
|
BtnWidth := BtnWidth + SmallButtonHalfBorderWidth
|
||||||
|
else
|
||||||
BtnWidth := BtnWidth + SmallButtonBorderWidth;
|
BtnWidth := BtnWidth + SmallButtonBorderWidth;
|
||||||
|
|
||||||
{$IFDEF EnhancedRecordSupport}
|
{$IFDEF EnhancedRecordSupport}
|
||||||
@@ -1218,10 +1227,13 @@ case FButtonKind of
|
|||||||
DropRect.Create(0, 0, 0, 0);
|
DropRect.Create(0, 0, 0, 0);
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
end;
|
end;
|
||||||
bkButtonDropdown: begin
|
|
||||||
|
bkButtonDropdown:
|
||||||
|
begin
|
||||||
// Lewa krawêdŸ przycisku
|
// Lewa krawêdŸ przycisku
|
||||||
if FGroupBehaviour in [gbContinuesGroup, gbEndsGroup] then
|
if FGroupBehaviour in [gbContinuesGroup, gbEndsGroup] then
|
||||||
BtnWidth:=BtnWidth + SmallButtonHalfBorderWidth else
|
BtnWidth := BtnWidth + SmallButtonHalfBorderWidth
|
||||||
|
else
|
||||||
BtnWidth := BtnWidth + SmallButtonBorderWidth;
|
BtnWidth := BtnWidth + SmallButtonBorderWidth;
|
||||||
|
|
||||||
// Prawa krawêdŸ przycisku
|
// Prawa krawêdŸ przycisku
|
||||||
@@ -1232,30 +1244,31 @@ case FButtonKind of
|
|||||||
|
|
||||||
// Prawa krawêdŸ pola dropdown
|
// Prawa krawêdŸ pola dropdown
|
||||||
if (FGroupBehaviour in [gbBeginsGroup, gbContinuesGroup]) then
|
if (FGroupBehaviour in [gbBeginsGroup, gbContinuesGroup]) then
|
||||||
DropdownWidth:=DropdownWidth + SmallButtonHalfBorderWidth else
|
DropdownWidth := DropdownWidth + SmallButtonHalfBorderWidth
|
||||||
|
else
|
||||||
DropdownWidth := DropdownWidth + SmallButtonBorderWidth;
|
DropdownWidth := DropdownWidth + SmallButtonBorderWidth;
|
||||||
|
|
||||||
{$IFDEF EnhancedRecordSupport}
|
{$IFDEF EnhancedRecordSupport}
|
||||||
BtnRect := T2DIntRect.Create(0, 0, BtnWidth - 1, PaneRowHeightT - 1);
|
BtnRect := T2DIntRect.Create(0, 0, BtnWidth - 1, PaneRowHeightT - 1);
|
||||||
DropRect:=T2DIntRect.Create(BtnRect.right+1,
|
DropRect := T2DIntRect.Create(BtnRect.Right+1, 0, BtnRect.Right+DropdownWidth, PaneRowHeight - 1);
|
||||||
0,
|
|
||||||
BtnRect.right+DropdownWidth,
|
|
||||||
PaneRowHeight - 1);
|
|
||||||
{$ELSE}
|
{$ELSE}
|
||||||
BtnRect.Create(0, 0, BtnWidth - 1, PaneRowHeight - 1);
|
BtnRect.Create(0, 0, BtnWidth - 1, PaneRowHeight - 1);
|
||||||
DropRect.Create(BtnRect.right+1, 0,
|
DropRect.Create(BtnRect.Right+1, 0, BtnRect.Right+DropdownWidth, PaneRowHeight - 1);
|
||||||
BtnRect.right+DropdownWidth, PaneRowHeight - 1);
|
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
end;
|
end;
|
||||||
bkDropdown: begin
|
|
||||||
|
bkDropdown:
|
||||||
|
begin
|
||||||
// Lewa krawêdŸ przycisku
|
// Lewa krawêdŸ przycisku
|
||||||
if FGroupBehaviour in [gbContinuesGroup, gbEndsGroup] then
|
if FGroupBehaviour in [gbContinuesGroup, gbEndsGroup] then
|
||||||
BtnWidth:=BtnWidth + SmallButtonHalfBorderWidth else
|
BtnWidth := BtnWidth + SmallButtonHalfBorderWidth
|
||||||
|
else
|
||||||
BtnWidth := BtnWidth + SmallButtonBorderWidth;
|
BtnWidth := BtnWidth + SmallButtonBorderWidth;
|
||||||
|
|
||||||
// Prawa krawêdŸ przycisku
|
// Prawa krawêdŸ przycisku
|
||||||
if (FGroupBehaviour in [gbBeginsGroup, gbContinuesGroup]) then
|
if (FGroupBehaviour in [gbBeginsGroup, gbContinuesGroup]) then
|
||||||
BtnWidth:=BtnWidth + SmallButtonHalfBorderWidth else
|
BtnWidth := BtnWidth + SmallButtonHalfBorderWidth
|
||||||
|
else
|
||||||
BtnWidth := BtnWidth + SmallButtonBorderWidth;
|
BtnWidth := BtnWidth + SmallButtonBorderWidth;
|
||||||
|
|
||||||
// Dodatkowy obszar na dropdown + miejsce na œrodkow¹ krawêdŸ,
|
// Dodatkowy obszar na dropdown + miejsce na œrodkow¹ krawêdŸ,
|
||||||
@@ -1273,16 +1286,6 @@ case FButtonKind of
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
constructor TSpkSmallButton.Create(AOwner: TComponent);
|
|
||||||
begin
|
|
||||||
inherited Create(AOwner);
|
|
||||||
FImageIndex := -1;
|
|
||||||
FTableBehaviour := tbContinuesRow;
|
|
||||||
FGroupBehaviour := gbSingleItem;
|
|
||||||
FHideFrameWhenIdle := false;
|
|
||||||
FShowCaption := true;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TSpkSmallButton.Draw(ABuffer: TBitmap; ClipRect: T2DIntRect);
|
procedure TSpkSmallButton.Draw(ABuffer: TBitmap; ClipRect: T2DIntRect);
|
||||||
var
|
var
|
||||||
fontColor: TColor;
|
fontColor: TColor;
|
||||||
|
@@ -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
|
||||||
@@ -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,25 +15,23 @@ unit spkt_Dispatch;
|
|||||||
|
|
||||||
interface
|
interface
|
||||||
|
|
||||||
uses Classes, Controls, Graphics,
|
uses
|
||||||
|
Classes, Controls, Graphics,
|
||||||
SpkMath;
|
SpkMath;
|
||||||
|
|
||||||
type TSpkBaseDispatch = class abstract(TObject)
|
type
|
||||||
|
TSpkBaseDispatch = class abstract(TObject)
|
||||||
private
|
private
|
||||||
protected
|
protected
|
||||||
public
|
public
|
||||||
end;
|
end;
|
||||||
|
|
||||||
type TSpkBaseAppearanceDispatch = class abstract(TSpkBaseDispatch)
|
TSpkBaseAppearanceDispatch = class abstract(TSpkBaseDispatch)
|
||||||
private
|
|
||||||
protected
|
|
||||||
public
|
public
|
||||||
procedure NotifyAppearanceChanged; virtual; abstract;
|
procedure NotifyAppearanceChanged; virtual; abstract;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
type TSpkBaseToolbarDispatch = class abstract(TSpkBaseAppearanceDispatch)
|
TSpkBaseToolbarDispatch = class abstract(TSpkBaseAppearanceDispatch)
|
||||||
private
|
|
||||||
protected
|
|
||||||
public
|
public
|
||||||
procedure NotifyItemsChanged; virtual; abstract;
|
procedure NotifyItemsChanged; virtual; abstract;
|
||||||
procedure NotifyMetricsChanged; virtual; abstract;
|
procedure NotifyMetricsChanged; virtual; abstract;
|
||||||
|
@@ -14,9 +14,11 @@ unit spkt_Exceptions;
|
|||||||
|
|
||||||
interface
|
interface
|
||||||
|
|
||||||
uses SysUtils;
|
uses
|
||||||
|
SysUtils;
|
||||||
|
|
||||||
type InternalException = class(Exception);
|
type
|
||||||
|
InternalException = class(Exception);
|
||||||
AssignException = class(Exception);
|
AssignException = class(Exception);
|
||||||
RuntimeException = class(Exception);
|
RuntimeException = class(Exception);
|
||||||
ListException = class(Exception);
|
ListException = class(Exception);
|
||||||
|
@@ -15,11 +15,13 @@ unit spkt_Items;
|
|||||||
|
|
||||||
interface
|
interface
|
||||||
|
|
||||||
uses Classes, Controls, SysUtils, Dialogs,
|
uses
|
||||||
|
Classes, Controls, SysUtils, Dialogs,
|
||||||
spkt_Appearance, spkt_Dispatch, spkt_BaseItem, spkt_Types,
|
spkt_Appearance, spkt_Dispatch, spkt_BaseItem, spkt_Types,
|
||||||
spkt_Buttons, spkt_Checkboxes;
|
spkt_Buttons, spkt_Checkboxes;
|
||||||
|
|
||||||
type TSpkItems = class(TSpkCollection)
|
type
|
||||||
|
TSpkItems = class(TSpkCollection)
|
||||||
private
|
private
|
||||||
FToolbarDispatch: TSpkBaseToolbarDispatch;
|
FToolbarDispatch: TSpkBaseToolbarDispatch;
|
||||||
FAppearance: TSpkToolbarAppearance;
|
FAppearance: TSpkToolbarAppearance;
|
||||||
@@ -30,12 +32,13 @@ type TSpkItems = class(TSpkCollection)
|
|||||||
|
|
||||||
// *** 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
|
public
|
||||||
function AddLargeButton: TSpkLargeButton;
|
function AddLargeButton: TSpkLargeButton;
|
||||||
function AddSmallButton: TSpkSmallButton;
|
function AddSmallButton: TSpkSmallButton;
|
||||||
@@ -87,22 +90,21 @@ 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:
|
||||||
|
begin
|
||||||
// Ustawienie dyspozytora na nil spowoduje, ¿e podczas
|
// Ustawienie dyspozytora na nil spowoduje, ¿e podczas
|
||||||
// przypisywania w³asnoœci nie bêd¹ wo³ane metody Notify*
|
// przypisywania w³asnoœci nie bêd¹ wo³ane metody Notify*
|
||||||
TSpkBaseItem(Item).ToolbarDispatch := nil;
|
TSpkBaseItem(Item).ToolbarDispatch := nil;
|
||||||
|
|
||||||
TSpkBaseItem(Item).Appearance := FAppearance;
|
TSpkBaseItem(Item).Appearance := FAppearance;
|
||||||
TSpkBaseItem(Item).Images := FImages;
|
TSpkBaseItem(Item).Images := FImages;
|
||||||
TSpkBaseItem(Item).DisabledImages := FDisabledImages;
|
TSpkBaseItem(Item).DisabledImages := FDisabledImages;
|
||||||
@@ -110,7 +112,8 @@ begin
|
|||||||
TSpkBaseItem(Item).DisabledLargeImages := FDisabledLargeImages;
|
TSpkBaseItem(Item).DisabledLargeImages := FDisabledLargeImages;
|
||||||
TSpkBaseItem(Item).ToolbarDispatch := FToolbarDispatch;
|
TSpkBaseItem(Item).ToolbarDispatch := FToolbarDispatch;
|
||||||
end;
|
end;
|
||||||
opRemove: begin
|
|
||||||
|
opRemove:
|
||||||
if not (csDestroying in Item.ComponentState) then
|
if not (csDestroying in Item.ComponentState) then
|
||||||
begin
|
begin
|
||||||
TSpkBaseItem(Item).ToolbarDispatch := nil;
|
TSpkBaseItem(Item).ToolbarDispatch := nil;
|
||||||
@@ -122,12 +125,10 @@ begin
|
|||||||
end;
|
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;
|
||||||
|
|
||||||
|
@@ -15,14 +15,16 @@ unit spkt_Pane;
|
|||||||
|
|
||||||
interface
|
interface
|
||||||
|
|
||||||
uses Graphics, Controls, Classes, SysUtils, Math, Dialogs,
|
uses
|
||||||
|
Graphics, Controls, Classes, SysUtils, Math, Dialogs,
|
||||||
SpkGraphTools, SpkGUITools, SpkMath,
|
SpkGraphTools, SpkGUITools, SpkMath,
|
||||||
spkt_Appearance, spkt_Const, spkt_Dispatch, spkt_Exceptions,
|
spkt_Appearance, spkt_Const, spkt_Dispatch, spkt_Exceptions,
|
||||||
spkt_BaseItem, spkt_Items, spkt_Types;
|
spkt_BaseItem, spkt_Items, spkt_Types;
|
||||||
|
|
||||||
type TSpkPaneState = (psIdle, psHover);
|
type
|
||||||
|
TSpkPaneState = (psIdle, psHover);
|
||||||
|
|
||||||
type TSpkMousePaneElementType = (peNone, pePaneArea, peItem);
|
TSpkMousePaneElementType = (peNone, pePaneArea, peItem);
|
||||||
|
|
||||||
TSpkMousePaneElement = record
|
TSpkMousePaneElement = record
|
||||||
ElementType: TSpkMousePaneElementType;
|
ElementType: TSpkMousePaneElementType;
|
||||||
@@ -30,17 +32,17 @@ type TSpkMousePaneElementType = (peNone, pePaneArea, peItem);
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
T2DIntRectArray = array of T2DIntRect;
|
T2DIntRectArray = array of T2DIntRect;
|
||||||
|
|
||||||
TSpkPaneItemsLayout = record
|
TSpkPaneItemsLayout = record
|
||||||
Rects: T2DIntRectArray;
|
Rects: T2DIntRectArray;
|
||||||
Width: integer;
|
Width: integer;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
type TSpkPane = class;
|
TSpkPane = class;
|
||||||
|
|
||||||
TSpkPane = class(TSpkComponent)
|
TSpkPane = class(TSpkComponent)
|
||||||
private
|
private
|
||||||
FPaneState: TSpkPaneState;
|
FPaneState: TSpkPaneState;
|
||||||
|
|
||||||
FMouseHoverElement: TSpkMousePaneElement;
|
FMouseHoverElement: TSpkMousePaneElement;
|
||||||
FMouseActiveElement: TSpkMousePaneElement;
|
FMouseActiveElement: TSpkMousePaneElement;
|
||||||
protected
|
protected
|
||||||
@@ -73,6 +75,7 @@ type TSpkPane = class;
|
|||||||
procedure SetDisabledLargeImages(const Value: TImageList);
|
procedure SetDisabledLargeImages(const Value: TImageList);
|
||||||
procedure SetRect(ARect : T2DIntRect);
|
procedure SetRect(ARect : T2DIntRect);
|
||||||
procedure SetToolbarDispatch(const Value: TSpkBaseToolbarDispatch);
|
procedure SetToolbarDispatch(const Value: TSpkBaseToolbarDispatch);
|
||||||
|
|
||||||
public
|
public
|
||||||
// *** Konstruktor, destruktor ***
|
// *** Konstruktor, destruktor ***
|
||||||
constructor Create(AOwner: TComponent); override;
|
constructor Create(AOwner: TComponent); override;
|
||||||
@@ -80,11 +83,9 @@ type TSpkPane = class;
|
|||||||
|
|
||||||
// *** Obs³uga gryzonia ***
|
// *** Obs³uga gryzonia ***
|
||||||
procedure MouseLeave;
|
procedure MouseLeave;
|
||||||
procedure MouseDown(Button: TMouseButton; Shift: TShiftState;
|
procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
||||||
X, Y: Integer);
|
|
||||||
procedure MouseMove(Shift: TShiftState; X, Y: Integer);
|
procedure MouseMove(Shift: TShiftState; X, Y: Integer);
|
||||||
procedure MouseUp(Button: TMouseButton; Shift: TShiftState;
|
procedure MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
||||||
X, Y: Integer);
|
|
||||||
|
|
||||||
// *** Geometria i rysowanie ***
|
// *** Geometria i rysowanie ***
|
||||||
function GetWidth: integer;
|
function GetWidth: integer;
|
||||||
@@ -102,12 +103,13 @@ type TSpkPane = class;
|
|||||||
property LargeImages: TImageList read FLargeImages write SetLargeImages;
|
property LargeImages: TImageList read FLargeImages write SetLargeImages;
|
||||||
property DisabledLargeImages: TImageList read FDisabledLargeImages write SetDisabledLargeImages;
|
property DisabledLargeImages: TImageList read FDisabledLargeImages write SetDisabledLargeImages;
|
||||||
property Items: TSpkItems read FItems;
|
property Items: TSpkItems read FItems;
|
||||||
|
|
||||||
published
|
published
|
||||||
property Caption: string read FCaption write SetCaption;
|
property Caption: string read FCaption write SetCaption;
|
||||||
property Visible: boolean read FVisible write SetVisible;
|
property Visible: boolean read FVisible write SetVisible;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
type TSpkPanes = class(TSpkCollection)
|
TSpkPanes = class(TSpkCollection)
|
||||||
private
|
private
|
||||||
protected
|
protected
|
||||||
FToolbarDispatch: TSpkBaseToolbarDispatch;
|
FToolbarDispatch: TSpkBaseToolbarDispatch;
|
||||||
@@ -119,16 +121,17 @@ type TSpkPanes = class(TSpkCollection)
|
|||||||
|
|
||||||
// *** Gettery i settery ***
|
// *** Gettery i settery ***
|
||||||
procedure SetToolbarDispatch(const Value: TSpkBaseToolbarDispatch);
|
procedure SetToolbarDispatch(const Value: TSpkBaseToolbarDispatch);
|
||||||
function GetItems(index: integer): TSpkPane; reintroduce;
|
function GetItems(AIndex: integer): TSpkPane; 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
|
public
|
||||||
// *** Dodawanie i wstawianie elementów ***
|
// *** Dodawanie i wstawianie elementów ***
|
||||||
function Add: TSpkPane;
|
function Add: TSpkPane;
|
||||||
function Insert(index : integer) : TSpkPane;
|
function Insert(AIndex: integer): TSpkPane;
|
||||||
|
|
||||||
// *** Reakcja na zmiany listy ***
|
// *** Reakcja na zmiany listy ***
|
||||||
procedure Notify(Item: TComponent; Operation: TOperation); override;
|
procedure Notify(Item: TComponent; Operation: TOperation); override;
|
||||||
@@ -143,42 +146,11 @@ type TSpkPanes = class(TSpkCollection)
|
|||||||
property DisabledLargeImages: TImageList read FDisabledLargeImages write SetDisabledLargeImages;
|
property DisabledLargeImages: TImageList read FDisabledLargeImages write SetDisabledLargeImages;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
{ TSpkPane }
|
{ TSpkPane }
|
||||||
|
|
||||||
procedure TSpkPane.SetRect(ARect: T2DIntRect);
|
|
||||||
|
|
||||||
var Pt : T2DIntPoint;
|
|
||||||
i : integer;
|
|
||||||
Layout : TSpkPaneItemsLayout;
|
|
||||||
|
|
||||||
begin
|
|
||||||
FRect:=ARect;
|
|
||||||
|
|
||||||
// Obliczamy layout
|
|
||||||
Layout:=GenerateLayout;
|
|
||||||
|
|
||||||
{$IFDEF EnhancedRecordSupport}
|
|
||||||
Pt:=T2DIntPoint.create(ARect.left + SpkLayoutSizes.PANE_BORDER_SIZE + SpkLayoutSizes.PANE_LEFT_PADDING, ARect.top + SpkLayoutSizes.PANE_BORDER_SIZE);
|
|
||||||
{$ELSE}
|
|
||||||
Pt.create(ARect.left + PaneBorderSize + PaneLeftPadding, ARect.top + PaneBorderSize);
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
if length(Layout.Rects)>0 then
|
|
||||||
begin
|
|
||||||
for i := 0 to high(Layout.Rects) do
|
|
||||||
FItems[i].Rect:=Layout.Rects[i] + Pt;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TSpkPane.SetToolbarDispatch(const Value: TSpkBaseToolbarDispatch);
|
|
||||||
|
|
||||||
begin
|
|
||||||
FToolbarDispatch := Value;
|
|
||||||
FItems.ToolbarDispatch:=FToolbarDispatch;
|
|
||||||
end;
|
|
||||||
|
|
||||||
constructor TSpkPane.Create(AOwner: TComponent);
|
constructor TSpkPane.Create(AOwner: TComponent);
|
||||||
begin
|
begin
|
||||||
inherited Create(AOwner);
|
inherited Create(AOwner);
|
||||||
@@ -191,9 +163,9 @@ begin
|
|||||||
|
|
||||||
FCaption := 'Pane';
|
FCaption := 'Pane';
|
||||||
{$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;
|
||||||
@@ -209,20 +181,52 @@ begin
|
|||||||
FItems.Appearance := FAppearance;
|
FItems.Appearance := FAppearance;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSpkPane.DefineProperties(Filer: TFiler);
|
|
||||||
begin
|
|
||||||
inherited DefineProperties(Filer);
|
|
||||||
|
|
||||||
Filer.DefineProperty('Items',FItems.ReadNames,FItems.WriteNames,true);
|
|
||||||
end;
|
|
||||||
|
|
||||||
destructor TSpkPane.Destroy;
|
destructor TSpkPane.Destroy;
|
||||||
begin
|
begin
|
||||||
FItems.Free;
|
FItems.Free;
|
||||||
|
|
||||||
inherited Destroy;
|
inherited Destroy;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TSpkPane.SetRect(ARect: T2DIntRect);
|
||||||
|
var
|
||||||
|
Pt: T2DIntPoint;
|
||||||
|
i: integer;
|
||||||
|
Layout: TSpkPaneItemsLayout;
|
||||||
|
begin
|
||||||
|
FRect := ARect;
|
||||||
|
|
||||||
|
// Obliczamy layout
|
||||||
|
Layout := GenerateLayout;
|
||||||
|
|
||||||
|
{$IFDEF EnhancedRecordSupport}
|
||||||
|
Pt := T2DIntPoint.Create(
|
||||||
|
{$ELSE}
|
||||||
|
Pt.Create(
|
||||||
|
{$ENDIF}
|
||||||
|
ARect.Left + PaneBorderSize + PaneLeftPadding,
|
||||||
|
ARect.Top + PaneBorderSize
|
||||||
|
);
|
||||||
|
|
||||||
|
if Length(Layout.Rects) > 0 then
|
||||||
|
begin
|
||||||
|
for i := 0 to High(Layout.Rects) do
|
||||||
|
FItems[i].Rect:=Layout.Rects[i] + Pt;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TSpkPane.SetToolbarDispatch(const Value: TSpkBaseToolbarDispatch);
|
||||||
|
begin
|
||||||
|
FToolbarDispatch := Value;
|
||||||
|
FItems.ToolbarDispatch := FToolbarDispatch;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure TSpkPane.DefineProperties(Filer: TFiler);
|
||||||
|
begin
|
||||||
|
inherited DefineProperties(Filer);
|
||||||
|
Filer.DefineProperty('Items', FItems.ReadNames, FItems.WriteNames, true);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TSpkPane.Draw(ABuffer: TBitmap; ClipRect: T2DIntRect);
|
procedure TSpkPane.Draw(ABuffer: TBitmap; ClipRect: T2DIntRect);
|
||||||
var
|
var
|
||||||
x: Integer;
|
x: Integer;
|
||||||
@@ -238,6 +242,7 @@ begin
|
|||||||
// * Brak dyspozytora
|
// * Brak dyspozytora
|
||||||
if FToolbarDispatch = nil then
|
if FToolbarDispatch = nil then
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
// * Brak appearance
|
// * Brak appearance
|
||||||
if FAppearance = nil then
|
if FAppearance = nil then
|
||||||
exit;
|
exit;
|
||||||
@@ -429,13 +434,12 @@ begin
|
|||||||
// Elementy
|
// Elementy
|
||||||
for i := 0 to FItems.Count - 1 do
|
for i := 0 to FItems.Count - 1 do
|
||||||
if FItems[i].Visible then
|
if FItems[i].Visible then
|
||||||
Fitems[i].Draw(ABuffer, ClipRect);
|
FItems[i].Draw(ABuffer, ClipRect);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TSpkPane.FindItemAt(x, y: integer): integer;
|
function TSpkPane.FindItemAt(x, y: integer): integer;
|
||||||
|
var
|
||||||
var i : integer;
|
i: integer;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
result := -1;
|
result := -1;
|
||||||
i := FItems.count-1;
|
i := FItems.count-1;
|
||||||
@@ -448,7 +452,7 @@ while (i>=0) and (result=-1) do
|
|||||||
{$ELSE}
|
{$ELSE}
|
||||||
if FItems[i].Rect.Contains(x,y) then
|
if FItems[i].Rect.Contains(x,y) then
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
result:=i;
|
Result := i;
|
||||||
end;
|
end;
|
||||||
dec(i);
|
dec(i);
|
||||||
end;
|
end;
|
||||||
@@ -460,12 +464,12 @@ FItems.RemoveReference(AItem);
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
function TSpkPane.GenerateLayout: TSpkPaneItemsLayout;
|
function TSpkPane.GenerateLayout: TSpkPaneItemsLayout;
|
||||||
|
type
|
||||||
type TLayoutRow = array of integer;
|
TLayoutRow = array of integer;
|
||||||
TLayoutColumn = array of TLayoutRow;
|
TLayoutColumn = array of TLayoutRow;
|
||||||
TLayout = array of TLayoutColumn;
|
TLayout = array of TLayoutColumn;
|
||||||
|
var
|
||||||
var Layout : TLayout;
|
Layout: TLayout;
|
||||||
CurrentColumn: integer;
|
CurrentColumn: integer;
|
||||||
CurrentRow: integer;
|
CurrentRow: integer;
|
||||||
CurrentItem: integer;
|
CurrentItem: integer;
|
||||||
@@ -480,30 +484,29 @@ var Layout : TLayout;
|
|||||||
rows: Integer;
|
rows: Integer;
|
||||||
ItemWidth: Integer;
|
ItemWidth: Integer;
|
||||||
tmpRect: T2DIntRect;
|
tmpRect: T2DIntRect;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
setlength(result.Rects,FItems.count);
|
SetLength(Result.Rects, FItems.count);
|
||||||
result.Width:=0;
|
Result.Width := 0;
|
||||||
|
|
||||||
if FItems.count=0 then
|
if FItems.Count = 0 then
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
// Notatka: algorytm jest skonstruowany w ten sposób, ¿e trójka: CurrentColumn,
|
// Notatka: algorytm jest skonstruowany w ten sposób, ¿e trójka: CurrentColumn,
|
||||||
// CurrentRow oraz CurrentItem wskazuje na element, którego jeszcze nie
|
// CurrentRow oraz CurrentItem wskazuje na element, którego jeszcze nie
|
||||||
// ma (zaraz za ostatnio dodanym elementem).
|
// ma (zaraz za ostatnio dodanym elementem).
|
||||||
|
|
||||||
setlength(Layout,1);
|
SetLength(Layout, 1);
|
||||||
CurrentColumn := 0;
|
CurrentColumn := 0;
|
||||||
|
|
||||||
setlength(Layout[CurrentColumn],1);
|
SetLength(Layout[CurrentColumn], 1);
|
||||||
CurrentRow := 0;
|
CurrentRow := 0;
|
||||||
|
|
||||||
setlength(Layout[CurrentColumn][CurrentRow],0);
|
SetLength(Layout[CurrentColumn][CurrentRow], 0);
|
||||||
CurrentItem := 0;
|
CurrentItem := 0;
|
||||||
|
|
||||||
ForceNewColumn := false;
|
ForceNewColumn := false;
|
||||||
|
|
||||||
for i := 0 to FItems.count - 1 do
|
for i := 0 to FItems.Count - 1 do
|
||||||
begin
|
begin
|
||||||
ItemTableBehaviour := FItems[i].GetTableBehaviour;
|
ItemTableBehaviour := FItems[i].GetTableBehaviour;
|
||||||
ItemSize := FItems[i].GetSize;
|
ItemSize := FItems[i].GetSize;
|
||||||
@@ -518,13 +521,13 @@ for i := 0 to FItems.count - 1 do
|
|||||||
// Jeœli ju¿ jesteœmy na pocz¹tku nowej kolumny, nie ma nic do roboty.
|
// Jeœli ju¿ jesteœmy na pocz¹tku nowej kolumny, nie ma nic do roboty.
|
||||||
if (CurrentRow <> 0) or (CurrentItem <> 0) then
|
if (CurrentRow <> 0) or (CurrentItem <> 0) then
|
||||||
begin
|
begin
|
||||||
setlength(Layout, length(Layout)+1);
|
SetLength(Layout, Length(Layout)+1);
|
||||||
CurrentColumn:=high(Layout);
|
CurrentColumn := High(Layout);
|
||||||
|
|
||||||
setlength(Layout[CurrentColumn], 1);
|
SetLength(Layout[CurrentColumn], 1);
|
||||||
CurrentRow := 0;
|
CurrentRow := 0;
|
||||||
|
|
||||||
setlength(Layout[CurrentColumn][CurrentRow],0);
|
SetLength(Layout[CurrentColumn][CurrentRow], 0);
|
||||||
CurrentItem := 0;
|
CurrentItem := 0;
|
||||||
end;
|
end;
|
||||||
end else
|
end else
|
||||||
@@ -534,19 +537,19 @@ for i := 0 to FItems.count - 1 do
|
|||||||
// Jeœli ju¿ jesteœmy na pocz¹tku nowego wiersza, nie ma nic do roboty.
|
// Jeœli ju¿ jesteœmy na pocz¹tku nowego wiersza, nie ma nic do roboty.
|
||||||
if CurrentItem <> 0 then
|
if CurrentItem <> 0 then
|
||||||
begin
|
begin
|
||||||
setlength(Layout[CurrentColumn], length(Layout[CurrentColumn])+1);
|
SetLength(Layout[CurrentColumn], Length(Layout[CurrentColumn])+1);
|
||||||
inc(CurrentRow);
|
inc(CurrentRow);
|
||||||
CurrentItem := 0;
|
CurrentItem := 0;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
ForceNewColumn:=ItemSize = isLarge;
|
ForceNewColumn := (ItemSize = isLarge);
|
||||||
|
|
||||||
// Jeœli element jest widoczny, dodajemy go w aktualnej kolumnie i aktualnym
|
// Jeœli element jest widoczny, dodajemy go w aktualnej kolumnie i aktualnym
|
||||||
// wierszu.
|
// wierszu.
|
||||||
if FItems[i].Visible then
|
if FItems[i].Visible then
|
||||||
begin
|
begin
|
||||||
setlength(Layout[CurrentColumn][CurrentRow], length(Layout[CurrentColumn][CurrentRow])+1);
|
SetLength(Layout[CurrentColumn][CurrentRow], Length(Layout[CurrentColumn][CurrentRow])+1);
|
||||||
Layout[CurrentColumn][CurrentRow][CurrentItem] := i;
|
Layout[CurrentColumn][CurrentRow][CurrentItem] := i;
|
||||||
|
|
||||||
inc(CurrentItem);
|
inc(CurrentItem);
|
||||||
@@ -559,18 +562,17 @@ for i := 0 to FItems.count - 1 do
|
|||||||
// Najpierw wype³niamy je pustymi danymi, które zape³ni¹ miejsce elementów
|
// Najpierw wype³niamy je pustymi danymi, które zape³ni¹ miejsce elementów
|
||||||
// niewidocznych.
|
// niewidocznych.
|
||||||
{$IFDEF EnhancedRecordSupport}
|
{$IFDEF EnhancedRecordSupport}
|
||||||
for i := 0 to FItems.count - 1 do
|
for i := 0 to FItems.Count - 1 do
|
||||||
result.Rects[i]:=T2DIntRect.create(-1, -1, -1, -1);
|
Result.Rects[i] := T2DIntRect.Create(-1, -1, -1, -1);
|
||||||
{$ELSE}
|
{$ELSE}
|
||||||
for i := 0 to FItems.count - 1 do
|
for i := 0 to FItems.Count - 1 do
|
||||||
result.Rects[i].create(-1, -1, -1, -1);
|
Result.Rects[i].Create(-1, -1, -1, -1);
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
MaxRowX := 0;
|
MaxRowX := 0;
|
||||||
|
|
||||||
// Teraz iterujemy po layoucie, ustalaj¹c recty.
|
// Teraz iterujemy po layoucie, ustalaj¹c recty.
|
||||||
if length(Layout)>0 then
|
for c := 0 to High(Layout) do
|
||||||
for c := 0 to high(Layout) do
|
|
||||||
begin
|
begin
|
||||||
if c>0 then
|
if c>0 then
|
||||||
begin
|
begin
|
||||||
@@ -584,14 +586,12 @@ if length(Layout)>0 then
|
|||||||
|
|
||||||
ColumnX := LastX;
|
ColumnX := LastX;
|
||||||
|
|
||||||
rows:=length(Layout[c]);
|
rows := Length(Layout[c]);
|
||||||
if rows>0 then
|
|
||||||
for r := 0 to rows - 1 do
|
for r := 0 to rows - 1 do
|
||||||
begin
|
begin
|
||||||
LastX := ColumnX;
|
LastX := ColumnX;
|
||||||
|
|
||||||
if length(Layout[c][r])>0 then
|
for i := 0 to High(Layout[c][r]) do
|
||||||
for i := 0 to high(Layout[c][r]) do
|
|
||||||
begin
|
begin
|
||||||
ItemGroupBehaviour := FItems[Layout[c][r][i]].GetGroupBehaviour;
|
ItemGroupBehaviour := FItems[Layout[c][r][i]].GetGroupBehaviour;
|
||||||
ItemSize := FItems[Layout[c][r][i]].GetSize;
|
ItemSize := FItems[Layout[c][r][i]].GetSize;
|
||||||
@@ -599,12 +599,12 @@ if length(Layout)>0 then
|
|||||||
|
|
||||||
if ItemSize = isLarge then
|
if ItemSize = isLarge then
|
||||||
begin
|
begin
|
||||||
tmpRect.top:=PaneFullRowTopPadding;
|
tmpRect.Top := PaneFullRowTopPadding;
|
||||||
tmpRect.bottom:=tmpRect.top + PaneFullRowHeight - 1;
|
tmpRect.Bottom := tmpRect.Top + PaneFullRowHeight - 1;
|
||||||
tmpRect.left:=LastX;
|
tmpRect.Left := LastX;
|
||||||
tmpRect.right:=LastX + ItemWidth - 1;
|
tmpRect.Right := LastX + ItemWidth - 1;
|
||||||
|
|
||||||
LastX:=tmpRect.right + 1;
|
LastX := tmpRect.Right + 1;
|
||||||
if LastX > MaxRowX then
|
if LastX > MaxRowX then
|
||||||
MaxRowX := LastX;
|
MaxRowX := LastX;
|
||||||
end
|
end
|
||||||
@@ -613,50 +613,47 @@ if length(Layout)>0 then
|
|||||||
if ItemGroupBehaviour in [gbContinuesGroup, gbEndsGroup] then
|
if ItemGroupBehaviour in [gbContinuesGroup, gbEndsGroup] then
|
||||||
begin
|
begin
|
||||||
tmpRect.Left := LastX;
|
tmpRect.Left := LastX;
|
||||||
tmpRect.right:=tmpRect.Left + ItemWidth - 1;
|
tmpRect.Right := tmpRect.Left + ItemWidth - 1;
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
// Jeœli element nie jest pierwszy, musi zostaæ
|
// Jeœli element nie jest pierwszy, musi zostaæ
|
||||||
// odsuniêty marginesem od poprzedniego
|
// odsuniêty marginesem od poprzedniego
|
||||||
if i>0 then
|
if i>0 then
|
||||||
tmpRect.Left:=LastX + PaneGroupSpacer else
|
tmpRect.Left := LastX + PaneGroupSpacer
|
||||||
|
else
|
||||||
tmpRect.Left := LastX;
|
tmpRect.Left := LastX;
|
||||||
tmpRect.right:=tmpRect.Left + ItemWidth - 1;
|
tmpRect.Right := tmpRect.Left + ItemWidth - 1;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{$REGION 'Obliczanie tmpRect.top i bottom'}
|
{$REGION 'Obliczanie tmpRect.top i bottom'}
|
||||||
case rows of
|
case rows of
|
||||||
1 : begin
|
1 : begin
|
||||||
tmpRect.top:=PaneOneRowTopPadding;
|
tmpRect.Top := PaneOneRowTopPadding;
|
||||||
tmpRect.bottom:=tmpRect.top + PaneRowHeight - 1;
|
tmpRect.Bottom := tmpRect.Top + PaneRowHeight - 1;
|
||||||
end;
|
end;
|
||||||
2 : begin
|
2 : case r of
|
||||||
case r of
|
|
||||||
0 : begin
|
0 : begin
|
||||||
tmpRect.top:=PaneTwoRowsTopPadding;
|
tmpRect.Top := PaneTwoRowsTopPadding;
|
||||||
tmpRect.bottom:=tmpRect.top + PaneRowHeight - 1;
|
tmpRect.Bottom := tmpRect.top + PaneRowHeight - 1;
|
||||||
end;
|
end;
|
||||||
1 : begin
|
1 : begin
|
||||||
tmpRect.top:=PaneTwoRowsTopPadding + PaneRowHeight + PaneTwoRowsVSpacer;
|
tmpRect.Top := PaneTwoRowsTopPadding + PaneRowHeight + PaneTwoRowsVSpacer;
|
||||||
tmpRect.bottom:=tmpRect.top + PaneRowHeight - 1;
|
tmpRect.Bottom := tmpRect.top + PaneRowHeight - 1;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
3 : case r of
|
||||||
3 : begin
|
|
||||||
case r of
|
|
||||||
0 : begin
|
0 : begin
|
||||||
tmpRect.top:=PaneThreeRowsTopPadding;
|
tmpRect.Top := PaneThreeRowsTopPadding;
|
||||||
tmpRect.bottom:=tmpRect.top + PaneRowHeight - 1;
|
tmpRect.Bottom := tmpRect.Top + PaneRowHeight - 1;
|
||||||
end;
|
end;
|
||||||
1 : begin
|
1 : begin
|
||||||
tmpRect.top:=PaneThreeRowsTopPadding + PaneRowHeight + PaneThreeRowsVSpacer;
|
tmpRect.Top := PaneThreeRowsTopPadding + PaneRowHeight + PaneThreeRowsVSpacer;
|
||||||
tmpRect.bottom:=tmpRect.top + PaneRowHeight - 1;
|
tmpRect.Bottom := tmpRect.Top + PaneRowHeight - 1;
|
||||||
end;
|
end;
|
||||||
2 : begin
|
2 : begin
|
||||||
tmpRect.top:=PaneThreeRowsTopPadding + 2 * PaneRowHeight + 2 * PaneThreeRowsVSpacer;
|
tmpRect.Top := PaneThreeRowsTopPadding + 2 * PaneRowHeight + 2 * PaneThreeRowsVSpacer;
|
||||||
tmpRect.bottom:=tmpRect.top + PaneRowHeight - 1;
|
tmpRect.Bottom := tmpRect.Top + PaneRowHeight - 1;
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@@ -681,23 +678,20 @@ var
|
|||||||
i: Integer;
|
i: Integer;
|
||||||
begin
|
begin
|
||||||
inherited;
|
inherited;
|
||||||
|
|
||||||
if FItems.Count>0 then
|
|
||||||
for i := 0 to FItems.Count - 1 do
|
for i := 0 to FItems.Count - 1 do
|
||||||
Proc(FItems.Items[i]);
|
Proc(FItems.Items[i]);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TSpkPane.GetWidth: integer;
|
function TSpkPane.GetWidth: integer;
|
||||||
|
var
|
||||||
var tmpBitmap : TBitmap;
|
tmpBitmap: TBitmap;
|
||||||
PaneCaptionWidth, PaneElementsWidth: integer;
|
PaneCaptionWidth, PaneElementsWidth: integer;
|
||||||
TextW: integer;
|
TextW: integer;
|
||||||
ElementsW: integer;
|
ElementsW: integer;
|
||||||
Layout: TSpkPaneItemsLayout;
|
Layout: TSpkPaneItemsLayout;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
// Przygotowywanie...
|
// Przygotowywanie...
|
||||||
result:=-1;
|
Result := -1;
|
||||||
if FToolbarDispatch = nil then
|
if FToolbarDispatch = nil then
|
||||||
exit;
|
exit;
|
||||||
if FAppearance = nil then
|
if FAppearance = nil then
|
||||||
@@ -706,7 +700,7 @@ if FAppearance=nil then
|
|||||||
tmpBitmap := FToolbarDispatch.GetTempBitmap;
|
tmpBitmap := FToolbarDispatch.GetTempBitmap;
|
||||||
if tmpBitmap = nil then
|
if tmpBitmap = nil then
|
||||||
exit;
|
exit;
|
||||||
tmpBitmap.Canvas.font.assign(FAppearance.Pane.CaptionFont);
|
tmpBitmap.Canvas.Font.Assign(FAppearance.Pane.CaptionFont);
|
||||||
|
|
||||||
// *** Minimalna szerokoϾ tafli (tekstu) ***
|
// *** Minimalna szerokoϾ tafli (tekstu) ***
|
||||||
TextW := tmpBitmap.Canvas.TextWidth(FCaption);
|
TextW := tmpBitmap.Canvas.TextWidth(FCaption);
|
||||||
@@ -718,7 +712,7 @@ ElementsW:=Layout.Width;
|
|||||||
PaneElementsWidth := PaneBorderSize + PaneLeftPadding + ElementsW + PaneRightPadding + PaneBorderSize;
|
PaneElementsWidth := PaneBorderSize + PaneLeftPadding + ElementsW + PaneRightPadding + PaneBorderSize;
|
||||||
|
|
||||||
// *** Ustawianie szerokoœci tafli ***
|
// *** Ustawianie szerokoœci tafli ***
|
||||||
result:=max(PaneCaptionWidth, PaneElementsWidth);
|
Result := Max(PaneCaptionWidth, PaneElementsWidth);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSpkPane.Loaded;
|
procedure TSpkPane.Loaded;
|
||||||
@@ -728,8 +722,8 @@ begin
|
|||||||
FItems.ProcessNames(self.Owner);
|
FItems.ProcessNames(self.Owner);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSpkPane.MouseDown(Button: TMouseButton; Shift: TShiftState; X,
|
procedure TSpkPane.MouseDown(Button: TMouseButton; Shift: TShiftState;
|
||||||
Y: Integer);
|
X, Y: Integer);
|
||||||
begin
|
begin
|
||||||
if FMouseActiveElement.ElementType = peItem then
|
if FMouseActiveElement.ElementType = peItem then
|
||||||
begin
|
begin
|
||||||
@@ -748,7 +742,6 @@ if FMouseActiveElement.ElementType = peNone then
|
|||||||
begin
|
begin
|
||||||
FMouseActiveElement.ElementType := peItem;
|
FMouseActiveElement.ElementType := peItem;
|
||||||
FMouseActiveElement.ElementIndex := FMouseHoverElement.ElementIndex;
|
FMouseActiveElement.ElementIndex := FMouseHoverElement.ElementIndex;
|
||||||
|
|
||||||
FItems[FMouseHoverElement.ElementIndex].MouseDown(Button, Shift, X, Y);
|
FItems[FMouseHoverElement.ElementIndex].MouseDown(Button, Shift, X, Y);
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
@@ -761,7 +754,6 @@ if FMouseActiveElement.ElementType = peNone then
|
|||||||
begin
|
begin
|
||||||
FMouseActiveElement.ElementType := pePaneArea;
|
FMouseActiveElement.ElementType := pePaneArea;
|
||||||
FMouseActiveElement.ElementIndex := -1;
|
FMouseActiveElement.ElementIndex := -1;
|
||||||
|
|
||||||
// Placeholder, jeœli zajdzie potrzeba obs³ugi tego zdarzenia.
|
// Placeholder, jeœli zajdzie potrzeba obs³ugi tego zdarzenia.
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@@ -790,16 +782,15 @@ FMouseHoverElement.ElementIndex:=-1;
|
|||||||
if FPaneState <> psIdle then
|
if FPaneState <> psIdle then
|
||||||
begin
|
begin
|
||||||
FPaneState := psIdle;
|
FPaneState := psIdle;
|
||||||
if assigned(FToolbarDispatch) then
|
if Assigned(FToolbarDispatch) then
|
||||||
FToolbarDispatch.NotifyVisualsChanged;
|
FToolbarDispatch.NotifyVisualsChanged;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSpkPane.MouseMove(Shift: TShiftState; X, Y: Integer);
|
procedure TSpkPane.MouseMove(Shift: TShiftState; X, Y: Integer);
|
||||||
|
var
|
||||||
var i : integer;
|
i: integer;
|
||||||
NewMouseHoverElement: TSpkMousePaneElement;
|
NewMouseHoverElement: TSpkMousePaneElement;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
// MouseMove jest wywo³ywany tylko, gdy tafla jest aktywna, b¹dŸ gdy
|
// MouseMove jest wywo³ywany tylko, gdy tafla jest aktywna, b¹dŸ gdy
|
||||||
// mysz rusza siê wewn¹trz jej obszaru. Wobec tego zawsze nale¿y
|
// mysz rusza siê wewn¹trz jej obszaru. Wobec tego zawsze nale¿y
|
||||||
@@ -808,19 +799,19 @@ begin
|
|||||||
if FPaneState = psIdle then
|
if FPaneState = psIdle then
|
||||||
begin
|
begin
|
||||||
FPaneState := psHover;
|
FPaneState := psHover;
|
||||||
if assigned(FToolbarDispatch) then
|
if Assigned(FToolbarDispatch) then
|
||||||
FToolbarDispatch.NotifyVisualsChanged;
|
FToolbarDispatch.NotifyVisualsChanged;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// Szukamy obiektu pod mysz¹
|
// Szukamy obiektu pod mysz¹
|
||||||
i:=FindItemAt(x, y);
|
i := FindItemAt(X, Y);
|
||||||
if i <> -1 then
|
if i <> -1 then
|
||||||
begin
|
begin
|
||||||
NewMouseHoverElement.ElementType := peItem;
|
NewMouseHoverElement.ElementType := peItem;
|
||||||
NewMouseHoverElement.ElementIndex := i;
|
NewMouseHoverElement.ElementIndex := i;
|
||||||
end else
|
end else
|
||||||
if (X>=FRect.left) and (Y>=FRect.top) and
|
if (X >= FRect.Left) and (Y >= FRect.Top) and
|
||||||
(X<=FRect.right) and (Y<=FRect.bottom) then
|
(X <= FRect.Right) and (Y <= FRect.Bottom) then
|
||||||
begin
|
begin
|
||||||
NewMouseHoverElement.ElementType := pePaneArea;
|
NewMouseHoverElement.ElementType := pePaneArea;
|
||||||
NewMouseHoverElement.ElementIndex := -1;
|
NewMouseHoverElement.ElementIndex := -1;
|
||||||
@@ -871,11 +862,10 @@ if FMouseActiveElement.ElementType = peNone then
|
|||||||
FMouseHoverElement := NewMouseHoverElement;
|
FMouseHoverElement := NewMouseHoverElement;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSpkPane.MouseUp(Button: TMouseButton; Shift: TShiftState; X,
|
procedure TSpkPane.MouseUp(Button: TMouseButton; Shift: TShiftState;
|
||||||
Y: Integer);
|
X, Y: Integer);
|
||||||
|
var
|
||||||
var ClearActive : boolean;
|
ClearActive: boolean;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
ClearActive := not (ssLeft in Shift) and not (ssMiddle in Shift) and not (ssRight in Shift);
|
ClearActive := not (ssLeft in Shift) and not (ssMiddle in Shift) and not (ssRight in Shift);
|
||||||
|
|
||||||
@@ -917,7 +907,7 @@ if ClearActive and
|
|||||||
if FPaneState <> psIdle then
|
if FPaneState <> psIdle then
|
||||||
begin
|
begin
|
||||||
FPaneState := psIdle;
|
FPaneState := psIdle;
|
||||||
if assigned(FToolbarDispatch) then
|
if Assigned(FToolbarDispatch) then
|
||||||
FToolbarDispatch.NotifyVisualsChanged;
|
FToolbarDispatch.NotifyVisualsChanged;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@@ -939,7 +929,7 @@ end;
|
|||||||
procedure TSpkPane.SetCaption(const Value: string);
|
procedure TSpkPane.SetCaption(const Value: string);
|
||||||
begin
|
begin
|
||||||
FCaption := Value;
|
FCaption := Value;
|
||||||
if assigned(FToolbarDispatch) then
|
if Assigned(FToolbarDispatch) then
|
||||||
FToolbarDispatch.NotifyMetricsChanged;
|
FToolbarDispatch.NotifyMetricsChanged;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@@ -970,11 +960,11 @@ end;
|
|||||||
procedure TSpkPane.SetVisible(const Value: boolean);
|
procedure TSpkPane.SetVisible(const Value: boolean);
|
||||||
begin
|
begin
|
||||||
FVisible := Value;
|
FVisible := Value;
|
||||||
|
if Assigned(FToolbarDispatch) then
|
||||||
if assigned(FToolbarDispatch) then
|
|
||||||
FToolbarDispatch.NotifyItemsChanged;
|
FToolbarDispatch.NotifyItemsChanged;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
{ TSpkPanes }
|
{ TSpkPanes }
|
||||||
|
|
||||||
function TSpkPanes.Add: TSpkPane;
|
function TSpkPanes.Add: TSpkPane;
|
||||||
@@ -984,57 +974,53 @@ begin
|
|||||||
AddItem(Result);
|
AddItem(Result);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TSpkPanes.GetItems(index: integer): TSpkPane;
|
function TSpkPanes.GetItems(AIndex: integer): TSpkPane;
|
||||||
begin
|
begin
|
||||||
result:=TSpkPane(inherited Items[index]);
|
Result := TSpkPane(inherited Items[AIndex]);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TSpkPanes.Insert(index: integer): TSpkPane;
|
function TSpkPanes.Insert(AIndex: integer): TSpkPane;
|
||||||
|
var
|
||||||
var Owner, Parent : TComponent;
|
lOwner, lParent: TComponent;
|
||||||
i: Integer;
|
i: Integer;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
if (index<0) or (index>self.Count) then
|
if (AIndex < 0) or (AIndex > self.Count) then
|
||||||
raise InternalException.create('TSpkPanes.Insert: Nieprawid³owy indeks!');
|
raise InternalException.Create('TSpkPanes.Insert: Nieprawid³owy indeks!');
|
||||||
|
|
||||||
if FRootComponent<>nil then
|
if FRootComponent<>nil then
|
||||||
begin
|
begin
|
||||||
Owner:=FRootComponent.Owner;
|
lOwner := FRootComponent.Owner;
|
||||||
Parent:=FRootComponent;
|
lParent := FRootComponent;
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
Owner:=nil;
|
lOwner := nil;
|
||||||
Parent:=nil;
|
lParent := nil;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
result:=TSpkPane.Create(Owner);
|
Result := TSpkPane.Create(lOwner);
|
||||||
result.Parent:=Parent;
|
Result.Parent := lParent;
|
||||||
|
|
||||||
if FRootComponent <> nil then
|
if FRootComponent <> nil then
|
||||||
begin
|
begin
|
||||||
i := 0;
|
i := 0;
|
||||||
while FRootComponent.Owner.FindComponent('SpkPane'+inttostr(i))<>nil do
|
while FRootComponent.Owner.FindComponent('SpkPane'+IntToStr(i)) <> nil do
|
||||||
inc(i);
|
inc(i);
|
||||||
|
Result.Name := 'SpkPane' + IntToStr(i);
|
||||||
result.Name:='SpkPane'+inttostr(i);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
InsertItem(index,result);
|
InsertItem(AIndex, Result);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSpkPanes.Notify(Item: TComponent;
|
procedure TSpkPanes.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:
|
||||||
|
begin
|
||||||
// Ustawienie dyspozytora na nil spowoduje, ¿e podczas
|
// Ustawienie dyspozytora na nil spowoduje, ¿e podczas
|
||||||
// przypisywania w³asnoœci nie bêd¹ wo³ane metody Notify*
|
// przypisywania w³asnoœci nie bêd¹ wo³ane metody Notify*
|
||||||
TSpkPane(Item).ToolbarDispatch := nil;
|
TSpkPane(Item).ToolbarDispatch := nil;
|
||||||
|
|
||||||
TSpkPane(Item).Appearance := FAppearance;
|
TSpkPane(Item).Appearance := FAppearance;
|
||||||
TSpkPane(Item).Images := FImages;
|
TSpkPane(Item).Images := FImages;
|
||||||
TSpkPane(Item).DisabledImages := FDisabledImages;
|
TSpkPane(Item).DisabledImages := FDisabledImages;
|
||||||
@@ -1042,7 +1028,7 @@ begin
|
|||||||
TSpkPane(Item).DisabledLargeImages := FDisabledLargeImages;
|
TSpkPane(Item).DisabledLargeImages := FDisabledLargeImages;
|
||||||
TSpkPane(Item).ToolbarDispatch := FToolbarDispatch;
|
TSpkPane(Item).ToolbarDispatch := FToolbarDispatch;
|
||||||
end;
|
end;
|
||||||
opRemove: begin
|
opRemove:
|
||||||
if not(csDestroying in Item.ComponentState) then
|
if not(csDestroying in Item.ComponentState) then
|
||||||
begin
|
begin
|
||||||
TSpkPane(Item).ToolbarDispatch := nil;
|
TSpkPane(Item).ToolbarDispatch := nil;
|
||||||
@@ -1054,15 +1040,13 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TSpkPanes.SetImages(const Value: TImageList);
|
procedure TSpkPanes.SetImages(const Value: TImageList);
|
||||||
var
|
var
|
||||||
I: Integer;
|
I: Integer;
|
||||||
begin
|
begin
|
||||||
FImages := Value;
|
FImages := Value;
|
||||||
if self.Count>0 then
|
for I := 0 to self.Count - 1 do
|
||||||
for I := 0 to self.count - 1 do
|
|
||||||
Items[i].Images := Value;
|
Items[i].Images := Value;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@@ -1071,63 +1055,52 @@ var
|
|||||||
I: Integer;
|
I: Integer;
|
||||||
begin
|
begin
|
||||||
FLargeImages := Value;
|
FLargeImages := Value;
|
||||||
if self.Count>0 then
|
for I := 0 to self.Count - 1 do
|
||||||
for I := 0 to self.count - 1 do
|
|
||||||
Items[i].LargeImages := Value;
|
Items[i].LargeImages := Value;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSpkPanes.SetToolbarDispatch(const Value: TSpkBaseToolbarDispatch);
|
procedure TSpkPanes.SetToolbarDispatch(const Value: TSpkBaseToolbarDispatch);
|
||||||
|
var
|
||||||
var i : integer;
|
i: integer;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
FToolbarDispatch := Value;
|
FToolbarDispatch := Value;
|
||||||
if self.Count>0 then
|
for i := 0 to self.Count - 1 do
|
||||||
for i := 0 to self.count - 1 do
|
|
||||||
Items[i].ToolbarDispatch := FToolbarDispatch;
|
Items[i].ToolbarDispatch := FToolbarDispatch;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSpkPanes.SetAppearance(const Value: TSpkToolbarAppearance);
|
procedure TSpkPanes.SetAppearance(const Value: TSpkToolbarAppearance);
|
||||||
|
var
|
||||||
var i: Integer;
|
i: Integer;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
FAppearance := Value;
|
FAppearance := Value;
|
||||||
if self.Count>0 then
|
for i := 0 to self.Count - 1 do
|
||||||
for i := 0 to self.count - 1 do
|
|
||||||
Items[i].Appearance := FAppearance;
|
Items[i].Appearance := FAppearance;
|
||||||
|
|
||||||
if FToolbarDispatch <> nil then
|
if FToolbarDispatch <> nil then
|
||||||
FToolbarDispatch.NotifyMetricsChanged;
|
FToolbarDispatch.NotifyMetricsChanged;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSpkPanes.SetDisabledImages(const Value: TImageList);
|
procedure TSpkPanes.SetDisabledImages(const Value: TImageList);
|
||||||
|
var
|
||||||
var I: Integer;
|
I: Integer;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
FDisabledImages := Value;
|
FDisabledImages := Value;
|
||||||
if self.Count>0 then
|
for I := 0 to self.Count - 1 do
|
||||||
for I := 0 to self.count - 1 do
|
|
||||||
Items[i].DisabledImages := Value;
|
Items[i].DisabledImages := Value;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSpkPanes.SetDisabledLargeImages(const Value: TImageList);
|
procedure TSpkPanes.SetDisabledLargeImages(const Value: TImageList);
|
||||||
|
|
||||||
var
|
var
|
||||||
I: Integer;
|
I: Integer;
|
||||||
begin
|
begin
|
||||||
FDisabledLargeImages := Value;
|
FDisabledLargeImages := Value;
|
||||||
if self.Count>0 then
|
for I := 0 to self.Count - 1 do
|
||||||
for I := 0 to self.count - 1 do
|
|
||||||
Items[i].DisabledLargeImages := Value;
|
Items[i].DisabledLargeImages := Value;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSpkPanes.Update;
|
procedure TSpkPanes.Update;
|
||||||
begin
|
begin
|
||||||
inherited Update;
|
inherited Update;
|
||||||
|
if Assigned(FToolbarDispatch) then
|
||||||
if assigned(FToolbarDispatch) then
|
|
||||||
FToolbarDispatch.NotifyItemsChanged;
|
FToolbarDispatch.NotifyItemsChanged;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@@ -15,12 +15,14 @@ unit spkt_Tab;
|
|||||||
|
|
||||||
interface
|
interface
|
||||||
|
|
||||||
uses Graphics, Controls, Classes, SysUtils,
|
uses
|
||||||
|
Graphics, Controls, Classes, SysUtils,
|
||||||
SpkMath,
|
SpkMath,
|
||||||
spkt_Appearance, spkt_Const, spkt_Dispatch, spkt_Exceptions,
|
spkt_Appearance, spkt_Const, spkt_Dispatch, spkt_Exceptions,
|
||||||
spkt_Pane, spkt_Types;
|
spkt_Pane, spkt_Types;
|
||||||
|
|
||||||
type TSpkTab = class;
|
type
|
||||||
|
TSpkTab = class;
|
||||||
|
|
||||||
TSpkMouseTabElementType = (etNone, etTabArea, etPane);
|
TSpkMouseTabElementType = (etNone, etTabArea, etPane);
|
||||||
|
|
||||||
@@ -32,7 +34,6 @@ type TSpkTab = class;
|
|||||||
TSpkTabAppearanceDispatch = class(TSpkBaseAppearanceDispatch)
|
TSpkTabAppearanceDispatch = class(TSpkBaseAppearanceDispatch)
|
||||||
private
|
private
|
||||||
FTab: TSpkTab;
|
FTab: TSpkTab;
|
||||||
protected
|
|
||||||
public
|
public
|
||||||
// *** Konstruktor ***
|
// *** Konstruktor ***
|
||||||
constructor Create(ATab: TSpkTab);
|
constructor Create(ATab: TSpkTab);
|
||||||
@@ -45,10 +46,8 @@ type TSpkTab = class;
|
|||||||
private
|
private
|
||||||
FAppearanceDispatch: TSpkTabAppearanceDispatch;
|
FAppearanceDispatch: TSpkTabAppearanceDispatch;
|
||||||
FAppearance: TSpkToolbarAppearance;
|
FAppearance: TSpkToolbarAppearance;
|
||||||
|
|
||||||
FMouseHoverElement: TSpkMouseTabElement;
|
FMouseHoverElement: TSpkMouseTabElement;
|
||||||
FMouseActiveElement: TSpkMouseTabElement;
|
FMouseActiveElement: TSpkMouseTabElement;
|
||||||
|
|
||||||
FOnClick: TNotifyEvent;
|
FOnClick: TNotifyEvent;
|
||||||
|
|
||||||
protected
|
protected
|
||||||
@@ -57,10 +56,8 @@ type TSpkTab = class;
|
|||||||
FVisible: boolean;
|
FVisible: boolean;
|
||||||
FOverrideAppearance: boolean;
|
FOverrideAppearance: boolean;
|
||||||
FCustomAppearance: TSpkToolbarAppearance;
|
FCustomAppearance: TSpkToolbarAppearance;
|
||||||
|
|
||||||
FPanes: TSpkPanes;
|
FPanes: TSpkPanes;
|
||||||
FRect: T2DIntRect;
|
FRect: T2DIntRect;
|
||||||
|
|
||||||
FImages: TImageList;
|
FImages: TImageList;
|
||||||
FDisabledImages: TImageList;
|
FDisabledImages: TImageList;
|
||||||
FLargeImages: TImageList;
|
FLargeImages: TImageList;
|
||||||
@@ -89,6 +86,7 @@ type TSpkTab = class;
|
|||||||
procedure SetDisabledLargeImages(const Value: TImageList);
|
procedure SetDisabledLargeImages(const Value: TImageList);
|
||||||
procedure SetRect(ARect: T2DIntRect);
|
procedure SetRect(ARect: T2DIntRect);
|
||||||
procedure SetToolbarDispatch(const Value: TSpkBaseToolbarDispatch);
|
procedure SetToolbarDispatch(const Value: TSpkBaseToolbarDispatch);
|
||||||
|
|
||||||
public
|
public
|
||||||
// *** Konstruktor, destruktor ***
|
// *** Konstruktor, destruktor ***
|
||||||
constructor Create(AOwner: TComponent); override;
|
constructor Create(AOwner: TComponent); override;
|
||||||
@@ -100,11 +98,9 @@ type TSpkTab = class;
|
|||||||
|
|
||||||
// *** Obs³uga gryzonia ***
|
// *** Obs³uga gryzonia ***
|
||||||
procedure MouseLeave;
|
procedure MouseLeave;
|
||||||
procedure MouseDown(Button: TMouseButton; Shift: TShiftState;
|
procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
||||||
X, Y: Integer);
|
|
||||||
procedure MouseMove(Shift: TShiftState; X, Y: Integer);
|
procedure MouseMove(Shift: TShiftState; X, Y: Integer);
|
||||||
procedure MouseUp(Button: TMouseButton; Shift: TShiftState;
|
procedure MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
||||||
X, Y: Integer);
|
|
||||||
|
|
||||||
// *** Obs³uga zdarzeñ dyspozytora ***
|
// *** Obs³uga zdarzeñ dyspozytora ***
|
||||||
procedure NotifyAppearanceChanged;
|
procedure NotifyAppearanceChanged;
|
||||||
@@ -116,13 +112,13 @@ type TSpkTab = class;
|
|||||||
|
|
||||||
property ToolbarDispatch: TSpkBaseToolbarDispatch read FToolbarDispatch write SetToolbarDispatch;
|
property ToolbarDispatch: TSpkBaseToolbarDispatch read FToolbarDispatch write SetToolbarDispatch;
|
||||||
property Appearance: TSpkToolbarAppearance read FAppearance write SetAppearance;
|
property Appearance: TSpkToolbarAppearance read FAppearance write SetAppearance;
|
||||||
|
|
||||||
property Panes: TSpkPanes read FPanes;
|
property Panes: TSpkPanes read FPanes;
|
||||||
property Rect: T2DIntRect read FRect write SetRect;
|
property Rect: T2DIntRect read FRect write SetRect;
|
||||||
property Images: TImageList read FImages write SetImages;
|
property Images: TImageList read FImages write SetImages;
|
||||||
property DisabledImages: TImageList read FDisabledImages write SetDisabledImages;
|
property DisabledImages: TImageList read FDisabledImages write SetDisabledImages;
|
||||||
property LargeImages: TImageList read FLargeImages write SetLargeImages;
|
property LargeImages: TImageList read FLargeImages write SetLargeImages;
|
||||||
property DisabledLargeImages: TImageList read FDisabledLargeImages write SetDisabledLargeImages;
|
property DisabledLargeImages: TImageList read FDisabledLargeImages write SetDisabledLargeImages;
|
||||||
|
|
||||||
published
|
published
|
||||||
property CustomAppearance: TSpkToolbarAppearance read FCustomAppearance write SetCustomAppearance;
|
property CustomAppearance: TSpkToolbarAppearance read FCustomAppearance write SetCustomAppearance;
|
||||||
property Caption: string read FCaption write SetCaption;
|
property Caption: string read FCaption write SetCaption;
|
||||||
@@ -131,8 +127,7 @@ type TSpkTab = class;
|
|||||||
property OnClick: TNotifyEvent read FOnClick write FOnClick;
|
property OnClick: TNotifyEvent read FOnClick write FOnClick;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
type TSpkTabs = class(TSpkCollection)
|
TSpkTabs = class(TSpkCollection)
|
||||||
private
|
|
||||||
protected
|
protected
|
||||||
FToolbarDispatch: TSpkBaseToolbarDispatch;
|
FToolbarDispatch: TSpkBaseToolbarDispatch;
|
||||||
FAppearance: TSpkToolbarAppearance;
|
FAppearance: TSpkToolbarAppearance;
|
||||||
@@ -140,9 +135,8 @@ type TSpkTabs = class(TSpkCollection)
|
|||||||
FDisabledImages: TImageList;
|
FDisabledImages: TImageList;
|
||||||
FLargeImages: TImageList;
|
FLargeImages: TImageList;
|
||||||
FDisabledLargeImages: TImageList;
|
FDisabledLargeImages: TImageList;
|
||||||
|
|
||||||
procedure SetToolbarDispatch(const Value: TSpkBaseToolbarDispatch);
|
procedure SetToolbarDispatch(const Value: TSpkBaseToolbarDispatch);
|
||||||
function GetItems(index: integer): TSpkTab; reintroduce;
|
function GetItems(AIndex: integer): TSpkTab; 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);
|
||||||
@@ -150,8 +144,7 @@ type TSpkTabs = class(TSpkCollection)
|
|||||||
procedure SetDisabledLargeImages(const Value: TImageList);
|
procedure SetDisabledLargeImages(const Value: TImageList);
|
||||||
public
|
public
|
||||||
function Add: TSpkTab;
|
function Add: TSpkTab;
|
||||||
function Insert(index : integer) : TSpkTab;
|
function Insert(AIndex: integer): TSpkTab;
|
||||||
|
|
||||||
procedure Notify(Item: TComponent; Operation: TOperation); override;
|
procedure Notify(Item: TComponent; Operation: TOperation); override;
|
||||||
procedure Update; override;
|
procedure Update; override;
|
||||||
|
|
||||||
@@ -164,6 +157,7 @@ type TSpkTabs = class(TSpkCollection)
|
|||||||
property DisabledLargeImages: TImageList read FDisabledLargeImages write SetDisabledLargeImages;
|
property DisabledLargeImages: TImageList read FDisabledLargeImages write SetDisabledLargeImages;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
{ TSpkTabDispatch }
|
{ TSpkTabDispatch }
|
||||||
@@ -176,124 +170,110 @@ end;
|
|||||||
|
|
||||||
procedure TSpkTabAppearanceDispatch.NotifyAppearanceChanged;
|
procedure TSpkTabAppearanceDispatch.NotifyAppearanceChanged;
|
||||||
begin
|
begin
|
||||||
if assigned(FTab) then
|
if Assigned(FTab) then
|
||||||
FTab.NotifyAppearanceChanged;
|
FTab.NotifyAppearanceChanged;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
{ TSpkTab }
|
{ TSpkTab }
|
||||||
|
|
||||||
function TSpkTab.AtLeastOnePaneVisible: boolean;
|
|
||||||
|
|
||||||
var i : integer;
|
|
||||||
PaneVisible : boolean;
|
|
||||||
|
|
||||||
begin
|
|
||||||
result:=FPanes.count>0;
|
|
||||||
if result then
|
|
||||||
begin
|
|
||||||
PaneVisible:=false;
|
|
||||||
i:=FPanes.count-1;
|
|
||||||
while (i>=0) and not(PaneVisible) do
|
|
||||||
begin
|
|
||||||
PaneVisible:=FPanes[i].Visible;
|
|
||||||
dec(i);
|
|
||||||
end;
|
|
||||||
result:=result and PaneVisible;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TSpkTab.SetRect(ARect: T2DIntRect);
|
|
||||||
|
|
||||||
var x, i : integer;
|
|
||||||
tw : integer;
|
|
||||||
tmpRect : T2DIntRect;
|
|
||||||
|
|
||||||
begin
|
|
||||||
FRect:=ARect;
|
|
||||||
|
|
||||||
if AtLeastOnePaneVisible then
|
|
||||||
begin
|
|
||||||
x:=ARect.left;
|
|
||||||
for i := 0 to FPanes.count - 1 do
|
|
||||||
if FPanes[i].Visible then
|
|
||||||
begin
|
|
||||||
tw:=FPanes[i].GetWidth;
|
|
||||||
|
|
||||||
tmpRect.Left:=x;
|
|
||||||
tmpRect.top:=ARect.Top;
|
|
||||||
tmpRect.right:=x + tw - 1;
|
|
||||||
tmpRect.bottom:=ARect.bottom;
|
|
||||||
|
|
||||||
FPanes[i].Rect:=tmpRect;
|
|
||||||
|
|
||||||
x:=x + tw + TabPaneHSpacing;
|
|
||||||
end
|
|
||||||
else
|
|
||||||
begin
|
|
||||||
{$IFDEF EnhancedRecordSupport}
|
|
||||||
FPanes[i].Rect:=T2DIntRect.create(-1,-1,-1,-1);
|
|
||||||
{$ELSE}
|
|
||||||
FPanes[i].Rect.create(-1,-1,-1,-1);
|
|
||||||
{$ENDIF}
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TSpkTab.SetToolbarDispatch(const Value: TSpkBaseToolbarDispatch);
|
|
||||||
|
|
||||||
begin
|
|
||||||
FToolbarDispatch := Value;
|
|
||||||
FPanes.ToolbarDispatch:=FToolbarDispatch;
|
|
||||||
end;
|
|
||||||
|
|
||||||
constructor TSpkTab.Create(AOwner: TComponent);
|
constructor TSpkTab.Create(AOwner: TComponent);
|
||||||
begin
|
begin
|
||||||
inherited Create(AOwner);
|
inherited Create(AOwner);
|
||||||
|
FAppearanceDispatch := TSpkTabAppearanceDispatch.Create(self);
|
||||||
FAppearanceDispatch:=TSpkTabAppearanceDispatch.create(self);
|
|
||||||
FMouseHoverElement.ElementType := etNone;
|
FMouseHoverElement.ElementType := etNone;
|
||||||
FMouseHoverElement.ElementIndex := -1;
|
FMouseHoverElement.ElementIndex := -1;
|
||||||
FMouseActiveElement.ElementType := etNone;
|
FMouseActiveElement.ElementType := etNone;
|
||||||
FMouseActiveElement.ElementIndex := -1;
|
FMouseActiveElement.ElementIndex := -1;
|
||||||
|
|
||||||
FCaption := 'Tab';
|
FCaption := 'Tab';
|
||||||
FVisible := true;
|
FVisible := true;
|
||||||
FCustomAppearance := TSpkToolbarAppearance.Create(FAppearanceDispatch);
|
FCustomAppearance := TSpkToolbarAppearance.Create(FAppearanceDispatch);
|
||||||
|
|
||||||
FPanes := TSpkPanes.Create(self);
|
FPanes := TSpkPanes.Create(self);
|
||||||
FPanes.ToolbarDispatch := FToolbarDispatch;
|
FPanes.ToolbarDispatch := FToolbarDispatch;
|
||||||
|
|
||||||
{$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}
|
||||||
|
|
||||||
|
|
||||||
SetPaneAppearance;
|
SetPaneAppearance;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSpkTab.DefineProperties(Filer: TFiler);
|
|
||||||
begin
|
|
||||||
inherited DefineProperties(Filer);
|
|
||||||
|
|
||||||
Filer.DefineProperty('Panes',FPanes.ReadNames,FPanes.WriteNames,true);
|
|
||||||
end;
|
|
||||||
|
|
||||||
destructor TSpkTab.Destroy;
|
destructor TSpkTab.Destroy;
|
||||||
begin
|
begin
|
||||||
FPanes.Free;
|
FPanes.Free;
|
||||||
FCustomAppearance.Free;
|
FCustomAppearance.Free;
|
||||||
FAppearanceDispatch.Free;
|
FAppearanceDispatch.Free;
|
||||||
|
|
||||||
inherited Destroy;
|
inherited Destroy;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSpkTab.Draw(ABuffer: TBitmap; AClipRect: T2DIntRect);
|
function TSpkTab.AtLeastOnePaneVisible: boolean;
|
||||||
|
var
|
||||||
var LocalClipRect : T2DIntRect;
|
|
||||||
i: integer;
|
i: integer;
|
||||||
|
PaneVisible: boolean;
|
||||||
|
begin
|
||||||
|
Result := (FPanes.Count > 0);
|
||||||
|
if Result then
|
||||||
|
begin
|
||||||
|
PaneVisible := false;
|
||||||
|
i := FPanes.Count - 1;
|
||||||
|
while (i >= 0) and not PaneVisible do
|
||||||
|
begin
|
||||||
|
PaneVisible := FPanes[i].Visible;
|
||||||
|
dec(i);
|
||||||
|
end;
|
||||||
|
Result := Result and PaneVisible;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TSpkTab.SetRect(ARect: T2DIntRect);
|
||||||
|
var
|
||||||
|
x, i: integer;
|
||||||
|
tw: integer;
|
||||||
|
tmpRect: T2DIntRect;
|
||||||
|
begin
|
||||||
|
FRect := ARect;
|
||||||
|
if AtLeastOnePaneVisible then
|
||||||
|
begin
|
||||||
|
x := ARect.left;
|
||||||
|
for i := 0 to FPanes.Count - 1 do
|
||||||
|
if FPanes[i].Visible then
|
||||||
|
begin
|
||||||
|
tw := FPanes[i].GetWidth;
|
||||||
|
tmpRect.Left := x;
|
||||||
|
tmpRect.Top := ARect.Top;
|
||||||
|
tmpRect.Right := x + tw - 1;
|
||||||
|
tmpRect.Bottom := ARect.bottom;
|
||||||
|
FPanes[i].Rect := tmpRect;
|
||||||
|
x := x + tw + TabPaneHSpacing;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
{$IFDEF EnhancedRecordSupport}
|
||||||
|
FPanes[i].Rect := T2DIntRect.Create(-1,-1,-1,-1);
|
||||||
|
{$ELSE}
|
||||||
|
FPanes[i].Rect.Create(-1,-1,-1,-1);
|
||||||
|
{$ENDIF}
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TSpkTab.SetToolbarDispatch(const Value: TSpkBaseToolbarDispatch);
|
||||||
|
begin
|
||||||
|
FToolbarDispatch := Value;
|
||||||
|
FPanes.ToolbarDispatch := FToolbarDispatch;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TSpkTab.DefineProperties(Filer: TFiler);
|
||||||
|
begin
|
||||||
|
inherited DefineProperties(Filer);
|
||||||
|
Filer.DefineProperty('Panes', FPanes.ReadNames, FPanes.WriteNames, true);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure TSpkTab.Draw(ABuffer: TBitmap; AClipRect: T2DIntRect);
|
||||||
|
var
|
||||||
|
LocalClipRect: T2DIntRect;
|
||||||
|
i: integer;
|
||||||
begin
|
begin
|
||||||
if AtLeastOnePaneVisible then
|
if AtLeastOnePaneVisible then
|
||||||
for i := 0 to FPanes.Count - 1 do
|
for i := 0 to FPanes.Count - 1 do
|
||||||
@@ -311,22 +291,21 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
function TSpkTab.FindPaneAt(x, y: integer): integer;
|
function TSpkTab.FindPaneAt(x, y: integer): integer;
|
||||||
|
var
|
||||||
var i : integer;
|
i: integer;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
result:=-1;
|
Result := -1;
|
||||||
i:=FPanes.count-1;
|
i := FPanes.Count - 1;
|
||||||
while (i>=0) and (result=-1) do
|
while (i >= 0) and (Result = -1) do
|
||||||
begin
|
begin
|
||||||
if FPanes[i].Visible then
|
if FPanes[i].Visible then
|
||||||
begin
|
begin
|
||||||
{$IFDEF EnhancedRecordSupport}
|
{$IFDEF EnhancedRecordSupport}
|
||||||
if FPanes[i].Rect.Contains(T2DIntVector.create(x,y)) then
|
if FPanes[i].Rect.Contains(T2DIntVector.Create(x,y)) then
|
||||||
{$ELSE}
|
{$ELSE}
|
||||||
if FPanes[i].Rect.Contains(x,y) then
|
if FPanes[i].Rect.Contains(x,y) then
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
result:=i;
|
Result := i;
|
||||||
end;
|
end;
|
||||||
dec(i);
|
dec(i);
|
||||||
end;
|
end;
|
||||||
@@ -338,13 +317,10 @@ FPanes.RemoveReference(APane);
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSpkTab.GetChildren(Proc: TGetChildProc; Root: TComponent);
|
procedure TSpkTab.GetChildren(Proc: TGetChildProc; Root: TComponent);
|
||||||
|
var
|
||||||
var i: Integer;
|
i: Integer;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
inherited;
|
inherited;
|
||||||
|
|
||||||
if FPanes.Count>0 then
|
|
||||||
for i := 0 to FPanes.Count - 1 do
|
for i := 0 to FPanes.Count - 1 do
|
||||||
Proc(FPanes.Items[i]);
|
Proc(FPanes.Items[i]);
|
||||||
end;
|
end;
|
||||||
@@ -352,13 +328,12 @@ end;
|
|||||||
procedure TSpkTab.Loaded;
|
procedure TSpkTab.Loaded;
|
||||||
begin
|
begin
|
||||||
inherited;
|
inherited;
|
||||||
|
|
||||||
if FPanes.ListState = lsNeedsProcessing then
|
if FPanes.ListState = lsNeedsProcessing then
|
||||||
FPanes.ProcessNames(self.Owner);
|
FPanes.ProcessNames(self.Owner);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSpkTab.MouseDown(Button: TMouseButton; Shift: TShiftState; X,
|
procedure TSpkTab.MouseDown(Button: TMouseButton; Shift: TShiftState;
|
||||||
Y: Integer);
|
X, Y: Integer);
|
||||||
begin
|
begin
|
||||||
if FMouseActiveElement.ElementType = etPane then
|
if FMouseActiveElement.ElementType = etPane then
|
||||||
begin
|
begin
|
||||||
@@ -377,7 +352,6 @@ if FMouseActiveElement.ElementType = etNone then
|
|||||||
begin
|
begin
|
||||||
FMouseActiveElement.ElementType := etPane;
|
FMouseActiveElement.ElementType := etPane;
|
||||||
FMouseActiveElement.ElementIndex := FMouseHoverElement.ElementIndex;
|
FMouseActiveElement.ElementIndex := FMouseHoverElement.ElementIndex;
|
||||||
|
|
||||||
FPanes[FMouseHoverElement.ElementIndex].MouseDown(Button, Shift, X, Y);
|
FPanes[FMouseHoverElement.ElementIndex].MouseDown(Button, Shift, X, Y);
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
@@ -390,7 +364,6 @@ if FMouseActiveElement.ElementType = etNone then
|
|||||||
begin
|
begin
|
||||||
FMouseActiveElement.ElementType := etTabArea;
|
FMouseActiveElement.ElementType := etTabArea;
|
||||||
FMouseActiveElement.ElementIndex := -1;
|
FMouseActiveElement.ElementIndex := -1;
|
||||||
|
|
||||||
// Placeholder, jeœli zajdzie potrzeba obs³ugi tego zdarzenia.
|
// Placeholder, jeœli zajdzie potrzeba obs³ugi tego zdarzenia.
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@@ -416,13 +389,12 @@ FMouseHoverElement.ElementIndex:=-1;
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSpkTab.MouseMove(Shift: TShiftState; X, Y: Integer);
|
procedure TSpkTab.MouseMove(Shift: TShiftState; X, Y: Integer);
|
||||||
|
var
|
||||||
var i : integer;
|
i: integer;
|
||||||
NewMouseHoverElement: TSpkMouseTabElement;
|
NewMouseHoverElement: TSpkMouseTabElement;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
// Szukamy obiektu pod mysz¹
|
// Szukamy obiektu pod mysz¹
|
||||||
i:=FindPaneAt(x, y);
|
i := FindPaneAt(X, Y);
|
||||||
if i <> -1 then
|
if i <> -1 then
|
||||||
begin
|
begin
|
||||||
NewMouseHoverElement.ElementType := etPane;
|
NewMouseHoverElement.ElementType := etPane;
|
||||||
@@ -484,9 +456,8 @@ end;
|
|||||||
|
|
||||||
procedure TSpkTab.MouseUp(Button: TMouseButton; Shift: TShiftState; X,
|
procedure TSpkTab.MouseUp(Button: TMouseButton; Shift: TShiftState; X,
|
||||||
Y: Integer);
|
Y: Integer);
|
||||||
|
var
|
||||||
var ClearActive : boolean;
|
ClearActive: boolean;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
ClearActive := not (ssLeft in Shift) and not (ssMiddle in Shift) and not (ssRight in Shift);
|
ClearActive := not (ssLeft in Shift) and not (ssMiddle in Shift) and not (ssRight in Shift);
|
||||||
|
|
||||||
@@ -534,13 +505,13 @@ end;
|
|||||||
|
|
||||||
procedure TSpkTab.NotifyAppearanceChanged;
|
procedure TSpkTab.NotifyAppearanceChanged;
|
||||||
begin
|
begin
|
||||||
if assigned(FToolbarDispatch) then
|
if Assigned(FToolbarDispatch) then
|
||||||
FToolbarDispatch.NotifyAppearanceChanged;
|
FToolbarDispatch.NotifyAppearanceChanged;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSpkTab.SetCustomAppearance(const Value: TSpkToolbarAppearance);
|
procedure TSpkTab.SetCustomAppearance(const Value: TSpkToolbarAppearance);
|
||||||
begin
|
begin
|
||||||
FCustomAppearance.assign(Value);
|
FCustomAppearance.Assign(Value);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSpkTab.SetDisabledImages(const Value: TImageList);
|
procedure TSpkTab.SetDisabledImages(const Value: TImageList);
|
||||||
@@ -570,9 +541,7 @@ end;
|
|||||||
procedure TSpkTab.SetAppearance(const Value: TSpkToolbarAppearance);
|
procedure TSpkTab.SetAppearance(const Value: TSpkToolbarAppearance);
|
||||||
begin
|
begin
|
||||||
FAppearance := Value;
|
FAppearance := Value;
|
||||||
|
|
||||||
SetPaneAppearance;
|
SetPaneAppearance;
|
||||||
|
|
||||||
if FToolbarDispatch <> nil then
|
if FToolbarDispatch <> nil then
|
||||||
FToolbarDispatch.NotifyMetricsChanged;
|
FToolbarDispatch.NotifyMetricsChanged;
|
||||||
end;
|
end;
|
||||||
@@ -580,16 +549,14 @@ end;
|
|||||||
procedure TSpkTab.SetCaption(const Value: string);
|
procedure TSpkTab.SetCaption(const Value: string);
|
||||||
begin
|
begin
|
||||||
FCaption := Value;
|
FCaption := Value;
|
||||||
if assigned(FToolbarDispatch) then
|
if Assigned(FToolbarDispatch) then
|
||||||
FToolbarDispatch.NotifyMetricsChanged;
|
FToolbarDispatch.NotifyMetricsChanged;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSpkTab.SetOverrideAppearance(const Value: boolean);
|
procedure TSpkTab.SetOverrideAppearance(const Value: boolean);
|
||||||
begin
|
begin
|
||||||
FOverrideAppearance := Value;
|
FOverrideAppearance := Value;
|
||||||
|
|
||||||
SetPaneAppearance;
|
SetPaneAppearance;
|
||||||
|
|
||||||
if FToolbarDispatch <> nil then
|
if FToolbarDispatch <> nil then
|
||||||
FToolbarDispatch.NotifyMetricsChanged;
|
FToolbarDispatch.NotifyMetricsChanged;
|
||||||
end;
|
end;
|
||||||
@@ -597,9 +564,9 @@ end;
|
|||||||
procedure TSpkTab.SetPaneAppearance;
|
procedure TSpkTab.SetPaneAppearance;
|
||||||
begin
|
begin
|
||||||
if FOverrideAppearance then
|
if FOverrideAppearance then
|
||||||
FPanes.Appearance:=FCustomAppearance else
|
FPanes.Appearance := FCustomAppearance
|
||||||
|
else
|
||||||
FPanes.Appearance := FAppearance;
|
FPanes.Appearance := FAppearance;
|
||||||
|
|
||||||
// Metoda pe³ni rolê makra - dlatego nie powiadamia dyspozytora o zmianie.
|
// Metoda pe³ni rolê makra - dlatego nie powiadamia dyspozytora o zmianie.
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@@ -610,6 +577,7 @@ begin
|
|||||||
FToolbarDispatch.NotifyItemsChanged;
|
FToolbarDispatch.NotifyItemsChanged;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
{ TSpkTabs }
|
{ TSpkTabs }
|
||||||
|
|
||||||
function TSpkTabs.Add: TSpkTab;
|
function TSpkTabs.Add: TSpkTab;
|
||||||
@@ -619,56 +587,54 @@ begin
|
|||||||
AddItem(Result);
|
AddItem(Result);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TSpkTabs.GetItems(index: integer): TSpkTab;
|
function TSpkTabs.GetItems(AIndex: integer): TSpkTab;
|
||||||
begin
|
begin
|
||||||
result:=TSpkTab(inherited Items[index]);
|
Result := TSpkTab(inherited Items[AIndex]);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TSpkTabs.Insert(index: integer): TSpkTab;
|
function TSpkTabs.Insert(AIndex: integer): TSpkTab;
|
||||||
|
var
|
||||||
var Owner, Parent : TComponent;
|
lOwner, lParent: TComponent;
|
||||||
i: Integer;
|
i: Integer;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
if (index<0) or (index>=self.Count) then
|
if (AIndex < 0) or (AIndex >= self.Count) then
|
||||||
raise InternalException.create('TSpkTabs.Insert: Nieprawid³owy indeks!');
|
raise InternalException.create('TSpkTabs.Insert: Nieprawid³owy indeks!');
|
||||||
|
|
||||||
if FRootComponent<>nil then
|
if FRootComponent<>nil then
|
||||||
begin
|
begin
|
||||||
Owner:=FRootComponent.Owner;
|
lOwner := FRootComponent.Owner;
|
||||||
Parent:=FRootComponent;
|
lParent := FRootComponent;
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
Owner:=nil;
|
lOwner := nil;
|
||||||
Parent:=nil;
|
lParent := nil;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
result:=TSpkTab.create(Owner);
|
Result := TSpkTab.create(lOwner);
|
||||||
result.Parent:=Parent;
|
Result.Parent := lParent;
|
||||||
|
|
||||||
if FRootComponent<>nil then
|
if FRootComponent<>nil then
|
||||||
begin
|
begin
|
||||||
i := 0;
|
i := 0;
|
||||||
while FRootComponent.Owner.FindComponent('SpkTab'+inttostr(i))<>nil do
|
while FRootComponent.Owner.FindComponent('SpkTab'+IntToStr(i)) <> nil do
|
||||||
inc(i);
|
inc(i);
|
||||||
|
|
||||||
result.Name:='SpkTab'+inttostr(i);
|
Result.Name := 'SpkTab' + IntToStr(i);
|
||||||
end;
|
end;
|
||||||
InsertItem(index, result);
|
InsertItem(AIndex, Result);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSpkTabs.Notify(Item: TComponent;
|
procedure TSpkTabs.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:
|
||||||
|
begin
|
||||||
// Ustawienie dyspozytora na nil spowoduje, ¿e podczas
|
// Ustawienie dyspozytora na nil spowoduje, ¿e podczas
|
||||||
// przypisywania w³asnoœci nie bêd¹ wo³ane metody Notify*
|
// przypisywania w³asnoœci nie bêd¹ wo³ane metody Notify*
|
||||||
TSpkTab(Item).ToolbarDispatch := nil;
|
TSpkTab(Item).ToolbarDispatch := nil;
|
||||||
|
|
||||||
TSpkTab(Item).Appearance := self.FAppearance;
|
TSpkTab(Item).Appearance := self.FAppearance;
|
||||||
TSpkTab(Item).Images := self.FImages;
|
TSpkTab(Item).Images := self.FImages;
|
||||||
TSpkTab(Item).DisabledImages := self.FDisabledImages;
|
TSpkTab(Item).DisabledImages := self.FDisabledImages;
|
||||||
@@ -676,7 +642,7 @@ begin
|
|||||||
TSpkTab(Item).DisabledLargeImages := self.FDisabledLargeImages;
|
TSpkTab(Item).DisabledLargeImages := self.FDisabledLargeImages;
|
||||||
TSpkTab(Item).ToolbarDispatch := self.FToolbarDispatch;
|
TSpkTab(Item).ToolbarDispatch := self.FToolbarDispatch;
|
||||||
end;
|
end;
|
||||||
opRemove: begin
|
opRemove:
|
||||||
if not(csDestroying in Item.ComponentState) then
|
if not(csDestroying in Item.ComponentState) then
|
||||||
begin
|
begin
|
||||||
TSpkTab(Item).ToolbarDispatch := nil;
|
TSpkTab(Item).ToolbarDispatch := nil;
|
||||||
@@ -688,77 +654,58 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TSpkTabs.SetAppearance(const Value: TSpkToolbarAppearance);
|
procedure TSpkTabs.SetAppearance(const Value: TSpkToolbarAppearance);
|
||||||
|
var
|
||||||
var i: Integer;
|
i: Integer;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
FAppearance := Value;
|
FAppearance := Value;
|
||||||
|
for i := 0 to self.Count - 1 do
|
||||||
if self.count>0 then
|
|
||||||
for i := 0 to self.count - 1 do
|
|
||||||
self.Items[i].Appearance := FAppearance;
|
self.Items[i].Appearance := FAppearance;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSpkTabs.SetDisabledImages(const Value: TImageList);
|
procedure TSpkTabs.SetDisabledImages(const Value: TImageList);
|
||||||
|
var
|
||||||
var i: Integer;
|
i: Integer;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
FDisabledImages := Value;
|
FDisabledImages := Value;
|
||||||
|
for i := 0 to self.Count - 1 do
|
||||||
if self.Count>0 then
|
|
||||||
for i := 0 to self.count - 1 do
|
|
||||||
Items[i].DisabledImages := Value;
|
Items[i].DisabledImages := Value;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSpkTabs.SetDisabledLargeImages(const Value: TImageList);
|
procedure TSpkTabs.SetDisabledLargeImages(const Value: TImageList);
|
||||||
|
var
|
||||||
var i: Integer;
|
i: Integer;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
FDisabledLargeImages := Value;
|
FDisabledLargeImages := Value;
|
||||||
|
|
||||||
if self.Count>0 then
|
|
||||||
for i := 0 to self.count - 1 do
|
for i := 0 to self.count - 1 do
|
||||||
Items[i].DisabledLargeImages := Value;
|
Items[i].DisabledLargeImages := Value;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSpkTabs.SetImages(const Value: TImageList);
|
procedure TSpkTabs.SetImages(const Value: TImageList);
|
||||||
|
var
|
||||||
var i: Integer;
|
i: Integer;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
FImages := Value;
|
FImages := Value;
|
||||||
|
for i := 0 to self.Count - 1 do
|
||||||
if self.Count>0 then
|
|
||||||
for i := 0 to self.count - 1 do
|
|
||||||
Items[i].Images := Value;
|
Items[i].Images := Value;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSpkTabs.SetLargeImages(const Value: TImageList);
|
procedure TSpkTabs.SetLargeImages(const Value: TImageList);
|
||||||
|
var
|
||||||
var i: Integer;
|
i: Integer;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
FLargeImages := Value;
|
FLargeImages := Value;
|
||||||
|
for i := 0 to self.Count - 1 do
|
||||||
if self.Count>0 then
|
|
||||||
for i := 0 to self.count - 1 do
|
|
||||||
Items[i].LargeImages := Value;
|
Items[i].LargeImages := Value;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSpkTabs.SetToolbarDispatch(const Value: TSpkBaseToolbarDispatch);
|
procedure TSpkTabs.SetToolbarDispatch(const Value: TSpkBaseToolbarDispatch);
|
||||||
|
var
|
||||||
var i : integer;
|
i: integer;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
FToolbarDispatch := Value;
|
FToolbarDispatch := Value;
|
||||||
|
for i := 0 to self.Count - 1 do
|
||||||
if self.Count>0 then
|
|
||||||
for i := 0 to self.count - 1 do
|
|
||||||
self.Items[i].ToolbarDispatch := FToolbarDispatch;
|
self.Items[i].ToolbarDispatch := FToolbarDispatch;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@@ -766,7 +713,7 @@ procedure TSpkTabs.Update;
|
|||||||
begin
|
begin
|
||||||
inherited Update;
|
inherited Update;
|
||||||
|
|
||||||
if assigned(FToolbarDispatch) then
|
if Assigned(FToolbarDispatch) then
|
||||||
FToolbarDispatch.NotifyItemsChanged;
|
FToolbarDispatch.NotifyItemsChanged;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@@ -18,9 +18,8 @@ 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;
|
||||||
@@ -47,7 +46,6 @@ class procedure TButtonTools.DrawButton(Bitmap: TBitmap;
|
|||||||
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;
|
||||||
|
@@ -14,13 +14,14 @@ unit spkt_Types;
|
|||||||
|
|
||||||
interface
|
interface
|
||||||
|
|
||||||
uses Controls, Classes, ContNrs, SysUtils, Dialogs,
|
uses
|
||||||
|
Controls, Classes, ContNrs, SysUtils, Dialogs,
|
||||||
spkt_Exceptions;
|
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;
|
||||||
@@ -37,19 +38,20 @@ type TSpkCollection = class(TPersistent)
|
|||||||
|
|
||||||
// *** 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
|
public
|
||||||
// *** Konstruktor, destruktor ***
|
// *** Konstruktor, destruktor ***
|
||||||
constructor Create(RootComponent : TComponent); reintroduce; virtual;
|
constructor Create(ARootComponent : TComponent); reintroduce; virtual;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
|
|
||||||
// *** Obs³uga listy ***
|
// *** Obs³uga listy ***
|
||||||
// *** List operations ***
|
// *** List operations ***
|
||||||
procedure AddItem(AItem: TComponent);
|
procedure AddItem(AItem: TComponent);
|
||||||
procedure InsertItem(index: integer; AItem: TComponent);
|
procedure InsertItem(AIndex: integer; AItem: TComponent);
|
||||||
procedure Clear;
|
procedure Clear;
|
||||||
function Count: integer;
|
function Count: integer;
|
||||||
procedure Delete(index: integer); virtual;
|
procedure Delete(AIndex: integer); virtual;
|
||||||
function IndexOf(Item: TComponent) : integer;
|
function IndexOf(Item: TComponent) : integer;
|
||||||
procedure Remove(Item: TComponent); virtual;
|
procedure Remove(Item: TComponent); virtual;
|
||||||
procedure RemoveReference(Item: TComponent);
|
procedure RemoveReference(Item: TComponent);
|
||||||
@@ -67,8 +69,7 @@ type TSpkCollection = class(TPersistent)
|
|||||||
property RootComponent: TComponent read FRootComponent;
|
property RootComponent: TComponent read FRootComponent;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
type TSpkComponent = class(TComponent)
|
TSpkComponent = class(TComponent)
|
||||||
private
|
|
||||||
protected
|
protected
|
||||||
FParent: TComponent;
|
FParent: TComponent;
|
||||||
FCollection: TSpkCollection;
|
FCollection: TSpkCollection;
|
||||||
@@ -83,10 +84,27 @@ type TSpkComponent = class(TComponent)
|
|||||||
property Collection: TSpkCollection read FCollection;
|
property Collection: TSpkCollection read FCollection;
|
||||||
end;
|
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
|
||||||
@@ -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;
|
||||||
@@ -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