-
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cdb7626
commit 23e42d4
Showing
7 changed files
with
821 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
76 changes: 76 additions & 0 deletions
76
samples/components-explorer/src/com/feathersui/components/views/CollapsibleScreen.hx
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
package com.feathersui.components.views; | ||
|
||
import feathers.layout.VerticalLayout; | ||
import feathers.text.TextFormat; | ||
import feathers.controls.Label; | ||
import feathers.skins.RectangleSkin; | ||
import feathers.controls.LayoutGroup; | ||
import openfl.display.DisplayObject; | ||
import feathers.controls.Button; | ||
import feathers.controls.Collapsible; | ||
import feathers.controls.Header; | ||
import feathers.controls.Panel; | ||
import feathers.events.TriggerEvent; | ||
import feathers.layout.AnchorLayout; | ||
import feathers.layout.AnchorLayoutData; | ||
import openfl.events.Event; | ||
|
||
class CollapsibleScreen extends Panel { | ||
private var collapsible:Collapsible; | ||
|
||
override private function initialize():Void { | ||
super.initialize(); | ||
this.createHeader(); | ||
|
||
this.layout = new AnchorLayout(); | ||
|
||
this.collapsible = new Collapsible(); | ||
this.collapsible.text = "Click to collapse and expand"; | ||
this.collapsible.content = this.createContent("This is the content", 0x339933); | ||
this.collapsible.layoutData = AnchorLayoutData.topCenter(20.0); | ||
this.collapsible.addEventListener(Event.OPEN, collapsible_openHandler); | ||
this.collapsible.addEventListener(Event.CLOSE, collapsible_closeHandler); | ||
this.addChild(this.collapsible); | ||
} | ||
|
||
private function createHeader():Void { | ||
var header = new Header(); | ||
header.text = "Collapsible"; | ||
this.header = header; | ||
|
||
var backButton = new Button(); | ||
backButton.text = "Back"; | ||
backButton.addEventListener(TriggerEvent.TRIGGER, backButton_triggerHandler); | ||
header.leftView = backButton; | ||
} | ||
|
||
private function createContent(text:String, color:UInt):DisplayObject { | ||
var content = new LayoutGroup(); | ||
var contentLayout = new VerticalLayout(); | ||
contentLayout.setPadding(50.0); | ||
contentLayout.horizontalAlign = CENTER; | ||
contentLayout.verticalAlign = MIDDLE; | ||
content.layout = contentLayout; | ||
var backgroundSkin = new RectangleSkin(); | ||
backgroundSkin.fill = SolidColor(color); | ||
content.backgroundSkin = backgroundSkin; | ||
var label = new Label(); | ||
label.textFormat = new TextFormat("_sans", 20, 0xffffff); | ||
label.text = text; | ||
label.layoutData = AnchorLayoutData.center(); | ||
content.addChild(label); | ||
return content; | ||
} | ||
|
||
private function collapsible_openHandler(event:Event):Void { | ||
trace("Collapsible opened"); | ||
} | ||
|
||
private function collapsible_closeHandler(event:Event):Void { | ||
trace("Collapsible closed"); | ||
} | ||
|
||
private function backButton_triggerHandler(event:TriggerEvent):Void { | ||
this.dispatchEvent(new Event(Event.COMPLETE)); | ||
} | ||
} |
This file contains 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
Oops, something went wrong.