/// <summary> /// Handles ButtonPress event /// </summary> /// <param name="evnt"> /// Arguments <see cref="Gdk.EventButton"/> /// </param> /// <returns> /// true if handled, false if not <see cref="System.Boolean"/> /// </returns> protected override bool OnButtonPressEvent(Gdk.EventButton evnt) { if (CanFocus == true) { if (HasFocus == false) { GrabFocus(); return(true); } } if (Editable == false) { return(base.OnButtonPressEvent(evnt)); } IDrawingCell cell = mainbox.CellAtCoordinates(System.Convert.ToInt32(evnt.X), System.Convert.ToInt32(evnt.Y)); if (cell == null) { return(base.OnButtonPressEvent(evnt)); } if (TypeValidator.IsCompatible(cell.GetType(), typeof(TimeText)) == true) { if ((int)(cell as TimeText).Part < 4) { Selected = (cell as TimeText).Part; return(true); } } return(base.OnButtonPressEvent(evnt)); }
public static IActivatable GetActivatableCell(this IDrawingCell aCell) { if (TypeValidator.IsCompatible(aCell.GetType(), typeof(IActivatable)) == true) { return(aCell as IActivatable); } if (aCell.Owner == null) { return(null); } if (TypeValidator.IsCompatible(aCell.Owner.GetType(), typeof(IDrawingCell)) == true) { return((aCell.Owner as IDrawingCell).GetActivatableCell()); } return(null); }
/// <summary> /// Packs cell into container /// </summary> /// <param name="aCell"> /// Cell <see cref="IDrawingCell"/> /// </param> /// <remarks> /// if cell already exists, exception is thrown /// </remarks> public virtual void Pack(IDrawingCell aCell) { if (aCell == null) { return; } if (Count > 0) { throw new NotSupportedException("Pack method only supports one cell"); } PackStart(aCell, true); if (TypeValidator.IsCompatible(aCell.GetType(), typeof(DrawingCellContent)) == true) { (aCell as DrawingCellContent).XPos = 0.5; (aCell as DrawingCellContent).YPos = 0.5; } }
public static StateType ResolveState(this IDrawingCell aCell) { if (aCell.MasterIsSensitive() == false) { return(StateType.Insensitive); } if (TypeValidator.IsCompatible(aCell.GetType(), typeof(IGtkState)) == true) { return((aCell as IGtkState).State); } if (TypeValidator.IsCompatible(aCell.Owner.GetType(), typeof(IDrawingCell)) == true) { return((aCell.Owner as IDrawingCell).ResolveState()); } if (TypeValidator.IsCompatible(aCell.Owner.GetType(), typeof(Gtk.Widget)) == true) { return((aCell.Owner as Gtk.Widget).State); } return(StateType.Normal); }
public static void SetGtkState(this IDrawingCell aCell, StateType aState) { if (TypeValidator.IsCompatible(aCell.GetType(), typeof(ICustomGtkState)) == true) { if ((aCell as ICustomGtkState).StateResolving == ValueResolveMethod.Manual) { (aCell as ICustomGtkState).CustomState = aState; } else { return; } return; } if (aCell.Owner != null) { if (TypeValidator.IsCompatible(aCell.Owner.GetType(), typeof(IDrawingCell)) == true) { (aCell.Owner as IDrawingCell).SetGtkState(aState); } } }
/// <summary> /// Packs cell into container /// </summary> /// <param name="aCell"> /// Cell <see cref="IDrawingCell"/> /// </param> /// <remarks> /// if cell already exists, exception is thrown /// </remarks> public virtual void Pack (IDrawingCell aCell) { if (aCell == null) return; if (Count > 0) throw new NotSupportedException ("Pack method only supports one cell"); PackStart (aCell, true); if (TypeValidator.IsCompatible(aCell.GetType(), typeof(DrawingCellContent)) == true) { (aCell as DrawingCellContent).XPos = 0.5; (aCell as DrawingCellContent).YPos = 0.5; } }