iconbox.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*
  2. * File : iconbox.h
  3. * This file is part of RT-Thread RTOS
  4. * COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team
  5. *
  6. * The license and distribution terms for this file may be
  7. * found in the file LICENSE in this distribution or at
  8. * http://www.rt-thread.org/license/LICENSE
  9. *
  10. * Change Logs:
  11. * Date Author Notes
  12. * 2009-10-16 Bernard first version
  13. */
  14. #ifndef __RTGUI_ICONBOX_H__
  15. #define __RTGUI_ICONBOX_H__
  16. #include <rtgui/rtgui.h>
  17. #include <rtgui/image.h>
  18. #include <rtgui/widgets/widget.h>
  19. DECLARE_CLASS_TYPE(iconbox);
  20. /** Gets the type of a iconbox */
  21. #define RTGUI_ICONBOX_TYPE (RTGUI_TYPE(iconbox))
  22. /** Casts the object to a rtgui_iconbox */
  23. #define RTGUI_ICONBOX(obj) (RTGUI_OBJECT_CAST((obj), RTGUI_ICONBOX_TYPE, rtgui_iconbox_t))
  24. /** Checks if the object is a rtgui_iconbox */
  25. #define RTGUI_IS_ICONBOX(obj) (RTGUI_OBJECT_CHECK_TYPE((obj), RTGUI_ICONBOX_TYPE))
  26. #define RTGUI_ICONBOX_NOTEXT 0x00
  27. #define RTGUI_ICONBOX_TEXT_RIGHT 0x01
  28. #define RTGUI_ICONBOX_TEXT_BELOW 0x02
  29. struct rtgui_iconbox
  30. {
  31. /* inherit from widget */
  32. struct rtgui_widget parent;
  33. /* widget private data */
  34. struct rtgui_image* image;
  35. char *text;
  36. rt_ubase_t text_position;
  37. rt_bool_t selected;
  38. };
  39. typedef struct rtgui_iconbox rtgui_iconbox_t;
  40. struct rtgui_iconbox* rtgui_iconbox_create(struct rtgui_image* image, const char* text, int position);
  41. void rtgui_iconbox_destroy(struct rtgui_iconbox* iconbox);
  42. rt_bool_t rtgui_iconbox_event_handler(struct rtgui_widget* widget, struct rtgui_event* event);
  43. void rtgui_iconbox_set_text_position(struct rtgui_iconbox* iconbox, int position);
  44. #endif