From 64a3fb1dc49c5939c75120031cf4fb4a1da9f53f Mon Sep 17 00:00:00 2001 From: drewski207 Date: Sun, 5 Jan 2014 14:41:52 +0000 Subject: [PATCH] Added Gtk3 GtkApplication example git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@2875 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- .../gtkapplication/gtkapplicationtest.lpi | 75 +++++++++++++++++++ .../gtkapplication/gtkapplicationtest.lpr | 34 +++++++++ 2 files changed, 109 insertions(+) create mode 100644 bindings/gtk3/examples/gtkapplication/gtkapplicationtest.lpi create mode 100644 bindings/gtk3/examples/gtkapplication/gtkapplicationtest.lpr diff --git a/bindings/gtk3/examples/gtkapplication/gtkapplicationtest.lpi b/bindings/gtk3/examples/gtkapplication/gtkapplicationtest.lpi new file mode 100644 index 000000000..56a57b02b --- /dev/null +++ b/bindings/gtk3/examples/gtkapplication/gtkapplicationtest.lpi @@ -0,0 +1,75 @@ + + + + + + + + + + + + + <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> diff --git a/bindings/gtk3/examples/gtkapplication/gtkapplicationtest.lpr b/bindings/gtk3/examples/gtkapplication/gtkapplicationtest.lpr new file mode 100644 index 000000000..e8a81bb76 --- /dev/null +++ b/bindings/gtk3/examples/gtkapplication/gtkapplicationtest.lpr @@ -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. +