• R/O
  • SSH

Commit

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

Revision3641ad9bc7b6e0c8f596f394a8bf44e1355222a9 (tree)
Time2022-03-31 06:49:22
AuthorJaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@fast...>
CommiterJaime Marquínez Ferrándiz

Log Message

Initial commit

Change Summary

Incremental Difference

diff -r 000000000000 -r 3641ad9bc7b6 .hgignore
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/.hgignore Wed Mar 30 23:49:22 2022 +0200
@@ -0,0 +1,7 @@
1+# SPDX-FileCopyrightText: 2022 Jaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@fastmail.net>
2+#
3+# SPDX-License-Identifier: Unlicense
4+
5+.vscode
6+
7+bin
\ No newline at end of file
diff -r 000000000000 -r 3641ad9bc7b6 .reuse/dep5
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/.reuse/dep5 Wed Mar 30 23:49:22 2022 +0200
@@ -0,0 +1,10 @@
1+Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
2+Upstream-Name: haxeui-YUI
3+Upstream-Contact: Jaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@fastmail.net>
4+Source:
5+
6+# Sample paragraph, commented out:
7+#
8+# Files: src/*
9+# Copyright: $YEAR $NAME <$CONTACT>
10+# License: ...
diff -r 000000000000 -r 3641ad9bc7b6 LICENSES/Unlicense.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/LICENSES/Unlicense.txt Wed Mar 30 23:49:22 2022 +0200
@@ -0,0 +1,10 @@
1+This is free and unencumbered software released into the public domain.
2+
3+Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means.
4+
5+In jurisdictions that recognize copyright laws, the author or authors of this software dedicate any and all copyright interest in the software to the public domain. We make this dedication for the benefit of the public at large and to the detriment of our heirs and
6+successors. We intend this dedication to be an overt act of relinquishment in perpetuity of all present and future rights to this software under copyright law.
7+
8+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
9+
10+For more information, please refer to <http://unlicense.org/>
diff -r 000000000000 -r 3641ad9bc7b6 Makefile
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Makefile Wed Mar 30 23:49:22 2022 +0200
@@ -0,0 +1,15 @@
1+# SPDX-FileCopyrightText: 2022 Jaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@fastmail.net>
2+#
3+# SPDX-License-Identifier: Unlicense
4+
5+.PHONY: all demo bin/Demo check check-license
6+all: demo check
7+
8+demo: bin/Demo
9+
10+bin/Demo:
11+ haxe demo.hxml
12+
13+check: check-license
14+check-license:
15+ reuse lint
\ No newline at end of file
diff -r 000000000000 -r 3641ad9bc7b6 assets/main-view.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/assets/main-view.xml Wed Mar 30 23:49:22 2022 +0200
@@ -0,0 +1,19 @@
1+<!--
2+SPDX-FileCopyrightText: 2022 Jaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@fastmail.net>
3+
4+SPDX-License-Identifier: Unlicense
5+-->
6+<vbox>
7+ <hbox>
8+ <button text="Button 1" id="btn1" />
9+ <button text="Button 2" id="btn2" />
10+ <vbox>
11+ <label text="Label 1" />
12+ <hbox>
13+ <label text="Label 2" />
14+ <button text="Inline handler" onclick="this.text='Clicked'" />
15+ <label text="Label 3" />
16+ </hbox>
17+ </vbox>
18+ </hbox>
19+</vbox>
\ No newline at end of file
diff -r 000000000000 -r 3641ad9bc7b6 demo.hxml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/demo.hxml Wed Mar 30 23:49:22 2022 +0200
@@ -0,0 +1,16 @@
1+# SPDX-FileCopyrightText: 2022 Jaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@fastmail.net>
2+#
3+# SPDX-License-Identifier: Unlicense
4+
5+--class-path src
6+--macro include("haxe.ui.backend.yui")
7+
8+--class-path demo
9+--main Demo
10+
11+--library haxeui-core
12+--library haxe-YUI
13+
14+--cpp bin
15+
16+--macro haxe.macro.Compiler.include("haxe.ui", ["haxe.ui.macros"])
\ No newline at end of file
diff -r 000000000000 -r 3641ad9bc7b6 demo/Demo.hx
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/demo/Demo.hx Wed Mar 30 23:49:22 2022 +0200
@@ -0,0 +1,20 @@
1+// SPDX-FileCopyrightText: 2022 Jaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@fastmail.net>
2+//
3+// SPDX-License-Identifier: Unlicense
4+
5+package ;
6+
7+import haxe.ui.HaxeUIApp;
8+
9+class Demo {
10+ public static function main() {
11+ var app = new HaxeUIApp();
12+ app.ready(function() {
13+ var mainView = new MainView();
14+
15+ app.addComponent(mainView);
16+
17+ app.start();
18+ });
19+ }
20+}
diff -r 000000000000 -r 3641ad9bc7b6 demo/MainView.hx
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/demo/MainView.hx Wed Mar 30 23:49:22 2022 +0200
@@ -0,0 +1,24 @@
1+// SPDX-FileCopyrightText: 2022 Jaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@fastmail.net>
2+//
3+// SPDX-License-Identifier: Unlicense
4+
5+package ;
6+
7+import haxe.ui.containers.VBox;
8+import haxe.ui.events.MouseEvent;
9+
10+@:build(haxe.ui.ComponentBuilder.build("assets/main-view.xml"))
11+class MainView extends VBox {
12+ public function new() {
13+ super();
14+ btn1.onClick = function(e) {
15+ btn1.text = "Thanks!";
16+ trace('button 1 clicked');
17+ }
18+ }
19+
20+ @:bind(btn2, MouseEvent.CLICK)
21+ private function onMyButton(e:MouseEvent) {
22+ btn2.text = "Thanks!";
23+ }
24+}
\ No newline at end of file
diff -r 000000000000 -r 3641ad9bc7b6 src/haxe/ui/backend/AppImpl.hx
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/haxe/ui/backend/AppImpl.hx Wed Mar 30 23:49:22 2022 +0200
@@ -0,0 +1,45 @@
1+// SPDX-FileCopyrightText: 2022 Jaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@fastmail.net>
2+//
3+// SPDX-License-Identifier: Unlicense
4+
5+package haxe.ui.backend;
6+
7+import haxe.ui.backend.yui.DialogWrapper;
8+import haxe.ui.backend.yui.WidgetWrapper;
9+import yui.YDialog;
10+import yui.YUI;
11+import yui.YWidget;
12+import yui.YWidgetFactory;
13+
14+using cpp.Pointer;
15+
16+class AppImpl extends AppBase {
17+ private var _mainWindow : DialogWrapper;
18+
19+ function new() {
20+
21+ }
22+
23+ override function build() {
24+ super.build();
25+
26+ var factory = YUI.widgetFactory().fromRaw().ref;
27+ var dialogPointer : cpp.RawPointer<YWidget> = cast factory.createMainDialog();
28+ this._mainWindow = new DialogWrapper(dialogPointer.fromRaw());
29+ }
30+
31+ override function start() {
32+ super.start();
33+ this._mainWindow.runEventLoop();
34+ }
35+
36+ override function exit() {
37+ this._mainWindow.dialog.ref.destroy();
38+ }
39+
40+ override function getToolkitInit():ToolkitOptions {
41+ return {
42+ mainWindow: this._mainWindow,
43+ };
44+ }
45+}
\ No newline at end of file
diff -r 000000000000 -r 3641ad9bc7b6 src/haxe/ui/backend/AssetsImpl.hx
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/haxe/ui/backend/AssetsImpl.hx Wed Mar 30 23:49:22 2022 +0200
@@ -0,0 +1,8 @@
1+// SPDX-FileCopyrightText: 2022 Jaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@fastmail.net>
2+//
3+// SPDX-License-Identifier: Unlicense
4+
5+package haxe.ui.backend;
6+
7+class AssetsImpl extends AssetsBase {
8+}
\ No newline at end of file
diff -r 000000000000 -r 3641ad9bc7b6 src/haxe/ui/backend/BackendImpl.hx
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/haxe/ui/backend/BackendImpl.hx Wed Mar 30 23:49:22 2022 +0200
@@ -0,0 +1,9 @@
1+// SPDX-FileCopyrightText: 2022 Jaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@fastmail.net>
2+//
3+// SPDX-License-Identifier: Unlicense
4+
5+package haxe.ui.backend;
6+
7+class BackendImpl {
8+ public static var id:String = "yui";
9+}
\ No newline at end of file
diff -r 000000000000 -r 3641ad9bc7b6 src/haxe/ui/backend/CallLaterImpl.hx
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/haxe/ui/backend/CallLaterImpl.hx Wed Mar 30 23:49:22 2022 +0200
@@ -0,0 +1,11 @@
1+// SPDX-FileCopyrightText: 2022 Jaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@fastmail.net>
2+//
3+// SPDX-License-Identifier: Unlicense
4+
5+package haxe.ui.backend;
6+
7+class CallLaterImpl {
8+ function new(fn:Void->Void) {
9+ fn();
10+ }
11+}
\ No newline at end of file
diff -r 000000000000 -r 3641ad9bc7b6 src/haxe/ui/backend/ComponentImpl.hx
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/haxe/ui/backend/ComponentImpl.hx Wed Mar 30 23:49:22 2022 +0200
@@ -0,0 +1,103 @@
1+// SPDX-FileCopyrightText: 2022 Jaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@fastmail.net>
2+//
3+// SPDX-License-Identifier: Unlicense
4+
5+package haxe.ui.backend;
6+
7+import haxe.ui.backend.yui.DialogWrapper;
8+import haxe.ui.backend.yui.WidgetWrapper;
9+import haxe.ui.components.Button;
10+import haxe.ui.components.Label;
11+import haxe.ui.containers.HBox;
12+import haxe.ui.containers.VBox;
13+import haxe.ui.core.TextInput;
14+import haxe.ui.core.Component;
15+import haxe.ui.events.UIEvent;
16+import haxe.ui.events.MouseEvent;
17+import yui.hxHelpers.AutoRawPointer;
18+import yui.YEvent;
19+import yui.YUI;
20+import yui.YWidget;
21+import yui.YWidgetFactory;
22+
23+using cpp.Pointer;
24+using yui.hxHelpers.YWidgetHelper;
25+
26+@:unreflective
27+class ComponentImpl extends ComponentBase {
28+ public var wrapper : WidgetWrapper;
29+
30+ public var __parent : Component;
31+
32+ override function handleAddComponent(child:Component) : Component {
33+ child.__parent = cast this;
34+ return super.handleAddComponent(child);
35+ }
36+
37+ override function removeComponent(child:Component, dispose:Bool = true, invalidate:Bool = true):Component {
38+ this.wrapper.children.remove(child);
39+ return super.removeComponent(child, dispose, invalidate);
40+ }
41+
42+ override function handleReady() {
43+ this.createWidget(this.__parent == null ? null : this.__parent.wrapper);
44+ super.handleReady();
45+ }
46+
47+ private function createWidget(parent:WidgetWrapper = null) {
48+ if (parent == null) {
49+ parent = Toolkit.screen.mainWindow;
50+ }
51+
52+ var factory = YUI.widgetFactory().fromRaw().ref;
53+ var rPointer : AutoRawPointer<YWidget> = null;
54+ // TODO: use creators defined at native.xml
55+ if (this is VBox) {
56+ rPointer = factory.createVBox(parent.widget);
57+ }
58+ else if (this is HBox) {
59+ rPointer = factory.createHBox(parent.widget);
60+ }
61+ else if (this is Button) {
62+ var b = cast(this, Button);
63+ rPointer = factory.createPushButton(parent.widget, b.text);
64+ }
65+ else if (this is Label) {
66+ var l = cast(this, Label);
67+ rPointer = factory.createLabel(parent.widget, l.text);
68+ }
69+
70+ if (rPointer != null) {
71+ var pointer : cpp.RawPointer<YWidget> = rPointer;
72+ this.wrapper = new WidgetWrapper(pointer.fromRaw());
73+ } else {
74+ trace('pointer not created');
75+ }
76+
77+ parent.children.push(cast(this, Component));
78+ }
79+
80+ public function handleYEvent(eventPointer : Pointer<YEvent>) : Bool {
81+ var event = eventPointer.ref;
82+ var widgetPointer = event.widget();
83+ if (widgetPointer != null) {
84+ var widget = widgetPointer.fromRaw().ref;
85+ if (widget.equals(this.wrapper.widget.ref)) {
86+ var lbl = widget.debugLabel();
87+ trace('Event handled at widget "${lbl}"');
88+ if (event.eventType() == WidgetEvent) {
89+ this.dispatch(new MouseEvent(MouseEvent.CLICK));
90+ }
91+ return true;
92+ }
93+ }
94+
95+ for(c in this.wrapper.children) {
96+ var handled = c.handleYEvent(Pointer.addressOf(event));
97+ if (handled) {
98+ return handled;
99+ }
100+ }
101+ return false;
102+ }
103+}
\ No newline at end of file
diff -r 000000000000 -r 3641ad9bc7b6 src/haxe/ui/backend/ComponentSurface.hx
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/haxe/ui/backend/ComponentSurface.hx Wed Mar 30 23:49:22 2022 +0200
@@ -0,0 +1,10 @@
1+// SPDX-FileCopyrightText: 2022 Jaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@fastmail.net>
2+//
3+// SPDX-License-Identifier: Unlicense
4+
5+package haxe.ui.backend;
6+
7+class ComponentSurface {
8+ function new() {
9+ }
10+}
\ No newline at end of file
diff -r 000000000000 -r 3641ad9bc7b6 src/haxe/ui/backend/EventImpl.hx
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/haxe/ui/backend/EventImpl.hx Wed Mar 30 23:49:22 2022 +0200
@@ -0,0 +1,8 @@
1+// SPDX-FileCopyrightText: 2022 Jaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@fastmail.net>
2+//
3+// SPDX-License-Identifier: Unlicense
4+
5+package haxe.ui.backend;
6+
7+class EventImpl extends EventBase {
8+}
\ No newline at end of file
diff -r 000000000000 -r 3641ad9bc7b6 src/haxe/ui/backend/FontData.hx
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/haxe/ui/backend/FontData.hx Wed Mar 30 23:49:22 2022 +0200
@@ -0,0 +1,9 @@
1+// SPDX-FileCopyrightText: 2022 Jaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@fastmail.net>
2+//
3+// SPDX-License-Identifier: Unlicense
4+
5+package haxe.ui.backend;
6+
7+class FontData {
8+
9+}
\ No newline at end of file
diff -r 000000000000 -r 3641ad9bc7b6 src/haxe/ui/backend/ImageData.hx
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/haxe/ui/backend/ImageData.hx Wed Mar 30 23:49:22 2022 +0200
@@ -0,0 +1,9 @@
1+// SPDX-FileCopyrightText: 2022 Jaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@fastmail.net>
2+//
3+// SPDX-License-Identifier: Unlicense
4+
5+package haxe.ui.backend;
6+
7+class ImageData {
8+
9+}
\ No newline at end of file
diff -r 000000000000 -r 3641ad9bc7b6 src/haxe/ui/backend/ImageDisplayImpl.hx
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/haxe/ui/backend/ImageDisplayImpl.hx Wed Mar 30 23:49:22 2022 +0200
@@ -0,0 +1,11 @@
1+// SPDX-FileCopyrightText: 2022 Jaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@fastmail.net>
2+//
3+// SPDX-License-Identifier: Unlicense
4+
5+package haxe.ui.backend;
6+
7+class ImageDisplayImpl extends ImageBase {
8+ function new() {
9+
10+ }
11+}
\ No newline at end of file
diff -r 000000000000 -r 3641ad9bc7b6 src/haxe/ui/backend/ImageSurface.hx
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/haxe/ui/backend/ImageSurface.hx Wed Mar 30 23:49:22 2022 +0200
@@ -0,0 +1,9 @@
1+// SPDX-FileCopyrightText: 2022 Jaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@fastmail.net>
2+//
3+// SPDX-License-Identifier: Unlicense
4+
5+package haxe.ui.backend;
6+
7+class ImageSurface {
8+
9+}
\ No newline at end of file
diff -r 000000000000 -r 3641ad9bc7b6 src/haxe/ui/backend/PlatformImpl.hx
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/haxe/ui/backend/PlatformImpl.hx Wed Mar 30 23:49:22 2022 +0200
@@ -0,0 +1,8 @@
1+// SPDX-FileCopyrightText: 2022 Jaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@fastmail.net>
2+//
3+// SPDX-License-Identifier: Unlicense
4+
5+package haxe.ui.backend;
6+
7+class PlatformImpl extends PlatformBase {
8+}
\ No newline at end of file
diff -r 000000000000 -r 3641ad9bc7b6 src/haxe/ui/backend/ScreenImpl.hx
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/haxe/ui/backend/ScreenImpl.hx Wed Mar 30 23:49:22 2022 +0200
@@ -0,0 +1,20 @@
1+// SPDX-FileCopyrightText: 2022 Jaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@fastmail.net>
2+//
3+// SPDX-License-Identifier: Unlicense
4+
5+package haxe.ui.backend;
6+
7+import haxe.ui.backend.yui.DialogWrapper;
8+
9+class ScreenImpl extends ScreenBase {
10+ function new() {
11+
12+ }
13+ public var mainWindow(get, null) : DialogWrapper;
14+ private function get_mainWindow() : DialogWrapper {
15+ if (options == null) {
16+ return null;
17+ }
18+ return options.mainWindow;
19+ }
20+}
\ No newline at end of file
diff -r 000000000000 -r 3641ad9bc7b6 src/haxe/ui/backend/TextDisplayImpl.hx
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/haxe/ui/backend/TextDisplayImpl.hx Wed Mar 30 23:49:22 2022 +0200
@@ -0,0 +1,8 @@
1+// SPDX-FileCopyrightText: 2022 Jaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@fastmail.net>
2+//
3+// SPDX-License-Identifier: Unlicense
4+
5+package haxe.ui.backend;
6+
7+class TextDisplayImpl extends TextBase {
8+}
\ No newline at end of file
diff -r 000000000000 -r 3641ad9bc7b6 src/haxe/ui/backend/TextInputImpl.hx
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/haxe/ui/backend/TextInputImpl.hx Wed Mar 30 23:49:22 2022 +0200
@@ -0,0 +1,8 @@
1+// SPDX-FileCopyrightText: 2022 Jaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@fastmail.net>
2+//
3+// SPDX-License-Identifier: Unlicense
4+
5+package haxe.ui.backend;
6+
7+class TextInputImpl extends TextDisplayImpl {
8+}
\ No newline at end of file
diff -r 000000000000 -r 3641ad9bc7b6 src/haxe/ui/backend/TimerImpl.hx
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/haxe/ui/backend/TimerImpl.hx Wed Mar 30 23:49:22 2022 +0200
@@ -0,0 +1,13 @@
1+// SPDX-FileCopyrightText: 2022 Jaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@fastmail.net>
2+//
3+// SPDX-License-Identifier: Unlicense
4+
5+package haxe.ui.backend;
6+
7+class TimerImpl {
8+ function new(delay:Int, callback:Void->Void) {
9+ }
10+
11+ public function stop() {
12+ }
13+}
\ No newline at end of file
diff -r 000000000000 -r 3641ad9bc7b6 src/haxe/ui/backend/ToolkitOptions.hx
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/haxe/ui/backend/ToolkitOptions.hx Wed Mar 30 23:49:22 2022 +0200
@@ -0,0 +1,11 @@
1+// SPDX-FileCopyrightText: 2022 Jaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@fastmail.net>
2+//
3+// SPDX-License-Identifier: Unlicense
4+
5+package haxe.ui.backend;
6+
7+import haxe.ui.backend.yui.DialogWrapper;
8+
9+typedef ToolkitOptions = {
10+ ?mainWindow : DialogWrapper,
11+}
\ No newline at end of file
diff -r 000000000000 -r 3641ad9bc7b6 src/haxe/ui/backend/module.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/haxe/ui/backend/module.xml Wed Mar 30 23:49:22 2022 +0200
@@ -0,0 +1,16 @@
1+<!--
2+SPDX-FileCopyrightText: 2022 Jaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@fastmail.net>
3+
4+SPDX-License-Identifier: Unlicense
5+-->
6+<?xml version="1.0" encoding="utf-8" ?>
7+<module id="haxeui-YUI">
8+ <resources>
9+ <resource path="/haxe/ui/backend/yui/_module/styles" prefix="styles" />
10+ </resources>
11+ <themes>
12+ <global>
13+ <style resource="styles/main.css" />
14+ </global>
15+ </themes>
16+</module>
\ No newline at end of file
diff -r 000000000000 -r 3641ad9bc7b6 src/haxe/ui/backend/native.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/haxe/ui/backend/native.xml Wed Mar 30 23:49:22 2022 +0200
@@ -0,0 +1,12 @@
1+<!--
2+SPDX-FileCopyrightText: 2022 Jaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@fastmail.net>
3+
4+SPDX-License-Identifier: Unlicense
5+-->
6+<?xml version="1.0" encoding="utf-8" ?>
7+<native>
8+ <component id="haxe.ui.components.Button" allowChildren="false">
9+ <behaviour id="text" class="haxe.ui.backend.yui.behaviours.WidgetLabel" />
10+ <behaviour id="value" class="haxe.ui.backend.yui.behaviours.WidgetLabel" />
11+ </component>
12+</native>
\ No newline at end of file
diff -r 000000000000 -r 3641ad9bc7b6 src/haxe/ui/backend/yui/DialogWrapper.hx
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/haxe/ui/backend/yui/DialogWrapper.hx Wed Mar 30 23:49:22 2022 +0200
@@ -0,0 +1,54 @@
1+// SPDX-FileCopyrightText: 2022 Jaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@fastmail.net>
2+//
3+// SPDX-License-Identifier: Unlicense
4+
5+package haxe.ui.backend.yui;
6+
7+import yui.YDialog;
8+import yui.YWidget;
9+
10+using cpp.Pointer;
11+using cpp.RawPointer;
12+
13+/**
14+ * Wrapper for `YDialog`.
15+ */
16+@:unreflective
17+class DialogWrapper extends WidgetWrapper {
18+ public var dialog(get, null) : cpp.Pointer<YDialog>;
19+ function get_dialog() {
20+ var widgetRef = this.widget.ref;
21+ var widgetPointer : cpp.RawPointer<YWidget> = widgetRef.addressOf();
22+ var dialogPointer : cpp.RawPointer<YDialog> = cast widgetPointer;
23+ return dialogPointer.fromRaw();
24+ }
25+
26+ /**
27+ * Run the event loop for the dialog.
28+ *
29+ * Event at widgets are forwarded to the corresponding widget.
30+ */
31+ public function runEventLoop() {
32+ var dialogRef = this.dialog.ref;
33+ while (true) {
34+ var event = dialogRef.waitForEvent().fromRaw().ref;
35+ var type = event.eventType();
36+ trace('Received event ${type}');
37+ if (type == CancelEvent) {
38+ break;
39+ }
40+ var widgetPointer = event.widget();
41+ if (widgetPointer != null) {
42+ var widget = widgetPointer.fromRaw().ref;
43+ var lbl = widget.debugLabel();
44+ trace('Event at widget "${lbl}"');
45+ for(c in this.children) {
46+ var handled = c.handleYEvent(Pointer.addressOf(event));
47+ if (handled) {
48+ break;
49+ }
50+ }
51+ }
52+ }
53+ }
54+}
\ No newline at end of file
diff -r 000000000000 -r 3641ad9bc7b6 src/haxe/ui/backend/yui/WidgetWrapper.hx
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/haxe/ui/backend/yui/WidgetWrapper.hx Wed Mar 30 23:49:22 2022 +0200
@@ -0,0 +1,27 @@
1+// SPDX-FileCopyrightText: 2022 Jaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@fastmail.net>
2+//
3+// SPDX-License-Identifier: Unlicense
4+
5+package haxe.ui.backend.yui;
6+
7+import haxe.ui.core.Component;
8+import yui.hxHelpers.AutoRawPointer;
9+import yui.YDialog;
10+import yui.YWidget;
11+
12+using cpp.Pointer;
13+using cpp.RawPointer;
14+
15+/**
16+ * Wrapper for `YWidget`.
17+ */
18+@:unreflective
19+class WidgetWrapper {
20+ public function new(w : cpp.Pointer<YWidget>) {
21+ this.widget = w;
22+ this.children = [];
23+ }
24+ public var widget : cpp.Pointer<YWidget>;
25+
26+ public var children : Array<Component>;
27+}
\ No newline at end of file
diff -r 000000000000 -r 3641ad9bc7b6 src/haxe/ui/backend/yui/_module/styles/main.css
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/haxe/ui/backend/yui/_module/styles/main.css Wed Mar 30 23:49:22 2022 +0200
@@ -0,0 +1,14 @@
1+/*
2+SPDX-FileCopyrightText: 2022 Jaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@fastmail.net>
3+
4+SPDX-License-Identifier: Unlicense
5+*/
6+* {
7+ native: true;
8+}
9+
10+.component:native {
11+ background-color: none;
12+ color: none;
13+ border: none;
14+}
\ No newline at end of file
diff -r 000000000000 -r 3641ad9bc7b6 src/haxe/ui/backend/yui/behaviours/WidgetLabel.hx
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/haxe/ui/backend/yui/behaviours/WidgetLabel.hx Wed Mar 30 23:49:22 2022 +0200
@@ -0,0 +1,32 @@
1+// SPDX-FileCopyrightText: 2022 Jaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@fastmail.net>
2+//
3+// SPDX-License-Identifier: Unlicense
4+
5+package haxe.ui.backend.yui.behaviours;
6+
7+import haxe.ui.behaviours.DataBehaviour;
8+import haxe.ui.util.Variant;
9+import yui.YProperty;
10+import yui.YPropertyValue;
11+
12+class WidgetLabel extends DataBehaviour {
13+ static final LABEL_PROPERTY = "Label";
14+
15+ override function get() : Variant {
16+ if (_component.wrapper != null) {
17+ var wid = _component.wrapper.widget.ref;
18+ var prop = wid.getProperty(LABEL_PROPERTY);
19+ var val = prop.stringVal();
20+ return VT_String(val);
21+ } else {
22+ return _value;
23+ }
24+ }
25+
26+ override function invalidateData() {
27+ if (_component.wrapper != null) {
28+ var prop = YPropertyValue.create((_value : String));
29+ _component.wrapper.widget.ref.setProperty(LABEL_PROPERTY, prop);
30+ }
31+ }
32+}
\ No newline at end of file