コード例 #1
0
        private void CreateWindow(string query)
        {
            Title = Best.DefaultWindowTitle;

            DeleteEvent += new DeleteEventHandler(this.DoDelete);
            MapEvent    += new MapEventHandler(MapIt);
            UnmapEvent  += new UnmapEventHandler(UnmapIt);

            Icon = Images.GetPixbuf("best.png");

            Widget content = CreateContents();

            VBox main = new VBox(false, 3);

            main.PackStart(content, true, true, 3);
            content.Show();
            Add(main);
            main.Show();
            main.Realize();
            canvas.Realize();

            root        = new SimpleRootTile();
            canvas.Root = root;

            DefaultWidth  = 600;
            DefaultHeight = 675;

            accel_group = new Gtk.AccelGroup();
            this.AddAccelGroup(accel_group);
            global_keys = new GlobalKeybinder(accel_group);

            // Close window (Ctrl-W)
            global_keys.AddAccelerator(new EventHandler(this.HideWindowHandler),
                                       (uint)Gdk.Key.w,
                                       Gdk.ModifierType.ControlMask,
                                       Gtk.AccelFlags.Visible);

            // Close window (Escape)
            global_keys.AddAccelerator(new EventHandler(this.HideWindowHandler),
                                       (uint)Gdk.Key.Escape,
                                       0,
                                       Gtk.AccelFlags.Visible);

            // Show source (Ctrl+U)
            global_keys.AddAccelerator(new EventHandler(this.ShowSource),
                                       (uint)Gdk.Key.U,
                                       Gdk.ModifierType.ControlMask,
                                       Gtk.AccelFlags.Visible);

            // Focus Entry (Ctrl+L)
            global_keys.AddAccelerator(new EventHandler(this.FocusEntryHandler),
                                       (uint)Gdk.Key.L,
                                       Gdk.ModifierType.ControlMask,
                                       Gtk.AccelFlags.Visible);

            // Previous Page (PageUp)
            global_keys.AddAccelerator(new EventHandler(this.PageBackHandler),
                                       (uint)Gdk.Key.Page_Up,
                                       0,
                                       Gtk.AccelFlags.Visible);

            // Next Page (PageDown)
            global_keys.AddAccelerator(new EventHandler(this.PageForwardHandler),
                                       (uint)Gdk.Key.Page_Down,
                                       0,
                                       Gtk.AccelFlags.Visible);

            UpdateFromConf();
            UpdatePage();

            if (query != null)
            {
                Search(query);
            }
        }