Gambas Documentation - /dev/api/cat/desc

/dev/api/cat/desc

# Class Description

`/wiki/api/name/gb_constant` | Declares a constant.
`GB_AUTO_CREATABLE` | Indicates an auto-creatable class.
`GB_DECLARE` | Begins a class description.
`GB_DESC` | Class description structure.
`GB_END_DECLARE` | Ends a class description.
`GB_EVENT` | Declares an event.
`GB_INHERITS` | Makes the class inherit another one.
`GB_METHOD` | Declares a method.
`GB_NOT_CREATABLE` | Indicates that a class is not creatable.
`GB_PROPERTY` | Declares a property.
`GB_PROPERTY_READ` | Declares a read-only property.
`GB_PROPERTY_SELF` | Declares a property that returns a virtual class.
`GB_STATIC_METHOD` | Declares a static method.
`GB_STATIC_PROPERTY` | Declares a static property.
`GB_STATIC_PROPERTY_READ` | Declares a static read-only property.
`GB_STATIC_PROPERTY_SELF` | Declares a static property that returns a virtual class.
`GB_VIRTUAL_CLASS` | Indicates a virtual class.

## Overview

These macros must be used when describing a class.

A class description is an array of `GB_DESC` structure, whose each element is filled with one of the following macros.

The first element must be filled with the `GB_DECLARE` macro, and the last one must be filled with the `GB_END_DECLARE` macro.

The following macros must be used at the beginning of the array, just after `GB_END_DECLARE`:

- `GB_AUTO_CREATABLE`

- `GB_INHERITS`

- `GB_NOT_CREATABLE`

- `GB_VIRTUAL_CLASS`

The other macros can be used in any order, as the interpreter will sort them anyway.

Here is the declaration of the Window class:

### Examples

    GB_DESC CWindowDesc[] =
    {
      GB_DECLARE("Window", sizeof(CWINDOW)), GB_INHERITS("Container"),

      GB_CONSTANT("None", "i", 0),
      GB_CONSTANT("Fixed", "i", 1),
      GB_CONSTANT("Resizable", "i", 2),

      GB_STATIC_METHOD("_init", NULL, CWINDOW_init, NULL),
      GB_METHOD("_new", NULL, CWINDOW_new, "[(Parent)Control;]"),
      GB_METHOD("_free", NULL, CWINDOW_free, NULL),

      GB_METHOD("Close", "b", CWINDOW_close, "[(Return)i]"),
      GB_METHOD("Raise", NULL, CWINDOW_raise, NULL),
      GB_METHOD("Show", NULL, CWINDOW_show, NULL),
      GB_METHOD("ShowModal", "i", CWINDOW_show_modal, NULL),
      GB_METHOD("ShowDialog", "i", CWINDOW_show_modal, NULL),
      GB_METHOD("Center", NULL, CWINDOW_center, NULL),
      GB_PROPERTY_READ("Modal", "b", CWINDOW_modal),

      GB_METHOD("Delete", NULL, CWINDOW_delete, NULL),

      GB_PROPERTY("Persistent", "b", CWINDOW_persistent),
      GB_PROPERTY("Text", "s", CWINDOW_text),
      GB_PROPERTY("Title", "s", CWINDOW_text),
      GB_PROPERTY("Caption", "s", CWINDOW_text),
      GB_PROPERTY("Icon", "Picture", CWINDOW_icon),
      GB_PROPERTY("Picture", "Picture", CWINDOW_picture),
      GB_PROPERTY("Mask", "b", CWINDOW_mask),
      GB_PROPERTY("Border", "i<Window,None,Fixed,Resizable>", CWINDOW_border),
      GB_PROPERTY("Minimized", "b", CWINDOW_minimized),
      GB_PROPERTY("Maximized", "b", CWINDOW_maximized),
      GB_PROPERTY("FullScreen", "b", CWINDOW_full_screen),
      GB_PROPERTY("TopOnly", "b", CWINDOW_top_only),
      GB_PROPERTY("SkipTaskbar", "b", CWINDOW_skip_taskbar),
      GB_PROPERTY("ToolBox", "b", CWINDOW_tool),
      GB_PROPERTY("Visible", "b", CWINDOW_visible),
      GB_PROPERTY("Arrangement", "i<Arrange>", CCONTAINER_arrangement),
      GB_PROPERTY("Padding", "i", CCONTAINER_padding),
      GB_PROPERTY("Spacing", "i", CCONTAINER_spacing),

      GB_PROPERTY_SELF("Menus", ".WindowMenus"),

      GB_CONSTANT("_Properties", "s", "*,Text,Icon,Picture,Mask,Persistent,Border,Minimized,Maximized,"
                                      "FullScreen,TopOnly,SkipTaskbar,ToolBox,Arrangement,Spacing,Padding"),
      GB_CONSTANT("_DefaultEvent", "s", "Open"),
      GB_CONSTANT("_Arrangement", "i", ARRANGE_FILL),

      GB_EVENT("Close", "b", NULL, &EVENT_Close),
      GB_EVENT("Open", NULL, NULL, &EVENT_Open),
      GB_EVENT("Activate", NULL, NULL, &EVENT_Activate),
      GB_EVENT("Deactivate", NULL, NULL, &EVENT_Deactivate),
      GB_EVENT("Move", NULL, NULL, &EVENT_Move),
      GB_EVENT("Resize", NULL, NULL, &EVENT_Resize),
      GB_EVENT("Show", NULL, NULL, &EVENT_Show),
      GB_EVENT("Hide", NULL, NULL, &EVENT_Hide),
      GB_EVENT("Embed", NULL, NULL, &EVENT_Embed),

      GB_END_DECLARE
    };