コード例 #1
0
		internal DockItemToolbar (DockItem parentItem, PositionType position)
		{
			this.parentItem = parentItem;
			frame = new CustomFrame ();
			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.Add (box);
			frame.GradientBackround = true;
		}
コード例 #2
0
ファイル: AutoHideBox.cs プロジェクト: JamesChan/monodevelop
		public AutoHideBox (DockFrame frame, DockItem item, Gtk.PositionType pos, int size)
		{
			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 (1, 1, 0, 1); break;
				case PositionType.Right: cframe.SetMargins (1, 1, 1, 0); break;
				case PositionType.Top: cframe.SetMargins (0, 1, 1, 1); break;
				case PositionType.Bottom: cframe.SetMargins (1, 0, 1, 1); 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 ();
			
			scrollable = new ScrollableContainer ();
			scrollable.ScrollMode = false;
			scrollable.Show ();

			if (item.Widget.Parent != null) {
				((Gtk.Container)item.Widget.Parent).Remove (item.Widget);
			}

			item.Widget.Show ();
			scrollable.Add (item.Widget);
			fr.PackStart (scrollable, true, true, 0);
			
			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 (); };
		}
コード例 #3
0
        internal DockItemToolbar(DockItem parentItem, DockPositionType 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 == DockPositionType.Top || position == DockPositionType.Bottom)
            {
                box = new HBox(false, 3);
            }
            else
            {
                box = new VBox(false, 3);
            }
            box.Show();
//			frame = box;
            frame = topFrame;
            topFrame.Add(box);

//			topFrame.GradientBackround = true;

            box.Accessible.SetShouldIgnore(false);
            box.Accessible.Role = Atk.Role.ToolBar;

            UpdateAccessibilityLabel();
        }
コード例 #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 Xwt.ImageView(draggedItem.Icon);
                box.PackStart(img.ToGtkWidget(), 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();
        }
コード例 #5
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;
        }
コード例 #6
0
        internal DockItemToolbar(DockItem parentItem, PositionType position)
        {
            this.parentItem = parentItem;
            frame           = new CustomFrame();
            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.Add(box);
            frame.GradientBackround = true;
        }
コード例 #7
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 Xwt.ImageView (draggedItem.Icon);
				titleBox.PackStart (img.ToGtkWidget (), 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 ();
		}
コード例 #8
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 Xwt.ImageView (draggedItem.Icon);
				box.PackStart (img.ToGtkWidget (), 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 ();
		}
