Skip to content

Commit

Permalink
Added hspace and vspace spacer elements
Browse files Browse the repository at this point in the history
Sync artist and cairo versions for improved backward compatibility
  • Loading branch information
djowel committed Oct 22, 2023
1 parent 6c34d49 commit 32e0362
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/include/elements/element/element.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ namespace cycfi { namespace elements
class context;
class view;

// Hoist artist colors namespace and type for backward compatibility with
// original cairo API.
using artist::rgba;
namespace colors = artist::colors;

////////////////////////////////////////////////////////////////////////////
// Elements
//
Expand Down
12 changes: 12 additions & 0 deletions lib/include/elements/element/size.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,12 @@ namespace cycfi { namespace elements
return {width, std::forward<Subject>(subject)};
}

inline hsize_element<element>
hspace(float width)
{
return { width, {} };
}

template <typename Subject>
inline view_limits hsize_element<Subject>::limits(basic_context const& ctx) const
{
Expand Down Expand Up @@ -150,6 +156,12 @@ namespace cycfi { namespace elements
return {height, std::forward<Subject>(subject)};
}

inline vsize_element<element>
vspace(float height)
{
return { height, {} };
}

template <typename Subject>
inline view_limits vsize_element<Subject>::limits(basic_context const& ctx) const
{
Expand Down

0 comments on commit 32e0362

Please sign in to comment.