Skip to content

Commit

Permalink
GTkl sample fixed & ported to Mercury; Win32 sample ported to Mercury…
Browse files Browse the repository at this point in the history
… (with bugs)
  • Loading branch information
dwarfland committed Sep 16, 2020
1 parent 761669e commit d6ebdf7
Show file tree
Hide file tree
Showing 13 changed files with 299 additions and 56 deletions.
4 changes: 2 additions & 2 deletions Hydrogene/Island/GUI/Basic Linux Gtk App/BasicGtkApp.sln
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@


Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
Expand All @@ -19,4 +19,4 @@ Global
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
EndGlobal
25 changes: 8 additions & 17 deletions Hydrogene/Island/GUI/Basic Linux Gtk App/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,11 @@

namespace BasicGtkApp
{

class Program
{

static GtkWindow *window;

static void clicked(GtkApplication app, Void *userdata)
static void clicked(GtkWidget app, Void *userdata)
{
var dialog = (GtkDialog *)gtk_message_dialog_new(null,
GtkDialogFlags.GTK_DIALOG_DESTROY_WITH_PARENT,
Expand All @@ -30,29 +28,22 @@ static void clicked(GtkApplication app, Void *userdata)
gtk_widget_destroy(dialog);
}

static void activate(GtkApplication *app, Void *userdata)
static Int32 Main(string[] args)
{
window = (GtkWindow *)gtk_application_window_new(app);
gtk_window_set_title(window, "RemObjects Elements - Island GTK Sample");
window = (GtkWindow *)gtk_window_new(GtkWindowType.GTK_WINDOW_TOPLEVEL);

gtk_window_set_title(window, "RemObjects C# - Island GTK Sample");
gtk_window_set_default_size(window, 200, 200);

var button_box = gtk_button_box_new(GtkOrientation.GTK_ORIENTATION_HORIZONTAL);
var button_box = gtk_hbutton_box_new();
gtk_container_add(window, button_box);

var button = gtk_button_new_with_label("Hello World");
g_signal_connect_data((glib.gpointer)button, "clicked", (glib.GVoidFunc)((void *)(clicked)), null, null, (GConnectFlags)0);
g_signal_connect_data((glib.gpointer)button, "clicked", (glib.GVoidFunc)((Void *)clicked), null, null, (GConnectFlags)0);
gtk_container_add((GtkContainer *)button_box, button);
gtk_widget_show_all(window);
}

static Int32 Main(string[] args)
{
var app = gtk_application_new ("org.gtk.example", gio.GApplicationFlags.G_APPLICATION_FLAGS_NONE);
g_signal_connect_data((glib.gpointer)app, "activate", (glib.GVoidFunc)((void *)(activate)), null, null, (GConnectFlags)0);
var status = g_application_run (app, ExternalCalls.nargs, ExternalCalls.args);
g_object_unref((glib.gpointer)app);
return status;
gtk_main();
}
}

}
4 changes: 2 additions & 2 deletions Iodine/Island/GUI/Basic Linux Gtk App/BasicGtkApp.sln
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@


Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
Expand All @@ -19,4 +19,4 @@ Global
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
EndGlobal
26 changes: 10 additions & 16 deletions Iodine/Island/GUI/Basic Linux Gtk App/Program.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
!!! GUI applications cannot be run via SSH or CrossBox 2, and they are also not supported on "Bash on Windows".
*/

class Program {

class Program
{
static GtkWindow *window;

static void clicked(GtkApplication app, Void *userdata)
static void clicked(GtkWidget app, Void *userdata)
{
var dialog = (GtkDialog *)gtk_message_dialog_new(null,
GtkDialogFlags.GTK_DIALOG_DESTROY_WITH_PARENT,
Expand All @@ -28,27 +28,21 @@ static void clicked(GtkApplication app, Void *userdata)
gtk_widget_destroy(dialog);
}

static void activate(GtkApplication *app, Void *userdata)
static Int32 Main(String[] args)
{
window = (GtkWindow *)gtk_application_window_new(app);
gtk_window_set_title(window, "RemObjects Elements - Island GTK Sample");
window = (GtkWindow *)gtk_window_new(GtkWindowType.GTK_WINDOW_TOPLEVEL);

gtk_window_set_title(window, "RemObjects C# - Island GTK Sample");
gtk_window_set_default_size(window, 200, 200);

var button_box = gtk_button_box_new(GtkOrientation.GTK_ORIENTATION_HORIZONTAL);
var button_box = gtk_hbutton_box_new();
gtk_container_add(window, button_box);

var button = gtk_button_new_with_label("Hello World");
g_signal_connect_data((glib.gpointer)button, "clicked", (glib.GVoidFunc)((void *)(clicked)), null, null, (GConnectFlags)0);
g_signal_connect_data((glib.gpointer)button, "clicked", (glib.GVoidFunc)((void *)clicked), null, null, (GConnectFlags)0);
gtk_container_add((GtkContainer *)button_box, button);
gtk_widget_show_all(window);
}

static Int32 Main(String[] args)
{
var app = gtk_application_new ("org.gtk.example", gio.GApplicationFlags.G_APPLICATION_FLAGS_NONE);
g_signal_connect_data((glib.gpointer)app, "activate", (glib.GVoidFunc)((void *)(activate)), null, null, (GConnectFlags)0);
var status = g_application_run (app, ExternalCalls.nargs, ExternalCalls.args);
g_object_unref((glib.gpointer)app);
return status;
gtk_main();
}
}
60 changes: 60 additions & 0 deletions Mercury/Island/GUI/Basic Linux Gtk App/BasicGtkApp.elements
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build" ToolsVersion="4.0">
<PropertyGroup>
<ProductVersion>3.5</ProductVersion>
<RootNamespace>BasicGtkApp</RootNamespace>
<ProjectGuid>{C34F7909-BC5D-4C8E-A693-8EDBA7E7058E}</ProjectGuid>
<OutputType>Executable</OutputType>
<AssemblyName>BasicGtkApp</AssemblyName>
<AllowGlobals>False</AllowGlobals>
<AllowLegacyWith>False</AllowLegacyWith>
<AllowLegacyOutParams>False</AllowLegacyOutParams>
<AllowLegacyCreate>False</AllowLegacyCreate>
<AllowUnsafeCode>False</AllowUnsafeCode>
<Configuration Condition="'$(Configuration)' == ''">Release</Configuration>
<Name>BasicGtkApp</Name>
<WarnOnCaseMismatch>True</WarnOnCaseMismatch>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<Optimize>False</Optimize>
<OutputPath>bin\Debug</OutputPath>
<DefineConstants>DEBUG;TRACE;</DefineConstants>
<GenerateDebugInfo>True</GenerateDebugInfo>
<CaptureConsoleOutput>False</CaptureConsoleOutput>
<StartMode>Project</StartMode>
<RuntimeVersion>v25</RuntimeVersion>
<XmlDoc>False</XmlDoc>
<XmlDocWarningLevel>WarningOnPublicMembers</XmlDocWarningLevel>
<EnableUnmanagedDebugging>False</EnableUnmanagedDebugging>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<Optimize>true</Optimize>
<OutputPath>.</OutputPath>
<GenerateDebugInfo>False</GenerateDebugInfo>
<EnableAsserts>False</EnableAsserts>
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
<CaptureConsoleOutput>False</CaptureConsoleOutput>
<StartMode>Project</StartMode>
<RegisterForComInterop>False</RegisterForComInterop>
<RuntimeVersion>v25</RuntimeVersion>
<XmlDoc>False</XmlDoc>
<XmlDocWarningLevel>WarningOnPublicMembers</XmlDocWarningLevel>
<EnableUnmanagedDebugging>False</EnableUnmanagedDebugging>
</PropertyGroup>
<ItemGroup>
<Reference Include="atk" />
<Reference Include="cairo" />
<Reference Include="gc" />
<Reference Include="gdk" />
<Reference Include="glib" />
<Reference Include="gtk" />
<Reference Include="Island" />
<Reference Include="pango" />
<Reference Include="rtl" />
<Reference Include="Swift" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.vb" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\RemObjects Software\Elements\RemObjects.Elements.Island.Linux.targets" />
</Project>
22 changes: 22 additions & 0 deletions Mercury/Island/GUI/Basic Linux Gtk App/BasicGtkApp.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{656346D9-4656-40DA-A068-22D5425D4639}") = "BasicGtkApp", "BasicGtkApp.elements", "{C34F7909-BC5D-4C8E-A693-8EDBA7E7058E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Default = Debug|Default
Release|Default = Release|Default
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{C34F7909-BC5D-4C8E-A693-8EDBA7E7058E}.Debug|Default.ActiveCfg = Debug
{C34F7909-BC5D-4C8E-A693-8EDBA7E7058E}.Debug|Default.Build.0 = Debug
{C34F7909-BC5D-4C8E-A693-8EDBA7E7058E}.Release|Default.ActiveCfg = Release
{C34F7909-BC5D-4C8E-A693-8EDBA7E7058E}.Release|Default.Build.0 = Release
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
35 changes: 35 additions & 0 deletions Mercury/Island/GUI/Basic Linux Gtk App/Program.vb
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// based on https://developer.gnome.org/gtk3/stable/gtk-getting-started.html

Imports atk
Imports gobject
Imports gio
Imports gtk

/*
!!! Please note: in order to run this sample, you need to manually copy it to a Linux PC or VM with an active GUI, and run it.
!!!
!!! GUI applications cannot be run via SSH or CrossBox 2, and they are also not supported on "Bash on Windows".
*/

Class Program
Shared Dim window As Ptr(Of GtkWindow)

Shared Sub clicked(app As GtkWidget, userdata As Ptr(Of Void))
Dim dialog = TryCast(gtk_message_dialog_new(Null, GtkDialogFlags.GTK_DIALOG_DESTROY_WITH_PARENT, GtkMessageType.GTK_MESSAGE_INFO, GtkButtonsType.GTK_BUTTONS_OK, "Hello World!"), Ptr(Of GtkDialog))
gtk_dialog_run(dialog)
gtk_widget_destroy(dialog)
End Sub

Shared Function Main(args As String()) As Int32
window = TryCast(gtk_window_new(GtkWindowType.GTK_WINDOW_TOPLEVEL), Ptr(Of GtkWindow))
gtk_window_set_title(window, "RemObjects C# - Island GTK Sample")
gtk_window_set_default_size(window, 200, 200)
Dim button_box = gtk_hbutton_box_new()
gtk_container_add(window, button_box)
Dim button = gtk_button_new_with_label("Hello World")
g_signal_connect_data(TryCast(button, glib.gpointer), "clicked", TryCast(TryCast(AddressOf(clicked), Ptr(Of Void)), glib.GVoidFunc), Null, Null, TryCast(0, GConnectFlags))
gtk_container_add(TryCast(button_box, Ptr(Of GtkContainer)), button)
gtk_widget_show_all(window)
gtk_main()
End Function
End Class
54 changes: 54 additions & 0 deletions Mercury/Island/GUI/Basic Windows GUI App/BasicWindowsApp.elements
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build" ToolsVersion="4.0">
<PropertyGroup>
<ProductVersion>3.5</ProductVersion>
<RootNamespace>BasicWindowsApp</RootNamespace>
<ProjectGuid>{186BBBBD-FEB0-4658-92A8-6CA339FD27BB}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AssemblyName>BasicWindowsApp</AssemblyName>
<AllowGlobals>False</AllowGlobals>
<AllowLegacyWith>False</AllowLegacyWith>
<AllowLegacyOutParams>False</AllowLegacyOutParams>
<AllowLegacyCreate>False</AllowLegacyCreate>
<AllowUnsafeCode>False</AllowUnsafeCode>
<Configuration Condition="'$(Configuration)' == ''">Release</Configuration>
<Name>BasicWindowsApp</Name>
<WarnOnCaseMismatch>True</WarnOnCaseMismatch>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<Optimize>False</Optimize>
<OutputPath>bin\Debug</OutputPath>
<DefineConstants>DEBUG;TRACE;</DefineConstants>
<GenerateDebugInfo>True</GenerateDebugInfo>
<CaptureConsoleOutput>False</CaptureConsoleOutput>
<StartMode>Project</StartMode>
<RuntimeVersion>v25</RuntimeVersion>
<XmlDoc>False</XmlDoc>
<XmlDocWarningLevel>WarningOnPublicMembers</XmlDocWarningLevel>
<EnableUnmanagedDebugging>False</EnableUnmanagedDebugging>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<Optimize>true</Optimize>
<OutputPath>.</OutputPath>
<GenerateDebugInfo>False</GenerateDebugInfo>
<EnableAsserts>False</EnableAsserts>
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
<CaptureConsoleOutput>False</CaptureConsoleOutput>
<StartMode>Project</StartMode>
<RegisterForComInterop>False</RegisterForComInterop>
<RuntimeVersion>v25</RuntimeVersion>
<XmlDoc>False</XmlDoc>
<XmlDocWarningLevel>WarningOnPublicMembers</XmlDocWarningLevel>
<EnableUnmanagedDebugging>False</EnableUnmanagedDebugging>
</PropertyGroup>
<ItemGroup>
<Reference Include="gc" />
<Reference Include="Island" />
<Reference Include="rtl" />
<Reference Include="Swift" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.vb" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\RemObjects Software\Elements\RemObjects.Elements.Island.Windows.targets" />
</Project>
20 changes: 20 additions & 0 deletions Mercury/Island/GUI/Basic Windows GUI App/BasicWindowsApp.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# RemObjects Fire
Project("{656346D9-4656-40DA-A068-22D5425D4639}") = "BasicWindowsApp", "BasicWindowsApp.elements", "{186BBBBD-FEB0-4658-92A8-6CA339FD27BB}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|AnyCPU = Debug|AnyCPU
Release|AnyCPU = Release|AnyCPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{186BBBBD-FEB0-4658-92A8-6CA339FD27BB}.Debug|AnyCPU.ActiveCfg = Debug|AnyCPU
{186BBBBD-FEB0-4658-92A8-6CA339FD27BB}.Debug|AnyCPU.Build.0 = Debug|AnyCPU
{186BBBBD-FEB0-4658-92A8-6CA339FD27BB}.Release|AnyCPU.ActiveCfg = Release|AnyCPU
{186BBBBD-FEB0-4658-92A8-6CA339FD27BB}.Release|AnyCPU.Build.0 = Release|AnyCPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
Loading

0 comments on commit d6ebdf7

Please sign in to comment.