コード例 #9
0
		internal MonoDevelopStatusBar ()
		{
			mainContext = new MainStatusBarContextImpl (this);
			activeContext = mainContext;
			contexts.Add (mainContext);
			
			Frame originalFrame = (Frame)Children [0];
//			originalFrame.WidthRequest = 8;
//			originalFrame.Shadow = ShadowType.In;
//			originalFrame.BorderWidth = 0;
			
			BorderWidth = 0;
			Spacing = 0;
			
			// Feedback button
			
			if (FeedbackService.Enabled) {
				CustomFrame fr = new CustomFrame (0, 0, 1, 1);
				Gdk.Pixbuf px = Gdk.Pixbuf.LoadFromResource ("balloon.png");
				HBox b = new HBox (false, 3);
				b.PackStart (new Gtk.Image (px));
				b.PackStart (new Gtk.Label ("Feedback"));
				Gtk.Alignment al = new Gtk.Alignment (0f, 0f, 1f, 1f);
				al.RightPadding = 5;
				al.LeftPadding = 3;
				al.Add (b);
				feedbackButton = new MiniButton (al);
				//feedbackButton.BackroundColor = new Gdk.Color (200, 200, 255);
				fr.Add (feedbackButton);
				PackStart (fr, false, false, 0);
				feedbackButton.Clicked += HandleFeedbackButtonClicked;
				feedbackButton.ButtonPressEvent += HandleFeedbackButtonButtonPressEvent;
				;
				feedbackButton.ClickOnRelease = true;
				FeedbackService.FeedbackPositionGetter = delegate {
					int x, y;
					feedbackButton.GdkWindow.GetOrigin (out x, out y);
					x += feedbackButton.Allocation.Width;
					y -= 6;
					return new Gdk.Point (x, y);
				};
			}
			
			// Dock area
			
			DefaultWorkbench wb = (DefaultWorkbench)IdeApp.Workbench.RootWindow;
			wb.DockFrame.ShadedContainer.Add (this);
			Gtk.Widget dockBar = wb.DockFrame.ExtractDockBar (PositionType.Bottom);
			dockBar.NoShowAll = true;
			PackStart (dockBar, false, false, 0);
			
			// Status panels
			
			progressBar = new ProgressBar ();
			progressBar.PulseStep = 0.1;
			progressBar.SizeRequest ();
			progressBar.HeightRequest = 1;
			
			statusBox = new HBox (false, 0);
			statusBox.BorderWidth = 0;
			
			statusLabel = new Label ();
			statusLabel.SetAlignment (0, 0.5f);
			statusLabel.Wrap = false;
			int w, h;
			Gtk.Icon.SizeLookup (IconSize.Menu, out w, out h);
			statusLabel.HeightRequest = h;
			statusLabel.SetPadding (0, 0);
			
			EventBox eventMessageBox = new EventBox ();
			messageBox = new HBox ();
			messageBox.PackStart (progressBar, false, false, 0);
			messageBox.PackStart (statusLabel, true, true, 0);
			eventMessageBox.Add (messageBox);
			statusBox.PackStart (eventMessageBox, true, true, 0);
			eventMessageBox.ButtonPressEvent += HandleEventMessageBoxButtonPressEvent;
			
			textStatusBarPanel.BorderWidth = 0;
			textStatusBarPanel.ShadowType = ShadowType.None;
			textStatusBarPanel.Add (statusBox);
			
			var eventCaretBox = new EventBox ();
			var caretStatusBox = new HBox ();
			modeLabel = new Label (" ");
			caretStatusBox.PackEnd (modeLabel, false, false, 8);
			
			cursorLabel = new CaretStatusLabel (" ");
			caretStatusBox.PackEnd (cursorLabel, false, false, 0);
			
			caretStatusBox.GetSizeRequest (out w, out h);
			caretStatusBox.WidthRequest = w;
			caretStatusBox.HeightRequest = h;
			eventCaretBox.Add (caretStatusBox);
			statusBox.PackEnd (eventCaretBox, false, false, 0);
			
			statusIconBox = new HBox ();
			statusIconBox.BorderWidth = 0;
			statusIconBox.Spacing = 3;
			statusBox.PackEnd (statusIconBox, false, false, 4);
			
			this.PackStart (textStatusBarPanel, true, true, 0);
			
			ShowReady ();
			Gtk.Box.BoxChild boxChild = (Gtk.Box.BoxChild)this[textStatusBarPanel];
			boxChild.Position = 0;
			boxChild.Expand = boxChild.Fill = true;
			
	//		boxChild = (Gtk.Box.BoxChild)this[originalFrame];
	//		boxChild.Padding = 0;
	//		boxChild.Expand = boxChild.Fill = false;
			
			this.progressBar.Fraction = 0.0;
			this.ShowAll ();
			statusIconBox.HideAll ();
			
			originalFrame.HideAll ();
			progressBar.Visible = false;
			
			StatusBarContext completionStatus = null;
			
			// todo: Move this to the CompletionWindowManager when it's possible.
			CompletionWindowManager.WindowShown += delegate {
				CompletionListWindow wnd = CompletionWindowManager.Wnd;
				if (wnd != null && wnd.List != null && wnd.List.CategoryCount > 1) {
					if (completionStatus == null)
						completionStatus = CreateContext ();
					completionStatus.ShowMessage (string.Format (GettextCatalog.GetString ("To toggle categorized completion mode press {0}."), IdeApp.CommandService.GetCommandInfo (Commands.TextEditorCommands.ShowCompletionWindow).AccelKey));
				}
			};
			
			CompletionWindowManager.WindowClosed += delegate {
				if (completionStatus != null) {
					completionStatus.Dispose ();
					completionStatus = null;
				}
			};
		}
コード例 #10
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 Xwt.ImageView (draggedItem.Icon);
					box.PackStart (img.ToGtkWidget (), 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 ();
			}
コード例 #11
0
ファイル: AutoHideBox.cs プロジェクト: riverans/monodevelop
		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 (); };
		}
コード例 #12
0
        public AutoHideBox(DockFrame frame, DockItem item, Gtk.PositionType pos, int size)
        {
            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;
            }
            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(); };
        }
