Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Haxe 1.79 KB | None | 0 0
  1. class ComponentBase {
  2.     public function handleCreate(native:Bool) {
  3.         trace('handleCreate for ${Type.getClassName(Type.getClass(this))} - native: ${native}');
  4.         var className:String = Type.getClassName(Type.getClass(this));
  5.         var nativeComponentClass:String = Toolkit.nativeConfig.query('component[id=${className}].@class', 'System.Windows.Forms.Panel');
  6.         trace(nativeComponentClass);
  7.         control = Type.createInstance(Type.resolveClass(nativeComponentClass), []);
  8.     }
  9.  
  10.     private function handlePosition(left:Null<Float>, top:Null<Float>, style:Style) {
  11.         trace('handlePosition for ${Type.getClassName(Type.getClass(this))} - left: ${left}, top: ${top}');
  12.         if (control == null) {
  13.             return;
  14.         }
  15.        
  16.         control.Location = new Point(Std.int(left), Std.int(top));
  17.     }
  18.  
  19.     private function handleSize(width:Null<Float>, height:Null<Float>, style:Style) {
  20.         trace('handleSize for ${Type.getClassName(Type.getClass(this))} - width: ${width}, height: ${height}');
  21.         if (control == null) {
  22.             return;
  23.         }
  24.        
  25.         control.Size = new Size(Std.int(width), Std.int(height));
  26.     }
  27. }
  28.  
  29. class ControlText extends Behaviour {
  30.     public override function set(value:Variant) {
  31.         if (value == null || value.isNull == true) {
  32.             return;
  33.         }
  34.         trace("ControlText.set: " + value);
  35.         _component.control.Text = value;
  36.     }
  37.  
  38.     public override function get():Variant {
  39.         return null;
  40.     }
  41. }
  42.  
  43. class ControlSize extends DelegateLayoutSize {
  44.     private override function get_width():Float {
  45.         return component.control.Size.Width;
  46.     }
  47.    
  48.     private override function get_height():Float {
  49.         return component.control.Size.Height;
  50.     }
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement