Beispiel #1
0
 public Checkbox(ControlProperty resource)
     : base(resource)
 {
     m_szDefaultID = DefaultStrings.CheckboxControl;
     m_color = Skin.Instance.DefaultColors.CheckboxControl.Caption;
     m_bChecked = false;
     if (resource.m_szTexture.Length > 3)
         UpdateTexture(resource.m_szTexture);
     else
         UpdateTexture("ButtCheck.tga");
 }
Beispiel #2
0
 public Radiobox(ControlProperty resource)
     : base(resource)
 {
     m_szDefaultID = DefaultStrings.RadioControl;
     m_color = Skin.Instance.DefaultColors.CheckboxControl.Caption;
     m_bGroup = (resource.m_bGroup != 0);
     if (resource.m_szTexture.Length > 3)
         UpdateTexture(resource.m_szTexture);
     else
         UpdateTexture("ButtRadio.tga");
 }
Beispiel #3
0
        public TabbedMdi(ControlProperty resource)
            : base(resource)
        {
            m_szDefaultID = DefaultStrings.TabControl;
            if (resource.m_style.HasFlag(WindowStyle.WSS_ALIGNHCENTER))
                m_alignHori = HALIGN_TYPE.Center;
            else if (resource.m_style.HasFlag(WindowStyle.WSS_ALIGNHRIGHT))
                m_alignHori = HALIGN_TYPE.Right;
            else
                m_alignHori = HALIGN_TYPE.Left;

            if (resource.m_style.HasFlag(WindowStyle.WSS_ALIGNVBOTTOM))
                m_alignVert = VALIGN_TYPE.Bottom;
            else if (resource.m_style.HasFlag(WindowStyle.WSS_ALIGNVCENTER))
                m_alignVert = VALIGN_TYPE.Center;
            else
                m_alignVert = VALIGN_TYPE.Top;
            m_bShowCaption = false;
        }
Beispiel #4
0
        public Static(ControlProperty resource)
            : base(resource)
        {
            m_szDefaultID = DefaultStrings.StaticControl;
            if (resource.m_bTile != 0)
                m_bgLayoutType = BGLAYOUT_TYPE.Tile;
            else
                m_bgLayoutType = BGLAYOUT_TYPE.Normal;
            if (resource.m_szTexture.Length > 3)
            {
                UpdateImage(resource.m_szTexture);
            }
            else
            {
                m_pTexture = null;
                m_bgLayoutType = BGLAYOUT_TYPE.Normal;
            }
            m_bVertScrollBar = resource.m_style.HasFlag(WindowStyle.WBS_VSCROLL);

            m_texScrollUp.SetFrames(4);
            m_texScrollDown.SetFrames(4);
        }
Beispiel #5
0
        public Label(ControlProperty resource)
            : base(resource)
        {
            m_shadowColor = Color.Transparent;
            m_color = Skin.Instance.DefaultColors.StaticControl.Caption;
            //m_rectBounds = CalculateBounds();
            if (resource.m_style.HasFlag(WindowStyle.WSS_ALIGNHCENTER))
                m_alignHori = HALIGN_TYPE.Center;
            else if (resource.m_style.HasFlag(WindowStyle.WSS_ALIGNHRIGHT))
                m_alignHori = HALIGN_TYPE.Right;
            else
                m_alignHori = HALIGN_TYPE.Left;

            if (resource.m_style.HasFlag(WindowStyle.WSS_ALIGNVBOTTOM))
                m_alignVert = VALIGN_TYPE.Bottom;
            else if (resource.m_style.HasFlag(WindowStyle.WSS_ALIGNVCENTER))
                m_alignVert = VALIGN_TYPE.Center;
            else
                m_alignVert = VALIGN_TYPE.Top;

            if (resource.m_style.HasFlag(WindowStyle.WSS_GROUPBOX))
                m_color = Skin.Instance.DefaultColors.StaticControl.CaptionText;
        }
