26#include <Objectively/Data.h>
27#include <Objectively/Enum.h>
28#include <Objectively/Dictionary.h>
29#include <Objectively/Array.h>
30#include <Objectively/Set.h>
31#include <Objectively/Resource.h>
44#define ViewAlignmentMaskTop 0x1
45#define ViewAlignmentMaskMiddle 0x2
46#define ViewAlignmentMaskBottom 0x4
47#define ViewAlignmentMaskLeft 0x8
48#define ViewAlignmentMaskCenter 0x10
49#define ViewAlignmentMaskRight 0x20
50#define ViewAlignmentMaskInternal 0x100
52#define ViewAlignmentMaskVertical \
53 (ViewAlignmentMaskTop | ViewAlignmentMaskMiddle | ViewAlignmentMaskBottom)
55#define ViewAlignmentMaskHorizontal \
56 (ViewAlignmentMaskLeft | ViewAlignmentMaskCenter | ViewAlignmentMaskRight)
107#define MakePadding(top, right, bottom, left) \
108 (ViewPadding) { (top), (right), (bottom), (left) }
113#define AddPadding(a, b) \
114 MakePadding(a.top + b.top, a.right + b.right, a.bottom + b.bottom, a.left + b.left)
124typedef struct ViewInterface ViewInterface;
283struct ViewInterface {
288 ObjectInterface parentInterface;
296 bool (*acceptsKeyResponder)(
const View *self);
304 bool (*acceptsTouchResponder)(
const View *self);
313 void (*addClassName)(
View *self,
const char *className);
323 void (*addSubview)(
View *self,
View *subview);
343 View *(*ancestorWithIdentifier)(
const View *self,
const char *identifier);
352 void (*applyStyle)(
View *self,
const Style *style);
379 void (*attachStylesheet)(
View *self, SDL_Window *window);
389 void (*awakeWithCharacters)(
View *self,
const char *chars);
399 void (*awakeWithData)(
View *self,
const Data *data);
410 void (*awakeWithDictionary)(
View *self,
const Dictionary *dictionary);
419 void (*awakeWithResource)(
View *self,
const Resource *resource);
428 void (*awakeWithResourceName)(
View *self,
const char *name);
437 void (*becomeKeyResponder)(
View *self);
446 void (*becomeTouchResponder)(
View *self);
458 bool (*bind)(
View *self,
const Inlet *inlets,
const Dictionary *dictionary);
466 SDL_Rect (*bounds)(
const View *self);
475 void (*bringSubviewToFront)(
View *self,
View *subview);
494 SDL_Rect (*clippingFrame)(
const View *self);
503 bool (*containsPoint)(
const View *self,
const SDL_Point *point);
511 int (*depth)(
const View *self);
520 View *(*descendantWithIdentifier)(
const View *self,
const char *identifier);
529 void (*detachStylesheet)(
View *self, SDL_Window *window);
538 void (*didMoveToWindow)(
View *self, SDL_Window *window);
547 bool (*didReceiveEvent)(
const View *self,
const SDL_Event *event);
571 void (*emitViewEvent)(
View *self,
ViewEvent code, ident data);
611 void (*enumerateDescendants)(
const View *self,
ViewEnumerator enumerator, ident data);
622 void (*enumerateSelection)(
View *self,
const char *rule,
ViewEnumerator enumerator, ident data);
672 bool (*hasClassName)(
const View *self,
const char *className);
680 bool (*hasOverflow)(
const View *self);
690 View *(*hitTest)(
const View *self,
const SDL_Point *point);
713 View *(*initWithFrame)(
View *self,
const SDL_Rect *frame);
721 void (*invalidateStyle)(
View *self);
729 bool (*isContainer)(
const View *self);
738 bool (*isDescendantOfView)(
const View *self,
const View *view);
746 bool (*isKeyResponder)(
const View *self);
754 bool (*isTouchResponder)(
const View *self);
762 bool (*isVisible)(
const View *self);
770 void (*layoutIfNeeded)(
View *self);
780 void (*layoutSubviews)(
View *self);
798 void (*moveToWindow)(
View *self, SDL_Window *window);
806 String *(*path)(
const View *self);
814 void (*removeAllClassNames)(
View *self);
822 void (*removeAllSubviews)(
View *self);
831 void (*removeClassName)(
View *self,
const char *className);
839 void (*removeFromSuperview)(
View *self);
848 void (*removeSubview)(
View *self,
View *subview);
868 void (*renderDeviceDidReset)(
View *self);
877 void (*renderDeviceWillReset)(
View *self);
885 SDL_Rect (*renderFrame)(
const View *self);
895 void (*replaceSubview)(
View *self,
View *subview,
View *replacement);
903 void (*resignKeyResponder)(
View *self);
911 void (*resignTouchResponder)(
View *self);
920 void (*resize)(
View *self,
const SDL_Size *size);
938 void (*respondToEvent)(
View *self,
const SDL_Event *event);
948 Set *(*select)(
View *self,
const char *rule);
958 View *(*selectFirst)(
View *self,
const char *rule);
966 SDL_Size (*size)(
const View *self);
975 SDL_Size (*sizeThatContains)(
const View *self);
985 SDL_Size (*sizeThatFits)(
const View *self);
993 SDL_Size (*sizeThatFills)(
const View *self);
1002 void (*sizeToContain)(
View *self);
1011 void (*sizeToFill)(
View *self);
1020 void (*sizeToFit)(
View *self);
1029 View *(*subviewWithIdentifier)(
const View *self,
const char *identifier);
1038 void (*updateBindings)(
View *self);
1046 SDL_Rect (*viewport)(
const View *self);
1057 View *(*viewWithCharacters)(
const char *chars,
Outlet *outlets);
1068 View *(*viewWithData)(
const Data *data,
Outlet *outlets);
1080 View *(*viewWithDictionary)(
const Dictionary *dictionary,
Outlet *outlets);
1092 View *(*viewWithResource)(
const Resource *resource,
Outlet *outlets);
1104 View *(*viewWithResourceName)(
const char *name,
Outlet *outlets);
1113 Array *(*visibleSubviews)(
const View *self);
1132 void (*willMoveToWindow)(
View *self, SDL_Window *window);
Renderer extends Object with ObjectivelyMVC's UI rendering layer.
static Theme * theme(SDL_Window *window)
ViewEvent
View event relay codes.
void(* ViewEnumerator)(View *view, ident data)
A function type for View enumeration.
#define OBJECTIVELYMVC_EXPORT
JSON data binding for Views.
#define ViewAlignmentMaskInternal
#define ViewAlignmentMaskCenter
OBJECTIVELYMVC_EXPORT Class * _View(void)
#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
Warnings are accumulated on Views so that they may be reported by the DebugViewController.
WarningType
Warning types.
Inlets enable inbound data binding of View attributes through JSON.
Outlets enable outbound data binding of Views through JSON.
Renderer extends Object with ObjectivelyMVC's UI rendering layer.
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.
bool clipsSubviews
If true, subviews will be clipped to this View's frame.
View * superview
The super View.
Array * subviews
The immediate subviews.
ViewController * viewController
The ViewController.
Style * style
The element-level Style of this View.
ViewAlignment alignment
The alignment.
SDL_Window * window
The window.
bool needsApplyTheme
If true, this View will apply the Theme before it is drawn.
SDL_Color borderColor
The border color.
int autoresizingMask
The ViewAutoresizing bitmask.
View * nextResponder
The next responder, or event handler, in the chain.
bool needsLayout
If true, this View will layout its subviews before it is drawn.
char * identifier
An optional identifier.
Array * warnings
The Warnings this View generated.
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.
Set * classNames
The class names.
ViewInterface * interface
The interface.
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.
bool hidden
If true, this View is not drawn.
Spacing applied to the inside of a View's frame.