examples: add an example to traverse stock images

git-svn-id: trunk@19782 -
This commit is contained in:
paul 2009-05-03 13:03:24 +00:00
parent a460f26890
commit 83a900bcad
10 changed files with 5702 additions and 0 deletions

9
.gitattributes vendored
View File

@ -2437,6 +2437,15 @@ examples/std_actions/readme.txt svneol=native#text/plain
examples/std_actions/unit1.lfm svneol=native#text/plain
examples/std_actions/unit1.lrs svneol=native#text/pascal
examples/std_actions/unit1.pas svneol=native#text/pascal
examples/stock_images/project1.ico -text svneol=unset#image/ico
examples/stock_images/project1.lpi svneol=native#text/plain
examples/stock_images/project1.lpr svneol=native#text/plain
examples/stock_images/project1.lrs svneol=native#text/pascal
examples/stock_images/project1.manifest svneol=native#text/plain
examples/stock_images/project1.rc svneol=native#text/plain
examples/stock_images/unit1.lfm svneol=native#text/plain
examples/stock_images/unit1.lrs svneol=native#text/pascal
examples/stock_images/unit1.pas svneol=native#text/pascal
examples/synanyhighlighter/synanysynhighlighter.lpi svneol=native#text/plain
examples/synanyhighlighter/synanysynhighlighter.lpr svneol=native#text/plain
examples/synanyhighlighter/unit1.lfm svneol=native#text/plain

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 KiB

View File

@ -0,0 +1,150 @@
<?xml version="1.0"?>
<CONFIG>
<ProjectOptions>
<PathDelim Value="\"/>
<Version Value="7"/>
<General>
<MainUnit Value="0"/>
<TargetFileExt Value=".exe"/>
<Icon Value="0"/>
<UseXPManifest Value="True"/>
<ActiveEditorIndexAtStart Value="0"/>
</General>
<VersionInfo>
<ProjectVersion Value=""/>
<Language Value=""/>
<CharSet Value=""/>
</VersionInfo>
<PublishOptions>
<Version Value="2"/>
<IgnoreBinaries Value="False"/>
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
<ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/>
</PublishOptions>
<RunParams>
<local>
<FormatVersion Value="1"/>
<LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
</local>
</RunParams>
<RequiredPackages Count="1">
<Item1>
<PackageName Value="LCL"/>
</Item1>
</RequiredPackages>
<Units Count="10">
<Unit0>
<Filename Value="project1.lpr"/>
<IsPartOfProject Value="True"/>
<UnitName Value="project1"/>
<CursorPos X="28" Y="6"/>
<TopLine Value="1"/>
<UsageCount Value="22"/>
</Unit0>
<Unit1>
<Filename Value="unit1.pas"/>
<ComponentName Value="Form1"/>
<IsPartOfProject Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="Unit1"/>
<CursorPos X="39" Y="23"/>
<TopLine Value="12"/>
<EditorIndex Value="0"/>
<UsageCount Value="22"/>
<Loaded Value="True"/>
</Unit1>
<Unit2>
<Filename Value="..\..\lcl\lcltype.pp"/>
<UnitName Value="LCLType"/>
<CursorPos X="15" Y="1604"/>
<TopLine Value="1585"/>
<UsageCount Value="11"/>
</Unit2>
<Unit3>
<Filename Value="..\..\lcl\interfaces\gtk2\gtk2themes.pas"/>
<UnitName Value="Gtk2Themes"/>
<CursorPos X="39" Y="166"/>
<TopLine Value="151"/>
<UsageCount Value="11"/>
</Unit3>
<Unit4>
<Filename Value="..\..\lcl\interfaces\win32\win32themes.pas"/>
<UnitName Value="Win32Themes"/>
<CursorPos X="37" Y="176"/>
<TopLine Value="153"/>
<UsageCount Value="11"/>
<Bookmarks Count="1">
<Item0 X="15" Y="163" ID="1"/>
</Bookmarks>
</Unit4>
<Unit5>
<Filename Value="..\..\lcl\interfaces\win32\win32extra.pas"/>
<UnitName Value="Win32Extra"/>
<CursorPos X="1" Y="1"/>
<TopLine Value="1"/>
<UsageCount Value="11"/>
</Unit5>
<Unit6>
<Filename Value="..\..\..\fpc\rtl\win\wininc\func.inc"/>
<CursorPos X="10" Y="61"/>
<TopLine Value="42"/>
<UsageCount Value="11"/>
</Unit6>
<Unit7>
<Filename Value="..\..\lcl\interfaces\qt\qtthemes.pas"/>
<UnitName Value="QtThemes"/>
<CursorPos X="55" Y="359"/>
<TopLine Value="338"/>
<UsageCount Value="11"/>
</Unit7>
<Unit8>
<Filename Value="..\..\lcl\interfaces\qt\qt45.pas"/>
<UnitName Value="qt45"/>
<CursorPos X="5" Y="10499"/>
<TopLine Value="10480"/>
<UsageCount Value="11"/>
<Bookmarks Count="1">
<Item0 X="35" Y="10466" ID="2"/>
</Bookmarks>
</Unit8>
<Unit9>
<Filename Value="..\..\lcl\interfaces\qt\qtwinapi.inc"/>
<CursorPos X="70" Y="4875"/>
<TopLine Value="4865"/>
<UsageCount Value="11"/>
</Unit9>
</Units>
<JumpHistory Count="0" HistoryIndex="-1"/>
</ProjectOptions>
<CompilerOptions>
<Version Value="8"/>
<PathDelim Value="\"/>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)\"/>
<LCLWidgetType Value="qt"/>
</SearchPaths>
<Linking>
<Options>
<Win32>
<GraphicApplication Value="True"/>
</Win32>
</Options>
</Linking>
<Other>
<CompilerPath Value="$(CompPath)"/>
</Other>
</CompilerOptions>
<Debugging>
<Exceptions Count="3">
<Item1>
<Name Value="EAbort"/>
</Item1>
<Item2>
<Name Value="ECodetoolError"/>
</Item2>
<Item3>
<Name Value="EFOpenError"/>
</Item3>
</Exceptions>
</Debugging>
</CONFIG>

