init
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
Needs user action. / needs-user-action (push) Failing after 8s
Can't reproduce. / cant-reproduce (push) Failing after 8s
Close stale issues and PRs / stale (push) Has been cancelled
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
Needs user action. / needs-user-action (push) Failing after 8s
Can't reproduce. / cant-reproduce (push) Failing after 8s
Close stale issues and PRs / stale (push) Has been cancelled
This commit is contained in:
58
Telegram/lib_ui/ui/rect_part.h
Normal file
58
Telegram/lib_ui/ui/rect_part.h
Normal file
@@ -0,0 +1,58 @@
|
||||
// This file is part of Desktop App Toolkit,
|
||||
// a set of libraries for developing nice desktop applications.
|
||||
//
|
||||
// For license and copyright information please follow this link:
|
||||
// https://github.com/desktop-app/legal/blob/master/LEGAL
|
||||
//
|
||||
#pragma once
|
||||
|
||||
#include "base/flags.h"
|
||||
|
||||
enum class RectPart {
|
||||
None = 0,
|
||||
|
||||
TopLeft = (1 << 0),
|
||||
Top = (1 << 1),
|
||||
TopRight = (1 << 2),
|
||||
Left = (1 << 3),
|
||||
Center = (1 << 4),
|
||||
Right = (1 << 5),
|
||||
BottomLeft = (1 << 6),
|
||||
Bottom = (1 << 7),
|
||||
BottomRight = (1 << 8),
|
||||
|
||||
FullTop = TopLeft | Top | TopRight,
|
||||
NoTopBottom = Left | Center | Right,
|
||||
FullBottom = BottomLeft | Bottom | BottomRight,
|
||||
NoTop = NoTopBottom | FullBottom,
|
||||
NoBottom = FullTop | NoTopBottom,
|
||||
|
||||
FullLeft = TopLeft | Left | BottomLeft,
|
||||
NoLeftRight = Top | Center | Bottom,
|
||||
FullRight = TopRight | Right | BottomRight,
|
||||
NoLeft = NoLeftRight | FullRight,
|
||||
NoRight = FullLeft | NoLeftRight,
|
||||
|
||||
AllCorners = TopLeft | TopRight | BottomLeft | BottomRight,
|
||||
AllSides = Top | Bottom | Left | Right,
|
||||
|
||||
Full = FullTop | NoTop,
|
||||
};
|
||||
using RectParts = base::flags<RectPart>;
|
||||
inline constexpr auto is_flag_type(RectPart) { return true; };
|
||||
|
||||
inline bool IsTopCorner(RectPart corner) {
|
||||
return (corner == RectPart::TopLeft) || (corner == RectPart::TopRight);
|
||||
}
|
||||
|
||||
inline bool IsBottomCorner(RectPart corner) {
|
||||
return (corner == RectPart::BottomLeft) || (corner == RectPart::BottomRight);
|
||||
}
|
||||
|
||||
inline bool IsLeftCorner(RectPart corner) {
|
||||
return (corner == RectPart::TopLeft) || (corner == RectPart::BottomLeft);
|
||||
}
|
||||
|
||||
inline bool IsRightCorner(RectPart corner) {
|
||||
return (corner == RectPart::TopRight) || (corner == RectPart::BottomRight);
|
||||
}
|
||||
Reference in New Issue
Block a user