iconbox.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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. /** Gets the type of a iconbox */
  20. #define RTGUI_ICONBOX_TYPE (rtgui_iconbox_type_get())
  21. /** Casts the object to a rtgui_iconbox */
  22. #define RTGUI_ICONBOX(obj) (RTGUI_OBJECT_CAST((obj), RTGUI_ICONBOX_TYPE, rtgui_iconbox_t))
  23. /** Checks if the object is a rtgui_iconbox */
  24. #define RTGUI_IS_ICONBOX(obj) (RTGUI_OBJECT_CHECK_TYPE((obj), RTGUI_ICONBOX_TYPE))
  25. #define RTGUI_ICONBOX_NOTEXT 0x00
  26. #define RTGUI_ICONBOX_TEXT_RIGHT 0x01
  27. #define RTGUI_ICONBOX_TEXT_BELOW 0x02
  28. struct rtgui_iconbox
  29. {
  30. /* inherit from widget */
  31. struct rtgui_widget parent;
  32. /* widget private data */
  33. struct rtgui_image* image;
  34. char *text;
  35. rt_ubase_t text_position;
  36. rt_bool_t selected;
  37. };
  38. typedef struct rtgui_iconbox rtgui_iconbox_t;
  39. rtgui_type_t *rtgui_iconbox_type_get(void);
  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