intake_num.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /* MegaZeux
  2. *
  3. * Copyright (C) 2018 Alice Rowan <petrifiedrowan@gmail.com>
  4. *
  5. * This program is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU General Public License as
  7. * published by the Free Software Foundation; either version 2 of
  8. * the License, or (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13. * General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program; if not, write to the Free Software
  17. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  18. */
  19. #ifndef __INTAKE_NUM_H
  20. #define __INTAKE_NUM_H
  21. #include "compat.h"
  22. __M_BEGIN_DECLS
  23. #include "core.h"
  24. /**
  25. * Create a context for number entry. On exit if the number was changed, the
  26. * callback will be executed using the parent context and the final value as
  27. * inputs.
  28. *
  29. * @param parent Calling context/context to receive result.
  30. * @param value Initial number value.
  31. * @param min_val Minimum possible value.
  32. * @param max_val Maximum possible value.
  33. * @param x X position to display the number onscreen.
  34. * @param y Y position to display the number onscreen.
  35. * @param min_width Minimum width of the number display.
  36. * @param color Color of the number display.
  37. * @param callback Function to be called after a number is entered.
  38. * @return The new intake_num context.
  39. */
  40. CORE_LIBSPEC
  41. context *intake_num(context *parent, int value, int min_val, int max_val,
  42. int x, int y, int min_width, int color, void (*callback)(context *, int));
  43. __M_END_DECLS
  44. #endif // __INTAKE_NUM_H