Пример #1
0
        public unsafe Toolbar(GToolbarItem *items, int icon_size)
        {
            this.ButtonClick   = null;
            this.Rearranged    = null;
            this.NumItems      = 0;
            this.ActiveItem    = -2;
            this.SelectedItem  = -1;
            this.ActivePressed = false;
            base.SetStyle(ControlStyles.Selectable, false);
            this.InitializeComponent();
            this.Items    = items;
            this.IconSize = icon_size;
            this.NumItems = 0;
            if (*(int *)items != -3)
            {
                do
                {
                    this.NumItems++;
                }while (*(int *)(this.NumItems * 16 / sizeof(GToolbarItem) + this.Items) != -3);
            }
            this.ItemProps = new Toolbar.ToolbarItemProp[this.NumItems];
            ImageServer imageServer = ImageServer.GetImageServer("Images");
            int         num         = 0;

            if (0 < this.NumItems)
            {
                int num2 = 0;
                do
                {
                    this.ItemProps[num] = new Toolbar.ToolbarItemProp();
                    GToolbarItem *ptr  = num2 / sizeof(GToolbarItem) + this.Items;
                    int           num3 = *(int *)ptr;
                    if (num3 != -1 && num3 != -2)
                    {
                        this.ItemProps[num].itemImage         = imageServer.GetImage(new string(*(int *)(ptr + 8 / sizeof(GToolbarItem))));
                        this.ItemProps[num].itemDisabledImage = imageServer.GetImage(new string(*(int *)(num2 / sizeof(GToolbarItem) + this.Items + 8 / sizeof(GToolbarItem))) + "-disabled");
                        Toolbar.ToolbarItemProp toolbarItemProp = this.ItemProps[num];
                        if (toolbarItemProp.itemImage == null || toolbarItemProp.itemDisabledImage == null)
                        {
                            goto IL_170;
                        }
                    }
                    this.ItemProps[num].Enabled = true;
                    this.ItemProps[num].Pushed  = false;
                    num++;
                    num2 += 16;
                }while (num < this.NumItems);
                goto IL_199;
IL_170:
                < Module >.GLogger.MarkLine((sbyte *)(& < Module >.?? _C@_0CL@OAFELHOF@c?3?2jtfcode?2src?2workshop?2controls@), 98, (sbyte *)(& < Module >.?? _C@_0BM@GKMMDKEB@NControls?3?3Toolbar?3?3Toolbar?$AA@));