Beispiel #6
0
        public override void Save(ref ControlProperty prop)
        {
            base.Save(ref prop);

            prop.m_style |= WindowStyle.WBS_CAPTION;
            if (m_alignHori == HALIGN_TYPE.Center)
                prop.m_style |= WindowStyle.WSS_ALIGNHCENTER;
            else if (m_alignHori == HALIGN_TYPE.Right)
                prop.m_style |= WindowStyle.WSS_ALIGNHRIGHT;
            if (m_alignVert == VALIGN_TYPE.Center)
                prop.m_style |= WindowStyle.WSS_ALIGNVCENTER;
            else if (m_alignVert == VALIGN_TYPE.Bottom)
                prop.m_style |= WindowStyle.WSS_ALIGNVBOTTOM;

            //prop.m_fontcolor = m_color;
            if (m_color == Skin.Instance.DefaultColors.StaticControl.CaptionText)
                prop.m_style |= WindowStyle.WBS_TEXT;
        }
Beispiel #7
0
        public override void Save(ref ControlProperty prop)
        {
            base.Save(ref prop);

            if (m_alignHori == HALIGN_TYPE.Center)
                prop.m_style |= WindowStyle.WSS_ALIGNHCENTER;
            else if (m_alignHori == HALIGN_TYPE.Right)
                prop.m_style |= WindowStyle.WSS_ALIGNHRIGHT;
            if (m_alignVert == VALIGN_TYPE.Center)
                prop.m_style |= WindowStyle.WSS_ALIGNVCENTER;
            else if (m_alignVert == VALIGN_TYPE.Bottom)
                prop.m_style |= WindowStyle.WSS_ALIGNVBOTTOM;
        }
Beispiel #8
0
        public virtual void Save(ref ControlProperty prop)
        {
            if (!ResManager.Instance.Data.Controls.Keys.Contains(m_szID))
                ResManager.Instance.Data.Controls.Add(m_szID, ResManager.Instance.Data.Controls.Values.LastOrDefault() + 1);

            prop.m_szID = m_szID;
            prop.m_szType = ((System.Enum)m_type).ToString();
            prop.m_szTitle = m_szCaption;
            prop.m_szTooltip = m_szTooltip;

            prop.m_rectBounds = m_rectBounds;
            prop.m_rectBounds.X -= ResManager.Instance.DefaultWindowLocation.X;
            prop.m_rectBounds.Y -= ResManager.Instance.DefaultWindowLocation.Y;
            if (m_parent.NoFrame == false)
            {
                if (m_parent.ShowCaption == true)
                    prop.m_rectBounds.Y -= ResManager.Instance.CaptionOffset;
                prop.m_rectBounds.X -= ResManager.Instance.DefaultDeflateRect.X;
                prop.m_rectBounds.Y -= ResManager.Instance.DefaultDeflateRect.Y;
            }
            if (m_bEnabled)
                prop.m_bDisabled = 0;
            else
                prop.m_bDisabled = 1;
            if (m_visibility == VISIBLITY_TYPE.Visible)
                prop.m_bVisible = 1;
            else
                prop.m_bVisible = 0;

            prop.m_style = WindowStyle.WBS_CHILD;
            if (m_bShowCaption && m_type != CONTROL_TYPE.WTYPE_TABCTRL)
                prop.m_style |= WindowStyle.WBS_CAPTION;
        }
Beispiel #9
0
 public Control(ControlProperty resource)
     : this()
 {
     m_rectBounds = new Rectangle(resource.m_rectBounds.Left + ResManager.Instance.DefaultWindowLocation.X, resource.m_rectBounds.Top + ResManager.Instance.DefaultWindowLocation.Y, resource.m_rectBounds.Width, resource.m_rectBounds.Height);
     m_szID = resource.m_szID;
     m_bEnabled = (resource.m_bDisabled == 0);
     m_szTooltip = resource.m_szTooltip;
     m_szCaption = resource.m_szTitle;
     m_bShowCaption = resource.m_style.HasFlag(WindowStyle.WBS_CAPTION);
     m_visibility = VISIBLITY_TYPE.Visible;
     m_type = (CONTROL_TYPE)System.Enum.Parse(typeof(CONTROL_TYPE), resource.m_szType);
     /*
     if (resource.visible == 0)
         m_visibility = VISIBLITY_TYPE.Visible;
     else
         m_visibility = VISIBLITY_TYPE.Hidden;
     */
 }
Beispiel #10
0
 public ListBox(ControlProperty resource)
     : base(resource)
 {
     m_szDefaultID = DefaultStrings.ListControl;
 }
