tdesktop/Telegram/SourceFiles/history/view/history_view_schedule_box.h

60 lines
1.4 KiB
C
Raw Normal View History

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
#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
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();
[[nodiscard]] bool CanScheduleUntilOnline(not_null<PeerData*> peer);
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,
SendMenu::Type type,
Fn<void(Api::SendOptions)> done,
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,
SendMenu::Type type,
Submit &&submit,
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)),
scheduleTime,
std::move(style));
2019-08-20 13:21:10 +00:00
}
2019-08-13 15:35:49 +00:00
} // namespace HistoryView