Пример #1
0
 public void Normal()
 {
     if (m_enable == true)
     {
         GuiBackground.CreateControlRegion(this, bmp[Common.LEAVE]);
     }
 }
Пример #2
0
        public void Checked(bool c)
        {
            m_checkedState = c;
            if (m_enable == false)
            {
                return;
            }
            m_checked = c;
            int index = m_checked == false ? 0 : 1;

            if (c)
            {
                GuiBackground.CreateControlRegion(this, bmp[index, Common.DOWN]);
            }
            else
            {
                if (m_isEnter == false)
                {
                    GuiBackground.CreateControlRegion(this, bmp[index, Common.DOWN]);
                }
                else
                {
                    GuiBackground.CreateControlRegion(this, bmp[index, Common.ENTER]);
                }
            }
        }
Пример #3
0
 public void Checked(bool c, Action <bool> cb)
 {
     m_checkedState = c;
     if (m_enable == false)
     {
         return;
     }
     m_checked = c;
     if (m_checked == true)
     {
         GuiBackground.CreateControlRegion(this, bmp[Common.DOWN]);
     }
     else
     {
         if (m_isEnter == false)
         {
             GuiBackground.CreateControlRegion(this, bmp[Common.UP]);
         }
         else
         {
             GuiBackground.CreateControlRegion(this, bmp[Common.ENTER]);
         }
     }
     cb(m_checked);
 }
Пример #4
0
        public void Toogle(Action <bool> cb)
        {
            if (m_enable == false)
            {
                return;
            }
            m_checked = !m_checked;
            int index = m_checked == false ? 0 : 1;

            if (m_checked)
            {
                GuiBackground.CreateControlRegion(this, bmp[index, Common.DOWN]);
            }
            else
            {
                if (m_isEnter == false)
                {
                    GuiBackground.CreateControlRegion(this, bmp[index, Common.LEAVE]);
                }
                else
                {
                    GuiBackground.CreateControlRegion(this, bmp[index, Common.ENTER]);
                }
            }
            cb(m_checked);
        }
Пример #5
0
        public void Enable(bool b)
        {
            if (m_disableExists == false)
            {
                return;
            }
            m_enable = b;
            int index = m_checked == false ? 0 : 1;

            if (b == false)
            {
                GuiBackground.CreateControlRegion(this, bmp[index, Common.DISABLE]);
            }
            else
            {
                if (m_checked == false && m_checkedState == true)
                {
                    m_checked = m_checkedState;
                }

                if (m_isEnter == false && m_checked == false)
                {
                    GuiBackground.CreateControlRegion(this, bmp[index, Common.LEAVE]);
                }
                if (m_isEnter == true && m_checked == false)
                {
                    GuiBackground.CreateControlRegion(this, bmp[index, Common.ENTER]);
                }
                if (m_checked == true)
                {
                    GuiBackground.CreateControlRegion(this, bmp[index, Common.DOWN]);
                }
            }
        }
Пример #6
0
 private void SkinButton_MouseLeave(object sender, EventArgs e)
 {
     if (m_enable == false)
     {
         return;
     }
     if (m_forePress == true)
     {
         return;
     }
     GuiBackground.CreateControlRegion(this, bmp[Common.LEAVE]);
     m_state = ACTIONS.LEAVE;
 }
Пример #7
0
 private void SkinButton_MouseUp(object sender, MouseEventArgs e)
 {
     if (m_enable == false)
     {
         return;
     }
     GuiBackground.CreateControlRegion(this, bmp[Common.UP]);
     m_state = ACTIONS.UP;
     if (pMouseAction != null)
     {
         pMouseAction(ACTIONS.UP);
     }
 }
Пример #8
0
        public void SetSkin(string dir, string onButtonName, string offButtonName)
        {
            string[] names = { onButtonName, offButtonName };
            for (int i = 0; i < 2; i++)
            {
                if (File.Exists(dir + names[i] + "_normal.png") == true)
                {
                    bmp[i, 0] = new Bitmap(dir + names[i] + "_normal.png");
                }
                else
                {
                    throw (new SystemException("File: " + dir + names[i] + "_normal.png" + " does not exists"));
                }

                if (File.Exists(dir + names[i] + "_enter.png") == true)
                {
                    bmp[i, 1] = new Bitmap(dir + names[i] + "_enter.png");
                }
                else
                {
                    throw (new SystemException("File: " + dir + names[i] + "_enter.png" + " does not exists"));
                }

                if (File.Exists(dir + names[i] + "_press.png") == true)
                {
                    bmp[i, 2] = new Bitmap(dir + names[i] + "_press.png");
                }
                else
                {
                    throw (new SystemException("File: " + dir + onButtonName + "_press.png" + " does not exists"));
                }

                if (File.Exists(dir + names[i] + "_disable.png") == true)
                {
                    bmp[i, 3]       = new Bitmap(dir + names[i] + "_disable.png");
                    m_disableExists = true;
                }
                else
                {
                    m_disableExists = false;
                }
            }

            this.MouseEnter += SkinCheckBox_MouseEnter;
            this.MouseLeave += SkinCheckBox_MouseLeave;

            GuiBackground.CreateControlRegion(this, bmp[0, 0]);
        }
