/// <summary>Constructor.</summary> /// <param name="model">The logical model of the button</param> /// <param name="container">The HTML container of the button.</param> protected ButtonView(IButton model, jQueryObject container) : base(InitContainer(container)) { // Setup initial conditions. if (Script.IsNullOrUndefined(model)) model = new ButtonBase(); this.model = model; Focus.BrowserHighlighting = false; // Setup CSS. Css.InsertLink(Css.Urls.CoreButtons); Container.AddClass(ClassButton); Container.AddClass(Css.Classes.NoSelect); // Insert the content and mask containers. divContent = CreateContainer("buttonContent"); // Create child controllers. eventController = new ButtonEventController(this); contentController = new ButtonContentController(this, divContent); // Wire up events. Model.LayoutInvalidated += OnLayoutInvalidated; Helper.ListenPropertyChanged(Model, OnModelPropertyChanged); eventController.PropertyChanged += OnEventControllerPropertyChanged; GotFocus += delegate { UpdateLayout(); }; LostFocus += delegate { UpdateLayout(); }; IsEnabledChanged += delegate { UpdateLayout(); }; Container.Keydown(delegate(jQueryEvent e) { OnKeyPress(Int32.Parse(e.Which)); }); // Finish up. SyncCanFocus(); }
/// <summary>Constructor.</summary> /// <param name="model">The logical model of the button</param> /// <param name="container">The HTML container of the button.</param> public LayeredButtonView(IButton model, jQueryObject container) : base(model, container, Html.CreateDiv()) { // Setup initial conditions. clickMask.AddClass(Css.Classes.AbsoluteFill); // Insert containers. divContent = CreateAndAppendContainer("buttonContent"); clickMask.AppendTo(Container); // Create controllers contentController = new ButtonContentController(this, divContent); }
public ButtonContentLayer(ButtonContentController parent, int layer) { Parent = parent; Layer = layer; }