iconbox.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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 <topwin.h>
  18. #include <rtgui/image.h>
  19. #include <rtgui/font.h>
  20. #include <rtgui/widgets/widget.h>
  21. /** Gets the type of a iconbox */
  22. #define RTGUI_ICONBOX_TYPE (rtgui_iconbox_type_get())
  23. /** Casts the object to a rtgui_iconbox_t */
  24. #define RTGUI_ICONBOX(obj) (RTGUI_OBJECT_CAST((obj), RTGUI_ICONBOX_TYPE, rtgui_iconbox_t))
  25. /** Checks if the object is a rtgui_iconbox_t */
  26. #define RTGUI_IS_ICONBOX(obj) (RTGUI_OBJECT_CHECK_TYPE((obj), RTGUI_ICONBOX_TYPE))
  27. #define RTGUI_ICONBOX_NOTEXT 0x00
  28. #define RTGUI_ICONBOX_TEXT_RIGHT 0x01
  29. #define RTGUI_ICONBOX_TEXT_BELOW 0x02
  30. #define RTGUI_ICONBOX_AREA 76
  31. struct rtgui_iconbox
  32. {
  33. rtgui_widget_t parent; /* inherit from widget */
  34. rtgui_image_t* image; /* widget private data */
  35. char *text;
  36. void (*call)(void);
  37. rt_uint32_t text_position;
  38. rt_bool_t selected;
  39. };
  40. typedef struct rtgui_iconbox rtgui_iconbox_t;
  41. rtgui_type_t *rtgui_iconbox_type_get(void);
  42. rtgui_iconbox_t* rtgui_iconbox_create(PVOID parent, rtgui_image_t* image, const char* text, int position);
  43. void rtgui_iconbox_destroy(rtgui_iconbox_t* iconbox);
  44. rt_bool_t rtgui_iconbox_event_handler(PVOID wdt, rtgui_event_t* event);
  45. void rtgui_iconbox_set_text_position(rtgui_iconbox_t* iconbox, int position);
  46. #endif