2019-08-13 15:35:49 +00:00
|
|
|
/*
|
|
|
|
This file is part of Telegram Desktop,
|
|
|
|
the official desktop application for the Telegram messaging service.
|
|
|
|
|
|
|
|
For license and copyright information please follow this link:
|
|
|
|
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
2022-03-06 09:31:28 +00:00
|
|
|
#include "ui/boxes/choose_date_time.h"
|
|
|
|
|
|
|
|
namespace style {
|
|
|
|
struct IconButton;
|
|
|
|
struct PopupMenu;
|
|
|
|
} // namespace style
|
2019-08-13 15:35:49 +00:00
|
|
|
|
|
|
|
namespace Api {
|
|
|
|
struct SendOptions;
|
|
|
|
} // namespace Api
|
|
|
|
|
2020-08-10 12:22:54 +00:00
|
|
|
namespace SendMenu {
|
|
|
|
enum class Type;
|
|
|
|
} // namespace SendMenu
|
2019-08-28 16:46:47 +00:00
|
|
|
|
2019-08-13 15:35:49 +00:00
|
|
|
namespace HistoryView {
|
|
|
|
|
2019-08-13 20:01:39 +00:00
|
|
|
[[nodiscard]] TimeId DefaultScheduleTime();
|
2020-01-15 02:31:28 +00:00
|
|
|
[[nodiscard]] bool CanScheduleUntilOnline(not_null<PeerData*> peer);
|
2021-01-19 06:22:25 +00:00
|
|
|
|
2022-03-06 09:31:28 +00:00
|
|
|
struct ScheduleBoxStyleArgs {
|
|
|
|
ScheduleBoxStyleArgs();
|
|
|
|
const style::IconButton *topButtonStyle;
|
|
|
|
const style::PopupMenu *popupMenuStyle;
|
|
|
|
Ui::ChooseDateTimeStyleArgs chooseDateTimeArgs;
|
|
|
|
};
|
|
|
|
|
2019-08-13 20:01:39 +00:00
|
|
|
void ScheduleBox(
|
2019-09-18 11:19:05 +00:00
|
|
|
not_null<Ui::GenericBox*> box,
|
2020-08-10 12:22:54 +00:00
|
|
|
SendMenu::Type type,
|
2020-07-06 11:51:58 +00:00
|
|
|
Fn<void(Api::SendOptions)> done,
|
2022-03-06 09:31:28 +00:00
|
|
|
TimeId time,
|
|
|
|
ScheduleBoxStyleArgs style);
|
2019-08-13 15:35:49 +00:00
|
|
|
|
2019-08-20 13:21:10 +00:00
|
|
|
template <typename Guard, typename Submit>
|
2019-09-18 11:19:05 +00:00
|
|
|
[[nodiscard]] object_ptr<Ui::GenericBox> PrepareScheduleBox(
|
2019-08-20 13:21:10 +00:00
|
|
|
Guard &&guard,
|
2020-08-10 12:22:54 +00:00
|
|
|
SendMenu::Type type,
|
2020-05-11 00:11:32 +00:00
|
|
|
Submit &&submit,
|
2022-03-06 09:31:28 +00:00
|
|
|
TimeId scheduleTime = DefaultScheduleTime(),
|
|
|
|
ScheduleBoxStyleArgs style = ScheduleBoxStyleArgs()) {
|
2019-08-20 13:21:10 +00:00
|
|
|
return Box(
|
|
|
|
ScheduleBox,
|
2019-08-28 16:46:47 +00:00
|
|
|
type,
|
2019-08-20 13:21:10 +00:00
|
|
|
crl::guard(std::forward<Guard>(guard), std::forward<Submit>(submit)),
|
2022-03-06 09:31:28 +00:00
|
|
|
scheduleTime,
|
|
|
|
std::move(style));
|
2019-08-20 13:21:10 +00:00
|
|
|
}
|
|
|
|
|
2019-08-13 15:35:49 +00:00
|
|
|
} // namespace HistoryView
|