# HG changeset patch # User John Reimer # Date 1199944480 28800 # Node ID 0b417301f4047b13b5300e4981a1661b690c7df2 # Parent 3a3e3aa76b66422d0bad53dd99c6bfcbb8d9e015 Added rest of macro functions to OS.d diff -r 3a3e3aa76b66 -r 0b417301f404 dwt/internal/gtk/OS.d --- a/dwt/internal/gtk/OS.d Thu Jan 10 03:51:48 2008 +0100 +++ b/dwt/internal/gtk/OS.d Wed Jan 09 21:54:40 2008 -0800 @@ -2277,4 +2277,546 @@ localeconv_decimal_point() localeconv()->decimal_point +/ +/+ + /************************************************************************** + + Utility methods -- conversions of gtk macros + + **************************************************************************/ + + gulong g_signal_connect( gpointer arg0, ghar* arg1, GCallback arg2, gpointer arg3 ) + { + lock.lock(); + scope(exit) lock.unlock(); + return g_signal_connect_data (arg0, arg1, arg2, arg3, null , cast(GConnectFlags) 0) ; + } + + gulong g_signal_connect_after( gpointer arg0, gchar* arg1, GCallback arg2, gpointer arg3 ) + { + lock.lock(); + scope(exit) lock.unlock(); + return g_signal_connect_data ( arg0, arg1, arg2, arg3, null, GConnectFlags.AFTER ) + } + + GSList* g_slist_next( GSList* arg0 ) + { + lock.lock(); + scope(exit) lock.unlock(); + return arg0 ? arg0.next : null; + } + + GList* g_list_next( GList* arg0 ) + { + lock.lock(); + scope(exit) lock.unlock(); + return arg0 ? arg0.next : null; + } + + GList* g_list_previous( GList* arg0 ) + { + lock.lock(); + scope(exit) lock.unlock(); + return arg0 ? arg0.prev : null; + } + + Display* GDK_DISPLAY() + { + lock.lock(); + scope(exit) lock.unlock(); + // gdk_display needs to be a reference to the an external X11 global + // representing the current X11 display + return gdk_display; + } + + GdkWindow* GDK_ROOT_PARENT() + { + lock.lock(); + scope(exit) lock.unlock; + return gdk_get_default_root_window(); + } + + GType GDK_TYPE_COLOR() + { + lock.lock(); + scope(exit) lock.unlock; + return gdk_color_get_type(); + } + + GType GDK_TYPE_PIXBUF() + { + lock.lock(); + scope(exit) lock.unlock; + return gdk_pixbuf_get_type(); + } + + bool GTK_IS_BUTTON( GTypeInstance* arg0 ) + { + lock.lock(); + scope(exit) lock.unlock(); + return g_type_check_instance_is_a( arg0, gtk_button_get_type() ); + } + + bool GTK_IS_WINDOW( GTypeInstance* arg0 ) + { + lock.lock(); + scope(exit) lock.unlock(); + return g_type_check_instance_is_a( arg0, gtk_window_get_type()); + } + + bool GTK_IS_CELL_RENDERER_PIXBUF( GTypeInstance* arg0 ) + { + lock.lock(); + scope(exit) lock.unlock(); + return g_type_check_instance_is_a( arg0, gtk_cell_renderer_pixbuf_get_type()); + } + + bool GTK_IS_CELL_RENDERER_TEXT( GTypeInstance* arg0 ) + { + lock.lock(); + scope(exit) lock.unlock(); + return g_type_check_instance_is_a( arg0, gtk_cell_renderer_text_get_type()); + } + + bool GTK_IS_CELL_RENDERER_TOGGLE( GTypeInstance* arg0 ) + { + lock.lock() + scope(exit) lock.unlock(); + return g_type_check_instance_is_a( arg0, gtk_cell_renderer_toggle_get_type ()); + } + + bool GTK_IS_CONTAINER( GTypeInstance* arg0 ) + { + lock.lock(); + scope(exit) lock.unlock(); + return g_type_check_instance_is_a( arg0, gtk_container_get_type () ); + } + + + bool GTK_IS_IMAGE_MENU_ITEM( GTypeInstance* arg0 ) + { + lock.lock(); + scope(exit) lock.unlock(); + return g_type_check_instance_is_a( arg0, gtk_image_menu_item_get_type ()); + } + + bool GTK_IS_PLUG( GTypeInstance* arg0 ) + { + lock.lock(); + scope(exit) lock.unlock(); + return g_type_check_instance_is_a( arg0, gtk_plug_get_type () ); + } + + // Should use d char[] instead for next two methods? - JJR + char* GTK_STOCK_CANCEL() + { + lock.lock(); + scope(exit) lock.unlock(); + return "gtk-cancel"; + } + + char* GTK_STOCK_OK() + { + lock.lock(); + scope(exit) lock.unlock(); + return "gtk-ok"; + } + + GType GTK_TYPE_CELL_RENDERER_TEXT() + { + lock.lock(); + scope(exit) lock.unlock(); + return gtk_cell_renderer_text_get_type(); + } + + GType GTK_TYPE_CELL_RENDERER_PIXBUF() + { + lock.lock(); + scope(exit) lock.unlock(); + return gtk_cell_renderer_pixbuf_get_type(); + } + + GType GTK_TYPE_CELL_RENDERER_TOGGLE () + { + lock.lock(); + scope(exit) lock.unlock(); + return gtk_cell_renderer_toggle_get_type(); + } + + GType GTK_TYPE_FIXED() + { + lock.lock(); + scope(exit) lock.unlock(); + return gtk_fixed_get_type (); + } + + GType GTK_TYPE_MENU() + { + lock.lock(); + scope(exit) lock.unlock(); + return gtk_menu_get_type (); + } + + GType GTK_TYPE_WIDGET() + { + lock.lock(); + scope(exit) lock.unlock(); + return gtk_widget_get_type (); + } + + guint32 GTK_WIDGET_FLAGS( GTypeInstance* arg0 ) + { + lock.lock(); + scope(exit) lock.unlock(); + return (cast(GtkObject*) g_type_check_instance_cast ( arg0, gtk_object_get_type ())).flags ; + } + + guint8 GTK_WIDGET_STATE( GTypeInstance* arg0 ) + { + lock.lock(); + scope(exit) lock.unlock(); + return ( cast(GtkWidget*) g_type_check_instance_cast (arg0, gtk_widget_get_type ())).state; + } + + bool GTK_WIDGET_HAS_DEFAULT( GTypeInstance* arg0 ) + { + lock.lock(); + scope(exit) lock.unlock(); + return ( ( ( cast(GtkObject*) g_type_check_instance_cast (arg0, gtk_object_get_type () )).flags & GTK_HAS_DEFAULT) != 0) ; + } + + bool GTK_WIDGET_HAS_FOCUS( GTypeInstance* arg0 ) + { + lock.lock(); + scope(exit) lock.unlock(); + return ( ( ( cast(GtkObject*) g_type_check_instance_cast (arg0, gtk_object_get_type () )).flags & GTK_HAS_FOCUS) != 0) ; + } + + bool GTK_WIDGET_IS_SENSITIVE( GTypeInstance* arg0 ) + { + lock.lock(); + scope(exit) lock.unlock(); + return ( ( ( cast (GtkObject*) g_type_check_instance_cast ( arg0, gtk_object_get_type ()) ).flags & GTK_SENSITIVE) != 0) && ( ( ( cast(GtkObject*) g_type_check_instance_cast ( arg0, gtk_object_get_type ()) ).flags & GTK_PARENT_SENSITIVE) != 0); + } + + bool GTK_WIDGET_MAPPED( GTypeInstance* arg0 ) + { + lock.lock(); + scope(exit) lock.unlock(); + return ( ( ( cast(GtkObject*) g_type_check_instance_cast (arg0, gtk_object_get_type () )).flags & GTK_MAPPED) != 0) ; + } + + bool GTK_WIDGET_SENSITIVE( GTypeInstance* arg0 ) + { + lock.lock(); + scope(exit) lock.unlock(); + return ( ( ( cast(GtkObject*) g_type_check_instance_cast (arg0, gtk_object_get_type () )).flags & GTK_SENSITIVE) != 0) ; + } + + void GTK_WIDGET_SET_FLAGS( GTypeInstance* arg0, guint32 arg1 ) + { + lock.lock(); + scope(exit) lock.unlock(); + (cast(GtkObject*) g_type_check_instance_cast ( arg0, gtk_object_get_type () ) ).flags |= arg1; + } + + void GTK_WIDGET_UNSET_FLAGS( GTypeInstance* arg0, guint32 arg1 ) + { + lock.lock(); + scope(exit) lock.unlock(); + (cast(GtkObject*) g_type_check_instance_cast ( arg0, gtk_object_get_type () ) ).flags &= ~arg1; + } + + bool GTK_WIDGET_VISIBLE( GTypeInstance* arg0 ) + { + lock.lock(); + scope(exit) lock.unlock(); + return ( ( ( cast(GtkObject*) g_type_check_instance_cast (arg0, gtk_object_get_type () )).flags & GTK_VISIBLE) != 0) ; + } + + GObjectClass* G_OBJECT_CLASS( GTypeClass* arg0 ) + { + lock.lock(); + scope(exit) lock.unlock(); + return (cast(GObjectClass*) g_type_check_class_cast ( arg0, cast(GType) (20 << 2) ) ) ; + } + + GObjectClass* G_OBJECT_GET_CLASS( GTypeClass* arg0 ) + { + lock.lock(); + scope(exit) lock.unlock(); + return (cast(GObjectClass*) arg0.g_class) ; + } + + gchar* G_OBJECT_TYPE_NAME( GTypeInstance* arg0 ) + { + lock.lock(); + scope(exit) lock.unlock(); + return g_type_name( (cast(GTypeClass*) arg0.g_class).g_type ) ; + } + + GType G_TYPE_BOOLEAN() + { + lock.lock(); + scope(exit) lock.unlock(); + return (cast(GType) (5 << 2)) ; + } + + GType G_TYPE_INT() + { + lock.lock(); + scope(exit) lock.unlock(); + return (cast(GType) (6 << 2)); + } + + GType G_OBJECT_TYPE( GTypeInstance* arg0 ) + { + lock.lock(); + scope(exit) lock.unlock(); + return (cast(GTypeClass*) arg0.g_class).g_type; + } + + GType G_TYPE_STRING() + { + lock.lock(); + scope(exit) lock.unlock(); + return (cast(GType) (16 << 2)); + } + + + int PANGO_PIXELS( int arg0 ) + { + lock.lock(); + scope(exit) lock.unlock(); + return ((arg0 + 512) >> 10); + } + + GType PANGO_TYPE_FONT_DESCRIPTION() + { + lock.lock(); + scope(exit) lock.unlock(); + return pango_font_description_get_type () ; + } + + /************************************************************************** + + Utility methods -- conversions of SWT macros + + **************************************************************************/ + + gpointer g_list_data( GList* arg0 ) + { + lock.lock(); + scope(exit) lock.unlock(); + return arg0.data; + } + + gpointer g_slist_data( GSList* arg0 ) + { + lock.lock(); + scope(exit) lock.unlock(); + return arg0.data; + } + + void g_list_set_next( GList* arg0, GList* arg1 ) + { + lock.lock(); + scope(exit) lock.unlock(); + arg0.next = arg1; + } + + void g_list_set_previous( GList* arg0, GList* arg1 ) + { + lock.lock(); + scope(exit) lock.unlock(); + arg0.prev = arg1; + } + + char* gtk_rc_style_get_bg_pixmap_name( GtkRcStyle* arg0, int arg1 ) + { + lock.lock(); + scope(exit) lock.unlock(); + return arg0.bg_pixmap_name[arg1]; + } + + int gtk_rc_style_get_color_flags( GtkRcStyle* arg0, int arg1) + { + lock.lock(); + scope(exit) lock.unlock(); + return arg0.color_flags[arg1]; + } + + void gtk_rc_style_set_bg( GtkRcStyle* arg0, int arg1, GdkColor* arg2) + { + lock.lock(); + scope(exit) lock.unlock(); + if (arg2 !is null) { + arg0.bg[arg1] = *arg2; + } + } + + void gtk_rc_style_set_bg_pixmap_name( GtkRcStyle* arg0, int arg1, char* arg2) + { + lock.lock(); + scope(exit) lock.unlock(); + arg0.bg_pixmap_name[arg1] = arg2; + } + + void gtk_rc_style_set_color_flags( GtkRcStyle* arg0, int arg1, int arg2) + { + lock.lock(); + scope(exit) lock.unlock(); + arg0.color_flags[arg1] = arg2; + } + + void gtk_rc_style_set_fg( GtkRcStyle* arg0, int arg1, GdkColor* arg2) + { + lock.lock(); + scope(exit) lock.unlock(); + if (arg2 !is null ) { + arg0.fg[arg1] = *arg2; + } + } + + void gtk_rc_style_set_text( GtkRcStyle* arg0, int arg1, GdkColor* arg2) + { + lock.lock(); + scope(exit) lock.unlock(); + if (arg2 !is null) { + arg0.text[arg1] = *arg2; + } + } + + void* gtk_style_get_font_desc( GtkStyle* arg0 ) + { + lock.lock(); + scope(exit) lock.unlock(); + return arg0.font_desc; + } + + void gtk_style_get_base( GtkStyle* arg0, int arg1, GdkColor* arg2 ) + { + lock.lock(); + scope(exit) lock.unlock(); + *arg2 = arg0.base[arg1]; + } + + void gtk_style_get_bg( GtkStyle* arg0, int arg1, GdkColor* arg2 ) + { + lock.lock(); + scope(exit) lock.unlock(); + *arg2 = arg0.bg[arg1]; + } + + void gtk_style_get_black( GtkStyle* arg0, GdkColor* arg1 ) + { + lock.lock(); + scope(exit) lock.unlock(); + *arg1 = arg0.black; + } + + void gtk_style_get_dark( GtkStyle* arg0, int arg1, GdkColor* arg2 ) + { + lock.lock(); + scope(exit) lock.unlock(); + *arg2 = arg0.dark[arg1]; + } + + void gtk_style_get_fg( GtkStyle* arg0, int arg1, GdkColor* arg2 ) + { + lock.lock(); + scope(exit) lock.unlock(); + *arg2 = arg0.fg[arg1]; + } + + void gtk_style_get_light( GtkStyle* arg0, int arg1, GdkColor* arg2) + { + lock.lock(); + scope(exit) lock.unlock(); + *arg2 = arg0.light[arg1]; + } + + void gtk_style_get_text( GtkStyle* arg0, int arg1, GdkColor* arg2) + { + lock.lock(); + scope(exit) lock.unlock(); + *arg2 = arg0.text[arg1]; + } + + int gtk_style_get_xthickness( GtkStyle* arg0 ) + { + lock.lock(); + scope(exit) lock.unlock(); + return arg0.xthickness; + } + + int gtk_style_get_ythickness( GtkStyle* arg0 ) + { + lock.lock(); + scope(exit) lock.unlock(); + return arg0.ythickness; + } + + void gtk_style_get_fg_gc( GtkStyle* arg0, int arg1, GdkGC** arg2 ) + { + lock.lock(); + scope(exit) lock.unlock(); + *arg2 = arg0.fg_gc[arg1]; + } + + void gtk_style_get_bg_gc( GtkStyle* arg0, int arg1, GdkGC** arg2 ) + { + lock.lock(); + scope(exit) lock.unlock(); + *arg2 = arg0.bg_gc[arg1]; + } + + void gtk_style_get_light_gc( GtkStyle* arg0, int arg1, GdkGC** arg2 ) + { + lock.lock(); + scope(exit) lock.unlock(); + *arg2 = arg0.light_gc[arg1]; + } + + void gtk_style_get_dark_gc( GtkStyle* arg0, int arg1, GdkGC** arg2 ) + { + lock.lock(); + scope(exit) lock.unlock(); + *arg2 = arg0.dark_gc[arg1]; } + } + + void gtk_style_get_mid_gc( GtkStyle* arg0, int arg1, GdkGC** arg2 ) + { + lock.lock(); + scope(exit) lock.unlock(); + *arg2 = arg0.mid_gc[arg1]; + } + + void gtk_style_get_text_gc( GtkStyle* arg0, int arg1, GdkGC** arg2 ) + { + lock.lock(); + scope(exit) lock.unlock(); + *arg2 = arg0.text_gc[arg1]; + } + + void gtk_style_get_text_aa_gc( GtkStyle* arg0, int arg1, GdkGC** arg2 ) + { + lock.lock(); + scope(exit) lock.unlock(); + *arg2 = arg0.text_aa_gc[arg1]; + } + + void gtk_style_get_black_gc( GtkStyle* arg0, GdkGC** arg1 ) + { + lock.lock(); + scope(exit) lock.unlock(); + *arg1 = arg0.black_gc; + } + + void gtk_style_get_white_gc( GtkStyle* arg0, GdkGC** arg1 ) + { + lock.lock(); + scope(exit) lock.unlock(); + *arg1 = arg0.white_gc; + } ++/ }