示例#1
0
        public ITUWidget CreateITUWidget()
        {
            ITUPopupButton btn = new ITUPopupButton();

            btn.name   = this.Name;
            btn.flags |= this.TabStop ? ITU.ITU_TAPSTOP : 0;
            btn.flags |= this.ResponseToUpKey ? ITU.ITU_RESPONSE_TO_UP_KEY : 0;

            PropertyDescriptorCollection properties = TypeDescriptor.GetProperties(this);

            btn.visible = (bool)properties["Visible"].GetValue(this);

            btn.active       = false;
            btn.dirty        = false;
            btn.alpha        = this.Alpha;
            btn.tabIndex     = this.TabIndex;
            btn.rect.x       = this.Location.X;
            btn.rect.y       = this.Location.Y;
            btn.rect.width   = this.Size.Width;
            btn.rect.height  = this.Size.Height;
            btn.color.alpha  = this.BackColor.A;
            btn.color.red    = this.BackColor.R;
            btn.color.green  = this.BackColor.G;
            btn.color.blue   = this.BackColor.B;
            btn.bound.x      = 0;
            btn.bound.y      = 0;
            btn.bound.width  = 0;
            btn.bound.height = 0;

            if (this.BackgroundImage != null)
            {
                btn.staticSurf = ITU.CreateSurfaceNode(this.BackgroundImage as Bitmap, this.PixelFormat, this.Compress, this.External);
                if (this.External)
                {
                    btn.flags |= ITU.ITU_EXTERNAL;
                }
            }

            ITUBorderWindow bwin = btn.bwin.widget as ITUBorderWindow;

            bwin.name         = "";
            bwin.visible      = true;
            bwin.active       = false;
            bwin.dirty        = false;
            bwin.alpha        = 255;
            bwin.rect.x       = 0;
            bwin.rect.y       = 0;
            bwin.rect.width   = this.Size.Width;
            bwin.rect.height  = this.Size.Height;
            bwin.color.alpha  = this.FlatAppearance.BorderColor.A;
            bwin.color.red    = this.FlatAppearance.BorderColor.R;
            bwin.color.green  = this.FlatAppearance.BorderColor.G;
            bwin.color.blue   = this.FlatAppearance.BorderColor.B;
            bwin.bound.x      = 0;
            bwin.bound.y      = 0;
            bwin.bound.width  = 0;
            bwin.bound.height = 0;
            bwin.borderSize   = this.FlatAppearance.BorderSize;

            ITUText text = btn.text.widget as ITUText;

            text.name    = "";
            text.visible = true;
            text.active  = false;
            text.dirty   = false;
            text.alpha   = 255;
            text.rect.x  = 0;
            text.rect.y  = 0;

            using (Graphics cg = this.CreateGraphics())
            {
                SizeF size = cg.MeasureString(this.Text, this.Font);

                text.rect.width  = (int)Math.Ceiling(size.Width);
                text.rect.height = (int)Math.Ceiling(size.Height);
            }
            text.color.alpha  = this.ForeColor.A;
            text.color.red    = this.ForeColor.R;
            text.color.green  = this.ForeColor.G;
            text.color.blue   = this.ForeColor.B;
            text.bound.x      = 0;
            text.bound.y      = 0;
            text.bound.width  = 0;
            text.bound.height = 0;
            text.fontWidth    = (int)Math.Round(this.Font.Size * (this.Font.FontFamily.GetCellAscent(FontStyle.Regular) + this.Font.FontFamily.GetCellDescent(FontStyle.Regular)) / this.Font.FontFamily.GetEmHeight(FontStyle.Regular));
            text.fontHeight   = text.fontWidth;
            text.fontIndex    = this.FontIndex;
            text.layout       = ITULayout.ITU_LAYOUT_MIDDLE_CENTER;

            if (base.Font.Bold)
            {
                text.textFlags |= ITUText.ITU_TEXT_BOLD;
            }

            text.boldSize = this.BoldSize;

            string[] texts = new string[] { this.Text, this.Text1, this.Text2, this.Text3, this.Text4, this.Text5, this.Text6, this.Text7 };
            text.stringSet = ITU.CreateStringSetNode(texts);

            btn.bgColor.alpha    = this.BackColor.A;
            btn.bgColor.red      = this.BackColor.R;
            btn.bgColor.green    = this.BackColor.G;
            btn.bgColor.blue     = this.BackColor.B;
            btn.focusColor.alpha = this.FlatAppearance.MouseOverBackColor.A;
            btn.focusColor.red   = this.FlatAppearance.MouseOverBackColor.R;
            btn.focusColor.green = this.FlatAppearance.MouseOverBackColor.G;
            btn.focusColor.blue  = this.FlatAppearance.MouseOverBackColor.B;

            if (this.FocusImage != null)
            {
                btn.staticFocusSurf = ITU.CreateSurfaceNode(this.FocusImage as Bitmap, this.PixelFormat, this.Compress, this.External);
                if (this.External)
                {
                    btn.flags |= ITU.ITU_EXTERNAL;
                }
            }
            btn.pressColor.alpha = this.FlatAppearance.MouseDownBackColor.A;
            btn.pressColor.red   = this.FlatAppearance.MouseDownBackColor.R;
            btn.pressColor.green = this.FlatAppearance.MouseDownBackColor.G;
            btn.pressColor.blue  = this.FlatAppearance.MouseDownBackColor.B;

            if (this.PressImage != null)
            {
                btn.staticPressSurf = ITU.CreateSurfaceNode(this.PressImage as Bitmap, this.PixelFormat, this.Compress, this.External);
                if (this.External)
                {
                    btn.flags |= ITU.ITU_EXTERNAL;
                }
            }
            btn.pressed = 0;

            btn.flags       |= ITU.ITU_STRETCH;
            btn.totalframe   = this.TotalFrame;
            btn.incPercent   = this.IncreasePercent;
            btn.alphaPercent = this.AlphaPercent;

            btn.actions[0].action  = (ITUActionType)this.Action01.Action;
            btn.actions[0].ev      = (ITUEvent)this.Action01.Event;
            btn.actions[0].target  = this.Action01.Target;
            btn.actions[0].param   = this.Action01.Parameter;
            btn.actions[1].action  = (ITUActionType)this.Action02.Action;
            btn.actions[1].ev      = (ITUEvent)this.Action02.Event;
            btn.actions[1].target  = this.Action02.Target;
            btn.actions[1].param   = this.Action02.Parameter;
            btn.actions[2].action  = (ITUActionType)this.Action03.Action;
            btn.actions[2].ev      = (ITUEvent)this.Action03.Event;
            btn.actions[2].target  = this.Action03.Target;
            btn.actions[2].param   = this.Action03.Parameter;
            btn.actions[3].action  = (ITUActionType)this.Action04.Action;
            btn.actions[3].ev      = (ITUEvent)this.Action04.Event;
            btn.actions[3].target  = this.Action04.Target;
            btn.actions[3].param   = this.Action04.Parameter;
            btn.actions[4].action  = (ITUActionType)this.Action05.Action;
            btn.actions[4].ev      = (ITUEvent)this.Action05.Event;
            btn.actions[4].target  = this.Action05.Target;
            btn.actions[4].param   = this.Action05.Parameter;
            btn.actions[5].action  = (ITUActionType)this.Action06.Action;
            btn.actions[5].ev      = (ITUEvent)this.Action06.Event;
            btn.actions[5].target  = this.Action06.Target;
            btn.actions[5].param   = this.Action06.Parameter;
            btn.actions[6].action  = (ITUActionType)this.Action07.Action;
            btn.actions[6].ev      = (ITUEvent)this.Action07.Event;
            btn.actions[6].target  = this.Action07.Target;
            btn.actions[6].param   = this.Action07.Parameter;
            btn.actions[7].action  = (ITUActionType)this.Action08.Action;
            btn.actions[7].ev      = (ITUEvent)this.Action08.Event;
            btn.actions[7].target  = this.Action08.Target;
            btn.actions[7].param   = this.Action08.Parameter;
            btn.actions[8].action  = (ITUActionType)this.Action09.Action;
            btn.actions[8].ev      = (ITUEvent)this.Action09.Event;
            btn.actions[8].target  = this.Action09.Target;
            btn.actions[8].param   = this.Action09.Parameter;
            btn.actions[9].action  = (ITUActionType)this.Action10.Action;
            btn.actions[9].ev      = (ITUEvent)this.Action10.Event;
            btn.actions[9].target  = this.Action10.Target;
            btn.actions[9].param   = this.Action10.Parameter;
            btn.actions[10].action = (ITUActionType)this.Action11.Action;
            btn.actions[10].ev     = (ITUEvent)this.Action11.Event;
            btn.actions[10].target = this.Action11.Target;
            btn.actions[10].param  = this.Action11.Parameter;
            btn.actions[11].action = (ITUActionType)this.Action12.Action;
            btn.actions[11].ev     = (ITUEvent)this.Action12.Event;
            btn.actions[11].target = this.Action12.Target;
            btn.actions[11].param  = this.Action12.Parameter;
            btn.actions[12].action = (ITUActionType)this.Action13.Action;
            btn.actions[12].ev     = (ITUEvent)this.Action13.Event;
            btn.actions[12].target = this.Action13.Target;
            btn.actions[12].param  = this.Action13.Parameter;
            btn.actions[13].action = (ITUActionType)this.Action14.Action;
            btn.actions[13].ev     = (ITUEvent)this.Action14.Event;
            btn.actions[13].target = this.Action14.Target;
            btn.actions[13].param  = this.Action14.Parameter;
            btn.actions[14].action = (ITUActionType)this.Action15.Action;
            btn.actions[14].ev     = (ITUEvent)this.Action15.Event;
            btn.actions[14].target = this.Action15.Target;
            btn.actions[14].param  = this.Action15.Parameter;

            return(btn);
        }
