64 TopCorners = TopLeftCorner | TopRightCorner,
65 BottomLeftCorner = 0x2,
66 BottomRightCorner = 0x1,
67 BottomCorners = BottomLeftCorner | BottomRightCorner,
68 LeftCorners = TopLeftCorner | BottomLeftCorner,
69 RightCorners = TopRightCorner | BottomRightCorner,
83 AllSides = TopSide | BotSide | LeftSide | RightSide,
84 TabTopSides = TopSide | LeftSide | RightSide,
121 ImageId corner,
const Size &size,
int extend = 0);
135 std::tuple<UseBorder,SelectedCorners> decoration();
154 explicit FrameElements(
int padding) : mFramePadding(padding) {}
158 mCornerStyle = cornerStyle;
174 mActiveColor = color;
180 mInactiveColor = color;
184 [[nodiscard]]
bool getState()
const {
return mInvert; }
187 createBackgroundMask(
gm::Context &context,
Size size,
int frameWidth,
bool roundCorners =
false);
193 mFrameSettings = frameSettings;
210 LayoutManager::Itr last)
override;
217 mLayoutManager = std::make_unique<FrameLayoutManager>();
220 auto idx = frame % mActionCurve->size();
221 mColorValue = (*mActionCurve)[idx];
222 draw(context, position);
224 removeAnimation(getWindow(), getNode<Animation>());
229 if (animationEnable == AnimationEnable::Disable && mAnimationEnableState == AnimationEnable::Enable) {
230 removeAnimation(getWindow(), getNode<Animation>());
235 explicit Frame(
bool invert) noexcept :
Frame() {
239 ~
Frame()
override =
default;
241 explicit Frame(
int padding) noexcept :
Frame() {
245 static constexpr std::string_view
id =
"Frame";
246 std::string_view nodeId()
const noexcept
override {
253 if (mActionCurve && mAnimationEnableState == AnimationEnable::Enable)
254 setAnimation(getWindow(), getNode<Animation>(), containerPosition);
255 drawAnimate(context,containerPosition);
262 enum class FrameColorType {
268 FrameColorType type{};
275 template<
typename ManagerClass>
276 inline std::shared_ptr<ManagerClass> operator<<(std::shared_ptr<ManagerClass> manager,
const rose::CornerStyle cornerStyle) {
277 static_assert(std::is_base_of_v<rose::FrameElements,ManagerClass>,
"ManagerClass must be derived from rose::FrameElements." );
278 manager->set(cornerStyle);
282 template <
class ManagerClass>
283 inline std::shared_ptr<ManagerClass> operator<<(std::shared_ptr<ManagerClass> manager,
const rose::FrameColor& frameColor) {
284 static_assert(std::is_base_of_v<rose::FrameElements,ManagerClass>,
"ManagerClass must be derived from rose::FrameElements." );
285 switch (frameColor.type) {
286 case rose::FrameColorType::InactiveColor:
287 manager->setInactiveColor(frameColor.rgba);
289 case rose::FrameColorType::AnimateColor:
290 manager->setAnimateColor(frameColor.rgba);
296 template <
class ManagerClass>
297 inline std::shared_ptr<ManagerClass> operator<<(std::shared_ptr<ManagerClass> manager,
const rose::FrameSettings& frameSettings) {
298 static_assert(std::is_base_of_v<rose::FrameElements, ManagerClass>,
299 "ManagerClass must be derived from rose::FrameElements.");
300 manager->frameSettings(frameSettings);
A pure virtual base class for layout managers.
Definition: Visual.h:392
SelectedCorners
Specify corners selected for some process, usually drawing.
Definition: Frame.h:60
A Widget which manages contained Widgets.
Definition: Visual.h:697
A beveled border that gives the illusion the frame is sunk into the display.
Definition: Frame.h:26
A wrapper class for SDL_Surface pointers.
Definition: Surface.h:50
AnimationEnable
An enumeration to enable or disable animation.
Definition: Animation.h:24
Red Green Blue Alpha representation of a color.
Definition: Color.h:64
SelectedSides
Specify sides selected for some process, usually drawing.
Definition: Frame.h:77
A notched border that looks like a trench surrounding the frame.
Definition: Frame.h:28
CornerStyle
Types of corners supported.
Definition: Types.h:63
UseBorder
The type of border to draw.
Definition: Frame.h:23
void draw(gm::Context &context, const Position< int > &containerPosition) override
Draw the visual.
Definition: Frame.h:252
void renderSelectedSides(gm::Context &context, FrameElements::SelectedSides selectedSides, BorderStyle useBorder, ImageId corner, const Size &size, int extend=0)
Render sides as part of a border around the frame.
Definition: Frame.cpp:93
Definition: Animation.h:157
No border.
Definition: Frame.h:24
Abstraction of space consumed around an object for space, borders, etc.
Definition: Types.h:454
ButtonDisplayState
The visible state a button is in.
Definition: Callbacks.h:21
Abstraction of SDL_Texture.
Definition: Texture.h:46
Context
Definition: GraphicsModel.h:76
A beveled border that gives the illusion the frame stands up from the display.
Definition: Frame.h:25
void drawBackground(gm::Context &context, Rectangle &src, Rectangle &dst)
Draw the background for the Frame.
Definition: Frame.cpp:256
void drawFrame(gm::Context &context, Rectangle widgetRect)
Draw the Frame and background.
Definition: Frame.cpp:349
void setAnimateColor(const color::RGBA &color)
Set the active color.
Definition: Frame.h:173
A notched border that looks like a ridge surrounding the frame.
Definition: Frame.h:27
void setInactiveColor(const color::RGBA &color)
Set the background color.
Definition: Frame.h:179
A composite of a Position and a Size.
Definition: Types.h:307
A size in integer dimensions.
Definition: Types.h:230
ToDo: There is an issue that the initial scroll interaction is lost if the click/press lands on a Wid...
Definition: CelestialOverlay.cpp:13
static void trimCorners(gm::Surface &surface, color::RGBA color, FrameElements::SelectedCorners selectedCorners, Size cornerSize, Size frameSize)
Trim corners on a background surface to allow for rounded corners.
Definition: Frame.cpp:27
BorderStyle
The types of border supported.
Definition: Types.h:50
void setState(bool state)
Set the state, true = inverted.
Definition: Frame.h:165
User Interface Visual types.
static void renderSelectedCorners(gm::Context &context, SelectedCorners selectedCorners, ImageId corner, const Size &size)
Render corner images as part of a border around the frame.
Definition: Frame.cpp:59
Encapsulation of the visual elements of a Frame.
Definition: Frame.h:35
void buttonDisplayStateChange(ButtonDisplayState buttonDisplayState)
Make visual changes to FrameElements for button display.
Definition: Frame.cpp:378