26#include <Objectively/Data.h>
27#include <Objectively/Enum.h>
28#include <Objectively/MutableDictionary.h>
29#include <Objectively/MutableArray.h>
30#include <Objectively/MutableSet.h>
31#include <Objectively/Resource.h>
43#define ViewAlignmentMaskTop 0x1
44#define ViewAlignmentMaskMiddle 0x2
45#define ViewAlignmentMaskBottom 0x4
46#define ViewAlignmentMaskLeft 0x8
47#define ViewAlignmentMaskCenter 0x10
48#define ViewAlignmentMaskRight 0x20
49#define ViewAlignmentMaskInternal 0x100
51#define ViewAlignmentMaskVertical \
52 (ViewAlignmentMaskTop | ViewAlignmentMaskMiddle | ViewAlignmentMaskBottom)
54#define ViewAlignmentMaskHorizontal \
55 (ViewAlignmentMaskLeft | ViewAlignmentMaskCenter | ViewAlignmentMaskRight)
106#define MakePadding(top, right, bottom, left) \
107 (ViewPadding) { (top), (right), (bottom), (left) }
112#define AddPadding(a, b) \
113 MakePadding(a.top + b.top, a.right + b.right, a.bottom + b.bottom, a.left + b.left)
123typedef struct ViewInterface ViewInterface;
282struct ViewInterface {
287 ObjectInterface parentInterface;
334 View *(*ancestorWithIdentifier)(
const View *self,
const char *identifier);
440 _Bool (*bind)(
View *self,
const Inlet *inlets,
const Dictionary *dictionary);
493 View *(*descendantWithIdentifier)(
const View *self,
const char *identifier);
622 View *(*firstResponder)(SDL_Window *window);
641 View *(*hitTest)(
const View *self,
const SDL_Point *point);
664 View *(*initWithFrame)(
View *self,
const SDL_Rect *frame);
749 String *(*path)(
const View *self);
883 Set *(*select)(
View *self,
const char *rule);
947 View *(*subviewWithIdentifier)(
const View *self,
const char *identifier);
975 View *(*viewWithCharacters)(
const char *chars,
Outlet *outlets);
986 View *(*viewWithData)(
const Data *data,
Outlet *outlets);
998 View *(*viewWithDictionary)(
const Dictionary *dictionary,
Outlet *outlets);
1010 View *(*viewWithResource)(
const Resource *resource,
Outlet *outlets);
1022 View *(*viewWithResourceName)(
const char *name,
Outlet *outlets);
1031 Array *(*visibleSubviews)(
const View *self);
1040 void (*
warn)(
View *self,
const char *fmt, ...);
static void awakeWithDictionary(View *self, const Dictionary *dictionary)
static void layoutSubviews(View *self)
static _Bool matchesSelector(const View *self, const SimpleSelector *simpleSelector)
static void applyStyle(View *self, const Style *style)
static SDL_Size sizeThatFits(const View *self)
static _Bool acceptsFirstResponder(const View *self)
static void respondToEvent(View *self, const SDL_Event *event)
static void render(View *self, Renderer *renderer)
static void renderDeviceDidReset(Font *self)
static void updateBindings(View *self)
static SDL_Size size(const Image *self)
static void renderDeviceWillReset(View *self)
static void removeSubview(View *self, View *subview)
static void addSubview(View *self, View *subview)
The Renderer is responsible for rasterizing the View hierarchy of a WindowController.
static void enumerateSelection(const Selector *self, View *view, ViewEnumerator enumerator, ident data)
static Theme * theme(SDL_Window *window)
void(* ViewEnumerator)(View *view, ident data)
A function type for View enumeration.
#define OBJECTIVELYMVC_EXPORT
JSON data binding for Views.
static void removeClassName(View *self, const char *className)
static _Bool didReceiveEvent(const View *self, const SDL_Event *event)
static void addClassName(View *self, const char *className)
static void warn(View *self, const char *fmt,...)
static void addSubviewRelativeTo(View *self, View *subview, View *other, ViewPosition position)
static void didMoveToWindow(View *self, SDL_Window *window)
static void resize(View *self, const SDL_Size *size)
static _Bool isFirstResponder(const View *self)
static void setFirstResponder(SDL_Window *window, View *view)
static void detachStylesheet(View *self, SDL_Window *window)
static void layoutIfNeeded(View *self)
static void sizeToContain(View *self)
static void enumerateAncestors(const View *self, ViewEnumerator enumerator, ident data)
static int depth(const View *self)
static void draw(View *self, Renderer *renderer)
static void removeAllClassNames(View *self)
static void enumerateSubviews(const View *self, ViewEnumerator enumerator, ident data)
static void becomeFirstResponder(View *self)
static _Bool containsPoint(const View *self, const SDL_Point *point)
static _Bool hasClassName(const View *self, const char *className)
static void replaceSubview(View *self, View *subview, View *replacement)
static void bringSubviewToFront(View *self, View *subview)
static _Bool isContainer(const View *self)
static void resignFirstResponder(View *self)
static void invalidateStyle(View *self)
static void awakeWithCharacters(View *self, const char *chars)
static void moveToWindow(View *self, SDL_Window *window)
static void removeFromSuperview(View *self)
static void removeAllSubviews(View *self)
static SDL_Size sizeThatContains(const View *self)
static void applyTheme(View *self, const Theme *theme)
static void awakeWithResourceName(View *self, const char *name)
static SDL_Rect renderFrame(const View *self)
static void willMoveToWindow(View *self, SDL_Window *window)
static void attachStylesheet(View *self, SDL_Window *window)
static void awakeWithResource(View *self, const Resource *resource)
static void enumerateSuperview(const View *self, ViewEnumerator enumerator, ident data)
static void enumerate(View *self, ViewEnumerator enumerator, ident data)
static void enumerateAdjacent(const View *self, ViewEnumerator enumerator, ident data)
static SDL_Rect viewport(const View *self)
static void applyThemeIfNeeded(View *self, const Theme *theme)
static _Bool isVisible(const View *self)
static void sizeToFit(View *self)
static SDL_Rect clippingFrame(const View *self)
static void enumerateSiblings(const View *self, ViewEnumerator enumerator, ident data)
static void awakeWithData(View *self, const Data *data)
static void enumerateDescendants(const View *self, ViewEnumerator enumerator, ident data)
static SDL_Rect bounds(const View *self)
static void resolve(View *self, Outlet *outlets)
static _Bool isDescendantOfView(const View *self, const View *view)
#define ViewAlignmentMaskInternal
#define ViewAlignmentMaskCenter
#define ViewAlignmentMaskLeft
#define ViewAlignmentMaskBottom
#define ViewAlignmentMaskTop
#define ViewAlignmentMaskRight
#define ViewAlignmentMaskMiddle
ViewPosition
Relative positioning of subviews within their superview.
OBJECTIVELYMVC_EXPORT const EnumName ViewAlignmentNames[]
OBJECTIVELYMVC_EXPORT const EnumName ViewAutoresizingNames[]
ViewAutoresizing
Auto-resizing constants, which are bitmasked.
@ ViewAutoresizingContain
ViewAlignment
Alignment constants, used to align a View within its superview.
@ ViewAlignmentBottomRight
@ ViewAlignmentBottomLeft
@ ViewAlignmentMiddleCenter
@ ViewAlignmentMiddleRight
@ ViewAlignmentMiddleLeft
@ ViewAlignmentBottomCenter
Inlets enable inbound data binding of View attributes through JSON.
Outlets enable outbound data binding of Views through JSON.
The Renderer is responsible for rasterizing the View hierarchy of a WindowController.
Stylesheets are comprised of Selectors and Styles.
A ViewController manages a View and its descendants.
Views are the fundamental building blocks of ObjectivelyMVC user interfaces.
Stylesheet * stylesheet
An optional Stylesheet.
MutableArray * subviews
The immediate subviews.
View * superview
The super View.
MutableArray * warnings
The warnings this View generated.
ViewController * viewController
The ViewController.
_Bool clipsSubviews
If true, subviews will be clipped to this View's frame.
Style * style
The element-level Style of this View.
ViewAlignment alignment
The alignment.
_Bool needsLayout
If true, this View will layout its subviews before it is drawn.
_Bool needsApplyTheme
If true, this View will apply the Theme before it is drawn.
SDL_Window * window
The window.
_Bool hidden
If true, this View is not drawn.
Class * _View(void)
The View archetype.
SDL_Color borderColor
The border color.
int autoresizingMask
The ViewAutoresizing bitmask.
View * nextResponder
The next responder, or event handler, in the chain.
char * identifier
An optional identifier.
ViewPadding padding
The padding.
int borderWidth
The border width.
SDL_Size minSize
The minimum size this View may be resized to during layout.
Object object
The superclass.
Style * computedStyle
The computed Style of this View.
ViewInterface * interface
The interface.
MutableSet * classNames
The class names.
SDL_Size maxSize
The maximum size this View may be resized to during layout.
SDL_Color backgroundColor
The background color.
SDL_Rect frame
The frame, relative to the superview.
Spacing applied to the inside of a View's frame.