notebook.c 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. #include <rtgui/rtgui.h>
  2. #include <rtgui/widgets/notebook.h>
  3. rtgui_type_t *rtgui_notebook_type_get(void)
  4. {
  5. }
  6. rtgui_notebook_t* rtgui_notebook_create(const rtgui_rect_t* rect)
  7. {
  8. }
  9. void rtgui_notebook_destroy(rtgui_notebook_t* notebook)
  10. {
  11. }
  12. void rtgui_notebook_add(rtgui_notebook_t* notebook, const char* label, rtgui_widget_t* child)
  13. {
  14. }
  15. int rtgui_notebook_get_count(rtgui_notebootk_t* notebook)
  16. {
  17. return notebook->count;
  18. }
  19. rtgui_widget_t* rtgui_notebook_get_current(rtgui_notebook_t* notebook)
  20. {
  21. RT_ASSERT(notebook != RT_NULL);
  22. if (notebook->current != RTGUI_NOT_FOUND)
  23. return &notebook->childs[notebook->current];
  24. return RT_NULL;
  25. }
  26. void rtgui_notebook_set_current(rtgui_notebook_t* notebook, rtgui_widget_t* widget)
  27. {
  28. rt_int16_t index;
  29. RT_ASSERT(notebook != RT_NULL);
  30. for (index = 0; index < notebook->count; index ++)
  31. {
  32. if (widget == &notebook->childs[index])
  33. {
  34. rtgui_notebook_set_current_by_index(notebook, index);
  35. return;
  36. }
  37. }
  38. }
  39. void rtgui_notebook_set_current_by_index(rtgui_notebook_t* notebook, rt_uint16_t index)
  40. {
  41. RT_ASSERT(notebook != RT_NULL);
  42. if ((index < notebook->count) && (notebook->current != index))
  43. {
  44. if (notebook->current != RTGUI_NOT_FOUND)
  45. rtgui_widget_hide(&notebook->childs[notebook->current]);
  46. notebook->current = index;
  47. rtgui_widget_show(&notebook->childs[notebook->current]);
  48. rtgui_widget_update(&notebook->childs[notebook->current]);
  49. }
  50. }
  51. rtgui_widget_t* rtgui_notebook_get_index(rtgui_notebook_t* notebook, rt_uint16_t index)
  52. {
  53. RT_ASSERT(notebook != RT_NULL);
  54. if (index < notebook->count)
  55. return &notebook->childs[index];
  56. return RT_NULL;
  57. }
  58. rt_bool_t rtgui_notebook_event_handler(struct rtgui_widget* widget, struct rtgui_event* event)
  59. {
  60. return RT_FALSE;
  61. }