Beispiel #11
0
        public override void Save(ref ControlProperty prop)
        {
            base.Save(ref prop);

            prop.m_szTexture = BackgroundImage;
            if(m_bgLayoutType == BGLAYOUT_TYPE.Tile)
                prop.m_bTile = 1;
            else
                prop.m_bTile = 0;
            if (m_bVertScrollBar)
                prop.m_style |= WindowStyle.WBS_VSCROLL;
        }
Beispiel #12
0
 public Edit(ControlProperty resource)
     : base(resource)
 {
     m_szDefaultID = DefaultStrings.EditControl;
 }
Beispiel #13
0
        private void LoadProperties(string Filename)
        {
            Scanner s = new Scanner(Filename);

            string id = s.GetToken();
            while (id != null)
            {
                WindowProperty res = new WindowProperty();

                // id
                res.m_szID = id;

                // tex
                res.m_szTexture = s.GetToken();
                if (Skin.Instance.Offi != 0)
                    s.GetToken();

                res.m_bTile = Convert.ToInt32(Convert.ToBoolean(s.GetNumber()));
                res.m_size = new Size(s.GetNumber(), s.GetNumber());
                res.m_style = (WindowStyle)s.GetNumber();
                //s.GetToken();

                s.GetToken(); // d3dFormat

                s.GetToken(); // {
                // title
                res.m_szTitle = s.GetToken();
                if (Data.Strings.Keys.Contains(res.m_szTitle))
                    res.m_szTitle = Data.Strings[res.m_szTitle];
                s.GetToken(); // }

                s.GetToken(); // {
                // help key
                res.m_szHelp = s.GetToken();
                if (Data.Strings.Keys.Contains(res.m_szHelp))
                    res.m_szHelp = Data.Strings[res.m_szHelp];
                s.GetToken(); // }

                s.GetToken(); // {
                string type = s.GetToken();
                while (!type.Equals("}"))
                {
                    ControlProperty con = new ControlProperty();

                    // type
                    con.m_szType = type;

                    // id
                    con.m_szID = s.GetToken();

                    // tex
                    con.m_szTexture = s.GetToken();

                    // tile
                    con.m_bTile = Convert.ToInt32(Convert.ToBoolean(s.GetNumber()));

                    // rect.left
                    int left = s.GetNumber();
                    int top = s.GetNumber();
                    int right = s.GetNumber();
                    int bottom = s.GetNumber();

                    con.m_rectBounds = new Rectangle(left, top, right - left, bottom - top);

                    con.m_style = (WindowStyle)s.GetNumber();

                    con.m_bVisible = s.GetNumber();
                    con.m_bGroup = s.GetNumber();
                    con.m_bDisabled = s.GetNumber();
                    con.m_bTabstop = s.GetNumber();

                    if (Skin.Instance.Offi != 0)
                    {
                        s.GetToken();
                        s.GetToken();
                        s.GetToken();
                    }
                    else
                    {
                        //con.m_nfontcolor = s.GetNumber();
                    }

                    s.GetToken(); // {
                    // title
                    con.m_szTitle = s.GetToken();
                    if (Data.Strings.Keys.Contains(con.m_szTitle))
                        con.m_szTitle = Data.Strings[con.m_szTitle];
                    s.GetToken(); // }

                    s.GetToken(); // {
                    // tooltip
                    con.m_szTooltip = s.GetToken();
                    if (Data.Strings.Keys.Contains(con.m_szTooltip))
                        con.m_szTooltip = Data.Strings[con.m_szTooltip];
                    s.GetToken(); // }

                    // Store control.
                    res.m_aControls.Add(con.m_szID, con);

                    type = s.GetToken();
                } // }

                // Store resource.
                Data.Properties.Add(id, res);
                //m_szLastWindowResource = id;

                id = s.GetToken();
            }
            Data.SortProperties();
        }
Beispiel #14
0
        public override void Save(ref ControlProperty prop)
        {
            base.Save(ref prop);

            prop.m_style |= WindowStyle.WBS_CHECK;
            prop.m_style |= WindowStyle.WBS_CAPTION;

            prop.m_szTexture = Image;
        }
Beispiel #15
0
 public Combo(ControlProperty resource)
     : base(resource)
 {
     m_szDefaultID = DefaultStrings.ComboControl;
     UpdateArrowTexture("ButtQuickListDn.tga");
 }
Beispiel #16
0
 public Custom(ControlProperty resource)
     : base(resource)
 {
     m_szDefaultID = DefaultStrings.CustomControl;
 }