> Could you please provide a link to gintro,

gintro generates the Nim modules during install, you may try
    
    
    nimble install gintro
    
    
    Run

For example something like
    
    
    $ grep -A9 "EventFlag" gdk.nim
      EventFlag* {.size: sizeof(cint), pure.} = enum
        ignoreThisDummyValue = 0
        exposure = 1
        pointerMotion = 2
        pointerMotionHint = 3
        buttonMotion = 4
        button1Motion = 5
        button2Motion = 6
        button3Motion = 7
        buttonPress = 8
      
      EventMask* {.size: sizeof(cint).} = set[EventFlag]
    
    
    
    Run

is generated. For this case it was necessary to insert a virtual flag 0, but it 
is an exception, most Flags start with bit 0. Using a set allows passing 
{pointerMotion, buttonPress} as function arguments, no strange or constructs 
are needed.

One additional restriction of Nim's enums is, that values must all be different.

So this is not allowed:
    
    
    $ grep -A9 "EventFlag" gdk.nim
      EventFlag* {.size: sizeof(cint), pure.} = enum
        ignoreThisDummyValue = 0
        exposure = 1
        pointerMotion = 2
        mouseMotion = 2
        pointerMotionHint = 3
        buttonMotion = 4
        button1Motion = 5
        button2Motion = 6
        button3Motion = 7
        buttonPress = 8
      
      EventMask* {.size: sizeof(cint).} = set[EventFlag]
    
    
    
    Run

But we can do
    
    
    const mouseMotion = EventFlag.pointerMotion
    
    
    Run

if an alias is really needed. (Generally it is not needed.)

Reply via email to