Beispiel #1
0
        public PadTitleWindow(DockFrame frame, DockItem draggedItem) : base(Gtk.WindowType.Popup)
        {
            SkipTaskbarHint = true;
            Decorated       = false;
            TransientFor    = (Gtk.Window)frame.Toplevel;
            TypeHint        = WindowTypeHint.Utility;

            VBox mainBox = new VBox();

            HBox box = new HBox(false, 3);

            if (draggedItem.Icon != null)
            {
                var img = new ImageView(draggedItem.Icon);
                box.PackStart(img, false, false, 0);
            }
            Gtk.Label la = new Label();
            la.Markup = draggedItem.Label;
            box.PackStart(la, false, false, 0);

            mainBox.PackStart(box, false, false, 0);

/*			if (draggedItem.Widget.IsRealized) {
 *                              var win = draggedItem.Widget.GdkWindow;
 *                              var alloc = draggedItem.Widget.Allocation;
 *                              Gdk.Pixbuf img = Gdk.Pixbuf.FromDrawable (win, win.Colormap, alloc.X, alloc.Y, 0, 0, alloc.Width, alloc.Height);
 *
 *                              double mw = 140, mh = 140;
 *                              if (img.Width > img.Height)
 *                                      mw *= 2;
 *                              else
 *                                      mh *= 2;
 *
 *                              double r = Math.Min (mw / img.Width, mh / img.Height);
 *                              img = img.ScaleSimple ((int)(img.Width * r), (int)(img.Height * r), Gdk.InterpType.Hyper);
 *                              mainBox.PackStart (new Gtk.Image (img), false, false, 0);
 *                      }*/

            CustomFrame f = new CustomFrame();

            f.SetPadding(12, 12, 12, 12);
            f.SetMargins(1, 1, 1, 1);
            f.Add(mainBox);

            Add(f);
            ShowAll();
        }
Beispiel #2
0
        internal DockItemToolbar(DockItem parentItem, PositionType position)
        {
            this.parentItem = parentItem;

            topFrame = new CustomFrame();
            topFrame.SetPadding(3, 3, 3, 3);

/*			switch (position) {
 *                              case PositionType.Top:
 *                                      frame.SetMargins (0, 0, 1, 1);
 *                                      frame.SetPadding (0, 2, 2, 0);
 *                                      break;
 *                              case PositionType.Bottom:
 *                                      frame.SetMargins (0, 1, 1, 1);
 *                                      frame.SetPadding (2, 2, 2, 0);
 *                                      break;
 *                              case PositionType.Left:
 *                                      frame.SetMargins (0, 1, 1, 0);
 *                                      frame.SetPadding (0, 0, 2, 2);
 *                                      break;
 *                              case PositionType.Right:
 *                                      frame.SetMargins (0, 1, 0, 1);
 *                                      frame.SetPadding (0, 0, 2, 2);
 *                                      break;
 *                      }*/

            this.position = position;
            if (position == PositionType.Top || position == PositionType.Bottom)
            {
                box = new HBox(false, 3);
            }
            else
            {
                box = new VBox(false, 3);
            }
            box.Show();
//			frame = box;
            frame = topFrame;
            topFrame.Add(box);

//			topFrame.GradientBackround = true;
        }
Beispiel #3
0
		internal DockItemToolbar (DockItem parentItem, PositionType position)
		{
			this.parentItem = parentItem;

			topFrame = new CustomFrame ();
			topFrame.SetPadding (3,3,3,3);

/*			switch (position) {
				case PositionType.Top:
					frame.SetMargins (0, 0, 1, 1); 
					frame.SetPadding (0, 2, 2, 0); 
					break;
				case PositionType.Bottom:
					frame.SetMargins (0, 1, 1, 1);
					frame.SetPadding (2, 2, 2, 0); 
					break;
				case PositionType.Left:
					frame.SetMargins (0, 1, 1, 0);
					frame.SetPadding (0, 0, 2, 2); 
					break;
				case PositionType.Right:
					frame.SetMargins (0, 1, 0, 1);
					frame.SetPadding (0, 0, 2, 2); 
					break;
			}*/

			this.position = position;
			if (position == PositionType.Top || position == PositionType.Bottom)
				box = new HBox (false, 3);
			else
				box = new VBox (false, 3);
			box.Show ();
//			frame = box;
			frame = topFrame;
			topFrame.Add (box);

//			topFrame.GradientBackround = true;
		}