コード例 #13
0
		internal MonoDevelopStatusBar ()
		{
			BorderWidth = 0;
			Spacing = 0;
			HasResizeGrip = true;

			HeaderBox hb = new HeaderBox (1, 0, 0, 0);
			hb.StyleSet += (o, args) => {
				hb.BorderColor = Styles.DockSeparatorColor.ToGdkColor ();
				hb.BackgroundColor = Styles.DockBarBackground.ToGdkColor ();
			};
			var mainBox = new HBox ();
			mainBox.PackStart (new Label (""), true, true, 0);
			hb.Add (mainBox);
			hb.ShowAll ();
			PackStart (hb, true, true, 0);
			
			// Feedback button
			
			if (FeedbackService.Enabled) {
				CustomFrame fr = new CustomFrame (0, 0, 1, 0);
				var px = Xwt.Drawing.Image.FromResource ("feedback-16.png");
				HBox b = new HBox (false, 3);
				b.PackStart (new Xwt.ImageView (px).ToGtkWidget ());
				b.PackStart (new Gtk.Label ("Feedback"));
				Gtk.Alignment al = new Gtk.Alignment (0f, 0f, 1f, 1f);
				al.RightPadding = 5;
				al.LeftPadding = 3;
				al.Add (b);
				feedbackButton = new MiniButton (al);
				//feedbackButton.BackroundColor = new Gdk.Color (200, 200, 255);
				fr.Add (feedbackButton);
				mainBox.PackStart (fr, false, false, 0);
				feedbackButton.Clicked += HandleFeedbackButtonClicked;
				feedbackButton.ButtonPressEvent += HandleFeedbackButtonButtonPressEvent;
				;
				feedbackButton.ClickOnRelease = true;
				FeedbackService.FeedbackPositionGetter = delegate {
					int x, y;
					if (feedbackButton.GdkWindow != null) {
						feedbackButton.GdkWindow.GetOrigin (out x, out y);
						x += feedbackButton.Allocation.Width;
						y -= 6;
					} else {
						x = y = -1;
					}
					return new Gdk.Point (x, y);
				};
			}
			
			// Dock area
			
			CustomFrame dfr = new CustomFrame (0, 0, 1, 0);
			dfr.StyleSet += (o, args) => {
				dfr.BorderColor = Styles.DockSeparatorColor.ToGdkColor ();
			};
			dfr.ShowAll ();
			DefaultWorkbench wb = (DefaultWorkbench)IdeApp.Workbench.RootWindow;
			var dockBar = wb.DockFrame.ExtractDockBar (PositionType.Bottom);
			dockBar.AlignToEnd = true;
			dockBar.ShowBorder = false;
			dockBar.NoShowAll = true;
			dfr.Add (dockBar);
			mainBox.PackStart (dfr, false, false, 0);

			// Resize grip

			resizeGrip.WidthRequest = ResizeGripWidth;
			resizeGrip.HeightRequest = 0;
			resizeGrip.VisibleWindow = false;
			mainBox.PackStart (resizeGrip, false, false, 0);

			resizeGrip.ButtonPressEvent += delegate (object o, ButtonPressEventArgs args) {
				if (args.Event.Button == 1) {
					GdkWindow.BeginResizeDrag (Gdk.WindowEdge.SouthEast, (int)args.Event.Button, (int)args.Event.XRoot, (int)args.Event.YRoot, args.Event.Time);
				}
			};

			// Status panels

			statusBox = new HBox (false, 0);
			statusBox.BorderWidth = 0;
			
			statusLabel.SetAlignment (0, 0.5f);
			statusLabel.Wrap = false;
			int w, h;
			Gtk.Icon.SizeLookup (IconSize.Menu, out w, out h);
			statusLabel.HeightRequest = h;
			statusLabel.SetPadding (0, 0);
			statusLabel.ShowAll ();
			
			messageBox.PackStart (statusLabel, true, true, 0);

			var eventCaretBox = new EventBox ();
			var caretStatusBox = new HBox ();
			modeLabel = new Label (" ");
			caretStatusBox.PackEnd (modeLabel, false, false, 8);
			
			cursorLabel = new CaretStatusLabel (" ");
			caretStatusBox.PackEnd (cursorLabel, false, false, 0);
			
			caretStatusBox.GetSizeRequest (out w, out h);
			caretStatusBox.WidthRequest = w;
			caretStatusBox.HeightRequest = h;
			eventCaretBox.Add (caretStatusBox);
			statusBox.PackEnd (eventCaretBox, false, false, 0);
			
			this.ShowAll ();

//			// todo: Move this to the CompletionWindowManager when it's possible.
//			StatusBarContext completionStatus = null;
//			CompletionWindowManager.WindowShown += delegate {
//				CompletionListWindow wnd = CompletionWindowManager.Wnd;
//				if (wnd != null && wnd.List != null && wnd.List.CategoryCount > 1) {
//					if (completionStatus == null)
//						completionStatus = CreateContext ();
//					completionStatus.ShowMessage (string.Format (GettextCatalog.GetString ("To toggle categorized completion mode press {0}."), IdeApp.CommandService.GetCommandInfo (Commands.TextEditorCommands.ShowCompletionWindow).AccelKey));
//				}
//			};
		}
コード例 #14
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(); };
        }