View File

@ -0,0 +1,21 @@
program project1;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
Interfaces, // this includes the LCL widgetset
Forms
{ you can add units after this }, Unit1, LResources;
{$IFDEF WINDOWS}{$R project1.rc}{$ENDIF}
begin
{$I project1.lrs}
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
end.

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity version="1.0.0.0" processorArchitecture="*" name="CompanyName.ProductName.YourApp" type="win32"/>
<description>Your application description here.</description>
<dependency>
<dependentAssembly>
<assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="*" publicKeyToken="6595b64144ccf1df" language="*"/>
</dependentAssembly>
</dependency>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel level="asInvoker" uiAccess="false"/>
</requestedPrivileges>
</security>
</trustInfo>
</assembly>

View File

@ -0,0 +1,7 @@
#define RT_MANIFEST 24
#define CREATEPROCESS_MANIFEST_RESOURCE_ID 1
#define ISOLATIONAWARE_MANIFEST_RESOURCE_ID 2
#define ISOLATIONAWARE_NOSTATICIMPORT_MANIFEST_RESOURCE_ID 3
CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "project1.manifest"
MAINICON ICON "project1.ico"

View File

@ -0,0 +1,137 @@
object Form1: TForm1
Left = 355
Height = 255
Top = 160
Width = 400
Caption = 'Stock Icons Tester'
ClientHeight = 255
ClientWidth = 400
OnCreate = FormCreate
LCLVersion = '0.9.27'
object Label1: TLabel
AnchorSideLeft.Control = Owner
AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = Owner
Left = 200
Height = 14
Top = 0
Width = 1
ParentColor = False
end
object GroupBox1: TGroupBox
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = Owner
AnchorSideRight.Control = Label1
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = BitBtn1
Left = 6
Height = 211
Top = 6
Width = 192
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Left = 6
BorderSpacing.Top = 6
BorderSpacing.Right = 3
Caption = 'Dialog Icons'
ClientHeight = 193
ClientWidth = 188
TabOrder = 0
object DialogImage: TImage
AnchorSideLeft.Control = GroupBox1
AnchorSideTop.Control = GroupBox1
AnchorSideRight.Control = GroupBox1
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = DialogTrack
Left = 6
Height = 134
Top = 6
Width = 176
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Around = 6
Center = True
end
object DialogTrack: TTrackBar
AnchorSideLeft.Control = GroupBox1
AnchorSideRight.Control = GroupBox1
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = GroupBox1
AnchorSideBottom.Side = asrBottom
Left = 6
Height = 41
Top = 146
Width = 176
OnChange = DialogTrackChange
Position = 0
Anchors = [akLeft, akRight, akBottom]
BorderSpacing.Around = 6
TabOrder = 0
end
end
object GroupBox2: TGroupBox
AnchorSideLeft.Control = Label1
AnchorSideTop.Control = Owner
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = GroupBox1
AnchorSideBottom.Side = asrBottom
Left = 203
Height = 211
Top = 6
Width = 191
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Left = 3
BorderSpacing.Top = 6
BorderSpacing.Right = 6
Caption = 'Button Icons'
ClientHeight = 193
ClientWidth = 187
TabOrder = 1
object ButtonImage: TImage
AnchorSideLeft.Control = GroupBox2
AnchorSideTop.Control = GroupBox2
AnchorSideRight.Control = GroupBox2
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = ButtonTrack
Left = 6
Height = 134
Top = 6
Width = 175
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Around = 6
Center = True
end
object ButtonTrack: TTrackBar
AnchorSideLeft.Control = GroupBox2
AnchorSideRight.Control = GroupBox2
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = GroupBox2
AnchorSideBottom.Side = asrBottom
Left = 6
Height = 41
Top = 146
Width = 175
OnChange = ButtonTrackChange
Position = 0
Anchors = [akLeft, akRight, akBottom]
BorderSpacing.Around = 6
TabOrder = 0
end
end
object BitBtn1: TBitBtn
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = Owner
AnchorSideBottom.Side = asrBottom
Left = 319
Height = 26
Top = 223
Width = 75
Anchors = [akRight, akBottom]
AutoSize = True
BorderSpacing.Around = 6
Caption = '&Close'
Constraints.MinWidth = 75
Kind = bkClose
TabOrder = 2
end
end

