コード例 #1
0
        /// ------------------------------------------------------------------------------------
        public CharPicker CreateNewPickerRow()
        {
            var pickerRow = new CharPicker
            {
                LayoutStyle       = ToolStripLayoutStyle.HorizontalStackWithOverflow,
                CheckItemsOnClick = false,
                AutoSize          = true,
                AutoSizeItems     = true,
                ShowItemToolTips  = false,
                Dock = DockStyle.Top
            };

            pickerRow.ItemDrag += delegate(object sender, ItemDragEventArgs e)
            {
                if (ItemDrag != null)
                {
                    ItemDrag(this, e);
                }
            };

            pickerRow.ItemClicked += delegate(object sender, ToolStripItemClickedEventArgs e)
            {
                if (ItemClicked != null)
                {
                    ItemClicked(this, e);
                }
            };

            return(pickerRow);
        }
コード例 #2
0
        /// ------------------------------------------------------------------------------------
        public virtual void Load(string heading, IEnumerable <IPASymbol> symbolsToLoad)
        {
            if (App.DesignMode)
            {
                return;
            }

            Utils.SetWindowRedraw(this, false, false);

            _pickers.Clear();

            var picker = new CharPicker();

            picker.Name        = heading;
            picker.CharPicked += HandleCharPicked;
            picker.ItemDrag   += HandleCharacterItemDrag;
            picker.LoadCharacters(symbolsToLoad);
            picker.CheckItemsOnClick = true;
            picker.AutoSizeItems     = true;
            _pickers.Add(picker);

            var item = Add(picker);

            item.Button.Text = heading;

            //	App.RegisterForLocalization(item.Button, "CommonControls.CharacterPicker.ConsonantHeading", "Consonant");


            Dock = DockStyle.Fill;
            LayoutPickers(false);
            Utils.SetWindowRedraw(this, true, true);
        }
コード例 #3
0
 /// ------------------------------------------------------------------------------------
 protected virtual void HandleCharPicked(CharPicker picker, ToolStripButton item)
 {
     if (CharPicked != null)
     {
         CharPicked(picker, item);
     }
 }
コード例 #4
0
        /// ------------------------------------------------------------------------------------
        private void SetPickersCheckStateBasedOnItsCheckedItems(CharPicker picker)
        {
            var symbolTypeHeading = picker.Parent as ExplorerBarItem;

            if (symbolTypeHeading != null)
            {
                symbolTypeHeading.CheckedBoxState = picker.GetRelevantCheckState();
            }
        }
コード例 #5
0
        /// ------------------------------------------------------------------------------------
        private void HandleCharChecked(CharPicker picker, ToolStripButton item)
        {
            var chk = picker.Tag as CheckBox;

            if (chk != null)
            {
                chk.CheckState = picker.GetRelevantCheckState();
            }
        }
コード例 #6
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Gets a string containing all the characters of the checked buttons in the
        /// specified chooser.
        /// </summary>
        /// ------------------------------------------------------------------------------------
        private static string GetIgnoredChars(CharPicker picker)
        {
            var ignoreList = new StringBuilder();

            foreach (var item in picker.Items.Cast <ToolStripButton>().Where(item => item.Checked))
            {
                ignoreList.AppendFormat("{0},", item.Text.Replace(App.DottedCircle, string.Empty));
            }

            return(ignoreList.Length == 0 ? string.Empty : ignoreList.ToString());
        }
コード例 #7
0
        /// ------------------------------------------------------------------------------------
        private static void SetIgnoredChars(CheckBox chk, CharPicker picker, IEnumerable <string> ignoredCharacters)
        {
            var ignoreList = ignoredCharacters.ToList();

            foreach (var item in picker.GetItems())
            {
                // Remove the dotted circle (if there is one) from the button's text, then
                // check the button's text to see if it's found in the ignore list.
                var chr = item.Text.Replace(App.DottedCircle, string.Empty);
                item.Checked = (ignoreList.Contains(chr));
                item.Tag     = item.Checked;
            }

            chk.CheckState = picker.GetRelevantCheckState();
        }
コード例 #8
0
        /// ------------------------------------------------------------------------------------
        private void LoadPhones()
        {
            SuspendLayout();
            PhoneInfo  prevPhoneInfo = null;
            CharPicker currRow       = null;

            foreach (var phoneInfo in _phonesToLoadProvider())
            {
                if (prevPhoneInfo == null || prevPhoneInfo.RowGroup != phoneInfo.RowGroup)
                {
                    Controls.Add((currRow = CreateNewPickerRow()));
                    currRow.BringToFront();
                }

                currRow.Items.Add(phoneInfo.Phone);
                prevPhoneInfo = phoneInfo;
            }

            ResumeLayout(false);
        }
コード例 #9
0
        /// ------------------------------------------------------------------------------------
        private CharPicker CreatePicker(int typeInfo, string name, bool makeBigFont)
        {
            var picker = new CharPicker();

            picker.Name        = name;
            picker.CharPicked += HandleCharPicked;
            picker.ItemDrag   += HandleCharacterItemDrag;
            picker.LoadCharacterType(typeInfo, ShouldLoadCharacterDelegate);
            picker.CheckItemsOnClick = false;
            picker.AutoSizeItems     = true;

            if (makeBigFont)
            {
                picker.Font     = FontHelper.MakeFont(picker.Font, kBigFontSize);
                picker.ItemSize = new Size(40, 46);
            }

            var item = Add(picker);

            LocalizePickerButton(typeInfo, item.Button);

            return(picker);
        }