StylePainter.cpp 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /*
  2. * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #include <LibGfx/Bitmap.h>
  7. #include <LibGfx/ClassicStylePainter.h>
  8. #include <LibGfx/Painter.h>
  9. #include <LibGfx/Palette.h>
  10. #include <LibGfx/StylePainter.h>
  11. namespace Gfx {
  12. BaseStylePainter& StylePainter::current()
  13. {
  14. static ClassicStylePainter style;
  15. return style;
  16. }
  17. void StylePainter::paint_tab_button(Painter& painter, IntRect const& rect, Palette const& palette, bool active, bool hovered, bool enabled, TabPosition position, bool in_active_window, bool accented)
  18. {
  19. current().paint_tab_button(painter, rect, palette, active, hovered, enabled, position, in_active_window, accented);
  20. }
  21. void StylePainter::paint_button(Painter& painter, IntRect const& rect, Palette const& palette, ButtonStyle button_style, bool pressed, bool hovered, bool checked, bool enabled, bool focused, bool default_button)
  22. {
  23. current().paint_button(painter, rect, palette, button_style, pressed, hovered, checked, enabled, focused, default_button);
  24. }
  25. void StylePainter::paint_frame(Painter& painter, IntRect const& rect, Palette const& palette, FrameStyle style, bool skip_vertical_lines)
  26. {
  27. current().paint_frame(painter, rect, palette, style, skip_vertical_lines);
  28. }
  29. void StylePainter::paint_window_frame(Painter& painter, IntRect const& rect, Palette const& palette)
  30. {
  31. current().paint_window_frame(painter, rect, palette);
  32. }
  33. void StylePainter::paint_progressbar(Painter& painter, IntRect const& rect, Palette const& palette, int min, int max, int value, StringView text, Orientation orientation)
  34. {
  35. current().paint_progressbar(painter, rect, palette, min, max, value, text, orientation);
  36. }
  37. void StylePainter::paint_radio_button(Painter& painter, IntRect const& rect, Palette const& palette, bool is_checked, bool is_being_pressed)
  38. {
  39. current().paint_radio_button(painter, rect, palette, is_checked, is_being_pressed);
  40. }
  41. void StylePainter::paint_check_box(Painter& painter, IntRect const& rect, Palette const& palette, bool is_enabled, bool is_checked, bool is_being_pressed)
  42. {
  43. current().paint_check_box(painter, rect, palette, is_enabled, is_checked, is_being_pressed);
  44. }
  45. void StylePainter::paint_transparency_grid(Painter& painter, IntRect const& rect, Palette const& palette)
  46. {
  47. current().paint_transparency_grid(painter, rect, palette);
  48. }
  49. void StylePainter::paint_simple_rect_shadow(Painter& painter, IntRect const& rect, Bitmap const& shadow_bitmap, bool shadow_includes_frame, bool fill_content)
  50. {
  51. current().paint_simple_rect_shadow(painter, rect, shadow_bitmap, shadow_includes_frame, fill_content);
  52. }
  53. }