示例#1
0
        static void size_allocate(IntPtr self, IntPtr allocation)
        {
            base_size_allocate?.Invoke(self, allocation);

            unsafe
            {
                GdkRectangle *pRect = (GdkRectangle *)allocation;
                //Console.WriteLine($"Allocate: {pRect->x},{pRect->y} x {pRect->width},{pRect->height}");
            }

            /*
             * GTK_WIDGET_CLASS (my_application_window_parent_class)->size_allocate (widget,
             *                                                          allocation);
             */
        }
示例#2
0
        static unsafe void size_allocate(IntPtr self, IntPtr allocation)
        {
            GdkRectangle *pAllocation = (GdkRectangle *)allocation;

            gtk_widget_set_allocation(self, ref *pAllocation);

            GdkRectangle child_allocation;

            child_allocation.x      = 0;
            child_allocation.y      = 0;
            child_allocation.width  = pAllocation->width;
            child_allocation.height = pAllocation->height;

            if (gtk_widget_get_realized(self) && gtk_widget_get_has_window(self))
            {
                gdk_window_move_resize(gtk_widget_get_window(self),
                                       pAllocation->x,
                                       pAllocation->y,
                                       child_allocation.width,
                                       child_allocation.height);
            }
        }