refactored package
This commit is contained in:
4
.gitignore
vendored
Executable file
4
.gitignore
vendored
Executable file
@@ -0,0 +1,4 @@
|
|||||||
|
*.iml
|
||||||
|
*.ipr
|
||||||
|
*.iws
|
||||||
|
out/
|
||||||
37
examples/ViewExample.hx
Executable file
37
examples/ViewExample.hx
Executable file
@@ -0,0 +1,37 @@
|
|||||||
|
package examples;
|
||||||
|
|
||||||
|
import flash.Lib;
|
||||||
|
import haxework.gui.skin.ColorSkin;
|
||||||
|
import haxework.gui.View;
|
||||||
|
import haxework.gui.IView;
|
||||||
|
import flash.display.Sprite;
|
||||||
|
import haxework.gui.GroupView;
|
||||||
|
import haxework.gui.IGroupView;
|
||||||
|
|
||||||
|
class ViewExample {
|
||||||
|
|
||||||
|
public static function main() {
|
||||||
|
View.updater.stage = Lib.current.stage;
|
||||||
|
|
||||||
|
var group:IGroupView<Sprite> = new GroupView();
|
||||||
|
group.width = 400;
|
||||||
|
group.height = 400;
|
||||||
|
group.skin = new ColorSkin(0xffff00);
|
||||||
|
var view:IView<Sprite> = new View();
|
||||||
|
view.width = 200;
|
||||||
|
view.height = 200;
|
||||||
|
view.skin = new ColorSkin(0xff0000);
|
||||||
|
group.addView(view);
|
||||||
|
view = new View();
|
||||||
|
view.width = 100;
|
||||||
|
view.height = 100;
|
||||||
|
view.skin = new ColorSkin(0x00ff00);
|
||||||
|
group.addView(view);
|
||||||
|
view = new View();
|
||||||
|
view.width = 50;
|
||||||
|
view.height = 50;
|
||||||
|
view.skin = new ColorSkin(0x0000ff);
|
||||||
|
group.addView(view);
|
||||||
|
Lib.current.addChild(group.content);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.abit.haxework.core;
|
package haxework.core;
|
||||||
typedef Tuple2#if!H<T1, T2>#end = {
|
typedef Tuple2#if!H<T1, T2>#end = {
|
||||||
var first(default, null):T1;
|
var first(default, null):T1;
|
||||||
var second(default, null):T2;
|
var second(default, null):T2;
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
package com.abit.haxework.gui;
|
package haxework.gui;
|
||||||
|
|
||||||
import com.abit.haxework.gui.core.VAlign;
|
import haxework.gui.core.VAlign;
|
||||||
import com.abit.haxework.gui.core.HAlign;
|
import haxework.gui.core.HAlign;
|
||||||
import com.abit.haxework.gui.layout.DefaultLayout;
|
import haxework.gui.layout.DefaultLayout;
|
||||||
import com.abit.haxework.gui.layout.ILayout;
|
import haxework.gui.layout.ILayout;
|
||||||
import flash.display.Sprite;
|
import flash.display.Sprite;
|
||||||
|
|
||||||
class GroupView extends View implements IGroupView<Sprite> {
|
class GroupView extends View implements IGroupView<Sprite> {
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
package com.abit.haxework.gui;
|
package haxework.gui;
|
||||||
|
|
||||||
import com.abit.haxework.gui.core.HAlign;
|
import haxework.gui.core.HAlign;
|
||||||
import com.abit.haxework.gui.core.VAlign;
|
import haxework.gui.core.VAlign;
|
||||||
import com.abit.haxework.gui.layout.ILayout;
|
import haxework.gui.layout.ILayout;
|
||||||
|
|
||||||
interface IGroupView<C> extends IView<C> {
|
interface IGroupView<C> extends IView<C> {
|
||||||
|
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
package com.abit.haxework.gui;
|
package haxework.gui;
|
||||||
|
|
||||||
import com.abit.haxework.gui.core.VAlign;
|
import haxework.gui.core.VAlign;
|
||||||
import com.abit.haxework.gui.core.HAlign;
|
import haxework.gui.core.HAlign;
|
||||||
import com.abit.haxework.gui.skin.ISkin;
|
import haxework.gui.skin.ISkin;
|
||||||
import com.abit.haxework.gui.core.SizeType;
|
import haxework.gui.core.SizeType;
|
||||||
|
|
||||||
interface IView<C> {
|
interface IView<C> {
|
||||||
public var id(default, null):String;
|
public var id(default, null):String;
|
||||||
@@ -1,12 +1,14 @@
|
|||||||
package com.abit.haxework.gui;
|
package haxework.gui;
|
||||||
|
|
||||||
import com.abit.haxework.gui.core.SizeType;
|
import flash.display.StageAlign;
|
||||||
import com.abit.haxework.gui.core.HAlign;
|
import flash.display.StageScaleMode;
|
||||||
import com.abit.haxework.gui.core.VAlign;
|
import haxework.gui.core.SizeType;
|
||||||
|
import haxework.gui.core.HAlign;
|
||||||
|
import haxework.gui.core.VAlign;
|
||||||
import flash.events.Event;
|
import flash.events.Event;
|
||||||
import flash.display.Stage;
|
import flash.display.Stage;
|
||||||
import com.abit.haxework.gui.skin.FakeSkin;
|
import haxework.gui.skin.FakeSkin;
|
||||||
import com.abit.haxework.gui.skin.ISkin;
|
import haxework.gui.skin.ISkin;
|
||||||
|
|
||||||
import flash.display.Sprite;
|
import flash.display.Sprite;
|
||||||
|
|
||||||
@@ -205,6 +207,8 @@ class Updater {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private function set_stage(value:Stage):Stage {
|
private function set_stage(value:Stage):Stage {
|
||||||
|
value.scaleMode = StageScaleMode.NO_SCALE;
|
||||||
|
value.align = StageAlign.TOP_LEFT;
|
||||||
value.addEventListener(Event.ENTER_FRAME, update);
|
value.addEventListener(Event.ENTER_FRAME, update);
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.abit.haxework.gui.core;
|
package haxework.gui.core;
|
||||||
|
|
||||||
enum HAlign {
|
enum HAlign {
|
||||||
TOP;
|
TOP;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.abit.haxework.gui.core;
|
package haxework.gui.core;
|
||||||
|
|
||||||
enum SizeType {
|
enum SizeType {
|
||||||
NORMAL;
|
NORMAL;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.abit.haxework.gui.core;
|
package haxework.gui.core;
|
||||||
|
|
||||||
enum VAlign {
|
enum VAlign {
|
||||||
LEFT;
|
LEFT;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.abit.haxework.gui.layout;
|
package haxework.gui.layout;
|
||||||
|
|
||||||
class DefaultLayout implements ILayout {
|
class DefaultLayout implements ILayout {
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.abit.haxework.gui.layout;
|
package haxework.gui.layout;
|
||||||
|
|
||||||
interface ILayout {
|
interface ILayout {
|
||||||
public function place(group:IGroupView<Dynamic>, views:Array<IView<Dynamic>>):Void;
|
public function place(group:IGroupView<Dynamic>, views:Array<IView<Dynamic>>):Void;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.abit.haxework.gui.skin;
|
package haxework.gui.skin;
|
||||||
|
|
||||||
import flash.display.Graphics;
|
import flash.display.Graphics;
|
||||||
import flash.display.Sprite;
|
import flash.display.Sprite;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.abit.haxework.gui.skin;
|
package haxework.gui.skin;
|
||||||
|
|
||||||
import flash.display.Sprite;
|
import flash.display.Sprite;
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.abit.haxework.gui.skin;
|
package haxework.gui.skin;
|
||||||
|
|
||||||
interface ISkin<C, V:IView<C>> {
|
interface ISkin<C, V:IView<C>> {
|
||||||
public function draw(view:V):Void;
|
public function draw(view:V):Void;
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
package com.abit.haxework.net;
|
package haxework.net;
|
||||||
|
|
||||||
import com.abit.haxework.net.callback.Callback;
|
import haxework.net.callback.Callback;
|
||||||
import com.abit.haxework.net.callback.ICallback;
|
import haxework.net.callback.ICallback;
|
||||||
import flash.events.Event;
|
import flash.events.Event;
|
||||||
import com.abit.haxework.net.ILoader.Method;
|
import haxework.net.ILoader.Method;
|
||||||
|
|
||||||
class BaseLoader<T> implements ILoader<T> {
|
class BaseLoader<T> implements ILoader<T> {
|
||||||
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
package com.abit.haxework.net;
|
package haxework.net;
|
||||||
|
|
||||||
import com.abit.haxework.net.BaseLoader;
|
import haxework.net.BaseLoader;
|
||||||
import flash.events.SecurityErrorEvent;
|
import flash.events.SecurityErrorEvent;
|
||||||
import flash.events.IOErrorEvent;
|
import flash.events.IOErrorEvent;
|
||||||
import flash.events.Event;
|
import flash.events.Event;
|
||||||
@@ -1,14 +1,11 @@
|
|||||||
package com.abit.haxework.net;
|
package haxework.net;
|
||||||
|
|
||||||
import flash.net.URLLoaderDataFormat;
|
import flash.net.URLLoaderDataFormat;
|
||||||
import flash.events.SecurityErrorEvent;
|
import flash.events.SecurityErrorEvent;
|
||||||
import com.abit.haxework.net.callback.Callback;
|
|
||||||
import com.abit.haxework.net.callback.ICallback;
|
|
||||||
import flash.events.IOErrorEvent;
|
import flash.events.IOErrorEvent;
|
||||||
import flash.net.URLRequest;
|
import flash.net.URLRequest;
|
||||||
import flash.events.Event;
|
import flash.events.Event;
|
||||||
import flash.net.URLLoader;
|
import flash.net.URLLoader;
|
||||||
import com.abit.haxework.net.ILoader.Method;
|
|
||||||
|
|
||||||
class BaseURLLoader<T> extends BaseLoader<T> {
|
class BaseURLLoader<T> extends BaseLoader<T> {
|
||||||
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
package com.abit.haxework.net;
|
package haxework.net;
|
||||||
|
|
||||||
import com.abit.haxework.net.callback.ICallback;
|
import haxework.net.callback.ICallback;
|
||||||
|
|
||||||
enum Method {
|
enum Method {
|
||||||
GET;
|
GET;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.abit.haxework.net;
|
package haxework.net;
|
||||||
|
|
||||||
import flash.display.LoaderInfo;
|
import flash.display.LoaderInfo;
|
||||||
import flash.display.Loader;
|
import flash.display.Loader;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.abit.haxework.net;
|
package haxework.net;
|
||||||
|
|
||||||
import flash.events.Event;
|
import flash.events.Event;
|
||||||
import flash.net.URLLoader;
|
import flash.net.URLLoader;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.abit.haxework.net;
|
package haxework.net;
|
||||||
|
|
||||||
import flash.net.URLLoader;
|
import flash.net.URLLoader;
|
||||||
import flash.events.Event;
|
import flash.events.Event;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.abit.haxework.net.callback;
|
package haxework.net.callback;
|
||||||
|
|
||||||
class Callback<T> implements ICallback<T> {
|
class Callback<T> implements ICallback<T> {
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.abit.haxework.net.callback;
|
package haxework.net.callback;
|
||||||
|
|
||||||
interface ICallback<T> {
|
interface ICallback<T> {
|
||||||
public function success(f:T -> Void):ICallback<T>;
|
public function success(f:T -> Void):ICallback<T>;
|
||||||
Reference in New Issue
Block a user