September Morn Update
This commit is contained in:
parent
4e2d22a71d
commit
aac6731f2c
6856 changed files with 141342 additions and 21127 deletions
|
|
@ -1,4 +1,4 @@
|
|||
#include "windows.h"
|
||||
#include <windows.h>
|
||||
void SayGoodbyeWorld(HWND hWnd)
|
||||
{
|
||||
SetWindowText(hWnd, _T("Goodbye, World!"));
|
||||
|
|
|
|||
3
Task/Hello-world-Graphical/C/hello-world-graphical-3.c
Normal file
3
Task/Hello-world-Graphical/C/hello-world-graphical-3.c
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
#include <windows.h>
|
||||
MessageBox(NULL, _T("Goodbye, World!"), _T("Rosettacode"), MB_OK | MB_ICONINFORMATION);
|
||||
/* different buttons and icons can be used. please read MS documentation for details. */
|
||||
|
|
@ -1,33 +1,27 @@
|
|||
import forms.
|
||||
import forms;
|
||||
|
||||
class MainWindow:: SDIDialog
|
||||
public class MainWindow : SDIDialog
|
||||
{
|
||||
object goodByeWorldLabel.
|
||||
object closeButton.
|
||||
Label goodByeWorldLabel;
|
||||
Button closeButton;
|
||||
|
||||
constructor new
|
||||
<= new;
|
||||
[
|
||||
goodByeWorldLabel := Label new.
|
||||
closeButton := Button new.
|
||||
constructor new()
|
||||
<= new()
|
||||
{
|
||||
goodByeWorldLabel := new Label();
|
||||
closeButton := new Button();
|
||||
|
||||
theControls
|
||||
append:goodByeWorldLabel;
|
||||
append:closeButton.
|
||||
self
|
||||
.appendControl(goodByeWorldLabel)
|
||||
.appendControl(closeButton);
|
||||
|
||||
$self
|
||||
set x:250 y:200;
|
||||
set width:200 height:110.
|
||||
self.setRegion(250, 200, 200, 110);
|
||||
|
||||
goodByeWorldLabel
|
||||
set x:40 y:10;
|
||||
set width:150 height:30;
|
||||
set caption:"Goodbye, World!".
|
||||
goodByeWorldLabel.Caption := "Goodbye, World!";
|
||||
goodByeWorldLabel.setRegion(40, 10, 150, 30);
|
||||
|
||||
closeButton
|
||||
set x:20 y:40;
|
||||
set width:150 height:30;
|
||||
set caption:"Close";
|
||||
set onClick(:args)[ 'program stop ]
|
||||
]
|
||||
closeButton.Caption := "Close";
|
||||
closeButton.setRegion(20, 40, 150, 30);
|
||||
closeButton.onClick := (args){ forward program.stop() };
|
||||
}
|
||||
}
|
||||
|
|
|
|||
117
Task/Hello-world-Graphical/Neko/hello-world-graphical-1.neko
Normal file
117
Task/Hello-world-Graphical/Neko/hello-world-graphical-1.neko
Normal file
|
|
@ -0,0 +1,117 @@
|
|||
/*
|
||||
Tectonics:
|
||||
gcc -shared -fPIC -o nekoagar.ndll nekoagar.c `agar-config --cflags --libs`
|
||||
*/
|
||||
|
||||
/* Neko primitives for libAgar http://www.libagar.org */
|
||||
#include <stdio.h>
|
||||
#include <neko.h>
|
||||
#include <agar/core.h>
|
||||
#include <agar/gui.h>
|
||||
|
||||
#define val_widget(v) ((AG_Widget *)val_data(v))
|
||||
DEFINE_KIND(k_agar_widget);
|
||||
|
||||
/* Initialize Agar Core given appname and flags */
|
||||
value agar_init_core(value appname, value flags) {
|
||||
#ifdef DEBUG
|
||||
if (!val_is_null(appname)) val_check(appname, string);
|
||||
val_check(flags, int);
|
||||
#endif
|
||||
if (AG_InitCore(val_string(appname), val_int(flags)) == -1) return alloc_bool(0);
|
||||
return alloc_bool(1);
|
||||
}
|
||||
DEFINE_PRIM(agar_init_core, 2);
|
||||
|
||||
/* Initialize Agar GUI given graphic engine driver */
|
||||
value agar_init_gui(value driver) {
|
||||
#ifdef DEBUG
|
||||
if (!val_is_null(driver)) val_check(driver, string);
|
||||
#endif
|
||||
if (AG_InitGraphics(val_string(driver)) == -1) return alloc_bool(0);
|
||||
AG_BindStdGlobalKeys();
|
||||
return alloc_bool(1);
|
||||
}
|
||||
DEFINE_PRIM(agar_init_gui, 1);
|
||||
|
||||
/* Initialize Agar given appname, flags and GUI driver */
|
||||
value agar_init(value appname, value flags, value driver) {
|
||||
#ifdef DEBUG
|
||||
if (!val_is_null(appname)) val_check(appname, string);
|
||||
val_check(flags, int);
|
||||
if (!val_is_null(driver)) val_check(driver, string);
|
||||
#endif
|
||||
if (!val_bool(agar_init_core(appname, flags))) return alloc_bool(0);
|
||||
if (!val_bool(agar_init_gui(driver))) return alloc_bool(0);
|
||||
return alloc_bool(1);
|
||||
}
|
||||
DEFINE_PRIM(agar_init, 3);
|
||||
|
||||
|
||||
/* end the Agar event loop on window-close */
|
||||
void rundown(AG_Event *event) {
|
||||
AG_Terminate(0);
|
||||
}
|
||||
|
||||
|
||||
/* Create an Agar window, given UInt flags (which might use 32 bits...) */
|
||||
value agar_window(value flags) {
|
||||
#ifdef DEBUG
|
||||
val_check(flags, int);
|
||||
#endif
|
||||
AG_Window *win;
|
||||
win = AG_WindowNew(val_int(flags));
|
||||
AG_SetEvent(win, "window-close", rundown, "%p", win);
|
||||
|
||||
if ( win == NULL) return alloc_bool(0);
|
||||
return alloc_abstract(k_agar_widget, win);
|
||||
}
|
||||
DEFINE_PRIM(agar_window, 1);
|
||||
|
||||
|
||||
/* Show a window */
|
||||
value agar_window_show(value w) {
|
||||
AG_Window *win;
|
||||
|
||||
#ifdef DEBUG
|
||||
val_check_kind(w, k_agar_widget);
|
||||
#endif
|
||||
win = (AG_Window *)val_widget(w);
|
||||
AG_WindowShow(win);
|
||||
return alloc_bool(1);
|
||||
}
|
||||
DEFINE_PRIM(agar_window_show, 1);
|
||||
|
||||
|
||||
/* New box */
|
||||
value agar_box(value parent, value type, value flags) {
|
||||
AG_Box *b;
|
||||
|
||||
#ifdef DEBUG
|
||||
val_check_kind(parent, k_agar_widget);
|
||||
#endif
|
||||
b = AG_BoxNew(val_widget(parent), val_int(type), val_int(flags));
|
||||
return alloc_abstract(k_agar_widget, b);
|
||||
}
|
||||
DEFINE_PRIM(agar_box, 3);
|
||||
|
||||
/* New label */
|
||||
value agar_label(value parent, value flags, value text) {
|
||||
AG_Label *lw;
|
||||
|
||||
#ifdef DEBUG
|
||||
val_check_kind(parent, k_agar_widget);
|
||||
#endif
|
||||
lw = AG_LabelNewS(val_widget(parent), val_int(flags), val_string(text));
|
||||
return alloc_abstract(k_agar_widget, lw);
|
||||
}
|
||||
DEFINE_PRIM(agar_label, 3);
|
||||
|
||||
|
||||
/* Event Loop */
|
||||
value agar_eventloop(void) {
|
||||
int rc;
|
||||
rc = AG_EventLoop();
|
||||
return alloc_int(rc);
|
||||
}
|
||||
DEFINE_PRIM(agar_eventloop, 0);
|
||||
34
Task/Hello-world-Graphical/Neko/hello-world-graphical-2.neko
Normal file
34
Task/Hello-world-Graphical/Neko/hello-world-graphical-2.neko
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
/**
|
||||
<doc><pre>
|
||||
Hello world, graphical, in Neko, via Agar label
|
||||
Tectonics:
|
||||
gcc -shared -fPIC -o nekoagar.ndll rosetta-nekoagar.c `agar-config --cflags --libs`
|
||||
nekoc hello-graphical.neko
|
||||
neko hello-graphical
|
||||
</pre></doc>
|
||||
*/
|
||||
|
||||
/* Load some libagar bindings http://www.libagar.org/mdoc.cgi?man=AG_Intro.3 */
|
||||
var agar_init = $loader.loadprim("nekoagar@agar_init", 3);
|
||||
var agar_window = $loader.loadprim("nekoagar@agar_window", 1);
|
||||
var agar_window_show = $loader.loadprim("nekoagar@agar_window_show", 1);
|
||||
var agar_box = $loader.loadprim("nekoagar@agar_box", 3);
|
||||
var agar_label = $loader.loadprim("nekoagar@agar_label", 3);
|
||||
var agar_eventloop = $loader.loadprim("nekoagar@agar_eventloop", 0);
|
||||
|
||||
/* Init with driver; NULL for best choice on current system */
|
||||
try {
|
||||
var rc = agar_init("nekoagar", 0, val_null);
|
||||
if $not(rc) $throw("Error: agar_init non zero");
|
||||
} catch e {
|
||||
$throw("Error: agar_init exception");
|
||||
}
|
||||
|
||||
/* Put up a window, with a box, and a label in the box */
|
||||
var w = agar_window(0);
|
||||
var box = agar_box(w, 1, 0);
|
||||
var label = agar_label(box, 0, "Goodbye, World!");
|
||||
agar_window_show(w);
|
||||
|
||||
/* Run the event loop */
|
||||
agar_eventloop();
|
||||
2
Task/Hello-world-Graphical/Ol/hello-world-graphical.ol
Normal file
2
Task/Hello-world-Graphical/Ol/hello-world-graphical.ol
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
(import (lib winapi))
|
||||
(MessageBox #f (c-string "Hello, World!") (c-string "Rosettacode") #x40)
|
||||
|
|
@ -0,0 +1 @@
|
|||
DIALOG "Goodbye, world."
|
||||
3
Task/Hello-world-Graphical/VBA/hello-world-graphical.vba
Normal file
3
Task/Hello-world-Graphical/VBA/hello-world-graphical.vba
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
Public Sub hello_world_gui()
|
||||
MsgBox "Goodbye, World!"
|
||||
End Sub
|
||||
20
Task/Hello-world-Graphical/Vala/hello-world-graphical.vala
Normal file
20
Task/Hello-world-Graphical/Vala/hello-world-graphical.vala
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
#!/usr/local/bin/vala --pkg gtk+-3.0
|
||||
using Gtk;
|
||||
|
||||
void main(string[] args) {
|
||||
Gtk.init(ref args);
|
||||
|
||||
var window = new Window();
|
||||
window.title = "Goodbye, world!";
|
||||
window.border_width = 10;
|
||||
window.window_position = WindowPosition.CENTER;
|
||||
window.set_default_size(350, 70);
|
||||
window.destroy.connect(Gtk.main_quit);
|
||||
|
||||
var label = new Label("Goodbye, world!");
|
||||
|
||||
window.add(label);
|
||||
window.show_all();
|
||||
|
||||
Gtk.main();
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue