diff --git a/src/post_modules/GTK/build_pgtk.pike b/src/post_modules/GTK/build_pgtk.pike index 3b5afea1b4d8054ab11ee5324143b28d7de8db2d..1b329837ed39a6abc3123fe48321989604d38593 100755 --- a/src/post_modules/GTK/build_pgtk.pike +++ b/src/post_modules/GTK/build_pgtk.pike @@ -511,7 +511,9 @@ void do_default_sprintf( int args, int offset, int len ) docs[progname+last_function] += "\n"+line; } } - else if(sscanf(line, "array %s %s[%s];", string type, line, string size ) ) + else if(sscanf(line, "%[A-Z ]array %s %s[%s];", + string alloctype, + string type, line, string size ) > 2 ) { string ptype; int and, star; @@ -552,10 +554,31 @@ void do_default_sprintf( int args, int offset, int len ) "( THIS->obj )->"+line+"[n]));\n"); } else { if( sscanf( type, "GDK.%s", type ) ) - emit(" push_gdkobject( "+ - (and?"&":"")+(star?"*":"")+ - "("+castname("GTK_"+upper_case( progname ))+ - "( THIS->obj )->"+line+"[n]), "+type+");\n" ); + { + if( alloctype == "COPY" ) + { + emit( " {\n"); + emit( +" Gdk"+type+" *tmp = malloc( sizeof( Gdk"+type+" ) );\n" +" *tmp = "+(star?"**":(and?"":"*"))+ +"("+castname("GTK_"+upper_case( progname ))+ +"( THIS->obj )->"+line+"[n]);\n" +" push_gdkobject( tmp, "+type+" );\n" ); + emit( " }\n"); + } + else + { + emit(" push_gdkobject( "+ + (and?"&":"")+(star?"*":"")+ + "("+castname("GTK_"+upper_case( progname ))+ + "( THIS->obj )->"+line+"[n]), "+type+");\n" ); + if( alloctype == "REF" ) + emit( " gdk_"+lower_case(type)+"_ref( "+ + (and?"&":"")+(star?"*":"")+ + "("+castname("GTK_"+upper_case( progname ))+ + "( THIS->obj )->"+line+"[n]) );\n" ); + } + } else { sscanf( type, "GTK.%s", type ); @@ -570,11 +593,13 @@ void do_default_sprintf( int args, int offset, int len ) emit("}\n"); if( current_define ) emit( "#endif\n"); } - else if(sscanf(line, "member %s %s;", string type, line ) ) + else if(sscanf(line, "%[A-Z ]member %s %s;", string alloctype, + string type, line ) > 1) { string ptype; int and, star; signal_doc=0; + alloctype = String.trim_whites( alloctype ); line = String.trim_whites( line ); type = String.trim_whites( type ); and = sscanf( type, "&%s", type ) || sscanf(line,"&%s",line); @@ -605,10 +630,31 @@ void do_default_sprintf( int args, int offset, int len ) "( THIS->obj )->"+line+"));\n"); } else { if( sscanf( type, "GDK.%s", type ) ) - emit(" push_gdkobject( "+ - (and?"&":"")+(star?"*":"")+ - "("+castname("GTK_"+upper_case( progname ))+ - "( THIS->obj )->"+line+"), "+type+");\n" ); + { + if( alloctype == "COPY" ) + { + emit( " {\n"); + emit( + " Gdk"+type+" *tmp = malloc( sizeof( Gdk"+type+" ) );\n" + " *tmp = "+(star?"**":(and?"":"*"))+ + "("+castname("GTK_"+upper_case( progname ))+ + "( THIS->obj )->"+line+");\n" + " push_gdkobject( tmp, "+type+" );\n" ); + emit( " }\n"); + } + else + { + emit(" push_gdkobject( "+ + (and?"&":"")+(star?"*":"")+ + "("+castname("GTK_"+upper_case( progname ))+ + "( THIS->obj )->"+line+"), "+type+");\n" ); + if( alloctype == "REF" ) + emit( " gdk_"+lower_case(type)+"_ref( "+ + (and?"&":"")+(star?"*":"")+ + "("+castname("GTK_"+upper_case( progname ))+ + "( THIS->obj )->"+line+") );\n" ); + } + } else { sscanf( type, "GTK.%s", type ); diff --git a/src/post_modules/GTK/source/gdkgc.pre b/src/post_modules/GTK/source/gdkgc.pre index a22dfcf8ed307ba52cc12e2231fc3aa0851b8a1c..cecce17e126eddec4e8e3753f5ab72c6fb0070dd 100644 --- a/src/post_modules/GTK/source/gdkgc.pre +++ b/src/post_modules/GTK/source/gdkgc.pre @@ -26,6 +26,51 @@ FUNCTION(destoy, "function(void:void)"); gdk_gc_destroy( (GdkGC*)THIS->obj ); destruct(Pike_fp->current_object); } + +FUNCTION(get_values, "function(void:mapping)"); +RETURNS(mapping(string:mixed)); +// Get all (or rather most) values from the GC. +{ + GdkGCValues v; + struct svalue *osp; + if( args ) my_pop_n_elems( args ); + + gdk_gc_get_values( (GdkGC*)THIS->obj, &v ); + + osp = Pike_sp; + push_text( "join_style" ); push_int( v.join_style ); + push_text( "cap_style" ); push_int( v.cap_style ); + push_text( "line_style" ); push_int( v.line_style ); + push_text( "line_width" ); push_int( v.line_width ); + push_text( "clip_x_origin" ); push_int( v.clip_x_origin ); + push_text( "clip_y_origin" ); push_int( v.clip_y_origin ); + push_text( "ts_x_origin" ); push_int( v.ts_x_origin ); + push_text( "ts_y_origin" ); push_int( v.ts_y_origin ); + push_text( "subwindow_mode" ); push_int( v.subwindow_mode ); + push_text( "clip_mask" ); push_gdkobject( v.clip_mask, Bitmap ); + push_text( "stipple" ); push_gdkobject( v.stipple, Bitmap ); + push_text( "tile" ); push_gdkobject( v.tile, Pixmap ); + push_text( "font" ); push_gdkobject( v.font, Font ); + + if( v.font ) gdk_font_ref( v.font ); + if( v.tile ) gdk_pixmap_ref( v.tile ); + if( v.stipple ) gdk_pixmap_ref( v.stipple ); + if( v.clip_mask ) gdk_pixmap_ref( v.clip_mask ); + + push_text( "fill" ); push_int( v.fill ); + push_text( "tile" ); push_int( v.tile ); + push_text( "function" ); push_int( v.function ); + { + GdkColor *f = malloc( sizeof( GdkColor ) ); + GdkColor *b = malloc( sizeof( GdkColor ) ); + *f = v.foreground; + *b = v.background; + push_text( "foreground" ); push_gdkobject( f, Color ); + push_text( "background" ); push_gdkobject( b, Color ); + } + f_aggregate_mapping( Pike_sp-osp ); +} + FUNCTION(set_foreground, "function(object:object)"); ARGS(GDK.Color); NAME_ARGS(color); diff --git a/src/post_modules/GTK/source/gtkstyle.pre b/src/post_modules/GTK/source/gtkstyle.pre index 3018882d16c0460e46258de881947142765ab1a2..4a533d4bdc40018d44b53c37ecc5debc71239d90 100644 --- a/src/post_modules/GTK/source/gtkstyle.pre +++ b/src/post_modules/GTK/source/gtkstyle.pre @@ -1,5 +1,10 @@ class style; +FUNCTION(destroy, "function(void:void)"); +{ + /* do nothing */ +} + style copy(); // Copy this style, and return the new style object style attach( GdkWindow to ); @@ -17,29 +22,29 @@ void apply_default_background( GdkWindow window, int set_bgp, int state_type, ?G // <p> // If set_bgp is true, the background of the widget will be set, // otherwise it will only be drawn into the window. -array GDK.Color &fg[5]; -array GDK.Color &bg[5]; -array GDK.Color &light[5]; -array GDK.Color &dark[5]; -array GDK.Color &mid[5]; -array GDK.Color &text[5]; -array GDK.Color &base[5]; +COPY array GDK.Color &fg[5]; +COPY array GDK.Color &bg[5]; +COPY array GDK.Color &light[5]; +COPY array GDK.Color &dark[5]; +COPY array GDK.Color &mid[5]; +COPY array GDK.Color &text[5]; +COPY array GDK.Color &base[5]; -member GDK.Color &black; -member GDK.Color &white; +REF member GDK.Color &black; +REF member GDK.Color &white; -member GDK.Font font; -array GDK.Pixmap bg_pixmap[5]; +REF member GDK.Font font; +REF array GDK.Pixmap bg_pixmap[5]; -array GDK.GC fg_gc[5]; -array GDK.GC bg_gc[5]; -array GDK.GC light_gc[5]; -array GDK.GC dark_gc[5]; -array GDK.GC mid_gc[5]; -array GDK.GC text_gc[5]; -array GDK.GC base_gc[5]; -member GDK.GC black_gc; -member GDK.GC white_gc; +REF array GDK.GC fg_gc[5]; +REF array GDK.GC bg_gc[5]; +REF array GDK.GC light_gc[5]; +REF array GDK.GC dark_gc[5]; +REF array GDK.GC mid_gc[5]; +REF array GDK.GC text_gc[5]; +REF array GDK.GC base_gc[5]; +REF member GDK.GC black_gc; +REF member GDK.GC white_gc; %{ /* void draw_hline( GDK.Window window, int state_type, int x1, int x2, int y) diff --git a/src/post_modules/GTK/source/gtkwidget.pre b/src/post_modules/GTK/source/gtkwidget.pre index f67a5a6fc0dda92f9081850868aeb3a679350fd3..d25ba338a4470eccfc4c3eed9a1dd0fc9a89ab9d 100644 --- a/src/post_modules/GTK/source/gtkwidget.pre +++ b/src/post_modules/GTK/source/gtkwidget.pre @@ -552,6 +552,8 @@ Style get_style(); void restore_default_style(); // Reset all styles to their default value +void set_rc_style(); +// Set the style from the .rc files void reset_rc_styles(); // Reset all styles to their default value, recursively void set_composite_name( string name );