示例#1
0
文件: Main.cs 项目: sazae657/Motitter
        /// <summary>
        /// メニュー生成
        /// </summary>
        /// <returns></returns>
        IWidget CreateMenu()
        {
            TonNurako.Widgets.Xm.MenuBar smbar;
            smbar = new TonNurako.Widgets.Xm.MenuBar();
            this.Layout.Children.Add(smbar);

            // PDM
            var pdm = new TonNurako.Widgets.Xm.PulldownMenu();

            pdm.Name = "PDM";
            smbar.Children.Add(pdm);

            var cb1 = new TonNurako.Widgets.Xm.CascadeButton();

            cb1.Name        = "CB";
            cb1.LabelString = "メニュー(M)";
            cb1.Mnemonic    = TonNurako.Data.KeySym.FromName("M");
            cb1.SubMenuId   = pdm;
            smbar.Children.Add(cb1);

            pdm.Children.Add(
                ((Func <PushButtonGadget>)(() => {
                var t = new PushButtonGadget();
                t.LabelString = "終了";
                t.ActivateEvent += (X, Y) => {
                    this.Destroy();
                };
                return(t);
            }))());

            // help
            var helpm = new TonNurako.Widgets.Xm.PulldownMenu();

            helpm.Name = "HELP";
            smbar.Children.Add(helpm);

            var helpb = new TonNurako.Widgets.Xm.CascadeButtonGadget();

            helpb.LabelString = "ヘルプ(H)";
            helpb.Mnemonic    = TonNurako.Data.KeySym.FromName("H");
            helpb.SubMenuId   = helpm;
            smbar.Children.Add(helpb);
            helpm.Children.Add(
                ((Func <PushButtonGadget>)(() => {
                var t = new PushButtonGadget();
                t.LabelString = "これについて";
                t.ActivateEvent += (X, Y) => {
                    var d = new InformationDialog();
                    d.WidgetCreatedEvent += (x, y) => {
                        d.Items.Cancel.Visible = false;
                        d.Items.Help.Visible = false;
                    };
                    d.WidgetManagedEvent += (x, y) => {
                        d.SymbolPixmap = TonNurako.GC.Pixmap.FromBuffer(this, Properties.Resources.icon_xpm);
                    };
                    d.DialogTitle = "トンヌラコ";
                    d.DialogStyle = DialogStyle.ApplicationModal;
                    d.MessageString = "トンヌラコ";
                    d.OkLabelString = "わかった";

                    this.Layout.Children.Add(d);
                    d.Visible = true;
                };
                return(t);
            }))());
            smbar.MenuHelpWidget = helpb;
            return(smbar);
        }
示例#2
0
文件: Main.cs 项目: sazae657/Motitter
        public override void ShellCreated()
        {
            timelineChildren = new List <IChild>();

            this.Title          = "もちったー";
            this.Layout.MenuBar = CreateMenu();

            var frame = new Form();

            frame.Width  = 320;
            frame.Height = 480;
            this.Layout.Children.Add(frame);

            var command = new Form();

            frame.Children.Add(command);
            var imp = new Text();

            imp.MaxLength    = 60;
            imp.Rows         = 2;
            imp.Width        = 220;
            imp.EditMode     = EditMode.Multi;
            imp.WordWrap     = true;
            imp.ResizeHeight = true;
            command.Children.Add(imp);

            // チートボタン
            var btn = new PushButtonGadget();

            btn.LeftAttachment  = AttachmentType.Widget;
            btn.RightAttachment = AttachmentType.Form;
            btn.LeftWidget      = imp;
            btn.LabelString     = "チート";
            btn.ActivateEvent  += (x, y) => {
                var    msg     = imp.Value;
                Status _status = this.Tokens.Statuses.Update(status => msg);
                imp.Value = "";
            };
            command.Children.Add(btn);


            scrollWindow = new ScrolledWindow();
            scrollWindow.TopAttachment = AttachmentType.Widget;
            scrollWindow.TopWidget     = command;

            scrollWindow.RightAttachment          =
                scrollWindow.LeftAttachment       =
                    scrollWindow.BottomAttachment = AttachmentType.Form;
            scrollWindow.ScrollingPolicy          = ScrollingPolicy.Automatic;
            scrollWindow.ScrolledWindowChildType  = ScrolledWindowChildType.WorkArea;
            frame.Children.Add(scrollWindow);

            timelineView = new RowColumn();
            timelineView.LeftAttachment  = AttachmentType.Form;
            timelineView.RightAttachment = AttachmentType.Form;
            timelineView.Resizable       = true;
            scrollWindow.Children.Add(timelineView);


            // ここは自分で入れてね
            Tokens = CoreTweet.Tokens.Create(
                "<ConsumerKey>", "<ConsumerSecret>", "<AccessToken>", "<AccessSecret>");

            this.RealizedEvent += (x, y) => {
                LoadTimeLine();
                this.IconPixmap = TonNurako.GC.Pixmap.FromBuffer(this, Motitter.Properties.Resources.icon_xpm);
            };
        }