Skip to content

Commit

Permalink
- Added PageNavigator to populate section icon/buttons
Browse files Browse the repository at this point in the history
- Structuring in-progress
(#37)
  • Loading branch information
rat-moonshine committed Aug 24, 2021
1 parent 026bc14 commit 1fea919
Show file tree
Hide file tree
Showing 5 changed files with 86 additions and 1 deletion.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package net.prominic.native.haxeScripts.ui;

import openfl.display.BitmapData;
import openfl.events.Event;
import openfl.display.DisplayObject;
import feathers.core.IMeasureObject;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package net.prominic.native.themes.assets;

import openfl.display.BitmapData;

@:bitmap("net/prominic/native/themes/assets/images/bgDashboard.png")
class DashboardBackground extends BitmapData {}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,11 +1,30 @@
package net.prominic.native.views.components.generals;

import openfl.display.BitmapData;
import openfl.geom.Matrix;
import feathers.utils.TextFormatUtil;
import feathers.text.TextFormat;
import feathers.controls.Label;
import feathers.controls.navigators.PageItem;
import feathers.data.ArrayCollection;
import feathers.layout.AnchorLayoutData;
import feathers.controls.navigators.PageNavigator;
import feathers.layout.AnchorLayout;
import net.prominic.shared.themes.SharedTheme;
import feathers.skins.RectangleSkin;
import feathers.controls.LayoutGroup;
import net.prominic.native.themes.assets.DashboardBackground;

typedef DashboardSectionButtonDescriptor = {
var label:String;
var componentWrapperGetMethod:String;
var icon:BitmapData;
}

class ViewHome extends LayoutGroup
{
private var appNote = "This application provides access to your machines.\nPlease, only use this on a secure computer, and close the application when you are done.\nProminic.NET is a registered trademark.";

public function new()
{
super();
Expand All @@ -15,7 +34,66 @@ class ViewHome extends LayoutGroup
{
this.variant = SharedTheme.THEME_VARIANT_NATIVE_ROUNDED_CONTAINER;


this.layout = new AnchorLayout();

var navigatorLayoutData = new AnchorLayoutData();
navigatorLayoutData.horizontalCenter = 0.0;
navigatorLayoutData.verticalCenter = 0.0;

this.generateSectionsForPage1();

var navigator = new PageNavigator();
navigator.layoutData = new AnchorLayoutData(20, 20, 80, 20);
navigator.dataProvider = new ArrayCollection([
PageItem.withClass(PageNavigatorPage)
]);
this.addChild(navigator);

var lblFooter = new Label(this.appNote);
lblFooter.textFormat = new TextFormat(SharedTheme.DEFAULT_FONT, 11, 0x999999, null, null, null, null, null, CENTER);
lblFooter.layoutData = new AnchorLayoutData(null, 20, 26, 20);
this.addChild(lblFooter);

super.initialize();
}

private function generateSectionsForPage1():ArrayCollection<DashboardSectionButtonDescriptor>
{
var tmpSections = new ArrayCollection([]);

var section = {
label: "abcd",
componentWrapperGetMethod: "efgh",
icon: null
};
tmpSections.add(section);

return tmpSections;
}
}

class PageNavigatorPage extends LayoutGroup
{
public var sections:ArrayCollection<DashboardSectionButtonDescriptor>;

public function new()
{
super();

this.layout = new AnchorLayout();

var backgroundLayoutLayoutData = new AnchorLayoutData();
backgroundLayoutLayoutData.horizontalCenter = 0.0;
backgroundLayoutLayoutData.verticalCenter = 0.0;

var backgroundLayout = new LayoutGroup();
var tmpBitmapData = new DashboardBackground(683, 420);
var backgroundRullers = new RectangleSkin();
backgroundRullers.fill = Bitmap(tmpBitmapData, new Matrix(), false);
backgroundLayout.backgroundSkin = backgroundRullers;
backgroundLayout.width = 683;
backgroundLayout.height = 420;
backgroundLayout.layoutData = backgroundLayoutLayoutData;
this.addChild(backgroundLayout);
}
}

0 comments on commit 1fea919

Please sign in to comment.