1

I had last used Mono (C#) with GTK, there is it possible to use ObjectAttributes. Is there in D with GtkD and Glade an ObjectAttribute, e.g [UI] like in C#?

For example like:

[UI] Gtk.Button button1;
[UI] Gtk.Label label1;

I did not understand the D documentation about Attributes.

sigod
  • 3,514
  • 2
  • 21
  • 44
NiRu
  • 65
  • 4

1 Answers1

2

D has UDAs (User Defined Attributes).

Example from documentation:

@(3) int a;
@("string", 7) int b;

enum Foo;
@Foo int c;

struct Bar
{
    int x;
}

@Bar(3) int d;

Example of how they're used in cerealed:

struct MyStruct {
    ubyte mybyte1;
    @NoCereal uint nocereal1; //won't be serialised
    @Bits!4 ubyte nibble;
    @Bits!1 ubyte bit;
    @Bits!3 ubyte bits3;
    ubyte mybyte2;
}

Unfortunately, I couldn't find any mentions of UDAs in GtkD.

sigod
  • 3,514
  • 2
  • 21
  • 44