Posted by ptomaine Fri 16th Feb 2007 16:31 - Syntax is C - 38 views
Download | New Post | Modify | Hide line numbers
  1. ? etk_text_view_scroll.patch
  2. Index: src/bin/etk_text_view_test.c
  3. ===================================================================
  4. RCS file: /var/cvs/e/e17/libs/etk/src/bin/etk_text_view_test.c,v
  5. retrieving revision 1.16
  6. diff -r1.16 etk_text_view_test.c
  7. 74a75
  8. >    Etk_Widget *scrolled_view;
  9. 136a138,141
  10. >
  11. >    scrolled_view = etk_scrolled_view_new();
  12. >
  13. >    etk_bin_child_set( ETK_BIN(scrolled_view), text_view );
  14. 138c143
  15. <    etk_box_append(ETK_BOX(vbox), text_view, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0);
  16. ---
  17. >    etk_box_append(ETK_BOX(vbox), scrolled_view, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0);
  18. Index: src/lib/etk_text_view.c
  19. ===================================================================
  20. RCS file: /var/cvs/e/e17/libs/etk/src/lib/etk_text_view.c,v
  21. retrieving revision 1.14
  22. diff -r1.14 etk_text_view.c
  23. 28a29,30
  24. > static void _etk_text_view_scroll_size_get(Etk_Widget *widget, Etk_Size scrollview_size, Etk_Size scrollbar_size, Etk_Size *scroll_size);
  25. > static void _etk_text_view_scroll(Etk_Widget *widget, int x, int y);
  26. 123a126,128
  27. >    ETK_WIDGET(text_view)->scroll = _etk_text_view_scroll;
  28. >    ETK_WIDGET(text_view)->scroll_size_get = _etk_text_view_scroll_size_get;
  29. >
  30. 266a272,295
  31. > /* Size of all the text_view for scrolling ability. */
  32. > static void _etk_text_view_scroll_size_get(Etk_Widget *widget, Etk_Size scrollview_size, Etk_Size scrollbar_size, Etk_Size *scroll_size)
  33. > {
  34. >    Etk_Text_View *text_view;
  35. >   
  36. >    if(!(text_view = ETK_TEXT_VIEW(widget)) || !scroll_size )
  37. >       return;
  38. >
  39. >    etk_textblock_object_full_geometry_get( text_view->textblock_object, NULL, NULL, &(scroll_size->w), &(scroll_size->h) );
  40. > }
  41. >
  42. > static void _etk_text_view_scroll(Etk_Widget *widget, int x, int y)
  43. > {
  44. >    Etk_Text_View *text_view;
  45. >
  46. >    if( !( text_view = ETK_TEXT_VIEW(widget) ) )
  47. >       return;
  48. >
  49. >    etk_textblock_object_xoffset_set( text_view->textblock_object, x );
  50. >    etk_textblock_object_yoffset_set( text_view->textblock_object, y );
  51. >
  52. >    etk_widget_redraw_queue( widget );
  53. > }
  54. >
  55. Index: src/lib/etk_textblock.c
  56. ===================================================================
  57. RCS file: /var/cvs/e/e17/libs/etk/src/lib/etk_textblock.c,v
  58. retrieving revision 1.29
  59. diff -r1.29 etk_textblock.c
  60. 1162a1163,1241
  61. > int etk_textblock_object_yoffset_get( Evas_Object *tbo )
  62. > {
  63. >    Etk_Textblock_Object_SD *tbo_sd;
  64. >
  65. >    if (!tbo || !(tbo_sd = evas_object_smart_data_get(tbo)))
  66. >        return 0;
  67. >
  68. >     return tbo_sd->yoffset;
  69. > }
  70. >
  71. > int etk_textblock_object_xoffset_get( Evas_Object *tbo )
  72. > {
  73. >    Etk_Textblock_Object_SD *tbo_sd;
  74. >   
  75. >    if (!tbo || !(tbo_sd = evas_object_smart_data_get(tbo)))
  76. >       return 0;
  77. >
  78. >    return tbo_sd->xoffset;
  79. > }
  80. >
  81. > void etk_textblock_object_yoffset_set( Evas_Object *tbo, int yoffset )
  82. > {
  83. >    Etk_Textblock_Object_SD *tbo_sd;
  84. >
  85. >    if (!tbo || !(tbo_sd = evas_object_smart_data_get(tbo)))
  86. >       return;
  87. >
  88. >    tbo_sd->yoffset = yoffset;
  89. >
  90. >    /* TODO: Update the object? */
  91. > }
  92. >
  93. > void etk_textblock_object_xoffset_set( Evas_Object *tbo, int xoffset )
  94. > {
  95. >    Etk_Textblock_Object_SD *tbo_sd;
  96. >
  97. >    if (!tbo || !(tbo_sd = evas_object_smart_data_get(tbo)))
  98. >       return;
  99. >
  100. >     tbo_sd->xoffset = xoffset;
  101. >
  102. >    /* TODO: Update the object? */
  103. > }
  104. >
  105. > void etk_textblock_object_full_geometry_get( Evas_Object *tbo, int *x, int *y, int *w, int *h )
  106. > {
  107. >    if(!tbo)
  108. >       return;
  109. >
  110. >    if(x)
  111. >    {
  112. >       evas_object_geometry_get( tbo, x, NULL, NULL, NULL );   
  113. >    }
  114. >
  115. >    if(y)
  116. >    {
  117. >       evas_object_geometry_get( tbo, NULL, y, NULL, NULL );
  118. >    }
  119. >
  120. >    if(w)
  121. >    {
  122. >       evas_object_geometry_get( tbo, NULL, NULL, w, NULL );
  123. >    }
  124. >
  125. >    if(h)
  126. >    {
  127. >        Etk_Textblock_Object_SD *tbo_sd;
  128. >        Etk_Textblock_Object_Line *line;
  129. >
  130. >        *h = 0;
  131. >
  132. >        if( !( tbo_sd = evas_object_smart_data_get(tbo) ) )
  133. >           return;
  134. >
  135. >        for (line = tbo_sd->lines; line; line = line->next)
  136. >           *h += line->geometry.h;
  137. >     }
  138. > }
  139. >
  140. 3551c3630
  141. <    y = 0;
  142. ---
  143. >    y = - tbo_sd->yoffset;
  144. 3566c3645
  145. <             evas_object_move(line->object, ox + line->geometry.x, oy + line->geometry.y);
  146. ---
  147. >             evas_object_move(line->object, tbo_sd->xoffset + ox + line->geometry.x, oy + line->geometry.y);
  148. Index: src/lib/etk_textblock.h
  149. ===================================================================
  150. RCS file: /var/cvs/e/e17/libs/etk/src/lib/etk_textblock.h,v
  151. retrieving revision 1.17
  152. diff -r1.17 etk_textblock.h
  153. 243a244,251
  154. > void etk_textblock_object_yoffset_set( Evas_Object *tbo, int yoffset );
  155. > int etk_textblock_object_yoffset_get( Evas_Object *tbo );
  156. >
  157. > void etk_textblock_object_xoffset_set( Evas_Object *tbo, int xoffset );
  158. > int etk_textblock_object_xoffset_get( Evas_Object *tbo );
  159. >
  160. > void etk_textblock_object_full_geometry_get( Evas_Object *tbo, int *x, int *y, int *w, int *h );
  161. >

PermaLink to this entry https://pastebin.co.uk/10573
Posted by ptomaine Fri 16th Feb 2007 16:31 - Syntax is C - 38 views
Download | New Post | Modify | Hide line numbers

 

Comments: 0