view_stack.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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. #ifdef __cplusplus
  14. extern "C" {
  15. #endif
  16. /** ViewStack, anonymous type. */
  17. typedef struct ViewStack ViewStack;
  18. /** Allocate and init ViewStack
  19. *
  20. * @return ViewStack instance
  21. */
  22. ViewStack* view_stack_alloc(void);
  23. /** Free ViewStack instance
  24. *
  25. * @param view_stack instance
  26. */
  27. void view_stack_free(ViewStack* view_stack);
  28. /** Get View of ViewStack.
  29. * Should this View to any view manager such as
  30. * ViewDispatcher or ViewHolder.
  31. *
  32. * @param view_stack instance
  33. */
  34. View* view_stack_get_view(ViewStack* view_stack);
  35. /** Add View to ViewStack.
  36. * Adds View on top of ViewStack.
  37. *
  38. * @param view_stack instance
  39. * @view view view to add
  40. */
  41. void view_stack_add_view(ViewStack* view_stack, View* view);
  42. /** Remove any View in ViewStack.
  43. * If no View to remove found - ignore.
  44. *
  45. * @param view_stack instance
  46. * @view view view to remove
  47. */
  48. void view_stack_remove_view(ViewStack* view_stack, View* view);
  49. #ifdef __cplusplus
  50. }
  51. #endif