Files
tdesktop/Telegram/SourceFiles/menu/menu_send.h
allhaileris afb81b8278
Some checks failed
Docker. / Ubuntu (push) Has been cancelled
User-agent updater. / User-agent (push) Failing after 15s
Lock Threads / lock (push) Failing after 10s
Waiting for answer. / waiting-for-answer (push) Failing after 22s
Close stale issues and PRs / stale (push) Successful in 13s
Needs user action. / needs-user-action (push) Failing after 8s
Can't reproduce. / cant-reproduce (push) Failing after 8s
init
2026-02-16 15:50:16 +03:00

122 lines
2.5 KiB
C++

/*
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 "api/api_common.h"
namespace style {
struct ComposeIcons;
struct PopupMenu;
} // namespace style
namespace ChatHelpers {
class Show;
} // namespace ChatHelpers
namespace Ui {
class PopupMenu;
class RpWidget;
class Show;
} // namespace Ui
namespace Data {
class Thread;
} // namespace Data
namespace SendMenu {
enum class Type : uchar {
Disabled,
SilentOnly,
Scheduled,
ScheduledToUser, // For "Send when online".
Reminder,
EditCommentPrice,
};
enum class SpoilerState : uchar {
None,
Enabled,
Possible,
};
enum class CaptionState : uchar {
None,
Below,
Above,
};
struct Details {
Type type = Type::Disabled;
SpoilerState spoiler = SpoilerState::None;
CaptionState caption = CaptionState::None;
TextWithTags commentPreview;
QString commentStreamerName;
std::optional<uint64> price;
std::optional<uint64> commentPriceMin;
bool effectAllowed = false;
};
enum class FillMenuResult : uchar {
Prepared,
Skipped,
Failed,
};
enum class ActionType : uchar {
Send,
Schedule,
SpoilerOn,
SpoilerOff,
CaptionUp,
CaptionDown,
ChangePrice,
};
struct Action {
using Type = ActionType;
Api::SendOptions options;
Type type = Type::Send;
};
[[nodiscard]] Fn<void(Action, Details)> DefaultCallback(
std::shared_ptr<ChatHelpers::Show> show,
Fn<void(Api::SendOptions)> send);
FillMenuResult FillSendMenu(
not_null<Ui::PopupMenu*> menu,
std::shared_ptr<ChatHelpers::Show> maybeShow,
Details details,
Fn<void(Action, Details)> action,
const style::ComposeIcons *iconsOverride = nullptr,
std::optional<QPoint> desiredPositionOverride = std::nullopt);
FillMenuResult AttachSendMenuEffect(
not_null<Ui::PopupMenu*> menu,
std::shared_ptr<ChatHelpers::Show> show,
Details details,
Fn<void(Action, Details)> action,
std::optional<QPoint> desiredPositionOverride = std::nullopt);
void SetupMenuAndShortcuts(
not_null<Ui::RpWidget*> button,
std::shared_ptr<ChatHelpers::Show> maybeShow,
Fn<Details()> details,
Fn<void(Action, Details)> action,
const style::PopupMenu *stOverride = nullptr,
const style::ComposeIcons *iconsOverride = nullptr);
void SetupUnreadMentionsMenu(
not_null<Ui::RpWidget*> button,
Fn<Data::Thread*()> currentThread);
void SetupUnreadReactionsMenu(
not_null<Ui::RpWidget*> button,
Fn<Data::Thread*()> currentThread);
} // namespace SendMenu