public bool InitializeImage(BitMobile.Controls.StyleSheet.StyleSheet stylesheet) { ImageWidth = 30; ImageHeight = 30; return(true); }
public override Bound Apply(StyleSheet.StyleSheet stylesheet, Bound styleBound, Bound maxBound) { base.Apply(stylesheet, styleBound, maxBound); var app = UIScreen.MainScreen.ApplicationFrame; Bound bound = new Bound(app.Width, app.Height); LayoutBehaviour.Screen(stylesheet, this, _child, bound); Rectangle old = _child.Frame; _child.Frame = new Rectangle(old.Left + app.Left, old.Top + app.Top, old.Width, old.Height); // background color _view.BackgroundColor = stylesheet.GetHelper <StyleHelper> ().ColorOrClear <BackgroundColor> (this); if (OnLoad != null) { OnLoad.Execute(); } Frame = new Rectangle(app.Left, app.Top, bound); return(bound); }
public bool InitializeImage(StyleSheet.StyleSheet stylesheet) { // Is is not a magic numbers, just 1 ImageWidth = 1; ImageHeight = 1; return(true); }
public override Bound Apply(StyleSheet.StyleSheet stylesheet, Bound styleBound, Bound maxBound) { base.Apply(stylesheet, styleBound, maxBound); // background color _view.BackgroundColor = stylesheet.GetHelper <StyleHelper>().ColorOrClear <BackgroundColor> (this); return(styleBound); }
public override Bound Apply(StyleSheet.StyleSheet stylesheet, Bound styleBound, Bound maxBound) { base.Apply(stylesheet, styleBound, maxBound); float offset = _behaviour.OffsetByIndex; _view.ContentOffset = new PointF(offset, 0); return(styleBound); }
public bool InitializeImage(BitMobile.Controls.StyleSheet.StyleSheet stylesheet) { if (InitBackgroundImage(stylesheet)) { this.ImageWidth = (int)_backgroundImageCache.Size.Width; this.ImageHeight = (int)_backgroundImageCache.Size.Height; return(true); } return(false); }
public override Bound Apply(StyleSheet.StyleSheet stylesheet, Bound styleBound, Bound maxBound) { base.Apply(stylesheet, styleBound, maxBound); // background color _view.SetBackgroundColor(stylesheet .GetHelper <StyleHelper>() .ColorOrTransparent <BackgroundColor>(this)); return(styleBound); }
public override Bound Apply(StyleSheet.StyleSheet stylesheet, Bound styleBound, Bound maxBound) { base.Apply(stylesheet, styleBound, maxBound); var style = stylesheet.GetHelper <StyleHelper>(); // background color, borders var background = style.Background(this, _applicationContext, true); _view.SetBackgroundDrawable(background); // text color _view.SetTextColor(style.ColorOrTransparent <Color>(this)); // placeholder color var hintColor = style.Color <PlaceholderColor>(this); if (hintColor != null) { string text = _view.Text; _view.Text = null; _view.SetHintTextColor(hintColor.Value); _view.Text = text; } // font style.SetFontSettings(this, _view, styleBound.Height); // padding int pl = style.Padding <PaddingLeft>(this, styleBound.Width).Round(); int pt = style.Padding <PaddingTop>(this, styleBound.Height).Round(); int pr = style.Padding <PaddingRight>(this, styleBound.Width).Round(); int pb = style.Padding <PaddingBottom>(this, styleBound.Height).Round(); View.SetPadding(pl, pt, pr, pb); // text align switch (style.TextAlign(this)) { case TextAlign.Align.Left: _view.Gravity = GravityFlags.Left; break; case TextAlign.Align.Center: _view.Gravity = GravityFlags.Center; break; case TextAlign.Align.Right: _view.Gravity = GravityFlags.Right; break; } return(styleBound); }
public bool InitializeImage (BitMobile.Controls.StyleSheet.StyleSheet stylesheet) { bool result = false; if (InitImage (stylesheet)) { ImageWidth = (int)_backgroungImageCache.Size.Width; ImageHeight = (int)_backgroungImageCache.Size.Height; result = true; } return result; }
public override Bound Apply(StyleSheet.StyleSheet stylesheet, Bound styleBound, Bound maxBound) { base.Apply(stylesheet, styleBound, maxBound); var style = stylesheet.GetHelper <StyleHelper>(); // color _view.IndeterminateDrawable.SetColorFilter(style.ColorOrTransparent <Color>(this) , Android.Graphics.PorterDuff.Mode.Multiply); return(styleBound); }
public override Bound Apply(StyleSheet.StyleSheet stylesheet, Bound styleBound, Bound maxBound) { base.Apply(stylesheet, styleBound, maxBound); var style = stylesheet.GetHelper <StyleHelper>(); // background color, background image, borders var background = style.Background(this, ApplicationContext); _view.SetBackgroundDrawable(background); return(LayoutChildren(stylesheet, styleBound, maxBound)); }
public override Bound Apply(StyleSheet.StyleSheet stylesheet, Bound styleBound, Bound maxBound) { base.Apply(stylesheet, styleBound, maxBound); StyleHelper style = stylesheet.GetHelper <StyleHelper>(); // color _view.Color = style.ColorOrClear <Color> (this); _view.HidesWhenStopped = true; return(styleBound); }
public override Bound Apply(StyleSheet.StyleSheet stylesheet, Bound styleBound, Bound maxBound) { StyleHelper style = stylesheet.GetHelper <StyleHelper> (); base.Apply(stylesheet, styleBound, maxBound); // background color, borders style.SetBackgroundSettings(this); // text color _view.TextColor = style.ColorOrClear <BitMobile.Controls.StyleSheet.Color> (this); // placeholder color _placeholderColor = style.Color <PlaceholderColor> (this); SetupPlaceholder(_placeholder); // font UIFont f = style.Font(this, styleBound.Height); if (f != null) { _view.Font = f; } // padding _view.PaddingLeft = style.Padding <PaddingLeft> (this, styleBound.Width); _view.PaddingTop = style.Padding <PaddingTop> (this, styleBound.Height); _view.PaddingRight = style.Padding <PaddingRight> (this, styleBound.Width); _view.PaddingBottom = style.Padding <PaddingBottom> (this, styleBound.Height); // text align switch (style.TextAlign(this)) { case TextAlign.Align.Left: _view.TextAlignment = UITextAlignment.Left; break; case TextAlign.Align.Center: _view.TextAlignment = UITextAlignment.Center; break; case TextAlign.Align.Right: _view.TextAlignment = UITextAlignment.Right; break; } _view.Text = _text; return(styleBound); }
bool InitImage (BitMobile.Controls.StyleSheet.StyleSheet stylesheet) { if (_backgroungImageCache == null) { if (Source != null) { _backgroungImageCache = UIImage.FromFile (FileSystemProvider.TranslatePath (_context.LocalStorage, Source)); } else { String imgPath = stylesheet.GetHelper<StyleHelper> ().BackgroundImage (this); if (imgPath != null) _backgroungImageCache = UIImage.LoadFromData (MonoTouch.Foundation.NSData.FromStream (_context.DAL.GetImageByName (imgPath))); } } return _backgroungImageCache != null; }
public static Bound Screen(StyleSheet.StyleSheet stylesheet , ILayoutable parent , ILayoutable control , Bound screenBound) { IStyleSheetHelper style = stylesheet.Helper; float parentW = screenBound.Width; float parentH = screenBound.Height; float paddingL = style.Padding <PaddingLeft>(parent, parentW); float paddingT = style.Padding <PaddingTop>(parent, parentH); float paddingR = style.Padding <PaddingRight>(parent, parentW); float paddingB = style.Padding <PaddingBottom>(parent, parentH); float borderWidth = style.BorderWidth(parent); float w = style.Width(control, parentW); float h = style.Height(control, parentH); float marginL = style.Margin <MarginLeft>(control, parentW); float marginT = style.Margin <MarginTop>(control, parentH); float marginR = style.Margin <MarginRight>(control, parentW); float marginB = style.Margin <MarginBottom>(control, parentH); InitializeImageContainer(stylesheet, control, ref w, ref h); float maxW = parentW - (marginL + marginR) - (paddingL + paddingR) - 2 * borderWidth; if (parentW < paddingL + marginL + w + marginR + paddingR + 2 * borderWidth) { w = maxW; } float maxH = parentH - (marginT + marginB) - (paddingT + paddingB) - 2 * borderWidth; if (parentH < paddingT + marginT + h + marginB + paddingB + 2 * borderWidth) { h = maxH; } float l = borderWidth + paddingL + marginL; float t = borderWidth + paddingT + marginT; Bound bound = control.Apply(stylesheet, new Bound(w, h), new Bound(maxW, maxH)); w = bound.Width > maxW ? maxW : bound.Width; h = bound.Height > maxH ? maxH : bound.Height; control.Frame = new Rectangle(l, t, w, h); return(screenBound); }
protected override Bound LayoutChildren(StyleSheet.StyleSheet stylesheet, Bound styleBound, Bound maxBound) { Bound bound = LayoutBehaviour.Vertical(stylesheet, this, Childrens, styleBound, maxBound, true); if (Childrens.Count > 0) { Behavour.Borders.Add(Childrens[0].Frame.Top); foreach (IControl <View> control in Childrens) { Behavour.Borders.Add(control.Frame.Bottom); } } Behavour.ScrolledMeasure = bound.Height; return(bound); }
bool InitBackgroundImage(StyleSheet.StyleSheet stylesheet) { if (_backgroundImageCache == null) { String imgPath = stylesheet.GetHelper <StyleHelper> ().BackgroundImage(this); if (imgPath != null) { Stream imgStream = _applicationContext.DAL.GetImageByName(imgPath); if (imgStream != null) { _backgroundImageCache = UIImage.LoadFromData(MonoTouch.Foundation.NSData.FromStream(imgStream)); } } } return(_backgroundImageCache != null); }
protected override Bound LayoutChildren(StyleSheet.StyleSheet stylesheet, Bound styleBound, Bound maxBound) { _behaviour.ScrolledMeasure = styleBound.Width; Bound bound = LayoutBehaviour.Horizontal(stylesheet, this, _controls, styleBound, maxBound, true); if (_controls.Count > 0) { _behaviour.Borders.Add(_controls [0].Frame.Left); foreach (var control in _controls) { _behaviour.Borders.Add(control.Frame.Right); } } return(bound); }
public override Bound Apply(StyleSheet.StyleSheet stylesheet, Bound styleBound, Bound maxBound) { base.Apply(stylesheet, styleBound, maxBound); var style = stylesheet.GetHelper <StyleHelper>(); // background image if (Source == null) { var background = style.Background(this, _applicationContext); _view.SetBackgroundDrawable(background); } //selected color _selectedColor = style.Color <SelectedColor>(this); return(styleBound); }
public override Bound Apply(StyleSheet.StyleSheet stylesheet, Bound styleBound, Bound maxBound) { var bound = new Bound(BitBrowserApp.Current.Width, BitBrowserApp.Current.Height); base.Apply(stylesheet, bound, bound); //background color _view.SetBackgroundColor(Android.Graphics.Color.White); if (OnLoad != null) { OnLoad.Execute(); } Frame = new Rectangle(0, 0, bound); return(bound); }
public override Bound Apply(StyleSheet.StyleSheet stylesheet, Bound styleBound, Bound maxBound) { base.Apply(stylesheet, styleBound, maxBound); StyleHelper style = stylesheet.GetHelper <StyleHelper> (); // background color, background image, borders if (!InitBackgroundImage(stylesheet)) { style.SetBackgroundSettings(this); } _backgroundColor = _view.BackgroundColor; // selected-color _selectedColor = style.Color <SelectedColor> (this); return(LayoutChildren(stylesheet, styleBound, maxBound)); }
public override Bound Apply(StyleSheet.StyleSheet stylesheet, Bound styleBound, Bound maxBound) { base.Apply(stylesheet, styleBound, maxBound); StyleHelper style = stylesheet.GetHelper <StyleHelper> (); // background color, background image, borders if (!InitBackgroundImage(stylesheet)) { style.SetBackgroundSettings(this); } Bound bound = LayoutChildren(stylesheet, styleBound, maxBound); _view.ContentSize = new SizeF(bound.ContentWidth, bound.ContentHeight); return(styleBound); }
public override Bound Apply (StyleSheet.StyleSheet stylesheet, Bound styleBound, Bound maxBound) { base.Apply (stylesheet, styleBound, maxBound); StyleHelper style = stylesheet.GetHelper<StyleHelper> (); // background image if (InitImage (stylesheet)) { _view.Image = _backgroungImageCache; // selected-color var selectedColor = style.Color<SelectedColor> (this); if (selectedColor != null) _selectedImage = GetFilteredImage (_backgroungImageCache, selectedColor); } return styleBound; }
public bool InitializeImage(BitMobile.Controls.StyleSheet.StyleSheet stylesheet) { String imgPath = stylesheet.GetHelper <StyleHelper> ().BackgroundImage(this); if (imgPath != null) { System.IO.Stream imgStream = _applicationContext.DAL.GetImageByName(imgPath); if (imgStream != null) { _backgroundImageCache = UIImage.LoadFromData(MonoTouch.Foundation.NSData.FromStream(imgStream)); ImageWidth = (int)_backgroundImageCache.Size.Width; ImageHeight = (int)_backgroundImageCache.Size.Height; return(true); } } return(false); }
public static void InitializeImageContainer(StyleSheet.StyleSheet stylesheet , ILayoutable control , ref float w , ref float h) { var container = control as IImageContainer; if (container != null && container.InitializeImage(stylesheet)) { float proportion = ((float)container.ImageWidth) / container.ImageHeight; if (w == 0 && h != 0) { w = (int)Math.Round(h * proportion); } else if (h == 0 && w != 0) { h = (int)Math.Round(w / proportion); } } }
public override Bound Apply(StyleSheet.StyleSheet stylesheet, Bound styleBound, Bound maxBound) { base.Apply(stylesheet, styleBound, maxBound); var style = stylesheet.GetHelper <StyleHelper>(); // background color, background image, borders var background = style.Background(this, _applicationContext); _view.SetBackgroundDrawable(background); // selected color Android.Graphics.Color?selectedColor = style.Color <SelectedColor>(this); if (selectedColor != null) { _selectedBackground = style.ColorWithBorders(this, selectedColor.Value); } return(LayoutChildren(stylesheet, styleBound, maxBound)); }
public override Bound Apply(StyleSheet.StyleSheet stylesheet, Bound styleBound, Bound maxBound) { base.Apply(stylesheet, styleBound, maxBound); StyleHelper style = stylesheet.GetHelper <StyleHelper> (); // background color, background image, borders if (InitBackgroundImage(stylesheet)) { _view.SetBackgroundImage(_backgroundImageCache, UIControlState.Normal); } else { style.SetBackgroundSettings(this); } // font UIFont f = style.Font(this, styleBound.Height); if (f != null) { _view.Font = f; } // text color _textColor = style.ColorOrClear <Color> (this); _view.SetTitleColor(_textColor, UIControlState.Normal); // selected-color var selectedColor = style.Color <SelectedColor> (this); if (selectedColor != null) { _view.SetTitleColor(selectedColor, UIControlState.Highlighted); } _view.SetTitle(_text, UIControlState.Normal); return(styleBound); }
public override Bound Apply(StyleSheet.StyleSheet stylesheet, Bound styleBound, Bound maxBound) { base.Apply(stylesheet, styleBound, maxBound); var style = stylesheet.GetHelper <StyleHelper>(); // background color, background image, borders var background = style.Background(this, _applicationContext); _view.SetBackgroundDrawable(background); // font style.SetFontSettings(this, _view, styleBound.Height); // text color _textColor = style.ColorOrTransparent <Color>(this); _view.SetTextColor(_textColor); //selected color _selectedColor = style.Color <SelectedColor>(this); return(styleBound); }
public bool InitializeImage(StyleSheet.StyleSheet stylesheet) { bool result = false; if (Source != null) { string path = FileSystemProvider.TranslatePath(_applicationContext.LocalStorage, Source); var img = (BitmapDrawable)Drawable.CreateFromPath(path); if (img != null) { View.SetBackgroundDrawable(img); ImageWidth = img.Bitmap.Width; ImageHeight = img.Bitmap.Height; result = true; } } else { result = stylesheet.GetHelper <StyleHelper>().InitializeImageContainer(this, _applicationContext); } return(result); }
protected override Bound LayoutChildren(StyleSheet.StyleSheet stylesheet, Bound styleBound, Bound maxBound) { return(LayoutBehaviour.Vertical(stylesheet, this, Childrens, styleBound, maxBound)); }