unread_badge_paint.h 958 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /*
  2. This file is part of Telegram Desktop,
  3. the official desktop application for the Telegram messaging service.
  4. For license and copyright information please follow this link:
  5. https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
  6. */
  7. #pragma once
  8. namespace Ui {
  9. enum class UnreadBadgeSize {
  10. Dialogs,
  11. MainMenu,
  12. HistoryToDown,
  13. StickersPanel,
  14. StickersBox,
  15. TouchBar,
  16. ReactionInDialogs,
  17. kCount,
  18. };
  19. struct UnreadBadgeStyle {
  20. UnreadBadgeStyle();
  21. style::align align = style::al_right;
  22. bool active = false;
  23. bool selected = false;
  24. bool muted = false;
  25. int textTop = 0;
  26. int size = 0;
  27. int padding = 0;
  28. UnreadBadgeSize sizeId = UnreadBadgeSize::Dialogs;
  29. style::font font;
  30. };
  31. [[nodiscard]] QSize CountUnreadBadgeSize(
  32. const QString &unreadCount,
  33. const UnreadBadgeStyle &st,
  34. int allowDigits = 0);
  35. QRect PaintUnreadBadge(
  36. QPainter &p,
  37. const QString &t,
  38. int x,
  39. int y,
  40. const UnreadBadgeStyle &st,
  41. int allowDigits = 0);
  42. } // namespace Ui