ObjectivelyMVC 0.1.0
Object oriented MVC framework for OpenGL, SDL2 and GNU C
Public Member Functions | Data Fields | Protected Attributes
DebugViewController Struct Reference

The DebugViewController type. More...

#include <DebugViewController.h>

Inheritance diagram for DebugViewController:
ViewController

Public Member Functions

Class * _DebugViewController (void)
 The DebugViewController archetype. More...
 
void debug (DebugViewController *self, const View *view, Renderer *renderer)
 Debugs the given View. More...
 
DebugViewControllerinit (DebugViewController *self)
 Initializes this DebugViewController. More...
 
- Public Member Functions inherited from ViewController
Class * _ViewController (void)
 The ViewController archetype. More...
 
void addChildViewController (ViewController *self, ViewController *childViewController)
 Adds the specified child ViewController to this ViewController. More...
 
void handleNotification (ViewController *self, const Notification *notification)
 Handles a broadcast notification. More...
 
ViewControllerinit (ViewController *self)
 Initializes this ViewController. More...
 
void loadView (ViewController *self)
 Loads this ViewController's View. More...
 
void loadViewIfNeeded (ViewController *self)
 Loads this ViewController's View if it is not already loaded. More...
 
void moveToParentViewController (ViewController *self, ViewController *parentViewController)
 Moves this ViewController to the specified parent. More...
 
void removeChildViewController (ViewController *self, ViewController *childViewController)
 Removes the specified child ViewController from this ViewController. More...
 
void removeFromParentViewController (ViewController *self)
 Removes this ViewController from its parent. More...
 
void respondToEvent (ViewController *self, const SDL_Event *event)
 Responds to the given event. More...
 
void setView (ViewController *self, View *view)
 Sets this ViewController's View. More...
 
void viewDidAppear (ViewController *self)
 This method is invoked after this ViewController's View is added to the View hierarchy. More...
 
void viewDidDisappear (ViewController *self)
 This method is invoked after this ViewController's View is removed to the View hierarchy. More...
 
void viewWillAppear (ViewController *self)
 This method is invoked before this ViewController's View is added to the View hierarchy. More...
 
void viewWillDisappear (ViewController *self)
 This method is invoked before this ViewController's View is removed from the View hierarchy. More...
 

Data Fields

TableViewcomputedStyle
 The computed style of the View. More...
 
const Viewdebug
 The View to debug. More...
 
Textdescription
 The View description. More...
 
int frames
 
Textpath
 The path to the debug View. More...
 
Rendererrenderer
 A weak referece to the current WindowController's renderer. More...
 
const Viewroot
 The root ancestor of the debug View. More...
 
TableViewselectors
 The CSS selectors matching the View. More...
 
Textstatistics
 
int timestamp
 
ViewController viewController
 The superclass. More...
 
int visibleViews
 The count of visibile Views. More...
 
TableViewwarnings
 The warnings generated by the View. More...
 
- Data Fields inherited from ViewController
MutableArray * childViewControllers
 The child view controllers. More...
 
ViewControllerInterface * interface
 The interface. More...
 
Object object
 The superclass. More...
 
ViewControllerparentViewController
 The parent view controller. More...
 
Viewview
 The main view. More...
 

Protected Attributes

DebugViewControllerInterface * interface
 The interface. More...
 

Detailed Description

The DebugViewController type.

Definition at line 41 of file DebugViewController.h.

Member Function Documentation

◆ _DebugViewController()

Class * _DebugViewController ( void  )

The DebugViewController archetype.

Returns
The DebugViewController Class.

Definition at line 336 of file DebugViewController.c.

336 {
337 static Class *clazz;
338 static Once once;
339
340 do_once(&once, {
341 clazz = _initialize(&(const ClassDef) {
342 .name = "DebugViewController",
343 .superclass = _ViewController(),
344 .instanceSize = sizeof(DebugViewController),
345 .interfaceOffset = offsetof(DebugViewController, interface),
346 .interfaceSize = sizeof(DebugViewControllerInterface),
348 });
349 });
350
351 return clazz;
352}
static void initialize(Class *clazz)
The DebugViewController type.
DebugViewControllerInterface * interface
The interface.
Class * _ViewController(void)
The ViewController archetype.

◆ debug()

void debug ( DebugViewController self,
const View view,
Renderer renderer 
)

Debugs the given View.

Parameters
selfThe DebugViewController.
viewThe View to debug.
rendererThe Renderer to draw debugging information with.

Definition at line 259 of file DebugViewController.c.

