public void Normal() { if (m_enable == true) { GuiBackground.CreateControlRegion(this, bmp[Common.LEAVE]); } }
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]); } } }
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); }
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); }
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]); } } }
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; }
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); } }
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]); }
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; }
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); } }
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]); }
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; } }
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]); } } }
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]); } } }
public void PressState() { GuiBackground.CreateControlRegion(this, bmp[Common.DOWN]); m_state = ACTIONS.DOWN; }
public void EnterState() { GuiBackground.CreateControlRegion(this, bmp[Common.ENTER]); m_state = ACTIONS.ENTER; }
public void NormalState() { GuiBackground.CreateControlRegion(this, bmp[Common.LEAVE]); m_state = ACTIONS.LEAVE; }
public void SimulateEnter() { GuiBackground.CreateControlRegion(this, bmp[Common.ENTER]); }