You've already forked lazarus-ccr
RxFPC:new glyph images for RxSwitch from zoltanleo
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6523 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
BIN
components/rx/trunk/demos/RxSwitch/project1.ico
Normal file
BIN
components/rx/trunk/demos/RxSwitch/project1.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 134 KiB |
80
components/rx/trunk/demos/RxSwitch/project1.lpi
Normal file
80
components/rx/trunk/demos/RxSwitch/project1.lpi
Normal file
@ -0,0 +1,80 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CONFIG>
|
||||
<ProjectOptions>
|
||||
<Version Value="11"/>
|
||||
<General>
|
||||
<SessionStorage Value="InProjectDir"/>
|
||||
<MainUnit Value="0"/>
|
||||
<Title Value="project1"/>
|
||||
<Scaled Value="True"/>
|
||||
<ResourceType Value="res"/>
|
||||
<UseXPManifest Value="True"/>
|
||||
<XPManifest>
|
||||
<DpiAware Value="True"/>
|
||||
</XPManifest>
|
||||
<Icon Value="0"/>
|
||||
</General>
|
||||
<BuildModes Count="1">
|
||||
<Item1 Name="Default" Default="True"/>
|
||||
</BuildModes>
|
||||
<PublishOptions>
|
||||
<Version Value="2"/>
|
||||
</PublishOptions>
|
||||
<RunParams>
|
||||
<FormatVersion Value="2"/>
|
||||
<Modes Count="0"/>
|
||||
</RunParams>
|
||||
<RequiredPackages Count="2">
|
||||
<Item1>
|
||||
<PackageName Value="rxnew"/>
|
||||
</Item1>
|
||||
<Item2>
|
||||
<PackageName Value="LCL"/>
|
||||
</Item2>
|
||||
</RequiredPackages>
|
||||
<Units Count="2">
|
||||
<Unit0>
|
||||
<Filename Value="project1.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
</Unit0>
|
||||
<Unit1>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<ComponentName Value="Form1"/>
|
||||
<HasResources Value="True"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<UnitName Value="Unit1"/>
|
||||
</Unit1>
|
||||
</Units>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
<Version Value="11"/>
|
||||
<Target>
|
||||
<Filename Value="project1"/>
|
||||
</Target>
|
||||
<SearchPaths>
|
||||
<IncludeFiles Value="$(ProjOutDir)"/>
|
||||
<UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
|
||||
</SearchPaths>
|
||||
<Linking>
|
||||
<Options>
|
||||
<Win32>
|
||||
<GraphicApplication Value="True"/>
|
||||
</Win32>
|
||||
</Options>
|
||||
</Linking>
|
||||
</CompilerOptions>
|
||||
<Debugging>
|
||||
<Exceptions Count="3">
|
||||
<Item1>
|
||||
<Name Value="EAbort"/>
|
||||
</Item1>
|
||||
<Item2>
|
||||
<Name Value="ECodetoolError"/>
|
||||
</Item2>
|
||||
<Item3>
|
||||
<Name Value="EFOpenError"/>
|
||||
</Item3>
|
||||
</Exceptions>
|
||||
</Debugging>
|
||||
</CONFIG>
|
22
components/rx/trunk/demos/RxSwitch/project1.lpr
Normal file
22
components/rx/trunk/demos/RxSwitch/project1.lpr
Normal file
@ -0,0 +1,22 @@
|
||||
program project1;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
uses
|
||||
{$IFDEF UNIX}{$IFDEF UseCThreads}
|
||||
cthreads,
|
||||
{$ENDIF}{$ENDIF}
|
||||
Interfaces, // this includes the LCL widgetset
|
||||
Forms, Unit1, rxnew
|
||||
{ you can add units after this };
|
||||
|
||||
{$R *.res}
|
||||
|
||||
begin
|
||||
RequireDerivedFormResource:=True;
|
||||
Application.Scaled:=True;
|
||||
Application.Initialize;
|
||||
Application.CreateForm(TForm1, Form1);
|
||||
Application.Run;
|
||||
end.
|
||||
|
180
components/rx/trunk/demos/RxSwitch/project1.lps
Normal file
180
components/rx/trunk/demos/RxSwitch/project1.lps
Normal file
@ -0,0 +1,180 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CONFIG>
|
||||
<ProjectSession>
|
||||
<Version Value="11"/>
|
||||
<BuildModes Active="Default"/>
|
||||
<Units Count="5">
|
||||
<Unit0>
|
||||
<Filename Value="project1.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<EditorIndex Value="-1"/>
|
||||
<WindowIndex Value="-1"/>
|
||||
<TopLine Value="-1"/>
|
||||
<CursorPos X="-1" Y="-1"/>
|
||||
<UsageCount Value="20"/>
|
||||
</Unit0>
|
||||
<Unit1>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<ComponentName Value="Form1"/>
|
||||
<HasResources Value="True"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<UnitName Value="Unit1"/>
|
||||
<IsVisibleTab Value="True"/>
|
||||
<TopLine Value="13"/>
|
||||
<CursorPos X="33" Y="24"/>
|
||||
<UsageCount Value="20"/>
|
||||
<Loaded Value="True"/>
|
||||
<LoadedDesigner Value="True"/>
|
||||
</Unit1>
|
||||
<Unit2>
|
||||
<Filename Value="../../rxcontrols/rxswitch.pas"/>
|
||||
<EditorIndex Value="1"/>
|
||||
<TopLine Value="30"/>
|
||||
<CursorPos X="73" Y="47"/>
|
||||
<UsageCount Value="10"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit2>
|
||||
<Unit3>
|
||||
<Filename Value="/home/install/source/fpcsrc/rtl/objpas/classes/streams.inc"/>
|
||||
<EditorIndex Value="-1"/>
|
||||
<TopLine Value="959"/>
|
||||
<CursorPos Y="976"/>
|
||||
<UsageCount Value="10"/>
|
||||
</Unit3>
|
||||
<Unit4>
|
||||
<Filename Value="/home/install/source/fpcsrc/rtl/objpas/classes/reader.inc"/>
|
||||
<EditorIndex Value="-1"/>
|
||||
<TopLine Value="1354"/>
|
||||
<CursorPos Y="1370"/>
|
||||
<UsageCount Value="10"/>
|
||||
</Unit4>
|
||||
</Units>
|
||||
<JumpHistory Count="30" HistoryIndex="29">
|
||||
<Position1>
|
||||
<Filename Value="../../rxcontrols/rxswitch.pas"/>
|
||||
<Caret Line="330" TopLine="303"/>
|
||||
</Position1>
|
||||
<Position2>
|
||||
<Filename Value="../../rxcontrols/rxswitch.pas"/>
|
||||
<Caret Line="297" Column="41" TopLine="281"/>
|
||||
</Position2>
|
||||
<Position3>
|
||||
<Filename Value="../../rxcontrols/rxswitch.pas"/>
|
||||
<Caret Line="298" Column="5" TopLine="281"/>
|
||||
</Position3>
|
||||
<Position4>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="16" Column="18" TopLine="6"/>
|
||||
</Position4>
|
||||
<Position5>
|
||||
<Filename Value="../../rxcontrols/rxswitch.pas"/>
|
||||
<Caret Line="320" Column="25" TopLine="304"/>
|
||||
</Position5>
|
||||
<Position6>
|
||||
<Filename Value="../../rxcontrols/rxswitch.pas"/>
|
||||
<Caret Line="58" Column="5" TopLine="41"/>
|
||||
</Position6>
|
||||
<Position7>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="18" Column="18" TopLine="6"/>
|
||||
</Position7>
|
||||
<Position8>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="45" Column="13" TopLine="16"/>
|
||||
</Position8>
|
||||
<Position9>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="23" Column="33" TopLine="13"/>
|
||||
</Position9>
|
||||
<Position10>
|
||||
<Filename Value="../../rxcontrols/rxswitch.pas"/>
|
||||
<Caret Line="97" Column="27" TopLine="93"/>
|
||||
</Position10>
|
||||
<Position11>
|
||||
<Filename Value="../../rxcontrols/rxswitch.pas"/>
|
||||
<Caret Line="171" Column="3" TopLine="164"/>
|
||||
</Position11>
|
||||
<Position12>
|
||||
<Filename Value="../../rxcontrols/rxswitch.pas"/>
|
||||
<Caret Line="66" Column="15" TopLine="49"/>
|
||||
</Position12>
|
||||
<Position13>
|
||||
<Filename Value="../../rxcontrols/rxswitch.pas"/>
|
||||
<Caret Line="279" Column="3" TopLine="275"/>
|
||||
</Position13>
|
||||
<Position14>
|
||||
<Filename Value="../../rxcontrols/rxswitch.pas"/>
|
||||
<Caret Line="136" Column="15" TopLine="117"/>
|
||||
</Position14>
|
||||
<Position15>
|
||||
<Filename Value="../../rxcontrols/rxswitch.pas"/>
|
||||
<Caret Line="68" Column="15" TopLine="50"/>
|
||||
</Position15>
|
||||
<Position16>
|
||||
<Filename Value="../../rxcontrols/rxswitch.pas"/>
|
||||
<Caret Line="519" Column="28" TopLine="514"/>
|
||||
</Position16>
|
||||
<Position17>
|
||||
<Filename Value="../../rxcontrols/rxswitch.pas"/>
|
||||
<Caret Line="516" TopLine="496"/>
|
||||
</Position17>
|
||||
<Position18>
|
||||
<Filename Value="../../rxcontrols/rxswitch.pas"/>
|
||||
<Caret Line="520" TopLine="496"/>
|
||||
</Position18>
|
||||
<Position19>
|
||||
<Filename Value="../../rxcontrols/rxswitch.pas"/>
|
||||
<Caret Line="517" TopLine="496"/>
|
||||
</Position19>
|
||||
<Position20>
|
||||
<Filename Value="../../rxcontrols/rxswitch.pas"/>
|
||||
<Caret Line="518" TopLine="496"/>
|
||||
</Position20>
|
||||
<Position21>
|
||||
<Filename Value="../../rxcontrols/rxswitch.pas"/>
|
||||
<Caret Line="306" TopLine="289"/>
|
||||
</Position21>
|
||||
<Position22>
|
||||
<Filename Value="../../rxcontrols/rxswitch.pas"/>
|
||||
<Caret Line="307" TopLine="289"/>
|
||||
</Position22>
|
||||
<Position23>
|
||||
<Filename Value="../../rxcontrols/rxswitch.pas"/>
|
||||
<Caret Line="308" TopLine="289"/>
|
||||
</Position23>
|
||||
<Position24>
|
||||
<Filename Value="../../rxcontrols/rxswitch.pas"/>
|
||||
<Caret Line="315" TopLine="298"/>
|
||||
</Position24>
|
||||
<Position25>
|
||||
<Filename Value="../../rxcontrols/rxswitch.pas"/>
|
||||
<Caret Line="321" TopLine="298"/>
|
||||
</Position25>
|
||||
<Position26>
|
||||
<Filename Value="../../rxcontrols/rxswitch.pas"/>
|
||||
<Caret Line="326" TopLine="298"/>
|
||||
</Position26>
|
||||
<Position27>
|
||||
<Filename Value="../../rxcontrols/rxswitch.pas"/>
|
||||
<Caret Line="513" Column="9" TopLine="514"/>
|
||||
</Position27>
|
||||
<Position28>
|
||||
<Filename Value="../../rxcontrols/rxswitch.pas"/>
|
||||
<Caret Line="74" Column="15" TopLine="59"/>
|
||||
</Position28>
|
||||
<Position29>
|
||||
<Filename Value="../../rxcontrols/rxswitch.pas"/>
|
||||
<Caret Line="299" Column="59" TopLine="282"/>
|
||||
</Position29>
|
||||
<Position30>
|
||||
<Filename Value="../../rxcontrols/rxswitch.pas"/>
|
||||
<Caret Line="47" Column="63" TopLine="30"/>
|
||||
</Position30>
|
||||
</JumpHistory>
|
||||
<RunParams>
|
||||
<FormatVersion Value="2"/>
|
||||
<Modes Count="0" ActiveMode=""/>
|
||||
</RunParams>
|
||||
</ProjectSession>
|
||||
</CONFIG>
|
BIN
components/rx/trunk/demos/RxSwitch/project1.res
Normal file
BIN
components/rx/trunk/demos/RxSwitch/project1.res
Normal file
Binary file not shown.
71
components/rx/trunk/demos/RxSwitch/unit1.lfm
Normal file
71
components/rx/trunk/demos/RxSwitch/unit1.lfm
Normal file
@ -0,0 +1,71 @@
|
||||
object Form1: TForm1
|
||||
Left = 600
|
||||
Height = 344
|
||||
Top = 231
|
||||
Width = 474
|
||||
Caption = 'Form1'
|
||||
ClientHeight = 344
|
||||
ClientWidth = 474
|
||||
OnCreate = RxSwitch1Off
|
||||
LCLVersion = '1.9.0.0'
|
||||
object RxSwitch1: TRxSwitch
|
||||
Left = 40
|
||||
Height = 84
|
||||
Top = 16
|
||||
Width = 98
|
||||
Caption = 'RxSwitch1'
|
||||
TabOrder = 0
|
||||
TextPosition = tpAbove
|
||||
Style = swsClassic
|
||||
OnOn = RxSwitch1Off
|
||||
OnOff = RxSwitch1Off
|
||||
end
|
||||
object Label1: TLabel
|
||||
AnchorSideLeft.Control = RxSwitch1
|
||||
AnchorSideLeft.Side = asrCenter
|
||||
AnchorSideTop.Control = RxSwitch1
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 68
|
||||
Height = 20
|
||||
Top = 100
|
||||
Width = 42
|
||||
Caption = 'Label1'
|
||||
ParentColor = False
|
||||
end
|
||||
object RadioGroup1: TRadioGroup
|
||||
Left = 216
|
||||
Height = 117
|
||||
Top = 16
|
||||
Width = 161
|
||||
AutoFill = True
|
||||
AutoSize = True
|
||||
Caption = 'Style'
|
||||
ChildSizing.LeftRightSpacing = 6
|
||||
ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
|
||||
ChildSizing.EnlargeVertical = crsHomogenousChildResize
|
||||
ChildSizing.ShrinkHorizontal = crsScaleChilds
|
||||
ChildSizing.ShrinkVertical = crsScaleChilds
|
||||
ChildSizing.Layout = cclLeftToRightThenTopToBottom
|
||||
ChildSizing.ControlsPerLine = 1
|
||||
ClientHeight = 96
|
||||
ClientWidth = 159
|
||||
ItemIndex = 0
|
||||
Items.Strings = (
|
||||
'swsClassic'
|
||||
'swsNewHorizontal'
|
||||
'swsVerticalUD'
|
||||
'swsVerticalDU'
|
||||
)
|
||||
OnClick = RadioGroup1Click
|
||||
TabOrder = 1
|
||||
end
|
||||
object RxSwitch2: TRxSwitch
|
||||
Left = 40
|
||||
Height = 60
|
||||
Top = 200
|
||||
Width = 50
|
||||
Caption = 'RxSwitch2'
|
||||
TabOrder = 2
|
||||
Style = swsClassic
|
||||
end
|
||||
end
|
50
components/rx/trunk/demos/RxSwitch/unit1.pas
Normal file
50
components/rx/trunk/demos/RxSwitch/unit1.pas
Normal file
@ -0,0 +1,50 @@
|
||||
unit Unit1;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, ExtCtrls,
|
||||
rxswitch;
|
||||
|
||||
type
|
||||
|
||||
{ TForm1 }
|
||||
|
||||
TForm1 = class(TForm)
|
||||
Label1: TLabel;
|
||||
RadioGroup1: TRadioGroup;
|
||||
RxSwitch1: TRxSwitch;
|
||||
RxSwitch2: TRxSwitch;
|
||||
procedure RadioGroup1Click(Sender: TObject);
|
||||
procedure RxSwitch1Off(Sender: TObject);
|
||||
private
|
||||
|
||||
public
|
||||
|
||||
end;
|
||||
|
||||
var
|
||||
Form1: TForm1;
|
||||
|
||||
implementation
|
||||
|
||||
{$R *.lfm}
|
||||
|
||||
{ TForm1 }
|
||||
const
|
||||
SwithcStateStr:array [TSwithState] of string = ('OFF', 'ON');
|
||||
|
||||
procedure TForm1.RxSwitch1Off(Sender: TObject);
|
||||
begin
|
||||
Label1.Caption:=SwithcStateStr[RxSwitch1.StateOn];
|
||||
end;
|
||||
|
||||
procedure TForm1.RadioGroup1Click(Sender: TObject);
|
||||
begin
|
||||
RxSwitch1.Style:=TSwithStyle(RadioGroup1.ItemIndex);
|
||||
end;
|
||||
|
||||
end.
|
||||
|
@ -16,3 +16,5 @@ rm rxswitch.res
|
||||
|
||||
/usr/local/share/lazarus/tools/lazres pickdate.res rx_next1.png rx_next2.png rx_prev1.png rx_prev2.png
|
||||
/usr/local/share/lazarus/tools/lazres rxswitch.res rxswitch_off.png rxswitch_on.png rx_ButtonOffHor.png rx_ButtonOffVertDown.png rx_ButtonOffVertUp.png rx_ButtonOnHor.png rx_ButtonOnVertDown.png rx_ButtonOnVertUp.png
|
||||
|
||||
cp rxswitch.res ../../rxcontrols
|
||||
|
@ -44,7 +44,7 @@ type
|
||||
|
||||
TTextPos = (tpNone, tpLeft, tpRight, tpAbove, tpBelow);
|
||||
TSwithState = (sw_off, sw_on);
|
||||
TSwithStyle = (swsClassic, swsNewHorizontal, swsNewVertical, swsCustom);
|
||||
TSwithStyle = (swsClassic, swsHorizontal, swsVerticalUD, swsVerticalDU);
|
||||
TSwitchBitmaps = set of TSwithState;
|
||||
|
||||
TRxSwitch = class(TCustomControl)
|
||||
@ -125,7 +125,7 @@ type
|
||||
property Constraints;
|
||||
property DragKind;
|
||||
property Visible;
|
||||
property Style:TSwithStyle read FStyle write SetStyle;
|
||||
property Style:TSwithStyle read FStyle write SetStyle default swsClassic;
|
||||
property OnClick;
|
||||
property OnDblClick;
|
||||
property OnEnter;
|
||||
@ -166,8 +166,9 @@ var
|
||||
I : TSwithState;
|
||||
begin
|
||||
inherited Create(AOwner);
|
||||
ControlStyle := [csClickEvents, csSetCaption, csCaptureMouse,
|
||||
csOpaque, csDoubleClicks];
|
||||
ControlStyle := [csClickEvents, csSetCaption, csCaptureMouse, csOpaque, csDoubleClicks];
|
||||
FStyle:=swsClassic;
|
||||
|
||||
Width := 50;
|
||||
Height := 60;
|
||||
for I := sw_off to sw_on do
|
||||
@ -293,6 +294,11 @@ begin
|
||||
Result:=GetSwitchGlyph(sw_on);
|
||||
end;
|
||||
|
||||
const
|
||||
s_sw_on : array [TSwithStyle] of string = ('rxswitch_on', 'rx_ButtonOnHor', 'rx_ButtonOnVertDown', 'rx_ButtonOnVertUp');
|
||||
s_sw_off : array [TSwithStyle] of string = ('rxswitch_off', 'rx_ButtonOffHor', 'rx_ButtonOffVertUp', 'rx_ButtonOffVertDown');
|
||||
|
||||
|
||||
procedure TRxSwitch.SetSwitchGlyph(Index: TSwithState; Value: TBitmap);
|
||||
var
|
||||
S: String;
|
||||
@ -310,14 +316,19 @@ begin
|
||||
{ sw_off: FBitmaps[Index].Handle:=CreatePixmapIndirect(@RXSWITCH_OFF[0], GetSysColor(COLOR_BTNFACE));
|
||||
sw_on: FBitmaps[Index].Handle:=CreatePixmapIndirect(@RXSWITCH_ON[0],
|
||||
GetSysColor(COLOR_BTNFACE));}
|
||||
sw_off:S:='rxswitch_off';
|
||||
sw_on:S:='rxswitch_on';
|
||||
//sw_off:S:='rxswitch_off';
|
||||
//sw_on:S:='rxswitch_on';
|
||||
sw_off:S:=s_sw_off[FStyle];
|
||||
sw_on:S:=s_sw_on[FStyle];
|
||||
else
|
||||
Exit;
|
||||
end;
|
||||
B:=CreateResBitmap(S);
|
||||
FBitmaps[Index].Assign(B);
|
||||
B.Free;
|
||||
if S<>'' then
|
||||
begin
|
||||
B:=CreateResBitmap(S);
|
||||
FBitmaps[Index].Assign(B);
|
||||
B.Free;
|
||||
end;
|
||||
Exclude(FUserBitmaps, Index);
|
||||
end;
|
||||
end;
|
||||
@ -504,6 +515,8 @@ procedure TRxSwitch.SetStyle(AValue: TSwithStyle);
|
||||
begin
|
||||
if FStyle=AValue then Exit;
|
||||
FStyle:=AValue;
|
||||
SetSwitchGlyph(sw_off, nil);
|
||||
SetSwitchGlyph(sw_on, nil);
|
||||
end;
|
||||
|
||||
procedure TRxSwitch.SetSwitchGlyphOff(const AValue: TBitmap);
|
||||
|
Binary file not shown.
Reference in New Issue
Block a user