示例#2
0
        public ITUWidget CreateITUWidget()
        {
            ITUCheckBox checkbox = new ITUCheckBox();

            checkbox.name   = this.Name;
            checkbox.flags |= this.TabStop ? ITU.ITU_TAPSTOP : 0;
            checkbox.flags |= this.ResponseToUpKey ? ITU.ITU_RESPONSE_TO_UP_KEY : 0;

            PropertyDescriptorCollection properties = TypeDescriptor.GetProperties(this);

            checkbox.visible = (bool)properties["Visible"].GetValue(this);

            checkbox.active       = false;
            checkbox.dirty        = false;
            checkbox.alpha        = 255;
            checkbox.tabIndex     = this.TabIndex;
            checkbox.rect.x       = this.Location.X;
            checkbox.rect.y       = this.Location.Y;
            checkbox.rect.width   = this.Size.Width;
            checkbox.rect.height  = this.Size.Height;
            checkbox.color.alpha  = this.BackColor.A;
            checkbox.color.red    = this.BackColor.R;
            checkbox.color.green  = this.BackColor.G;
            checkbox.color.blue   = this.BackColor.B;
            checkbox.bound.x      = 0;
            checkbox.bound.y      = 0;
            checkbox.bound.width  = 0;
            checkbox.bound.height = 0;

            if (this.BackgroundImage != null)
            {
                checkbox.staticSurf = ITU.CreateSurfaceNode(this.BackgroundImage as Bitmap, this.PixelFormat, this.Compress, this.External);
                if (this.External)
                {
                    checkbox.flags |= ITU.ITU_EXTERNAL;
                }
            }

            ITUBorderWindow bwin = checkbox.bwin.widget as ITUBorderWindow;

            bwin.name         = "";
            bwin.visible      = true;
            bwin.active       = false;
            bwin.dirty        = false;
            bwin.alpha        = 255;
            bwin.rect.x       = 0;
            bwin.rect.y       = 0;
            bwin.rect.width   = this.Size.Width;
            bwin.rect.height  = this.Size.Height;
            bwin.color.alpha  = this.FlatAppearance.BorderColor.A;
            bwin.color.red    = this.FlatAppearance.BorderColor.R;
            bwin.color.green  = this.FlatAppearance.BorderColor.G;
            bwin.color.blue   = this.FlatAppearance.BorderColor.B;
            bwin.bound.x      = 0;
            bwin.bound.y      = 0;
            bwin.bound.width  = 0;
            bwin.bound.height = 0;
            bwin.borderSize   = this.FlatAppearance.BorderSize;

            ITUText text = checkbox.text.widget as ITUText;

            text.flags   = ITU.ITU_CLIP_DISABLED;
            text.name    = "";
            text.visible = true;
            text.active  = false;
            text.dirty   = false;
            text.alpha   = 255;
            text.rect.x  = 0;
            text.rect.y  = 0;

            using (Graphics cg = this.CreateGraphics())
            {
                SizeF size = cg.MeasureString(this.Text, this.Font);

                text.rect.width  = (int)Math.Ceiling(size.Width);
                text.rect.height = (int)Math.Ceiling(size.Height);
            }
            text.color.alpha  = this.ForeColor.A;
            text.color.red    = this.ForeColor.R;
            text.color.green  = this.ForeColor.G;
            text.color.blue   = this.ForeColor.B;
            text.bound.x      = 0;
            text.bound.y      = 0;
            text.bound.width  = 0;
            text.bound.height = 0;
            text.fontWidth    = (int)Math.Round(this.Font.Size * (this.Font.FontFamily.GetCellAscent(FontStyle.Regular) + this.Font.FontFamily.GetCellDescent(FontStyle.Regular)) / this.Font.FontFamily.GetEmHeight(FontStyle.Regular));
            text.fontHeight   = text.fontWidth;
            text.fontIndex    = this.FontIndex;
            text.layout       = ITULayout.ITU_LAYOUT_MIDDLE_CENTER;

            if (base.Font.Bold)
            {
                text.textFlags |= ITUText.ITU_TEXT_BOLD;
            }

            text.boldSize = this.BoldSize;

            string[] texts = new string[] { this.Text, this.Text1, this.Text2, this.Text3, this.Text4, this.Text5, this.Text6, this.Text7 };
            text.stringSet = ITU.CreateStringSetNode(texts);

            checkbox.bgColor.alpha    = this.BackColor.A;
            checkbox.bgColor.red      = this.BackColor.R;
            checkbox.bgColor.green    = this.BackColor.G;
            checkbox.bgColor.blue     = this.BackColor.B;
            checkbox.focusColor.alpha = this.FlatAppearance.MouseOverBackColor.A;
            checkbox.focusColor.red   = this.FlatAppearance.MouseOverBackColor.R;
            checkbox.focusColor.green = this.FlatAppearance.MouseOverBackColor.G;
            checkbox.focusColor.blue  = this.FlatAppearance.MouseOverBackColor.B;

            if (this.FocusImage != null)
            {
                checkbox.staticFocusSurf = ITU.CreateSurfaceNode(this.FocusImage as Bitmap, this.PixelFormat, this.Compress, this.External);
                if (this.External)
                {
                    checkbox.flags |= ITU.ITU_EXTERNAL;
                }
            }
            checkbox.pressColor.alpha = this.FlatAppearance.MouseDownBackColor.A;
            checkbox.pressColor.red   = this.FlatAppearance.MouseDownBackColor.R;
            checkbox.pressColor.green = this.FlatAppearance.MouseDownBackColor.G;
            checkbox.pressColor.blue  = this.FlatAppearance.MouseDownBackColor.B;
            checkbox.pressed          = 0;

            checkbox.checkedColor.alpha = this.FlatAppearance.CheckedBackColor.A;
            checkbox.checkedColor.red   = this.FlatAppearance.CheckedBackColor.R;
            checkbox.checkedColor.green = this.FlatAppearance.CheckedBackColor.G;
            checkbox.checkedColor.blue  = this.FlatAppearance.CheckedBackColor.B;

            checkbox.checkedFontColor.alpha = this.CheckedFontColor.A;
            checkbox.checkedFontColor.red   = this.CheckedFontColor.R;
            checkbox.checkedFontColor.green = this.CheckedFontColor.G;
            checkbox.checkedFontColor.blue  = this.CheckedFontColor.B;
            checkbox.orgFontColor.alpha     = this.ForeColor.A;
            checkbox.orgFontColor.red       = this.ForeColor.R;
            checkbox.orgFontColor.green     = this.ForeColor.G;
            checkbox.orgFontColor.blue      = this.ForeColor.B;

            if (this.CheckedImage != null)
            {
                checkbox.staticCheckedSurf = ITU.CreateSurfaceNode(this.CheckedImage as Bitmap, this.PixelFormat, this.Compress, this.External);
                if (this.External)
                {
                    checkbox.flags |= ITU.ITU_EXTERNAL;
                }
            }
            checkbox._checked = this.Checked ? 1 : 0;

            if (this.FocusCheckedImage != null)
            {
                checkbox.staticFocusCheckedSurf = ITU.CreateSurfaceNode(this.FocusCheckedImage as Bitmap, this.PixelFormat, this.Compress, this.External);
                if (this.External)
                {
                    checkbox.flags |= ITU.ITU_EXTERNAL;
                }
            }

            if (!this.SupportTouch)
            {
                checkbox.flags &= ~ITU.ITU_ENABLED;
            }

            checkbox.angle         = this.Angle;
            checkbox.transformType = (ITUTransformType)this.TransformType;
            checkbox.transformX    = this.TransformX;
            checkbox.transformY    = this.TransformY;

            checkbox.actions[0].action  = (ITUActionType)this.Action01.Action;
            checkbox.actions[0].ev      = (ITUEvent)this.Action01.Event;
            checkbox.actions[0].target  = this.Action01.Target;
            checkbox.actions[0].param   = this.Action01.Parameter;
            checkbox.actions[1].action  = (ITUActionType)this.Action02.Action;
            checkbox.actions[1].ev      = (ITUEvent)this.Action02.Event;
            checkbox.actions[1].target  = this.Action02.Target;
            checkbox.actions[1].param   = this.Action02.Parameter;
            checkbox.actions[2].action  = (ITUActionType)this.Action03.Action;
            checkbox.actions[2].ev      = (ITUEvent)this.Action03.Event;
            checkbox.actions[2].target  = this.Action03.Target;
            checkbox.actions[2].param   = this.Action03.Parameter;
            checkbox.actions[3].action  = (ITUActionType)this.Action04.Action;
            checkbox.actions[3].ev      = (ITUEvent)this.Action04.Event;
            checkbox.actions[3].target  = this.Action04.Target;
            checkbox.actions[3].param   = this.Action04.Parameter;
            checkbox.actions[4].action  = (ITUActionType)this.Action05.Action;
            checkbox.actions[4].ev      = (ITUEvent)this.Action05.Event;
            checkbox.actions[4].target  = this.Action05.Target;
            checkbox.actions[4].param   = this.Action05.Parameter;
            checkbox.actions[5].action  = (ITUActionType)this.Action06.Action;
            checkbox.actions[5].ev      = (ITUEvent)this.Action06.Event;
            checkbox.actions[5].target  = this.Action06.Target;
            checkbox.actions[5].param   = this.Action06.Parameter;
            checkbox.actions[6].action  = (ITUActionType)this.Action07.Action;
            checkbox.actions[6].ev      = (ITUEvent)this.Action07.Event;
            checkbox.actions[6].target  = this.Action07.Target;
            checkbox.actions[6].param   = this.Action07.Parameter;
            checkbox.actions[7].action  = (ITUActionType)this.Action08.Action;
            checkbox.actions[7].ev      = (ITUEvent)this.Action08.Event;
            checkbox.actions[7].target  = this.Action08.Target;
            checkbox.actions[7].param   = this.Action08.Parameter;
            checkbox.actions[8].action  = (ITUActionType)this.Action09.Action;
            checkbox.actions[8].ev      = (ITUEvent)this.Action09.Event;
            checkbox.actions[8].target  = this.Action09.Target;
            checkbox.actions[8].param   = this.Action09.Parameter;
            checkbox.actions[9].action  = (ITUActionType)this.Action10.Action;
            checkbox.actions[9].ev      = (ITUEvent)this.Action10.Event;
            checkbox.actions[9].target  = this.Action10.Target;
            checkbox.actions[9].param   = this.Action10.Parameter;
            checkbox.actions[10].action = (ITUActionType)this.Action11.Action;
            checkbox.actions[10].ev     = (ITUEvent)this.Action11.Event;
            checkbox.actions[10].target = this.Action11.Target;
            checkbox.actions[10].param  = this.Action11.Parameter;
            checkbox.actions[11].action = (ITUActionType)this.Action12.Action;
            checkbox.actions[11].ev     = (ITUEvent)this.Action12.Event;
            checkbox.actions[11].target = this.Action12.Target;
            checkbox.actions[11].param  = this.Action12.Parameter;
            checkbox.actions[12].action = (ITUActionType)this.Action13.Action;
            checkbox.actions[12].ev     = (ITUEvent)this.Action13.Event;
            checkbox.actions[12].target = this.Action13.Target;
            checkbox.actions[12].param  = this.Action13.Parameter;
            checkbox.actions[13].action = (ITUActionType)this.Action14.Action;
            checkbox.actions[13].ev     = (ITUEvent)this.Action14.Event;
            checkbox.actions[13].target = this.Action14.Target;
            checkbox.actions[13].param  = this.Action14.Parameter;
            checkbox.actions[14].action = (ITUActionType)this.Action15.Action;
            checkbox.actions[14].ev     = (ITUEvent)this.Action15.Event;
            checkbox.actions[14].target = this.Action15.Target;
            checkbox.actions[14].param  = this.Action15.Parameter;

            return(checkbox);
        }