259 {
260
261 if (view != self->debug) {
262 self->debug = view;
263
264 if (self->debug) {
265 self->root = self->debug;
266 while (self->root->superview) {
267 self->root = self->root->superview;
268 }
269
270 String *path = $(self->debug, path);
271 $(self->path, setText, path->chars);
272 release(path);
273
274 String *description = $((Object *) view, description);
275 $(self->description, setText, description->chars);
276 release(description);
277 } else {
278 $(self->path, setText, NULL);
279 $(self->description, setText, NULL);
280 }
281
282 $(self->selectors, reloadData);
283 $((View *) self->selectors, sizeToFit);
284
285 $(self->computedStyle, reloadData);
286 $((View *) self->computedStyle, sizeToFit);
287
288 $(self->warnings, reloadData);
289 $((View *) self->warnings, sizeToFit);
290 }
291
292 self->renderer = renderer;
293 assert(self->renderer);
294
295 self->visibleViews = 0;
296
297 if (self->root) {
298 $((View *) self->root, enumerate, debugEnumerate, self);
299 }
300
301 self->frames++;
302 if (SDL_GetTicks() - self->timestamp >= 1000) {
303
304 $(self->statistics, setTextWithFormat, "%d views, %dfps", self->visibleViews, self->frames);
305
306 self->timestamp = SDL_GetTicks();
307 self->frames = 0;
308 }
309}
static void reloadData(CollectionView *self)
static void debugEnumerate(View *view, ident data)
static void setTextWithFormat(Text *self, const char *fmt,...)
Definition: Text.c:289
static void setText(Text *self, const char *text)
Definition: Text.c:261
static void enumerate(View *self, ViewEnumerator enumerator, ident data)
Definition: View.c:588
static void sizeToFit(View *self)
Definition: View.c:1496
TableView * selectors
The CSS selectors matching the View.
const View * debug
The View to debug.
TableView * computedStyle
The computed style of the View.
int visibleViews
The count of visibile Views.
Renderer * renderer
A weak referece to the current WindowController's renderer.
TableView * warnings
The warnings generated by the View.
Text * description
The View description.
const View * root
The root ancestor of the debug View.
Text * path
The path to the debug View.
View * view
The main view.
Views are the fundamental building blocks of ObjectivelyMVC user interfaces.
Definition: View.h:133
View * superview
The super View.
Definition: View.h:258

◆ init()

Initializes this DebugViewController.

Parameters
selfThe DebugViewController.
Returns
The initialized DebugViewController, or NULL on error.

Definition at line 315 of file DebugViewController.c.

315 {
316 return (DebugViewController *) super(ViewController, self, init);
317}
DebugViewController * init(DebugViewController *self)
Initializes this DebugViewController.
A ViewController manages a View and its descendants.

Field Documentation

◆ computedStyle

TableView* DebugViewController::computedStyle

The computed style of the View.

Definition at line 102 of file DebugViewController.h.

◆ debug

const View* DebugViewController::debug

The View to debug.

Definition at line 57 of file DebugViewController.h.

◆ description

Text* DebugViewController::description

The View description.

Definition at line 92 of file DebugViewController.h.

◆ frames

int DebugViewController::frames

Framerate counters.

Definition at line 82 of file DebugViewController.h.

◆ interface

DebugViewControllerInterface* DebugViewController::interface
protected

The interface.

Definition at line 52 of file DebugViewController.h.

◆ path

Text* DebugViewController::path

The path to the debug View.

Definition at line 77 of file DebugViewController.h.

◆ renderer

Renderer* DebugViewController::renderer

A weak referece to the current WindowController's renderer.

Definition at line 67 of file DebugViewController.h.

◆ root

const View* DebugViewController::root

The root ancestor of the debug View.

Definition at line 62 of file DebugViewController.h.

◆ selectors

TableView* DebugViewController::selectors

The CSS selectors matching the View.

Definition at line 97 of file DebugViewController.h.

◆ statistics

Text* DebugViewController::statistics

The debug statistics.

Definition at line 72 of file DebugViewController.h.

◆ timestamp

int DebugViewController::timestamp

Definition at line 82 of file DebugViewController.h.

◆ viewController

ViewController DebugViewController::viewController

The superclass.

Definition at line 46 of file DebugViewController.h.

◆ visibleViews

int DebugViewController::visibleViews

The count of visibile Views.

Definition at line 87 of file DebugViewController.h.

◆ warnings

TableView* DebugViewController::warnings

The warnings generated by the View.

Definition at line 107 of file DebugViewController.h.


The documentation for this struct was generated from the following files: