Add VBNet templates

This commit is contained in:
cra0zy 2017-11-02 22:13:53 +01:00
parent e621c368bd
commit 5e905ba3e4
21 changed files with 400 additions and 14 deletions

View file

@ -3,7 +3,7 @@
<metadata>
<id>GtkSharp.Template.CSharp</id>
<version>3.0.0</version>
<title>Gtk template for CSharp</title>
<title>Gtk templates for CSharp</title>
<summary>A set of C# templates for your .Net Core Gtk Application.</summary>
<description>A set of C# templates for your .Net Core Gtk Application.</description>
<authors>GtkSharp Contributors</authors>
@ -11,7 +11,7 @@
<projectUrl>https://github.com/GtkSharp/GtkSharp</projectUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<releaseNotes></releaseNotes>
<tags>gtk gtksharp gtk-sharp app dotnet new template</tags>
<tags>gtk gtksharp gtk-sharp app dotnet new template c# csharp</tags>
<packageTypes>
<packageType name="Template" />
</packageTypes>

View file

@ -19,11 +19,11 @@ namespace GtkNamespace
{
builder.Autoconnect(this);
DeleteEvent += OnDeleteEvent;
DeleteEvent += Window_DeleteEvent;
_button1.Clicked += Button1_Clicked;
}
private void OnDeleteEvent(object sender, DeleteEventArgs a)
private void Window_DeleteEvent(object sender, DeleteEventArgs a)
{
Application.Quit();
}

View file

@ -10,12 +10,13 @@ namespace GtkNamespace
private Gtk_Dialog(Builder builder) : base(builder.GetObject("Gtk_Dialog").Handle)
{
builder.Autoconnect(this);
DefaultResponse = ResponseType.Cancel;
Response += OnResponse;
Response += Dialog_Response;
}
private void OnResponse(object o, ResponseArgs args)
private void Dialog_Response(object o, ResponseArgs args)
{
Hide();
}

View file

@ -10,7 +10,7 @@ namespace GtkNamespace
private Gtk_Widget(Builder builder) : base(builder.GetObject("Gtk_Widget").Handle)
{
builder.Autoconnect(this);
}
}
}

View file

@ -11,13 +11,6 @@ namespace GtkNamespace
private Gtk_Window(Builder builder) : base(builder.GetObject("Gtk_Window").Handle)
{
builder.Autoconnect(this);
DeleteEvent += OnDeleteEvent;
}
private void OnDeleteEvent(object sender, DeleteEventArgs a)
{
Application.Quit();
}
}
}

View file

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<package>
<metadata>
<id>GtkSharp.Template.VBNet</id>
<version>3.0.0</version>
<title>Gtk templates for VBNet</title>
<summary>A set of VB templates for your .Net Core Gtk Application.</summary>
<description>A set of VB templates for your .Net Core Gtk Application.</description>
<authors>GtkSharp Contributors</authors>
<owners>GtkSharp Contributors</owners>
<projectUrl>https://github.com/GtkSharp/GtkSharp</projectUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<releaseNotes></releaseNotes>
<tags>gtk gtksharp gtk-sharp app dotnet new template vbnet vb</tags>
<packageTypes>
<packageType name="Template" />
</packageTypes>
</metadata>
</package>

View file

@ -0,0 +1,18 @@
{
"$schema": "http://json.schemastore.org/template",
"author": "GtkSharp Contributors",
"classifications": [
"Gtk",
"GUI App"
],
"name": "Gtk Application",
"identity": "GtkSharp.Application.VBNet",
"groupIdentity": "GtkSharp.Application",
"shortName": "gtkapp",
"tags": {
"language": "VB",
"type": "project"
},
"sourceName": "GtkNamespace",
"preferNameDirectory": true
}

View file

@ -0,0 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<EmbeddedResource Include="**/*.glade">
<LogicalName>%(Filename)%(Extension)</LogicalName>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<PackageReference Include="GtkSharp" Version="3.22.24.10" />
</ItemGroup>
</Project>

View file

@ -0,0 +1,46 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<requires lib="gtk+" version="3.18"/>
<object class="GtkWindow" id="MainWindow">
<property name="can_focus">False</property>
<property name="title" translatable="yes">Example Window</property>
<property name="default_width">480</property>
<property name="default_height">240</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">4</property>
<property name="margin_right">4</property>
<property name="margin_top">4</property>
<property name="margin_bottom">4</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkLabel" id="_label1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Hello World!</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="_button1">
<property name="label" translatable="yes">Click me!</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="receives_default">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
</interface>

View file

@ -0,0 +1,37 @@
Imports System
Imports Gtk
Imports UI = Gtk.Builder.ObjectAttribute
Namespace GtkNamespace
Public Class MainWindow
Inherits Window
Private _counter = 0
<UI>Private _label1 As Label
<UI>Private _button1 As Button
Public Sub New (builder as Builder)
MyBase.New(builder.GetObject("MainWindow").Handle)
builder.Autoconnect (Me)
AddHandler MyBase.DeleteEvent, AddressOf Window_Delete
AddHandler _button1.Clicked, AddressOf Button1_Clicked
End Sub
Public Sub New ()
Me.New(new Builder("MainWindow.glade"))
End Sub
Private Sub Window_Delete (ByVal sender As Object, ByVal a As DeleteEventArgs)
Application.Quit ()
a.RetVal = true
End Sub
Private Sub Button1_Clicked (ByVal sender As Object, ByVal a As EventArgs)
_counter += 1
_label1.Text = "Hello World! This button has been clicked " + _counter.ToString() + " time(s)."
End Sub
End Class
End Namespace

View file

@ -0,0 +1,21 @@
Imports System
Imports Gtk
Namespace GtkNamespace
Public Class MainClass
Public Shared Sub Main ()
Application.Init ()
Dim app as new Application ("org.GtkNamespace.GtkNamespace", GLib.ApplicationFlags.None)
app.Register (GLib.Cancellable.Current)
Dim win as new MainWindow ()
app.AddWindow (win)
win.Show ()
Application.Run ()
End Sub
End Class
End Namespace

View file

@ -0,0 +1,32 @@
{
"$schema": "http://json.schemastore.org/template",
"author": "GtkSharp Contributors",
"classifications": [
"Gtk",
"UI"
],
"name": "Gtk Dialog",
"identity": "GtkSharp.Dialog.VBNet",
"groupIdentity": "GtkSharp.Dialog",
"shortName": "gtkdialog",
"tags": {
"language": "VB"
},
"sourceName": "Gtk_Dialog",
"primaryOutputs": [
{
"path": "Gtk_Dialog.vb"
},
{
"path": "Gtk_Dialog.glade"
}
],
"defaultName": "Gtk_Dialog",
"symbols": {
"namespace": {
"description": "Namespace for the generated files",
"replaces": "GtkNamespace",
"type": "parameter"
}
}
}

View file

@ -0,0 +1,51 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<requires lib="gtk+" version="3.18"/>
<object class="GtkDialog" id="Gtk_Dialog">
<property name="can_focus">False</property>
<property name="default_width">320</property>
<property name="default_height">260</property>
<property name="type_hint">dialog</property>
<child internal-child="vbox">
<object class="GtkBox">
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">2</property>
<child internal-child="action_area">
<object class="GtkButtonBox">
<property name="can_focus">False</property>
<property name="layout_style">end</property>
<child>
<placeholder/>
</child>
<child>
<object class="GtkButton" id="button1">
<property name="label">gtk-close</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<placeholder/>
</child>
</object>
</child>
<action-widgets>
<action-widget response="-7">button1</action-widget>
</action-widgets>
</object>
</interface>

View file