示例#3
0
        public ITUWidget CreateITUWidget()
        {
            ITUWheel wheel = new ITUWheel();

            wheel.type   = ITUWidgetType.ITU_WHEEL;
            wheel.name   = this.Name;
            wheel.flags |= this.TabStop ? ITU.ITU_TAPSTOP : 0;
            wheel.flags |= this.Touchable ? ITU.ITU_TOUCHABLE : 0;

            PropertyDescriptorCollection properties = TypeDescriptor.GetProperties(this);

            wheel.visible = (bool)properties["Visible"].GetValue(this);

            wheel.active       = false;
            wheel.dirty        = false;
            wheel.alpha        = 255;
            wheel.tabIndex     = this.TabIndex;
            wheel.rect.x       = this.Location.X;
            wheel.rect.y       = this.Location.Y;
            wheel.rect.width   = this.Size.Width;
            wheel.rect.height  = this.Size.Height;
            wheel.color.alpha  = this.BackAlpha;
            wheel.color.red    = this.BackColor.R;
            wheel.color.green  = this.BackColor.G;
            wheel.color.blue   = this.BackColor.B;
            wheel.bound.x      = 0;
            wheel.bound.y      = 0;
            wheel.bound.width  = 0;
            wheel.bound.height = 0;

            /*
             * for (int i = 0; i < this.ItemCount / 2; i++)
             * {
             *  ITUText text = new ITUText();
             *
             *  text.flags = ITU.ITU_CLIP_DISABLED;
             *  text.name = "";
             *  text.visible = true;
             *  text.active = false;
             *  text.dirty = text.visible ? true : false;
             *  text.alpha = 255;
             *  text.rect.x = 0;
             *  text.rect.y = 0;
             *  text.rect.width = this.Size.Width;
             *  text.rect.height = this.ItemHeight;
             *  text.color.alpha = this.ForeColor.A;
             *  text.color.red = this.ForeColor.R;
             *  text.color.green = this.ForeColor.G;
             *  text.color.blue = this.ForeColor.B;
             *  text.bound.x = 0;
             *  text.bound.y = 0;
             *  text.bound.width = 0;
             *  text.bound.height = 0;
             *  text.bgColor.alpha = 0;
             *  text.bgColor.red = 0;
             *  text.bgColor.green = 0;
             *  text.bgColor.blue = 0;
             *  text.fontHeight = (int)this.Font.SizeInPoints;
             *  text.fontIndex = this.FontIndex;
             *
             *  string[] texts = new string[] { "" };
             *  text.stringSet = ITU.CreateStringSetNode(texts);
             *
             *  switch (this.TextAlign)
             *  {
             *      case ContentAlignment.BottomLeft:
             *          text.layout = ITULayout.ITU_LAYOUT_BOTTOM_LEFT;
             *          break;
             *
             *      case ContentAlignment.MiddleLeft:
             *          text.layout = ITULayout.ITU_LAYOUT_MIDDLE_LEFT;
             *          break;
             *
             *      case ContentAlignment.TopLeft:
             *          text.layout = ITULayout.ITU_LAYOUT_TOP_LEFT;
             *          break;
             *
             *      case ContentAlignment.BottomCenter:
             *          text.layout = ITULayout.ITU_LAYOUT_BOTTOM_CENTER;
             *          break;
             *
             *      case ContentAlignment.MiddleCenter:
             *          text.layout = ITULayout.ITU_LAYOUT_MIDDLE_CENTER;
             *          break;
             *
             *      case ContentAlignment.TopCenter:
             *          text.layout = ITULayout.ITU_LAYOUT_TOP_CENTER;
             *          break;
             *
             *      case ContentAlignment.BottomRight:
             *          text.layout = ITULayout.ITU_LAYOUT_BOTTOM_RIGHT;
             *          break;
             *
             *      case ContentAlignment.MiddleRight:
             *          text.layout = ITULayout.ITU_LAYOUT_MIDDLE_RIGHT;
             *          break;
             *
             *      case ContentAlignment.TopRight:
             *          text.layout = ITULayout.ITU_LAYOUT_TOP_RIGHT;
             *          break;
             *
             *      default:
             *          text.layout = ITULayout.ITU_LAYOUT_DEFAULT;
             *          break;
             *  }
             *  WidgetNode node = new WidgetNode();
             *  node.widget = text;
             *  wheel.items.Add(node);
             * }
             */

            int index = 0;

            foreach (object item in this.Items)
            {
                ITUText text = new ITUText();

                text.flags         = ITU.ITU_CLIP_DISABLED;
                text.name          = "";
                text.visible       = true;
                text.active        = false;
                text.dirty         = false;
                text.alpha         = 255;
                text.rect.x        = 0;
                text.rect.y        = 0;
                text.rect.width    = this.Size.Width;
                text.rect.height   = this.ItemHeight;
                text.color.alpha   = this.ForeColor.A;
                text.color.red     = this.ForeColor.R;
                text.color.green   = this.ForeColor.G;
                text.color.blue    = this.ForeColor.B;
                text.bound.x       = 0;
                text.bound.y       = 0;
                text.bound.width   = 0;
                text.bound.height  = 0;
                text.bgColor.alpha = 0;
                text.bgColor.red   = 0;
                text.bgColor.green = 0;
                text.bgColor.blue  = 0;
                text.fontWidth     = (int)Math.Round(this.Font.Size * (this.Font.FontFamily.GetCellAscent(FontStyle.Regular) + this.Font.FontFamily.GetCellDescent(FontStyle.Regular)) / this.Font.FontFamily.GetEmHeight(FontStyle.Regular));
                text.fontHeight    = text.fontWidth;
                text.fontIndex     = this.FontIndex;

                if (base.Font.Bold)
                {
                    text.textFlags |= ITUText.ITU_TEXT_BOLD;
                }

                text.boldSize = this.BoldSize;

                string[] texts = new string[8];

                texts[0] = item.ToString();

                if (this.Items1.Count > index)
                {
                    texts[1] = this.Items1[index].ToString();
                }

                if (this.Items2.Count > index)
                {
                    texts[2] = this.Items2[index].ToString();
                }

                if (this.Items3.Count > index)
                {
                    texts[3] = this.Items3[index].ToString();
                }

                if (this.Items4.Count > index)
                {
                    texts[4] = this.Items4[index].ToString();
                }

                if (this.Items5.Count > index)
                {
                    texts[5] = this.Items5[index].ToString();
                }

                if (this.Items6.Count > index)
                {
                    texts[6] = this.Items6[index].ToString();
                }

                if (this.Items7.Count > index)
                {
                    texts[7] = this.Items7[index].ToString();
                }

                text.stringSet = ITU.CreateStringSetNode(texts);

                switch (this.TextAlign)
                {
                case ContentAlignment.BottomLeft:
                    text.layout = ITULayout.ITU_LAYOUT_BOTTOM_LEFT;
                    break;

                case ContentAlignment.MiddleLeft:
                    text.layout = ITULayout.ITU_LAYOUT_MIDDLE_LEFT;
                    break;

                case ContentAlignment.TopLeft:
                    text.layout = ITULayout.ITU_LAYOUT_TOP_LEFT;
                    break;

                case ContentAlignment.BottomCenter:
                    text.layout = ITULayout.ITU_LAYOUT_BOTTOM_CENTER;
                    break;

                case ContentAlignment.MiddleCenter:
                    text.layout = ITULayout.ITU_LAYOUT_MIDDLE_CENTER;
                    break;

                case ContentAlignment.TopCenter:
                    text.layout = ITULayout.ITU_LAYOUT_TOP_CENTER;
                    break;

                case ContentAlignment.BottomRight:
                    text.layout = ITULayout.ITU_LAYOUT_BOTTOM_RIGHT;
                    break;

                case ContentAlignment.MiddleRight:
                    text.layout = ITULayout.ITU_LAYOUT_MIDDLE_RIGHT;
                    break;

                case ContentAlignment.TopRight:
                    text.layout = ITULayout.ITU_LAYOUT_TOP_RIGHT;
                    break;

                default:
                    text.layout = ITULayout.ITU_LAYOUT_DEFAULT;
                    break;
                }
                WidgetNode node = new WidgetNode();
                node.widget = text;
                wheel.items.Add(node);
                index++;
            }

            /*
             * for (int i = 0; i < this.ItemCount / 2; i++)
             * {
             *  ITUText text = new ITUText();
             *
             *  text.flags = ITU.ITU_CLIP_DISABLED;
             *  text.name = "";
             *  text.visible = true;
             *  text.active = false;
             *  text.dirty = text.visible ? true : false;
             *  text.alpha = 255;
             *  text.rect.x = 0;
             *  text.rect.y = 0;
             *  text.rect.width = this.Size.Width;
             *  text.rect.height = this.ItemHeight;
             *  text.color.alpha = this.ForeColor.A;
             *  text.color.red = this.ForeColor.R;
             *  text.color.green = this.ForeColor.G;
             *  text.color.blue = this.ForeColor.B;
             *  text.bound.x = 0;
             *  text.bound.y = 0;
             *  text.bound.width = 0;
             *  text.bound.height = 0;
             *  text.bgColor.alpha = 0;
             *  text.bgColor.red = 0;
             *  text.bgColor.green = 0;
             *  text.bgColor.blue = 0;
             *  text.fontHeight = (int)this.Font.SizeInPoints;
             *  text.fontIndex = this.FontIndex;
             *
             *  string[] texts = new string[] { "" };
             *  text.stringSet = ITU.CreateStringSetNode(texts);
             *
             *  switch (this.TextAlign)
             *  {
             *      case ContentAlignment.BottomLeft:
             *          text.layout = ITULayout.ITU_LAYOUT_BOTTOM_LEFT;
             *          break;
             *
             *      case ContentAlignment.MiddleLeft:
             *          text.layout = ITULayout.ITU_LAYOUT_MIDDLE_LEFT;
             *          break;
             *
             *      case ContentAlignment.TopLeft:
             *          text.layout = ITULayout.ITU_LAYOUT_TOP_LEFT;
             *          break;
             *
             *      case ContentAlignment.BottomCenter:
             *          text.layout = ITULayout.ITU_LAYOUT_BOTTOM_CENTER;
             *          break;
             *
             *      case ContentAlignment.MiddleCenter:
             *          text.layout = ITULayout.ITU_LAYOUT_MIDDLE_CENTER;
             *          break;
             *
             *      case ContentAlignment.TopCenter:
             *          text.layout = ITULayout.ITU_LAYOUT_TOP_CENTER;
             *          break;
             *
             *      case ContentAlignment.BottomRight:
             *          text.layout = ITULayout.ITU_LAYOUT_BOTTOM_RIGHT;
             *          break;
             *
             *      case ContentAlignment.MiddleRight:
             *          text.layout = ITULayout.ITU_LAYOUT_MIDDLE_RIGHT;
             *          break;
             *
             *      case ContentAlignment.TopRight:
             *          text.layout = ITULayout.ITU_LAYOUT_TOP_RIGHT;
             *          break;
             *
             *      default:
             *          text.layout = ITULayout.ITU_LAYOUT_DEFAULT;
             *          break;
             *  }
             *  WidgetNode node = new WidgetNode();
             *  node.widget = text;
             *  wheel.items.Add(node);
             * }
             */
            wheel.focusColor.alpha  = this.FocusColor.A;
            wheel.focusColor.red    = this.FocusColor.R;
            wheel.focusColor.green  = this.FocusColor.G;
            wheel.focusColor.blue   = this.FocusColor.B;
            wheel.normalColor.alpha = this.ForeColor.A;
            wheel.normalColor.red   = this.ForeColor.R;
            wheel.normalColor.green = this.ForeColor.G;
            wheel.normalColor.blue  = this.ForeColor.B;

            wheel.tempy           = 0;
            wheel.shift_one       = 0;
            wheel.sliding         = 0;
            wheel.scal            = 0;
            wheel.moving_step     = 0;
            wheel.inside          = 0;
            wheel.slide_step      = 2; //this.Speed;
            wheel.slide_itemcount = 0; // this.SlideCount;
            wheel.idle            = 0;
            wheel.focusIndex      = this.FocusIndex;
            wheel.itemCount       = 7; // this.ItemCount;
            wheel.totalframe      = this.TotalFrame;



            if (this.Draggable)
            {
                wheel.flags |= ITU.ITU_DRAGGABLE;
            }

            wheel.fontHeight      = (int)this.Font.SizeInPoints;
            wheel.focusFontHeight = this.FocusFontHeight;

            if (this.Cycle)
            {
                wheel.cycle_tor = 1;
            }
            else
            {
                wheel.cycle_tor = 0;
            }

            wheel.cycle_arr_count = 0;
            wheel.maxci           = 0;
            wheel.minci           = 0;
            wheel.layout_ci       = 0;
            wheel.fix_count       = 0;
            wheel.focus_c         = 0;
            wheel.focus_dev       = 0;

            if (this.FontSquare)
            {
                wheel.fontsquare = 1;
            }
            else
            {
                wheel.fontsquare = 0;
            }

            for (int i = 0; i < ITU.ITU_WHEEL_CYCLE_ARR_LIMIT; i++)
            {
                wheel.cycle_arr[i] = 0;
            }

            wheel.actions[0].action  = (ITUActionType)this.Action01.Action;
            wheel.actions[0].ev      = (ITUEvent)this.Action01.Event;
            wheel.actions[0].target  = this.Action01.Target;
            wheel.actions[0].param   = this.Action01.Parameter;
            wheel.actions[1].action  = (ITUActionType)this.Action02.Action;
            wheel.actions[1].ev      = (ITUEvent)this.Action02.Event;
            wheel.actions[1].target  = this.Action02.Target;
            wheel.actions[1].param   = this.Action02.Parameter;
            wheel.actions[2].action  = (ITUActionType)this.Action03.Action;
            wheel.actions[2].ev      = (ITUEvent)this.Action03.Event;
            wheel.actions[2].target  = this.Action03.Target;
            wheel.actions[2].param   = this.Action03.Parameter;
            wheel.actions[3].action  = (ITUActionType)this.Action04.Action;
            wheel.actions[3].ev      = (ITUEvent)this.Action04.Event;
            wheel.actions[3].target  = this.Action04.Target;
            wheel.actions[3].param   = this.Action04.Parameter;
            wheel.actions[4].action  = (ITUActionType)this.Action05.Action;
            wheel.actions[4].ev      = (ITUEvent)this.Action05.Event;
            wheel.actions[4].target  = this.Action05.Target;
            wheel.actions[4].param   = this.Action05.Parameter;
            wheel.actions[5].action  = (ITUActionType)this.Action06.Action;
            wheel.actions[5].ev      = (ITUEvent)this.Action06.Event;
            wheel.actions[5].target  = this.Action06.Target;
            wheel.actions[5].param   = this.Action06.Parameter;
            wheel.actions[6].action  = (ITUActionType)this.Action07.Action;
            wheel.actions[6].ev      = (ITUEvent)this.Action07.Event;
            wheel.actions[6].target  = this.Action07.Target;
            wheel.actions[6].param   = this.Action07.Parameter;
            wheel.actions[7].action  = (ITUActionType)this.Action08.Action;
            wheel.actions[7].ev      = (ITUEvent)this.Action08.Event;
            wheel.actions[7].target  = this.Action08.Target;
            wheel.actions[7].param   = this.Action08.Parameter;
            wheel.actions[8].action  = (ITUActionType)this.Action09.Action;
            wheel.actions[8].ev      = (ITUEvent)this.Action09.Event;
            wheel.actions[8].target  = this.Action09.Target;
            wheel.actions[8].param   = this.Action09.Parameter;
            wheel.actions[9].action  = (ITUActionType)this.Action10.Action;
            wheel.actions[9].ev      = (ITUEvent)this.Action10.Event;
            wheel.actions[9].target  = this.Action10.Target;
            wheel.actions[9].param   = this.Action10.Parameter;
            wheel.actions[10].action = (ITUActionType)this.Action11.Action;
            wheel.actions[10].ev     = (ITUEvent)this.Action11.Event;
            wheel.actions[10].target = this.Action11.Target;
            wheel.actions[10].param  = this.Action11.Parameter;
            wheel.actions[11].action = (ITUActionType)this.Action12.Action;
            wheel.actions[11].ev     = (ITUEvent)this.Action12.Event;
            wheel.actions[11].target = this.Action12.Target;
            wheel.actions[11].param  = this.Action12.Parameter;
            wheel.actions[12].action = (ITUActionType)this.Action13.Action;
            wheel.actions[12].ev     = (ITUEvent)this.Action13.Event;
            wheel.actions[12].target = this.Action13.Target;
            wheel.actions[12].param  = this.Action13.Parameter;
            wheel.actions[13].action = (ITUActionType)this.Action14.Action;
            wheel.actions[13].ev     = (ITUEvent)this.Action14.Event;
            wheel.actions[13].target = this.Action14.Target;
            wheel.actions[13].param  = this.Action14.Parameter;
            wheel.actions[14].action = (ITUActionType)this.Action15.Action;
            wheel.actions[14].ev     = (ITUEvent)this.Action15.Event;
            wheel.actions[14].target = this.Action15.Target;
            wheel.actions[14].param  = this.Action15.Parameter;

            return(wheel);
        }
