示例#1
0
        public override NSTableCellView GetCell(Cell item, NSTableCellView reusableCell, NSTableView tv)
        {
            EntryCell entryCell = (EntryCell)item;

            EntryCellRenderer.EntryCellTableViewCell cell = reusableCell as EntryCellRenderer.EntryCellTableViewCell;
            if (cell == null)
            {
                cell = new EntryCellRenderer.EntryCellTableViewCell((item).GetType().FullName);
            }
            else
            {
                cell.Cell.PropertyChanged      -= OnCellPropertyChanged;
                cell.TextFieldTextChanged      -= new EventHandler(EntryCellRenderer.OnTextFieldTextChanged);
                cell.KeyboardDoneButtonPressed -= new EventHandler(EntryCellRenderer.OnKeyBoardDoneButtonPressed);
            }
            CellRenderer.SetRealCell((BindableObject)item, (NSTableCellView)cell);
            cell.Cell = item;
            cell.Cell.PropertyChanged      += OnCellPropertyChanged;
            cell.TextFieldTextChanged      += new EventHandler(EntryCellRenderer.OnTextFieldTextChanged);
            cell.KeyboardDoneButtonPressed += new EventHandler(EntryCellRenderer.OnKeyBoardDoneButtonPressed);
            this.UpdateBackground((NSTableCellView)cell, (Cell)entryCell);
            EntryCellRenderer.UpdateLabel(cell, entryCell);
            EntryCellRenderer.UpdateText(cell, entryCell);
            //EntryCellRenderer.UpdateKeyboard (cell, entryCell);
            EntryCellRenderer.UpdatePlaceholder(cell, entryCell);
            EntryCellRenderer.UpdateLabelColor(cell, entryCell);
            EntryCellRenderer.UpdateHorizontalTextAlignment(cell, entryCell);
            EntryCellRenderer.UpdateIsEnabled(cell, entryCell);
            return((NSTableCellView)cell);
        }
示例#2
0
 private static void UpdateText(EntryCellRenderer.EntryCellTableViewCell cell, EntryCell entryCell)
 {
     if (cell.TextField.StringValue == entryCell.Text)
     {
         return;
     }
     cell.TextField.StringValue = entryCell.Text;
 }
示例#3
0
        private static void OnCellPropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            EntryCell entryCell = (EntryCell)sender;

            EntryCellRenderer.EntryCellTableViewCell cell = (EntryCellRenderer.EntryCellTableViewCell)CellRenderer.GetRealCell((BindableObject)entryCell);
            if (e.PropertyName == EntryCell.LabelProperty.PropertyName)
            {
                EntryCellRenderer.UpdateLabel(cell, entryCell);
            }
            else if (e.PropertyName == EntryCell.TextProperty.PropertyName)
            {
                EntryCellRenderer.UpdateText(cell, entryCell);
            }
            else if (e.PropertyName == EntryCell.PlaceholderProperty.PropertyName)
            {
                EntryCellRenderer.UpdatePlaceholder(cell, entryCell);
            }
            //else if (e.PropertyName == EntryCell.KeyboardProperty.PropertyName)
            //	EntryCellRenderer.UpdateKeyboard (cell, entryCell);
            else if (e.PropertyName == EntryCell.LabelColorProperty.PropertyName)
            {
                EntryCellRenderer.UpdateLabelColor(cell, entryCell);
            }
            else if (e.PropertyName == EntryCell.HorizontalTextAlignmentProperty.PropertyName)
            {
                EntryCellRenderer.UpdateHorizontalTextAlignment(cell, entryCell);
            }
            else
            {
                if (!(e.PropertyName == Cell.IsEnabledProperty.PropertyName))
                {
                    return;
                }
                EntryCellRenderer.UpdateIsEnabled(cell, entryCell);
            }
        }
示例#4
0
 private static void UpdateIsEnabled(EntryCellRenderer.EntryCellTableViewCell cell, EntryCell entryCell)
 {
     //cell.UserInteractionEnabled = entryCell.IsEnabled;
     //cell.DetailTextLabel.Enabled = entryCell.IsEnabled;
     cell.TextField.Enabled = entryCell.IsEnabled;
 }
示例#5
0
 private static void UpdatePlaceholder(EntryCellRenderer.EntryCellTableViewCell cell, EntryCell entryCell)
 {
     cell.TextField.PlaceholderString = entryCell.Placeholder;
 }
示例#6
0
        // Not for Mac

        /*
         * private static void UpdateKeyboard (EntryCellRenderer.EntryCellTableViewCell cell, EntryCell entryCell)
         * {
         *      Extensions.ApplyKeyboard ((IUITextInput)cell.TextField, entryCell.Keyboard);
         * }
         */

        private static void UpdateLabelColor(EntryCellRenderer.EntryCellTableViewCell cell, EntryCell entryCell)
        {
            cell.TextField.TextColor = ColorExtensions.ToUIColor(entryCell.LabelColor, EntryCellRenderer.DefaultTextColor);
        }
示例#7
0
 private static void UpdateLabel(EntryCellRenderer.EntryCellTableViewCell cell, EntryCell entryCell)
 {
     cell.TextField.StringValue = entryCell.Label;
 }
示例#8
0
 private static void UpdateHorizontalTextAlignment(EntryCellRenderer.EntryCellTableViewCell cell, EntryCell entryCell)
 {
     cell.TextField.Alignment = AlignmentExtensions.ToNativeTextAlignment(entryCell.HorizontalTextAlignment);
 }
示例#9
0
 private static void OnTextFieldTextChanged(object sender, EventArgs eventArgs)
 {
     EntryCellRenderer.EntryCellTableViewCell cellTableViewCell = (EntryCellRenderer.EntryCellTableViewCell)sender;
     ((EntryCell)cellTableViewCell.Cell).Text = cellTableViewCell.TextField.StringValue;
 }