//		public override void DrawerWillClose (NSNotification notification)
//		{
//			Console.WriteLine("Drawer Will Close");
//		}

        public override CGSize DrawerWillResizeContents(NSDrawer sender, CGSize contentSize)
        {
            Console.WriteLine("Drawer Resize from MyDrawerDelegate");
            contentSize.Width = 10 * (float)Math.Ceiling(contentSize.Width / 10);
            if (contentSize.Width < 50)
            {
                contentSize.Width = 50;
            }
            if (contentSize.Width > 250)
            {
                contentSize.Width = 250;
            }
            if (sender == controller.upperRightDrawer)
            {
                controller.lowerRightDrawer.ContentSize = new CGSize(300 - contentSize.Width,
                                                                     controller.lowerRightDrawer.ContentSize.Height);
            }
            else if (sender == controller.lowerRightDrawer)
            {
                controller.upperRightDrawer.ContentSize = new CGSize(300 - contentSize.Width,
                                                                     controller.upperRightDrawer.ContentSize.Height);
            }

            return(contentSize);
        }
Exemple #2
0
        /****************** Bottom drawer ******************/

        /* Our bottom drawer is created programmatically rather than in IB, and has a
         * fixed size both vertically and horizontally.  The fixed vertical size is achieved
         * by setting min and max content sizes equal to the content size.  The fixed horizontal
         * size is achieved by setting leading and trailing offsets when the parent window resizes. */

        private void setupBottomDrawer()
        {
            CGSize contentSize = new CGSize(100, 100);

            bottomDrawer = new NSDrawer(contentSize, NSRectEdge.MinYEdge)
            {
                ParentWindow   = myParentWindow,
                MinContentSize = contentSize,
                MaxContentSize = contentSize
            };
        }
 public CocoaWarningViewHelper(NSBrowser warningsBrowser, NSDrawer drawer)
 {
     m_drawer          = drawer;
     m_warningsBrowser = warningsBrowser;
     m_warningsBrowser.SetDelegate(d => {
         d.BrowserNumberOfRowsInColumn       += HandleDBrowserNumberOfRowsInColumn;
         d.BrowserWillDisplayCellAtRowColumn += HandleDBrowserWillDisplayCellAtRowColumn;
     });
     m_warningsBrowser.AddColumn();
     m_warningsBrowser.SetTitleOfColumn("Warnings", 0);
     m_warningsBrowser.ActionEvent += HandleM_warningsBrowserActionEvent;
 }
 public CocoaWarningViewHelper(NSBrowser warningsBrowser, NSDrawer drawer)
 {
     m_drawer = drawer;
     m_warningsBrowser = warningsBrowser;
     m_warningsBrowser.SetDelegate(d => {
         d.BrowserNumberOfRowsInColumn += HandleDBrowserNumberOfRowsInColumn;
         d.BrowserWillDisplayCellAtRowColumn += HandleDBrowserWillDisplayCellAtRowColumn;
     });
     m_warningsBrowser.AddColumn();
     m_warningsBrowser.SetTitleOfColumn("Warnings", 0);
     m_warningsBrowser.ActionEvent += HandleM_warningsBrowserActionEvent;
 }
Exemple #5
0
        /****************** Upper right drawer ******************/

        /* Our two right drawers divide the right edge of the parent window between them.
         * In addition, they resize together horizontally, in such a way as to maintain a
         * constant total width.
         *
         * The upper right drawer will use our custom delegate class and the lower right drawer will events.
         */

        private void setupUpperRightDrawer()
        {
            CGSize contentSize = new CGSize(150, 150);

            upperRightDrawer = new NSDrawer(contentSize, NSRectEdge.MaxXEdge)
            {
                ParentWindow   = myParentWindow,
                MinContentSize = contentSize
            };

            // setup delegate to recompute the sizes and control close
            myDrawerDelegate          = new MyDrawerDelegate(this);
            upperRightDrawer.Delegate = myDrawerDelegate;
        }
Exemple #6
0
        /****************** Lower right drawer ******************/
        private void setupLowerRightDrawer()
        {
            CGSize contentSize = new CGSize(150, 150);

            lowerRightDrawer = new NSDrawer(contentSize, NSRectEdge.MaxXEdge)
            {
                ParentWindow   = myParentWindow,
                MinContentSize = new CGSize(50, 50)
            };

            // Attach our delegate methods
            lowerRightDrawer.DrawerWillResizeContents = DrawerWillResizeContents;
            lowerRightDrawer.DrawerShouldClose        = DrawerShouldClose;
        }
//		public override void DrawerWillClose (NSNotification notification)
//		{
//			Console.WriteLine("Drawer Will Close");
//		}
		
		public override CGSize DrawerWillResizeContents (NSDrawer sender, CGSize contentSize)
		{
			Console.WriteLine("Drawer Resize from MyDrawerDelegate");
			contentSize.Width = 10 * (float)Math.Ceiling(contentSize.Width / 10);
			if (contentSize.Width < 50) 
				contentSize.Width = 50;
			if (contentSize.Width > 250) 
				contentSize.Width = 250;
			if (sender == controller.upperRightDrawer) {
				controller.lowerRightDrawer.ContentSize = new CGSize(300 - contentSize.Width, 
				                                                    controller.lowerRightDrawer.ContentSize.Height);
			} 
			else if (sender == controller.lowerRightDrawer) {
				controller.upperRightDrawer.ContentSize = new CGSize(300 - contentSize.Width, 
				                                                    controller.upperRightDrawer.ContentSize.Height);
				
			}
			
			return contentSize;
		}
