mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
Merge branch 'ErjanGavalji/remove-toolbar'
This commit is contained in:
@@ -1,2 +0,0 @@
|
|||||||
{ "name" : "tool-bar",
|
|
||||||
"main" : "tool-bar.js" }
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
import definition = require("ui/tool-bar");
|
|
||||||
import view = require("ui/core/view");
|
|
||||||
import proxy = require("ui/core/proxy");
|
|
||||||
import dependencyObservable = require("ui/core/dependency-observable");
|
|
||||||
|
|
||||||
export module knownCollections {
|
|
||||||
export var items = "items";
|
|
||||||
}
|
|
||||||
|
|
||||||
export class ToolBar extends view.View implements definition.ToolBar {
|
|
||||||
public _addArrayFromBuilder(name: string, value: Array<any>) {
|
|
||||||
if (name === "items") {
|
|
||||||
this._setValue(ToolBar.itemsProperty, value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
get items(): Array<definition.ToolBarItem> {
|
|
||||||
return this._getValue(ToolBar.itemsProperty);
|
|
||||||
}
|
|
||||||
set items(value: Array<definition.ToolBarItem>) {
|
|
||||||
this._setValue(ToolBar.itemsProperty, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static itemsProperty = new dependencyObservable.Property("items", "ToolBar", new proxy.PropertyMetadata(undefined))
|
|
||||||
}
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
import common = require("ui/tool-bar/tool-bar-common");
|
|
||||||
import dependencyObservable = require("ui/core/dependency-observable");
|
|
||||||
import proxy = require("ui/core/proxy");
|
|
||||||
|
|
||||||
// merge the exports of the common file with the exports of this file
|
|
||||||
declare var exports;
|
|
||||||
require("utils/module-merge").merge(common, exports);
|
|
||||||
|
|
||||||
function onItemsPropertyChanged(data: dependencyObservable.PropertyChangeData) {
|
|
||||||
var view = <ToolBar>data.object;
|
|
||||||
if (!view.android) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
(<proxy.PropertyMetadata>common.ToolBar.itemsProperty.metadata).onSetNativeValue = onItemsPropertyChanged;
|
|
||||||
|
|
||||||
export class ToolBar extends common.ToolBar {
|
|
||||||
private _android: any;
|
|
||||||
|
|
||||||
public _createUI() {
|
|
||||||
this._android = new (<any>android.widget).Toolbar(this._context);
|
|
||||||
}
|
|
||||||
|
|
||||||
get android(): any {
|
|
||||||
return this._android;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
32
ui/tool-bar/tool-bar.d.ts
vendored
32
ui/tool-bar/tool-bar.d.ts
vendored
@@ -1,32 +0,0 @@
|
|||||||
/**
|
|
||||||
* Contains the ToolBar class, which represents a ToolBar component.
|
|
||||||
*/
|
|
||||||
declare module "ui/tool-bar" {
|
|
||||||
import view = require("ui/core/view");
|
|
||||||
import dependencyObservable = require("ui/core/dependency-observable");
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Represents a ToolBar item.
|
|
||||||
*/
|
|
||||||
interface ToolBarItem {
|
|
||||||
/**
|
|
||||||
* Gets or sets the title of the ToolBar.
|
|
||||||
*/
|
|
||||||
view: view.View;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Represents a UI ToolBar component.
|
|
||||||
*/
|
|
||||||
export class ToolBar extends view.View {
|
|
||||||
/**
|
|
||||||
* Gets or sets the items of the ToolBar.
|
|
||||||
*/
|
|
||||||
items: Array<ToolBarItem>;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets or sets the items dependency property of the ToolBar.
|
|
||||||
*/
|
|
||||||
public static itemsProperty: dependencyObservable.Property;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,41 +0,0 @@
|
|||||||
import definition = require("ui/tool-bar");
|
|
||||||
import common = require("ui/tool-bar/tool-bar-common");
|
|
||||||
import dependencyObservable = require("ui/core/dependency-observable");
|
|
||||||
import proxy = require("ui/core/proxy");
|
|
||||||
import view = require("ui/core/view");
|
|
||||||
|
|
||||||
// merge the exports of the common file with the exports of this file
|
|
||||||
declare var exports;
|
|
||||||
require("utils/module-merge").merge(common, exports);
|
|
||||||
|
|
||||||
function onItemsPropertyChanged(data: dependencyObservable.PropertyChangeData) {
|
|
||||||
var bar = <ToolBar>data.object;
|
|
||||||
if (!bar.ios) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var items = new NSMutableArray();
|
|
||||||
for (var element in <Array<definition.ToolBarItem>>data.newValue) {
|
|
||||||
if (element.view instanceof view.View) {
|
|
||||||
bar._addView(element.view);
|
|
||||||
items.addObject(element.view.ios);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bar.ios.setItemsAnimated(items, false);
|
|
||||||
}
|
|
||||||
(<proxy.PropertyMetadata>common.ToolBar.itemsProperty.metadata).onSetNativeValue = onItemsPropertyChanged;
|
|
||||||
|
|
||||||
export class ToolBar extends common.ToolBar {
|
|
||||||
private _ios: UIToolbar;
|
|
||||||
|
|
||||||
constructor() {
|
|
||||||
super();
|
|
||||||
|
|
||||||
this._ios = UIToolbar.new();
|
|
||||||
}
|
|
||||||
|
|
||||||
get ios(): UIToolbar {
|
|
||||||
return this._ios;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user