Пример #9
0
        public void SetSkin(string dir, string name)
        {
            if (File.Exists(dir + name + "_normal.png"))
            {
                bmp[0] = new Bitmap(dir + name + "_normal.png");
            }
            else
            {
                throw (new SystemException("File: " + dir + name + "_normal.png" + " does not exists"));
            }

            if (File.Exists(dir + name + "_enter.png"))
            {
                bmp[1] = new Bitmap(dir + name + "_enter.png");
            }
            else
            {
                throw (new SystemException("File: " + dir + name + "_enter.png" + " does not exists"));
            }

            if (File.Exists(dir + name + "_press.png"))
            {
                bmp[2] = new Bitmap(dir + name + "_press.png");
            }
            else
            {
                throw (new SystemException("File: " + dir + name + "_press.png" + " does not exists"));
            }

            if (File.Exists(dir + name + "_disable.png"))
            {
                bmp[3] = new Bitmap(dir + name + "_disable.png");
                m_enableButtonExists = true;
            }
            else
            {
                m_enableButtonExists = false;
            }


            GuiBackground.CreateControlRegion(this, bmp[0]);
            m_state = ACTIONS.LEAVE;

            this.MouseDown  += SkinButton_MouseDown;
            this.MouseEnter += SkinButton_MouseEnter;
            this.MouseLeave += SkinButton_MouseLeave;
            this.MouseUp    += SkinButton_MouseUp;
        }
Пример #10
0
 private void SkinButton_MouseDown(object sender, MouseEventArgs e)
 {
     if (m_enable == false)
     {
         return;
     }
     if (m_forePress == true)
     {
         return;
     }
     GuiBackground.CreateControlRegion(this, bmp[Common.DOWN]);
     m_state = ACTIONS.DOWN;
     if (pMouseAction != null)
     {
         pMouseAction(ACTIONS.DOWN);
     }
 }
Пример #11
0
        public void SetSkin(string dir, string buttonName)
        {
            if (File.Exists(dir + buttonName + "_normal.png") == true)
            {
                bmp[0] = new Bitmap(dir + buttonName + "_normal.png");
            }
            else
            {
                throw (new SystemException("File: " + dir + buttonName + "_normal.png" + " does not exists"));
            }

            if (File.Exists(dir + buttonName + "_enter.png") == true)
            {
                bmp[1] = new Bitmap(dir + buttonName + "_enter.png");
            }
            else
            {
                throw (new SystemException("File: " + dir + buttonName + "_enter.png" + " does not exists"));
            }

            if (File.Exists(dir + buttonName + "_press.png") == true)
            {
                bmp[2] = new Bitmap(dir + buttonName + "_press.png");
            }
            else
            {
                throw (new SystemException("File: " + dir + buttonName + "_press.png" + " does not exists"));
            }

            if (File.Exists(dir + buttonName + "_disable.png") == true)
            {
                bmp[3] = new Bitmap(dir + buttonName + "_disable.png");
                m_disableButtonExists = true;
            }
            else
            {
                m_disableButtonExists = false;
            }


            this.MouseEnter += SkinCheckBox_MouseEnter;
            this.MouseLeave += SkinCheckBox_MouseLeave;

            GuiBackground.CreateControlRegion(this, bmp[0]);
        }
Пример #12
0
        public void UpdateSate()
        {
            switch (m_state)
            {
            case ACTIONS.LEAVE:
                GuiBackground.CreateControlRegion(this, bmp[Common.LEAVE]);
                break;

            case ACTIONS.ENTER:
                GuiBackground.CreateControlRegion(this, bmp[Common.ENTER]);
                break;

            case ACTIONS.DOWN:
                GuiBackground.CreateControlRegion(this, bmp[Common.DOWN]);
                break;

            case ACTIONS.DISABLE:
                GuiBackground.CreateControlRegion(this, bmp[Common.DISABLE]);
                break;
            }
        }
Пример #13
0
 public void Toogle()
 {
     if (m_enable == false)
     {
         return;
     }
     m_checked = !m_checked;
     if (m_checked)
     {
         GuiBackground.CreateControlRegion(this, bmp[Common.DOWN]);
     }
     else
     {
         if (m_isEnter == false)
         {
             GuiBackground.CreateControlRegion(this, bmp[Common.LEAVE]);
         }
         else
         {
             GuiBackground.CreateControlRegion(this, bmp[Common.ENTER]);
         }
     }
 }
Пример #14
0
 public void Enable(bool b)
 {
     if (m_enableButtonExists == false)
     {
         return;
     }
     m_enable = b;
     if (b == false)
     {
         GuiBackground.CreateControlRegion(this, bmp[DISABLE]);
         m_state = ACTIONS.DISABLE;
     }
     else
     {
         if (m_state == ACTIONS.LEAVE)
         {
             GuiBackground.CreateControlRegion(this, bmp[Common.LEAVE]);
         }
         if (m_state == ACTIONS.ENTER)
         {
             GuiBackground.CreateControlRegion(this, bmp[Common.ENTER]);
         }
     }
 }
Пример #15
0
 public void PressState()
 {
     GuiBackground.CreateControlRegion(this, bmp[Common.DOWN]);
     m_state = ACTIONS.DOWN;
 }
Пример #16
0
 public void EnterState()
 {
     GuiBackground.CreateControlRegion(this, bmp[Common.ENTER]);
     m_state = ACTIONS.ENTER;
 }
Пример #17
0
 public void NormalState()
 {
     GuiBackground.CreateControlRegion(this, bmp[Common.LEAVE]);
     m_state = ACTIONS.LEAVE;
 }
Пример #18
0
 public void SimulateEnter()
 {
     GuiBackground.CreateControlRegion(this, bmp[Common.ENTER]);
 }