示例#4
0
        public ITUWidget CreateITUWidget()
        {
            ITUText widget = new ITUText();

            widget.name = this.Name;

            PropertyDescriptorCollection properties = TypeDescriptor.GetProperties(this);

            widget.visible = (bool)properties["Visible"].GetValue(this);

            widget.active        = false;
            widget.dirty         = false;
            widget.alpha         = 255;
            widget.rect.x        = this.Location.X;
            widget.rect.y        = this.Location.Y;
            widget.rect.width    = this.Size.Width;
            widget.rect.height   = this.Size.Height;
            widget.color.alpha   = this.ForeColor.A;
            widget.color.red     = this.ForeColor.R;
            widget.color.green   = this.ForeColor.G;
            widget.color.blue    = this.ForeColor.B;
            widget.bound.x       = 0;
            widget.bound.y       = 0;
            widget.bound.width   = 0;
            widget.bound.height  = 0;
            widget.bgColor.alpha = this.BackColor.A;
            widget.bgColor.red   = this.BackColor.R;
            widget.bgColor.green = this.BackColor.G;
            widget.bgColor.blue  = this.BackColor.B;
            widget.fontWidth     = (int)Math.Round(this.Font.Size * (this.Font.FontFamily.GetCellAscent(FontStyle.Regular) + this.Font.FontFamily.GetCellDescent(FontStyle.Regular)) / this.Font.FontFamily.GetEmHeight(FontStyle.Regular));
            widget.fontHeight    = widget.fontWidth;
            widget.fontIndex     = this.FontIndex;

            if (base.Font.Bold)
            {
                widget.textFlags |= ITUText.ITU_TEXT_BOLD;
            }

            widget.boldSize = this.BoldSize;

            switch (this.TextAlign)
            {
            case ContentAlignment.BottomLeft:
                widget.layout = ITULayout.ITU_LAYOUT_BOTTOM_LEFT;
                break;

            case ContentAlignment.MiddleLeft:
                widget.layout = ITULayout.ITU_LAYOUT_MIDDLE_LEFT;
                break;

            case ContentAlignment.TopLeft:
                widget.layout = ITULayout.ITU_LAYOUT_TOP_LEFT;
                break;

            case ContentAlignment.BottomCenter:
                widget.layout = ITULayout.ITU_LAYOUT_BOTTOM_CENTER;
                break;

            case ContentAlignment.MiddleCenter:
                widget.layout = ITULayout.ITU_LAYOUT_MIDDLE_CENTER;
                break;

            case ContentAlignment.TopCenter:
                widget.layout = ITULayout.ITU_LAYOUT_TOP_CENTER;
                break;

            case ContentAlignment.BottomRight:
                widget.layout = ITULayout.ITU_LAYOUT_BOTTOM_RIGHT;
                break;

            case ContentAlignment.MiddleRight:
                widget.layout = ITULayout.ITU_LAYOUT_MIDDLE_RIGHT;
                break;

            case ContentAlignment.TopRight:
                widget.layout = ITULayout.ITU_LAYOUT_TOP_RIGHT;
                break;

            default:
                widget.layout = ITULayout.ITU_LAYOUT_DEFAULT;
                break;
            }

            string[] texts = new string[] { this.Text, this.Text1, this.Text2, this.Text3, this.Text4, this.Text5, this.Text6, this.Text7 };
            widget.stringSet = ITU.CreateStringSetNode(texts);

            return(widget);
        }