abstract_box.cpp 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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. #include "boxes/abstract_box.h"
  8. #include "core/application.h"
  9. #include "window/window_controller.h"
  10. #include "mainwidget.h"
  11. #include "mainwindow.h"
  12. namespace Ui {
  13. namespace internal {
  14. void showBox(
  15. object_ptr<BoxContent> content,
  16. LayerOptions options,
  17. anim::type animated) {
  18. const auto window = Core::IsAppLaunched()
  19. ? Core::App().activePrimaryWindow()
  20. : nullptr;
  21. if (window) {
  22. window->show(std::move(content), options, animated);
  23. }
  24. }
  25. } // namespace internal
  26. void hideLayer(anim::type animated) {
  27. const auto window = Core::IsAppLaunched()
  28. ? Core::App().activePrimaryWindow()
  29. : nullptr;
  30. if (window) {
  31. window->hideLayer(animated);
  32. }
  33. }
  34. bool isLayerShown() {
  35. const auto window = Core::IsAppLaunched()
  36. ? Core::App().activePrimaryWindow()
  37. : nullptr;
  38. return window && window->isLayerShown();
  39. }
  40. } // namespace Ui