Exemple #8
0
 private CGSize DrawerWillResizeContents(NSDrawer sender, CGSize contentSize)
 {
     Console.WriteLine("Drawer Resize");
     contentSize.Width = 10 * (float)Math.Ceiling(contentSize.Width / 10);
     if (contentSize.Width < 50)
     {
         contentSize.Width = 50;
     }
     if (contentSize.Width > 250)
     {
         contentSize.Width = 250;
     }
     if (sender == upperRightDrawer)
     {
         lowerRightDrawer.ContentSize = new CGSize(300 - contentSize.Width,
                                                   lowerRightDrawer.ContentSize.Height);
     }
     else if (sender == lowerRightDrawer)
     {
         upperRightDrawer.ContentSize = new CGSize(300 - contentSize.Width,
                                                   upperRightDrawer.ContentSize.Height);
     }
     return(contentSize);
 }
 public override CoreGraphics.CGSize DrawerWillResizeContents(NSDrawer sender, CGSize toSize)
 {
     // Prevent resizing of the drawer
     return sender.ContentSize;
 }
//		public override void DrawerDidOpen(NSNotification notification) 
//		{
//			Console.WriteLine("Drawer Did Open");
//		}
//		
//		
//		public override void DrawerWillOpen (NSNotification notification)
//		{
//			Console.WriteLine("Drawer Will Open");
//		}
//		
//		public override bool DrawerShouldOpen (NSDrawer sender)
//		{
//			Console.WriteLine("Drawer Should Open");
//			return true;
//		}
//		
//		public override void DrawerDidClose (NSNotification notification)
//		{
//			Console.WriteLine("Drawer Did Close");
//		}
//		
		public override bool DrawerShouldClose (NSDrawer sender)
		{
			return controller.AllowUpperRightDrawerToClose;
			
		}
		private SizeF DrawerWillResizeContents (NSDrawer sender, SizeF contentSize)
		{
			Console.WriteLine("Drawer Resize");
			contentSize.Width = 10 * (float)Math.Ceiling(contentSize.Width / 10);
			if (contentSize.Width < 50) 
				contentSize.Width = 50;
			if (contentSize.Width > 250) 
				contentSize.Width = 250;
			if (sender == upperRightDrawer)
				lowerRightDrawer.ContentSize = new SizeF(300 - contentSize.Width, 
									 lowerRightDrawer.ContentSize.Height);
			else if (sender == lowerRightDrawer) 
				upperRightDrawer.ContentSize = new SizeF(300 - contentSize.Width, 
									 upperRightDrawer.ContentSize.Height);
			return contentSize;
			
		}
		private bool DrawerShouldClose (NSDrawer sender)
		{
			return (lowerRightAllowClose.State == NSCellStateValue.On);
		}
		/****************** Lower right drawer ******************/
		private void setupLowerRightDrawer()
		{
			SizeF contentSize = new SizeF(150,150);
			lowerRightDrawer = new NSDrawer(contentSize,NSRectEdge.MaxXEdge) {
				ParentWindow = myParentWindow,
				MinContentSize = new SizeF(50,50)
			};
			
			// Attach our delegate methods
			lowerRightDrawer.DrawerWillResizeContents = DrawerWillResizeContents;
			lowerRightDrawer.DrawerShouldClose = DrawerShouldClose;
		}
		/****************** Upper right drawer ******************/

		/* Our two right drawers divide the right edge of the parent window between them. 
		In addition, they resize together horizontally, in such a way as to maintain a
		constant total width. 
		
		The upper right drawer will use our custom delegate class and the lower right drawer will events.
		*/
		
		private void setupUpperRightDrawer() {
			SizeF contentSize = new SizeF(150,150);
			upperRightDrawer = new NSDrawer(contentSize,NSRectEdge.MaxXEdge) {
				ParentWindow = myParentWindow,
				MinContentSize = contentSize
			};

			// setup delegate to recompute the sizes and control close
			myDrawerDelegate = new MyDrawerDelegate(this);
			upperRightDrawer.Delegate = myDrawerDelegate;
		}
		/****************** Bottom drawer ******************/
		/* Our bottom drawer is created programmatically rather than in IB, and has a 
		fixed size both vertically and horizontally.  The fixed vertical size is achieved
		by setting min and max content sizes equal to the content size.  The fixed horizontal
		size is achieved by setting leading and trailing offsets when the parent window resizes. */ 
		
		private void setupBottomDrawer() 
		{
			SizeF contentSize = new SizeF(100,100);
			bottomDrawer = new NSDrawer(contentSize,NSRectEdge.MinYEdge) {
				ParentWindow = myParentWindow,
				MinContentSize = contentSize,
				MaxContentSize = contentSize
			};
		}
Exemple #16
0
 private bool DrawerShouldClose(NSDrawer sender)
 {
     return(lowerRightAllowClose.State == NSCellStateValue.On);
 }
//		public override void DrawerDidOpen(NSNotification notification)
//		{
//			Console.WriteLine("Drawer Did Open");
//		}
//
//
//		public override void DrawerWillOpen (NSNotification notification)
//		{
//			Console.WriteLine("Drawer Will Open");
//		}
//
//		public override bool DrawerShouldOpen (NSDrawer sender)
//		{
//			Console.WriteLine("Drawer Should Open");
//			return true;
//		}
//
//		public override void DrawerDidClose (NSNotification notification)
//		{
//			Console.WriteLine("Drawer Did Close");
//		}
//
        public override bool DrawerShouldClose(NSDrawer sender)
        {
            return(controller.AllowUpperRightDrawerToClose);
        }