Created
June 20, 2013 17:57
-
-
Save bsideup/5825024 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Generated by mxmlc 4.0 | |
* | |
* Package: ru.trylogic.gui.components.button | |
* Class: ButtonSkin | |
* Source: /Users/bsideup/Dropbox/Work/_VersionControlled_/GitHub/TrylogicGUI/src/main/flex/ru/trylogic/gui/components/button/ButtonSkin.mxml | |
* Template: flex2/compiler/mxml/gen/ClassDef.vm | |
* Time: 2012.09.14 15:11:14 MSK | |
*/ | |
package ru.trylogic.gui.components.button | |
{ | |
import flash.accessibility.*; | |
import flash.debugger.*; | |
import flash.display.*; | |
import flash.errors.*; | |
import flash.events.*; | |
import flash.external.*; | |
import flash.geom.*; | |
import flash.media.*; | |
import flash.net.*; | |
import flash.printing.*; | |
import flash.profiler.*; | |
import flash.system.*; | |
import flash.text.*; | |
import flash.ui.*; | |
import flash.utils.*; | |
import flash.xml.*; | |
import mx.binding.*; | |
import mx.binding.IBindingClient; | |
import mx.core.ClassFactory; | |
import mx.core.DeferredInstanceFromClass; | |
import mx.core.DeferredInstanceFromFunction; | |
import mx.core.IDeferredInstance; | |
import mx.core.IFactory; | |
import mx.core.IFlexModuleFactory; | |
import mx.core.IPropertyChangeNotifier; | |
import mx.core.IStateClient2; | |
import mx.core.mx_internal; | |
import mx.filters.*; | |
import mx.states.SetProperty; | |
import mx.states.State; | |
import mx.styles.*; | |
import ru.trylogic.gui.components.image.Image; | |
import ru.trylogic.gui.components.textField.TextField; | |
import ru.trylogic.gui.containers.ContainerBase; | |
[HostComponent("ru.trylogic.gui.components.button.Button")] | |
[States("up", "down", "disabled")] | |
public class ButtonSkin | |
extends ru.trylogic.gui.containers.ContainerBase | |
implements mx.binding.IBindingClient, mx.core.IStateClient2 | |
{ | |
[Bindable] | |
/** | |
* @private | |
**/ | |
public var _ButtonSkin_SetProperty1 : mx.states.SetProperty; | |
[Bindable] | |
/** | |
* @private | |
**/ | |
public var _ButtonSkin_SetProperty2 : mx.states.SetProperty; | |
[Bindable] | |
/** | |
* @private | |
**/ | |
public var _ButtonSkin_SetProperty3 : mx.states.SetProperty; | |
[Bindable] | |
/** | |
* @private | |
**/ | |
public var buttonImage : ru.trylogic.gui.components.image.Image; | |
[Bindable] | |
/** | |
* @private | |
**/ | |
public var disabledState : mx.states.State; | |
[Bindable] | |
/** | |
* @private | |
**/ | |
public var downState : mx.states.State; | |
[Bindable] | |
/** | |
* @private | |
**/ | |
public var label : ru.trylogic.gui.components.textField.TextField; | |
[Bindable] | |
/** | |
* @private | |
**/ | |
public var upState : mx.states.State; | |
/** | |
* @private | |
**/ | |
public function ButtonSkin() | |
{ | |
super(); | |
states = [ | |
new State ({ | |
name: "up", | |
overrides: [ | |
_ButtonSkin_SetProperty1 = mx.states.SetProperty( new mx.states.SetProperty().initializeFromObject({ | |
target: "buttonImage", | |
name: "texture", | |
value: null | |
})) | |
] | |
}) | |
, | |
new State ({ | |
name: "down", | |
overrides: [ | |
_ButtonSkin_SetProperty2 = mx.states.SetProperty( new mx.states.SetProperty().initializeFromObject({ | |
target: "buttonImage", | |
name: "texture", | |
value: null | |
})) | |
] | |
}) | |
, | |
new State ({ | |
name: "disabled", | |
overrides: [ | |
_ButtonSkin_SetProperty3 = mx.states.SetProperty( new mx.states.SetProperty().initializeFromObject({ | |
target: "buttonImage", | |
name: "texture", | |
value: null | |
})) | |
] | |
}) | |
]; | |
mx.binding.BindingManager.executeBindings(this, "_ButtonSkin_SetProperty1", _ButtonSkin_SetProperty1); | |
mx.binding.BindingManager.executeBindings(this, "_ButtonSkin_SetProperty2", _ButtonSkin_SetProperty2); | |
mx.binding.BindingManager.executeBindings(this, "_ButtonSkin_SetProperty3", _ButtonSkin_SetProperty3); | |
upState= states[0]; | |
downState= states[1]; | |
disabledState= states[2]; | |
var bindings:Array = _ButtonSkin_bindingsSetup(); | |
var watchers:Array = []; | |
var target:Object = this; | |
if (_watcherSetupUtil == null) | |
{ | |
var watcherSetupUtilClass:Object = getDefinitionByName("_ru_trylogic_gui_components_button_ButtonSkinWatcherSetupUtil"); | |
watcherSetupUtilClass["init"](null); | |
} | |
_watcherSetupUtil.setup(this, | |
function(propertyName:String):* { return target[propertyName]; }, | |
function(propertyName:String):* { return ButtonSkin[propertyName]; }, | |
bindings, | |
watchers); | |
mx_internal::_bindings = mx_internal::_bindings.concat(bindings); | |
mx_internal::_watchers = mx_internal::_watchers.concat(watchers); | |
// our style settings | |
// layer initializers | |
// properties | |
this.subViews = new <tl.view.IView>[_ButtonSkin_Image1_i(), _ButtonSkin_TextField1_i()]; | |
this.currentState = "up"; | |
// events | |
for (var i:uint = 0; i < bindings.length; i++) | |
{ | |
Binding(bindings[i]).execute(); | |
} | |
} | |
// supporting function definitions for properties, events, styles, effects | |
private function _ButtonSkin_Image1_i() : ru.trylogic.gui.components.image.Image | |
{ | |
var temp : ru.trylogic.gui.components.image.Image = new ru.trylogic.gui.components.image.Image(); | |
buttonImage = temp; | |
mx.binding.BindingManager.executeBindings(this, "buttonImage", buttonImage); | |
return temp; | |
} | |
private function _ButtonSkin_TextField1_i() : ru.trylogic.gui.components.textField.TextField | |
{ | |
var temp : ru.trylogic.gui.components.textField.TextField = new ru.trylogic.gui.components.textField.TextField(); | |
label = temp; | |
mx.binding.BindingManager.executeBindings(this, "label", label); | |
return temp; | |
} | |
// binding mgmt | |
private function _ButtonSkin_bindingsSetup():Array | |
{ | |
var result:Array = []; | |
result[0] = new mx.binding.Binding(this, | |
function():* | |
{ | |
return (hostComponent.skinStyle.upTexture); | |
}, | |
null, | |
"_ButtonSkin_SetProperty1.value" | |
); | |
result[1] = new mx.binding.Binding(this, | |
function():* | |
{ | |
return (hostComponent.skinStyle.downTexture || hostComponent.skinStyle.upTexture); | |
}, | |
null, | |
"_ButtonSkin_SetProperty2.value" | |
); | |
result[2] = new mx.binding.Binding(this, | |
function():* | |
{ | |
return (hostComponent.skinStyle.disabledTexture || hostComponent.skinStyle.upTexture); | |
}, | |
null, | |
"_ButtonSkin_SetProperty3.value" | |
); | |
result[3] = new mx.binding.Binding(this, | |
function():String | |
{ | |
var result:* = (hostComponent.text); | |
return (result == undefined ? null : String(result)); | |
}, | |
null, | |
"label.text" | |
); | |
result[4] = new mx.binding.Binding(this, | |
function():Number | |
{ | |
return ((buttonImage.width - label.width) * 0.5); | |
}, | |
null, | |
"label.x" | |
); | |
result[5] = new mx.binding.Binding(this, | |
function():Number | |
{ | |
return ((buttonImage.height - label.height) * 0.5); | |
}, | |
null, | |
"label.y" | |
); | |
return result; | |
} | |
/** | |
* @private | |
**/ | |
public static function set watcherSetupUtil(watcherSetupUtil:IWatcherSetupUtil2):void | |
{ | |
(ButtonSkin)._watcherSetupUtil = watcherSetupUtil; | |
} | |
private static var _watcherSetupUtil:IWatcherSetupUtil2; | |
/** | |
* @private | |
**/ | |
mx_internal var _bindings : Array = []; | |
/** | |
* @private | |
**/ | |
mx_internal var _watchers : Array = []; | |
/** | |
* @private | |
**/ | |
mx_internal var _bindingsByDestination : Object = {}; | |
/** | |
* @private | |
**/ | |
mx_internal var _bindingsBeginWithWord : Object = {}; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment