tabbutton.m 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. /*---------------------------------------------------
  2. -----------------------------------------------------
  3. Filename: tabbutton.m
  4. Version: 1.0
  5. Type: maki
  6. Date: 28. Sep. 2007 - 13:12
  7. Author: Martin Poehlmann aka Deimos
  8. E-Mail: [email protected]
  9. Internet: www.skinconsortium.com
  10. www.martin.deimos.de.vu
  11. -----------------------------------------------------
  12. ---------------------------------------------------*/
  13. #include <lib/std.mi>
  14. Global GuiObject normalGrid, hoverGrid, activeGrid, footerGrid;
  15. Global Button mousetrap;
  16. Global Text normalText, hoverText, activeText;
  17. Global Boolean mouseDown;
  18. System.onScriptLoaded ()
  19. {
  20. group sg = getScriptGroup();
  21. normalGrid = sg.getObject("bento.tabbutton.normal");
  22. hoverGrid = sg.getObject("bento.tabbutton.hover");
  23. activeGrid = sg.getObject("bento.tabbutton.active");
  24. normalText = sg.getObject("bento.tabbutton.normal.text");
  25. hoverText = sg.getObject("bento.tabbutton.hover.text");
  26. activeText = sg.getObject("bento.tabbutton.active.text");
  27. footerGrid = sg.getObject("bento.tabbutton.footer");
  28. mousetrap = sg.getObject("bento.tabbutton.mousetrap");
  29. }
  30. System.onSetXuiParam (String stringParam, String value)
  31. {
  32. if ( strlower(stringParam) == "tabtext" )
  33. {
  34. normalText.setText(value);
  35. hoverText.setText(value);
  36. activeText.setText(value);
  37. }
  38. }
  39. mousetrap.onLeftButtonDown (int x, int y)
  40. {
  41. mouseDown = 1;
  42. normalGrid.show();
  43. hoverGrid.hide();
  44. normalText.show();
  45. hoverText.hide();
  46. }
  47. mousetrap.onLeftButtonUp (int x, int y)
  48. {
  49. mouseDown = 0;
  50. if (!getActivated() && isMouseOverRect()) { normalGrid.hide(); hoverGrid.show(); normalText.hide(); hoverText.show(); }
  51. }
  52. mousetrap.onleaveArea ()
  53. {
  54. normalGrid.show();
  55. hoverGrid.hide();
  56. normalText.show();
  57. hoverText.hide();
  58. }
  59. mousetrap.onEnterArea ()
  60. {
  61. normalGrid.hide(); hoverGrid.show(); normalText.hide(); hoverText.show();
  62. }
  63. mousetrap.onActivate (int activated)
  64. {
  65. if (activated)
  66. {
  67. normalGrid.hide(); hoverGrid.hide(); normalText.hide(); hoverText.hide();
  68. activeGrid.show(); footerGrid.show(); activeText.show();
  69. }
  70. else
  71. {
  72. normalGrid.show(); hoverGrid.hide(); normalText.show(); hoverText.hide();
  73. activeGrid.hide(); footerGrid.hide(); activeText.hide();
  74. }
  75. }