box.cpp 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. // Flexlay - A Generic 2D Game Editor
  2. // Copyright (C) 2002 Ingo Ruhnke <grumbel@gmx.de>
  3. //
  4. // This program is free software: you can redistribute it and/or modify
  5. // it under the terms of the GNU General Public License as published by
  6. // the Free Software Foundation, either version 3 of the License, or
  7. // (at your option) any later version.
  8. //
  9. // This program is distributed in the hope that it will be useful,
  10. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. // GNU General Public License for more details.
  13. //
  14. // You should have received a copy of the GNU General Public License
  15. // along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. #include "box.hpp"
  17. #include <ClanLib/Display/display.h>
  18. CL_Color background (210, 210, 210);
  19. CL_Color background_hl(240, 240, 240);
  20. CL_Color background_sw(200, 200, 200);
  21. CL_Color highlight (255, 255, 255);
  22. CL_Color midtone (150, 150, 150);
  23. CL_Color shadow (100, 100, 100);
  24. void
  25. Box::draw_button_up(const CL_Rect& rect)
  26. {
  27. CL_Display::fill_rect(rect, background_hl);
  28. CL_Display::draw_line(rect.left, rect.top,
  29. rect.right, rect.top, highlight);
  30. CL_Display::draw_line(rect.left, rect.top,
  31. rect.left, rect.bottom, highlight);
  32. CL_Display::draw_line(rect.left, rect.bottom,
  33. rect.right, rect.bottom, shadow);
  34. CL_Display::draw_line(rect.right, rect.top,
  35. rect.right, rect.bottom, shadow);
  36. }
  37. void
  38. Box::draw_button_down(const CL_Rect& rect)
  39. {
  40. CL_Display::fill_rect(rect, background_sw);
  41. CL_Display::draw_line(rect.left, rect.bottom,
  42. rect.right, rect.bottom, highlight);
  43. CL_Display::draw_line(rect.right, rect.top,
  44. rect.right, rect.bottom, highlight);
  45. CL_Display::draw_line(rect.left, rect.top,
  46. rect.right, rect.top, shadow);
  47. CL_Display::draw_line(rect.left, rect.top,
  48. rect.left, rect.bottom, shadow);
  49. }
  50. void
  51. Box::draw_button_neutral(const CL_Rect& rect)
  52. {
  53. CL_Display::fill_rect(rect, background);
  54. }
  55. void
  56. Box::draw_panel(const CL_Rect& rect)
  57. {
  58. CL_Display::fill_rect(rect, background);
  59. CL_Display::draw_line(rect.left, rect.top,
  60. rect.right, rect.top, highlight);
  61. CL_Display::draw_line(rect.left, rect.top,
  62. rect.left, rect.bottom, highlight);
  63. CL_Display::draw_line(rect.left, rect.bottom,
  64. rect.right, rect.bottom, shadow);
  65. CL_Display::draw_line(rect.right, rect.top,
  66. rect.right, rect.bottom, shadow);
  67. }
  68. void
  69. Box::draw_panel_down(const CL_Rect& rect)
  70. {
  71. CL_Display::fill_rect(rect, background);
  72. CL_Display::draw_line(rect.left, rect.top,
  73. rect.right, rect.top, shadow);
  74. CL_Display::draw_line(rect.left, rect.top,
  75. rect.left, rect.bottom, shadow);
  76. CL_Display::draw_line(rect.left, rect.bottom,
  77. rect.right, rect.bottom, highlight);
  78. CL_Display::draw_line(rect.right, rect.top,
  79. rect.right, rect.bottom, highlight);
  80. }
  81. void
  82. Box::draw_window(const CL_Rect& rect)
  83. {
  84. draw_panel(CL_Rect(rect.left+1, rect.top+1, rect.right-2, rect.bottom-2));
  85. CL_Display::draw_rect(rect, CL_Color(0, 0, 0));
  86. }
  87. /* EOF */