view_stack.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /**
  2. * @file view_stack.h
  3. * GUI: ViewStack API
  4. *
  5. * ViewStack accumulates several Views in one stack.
  6. * Draw callbacks are called sequenctially starting from
  7. * first added. Input callbacks are called in reverse order.
  8. * Consumed input is not passed on underlying layers.
  9. */
  10. #pragma once
  11. #include <stdbool.h>
  12. #include "view.h"
  13. /** ViewStack, anonymous type. */
  14. typedef struct ViewStack ViewStack;
  15. /** Allocate and init ViewStack
  16. *
  17. * @return ViewStack instance
  18. */
  19. ViewStack* view_stack_alloc(void);
  20. /** Free ViewStack instance
  21. *
  22. * @param view_stack instance
  23. */
  24. void view_stack_free(ViewStack* view_stack);
  25. /** Get View of ViewStack.
  26. * Should this View to any view manager such as
  27. * ViewDispatcher or ViewHolder.
  28. *
  29. * @param view_stack instance
  30. */
  31. View* view_stack_get_view(ViewStack* view_stack);
  32. /** Add View to ViewStack.
  33. * Adds View on top of ViewStack.
  34. *
  35. * @param view_stack instance
  36. * @view view view to add
  37. */
  38. void view_stack_add_view(ViewStack* view_stack, View* view);
  39. /** Remove any View in ViewStack.
  40. * If no View to remove found - ignore.
  41. *
  42. * @param view_stack instance
  43. * @view view view to remove
  44. */
  45. void view_stack_remove_view(ViewStack* view_stack, View* view);