Beispiel #4
0
		public PadTitleWindow (DockFrame frame, DockItem draggedItem): base (Gtk.WindowType.Popup)
		{
			SkipTaskbarHint = true;
			Decorated = false;
			TransientFor = (Gtk.Window) frame.Toplevel;
			TypeHint = WindowTypeHint.Utility;

			VBox mainBox = new VBox ();

			HBox box = new HBox (false, 3);
			if (draggedItem.Icon != null) {
				var img = new ImageView (draggedItem.Icon);
				box.PackStart (img, false, false, 0);
			}
			Gtk.Label la = new Label ();
			la.Markup = draggedItem.Label;
			box.PackStart (la, false, false, 0);

			mainBox.PackStart (box, false, false, 0);

/*			if (draggedItem.Widget.IsRealized) {
				var win = draggedItem.Widget.GdkWindow;
				var alloc = draggedItem.Widget.Allocation;
				Gdk.Pixbuf img = Gdk.Pixbuf.FromDrawable (win, win.Colormap, alloc.X, alloc.Y, 0, 0, alloc.Width, alloc.Height);

				double mw = 140, mh = 140;
				if (img.Width > img.Height)
					mw *= 2;
				else
					mh *= 2;

				double r = Math.Min (mw / img.Width, mh / img.Height);
				img = img.ScaleSimple ((int)(img.Width * r), (int)(img.Height * r), Gdk.InterpType.Hyper);
				mainBox.PackStart (new Gtk.Image (img), false, false, 0);
			}*/

			CustomFrame f = new CustomFrame ();
			f.SetPadding (12, 12, 12, 12);
			f.SetMargins (1, 1, 1, 1);
			f.Add (mainBox);

			Add (f);
			ShowAll ();
		}
Beispiel #5
0
			public PadTitleWindow (DockFrame frame, DockItem draggedItem) : base (Gtk.WindowType.Popup)
			{
				SkipTaskbarHint = true;
				Decorated = false;
				TransientFor = (Gtk.Window)frame.Toplevel;
				TypeHint = WindowTypeHint.Utility;

				var mainBox = new VBox ();

				var box = new HBox (false, 3);
				if (draggedItem.Icon != null) {
					var img = new ImageView (draggedItem.Icon);
					box.PackStart (img, false, false, 0);
				}
				var la = new Label ();
				la.Markup = draggedItem.Label;
				box.PackStart (la, false, false, 0);

				mainBox.PackStart (box, false, false, 0);

				var f = new CustomFrame ();
				f.SetPadding (12, 12, 12, 12);
				f.SetMargins (1, 1, 1, 1);
				f.Add (mainBox);

				Add (f);
				ShowAll ();
			}
Beispiel #6
0
		public AutoHideBox (DockFrame frame, DockItem item, Gtk.PositionType pos, int size): base (frame)
		{
			this.position = pos;
			this.frame = frame;
			this.targetSize = size;
			horiz = pos == PositionType.Left || pos == PositionType.Right;
			startPos = pos == PositionType.Top || pos == PositionType.Left;
			Events = Events | Gdk.EventMask.EnterNotifyMask | Gdk.EventMask.LeaveNotifyMask;
			
			Box fr;
			CustomFrame cframe = new CustomFrame ();
			switch (pos) {
			case PositionType.Left: cframe.SetMargins (0, 0, 1, 1); break;
			case PositionType.Right: cframe.SetMargins (0, 0, 1, 1); break;
			case PositionType.Top: cframe.SetMargins (1, 1, 0, 0); break;
			case PositionType.Bottom: cframe.SetMargins (1, 1, 0, 0); break;
			}

			if (frame.UseWindowsForTopLevelFrames) {
				// When using a top level window on mac, clicks on the first 4 pixels next to the border
				// are not detected. To avoid confusing the user (since the resize cursor is shown), 
				// we make the resize drag area smaller.
				switch (pos) {
				case PositionType.Left: cframe.SetPadding (0, 0, 0, 4); gripSize = 4; break;
				case PositionType.Right: cframe.SetPadding (0, 0, 4, 0); gripSize = 4; break;
				}
			}

			EventBox sepBox = new EventBox ();
			cframe.Add (sepBox);
			
			if (horiz) {
				fr = new HBox ();
				sepBox.Realized += delegate { sepBox.GdkWindow.Cursor = resizeCursorW; };
				sepBox.WidthRequest = gripSize;
			} else {
				fr = new VBox ();
				sepBox.Realized += delegate { sepBox.GdkWindow.Cursor = resizeCursorH; };
				sepBox.HeightRequest = gripSize;
			}
			
			sepBox.Events = EventMask.AllEventsMask;
			
			if (pos == PositionType.Left || pos == PositionType.Top)
				fr.PackEnd (cframe, false, false, 0);
			else
				fr.PackStart (cframe, false, false, 0);

			Add (fr);
			ShowAll ();
			Hide ();
			
#if ANIMATE_DOCKING
			scrollable = new ScrollableContainer ();
			scrollable.ScrollMode = false;
			scrollable.Show ();
#endif
			VBox itemBox = new VBox ();
			itemBox.Show ();
			item.TitleTab.Active = true;
			itemBox.PackStart (item.TitleTab, false, false, 0);
			itemBox.PackStart (item.Widget, true, true, 0);

			item.Widget.Show ();
#if ANIMATE_DOCKING
			scrollable.Add (itemBox);
			fr.PackStart (scrollable, true, true, 0);
#else
			fr.PackStart (itemBox, true, true, 0);
#endif
			
			sepBox.ButtonPressEvent += OnSizeButtonPress;
			sepBox.ButtonReleaseEvent += OnSizeButtonRelease;
			sepBox.MotionNotifyEvent += OnSizeMotion;
			sepBox.ExposeEvent += OnGripExpose;
			sepBox.EnterNotifyEvent += delegate { insideGrip = true; sepBox.QueueDraw (); };
			sepBox.LeaveNotifyEvent += delegate { insideGrip = false; sepBox.QueueDraw (); };
		}
