2022-09-29 16:28:05 +02:00
package io.gitlab.jfronny.inceptum.gtk ;
2022-12-17 21:53:21 +01:00
import org.gtk.gio.ApplicationFlags ;
import org.gtk.gtk.* ;
2022-11-24 21:11:07 +01:00
import io.gitlab.jfronny.commons.ref.R ;
2022-09-29 16:28:05 +02:00
public class TestStart {
public static void main ( String [ ] args ) {
var app = new Application ( GtkMain . ID , ApplicationFlags . FLAGS_NONE ) ;
2023-01-10 21:20:01 +01:00
app . onActivate ( ( ) - > {
2022-12-17 21:53:21 +01:00
var button = Button . newWithLabel ( " Test " ) ;
2022-09-29 16:28:05 +02:00
button . onClicked ( TestStart : : test ) ;
var window = new ApplicationWindow ( app ) ;
window . setDefaultSize ( 200 , 50 ) ;
2022-12-17 21:53:21 +01:00
window . title = " Inceptum " ;
window . child = button ;
2022-09-29 16:28:05 +02:00
window . show ( ) ;
GtkEnvBackend . INSTANCE . dialogParent = window ;
2023-01-10 21:20:01 +01:00
window . onCloseRequest ( ( ) - > {
2022-09-29 16:28:05 +02:00
GtkEnvBackend . INSTANCE . dialogParent = null ;
2022-12-17 21:53:21 +01:00
return false ;
2022-09-29 16:28:05 +02:00
} ) ;
} ) ;
2022-12-17 21:53:21 +01:00
System . exit ( app . run ( args . length , args ) ) ;
2022-09-29 16:28:05 +02:00
}
2023-01-10 21:20:01 +01:00
private static void test ( ) {
2022-09-29 16:28:05 +02:00
GtkEnvBackend backend = GtkEnvBackend . INSTANCE ;
2022-09-29 17:53:49 +02:00
2022-11-04 17:02:24 +01:00
backend . getInput ( " Ae " , " IoU \ naee " , " Def " , R : : nop , R : : nop ) ;
2022-09-29 16:28:05 +02:00
// backend.showInfo("Some message", "Title");
// backend.showError("Yes!", "AAee");
// backend.showError("Nes!", new ArrayIndexOutOfBoundsException("Top 500 cheese"));
// backend.showOkCancel("Some Message\nYes!", "TitL", () -> backend.showInfo("Pressed OK", "OK"), () -> backend.showError("Pressed CANCEL", "CANCEL"));
// backend.getInput("This is a prompt", """
// These are some extremely interesting and detailed (hence the name) details!
// This is a second line, since these details
// are just THAT important!""", "Default", value -> backend.showInfo("Received " + value, "Input"), () -> backend.showInfo("Got no input :/", "Input"));
}
}