Пример #1
0
        public override Xwt.MenuItem Makeup(IXwtWrapper Parent)
        {
            Xwt.CheckBoxMenuItem Target = new Xwt.CheckBoxMenuItem() {
                Label = Text,
                Sensitive = this.Sensitive,
                Visible = this.Visible,
                UseMnemonic = this.UseMnemonic,
                Checked = this.Checked
            };

            Target.Clicked += (o, e) =>
            {

            };

            WindowController.TryAttachEvent(Target, "Clicked", Parent, Activated);

            if (Subitems != null && Subitems.Count() > 0)
            {
                Target.SubMenu = new Xwt.Menu();
                foreach (var Subitem in Subitems)
                    Target.SubMenu.Items.Add(Subitem.Makeup(Parent));
            }

            RegisterItem(Parent, Target);

            return Target;
        }
Пример #2
0
        public void ChCp(object sender, EventArgs e) //change codepage
        {
            //BUG: the f*cking runtime substitutes selected by user menuitem with "unicode". wtf?
            Xwt.CheckBoxMenuItem SelItem = (Xwt.CheckBoxMenuItem)sender;
            Content     = Encoding.GetEncoding(Convert.ToInt32(SelItem.Tag)).GetString(FS.GetFile(URL, new int()).Content);
            txtBox.Text = Content;
#if DEBUG
            Console.WriteLine("Codepage debug: CP" + SelItem.Tag.ToString() + "=" + Encoding.GetEncoding(Convert.ToInt32(SelItem.Tag)).EncodingName + " (wanted:" + SelItem.Label + ")");
#endif
            foreach (Xwt.MenuItem CurItem in SettingsMenu)
            {
                if (CurItem.GetType() == new Xwt.CheckBoxMenuItem().GetType())//if the menuitem is checkbox
                {
                    Xwt.CheckBoxMenuItem SelItem2 = (Xwt.CheckBoxMenuItem)SelItem;
                    if (Convert.ToInt32(SelItem.Tag) == Convert.ToInt32(CurItem.Tag))
                    {//this is that!
                        SelItem2.Checked = true;
                    }
                    else
                    {//no, removing possibly mark
                        SelItem2.Checked = false;
                    }
                }
            }
        }