notebook.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #ifndef __RTGUI_NOTEBOOK_H__
  2. #define __RTGUI_NOTEBOOK_H__
  3. #include <rtgui/rtgui.h>
  4. #include <rtgui/widgets/container.h>
  5. DECLARE_CLASS_TYPE(notebook);
  6. /** Gets the type of a notebook */
  7. #define RTGUI_NOTEBOOK_TYPE (RTGUI_TYPE(notebook))
  8. /** Casts the object to a notebook control */
  9. #define RTGUI_NOTEBOOK(obj) (RTGUI_OBJECT_CAST((obj), RTGUI_NOTEBOOK_TYPE, rtgui_notebook_t))
  10. /** Checks if the object is a notebook control */
  11. #define RTGUI_IS_NOTEBOOK(obj) (RTGUI_OBJECT_CHECK_TYPE((obj), RTGUI_NOTEBOOK_TYPE))
  12. #define RTGUI_NOTEBOOK_TOP 0x00
  13. #define RTGUI_NOTEBOOK_BOTTOM 0x01
  14. #define RTGUI_NOTEBOOK_NOTAB 0x02
  15. struct rtgui_notebook_tab
  16. {
  17. char* title;
  18. struct rtgui_widget* widget;
  19. };
  20. typedef struct rtgui_notebook_tab rtgui_notebook_tab_t;
  21. struct rtgui_notebook
  22. {
  23. struct rtgui_container parent;
  24. rt_uint8_t flag;
  25. /* widget private data */
  26. rtgui_notebook_tab_t* childs;
  27. rt_uint16_t count;
  28. rt_int16_t current;
  29. };
  30. typedef struct rtgui_notebook rtgui_notebook_t;
  31. rtgui_type_t *rtgui_notebook_type_get(void);
  32. rtgui_notebook_t* rtgui_notebook_create(const rtgui_rect_t* rect, rt_uint8_t style);
  33. void rtgui_notebook_destroy(rtgui_notebook_t* notebook);
  34. void rtgui_notebook_add(rtgui_notebook_t* notebook, const char* label, rtgui_widget_t* child);
  35. int rtgui_notebook_get_count(rtgui_notebook_t* notebook);
  36. rtgui_widget_t* rtgui_notebook_get_current(rtgui_notebook_t* notebook);
  37. void rtgui_notebook_set_current(rtgui_notebook_t* notebook, rtgui_widget_t* widget);
  38. void rtgui_notebook_set_current_by_index(rtgui_notebook_t* notebook, rt_uint16_t index);
  39. rtgui_widget_t* rtgui_notebook_get_index(rtgui_notebook_t* notebook, rt_uint16_t index);
  40. rt_bool_t rtgui_notebook_event_handler(struct rtgui_widget* widget, struct rtgui_event* event);
  41. #endif