| 
									
										
										
										
											2020-10-15 17:27:16 +03: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 "base/flags.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | namespace Ui { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | enum class AttachButtonType { | 
					
						
							|  |  |  | 	Edit, | 
					
						
							|  |  |  | 	Delete, | 
					
						
							| 
									
										
										
										
											2021-04-26 01:50:16 +03:00
										 |  |  | 	Modify, | 
					
						
							| 
									
										
										
										
											2020-10-15 17:27:16 +03:00
										 |  |  | 	None, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class SendFilesWay final { | 
					
						
							|  |  |  | public: | 
					
						
							| 
									
										
										
										
											2020-10-17 12:51:55 +03:00
										 |  |  | 	[[nodiscard]] bool groupFiles() const { | 
					
						
							|  |  |  | 		return (_flags & Flag::GroupFiles) != 0; | 
					
						
							| 
									
										
										
										
											2020-10-15 17:27:16 +03:00
										 |  |  | 	} | 
					
						
							|  |  |  | 	[[nodiscard]] bool sendImagesAsPhotos() const { | 
					
						
							|  |  |  | 		return (_flags & Flag::SendImagesAsPhotos) != 0; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	void setGroupFiles(bool value); | 
					
						
							| 
									
										
										
										
											2020-10-17 12:51:55 +03:00
										 |  |  | 	void setSendImagesAsPhotos(bool value); | 
					
						
							| 
									
										
										
										
											2022-11-10 18:34:37 +03:00
										 |  |  | 	void setHasCompressedStickers(bool value); | 
					
						
							| 
									
										
										
										
											2020-10-15 17:27:16 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	[[nodiscard]] inline bool operator<(const SendFilesWay &other) const { | 
					
						
							|  |  |  | 		return _flags < other._flags; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	[[nodiscard]] inline bool operator>(const SendFilesWay &other) const { | 
					
						
							|  |  |  | 		return other < *this; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	[[nodiscard]] inline bool operator<=(const SendFilesWay &other) const { | 
					
						
							|  |  |  | 		return !(other < *this); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	[[nodiscard]] inline bool operator>=(const SendFilesWay &other) const { | 
					
						
							|  |  |  | 		return !(*this < other); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	[[nodiscard]] inline bool operator==(const SendFilesWay &other) const { | 
					
						
							|  |  |  | 		return _flags == other._flags; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	[[nodiscard]] inline bool operator!=(const SendFilesWay &other) const { | 
					
						
							|  |  |  | 		return !(*this == other); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	[[nodiscard]] int32 serialize() const; | 
					
						
							|  |  |  | 	[[nodiscard]] static std::optional<SendFilesWay> FromSerialized( | 
					
						
							|  |  |  | 		int32 value); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | private: | 
					
						
							| 
									
										
										
										
											2022-11-10 18:34:37 +03:00
										 |  |  | 	[[nodiscard]] bool hasCompressedStickers() const { | 
					
						
							|  |  |  | 		return (_flags & Flag::HasCompressedStickers) != 0; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-10-15 17:27:16 +03:00
										 |  |  | 	enum class Flag : uchar { | 
					
						
							| 
									
										
										
										
											2020-10-17 12:51:55 +03:00
										 |  |  | 		GroupFiles = (1 << 0), | 
					
						
							| 
									
										
										
										
											2020-10-15 17:27:16 +03:00
										 |  |  | 		SendImagesAsPhotos = (1 << 1), | 
					
						
							| 
									
										
										
										
											2022-11-10 18:34:37 +03:00
										 |  |  | 		HasCompressedStickers = (1 << 2), | 
					
						
							| 
									
										
										
										
											2020-10-15 17:27:16 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-10-17 12:51:55 +03:00
										 |  |  | 		Default = GroupFiles | SendImagesAsPhotos, | 
					
						
							| 
									
										
										
										
											2020-10-15 17:27:16 +03:00
										 |  |  | 	}; | 
					
						
							|  |  |  | 	friend inline constexpr bool is_flag_type(Flag) { return true; }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	base::flags<Flag> _flags = Flag::Default; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | } // namespace Ui
 |