View File

@ -0,0 +1,51 @@
LazarusResources.Add('TForm1','FORMDATA',[
'TPF0'#6'TForm1'#5'Form1'#4'Left'#3'c'#1#6'Height'#3#255#0#3'Top'#3#160#0#5'W'
+'idth'#3#144#1#7'Caption'#6#18'Stock Icons Tester'#12'ClientHeight'#3#255#0
+#11'ClientWidth'#3#144#1#8'OnCreate'#7#10'FormCreate'#10'LCLVersion'#6#6'0.9'
+'.27'#0#6'TLabel'#6'Label1'#22'AnchorSideLeft.Control'#7#5'Owner'#19'AnchorS'
+'ideLeft.Side'#7#9'asrCenter'#21'AnchorSideTop.Control'#7#5'Owner'#4'Left'#3
+#200#0#6'Height'#2#14#3'Top'#2#0#5'Width'#2#1#11'ParentColor'#8#0#0#9'TGroup'
+'Box'#9'GroupBox1'#22'AnchorSideLeft.Control'#7#5'Owner'#21'AnchorSideTop.Co'
+'ntrol'#7#5'Owner'#23'AnchorSideRight.Control'#7#6'Label1'#20'AnchorSideRigh'
+'t.Side'#7#9'asrBottom'#24'AnchorSideBottom.Control'#7#7'BitBtn1'#4'Left'#2#6
+#6'Height'#3#211#0#3'Top'#2#6#5'Width'#3#192#0#7'Anchors'#11#5'akTop'#6'akLe'
+'ft'#7'akRight'#8'akBottom'#0#18'BorderSpacing.Left'#2#6#17'BorderSpacing.To'
+'p'#2#6#19'BorderSpacing.Right'#2#3#7'Caption'#6#12'Dialog Icons'#12'ClientH'
+'eight'#3#193#0#11'ClientWidth'#3#188#0#8'TabOrder'#2#0#0#6'TImage'#11'Dialo'
+'gImage'#22'AnchorSideLeft.Control'#7#9'GroupBox1'#21'AnchorSideTop.Control'
+#7#9'GroupBox1'#23'AnchorSideRight.Control'#7#9'GroupBox1'#20'AnchorSideRigh'
+'t.Side'#7#9'asrBottom'#24'AnchorSideBottom.Control'#7#11'DialogTrack'#4'Lef'
+'t'#2#6#6'Height'#3#134#0#3'Top'#2#6#5'Width'#3#176#0#7'Anchors'#11#5'akTop'
+#6'akLeft'#7'akRight'#8'akBottom'#0#20'BorderSpacing.Around'#2#6#6'Center'#9
+#0#0#9'TTrackBar'#11'DialogTrack'#22'AnchorSideLeft.Control'#7#9'GroupBox1'
+#23'AnchorSideRight.Control'#7#9'GroupBox1'#20'AnchorSideRight.Side'#7#9'asr'
+'Bottom'#24'AnchorSideBottom.Control'#7#9'GroupBox1'#21'AnchorSideBottom.Sid'
+'e'#7#9'asrBottom'#4'Left'#2#6#6'Height'#2')'#3'Top'#3#146#0#5'Width'#3#176#0
+#8'OnChange'#7#17'DialogTrackChange'#8'Position'#2#0#7'Anchors'#11#6'akLeft'
+#7'akRight'#8'akBottom'#0#20'BorderSpacing.Around'#2#6#8'TabOrder'#2#0#0#0#0
+#9'TGroupBox'#9'GroupBox2'#22'AnchorSideLeft.Control'#7#6'Label1'#21'AnchorS'
+'ideTop.Control'#7#5'Owner'#23'AnchorSideRight.Control'#7#5'Owner'#20'Anchor'
+'SideRight.Side'#7#9'asrBottom'#24'AnchorSideBottom.Control'#7#9'GroupBox1'
+#21'AnchorSideBottom.Side'#7#9'asrBottom'#4'Left'#3#203#0#6'Height'#3#211#0#3
+'Top'#2#6#5'Width'#3#191#0#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#8'akB'
+'ottom'#0#18'BorderSpacing.Left'#2#3#17'BorderSpacing.Top'#2#6#19'BorderSpac'
+'ing.Right'#2#6#7'Caption'#6#12'Button Icons'#12'ClientHeight'#3#193#0#11'Cl'
+'ientWidth'#3#187#0#8'TabOrder'#2#1#0#6'TImage'#11'ButtonImage'#22'AnchorSid'
+'eLeft.Control'#7#9'GroupBox2'#21'AnchorSideTop.Control'#7#9'GroupBox2'#23'A'
+'nchorSideRight.Control'#7#9'GroupBox2'#20'AnchorSideRight.Side'#7#9'asrBott'
+'om'#24'AnchorSideBottom.Control'#7#11'ButtonTrack'#4'Left'#2#6#6'Height'#3
+#134#0#3'Top'#2#6#5'Width'#3#175#0#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRigh'
+'t'#8'akBottom'#0#20'BorderSpacing.Around'#2#6#6'Center'#9#0#0#9'TTrackBar'
+#11'ButtonTrack'#22'AnchorSideLeft.Control'#7#9'GroupBox2'#23'AnchorSideRigh'
+'t.Control'#7#9'GroupBox2'#20'AnchorSideRight.Side'#7#9'asrBottom'#24'Anchor'
+'SideBottom.Control'#7#9'GroupBox2'#21'AnchorSideBottom.Side'#7#9'asrBottom'
+#4'Left'#2#6#6'Height'#2')'#3'Top'#3#146#0#5'Width'#3#175#0#8'OnChange'#7#17
+'ButtonTrackChange'#8'Position'#2#0#7'Anchors'#11#6'akLeft'#7'akRight'#8'akB'
+'ottom'#0#20'BorderSpacing.Around'#2#6#8'TabOrder'#2#0#0#0#0#7'TBitBtn'#7'Bi'
+'tBtn1'#23'AnchorSideRight.Control'#7#5'Owner'#20'AnchorSideRight.Side'#7#9
+'asrBottom'#24'AnchorSideBottom.Control'#7#5'Owner'#21'AnchorSideBottom.Side'
+#7#9'asrBottom'#4'Left'#3'?'#1#6'Height'#2#26#3'Top'#3#223#0#5'Width'#2'K'#7
+'Anchors'#11#7'akRight'#8'akBottom'#0#8'AutoSize'#9#20'BorderSpacing.Around'
+#2#6#7'Caption'#6#6'&Close'#20'Constraints.MinWidth'#2'K'#4'Kind'#7#7'bkClos'
+'e'#8'TabOrder'#2#2#0#0#0
]);

