LongoMatch.Gui.Component.StringTaggerWidget.AddTagWidget C# (CSharp) Method

AddTagWidget() private method

private AddTagWidget ( StringTag tag, bool radio ) : void
tag StringTag
radio bool
return void
        private void AddTagWidget(StringTag tag, bool radio)
        {
            CheckButton button;
            uint row, col;

            if (radio) {
                if (firstRB == null)
                    button = firstRB = new RadioButton (tag.Value);
                else
                    button = new RadioButton(firstRB, tag.Value);
            } else {
                button = new CheckButton(tag.Value);
            }
            button.WidthRequest = 120;

            button.Toggled += delegate(object sender, EventArgs e) {
                if (button.Active) {
                    if (!tags.Contains(tag))
                        tags.Add(tag);
                } else
                    tags.Remove(tag);
            };
            dict.Add(tag, button);
            row = count % BUTTONS_PER_ROW;
            col = count / BUTTONS_PER_ROW;
            table.Attach (button, row, row+1, col, col+1);
            button.ShowAll();
            count ++;
        }