@ -0,0 +1,27 @@
Imports System
Imports Gtk
Imports UI = Gtk.Builder.ObjectAttribute
Namespace GtkNamespace
Public Class Gtk_Dialog
Inherits Dialog
Public Sub New (builder as Builder)
MyBase.New (builder.GetObject("Gtk_Dialog").Handle)
builder.Autoconnect (Me)
DefaultResponse = ResponseType.Cancel
AddHandler MyBase.Response, AddressOf Dialog_OnResponse
End Sub
Public Sub New ()
Me.New (new Builder ("Gtk_Dialog.glade"))
End Sub
Private Sub Dialog_OnResponse (ByVal sender As Object, ByVal args As ResponseArgs)
Hide ()
End Sub
End Class
End Namespace

View file

@ -0,0 +1,32 @@
{
"$schema": "http://json.schemastore.org/template",
"author": "GtkSharp Contributors",
"classifications": [
"Gtk",
"UI"
],
"name": "Gtk Widget",
"identity": "GtkSharp.Widget.VBNet",
"groupIdentity": "GtkSharp.Widget",
"shortName": "gtkwidget",
"tags": {
"language": "VB"
},
"sourceName": "Gtk_Widget",
"primaryOutputs": [
{
"path": "Gtk_Widget.vb"
},
{
"path": "Gtk_Widget.glade"
}
],
"defaultName": "Gtk_Widget",
"symbols": {
"namespace": {
"description": "Namespace for the generated files",
"replaces": "GtkNamespace",
"type": "parameter"
}
}
}

View file

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<requires lib="gtk+" version="3.18"/>
<object class="GtkBox" id="${EscapedIdentifier}">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<placeholder/>
</child>
</object>
</interface>

View file

@ -0,0 +1,20 @@
Imports System
Imports Gtk
Imports UI = Gtk.Builder.ObjectAttribute
Namespace GtkNamespace
Public Class Gtk_Widget
Inherits Box
Public Sub New (builder as Builder)
MyBase.New (builder.GetObject("Gtk_Widget").Handle)
builder.Autoconnect (Me)
End Sub
Public Sub New ()
Me.New (new Builder("Gtk_Widget.glade"))
End Sub
End Class
End Namespace

View file

@ -0,0 +1,32 @@
{
"$schema": "http://json.schemastore.org/template",
"author": "GtkSharp Contributors",
"classifications": [
"Gtk",
"UI"
],
"name": "Gtk Window",
"identity": "GtkSharp.Window.VBNet",
"groupIdentity": "GtkSharp.Window",
"shortName": "gtkwindow",
"tags": {
"language": "VB"
},
"sourceName": "Gtk_Window",
"primaryOutputs": [
{
"path": "Gtk_Window.vb"
},
{
"path": "Gtk_Window.glade"
}
],
"defaultName": "Gtk_Window",
"symbols": {
"namespace": {
"description": "Namespace for the generated files",
"replaces": "GtkNamespace",
"type": "parameter"
}
}
}

View file

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<requires lib="gtk+" version="3.18"/>
<object class="GtkWindow" id="Gtk_Window">
<property name="can_focus">False</property>
<property name="title" translatable="yes">Gtk_Window</property>
<child>
<placeholder/>
</child>
</object>
</interface>

View file

@ -0,0 +1,20 @@
Imports System
Imports Gtk
Imports UI = Gtk.Builder.ObjectAttribute
Namespace GtkNamespace
Public Class Gtk_Window
Inherits Window
Public Sub New (builder as Builder)
MyBase.New (builder.GetObject("Gtk_Window").Handle)
builder.Autoconnect (Me)
End Sub
Public Sub New ()
Me.New (new Builder ("Gtk_Window.glade"))
End Sub
End Class
End Namespace

View file

@ -123,6 +123,7 @@ Task("PackageTemplates")
};
NuGetPack("Source/Templates/NetCore/GtkSharp.Template.CSharp/GtkSharp.Template.CSharp.nuspec", settings);
NuGetPack("Source/Templates/NetCore/GtkSharp.Template.VBNet/GtkSharp.Template.VBNet.nuspec", settings);
});
// TASK TARGETS