Beispiel #7
0
        public AutoHideBox(DockFrame frame, DockItem item, Gtk.PositionType pos, int size) : base(frame)
        {
            this.position   = pos;
            this.frame      = frame;
            this.targetSize = size;
            horiz           = pos == PositionType.Left || pos == PositionType.Right;
            startPos        = pos == PositionType.Top || pos == PositionType.Left;
            Events          = Events | Gdk.EventMask.EnterNotifyMask | Gdk.EventMask.LeaveNotifyMask;

            Box         fr;
            CustomFrame cframe = new CustomFrame();

            switch (pos)
            {
            case PositionType.Left: cframe.SetMargins(0, 0, 1, 1); break;

            case PositionType.Right: cframe.SetMargins(0, 0, 1, 1); break;

            case PositionType.Top: cframe.SetMargins(1, 1, 0, 0); break;

            case PositionType.Bottom: cframe.SetMargins(1, 1, 0, 0); break;
            }

            if (frame.UseWindowsForTopLevelFrames)
            {
                // When using a top level window on mac, clicks on the first 4 pixels next to the border
                // are not detected. To avoid confusing the user (since the resize cursor is shown),
                // we make the resize drag area smaller.
                switch (pos)
                {
                case PositionType.Left: cframe.SetPadding(0, 0, 0, 4); gripSize = 4; break;

                case PositionType.Right: cframe.SetPadding(0, 0, 4, 0); gripSize = 4; break;
                }
            }

            EventBox sepBox = new EventBox();

            cframe.Add(sepBox);

            if (horiz)
            {
                fr = new HBox();
                sepBox.Realized    += delegate { sepBox.GdkWindow.Cursor = resizeCursorW; };
                sepBox.WidthRequest = gripSize;
            }
            else
            {
                fr = new VBox();
                sepBox.Realized     += delegate { sepBox.GdkWindow.Cursor = resizeCursorH; };
                sepBox.HeightRequest = gripSize;
            }

            sepBox.Events = EventMask.AllEventsMask;

            if (pos == PositionType.Left || pos == PositionType.Top)
            {
                fr.PackEnd(cframe, false, false, 0);
            }
            else
            {
                fr.PackStart(cframe, false, false, 0);
            }

            Add(fr);
            ShowAll();
            Hide();

#if ANIMATE_DOCKING
            scrollable            = new ScrollableContainer();
            scrollable.ScrollMode = false;
            scrollable.Show();
#endif
            VBox itemBox = new VBox();
            itemBox.Show();
            item.TitleTab.Active = true;
            itemBox.PackStart(item.TitleTab, false, false, 0);
            itemBox.PackStart(item.Widget, true, true, 0);

            item.Widget.Show();
#if ANIMATE_DOCKING
            scrollable.Add(itemBox);
            fr.PackStart(scrollable, true, true, 0);
#else
            fr.PackStart(itemBox, true, true, 0);
#endif

            sepBox.ButtonPressEvent   += OnSizeButtonPress;
            sepBox.ButtonReleaseEvent += OnSizeButtonRelease;
            sepBox.MotionNotifyEvent  += OnSizeMotion;
            sepBox.ExposeEvent        += OnGripExpose;
            sepBox.EnterNotifyEvent   += delegate { insideGrip = true; sepBox.QueueDraw(); };
            sepBox.LeaveNotifyEvent   += delegate { insideGrip = false; sepBox.QueueDraw(); };
        }
Beispiel #8
0
		public DocumentTitleWindow (PlaceholderWindow placeholder, DockNotebookTab draggedItem): base (Gtk.WindowType.Toplevel)
		{
			this.placeholder = placeholder;

			SkipTaskbarHint = true;
			Decorated = false;

			//TransientFor = parent;
			TypeHint = WindowTypeHint.Utility;

			VBox mainBox = new VBox ();
			mainBox.Spacing = 3;

			titleBox = new HBox (false, 3);
			if (draggedItem.Icon != null) {
				var img = new ImageView (draggedItem.Icon);
				titleBox.PackStart (img, false, false, 0);
			}
			Gtk.Label la = new Label ();
			la.Markup = draggedItem.Text;
			titleBox.PackStart (la, false, false, 0);

			mainBox.PackStart (titleBox, false, false, 0);

            var wi = RenderWidget (draggedItem.Content);
            if (wi != null) {
                wi = wi.WithBoxSize (200);
                mainBox.PackStart (new ImageView (wi), false, false, 0);
            }

			CustomFrame f = new CustomFrame ();
			f.SetPadding (2, 2, 2, 2);
			f.SetMargins (1, 1, 1, 1);
			f.Add (mainBox);

			Add (f);
			mainBox.CanFocus = true;
			Child.ShowAll ();
		}