Custom Container

Custom Container — For gjs container implementations

Functions

GtkWidget * eos_custom_container_new ()

Types and Values

Object Hierarchy

    GObject
    ╰── GInitiallyUnowned
        ╰── GtkWidget
            ╰── GtkContainer
                ╰── EosCustomContainer

Implemented Interfaces

EosCustomContainer implements AtkImplementorIface and GtkBuildable.

Description

This container allows for implementing a custom size allocate routine in gjs. This container implements the bare minimum of virtual functions from GtkContainer, add, remove and forall. Add and remove simply append to and remove from an internal list, and forall iterates over that list. Forall cannot be implemented in gjs, it's not supported by gobject-introspection, so this is needed for custom gjs containers. This class will not size_allocate any children or ever queue_resize, so that is up to subclasses in gjs.

Here's an example gjs program which allocates a GtkFrame the top right quarter of it's allocation.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
const TestContainer = Lang.Class({
  Name: 'TestContainer',
  Extends: Endless.CustomContainer,

  _init: function() {
    this.parent();

    this._frame = new Gtk.Frame();
    this.add(this._frame);
  },

  vfunc_size_allocate: function (alloc) {
    this.parent(alloc);
    alloc.width = alloc.width / 2;
    alloc.height = alloc.height / 2;
    this._frame.size_allocate(alloc);
  }
});

Functions

eos_custom_container_new ()

GtkWidget *
eos_custom_container_new (void);

Creates a new custom container.

Returns

the custom container.

Types and Values

struct EosCustomContainer

struct EosCustomContainer;

This structure contains no public members.