├── .gitignore
├── LICENSE
├── README.md
├── build.gradle.kts
├── examples
├── counter-gtk
│ ├── build.gradle.kts
│ └── src
│ │ └── nativeMain
│ │ └── kotlin
│ │ └── Main.kt
├── demo-adwaita
│ ├── build.gradle.kts
│ └── src
│ │ └── nativeMain
│ │ └── kotlin
│ │ ├── AboutDemo.kt
│ │ ├── ButtonDemo.kt
│ │ ├── Main.kt
│ │ └── ToastDemo.kt
├── gtk-examples
│ ├── build.gradle.kts
│ └── src
│ │ └── nativeMain
│ │ └── kotlin
│ │ ├── customwidget
│ │ └── CustomWidgetExample.kt
│ │ ├── customwidgetbinding
│ │ └── CustomWidgetBindingExample.kt
│ │ ├── gridview
│ │ └── GridViewExample.kt
│ │ ├── listmodel
│ │ └── ListModelExample.kt
│ │ └── treelistmodel
│ │ └── TreeListModelExample.kt
├── hello-world-gtk
│ ├── build.gradle.kts
│ └── src
│ │ └── nativeMain
│ │ └── kotlin
│ │ └── Main.kt
├── sevenguis-1-counter
│ ├── build.gradle.kts
│ └── src
│ │ └── nativeMain
│ │ └── kotlin
│ │ └── Main.kt
├── sevenguis-2-temperature-converter
│ ├── build.gradle.kts
│ └── src
│ │ └── nativeMain
│ │ └── kotlin
│ │ └── Main.kt
└── sevenguis-3-flight-booker
│ ├── build.gradle.kts
│ └── src
│ └── nativeMain
│ └── kotlin
│ └── Main.kt
├── gio-bindings
├── build.gradle.kts
└── src
│ ├── nativeInterop
│ └── cinterop
│ │ └── gio.def
│ ├── nativeMain
│ └── kotlin
│ │ └── bindings
│ │ └── gio
│ │ ├── Action.kt
│ │ ├── ActionGroup.kt
│ │ ├── ActionMap.kt
│ │ ├── ActionMapExt.kt
│ │ ├── Application.kt
│ │ ├── Extensions.kt
│ │ ├── ListModel.kt
│ │ ├── ListStore.kt
│ │ ├── Menu.kt
│ │ ├── MenuItem.kt
│ │ ├── MenuModel.kt
│ │ ├── Permission.kt
│ │ ├── SimpleAction.kt
│ │ ├── SimplePermission.kt
│ │ └── internal
│ │ ├── InterfaceWrappers.kt
│ │ └── Signals.kt
│ └── nativeTest
│ └── kotlin
│ ├── GApplicationTest.kt
│ └── ListStoreTests.kt
├── gobject-bindings
├── build.gradle.kts
└── src
│ ├── nativeInterop
│ └── cinterop
│ │ └── gobject.def
│ ├── nativeMain
│ └── kotlin
│ │ ├── bindings
│ │ ├── glib
│ │ │ ├── Variant.kt
│ │ │ └── VariantType.kt
│ │ ├── gobject
│ │ │ ├── Binding.kt
│ │ │ ├── Extensions.kt
│ │ │ ├── Object.kt
│ │ │ ├── ObjectCompanion.kt
│ │ │ ├── ParamSpec.kt
│ │ │ └── ParamSpecString.kt
│ │ └── util
│ │ │ └── Util.kt
│ │ ├── internal
│ │ ├── KGType.kt
│ │ ├── Signals.kt
│ │ ├── TypeRegistry.kt
│ │ └── objectproperties
│ │ │ ├── IntObjectProperty.kt
│ │ │ ├── NullableStringObjectProperty.kt
│ │ │ ├── ObjectClassProperties.kt
│ │ │ ├── ObjectPropertyDelegate.kt
│ │ │ └── StringObjectProperty.kt
│ │ └── usertypes
│ │ ├── KGObjectProperty.kt
│ │ └── UserTypes.kt
│ └── nativeTest
│ └── kotlin
│ ├── CustomObjectPropertiesTest.kt
│ ├── CustomObjectTest.kt
│ └── GObjectTests.kt
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── gtk-bindings
├── build.gradle.kts
└── src
│ ├── nativeInterop
│ └── cinterop
│ │ └── gtk.def
│ ├── nativeMain
│ └── kotlin
│ │ └── bindings
│ │ └── gtk
│ │ ├── AboutDialog.kt
│ │ ├── Actionable.kt
│ │ ├── Adjustment.kt
│ │ ├── Application.kt
│ │ ├── ApplicationWindow.kt
│ │ ├── AspectFrame.kt
│ │ ├── Border.kt
│ │ ├── Box.kt
│ │ ├── Button.kt
│ │ ├── CenterBox.kt
│ │ ├── CheckButton.kt
│ │ ├── ColumnView.kt
│ │ ├── Dialog.kt
│ │ ├── DropDown.kt
│ │ ├── Editable.kt
│ │ ├── Entry.kt
│ │ ├── EntryBuffer.kt
│ │ ├── Extensions.kt
│ │ ├── Grid.kt
│ │ ├── GridView.kt
│ │ ├── HeaderBar.kt
│ │ ├── Image.kt
│ │ ├── Label.kt
│ │ ├── LevelBar.kt
│ │ ├── LinkButton.kt
│ │ ├── ListBase.kt
│ │ ├── ListBox.kt
│ │ ├── ListBoxRow.kt
│ │ ├── ListItem.kt
│ │ ├── ListItemFactory.kt
│ │ ├── ListView.kt
│ │ ├── LockButton.kt
│ │ ├── MenuButton.kt
│ │ ├── MessageDialog.kt
│ │ ├── Native.kt
│ │ ├── Orientable.kt
│ │ ├── Popover.kt
│ │ ├── ProgressBar.kt
│ │ ├── Root.kt
│ │ ├── Scrollable.kt
│ │ ├── ScrolledWindow.kt
│ │ ├── Searchbar.kt
│ │ ├── SelectionModel.kt
│ │ ├── Separator.kt
│ │ ├── ShortcutManager.kt
│ │ ├── ShortcutsWindow.kt
│ │ ├── SignalListItemFactory.kt
│ │ ├── SingleSelection.kt
│ │ ├── Stack.kt
│ │ ├── StackPage.kt
│ │ ├── StackSidebar.kt
│ │ ├── StringList.kt
│ │ ├── StringObject.kt
│ │ ├── Switch.kt
│ │ ├── ToggleButton.kt
│ │ ├── TreeExpander.kt
│ │ ├── TreeListModel.kt
│ │ ├── TreeListRow.kt
│ │ ├── Widget.kt
│ │ ├── Window.kt
│ │ ├── internal
│ │ ├── InterfaceWrappers.kt
│ │ └── Signals.kt
│ │ └── usertypes
│ │ └── WidgetCompanion.kt
│ └── nativeTest
│ └── kotlin
│ └── bindings.gtk
│ ├── CustomGtkApplicationTest.kt
│ ├── CustomWidgetTest.kt
│ ├── GtkAboutDialogTest.kt
│ ├── GtkApplicationTest.kt
│ ├── GtkBoxTest.kt
│ ├── GtkButtonTest.kt
│ ├── GtkDialogTest.kt
│ ├── GtkHeaderBartest.kt
│ ├── GtkLabelTests.kt
│ ├── GtkListBoxTest.kt
│ ├── GtkMenuButtonTest.kt
│ ├── SignalListItemFactoryTest.kt
│ ├── WindowTests.kt
│ └── testutils
│ └── GtkTestBase.kt
├── libadwaita-bindings
├── build.gradle.kts
└── src
│ ├── nativeInterop
│ └── cinterop
│ │ └── adwaita.def
│ ├── nativeMain
│ └── kotlin
│ │ └── bindings.adw
│ │ ├── AboutWindow.kt
│ │ ├── ActionRow.kt
│ │ ├── Application.kt
│ │ ├── ApplicationWindow.kt
│ │ ├── Avatar.kt
│ │ ├── Bin.kt
│ │ ├── ButtonContent.kt
│ │ ├── Clamp.kt
│ │ ├── ClampScrollable.kt
│ │ ├── ComboRow.kt
│ │ ├── EntryRow.kt
│ │ ├── ExpanderRow.kt
│ │ ├── Extensions.kt
│ │ ├── Flap.kt
│ │ ├── HeaderBar.kt
│ │ ├── Leaflet.kt
│ │ ├── LeafletPage.kt
│ │ ├── MessageDialog.kt
│ │ ├── PasswordEntryRow.kt
│ │ ├── PreferencesGroup.kt
│ │ ├── PreferencesPage.kt
│ │ ├── PreferencesRow.kt
│ │ ├── PreferencesWindow.kt
│ │ ├── SplitButton.kt
│ │ ├── StatusPage.kt
│ │ ├── TabBar.kt
│ │ ├── TabPage.kt
│ │ ├── TabView.kt
│ │ ├── Toast.kt
│ │ ├── ToastOverlay.kt
│ │ ├── ViewStack.kt
│ │ ├── ViewStackPage.kt
│ │ ├── ViewSwitcher.kt
│ │ ├── ViewSwitcherBar.kt
│ │ ├── ViewSwitcherTitle.kt
│ │ ├── Window.kt
│ │ ├── WindowTitle.kt
│ │ └── internal
│ │ └── Signals.kt
│ └── nativeTest
│ └── kotlin
│ ├── AdMessageDialogTest.kt
│ ├── AdwAboutWindowTest.kt
│ ├── AdwActionRowTest.kt
│ ├── AdwApplicationTest.kt
│ ├── AdwApplicationWindowTest.kt
│ ├── AdwAvatarTest.kt
│ ├── AdwButtonContentTest.kt
│ ├── AdwClampTest.kt
│ ├── AdwHeaderBarTest.kt
│ ├── AdwPreferencesTest.kt
│ ├── AdwStatusPageTest.kt
│ ├── AdwStyleClassesTest.kt
│ ├── AdwTabBarTest.kt
│ ├── AdwTestBase.kt
│ ├── AdwToastTest.kt
│ ├── AdwViewSwitcherTest.kt
│ ├── AdwWindowTest.kt
│ ├── ApplicationUnrefTest.kt
│ └── SubclassAdwBinTest.kt
└── settings.gradle.kts
/.gitignore:
--------------------------------------------------------------------------------
1 | .gradle/
2 | .idea/
3 | build/
4 | .envrc
5 | .env
6 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2022 Steven Van Bael
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
--------------------------------------------------------------------------------
/build.gradle.kts:
--------------------------------------------------------------------------------
1 | plugins {
2 | kotlin("multiplatform") version "1.7.20"
3 | id("org.jetbrains.dokka") version "1.7.20"
4 | }
5 |
6 | allprojects {
7 | group = "io.quantus.gtk-kotlin-native"
8 | version = "0.0.1-SNAPSHOT"
9 | repositories {
10 | mavenCentral()
11 | }
12 | }
13 |
14 | kotlin {
15 | mingwX64()
16 | macosX64()
17 | linuxX64()
18 | }
19 |
20 |
21 |
--------------------------------------------------------------------------------
/examples/counter-gtk/build.gradle.kts:
--------------------------------------------------------------------------------
1 | plugins {
2 | kotlin("multiplatform")
3 | }
4 |
5 | kotlin {
6 | val hostOs = System.getProperty("os.name")
7 | val isMingwX64 = hostOs.startsWith("Windows")
8 | val nativeTarget = when {
9 | hostOs == "Mac OS X" -> macosX64("native")
10 | hostOs == "Linux" -> linuxX64("native")
11 | isMingwX64 -> mingwX64("native")
12 | else -> throw GradleException("Host OS is not supported in Kotlin/Native.")
13 | }
14 | sourceSets {
15 | val nativeMain by getting {
16 | dependencies {
17 | implementation(project(":gtk-bindings"))
18 | }
19 | }
20 | }
21 |
22 | nativeTarget.apply {
23 | binaries {
24 | executable {
25 | entryPoint = "main"
26 | if (isMingwX64) {
27 | val userHome = File(System.getenv("USERPROFILE"))
28 | linkerOpts(
29 | "-L${userHome}\\.konan\\dependencies\\msys2-mingw-w64-x86_64-2\\x86_64-w64-mingw32\\lib",
30 | "-LC:\\msys64\\mingw64\\lib",
31 | )
32 | }
33 | }
34 | }
35 | }
36 | }
--------------------------------------------------------------------------------
/examples/counter-gtk/src/nativeMain/kotlin/Main.kt:
--------------------------------------------------------------------------------
1 | import bindings.gtk.*
2 | import native.gtk.GtkAlign.GTK_ALIGN_CENTER
3 | import native.gtk.GtkOrientation.GTK_ORIENTATION_VERTICAL
4 |
5 | fun main() {
6 | val app = Application("com.example.counter")
7 |
8 | var counter = 0
9 |
10 | app.onActivate {
11 | // create the window
12 | val window = ApplicationWindow(app)
13 | window.title = "Hello World"
14 | window.defaultSize = Pair(600, 400)
15 |
16 | // create the widgets
17 | val label = Label()
18 | val button = Button("Click me")
19 |
20 | // attach a button click handler
21 | button.onClicked {
22 | label.text = "You clicked ${++counter} times"
23 | }
24 |
25 | // wrap in a box for layout
26 | window.child = Box(GTK_ORIENTATION_VERTICAL, 20).apply {
27 | valign = GTK_ALIGN_CENTER
28 | append(button)
29 | append(label)
30 | }
31 |
32 | // show the window
33 | window.show()
34 | }
35 |
36 | app.runApplication()
37 | app.unref()
38 | }
--------------------------------------------------------------------------------
/examples/demo-adwaita/build.gradle.kts:
--------------------------------------------------------------------------------
1 | plugins {
2 | kotlin("multiplatform")
3 | }
4 |
5 | kotlin {
6 | val hostOs = System.getProperty("os.name")
7 | val isMingwX64 = hostOs.startsWith("Windows")
8 | val nativeTarget = when {
9 | hostOs == "Mac OS X" -> macosX64("native")
10 | hostOs == "Linux" -> linuxX64("native")
11 | isMingwX64 -> mingwX64("native")
12 | else -> throw GradleException("Host OS is not supported in Kotlin/Native.")
13 | }
14 | sourceSets {
15 | val nativeMain by getting {
16 | dependencies {
17 | implementation(project(":libadwaita-bindings"))
18 | }
19 | }
20 | }
21 |
22 | nativeTarget.apply {
23 | binaries {
24 | executable {
25 | entryPoint = "main"
26 | if (isMingwX64) {
27 | val userHome = File(System.getenv("USERPROFILE"))
28 | linkerOpts(
29 | "-L${userHome}\\.konan\\dependencies\\msys2-mingw-w64-x86_64-2\\x86_64-w64-mingw32\\lib",
30 | "-LC:\\msys64\\mingw64\\lib",
31 | )
32 | }
33 | }
34 | }
35 | }
36 | }
--------------------------------------------------------------------------------
/examples/demo-adwaita/src/nativeMain/kotlin/AboutDemo.kt:
--------------------------------------------------------------------------------
1 | import bindings.adw.AboutWindow
2 | import bindings.adw.Clamp
3 | import bindings.adw.StatusPage
4 | import bindings.gtk.Button
5 | import native.gtk.GtkLicense
6 |
7 | fun buildAboutPage() = StatusPage().apply {
8 | title = "About Demo"
9 | child = Clamp().apply {
10 | maximumSize = 400
11 | child = Button("Show About").apply {
12 | onClicked { showAbout() }
13 | addCssClass("pill")
14 | }
15 | }
16 | }
17 |
18 | fun showAbout() {
19 | val about = AboutWindow()
20 |
21 | about.applicationIcon = "folder-music"
22 | about.applicationName = "Adwaita Demo"
23 | about.artists = listOf("Chuck Schuldiner", "Chris Cornell", "Layne Staley")
24 | about.comments = "Sample comments."
25 | about.copyright = "Copyright 2022 - Steven Van Bael"
26 | about.debugInfo = "Sample debug info."
27 | about.debugInfoFilename = "/tmp/debug.txt"
28 | about.designers = listOf("Designer 1", "Designer 2")
29 | about.developerName = "Steven Van Bael"
30 | about.developers = listOf("Steven Van Bael", "Mystery Developer")
31 | about.documenters = listOf("Documenter 1", "Documenter 2")
32 | about.issueUrl = "https://github.com/vbsteven/gtk-kotlin-native/issues"
33 | about.license = "The License Text"
34 | about.licenseType = GtkLicense.GTK_LICENSE_MIT_X11
35 | about.releaseNotes = """
36 |
37 | - Cool feature
38 | - Another cool feature
39 | - More cool features
40 |
41 | """
42 | about.releaseNotesVersion = "0.0.1"
43 | about.supportUrl = about.issueUrl
44 | about.translatorCredits = "Credit to the translators"
45 | about.version = "0.0.1"
46 | about.website = "https://github.com/vbsteven/gtk-kotlin-native"
47 | about.show()
48 | }
--------------------------------------------------------------------------------
/examples/demo-adwaita/src/nativeMain/kotlin/ToastDemo.kt:
--------------------------------------------------------------------------------
1 | import bindings.adw.*
2 | import bindings.gtk.Button
3 | import bindings.gtk.Widget
4 | import native.gtk.GtkAlign
5 |
6 | lateinit var overlay: ToastOverlay
7 |
8 | fun buildToastDemoPage(): Widget {
9 | overlay = ToastOverlay()
10 | overlay.vexpand = true
11 |
12 | val page = StatusPage().apply {
13 | vexpand = true
14 | title = "Toasts"
15 | child = buildToastList()
16 | valign = GtkAlign.GTK_ALIGN_START
17 | }
18 |
19 | overlay.child = page
20 |
21 | return overlay
22 | }
23 |
24 | fun buildToastList(): Widget {
25 |
26 | val prefGroup = PreferencesGroup()
27 |
28 | prefGroup.add(demoToastRow("Simple Toast", ::showSimpleToast))
29 | prefGroup.add(demoToastRow("Toast with button", ::showButtonToast))
30 | prefGroup.add(demoToastRow("Custom Title", ::showCustomTitleToast))
31 |
32 | return Clamp().apply {
33 | maximumSize = 400
34 | tighteningThreshold = 300
35 | child = prefGroup
36 | }
37 | }
38 |
39 | private fun demoToastRow(label: String, handler: () -> Unit) = ActionRow().apply {
40 | this.title = label
41 | this.addSuffix(
42 | Button("Show").apply {
43 | valign = GtkAlign.GTK_ALIGN_CENTER
44 | onClicked { handler() }
45 | }
46 | )
47 | }
48 |
49 | fun showSimpleToast() = overlay.addToast(Toast("A simple toast"))
50 | fun showButtonToast() = overlay.addToast(Toast("A button toast").apply {
51 | buttonLabel = "Click me"
52 | })
53 |
54 | fun showCustomTitleToast() = overlay.addToast(Toast("Custom Title").apply {
55 | customTitle = Avatar(30, null, false)
56 | })
57 |
--------------------------------------------------------------------------------
/examples/gtk-examples/build.gradle.kts:
--------------------------------------------------------------------------------
1 | plugins {
2 | kotlin("multiplatform")
3 | }
4 |
5 | kotlin {
6 | val hostOs = System.getProperty("os.name")
7 | val isMingwX64 = hostOs.startsWith("Windows")
8 | val nativeTarget = when {
9 | hostOs == "Mac OS X" -> macosX64("native")
10 | hostOs == "Linux" -> linuxX64("native")
11 | isMingwX64 -> mingwX64("native")
12 | else -> throw GradleException("Host OS is not supported in Kotlin/Native.")
13 | }
14 | sourceSets {
15 | val nativeMain by getting {
16 | dependencies {
17 | implementation(project(":gtk-bindings"))
18 | }
19 | }
20 | }
21 |
22 | nativeTarget.apply {
23 | // list all packages in the source dir
24 | val packageDirs =
25 | sourceSets["nativeMain"].kotlin.srcDirs
26 | .first()
27 | .listFiles()
28 | ?.filter { it.isDirectory }
29 | ?: emptyList()
30 |
31 | binaries {
32 | // add a binary for each package, using its main() fun as the entrypoint
33 | packageDirs.forEach { pkg ->
34 | executable(pkg.name) {
35 | entryPoint = "${pkg.name}.main"
36 | if (isMingwX64) {
37 | val userHome = File(System.getenv("USERPROFILE"))
38 | linkerOpts(
39 | "-L${userHome}\\.konan\\dependencies\\msys2-mingw-w64-x86_64-2\\x86_64-w64-mingw32\\lib",
40 | "-LC:\\msys64\\mingw64\\lib",
41 | )
42 | }
43 | }
44 | }
45 | }
46 | }
47 | }
--------------------------------------------------------------------------------
/examples/gtk-examples/src/nativeMain/kotlin/customwidget/CustomWidgetExample.kt:
--------------------------------------------------------------------------------
1 | package customwidget
2 |
3 | import bindings.gtk.*
4 | import bindings.gtk.usertypes.WidgetCompanion
5 | import kotlinx.cinterop.CPointer
6 | import native.gtk.GtkAlign.GTK_ALIGN_CENTER
7 | import native.gtk.GtkOrientation.GTK_ORIENTATION_VERTICAL
8 |
9 | /**
10 | * An example showing how to create a Custom Widget.
11 | */
12 | fun main() {
13 | val app = Application("io.quantus.gtk-kotlin-native.example.customwidget")
14 | app.onActivate {
15 | val window = ApplicationWindow(app)
16 | window.title = "Custom Widget Example"
17 | window.defaultSize = Pair(600, 400)
18 | buildUI(window)
19 | window.show()
20 | }
21 | app.run()
22 | app.unref()
23 | }
24 |
25 | private fun buildUI(window: Window) {
26 | window.child = MyCustomWidget("LabelText", "open-menu")
27 | }
28 |
29 | /**
30 | * A simple custom Widget that extends the [Box] class and contains a [Label] and an [Image].
31 | */
32 | private class MyCustomWidget : Box {
33 |
34 | private val label = Label()
35 | private val image = Image()
36 |
37 | constructor(pointer: CPointer<*>) : super(pointer)
38 |
39 | constructor(text: String, iconName: String) : this(newInstancePointer()) {
40 | // configure the box
41 | orientation = GTK_ORIENTATION_VERTICAL
42 | spacing = 10
43 | marginStart = 10
44 | marginEnd = 10
45 | marginTop = 10
46 | marginBottom = 10
47 |
48 | vexpand = true
49 | hexpand = true
50 | valign = GTK_ALIGN_CENTER
51 | halign = GTK_ALIGN_CENTER
52 |
53 | // set values on the child widgets
54 | label.text = text
55 | image.iconName = iconName
56 |
57 | // add the child widgets
58 | append(image)
59 | append(label)
60 | }
61 |
62 | companion object : WidgetCompanion() {
63 | override val typeName = "MyCustomWidget"
64 | override val parentType = Box.Type
65 | }
66 | }
--------------------------------------------------------------------------------
/examples/gtk-examples/src/nativeMain/kotlin/gridview/GridViewExample.kt:
--------------------------------------------------------------------------------
1 | package gridview
2 |
3 | import bindings.gobject.asType
4 | import bindings.gtk.*
5 |
6 | /**
7 | * An example showing how to build a GTK4 [ListView] with string items.
8 | */
9 | fun main() {
10 | val app = Application("io.quantus.gtk-kotlin-native.example.grid")
11 | app.onActivate {
12 | val window = ApplicationWindow(app)
13 | window.title = "GridView Example"
14 | window.defaultSize = Pair(600, 400)
15 | buildUI(window)
16 | window.show()
17 | }
18 | app.run()
19 | app.unref()
20 | }
21 |
22 | private fun buildUI(window: Window) {
23 |
24 | // create a list of String items
25 | val items = List(200) { "Item $it" }
26 |
27 | // wrap in a StingList (ListModel)
28 | val model = StringList(items)
29 |
30 | // setup the item factory
31 | val factory = SignalListItemFactory()
32 |
33 | // prepare the item row
34 | factory.onSetup { listItem ->
35 | listItem.child = Label()
36 | }
37 |
38 | // bind the item row
39 | factory.onBind { listItem ->
40 | // get the label from the listItem
41 | val label = listItem.child!!.asType(Label.Type)
42 |
43 | // get the StringObject from the listItem
44 | val item = listItem.item!!.asType(StringObject.Type)
45 |
46 | // update the label
47 | label.text = item.string
48 | }
49 |
50 | val selectionModel = SingleSelection(model)
51 | val gridView = GridView(selectionModel, factory)
52 |
53 | window.child = ScrolledWindow(gridView)
54 | }
--------------------------------------------------------------------------------
/examples/gtk-examples/src/nativeMain/kotlin/listmodel/ListModelExample.kt:
--------------------------------------------------------------------------------
1 | package listmodel
2 |
3 | import bindings.gobject.asType
4 | import bindings.gtk.*
5 |
6 | /**
7 | * An example showing how to build a GTK4 [ListView] with string items.
8 | */
9 | fun main() {
10 | val app = Application("io.quantus.gtk-kotlin-native.example.listmodel")
11 | app.onActivate {
12 | val window = ApplicationWindow(app)
13 | window.title = "ListModel"
14 | window.defaultSize = Pair(600, 400)
15 | buildUI(window)
16 | window.show()
17 | }
18 | app.run()
19 | app.unref()
20 | }
21 |
22 | private fun buildUI(window: Window) {
23 |
24 | // create a list of String items
25 | val items = List(200) { "Item $it" }
26 |
27 | // wrap in a StingList (ListModel)
28 | val model = StringList(items)
29 |
30 | // setup the item factory
31 | val factory = SignalListItemFactory()
32 |
33 | // prepare the item row
34 | factory.onSetup { listItem ->
35 | listItem.child = Label()
36 | }
37 |
38 | // bind the item row
39 | factory.onBind { listItem ->
40 | // get the label from the listItem
41 | val label = listItem.child!!.asType(Label.Type)
42 |
43 | // get the StringObject from the listItem
44 | val item = listItem.item!!.asType(StringObject.Type)
45 |
46 | // update the label
47 | label.text = item.string
48 | }
49 |
50 | val selectionModel = SingleSelection(model)
51 | val listView = ListView(selectionModel, factory)
52 |
53 | window.child = ScrolledWindow(listView)
54 | }
--------------------------------------------------------------------------------
/examples/hello-world-gtk/build.gradle.kts:
--------------------------------------------------------------------------------
1 | plugins {
2 | kotlin("multiplatform")
3 | }
4 |
5 | kotlin {
6 | val hostOs = System.getProperty("os.name")
7 | val isMingwX64 = hostOs.startsWith("Windows")
8 | val nativeTarget = when {
9 | hostOs == "Mac OS X" -> macosX64("native")
10 | hostOs == "Linux" -> linuxX64("native")
11 | isMingwX64 -> mingwX64("native")
12 | else -> throw GradleException("Host OS is not supported in Kotlin/Native.")
13 | }
14 | sourceSets {
15 | val nativeMain by getting {
16 | dependencies {
17 | implementation(project(":gtk-bindings"))
18 | }
19 | }
20 | }
21 |
22 | nativeTarget.apply {
23 | binaries {
24 | executable {
25 | entryPoint = "main"
26 | if (isMingwX64) {
27 | val userHome = File(System.getenv("USERPROFILE"))
28 | linkerOpts(
29 | "-L${userHome}\\.konan\\dependencies\\msys2-mingw-w64-x86_64-2\\x86_64-w64-mingw32\\lib",
30 | "-LC:\\msys64\\mingw64\\lib",
31 | )
32 | }
33 | }
34 | }
35 | }
36 | }
--------------------------------------------------------------------------------
/examples/hello-world-gtk/src/nativeMain/kotlin/Main.kt:
--------------------------------------------------------------------------------
1 | import bindings.gtk.Application
2 | import bindings.gtk.ApplicationWindow
3 | import bindings.gtk.Label
4 |
5 | fun main() {
6 | val app = Application("com.example.app")
7 |
8 | app.onActivate {
9 | val window = ApplicationWindow(app)
10 | window.title = "Hello World"
11 | window.defaultSize = Pair(600, 400)
12 | window.child = Label("Hello from Kotlin/Native")
13 | window.show()
14 | }
15 |
16 | app.runApplication()
17 | app.unref()
18 | }
--------------------------------------------------------------------------------
/examples/sevenguis-1-counter/build.gradle.kts:
--------------------------------------------------------------------------------
1 | plugins {
2 | kotlin("multiplatform")
3 | }
4 |
5 | kotlin {
6 | val hostOs = System.getProperty("os.name")
7 | val isMingwX64 = hostOs.startsWith("Windows")
8 | val nativeTarget = when {
9 | hostOs == "Mac OS X" -> macosX64("native")
10 | hostOs == "Linux" -> linuxX64("native")
11 | isMingwX64 -> mingwX64("native")
12 | else -> throw GradleException("Host OS is not supported in Kotlin/Native.")
13 | }
14 | sourceSets {
15 | val nativeMain by getting {
16 | dependencies {
17 | implementation(project(":gtk-bindings"))
18 | }
19 | }
20 | }
21 |
22 | nativeTarget.apply {
23 | binaries {
24 | executable {
25 | entryPoint = "main"
26 | }
27 | }
28 | }
29 | }
--------------------------------------------------------------------------------
/examples/sevenguis-1-counter/src/nativeMain/kotlin/Main.kt:
--------------------------------------------------------------------------------
1 | import bindings.gtk.*
2 | import native.gtk.GtkAlign.GTK_ALIGN_CENTER
3 | import native.gtk.GtkOrientation.GTK_ORIENTATION_HORIZONTAL
4 |
5 | fun main() {
6 | val app = Application("io.quantus.gtkkn.sevenguis.counter")
7 | app.onActivate {
8 | val window = ApplicationWindow(app).apply {
9 | title = "7GUIs Counter"
10 | }
11 |
12 | var counter = 0
13 |
14 | val textField = Entry()
15 | textField.text = counter.toString()
16 |
17 | val button = Button("Count").apply {
18 | onClicked {
19 | counter++
20 | textField.text = counter.toString()
21 | }
22 | }
23 |
24 | window.child = Box(GTK_ORIENTATION_HORIZONTAL, 10).apply {
25 | homogeneous = true
26 | valign = GTK_ALIGN_CENTER
27 | marginTop = 10
28 | marginBottom = 10
29 | marginStart = 10
30 | marginEnd = 10
31 | append(textField)
32 | append(button)
33 | }
34 |
35 | window.show()
36 | }
37 | app.run()
38 | app.unref()
39 | }
40 |
41 |
--------------------------------------------------------------------------------
/examples/sevenguis-2-temperature-converter/build.gradle.kts:
--------------------------------------------------------------------------------
1 | plugins {
2 | kotlin("multiplatform")
3 | }
4 |
5 | kotlin {
6 | val hostOs = System.getProperty("os.name")
7 | val isMingwX64 = hostOs.startsWith("Windows")
8 | val nativeTarget = when {
9 | hostOs == "Mac OS X" -> macosX64("native")
10 | hostOs == "Linux" -> linuxX64("native")
11 | isMingwX64 -> mingwX64("native")
12 | else -> throw GradleException("Host OS is not supported in Kotlin/Native.")
13 | }
14 | sourceSets {
15 | val nativeMain by getting {
16 | dependencies {
17 | implementation(project(":gtk-bindings"))
18 | }
19 | }
20 | }
21 |
22 | nativeTarget.apply {
23 | binaries {
24 | executable {
25 | entryPoint = "main"
26 | }
27 | }
28 | }
29 | }
--------------------------------------------------------------------------------
/examples/sevenguis-2-temperature-converter/src/nativeMain/kotlin/Main.kt:
--------------------------------------------------------------------------------
1 | import bindings.gtk.*
2 | import native.gtk.GtkAlign.GTK_ALIGN_CENTER
3 | import native.gtk.GtkOrientation.GTK_ORIENTATION_HORIZONTAL
4 |
5 | fun main() {
6 | val app = Application("io.quantus.gtkkn.sevenguis.temperature-converter")
7 | app.onActivate {
8 | val window = ApplicationWindow(app).apply {
9 | title = "7GUIs Temperature Converter"
10 | }
11 |
12 | val celciusField = Entry()
13 | val fahrenheitField = Entry()
14 |
15 | var isEditing = false
16 |
17 | celciusField.onChanged {
18 | if (isEditing) return@onChanged
19 | celciusField.text.toIntOrNull()?.let { c ->
20 | isEditing = true
21 | fahrenheitField.text = (c * (9 / 5.toDouble()) + 32).toInt().toString()
22 | isEditing = false
23 | }
24 | }
25 |
26 | fahrenheitField.onChanged {
27 | if (isEditing) return@onChanged
28 | fahrenheitField.text.toIntOrNull()?.let { f ->
29 | isEditing = true
30 | celciusField.text = ((f - 32) * (5 / 9.toDouble())).toInt().toString()
31 | isEditing = false
32 | }
33 | }
34 |
35 | window.child = Box(GTK_ORIENTATION_HORIZONTAL, 10).apply {
36 | homogeneous = true
37 | valign = GTK_ALIGN_CENTER
38 | marginTop = 10
39 | marginBottom = 10
40 | marginStart = 10
41 | marginEnd = 10
42 | append(celciusField)
43 | append(Label("Celcius ="))
44 | append(fahrenheitField)
45 | append(Label("Fahrenheit"))
46 | }
47 |
48 | window.show()
49 | }
50 | app.run()
51 | app.unref()
52 | }
53 |
54 |
--------------------------------------------------------------------------------
/examples/sevenguis-3-flight-booker/build.gradle.kts:
--------------------------------------------------------------------------------
1 | plugins {
2 | kotlin("multiplatform")
3 | }
4 |
5 | kotlin {
6 | val hostOs = System.getProperty("os.name")
7 | val isMingwX64 = hostOs.startsWith("Windows")
8 | val nativeTarget = when {
9 | hostOs == "Mac OS X" -> macosX64("native")
10 | hostOs == "Linux" -> linuxX64("native")
11 | isMingwX64 -> mingwX64("native")
12 | else -> throw GradleException("Host OS is not supported in Kotlin/Native.")
13 | }
14 | sourceSets {
15 | val nativeMain by getting {
16 | dependencies {
17 | implementation(project(":gtk-bindings"))
18 | implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.4.0")
19 | }
20 | }
21 | }
22 |
23 | nativeTarget.apply {
24 | binaries {
25 | executable {
26 | entryPoint = "main"
27 | }
28 | }
29 | }
30 | }
--------------------------------------------------------------------------------
/gio-bindings/build.gradle.kts:
--------------------------------------------------------------------------------
1 | plugins {
2 | kotlin("multiplatform")
3 | id("org.jetbrains.dokka")
4 | `maven-publish`
5 | }
6 |
7 | kotlin {
8 | val hostOs = System.getProperty("os.name")
9 | val isMingwX64 = hostOs.startsWith("Windows")
10 | val nativeTarget = when {
11 | hostOs == "Mac OS X" -> macosX64("native")
12 | hostOs == "Linux" -> linuxX64("native")
13 | isMingwX64 -> mingwX64("native")
14 | else -> throw GradleException("Host OS is not supported in Kotlin/Native.")
15 | }
16 |
17 | sourceSets {
18 | val nativeMain by getting {
19 | dependencies {
20 | api(project(":gobject-bindings"))
21 | }
22 | }
23 | val nativeTest by getting
24 | }
25 |
26 | nativeTarget.apply {
27 | compilations["main"].cinterops {
28 | val gio by creating
29 | }
30 |
31 | binaries {
32 | all {
33 | if (isMingwX64) {
34 | val userHome = File(System.getenv("USERPROFILE"))
35 | linkerOpts(
36 | "-L${userHome}\\.konan\\dependencies\\msys2-mingw-w64-x86_64-2\\x86_64-w64-mingw32\\lib",
37 | "-LC:\\msys64\\mingw64\\lib",
38 | )
39 | }
40 | }
41 | }
42 | }
43 | }
--------------------------------------------------------------------------------
/gio-bindings/src/nativeInterop/cinterop/gio.def:
--------------------------------------------------------------------------------
1 | headers = "gio/gio.h"
2 | package = native.gio
3 | headerFilter = "gio/*"
4 |
5 | # compiler opts
6 |
7 | compilerOpts.linux = \
8 | -I/usr/include/glib-2.0 \
9 | -I/usr/lib/glib-2.0/include \
10 | -I/usr/include/sysprof-4 \
11 | -I/usr/include/libmount \
12 | -I/usr/include/blkid \
13 | -pthread
14 |
15 | compilerOpts.linux_x64 = \
16 | -I/usr/lib64/glib-2.0/include \
17 | -I/usr/lib/x86_64-linux-gnu/glib-2.0/include
18 |
19 | compilerOpts.mingw_x64 = \
20 | -IC:/msys64/mingw64/include/glib-2.0 \
21 | -IC:/msys64/mingw64/lib/glib-2.0/include \
22 | -IC:/msys64/mingw64/include
23 |
24 | # linker opts
25 |
26 | linkerOpts.linux = \
27 | -L/usr/local/lib \
28 | -lgio-2.0 \
29 | -lgobject-2.0 \
30 | -lglib-2.0
31 |
32 | linkerOpts.linux_x64 = \
33 | -L/usr/lib64 \
34 | -L/usr/lib/x86_64-linux-gnu
35 |
36 | linkerOpts.mingw_x64 = \
37 | -LC:/msys64/mingw64/lib \
38 | -lgio-2.0 \
39 | -lgobject-2.0 \
40 | -lglib-2.0 \
41 | -lintl \
42 | -lstdc++
--------------------------------------------------------------------------------
/gio-bindings/src/nativeMain/kotlin/bindings/gio/Action.kt:
--------------------------------------------------------------------------------
1 | package bindings.gio
2 |
3 | import bindings.glib.Variant
4 | import bindings.glib.VariantType
5 | import bindings.glib.asVariant
6 | import bindings.glib.asVariantType
7 | import bindings.gobject.boolean
8 | import internal.BuiltinTypeInfo
9 | import kotlinx.cinterop.CPointer
10 | import kotlinx.cinterop.toKString
11 | import native.gio.*
12 | import native.gobject.g_free
13 |
14 | interface Action {
15 |
16 | val gActionPointer: CPointer
17 |
18 | fun activate(parameter: Variant) {
19 | g_action_activate(gActionPointer, parameter.variantPointer)
20 | }
21 |
22 | fun changeState(value: Variant) = g_action_change_state(gActionPointer, value.variantPointer)
23 |
24 | val isEnabled: Boolean
25 | get() = g_action_get_enabled(gActionPointer).boolean
26 |
27 | val name: String
28 | get() = g_action_get_name(gActionPointer)!!.toKString()
29 |
30 | val parameterType: VariantType?
31 | get() = g_action_get_parameter_type(gActionPointer)?.asVariantType()
32 |
33 | val state: Variant?
34 | get() = g_action_get_state(gActionPointer)?.asVariant()
35 |
36 | val stateHint: Variant?
37 | get() = g_action_get_state_hint(gActionPointer)?.asVariant()
38 |
39 | val stateType: VariantType?
40 | get() = g_action_get_state_type(gActionPointer)?.asVariantType()
41 |
42 | companion object {
43 | fun nameIsValid(name: String) = g_action_name_is_valid(name).boolean
44 | // TODO parseDetailedName
45 | fun printDetailedName(actionName: String, targetValue: Variant?): String {
46 | val resultPointer = g_action_print_detailed_name(actionName, targetValue?.variantPointer)!!
47 | val result = resultPointer.toKString()
48 | g_free(resultPointer)
49 | return result
50 | }
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/gio-bindings/src/nativeMain/kotlin/bindings/gio/ActionGroup.kt:
--------------------------------------------------------------------------------
1 | package bindings.gio
2 |
3 | import bindings.gobject.boolean
4 | import bindings.util.toStringList
5 | import kotlinx.cinterop.CPointer
6 | import kotlinx.cinterop.memScoped
7 | import native.gio.GActionGroup
8 | import native.gio.g_action_group_get_action_enabled
9 | import native.gio.g_action_group_has_action
10 | import native.gio.g_action_group_list_actions
11 | import native.gobject.g_strfreev
12 |
13 | interface ActionGroup {
14 | val gActionGroupPointer: CPointer
15 |
16 | fun hasAction(actionName: String): Boolean = g_action_group_has_action(gActionGroupPointer, actionName).boolean
17 |
18 | fun getActionEnabled(actionName: String): Boolean =
19 | g_action_group_get_action_enabled(gActionGroupPointer, actionName).boolean
20 |
21 | val actions: List
22 | get() = memScoped {
23 | val a = g_action_group_list_actions(gActionGroupPointer)!!
24 | val actions = a.toStringList()
25 | g_strfreev(a)
26 | actions
27 | }
28 | }
--------------------------------------------------------------------------------
/gio-bindings/src/nativeMain/kotlin/bindings/gio/ActionMap.kt:
--------------------------------------------------------------------------------
1 | package bindings.gio
2 |
3 | import kotlinx.cinterop.CPointer
4 | import native.gio.GActionMap
5 | import native.gio.g_action_map_add_action
6 | import native.gio.g_action_map_lookup_action
7 | import native.gio.g_action_map_remove_action
8 |
9 | interface ActionMap {
10 |
11 | val gActionMapPointer: CPointer
12 |
13 | fun addAction(action: Action) = g_action_map_add_action(gActionMapPointer, action.gActionPointer)
14 |
15 | // TODO addActionEntries with varargs or a list
16 |
17 | fun lookupAction(actionName: String) = g_action_map_lookup_action(gActionMapPointer, actionName)?.asAction()
18 |
19 | fun removeAction(actionName: String) = g_action_map_remove_action(gActionMapPointer, actionName)
20 | }
21 |
--------------------------------------------------------------------------------
/gio-bindings/src/nativeMain/kotlin/bindings/gio/ActionMapExt.kt:
--------------------------------------------------------------------------------
1 | package bindings.gio
2 |
3 | import bindings.glib.Variant
4 |
5 | fun ActionMap.addAction(actionName: String, handler: () -> Unit) = addAction(SimpleAction(actionName).apply {
6 | onActivate { handler() }
7 | })
8 |
9 | fun ActionMap.addAction(actionName: String, handler: (Variant?) -> Unit) = addAction(SimpleAction(actionName).apply {
10 | onActivate(handler)
11 | })
--------------------------------------------------------------------------------
/gio-bindings/src/nativeMain/kotlin/bindings/gio/Application.kt:
--------------------------------------------------------------------------------
1 | package bindings.gio
2 |
3 | import bindings.gobject.Object
4 | import bindings.gobject.asTypedPointer
5 | import bindings.gobject.boolean
6 | import internal.BuiltinTypeInfo
7 | import kotlinx.cinterop.CPointer
8 | import kotlinx.cinterop.sizeOf
9 | import kotlinx.cinterop.toKString
10 | import native.gio.*
11 |
12 | open class Application(pointer: CPointer<*>) : Object(pointer), ActionMap {
13 |
14 | val gApplicationPointer get() = this.gPointer.asTypedPointer()
15 |
16 | override val gActionMapPointer get() = gPointer.asTypedPointer()
17 |
18 | constructor(applicationId: String, flags: GApplicationFlags = G_APPLICATION_FLAGS_NONE)
19 | : this(g_application_new(applicationId, flags)!!)
20 |
21 | var applicationId: String?
22 | get() = g_application_get_application_id(gApplicationPointer)?.toKString()
23 | set(value) = g_application_set_application_id(gApplicationPointer, value)
24 |
25 | var flags: GApplicationFlags
26 | get() = g_application_get_flags(gApplicationPointer)
27 | set(value) = g_application_set_flags(gApplicationPointer, value)
28 |
29 | val isBusy: Boolean get() = g_application_get_is_busy(gApplicationPointer).boolean
30 |
31 | val isRegistered: Boolean get() = g_application_get_is_registered(gApplicationPointer).boolean
32 |
33 | val isRemote: Boolean get() = g_application_get_is_remote(gApplicationPointer).boolean
34 |
35 | fun markBusy() = g_application_mark_busy(gApplicationPointer)
36 | fun unmarkBusy() = g_application_unmark_busy(gApplicationPointer)
37 |
38 | fun hold() = g_application_hold(gApplicationPointer)
39 | fun release() = g_application_release(gApplicationPointer)
40 |
41 |
42 | fun run() {
43 | g_application_run(gApplicationPointer, 0, null)
44 | }
45 |
46 | /**
47 | * Start running the application.
48 | *
49 | * This method will not return until the app has quit.
50 | */
51 | fun runApplication() {
52 | g_application_run(gApplicationPointer, 0, null)
53 | }
54 |
55 | /**
56 | * Quit the application.
57 | */
58 | fun quit() {
59 | g_application_quit(gApplicationPointer)
60 | }
61 |
62 | companion object {
63 | val Type = BuiltinTypeInfo(
64 | G_TYPE_APPLICATION,
65 | sizeOf(),
66 | sizeOf(),
67 | ::Application
68 | )
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/gio-bindings/src/nativeMain/kotlin/bindings/gio/Extensions.kt:
--------------------------------------------------------------------------------
1 | package bindings.gio
2 |
3 | import bindings.gio.internal.ActionMapWrapper
4 | import bindings.gio.internal.ActionWrapper
5 | import bindings.gio.internal.ListModelWrapper
6 | import kotlinx.cinterop.CPointer
7 | import native.gio.*
8 |
9 | fun CPointer.asAction(): Action = ActionWrapper(this)
10 | fun CPointer.asActionMap(): ActionMap = ActionMapWrapper(this)
11 | fun CPointer.asApplication(): Application = Application(this)
12 | fun CPointer.asListModel(): ListModel = ListModelWrapper(this)
13 | fun CPointer.asListStore(): ListStore = ListStore(this)
14 | fun CPointer.asMenu(): Menu = Menu(this)
15 | fun CPointer.asMenuItem(): MenuItem = MenuItem(this)
16 | fun CPointer.asMenuModel(): MenuModel = MenuModel(this)
17 | fun CPointer.asPermission(): Permission = Permission(this)
18 | fun CPointer.asSimplePermission(): SimplePermission = SimplePermission(this)
19 |
20 |
21 |
--------------------------------------------------------------------------------
/gio-bindings/src/nativeMain/kotlin/bindings/gio/ListModel.kt:
--------------------------------------------------------------------------------
1 | package bindings.gio
2 |
3 | import kotlinx.cinterop.CPointer
4 | import native.gio.GListModel
5 | import native.gio.g_list_model_get_item_type
6 | import native.gio.g_list_model_get_n_items
7 | import native.gio.g_list_model_get_object
8 | import native.gobject.GType
9 | import native.gobject.gpointer
10 |
11 | interface ListModel {
12 | val gListModelPointer: CPointer
13 |
14 | val itemCount: Int
15 | get() = g_list_model_get_n_items(gListModelPointer).toInt()
16 |
17 | val itemType: GType
18 | get() = g_list_model_get_item_type(gListModelPointer)
19 |
20 | fun getObject(position: UInt): gpointer? {
21 | return g_list_model_get_object(gListModelPointer, position)
22 | }
23 |
24 | fun getObject(position: Int) = getObject(position.toUInt())
25 | }
26 |
--------------------------------------------------------------------------------
/gio-bindings/src/nativeMain/kotlin/bindings/gio/ListStore.kt:
--------------------------------------------------------------------------------
1 | package bindings.gio
2 |
3 | import bindings.gobject.Object
4 | import bindings.gobject.asTypedPointer
5 | import internal.BuiltinTypeInfo
6 | import internal.KGType
7 | import kotlinx.cinterop.CPointer
8 | import native.gio.*
9 | import native.gobject.GType
10 |
11 | class ListStore : Object, ListModel {
12 | override val gListModelPointer get() = gPointer.asTypedPointer()
13 |
14 | val gListStorePointer get() = gPointer.asTypedPointer()
15 |
16 | constructor(pointer: CPointer<*>) : super(pointer)
17 | constructor(itemType: GType) : super(g_list_store_new(itemType)!!)
18 | constructor(itemType: KGType<*>) : this(itemType.gType)
19 |
20 | /**
21 | * Utility constructor for creating a listStore with initial items.
22 | *
23 | * This is the same as creating a new listStore and immediately calling [appendAll] on it.
24 | */
25 | constructor(itemType: GType, vararg items: Object) : this(itemType) {
26 | this.appendAll(*items)
27 | }
28 |
29 | /**
30 | * Utility constructor for creating a listStore with initial items.
31 | *
32 | * This is the same as creating a new listStore and immediately calling [appendAll] on it.
33 | */
34 | constructor(itemType: GType, items: List