label.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*
  2. * File : label.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_LABEL_H__
  15. #define __RTGUI_LABEL_H__
  16. #include <rtgui/rtgui.h>
  17. #include <rtgui/widgets/widget.h>
  18. DECLARE_CLASS_TYPE(label);
  19. /** Gets the type of a button */
  20. #define RTGUI_LABEL_TYPE (RTGUI_TYPE(label))
  21. /** Casts the object to an rtgui_button */
  22. #define RTGUI_LABEL(obj) (RTGUI_OBJECT_CAST((obj), RTGUI_LABEL_TYPE, rtgui_label_t))
  23. /** Checks if the object is an rtgui_button */
  24. #define RTGUI_IS_LABEL(obj) (RTGUI_OBJECT_CHECK_TYPE((obj), RTGUI_LABEL_TYPE))
  25. /*
  26. * the label widget
  27. */
  28. struct rtgui_label
  29. {
  30. struct rtgui_widget parent;
  31. /* label */
  32. char* text;
  33. };
  34. typedef struct rtgui_label rtgui_label_t;
  35. rtgui_label_t* rtgui_label_create(const char* text);
  36. void rtgui_label_destroy(rtgui_label_t* label);
  37. rt_bool_t rtgui_label_event_handler(struct rtgui_widget* widget, struct rtgui_event* event);
  38. void rtgui_label_set_text(rtgui_label_t* label, const char* text);
  39. char* rtgui_label_get_text(rtgui_label_t* label);
  40. #endif