Posted by ptomaine Fri 16th Feb 2007 16:31 - Syntax is C - 149 views
Download | New Post | Modify | Show line numbers
Download | New Post | Modify | Show line numbers
? etk_text_view_scroll.patch
Index: src/bin/etk_text_view_test.c
===================================================================
RCS file: /var/cvs/e/e17/libs/etk/src/bin/etk_text_view_test.c,v
retrieving revision 1.16
diff -r1.16 etk_text_view_test.c
74a75
> Etk_Widget *scrolled_view;
136a138,141
>
> scrolled_view = etk_scrolled_view_new();
>
> etk_bin_child_set( ETK_BIN(scrolled_view), text_view );
138c143
< etk_box_append(ETK_BOX(vbox), text_view, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0);
---
> etk_box_append(ETK_BOX(vbox), scrolled_view, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0);
Index: src/lib/etk_text_view.c
===================================================================
RCS file: /var/cvs/e/e17/libs/etk/src/lib/etk_text_view.c,v
retrieving revision 1.14
diff -r1.14 etk_text_view.c
28a29,30
> static void _etk_text_view_scroll_size_get(Etk_Widget *widget, Etk_Size scrollview_size, Etk_Size scrollbar_size, Etk_Size *scroll_size);
> static void _etk_text_view_scroll(Etk_Widget *widget, int x, int y);
123a126,128
> ETK_WIDGET(text_view)->scroll = _etk_text_view_scroll;
> ETK_WIDGET(text_view)->scroll_size_get = _etk_text_view_scroll_size_get;
>
266a272,295
> /* Size of all the text_view for scrolling ability. */
> static void _etk_text_view_scroll_size_get(Etk_Widget *widget, Etk_Size scrollview_size, Etk_Size scrollbar_size, Etk_Size *scroll_size)
> {
> Etk_Text_View *text_view;
>
> if(!(text_view = ETK_TEXT_VIEW(widget)) || !scroll_size )
> return;
>
> etk_textblock_object_full_geometry_get( text_view->textblock_object, NULL, NULL, &(scroll_size->w), &(scroll_size->h) );
> }
>
> static void _etk_text_view_scroll(Etk_Widget *widget, int x, int y)
> {
> Etk_Text_View *text_view;
>
> if( !( text_view = ETK_TEXT_VIEW(widget) ) )
> return;
>
> etk_textblock_object_xoffset_set( text_view->textblock_object, x );
> etk_textblock_object_yoffset_set( text_view->textblock_object, y );
>
> etk_widget_redraw_queue( widget );
> }
>
Index: src/lib/etk_textblock.c
===================================================================
RCS file: /var/cvs/e/e17/libs/etk/src/lib/etk_textblock.c,v
retrieving revision 1.29
diff -r1.29 etk_textblock.c
1162a1163,1241
> int etk_textblock_object_yoffset_get( Evas_Object *tbo )
> {
> Etk_Textblock_Object_SD *tbo_sd;
>
> if (!tbo || !(tbo_sd = evas_object_smart_data_get(tbo)))
> return 0;
>
> return tbo_sd->yoffset;
> }
>
> int etk_textblock_object_xoffset_get( Evas_Object *tbo )
> {
> Etk_Textblock_Object_SD *tbo_sd;
>
> if (!tbo || !(tbo_sd = evas_object_smart_data_get(tbo)))
> return 0;
>
> return tbo_sd->xoffset;
> }
>
> void etk_textblock_object_yoffset_set( Evas_Object *tbo, int yoffset )
> {
> Etk_Textblock_Object_SD *tbo_sd;
>
> if (!tbo || !(tbo_sd = evas_object_smart_data_get(tbo)))
> return;
>
> tbo_sd->yoffset = yoffset;
>
> /* TODO: Update the object? */
> }
>
> void etk_textblock_object_xoffset_set( Evas_Object *tbo, int xoffset )
> {
> Etk_Textblock_Object_SD *tbo_sd;
>
> if (!tbo || !(tbo_sd = evas_object_smart_data_get(tbo)))
> return;
>
> tbo_sd->xoffset = xoffset;
>
> /* TODO: Update the object? */
> }
>
> void etk_textblock_object_full_geometry_get( Evas_Object *tbo, int *x, int *y, int *w, int *h )
> {
> if(!tbo)
> return;
>
> if(x)
> {
> evas_object_geometry_get( tbo, x, NULL, NULL, NULL );
> }
>
> if(y)
> {
> evas_object_geometry_get( tbo, NULL, y, NULL, NULL );
> }
>
> if(w)
> {
> evas_object_geometry_get( tbo, NULL, NULL, w, NULL );
> }
>
> if(h)
> {
> Etk_Textblock_Object_SD *tbo_sd;
> Etk_Textblock_Object_Line *line;
>
> *h = 0;
>
> if( !( tbo_sd = evas_object_smart_data_get(tbo) ) )
> return;
>
> for (line = tbo_sd->lines; line; line = line->next)
> *h += line->geometry.h;
> }
> }
>
3551c3630
< y = 0;
---
> y = - tbo_sd->yoffset;
3566c3645
< evas_object_move(line->object, ox + line->geometry.x, oy + line->geometry.y);
---
> evas_object_move(line->object, tbo_sd->xoffset + ox + line->geometry.x, oy + line->geometry.y);
Index: src/lib/etk_textblock.h
===================================================================
RCS file: /var/cvs/e/e17/libs/etk/src/lib/etk_textblock.h,v
retrieving revision 1.17
diff -r1.17 etk_textblock.h
243a244,251
> void etk_textblock_object_yoffset_set( Evas_Object *tbo, int yoffset );
> int etk_textblock_object_yoffset_get( Evas_Object *tbo );
>
> void etk_textblock_object_xoffset_set( Evas_Object *tbo, int xoffset );
> int etk_textblock_object_xoffset_get( Evas_Object *tbo );
>
> void etk_textblock_object_full_geometry_get( Evas_Object *tbo, int *x, int *y, int *w, int *h );
>
Index: src/bin/etk_text_view_test.c
===================================================================
RCS file: /var/cvs/e/e17/libs/etk/src/bin/etk_text_view_test.c,v
retrieving revision 1.16
diff -r1.16 etk_text_view_test.c
74a75
> Etk_Widget *scrolled_view;
136a138,141
>
> scrolled_view = etk_scrolled_view_new();
>
> etk_bin_child_set( ETK_BIN(scrolled_view), text_view );
138c143
< etk_box_append(ETK_BOX(vbox), text_view, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0);
---
> etk_box_append(ETK_BOX(vbox), scrolled_view, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0);
Index: src/lib/etk_text_view.c
===================================================================
RCS file: /var/cvs/e/e17/libs/etk/src/lib/etk_text_view.c,v
retrieving revision 1.14
diff -r1.14 etk_text_view.c
28a29,30
> static void _etk_text_view_scroll_size_get(Etk_Widget *widget, Etk_Size scrollview_size, Etk_Size scrollbar_size, Etk_Size *scroll_size);
> static void _etk_text_view_scroll(Etk_Widget *widget, int x, int y);
123a126,128
> ETK_WIDGET(text_view)->scroll = _etk_text_view_scroll;
> ETK_WIDGET(text_view)->scroll_size_get = _etk_text_view_scroll_size_get;
>
266a272,295
> /* Size of all the text_view for scrolling ability. */
> static void _etk_text_view_scroll_size_get(Etk_Widget *widget, Etk_Size scrollview_size, Etk_Size scrollbar_size, Etk_Size *scroll_size)
> {
> Etk_Text_View *text_view;
>
> if(!(text_view = ETK_TEXT_VIEW(widget)) || !scroll_size )
> return;
>
> etk_textblock_object_full_geometry_get( text_view->textblock_object, NULL, NULL, &(scroll_size->w), &(scroll_size->h) );
> }
>
> static void _etk_text_view_scroll(Etk_Widget *widget, int x, int y)
> {
> Etk_Text_View *text_view;
>
> if( !( text_view = ETK_TEXT_VIEW(widget) ) )
> return;
>
> etk_textblock_object_xoffset_set( text_view->textblock_object, x );
> etk_textblock_object_yoffset_set( text_view->textblock_object, y );
>
> etk_widget_redraw_queue( widget );
> }
>
Index: src/lib/etk_textblock.c
===================================================================
RCS file: /var/cvs/e/e17/libs/etk/src/lib/etk_textblock.c,v
retrieving revision 1.29
diff -r1.29 etk_textblock.c
1162a1163,1241
> int etk_textblock_object_yoffset_get( Evas_Object *tbo )
> {
> Etk_Textblock_Object_SD *tbo_sd;
>
> if (!tbo || !(tbo_sd = evas_object_smart_data_get(tbo)))
> return 0;
>
> return tbo_sd->yoffset;
> }
>
> int etk_textblock_object_xoffset_get( Evas_Object *tbo )
> {
> Etk_Textblock_Object_SD *tbo_sd;
>
> if (!tbo || !(tbo_sd = evas_object_smart_data_get(tbo)))
> return 0;
>
> return tbo_sd->xoffset;
> }
>
> void etk_textblock_object_yoffset_set( Evas_Object *tbo, int yoffset )
> {
> Etk_Textblock_Object_SD *tbo_sd;
>
> if (!tbo || !(tbo_sd = evas_object_smart_data_get(tbo)))
> return;
>
> tbo_sd->yoffset = yoffset;
>
> /* TODO: Update the object? */
> }
>
> void etk_textblock_object_xoffset_set( Evas_Object *tbo, int xoffset )
> {
> Etk_Textblock_Object_SD *tbo_sd;
>
> if (!tbo || !(tbo_sd = evas_object_smart_data_get(tbo)))
> return;
>
> tbo_sd->xoffset = xoffset;
>
> /* TODO: Update the object? */
> }
>
> void etk_textblock_object_full_geometry_get( Evas_Object *tbo, int *x, int *y, int *w, int *h )
> {
> if(!tbo)
> return;
>
> if(x)
> {
> evas_object_geometry_get( tbo, x, NULL, NULL, NULL );
> }
>
> if(y)
> {
> evas_object_geometry_get( tbo, NULL, y, NULL, NULL );
> }
>
> if(w)
> {
> evas_object_geometry_get( tbo, NULL, NULL, w, NULL );
> }
>
> if(h)
> {
> Etk_Textblock_Object_SD *tbo_sd;
> Etk_Textblock_Object_Line *line;
>
> *h = 0;
>
> if( !( tbo_sd = evas_object_smart_data_get(tbo) ) )
> return;
>
> for (line = tbo_sd->lines; line; line = line->next)
> *h += line->geometry.h;
> }
> }
>
3551c3630
< y = 0;
---
> y = - tbo_sd->yoffset;
3566c3645
< evas_object_move(line->object, ox + line->geometry.x, oy + line->geometry.y);
---
> evas_object_move(line->object, tbo_sd->xoffset + ox + line->geometry.x, oy + line->geometry.y);
Index: src/lib/etk_textblock.h
===================================================================
RCS file: /var/cvs/e/e17/libs/etk/src/lib/etk_textblock.h,v
retrieving revision 1.17
diff -r1.17 etk_textblock.h
243a244,251
> void etk_textblock_object_yoffset_set( Evas_Object *tbo, int yoffset );
> int etk_textblock_object_yoffset_get( Evas_Object *tbo );
>
> void etk_textblock_object_xoffset_set( Evas_Object *tbo, int xoffset );
> int etk_textblock_object_xoffset_get( Evas_Object *tbo );
>
> void etk_textblock_object_full_geometry_get( Evas_Object *tbo, int *x, int *y, int *w, int *h );
>
PermaLink to this entry https://pastebin.co.uk/10573
Posted by ptomaine Fri 16th Feb 2007 16:31 - Syntax is C - 149 views
Download | New Post | Modify | Show line numbers
Download | New Post | Modify | Show line numbers
Comments: 0