コード例 #1
0
        public BestTray(BestWindow bw, bool autostarted)
        {
            this.autostarted = autostarted;

            Raw = egg_tray_icon_new("Search");

            win              = bw;
            win.DeleteEvent += new DeleteEventHandler(WindowDeleteEvent);

            eventbox                   = new Gtk.EventBox();
            eventbox.CanFocus          = true;
            eventbox.ButtonPressEvent += new ButtonPressEventHandler(ButtonPress);

            Gdk.Pixbuf smalldog = Images.GetPixbuf("best.png");
            eventbox.Add(new Gtk.Image(smalldog.ScaleSimple(24, 24, Gdk.InterpType.Hyper)));

            KeyBinding binding = Conf.Searching.ShowSearchWindowBinding;

            string tooltip = String.Format("Beagle Search ({0})", binding.ToReadableString());

            tips = new Gtk.Tooltips();
            tips.SetTip(eventbox, tooltip, null);
            tips.Enable();

            Add(eventbox);
            eventbox.ShowAll();

            keybinder = new Beagle.Util.XKeybinder();
            keybinder.Bind(binding.ToString(),
                           new EventHandler(ShowBeaglePressed));
        }
コード例 #2
0
ファイル: PlotView.cs プロジェクト: oxyplot/oxyplot-gtksharp
        /// <summary>
        /// Shows the tracker.
        /// </summary>
        /// <param name="data">The data.</param>
        public void ShowTracker(TrackerHitResult data)
        {
            if (this.trackerLabel == null)
            {
                // Holding the tracker label inside an EventBox allows
                // us to set the background color
                Gtk.EventBox labelHolder = new Gtk.EventBox();
                this.trackerLabel = new Gtk.Label();
                this.trackerLabel.SetPadding(3, 3);
                OxyColor bgColor = OxyColors.LightSkyBlue;
                labelHolder.ModifyBg(StateType.Normal, new Gdk.Color(bgColor.R, bgColor.G, bgColor.B));
                labelHolder.Add(this.trackerLabel);
                this.Add(labelHolder);
                labelHolder.ShowAll();
            }
            this.trackerLabel.Parent.Visible = true;
            this.trackerLabel.Text           = data.ToString();
            Gtk.Requisition req  = this.trackerLabel.Parent.SizeRequest();
            int             xPos = (int)data.Position.X - req.Width / 2;
            int             yPos = (int)data.Position.Y - req.Height;

            xPos = Math.Max(0, Math.Min(xPos, this.Allocation.Width - req.Width));
            yPos = Math.Max(0, Math.Min(yPos, this.Allocation.Height - req.Height));
            this.Move(trackerLabel.Parent, xPos, yPos);
        }
コード例 #3
0
        private void HandleThumbnailIconViewButtonPressEvent(object sender, Gtk.ButtonPressEventArgs args)
        {
            int old_item = current_item;

            current_item = thumbnail_iconview.CellAtPosition((int)args.Event.X, (int)args.Event.Y, false);

            if (current_item < 0 || current_item >= items.Length)
            {
                current_item = old_item;
                return;
            }

            captions [old_item] = caption_textview.Buffer.Text;

            string caption = captions [current_item];

            if (caption == null)
            {
                captions [current_item] = caption = "";
            }
            caption_textview.Buffer.Text = caption;

            tag_treeview.Model = new TagStore(account.Facebook, tags [current_item], friends);

            IBrowsableItem item           = items [current_item];
            string         thumbnail_path = ThumbnailGenerator.ThumbnailPath(item.DefaultVersionUri);

            if (tag_image_eventbox.Children.Length > 0)
            {
                tag_image_eventbox.Remove(tag_image);
                tag_image.Destroy();
            }

            using (ImageFile image = new ImageFile(thumbnail_path)) {
                Gdk.Pixbuf data = image.Load();
                data             = PixbufUtils.ScaleToMaxSize(data, 400, 400);
                tag_image_height = data.Height;
                tag_image_width  = data.Width;
                tag_image        = new Gtk.Image(data);
                tag_image_eventbox.Add(tag_image);
                tag_image_eventbox.ShowAll();
            }
        }
