You've already forked lazarus-ccr
Added Gtk3 GtkApplication example
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@2875 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
75
bindings/gtk3/examples/gtkapplication/gtkapplicationtest.lpi
Normal file
75
bindings/gtk3/examples/gtkapplication/gtkapplicationtest.lpi
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<CONFIG>
|
||||||
|
<ProjectOptions>
|
||||||
|
<Version Value="9"/>
|
||||||
|
<General>
|
||||||
|
<Flags>
|
||||||
|
<MainUnitHasCreateFormStatements Value="False"/>
|
||||||
|
<MainUnitHasTitleStatement Value="False"/>
|
||||||
|
</Flags>
|
||||||
|
<SessionStorage Value="InProjectDir"/>
|
||||||
|
<MainUnit Value="0"/>
|
||||||
|
<Title Value="gtkapplicationtest"/>
|
||||||
|
<UseAppBundle Value="False"/>
|
||||||
|
<ResourceType Value="res"/>
|
||||||
|
</General>
|
||||||
|
<i18n>
|
||||||
|
<EnableI18N LFM="False"/>
|
||||||
|
</i18n>
|
||||||
|
<VersionInfo>
|
||||||
|
<StringTable ProductVersion=""/>
|
||||||
|
</VersionInfo>
|
||||||
|
<BuildModes Count="1">
|
||||||
|
<Item1 Name="Default" Default="True"/>
|
||||||
|
</BuildModes>
|
||||||
|
<PublishOptions>
|
||||||
|
<Version Value="2"/>
|
||||||
|
</PublishOptions>
|
||||||
|
<RunParams>
|
||||||
|
<local>
|
||||||
|
<FormatVersion Value="1"/>
|
||||||
|
</local>
|
||||||
|
</RunParams>
|
||||||
|
<RequiredPackages Count="1">
|
||||||
|
<Item1>
|
||||||
|
<PackageName Value="Gtk3Pkg"/>
|
||||||
|
</Item1>
|
||||||
|
</RequiredPackages>
|
||||||
|
<Units Count="1">
|
||||||
|
<Unit0>
|
||||||
|
<Filename Value="gtkapplicationtest.lpr"/>
|
||||||
|
<IsPartOfProject Value="True"/>
|
||||||
|
<UnitName Value="gtkapplicationtest"/>
|
||||||
|
</Unit0>
|
||||||
|
</Units>
|
||||||
|
</ProjectOptions>
|
||||||
|
<CompilerOptions>
|
||||||
|
<Version Value="11"/>
|
||||||
|
<Target>
|
||||||
|
<Filename Value="gtkapplicationtest"/>
|
||||||
|
</Target>
|
||||||
|
<SearchPaths>
|
||||||
|
<IncludeFiles Value="$(ProjOutDir)"/>
|
||||||
|
<UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
|
||||||
|
</SearchPaths>
|
||||||
|
<Other>
|
||||||
|
<CompilerMessages>
|
||||||
|
<MsgFileName Value=""/>
|
||||||
|
</CompilerMessages>
|
||||||
|
<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>
|
34
bindings/gtk3/examples/gtkapplication/gtkapplicationtest.lpr
Normal file
34
bindings/gtk3/examples/gtkapplication/gtkapplicationtest.lpr
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
program gtkapplicationtest;
|
||||||
|
|
||||||
|
{$mode objfpc}{$H+}
|
||||||
|
|
||||||
|
uses
|
||||||
|
Classes, Math, GLib2, GObject2, Gtk3, Gio2;
|
||||||
|
|
||||||
|
var
|
||||||
|
App: PGtkApplication;
|
||||||
|
Win: PGtkApplicationWindow;
|
||||||
|
|
||||||
|
procedure activate(app: PGtkApplication; user_data: gpointer); cdecl;
|
||||||
|
begin
|
||||||
|
Win := TGtkApplicationWindow.new(App);
|
||||||
|
Win^.show_all;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure CreateApplication;
|
||||||
|
begin
|
||||||
|
App := TGtkApplication.new('org.gtkbinding.applicationtest', G_APPLICATION_NON_UNIQUE);
|
||||||
|
g_signal_connect_data(App, 'activate', TGCallback(@activate), nil, nil, G_CONNECT_AFTER);
|
||||||
|
App^.register(nil);
|
||||||
|
end;
|
||||||
|
procedure RunApplication;
|
||||||
|
begin
|
||||||
|
App^.run(argc, @argv);
|
||||||
|
end;
|
||||||
|
|
||||||
|
begin
|
||||||
|
SetExceptionMask([exInvalidOp, exDenormalized, exZeroDivide, exOverflow, exUnderflow, exPrecision]);
|
||||||
|
CreateApplication;
|
||||||
|
RunApplication;
|
||||||
|
end.
|
||||||
|
|
Reference in New Issue
Block a user