コード例 #1
0
ファイル: MapView.cs プロジェクト: shenyczz/ApsimX
        /// <summary>
        /// Constructor. Initialises the widget and will show a world
        /// map with no markers until <see cref="ShowMap" /> is called.
        /// </summary>
        /// <param name="owner">Owner view.</param>
        public MapView(ViewBase owner) : base(owner)
        {
            GeometryServiceProvider.Instance = new NtsGeometryServices();

            image = new Gtk.Image();
            var container = new Gtk.EventBox();

            container.Add(image);

            VPaned box = new VPaned();

            Grid = new GridView(this);
            box.Pack1(((ViewBase)Grid).MainWidget, true, false);
            box.Pack2(container, true, true);

            container.AddEvents(
                (int)Gdk.EventMask.ButtonPressMask
                | (int)Gdk.EventMask.ButtonReleaseMask
                | (int)Gdk.EventMask.ScrollMask);
            container.ButtonPressEvent   += OnButtonPress;
            container.ButtonReleaseEvent += OnButtonRelease;
            image.SizeAllocated          += OnSizeAllocated;
            image.ExposeEvent            += OnImageExposed;
            container.Destroyed          += OnMainWidgetDestroyed;
            container.ScrollEvent        += OnMouseScroll;

            mainWidget = box;
            mainWidget.ShowAll();
        }
コード例 #2
0
        /// <summary>
        /// Constructor. Initialises the widget and will show a world
        /// map with no markers until <see cref="ShowMap" /> is called.
        /// </summary>
        /// <param name="owner">Owner view.</param>
        public MapView(ViewBase owner) : base(owner)
        {
            image = new Gtk.Image();
            var container = new Gtk.EventBox();

            container.Add(image);

            VPaned box = new VPaned();

            PropertiesGrid = new PropertyView(this);
            box.Pack1(((ViewBase)PropertiesGrid).MainWidget, true, false);
            box.Pack2(container, true, true);

            container.AddEvents(
                (int)Gdk.EventMask.ButtonPressMask
                | (int)Gdk.EventMask.ButtonReleaseMask
                | (int)Gdk.EventMask.ScrollMask);
            container.ButtonPressEvent   += OnButtonPress;
            container.ButtonReleaseEvent += OnButtonRelease;
            image.SizeAllocated          += OnSizeAllocated;
#if NETFRAMEWORK
            image.ExposeEvent += OnImageExposed;
#else
            image.Drawn += OnImageExposed;
#endif
            container.Destroyed   += OnMainWidgetDestroyed;
            container.ScrollEvent += OnMouseScroll;

            mainWidget = box;
            mainWidget.ShowAll();
        }
コード例 #3
0
        /// <summary>
        /// Constructor. Initialises the widget and will show a world
        /// map with no markers until <see cref="ShowMap" /> is called.
        /// </summary>
        /// <param name="owner">Owner view.</param>
        public MapView(ViewBase owner) : base(owner)
        {
            image = new Gtk.Image();

            image.Halign = Align.Start;
            image.Valign = Align.Start;

            var container = new Gtk.EventBox();

            container.Add(image);

            VPaned box = new VPaned();

            PropertiesView = new PropertyView(this);
            box.Pack1(((ViewBase)PropertiesView).MainWidget, true, false);

            if (((ViewBase)PropertiesView).MainWidget is ScrolledWindow scroller)
            {
                scroller.VscrollbarPolicy = PolicyType.Never;
            }

            box.Pack2(container, true, true);

            container.AddEvents(
                (int)Gdk.EventMask.ButtonPressMask
                | (int)Gdk.EventMask.ButtonReleaseMask
                | (int)Gdk.EventMask.ScrollMask);
            container.ButtonPressEvent   += OnButtonPress;
            container.ButtonReleaseEvent += OnButtonRelease;

            image.Drawn += OnImageExposed;

            container.Destroyed   += OnMainWidgetDestroyed;
            container.ScrollEvent += OnMouseScroll;

            mainWidget = box;
            mainWidget.ShowAll();
        }