コード例 #4
0
        public ColumnControl(VirtualListView view)
        {
            mView = view;
             GripperWidth = 8;

             this.HasWindow = false;
             this.ExposeEvent += new ExposeEventHandler(TheExposeEvent);

             // need an additional EventBox, because the underlaying Gtk.Fixed widget don't receive and handle some possible events
             // this is one more suspicious behaviour of GTK
             // as you can see, the mouse buttons will be received by the EventBox widget,
             // but the mouse motion received by Fixed widget enabled by the EventBox ...
             EventBox = new EventBox();
             EventBox.Events |= Gdk.EventMask.ButtonPressMask | Gdk.EventMask.ButtonReleaseMask | Gdk.EventMask.PointerMotionMask | Gdk.EventMask.LeaveNotifyMask;
             EventBox.ButtonPressEvent += new ButtonPressEventHandler(TheButtonPressEvent);
             EventBox.ButtonReleaseEvent += new ButtonReleaseEventHandler(TheButtonReleaseEvent);
             EventBox.LeaveNotifyEvent += new LeaveNotifyEventHandler(TheLeaveNotifyEvent);
             EventBox.VisibleWindow = false; // must not drawn itself
             this.Add(EventBox);
             EventBox.ShowAll();
        }
コード例 #5
0
ファイル: BestTray.cs プロジェクト: ArsenShnurkov/beagle-1
		public BestTray (BestWindow bw, bool autostarted)
		{
			this.autostarted = autostarted;

			Raw = egg_tray_icon_new ("Search");

			win = bw;
			win.DeleteEvent += new DeleteEventHandler (WindowDeleteEvent);
						
			eventbox = new Gtk.EventBox ();
			eventbox.CanFocus = true;
			eventbox.ButtonPressEvent += new ButtonPressEventHandler (ButtonPress);
			
			Gdk.Pixbuf smalldog = Images.GetPixbuf ("best.png");
			eventbox.Add (new Gtk.Image (smalldog.ScaleSimple (24, 24, Gdk.InterpType.Hyper)));

			KeyBinding binding = Conf.Searching.ShowSearchWindowBinding;

			string tooltip = String.Format ("Beagle Search ({0})", binding.ToReadableString ());
			tips = new Gtk.Tooltips ();
			tips.SetTip (eventbox, tooltip, null);
			tips.Enable ();
			
			Add (eventbox);
			eventbox.ShowAll ();

			keybinder = new Beagle.Util.XKeybinder ();
			keybinder.Bind (binding.ToString (),
					new EventHandler (ShowBeaglePressed));
		}
コード例 #6
0
ファイル: PlotView.cs プロジェクト: huoxudong125/oxyplot
 /// <summary>
 /// Shows the tracker.
 /// </summary>
 /// <param name="data">The data.</param>
 public void ShowTracker(TrackerHitResult data)
 {
     if (this.trackerLabel == null)
     {
         // Holding the tracker label inside an EventBox allows
         // us to set the background color
         Gtk.EventBox labelHolder = new Gtk.EventBox();
         this.trackerLabel = new Gtk.Label();
         this.trackerLabel.SetPadding(3, 3);
         OxyColor bgColor = OxyColors.LightSkyBlue;
         labelHolder.ModifyBg(StateType.Normal, new Gdk.Color(bgColor.R, bgColor.G, bgColor.B));
         labelHolder.Add(this.trackerLabel);
         this.Add(labelHolder);
         labelHolder.ShowAll();
     }
     this.trackerLabel.Parent.Visible = true;
     this.trackerLabel.Text = data.ToString();
     Gtk.Requisition req = this.trackerLabel.Parent.SizeRequest();
     int xPos = (int)data.Position.X - req.Width / 2;
     int yPos = (int)data.Position.Y - req.Height;
     xPos = Math.Max(0, Math.Min(xPos, this.Allocation.Width - req.Width));
     yPos = Math.Max(0, Math.Min(yPos, this.Allocation.Height - req.Height));
     this.Move(trackerLabel.Parent, xPos, yPos);
 }