# automatically generated by the FlatBuffers compiler, do not modify

# namespace: fbs

import flatbuffers
from flatbuffers.compat import import_numpy
np = import_numpy()

class MenuItem(object):
    __slots__ = ['_tab']

    @classmethod
    def GetRootAsMenuItem(cls, buf, offset):
        n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
        x = MenuItem()
        x.Init(buf, n + offset)
        return x

    # MenuItem
    def Init(self, buf, pos):
        self._tab = flatbuffers.table.Table(buf, pos)

    # MenuItem
    def Glyph(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Int16Flags, o + self._tab.Pos)
        return 0

    # MenuItem
    def Selector(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Int8Flags, o + self._tab.Pos)
        return 0

    # MenuItem
    def Gselector(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Int8Flags, o + self._tab.Pos)
        return 0

    # MenuItem
    def Str(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
        if o != 0:
            return self._tab.String(o + self._tab.Pos)
        return None

    # MenuItem
    def Selected(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12))
        if o != 0:
            return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos))
        return False

def MenuItemStart(builder): builder.StartObject(5)
def MenuItemAddGlyph(builder, glyph): builder.PrependInt16Slot(0, glyph, 0)
def MenuItemAddSelector(builder, selector): builder.PrependInt8Slot(1, selector, 0)
def MenuItemAddGselector(builder, gselector): builder.PrependInt8Slot(2, gselector, 0)
def MenuItemAddStr(builder, str): builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(str), 0)
def MenuItemAddSelected(builder, selected): builder.PrependBoolSlot(4, selected, 0)
def MenuItemEnd(builder): return builder.EndObject()