View File

@ -0,0 +1,88 @@
unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
ComCtrls, ExtCtrls, LCLType, Themes, StdCtrls, Buttons;
type
{ TForm1 }
TForm1 = class(TForm)
BitBtn1: TBitBtn;
ButtonImage: TImage;
ButtonTrack: TTrackBar;
DialogImage: TImage;
DialogTrack: TTrackBar;
GroupBox1: TGroupBox;
GroupBox2: TGroupBox;
Label1: TLabel;
procedure ButtonTrackChange(Sender: TObject);
procedure DialogTrackChange(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
procedure UpdateDialogImage;
procedure UpdateButtonImage;
public
{ public declarations }
end;
var
Form1: TForm1;
implementation
{ TForm1 }
procedure TForm1.FormCreate(Sender: TObject);
begin
DialogTrack.Min := idDialogWarning - idDialogBase;
DialogTrack.Max := idDialogShield - idDialogBase;
DialogTrack.Position := DialogTrack.Min;
UpdateDialogImage;
ButtonTrack.Min := idButtonOk - idButtonBase;
ButtonTrack.Max := idButtonShield - idButtonBase;
ButtonTrack.Position := ButtonTrack.Min;
UpdateButtonImage;
end;
procedure TForm1.DialogTrackChange(Sender: TObject);
begin
UpdateDialogImage;
end;
procedure TForm1.ButtonTrackChange(Sender: TObject);
begin
UpdateButtonImage;
end;
procedure TForm1.UpdateDialogImage;
var
Image, Mask: HBitmap;
begin
if ThemeServices.GetStockImage(DialogTrack.Position + idDialogBase, Image, Mask) then
DialogImage.Picture.Bitmap.LoadFromBitmapHandles(Image, Mask)
else
DialogImage.Picture.Clear;
end;
procedure TForm1.UpdateButtonImage;
var
Image, Mask: HBitmap;
begin
if ThemeServices.GetStockImage(ButtonTrack.Position + idButtonBase, Image, Mask) then
ButtonImage.Picture.Bitmap.LoadFromBitmapHandles(Image, Mask)
else
ButtonImage.Picture.Clear;
end;
initialization
{$I unit1.lrs}
end.