コード例 #1
0
        static public new string Describe(object x)
        {
            if (x == null)
            {
                return("object is null");
            }

            Type t = x as Type;

            if (t == null)
            {
                t = x.GetType();
            }

            main_window.Describe(t);
            return("Described on separate page");
        }
コード例 #2
0
        string GetTypeTag(Type t)
        {
            if (typetags.ContainsKey(t))
            {
                return(typetags [t].Name);
            }

            TextTag typetag = new TextTag("t" + (typec++))
            {
                Foreground = "blue",
                Weight     = Pango.Weight.Bold
            };

            typetag.TextEvent += delegate(object o, TextEventArgs e){
                EventButton eb = e.Event as EventButton;

                if (eb != null && eb.Button == 1)
                {
                    if (eb.Type == EventType.ButtonPress)
                    {
                        press_x = eb.X;
                        press_y = eb.Y;
                    }
                    else if (eb.Type == EventType.ButtonRelease)
                    {
                        if (press_x != -1)
                        {
                            int dx = System.Math.Abs((int)(eb.X - press_x));
                            int dy = System.Math.Abs((int)(eb.Y - press_y));

                            if (dx < 8 && dy < 8)
                            {
                                container.Describe(t);
                            }
                        }
                        press_x = -1;
                    }
                }
            };

            Buffer.TagTable.Add(typetag);

            return(typetag.Name);
        }