Mercurial > projects > dwt2
comparison org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/gtk/OS.d @ 51:c01d033c633a
[swt lin]
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Fri, 27 Mar 2009 19:58:06 +0100 |
parents | f589fc20a5f9 |
children | 7e78af7adab5 |
comparison
equal
deleted
inserted
replaced
50:d5075f5226e5 | 51:c01d033c633a |
---|---|
26 import tango.stdc.posix.stdlib : realpath; | 26 import tango.stdc.posix.stdlib : realpath; |
27 static import tango.stdc.string; | 27 static import tango.stdc.string; |
28 } else { // Phobos | 28 } else { // Phobos |
29 import std.traits; | 29 import std.traits; |
30 import core.sys.posix.stdlib : realpath; | 30 import core.sys.posix.stdlib : realpath; |
31 import std.c.locale; | |
31 static import std.c.string; | 32 static import std.c.string; |
32 } | 33 } |
33 | 34 |
34 import org.eclipse.swt.internal.c.gtk, | 35 import org.eclipse.swt.internal.c.gtk, |
35 org.eclipse.swt.internal.c.gdk, | 36 org.eclipse.swt.internal.c.gdk, |
62 public alias org.eclipse.swt.internal.c.glib_object.GError GError; | 63 public alias org.eclipse.swt.internal.c.glib_object.GError GError; |
63 public alias org.eclipse.swt.internal.c.glib_object.GSignalEmissionHook GSignalEmissionHook; | 64 public alias org.eclipse.swt.internal.c.glib_object.GSignalEmissionHook GSignalEmissionHook; |
64 public alias org.eclipse.swt.internal.c.glib_object.GSignalInvocationHint GSignalInvocationHint; | 65 public alias org.eclipse.swt.internal.c.glib_object.GSignalInvocationHint GSignalInvocationHint; |
65 public alias org.eclipse.swt.internal.c.glib_object.GValue GValue; | 66 public alias org.eclipse.swt.internal.c.glib_object.GValue GValue; |
66 | 67 |
68 public alias org.eclipse.swt.internal.c.gdk.GdkBitmap GdkBitmap; | |
67 public alias org.eclipse.swt.internal.c.gdk.GdkColor GdkColor; | 69 public alias org.eclipse.swt.internal.c.gdk.GdkColor GdkColor; |
68 public alias org.eclipse.swt.internal.c.gdk.GdkRegion GdkRegion; | 70 public alias org.eclipse.swt.internal.c.gdk.GdkCursor GdkCursor; |
71 public alias org.eclipse.swt.internal.c.gdk.GdkDisplay GdkDisplay; | |
72 public alias org.eclipse.swt.internal.c.gdk.GdkDragContext GdkDragContext; | |
69 public alias org.eclipse.swt.internal.c.gdk.GdkDrawable GdkDrawable; | 73 public alias org.eclipse.swt.internal.c.gdk.GdkDrawable GdkDrawable; |
70 public alias org.eclipse.swt.internal.c.gdk.GdkGC GdkGC; | |
71 public alias org.eclipse.swt.internal.c.gdk.GdkPixbuf GdkPixbuf; | |
72 public alias org.eclipse.swt.internal.c.gdk.GdkCursor GdkCursor; | |
73 public alias org.eclipse.swt.internal.c.gdk.GdkEvent GdkEvent; | 74 public alias org.eclipse.swt.internal.c.gdk.GdkEvent GdkEvent; |
75 public alias org.eclipse.swt.internal.c.gdk.GdkEventAny GdkEventAny; | |
76 public alias org.eclipse.swt.internal.c.gdk.GdkEventButton GdkEventButton; | |
77 public alias org.eclipse.swt.internal.c.gdk.GdkEventCrossing GdkEventCrossing; | |
78 public alias org.eclipse.swt.internal.c.gdk.GdkEventExpose GdkEventExpose; | |
79 public alias org.eclipse.swt.internal.c.gdk.GdkEventFocus GdkEventFocus; | |
74 public alias org.eclipse.swt.internal.c.gdk.GdkEventKey GdkEventKey; | 80 public alias org.eclipse.swt.internal.c.gdk.GdkEventKey GdkEventKey; |
75 public alias org.eclipse.swt.internal.c.gdk.GdkWindow GdkWindow; | |
76 public alias org.eclipse.swt.internal.c.gdk.GdkEventButton GdkEventButton; | |
77 public alias org.eclipse.swt.internal.c.gdk.GdkRectangle GdkRectangle; | |
78 public alias org.eclipse.swt.internal.c.gdk.GdkEventExpose GdkEventExpose; | |
79 public alias org.eclipse.swt.internal.c.gdk.GdkEventCrossing GdkEventCrossing; | |
80 public alias org.eclipse.swt.internal.c.gdk.GdkEventMotion GdkEventMotion; | 81 public alias org.eclipse.swt.internal.c.gdk.GdkEventMotion GdkEventMotion; |
81 public alias org.eclipse.swt.internal.c.gdk.GdkEventScroll GdkEventScroll; | 82 public alias org.eclipse.swt.internal.c.gdk.GdkEventScroll GdkEventScroll; |
82 public alias org.eclipse.swt.internal.c.gdk.GdkEventVisibility GdkEventVisibility; | 83 public alias org.eclipse.swt.internal.c.gdk.GdkEventVisibility GdkEventVisibility; |
84 public alias org.eclipse.swt.internal.c.gdk.GdkEventWindowState GdkEventWindowState; | |
85 public alias org.eclipse.swt.internal.c.gdk.GdkGC GdkGC; | |
86 public alias org.eclipse.swt.internal.c.gdk.GdkGCValues GdkGCValues; | |
87 public alias org.eclipse.swt.internal.c.gdk.GdkGeometry GdkGeometry; | |
88 public alias org.eclipse.swt.internal.c.gdk.GdkImage GdkImage; | |
89 public alias org.eclipse.swt.internal.c.gdk.GdkPixbuf GdkPixbuf; | |
90 public alias org.eclipse.swt.internal.c.gdk.GdkPixmap GdkPixmap; | |
91 public alias org.eclipse.swt.internal.c.gdk.GdkPoint GdkPoint; | |
92 public alias org.eclipse.swt.internal.c.gdk.GdkRectangle GdkRectangle; | |
93 public alias org.eclipse.swt.internal.c.gdk.GdkRegion GdkRegion; | |
94 public alias org.eclipse.swt.internal.c.gdk.GdkWindow GdkWindow; | |
95 public alias org.eclipse.swt.internal.c.gdk.GdkWindowAttr GdkWindowAttr; | |
83 public alias org.eclipse.swt.internal.c.gdk.GdkXEvent GdkXEvent; | 96 public alias org.eclipse.swt.internal.c.gdk.GdkXEvent GdkXEvent; |
84 public alias org.eclipse.swt.internal.c.gdk.GdkPoint GdkPoint; | |
85 public alias org.eclipse.swt.internal.c.gdk.GdkPixmap GdkPixmap; | |
86 public alias org.eclipse.swt.internal.c.gdk.GdkBitmap GdkBitmap; | |
87 public alias org.eclipse.swt.internal.c.gdk.GdkGCValues GdkGCValues; | |
88 public alias org.eclipse.swt.internal.c.gdk.GdkDisplay GdkDisplay; | |
89 public alias org.eclipse.swt.internal.c.gdk.GdkImage GdkImage; | |
90 public alias org.eclipse.swt.internal.c.gdk.GdkEventAny GdkEventAny; | |
91 public alias org.eclipse.swt.internal.c.gdk.GdkEventFocus GdkEventFocus; | |
92 public alias org.eclipse.swt.internal.c.gdk.GdkWindowAttr GdkWindowAttr; | |
93 public alias org.eclipse.swt.internal.c.gdk.GdkEventWindowState GdkEventWindowState; | |
94 public alias org.eclipse.swt.internal.c.gdk.GdkDragContext GdkDragContext; | |
95 | 97 |
96 public alias org.eclipse.swt.internal.c.pango.PangoAttrColor PangoAttrColor; | 98 public alias org.eclipse.swt.internal.c.pango.PangoAttrColor PangoAttrColor; |
97 public alias org.eclipse.swt.internal.c.pango.PangoAttribute PangoAttribute; | 99 public alias org.eclipse.swt.internal.c.pango.PangoAttribute PangoAttribute; |
98 public alias org.eclipse.swt.internal.c.pango.PangoAttrList PangoAttrList; | 100 public alias org.eclipse.swt.internal.c.pango.PangoAttrList PangoAttrList; |
99 public alias org.eclipse.swt.internal.c.pango.PangoAttrInt PangoAttrInt; | 101 public alias org.eclipse.swt.internal.c.pango.PangoAttrInt PangoAttrInt; |
533 public alias org.eclipse.swt.internal.c.Xrender.XRenderPictureAttributes XRenderPictureAttributes; | 535 public alias org.eclipse.swt.internal.c.Xrender.XRenderPictureAttributes XRenderPictureAttributes; |
534 public alias org.eclipse.swt.internal.c.Xrender.XTransform XTransform; | 536 public alias org.eclipse.swt.internal.c.Xrender.XTransform XTransform; |
535 | 537 |
536 | 538 |
537 // function with variadic argument list | 539 // function with variadic argument list |
538 private void gtk_widget_style_get1( GtkWidget* widget, char* firstPropertyName, int* res ){ | 540 private void gtk_widget_style_get1( GtkWidget* widget, in char* firstPropertyName, int* res ){ |
539 gtk_widget_style_get( widget, firstPropertyName, res, null ); | 541 gtk_widget_style_get( widget, firstPropertyName, res, null ); |
540 } | 542 } |
541 // function with variadic argument list | 543 // function with variadic argument list |
542 private void g_object_get1( void* obj, char* firstPropertyName, int* res ){ | 544 private void g_object_get1( void* obj, in char* firstPropertyName, int* res ){ |
543 g_object_get( obj, firstPropertyName, res, null ); | 545 g_object_get( obj, firstPropertyName, res, null ); |
544 } | 546 } |
545 | 547 |
546 private void g_object_set1( void* obj, char* firstPropertyName, int value ){ | 548 private void g_object_set1( void* obj, in char* firstPropertyName, int value ){ |
547 g_object_set( obj, firstPropertyName, value, null ); | 549 g_object_set( obj, firstPropertyName, value, null ); |
548 } | 550 } |
549 | 551 |
550 private void g_object_set1_float( void* obj, char* firstPropertyName, float value ){ | 552 private void g_object_set1_float( void* obj, in char* firstPropertyName, float value ){ |
551 g_object_set( obj, firstPropertyName, value, null ); | 553 g_object_set( obj, firstPropertyName, value, null ); |
552 } | 554 } |
553 | 555 |
554 private void g_signal_emit_by_name0( void* instance, char* detailed_signal ){ | 556 private void g_signal_emit_by_name0( void* instance, in char* detailed_signal ){ |
555 g_signal_emit_by_name( instance, detailed_signal ); | 557 g_signal_emit_by_name( instance, detailed_signal ); |
556 } | 558 } |
557 | 559 |
558 private void g_signal_emit_by_name1( void* instance, char* detailed_signal, int value ){ | 560 private void g_signal_emit_by_name1( void* instance, in char* detailed_signal, int value ){ |
559 g_signal_emit_by_name( instance, detailed_signal, value ); | 561 g_signal_emit_by_name( instance, detailed_signal, value ); |
560 } | 562 } |
561 | 563 |
562 private void g_signal_emit_by_name2( void* instance, char* detailed_signal, int value1, int value2 ){ | 564 private void g_signal_emit_by_name2( void* instance, in char* detailed_signal, int value1, int value2 ){ |
563 g_signal_emit_by_name( instance, detailed_signal, value1, value2 ); | 565 g_signal_emit_by_name( instance, detailed_signal, value1, value2 ); |
564 } | 566 } |
565 | 567 |
566 private void g_signal_emit_by_name3( void* instance, char* detailed_signal, int value1, int value2, int value3 ){ | 568 private void g_signal_emit_by_name3( void* instance, in char* detailed_signal, int value1, int value2, int value3 ){ |
567 g_signal_emit_by_name( instance, detailed_signal, value1, value2, value3 ); | 569 g_signal_emit_by_name( instance, detailed_signal, value1, value2, value3 ); |
568 } | 570 } |
569 | 571 |
570 private void gdk_pixbuf_save_to_buffer0(GdkPixbuf *pixbuf, char **buffer, uint *buffer_size, | 572 private void gdk_pixbuf_save_to_buffer0(GdkPixbuf *pixbuf, char **buffer, uint *buffer_size, |
571 char *type, GError **error ){ | 573 in char *type, GError **error ){ |
572 gdk_pixbuf_save_to_buffer( pixbuf, buffer, buffer_size, type, error ); | 574 gdk_pixbuf_save_to_buffer( pixbuf, buffer, buffer_size, type, error ); |
573 } | 575 } |
574 | 576 |
575 private void gtk_list_store_set1(void* store , void* iter, int column, void* value ){ | 577 private void gtk_list_store_set1(void* store , void* iter, int column, void* value ){ |
576 gtk_list_store_set( cast(GtkListStore *)store, cast(GtkTreeIter *)iter, column, value, -1 ); | 578 gtk_list_store_set( cast(GtkListStore *)store, cast(GtkTreeIter *)iter, column, value, -1 ); |
581 } | 583 } |
582 | 584 |
583 private void gtk_tree_store_set1(void* tree_store, GtkTreeIter *iter, int column, void* value ){ | 585 private void gtk_tree_store_set1(void* tree_store, GtkTreeIter *iter, int column, void* value ){ |
584 gtk_tree_store_set( tree_store, iter, column, value, -1 ); | 586 gtk_tree_store_set( tree_store, iter, column, value, -1 ); |
585 } | 587 } |
586 private void gtk_cell_layout_set_attributes1( void *cell_layout, void* cell, void* key, void* value ){ | 588 private void gtk_cell_layout_set_attributes1( void *cell_layout, void* cell, in void* key, void* value ){ |
587 gtk_cell_layout_set_attributes( cast(GtkCellLayout *)cell_layout, cast(GtkCellRenderer*)cell, key, value, null ); | 589 gtk_cell_layout_set_attributes( cast(GtkCellLayout *)cell_layout, cast(GtkCellRenderer*)cell, key, value, null ); |
588 } | 590 } |
589 GtkWidget * gtk_file_chooser_dialog_new2(char * title, aGtkWindow * parent, int action, char * btn0_text, int btn0_id, char * btn1_text, int btn1_id ){ | 591 GtkWidget * gtk_file_chooser_dialog_new2(in char * title, aGtkWindow * parent, int action, in char * btn0_text, int btn0_id, in char * btn1_text, int btn1_id ){ |
590 return gtk_file_chooser_dialog_new( title, parent, action, btn0_text, btn0_id, btn1_text, btn1_id, null ); | 592 return gtk_file_chooser_dialog_new( title, parent, action, btn0_text, btn0_id, btn1_text, btn1_id, null ); |
591 } | 593 } |
592 // for linux always true, the other possibility would be GDK_WINDOWING_WIN32 | 594 // for linux always true, the other possibility would be GDK_WINDOWING_WIN32 |
593 private bool GDK_WINDOWING_X11(){ | 595 private bool GDK_WINDOWING_X11(){ |
594 return true; | 596 return true; |
597 private uint GDK_PIXMAP_XID(GdkDrawable* win){ | 599 private uint GDK_PIXMAP_XID(GdkDrawable* win){ |
598 return gdk_x11_drawable_get_xid(win); | 600 return gdk_x11_drawable_get_xid(win); |
599 } | 601 } |
600 | 602 |
601 // macro | 603 // macro |
602 int g_signal_connect( void* instance, char* sig, GCallback handle, void* ptr ){ | 604 int g_signal_connect( void* instance, in char* sig, GCallback handle, void* ptr ){ |
603 return g_signal_connect_data( instance, sig, handle, ptr, cast(GClosureNotify) 0, cast(GConnectFlags)0 ); | 605 return g_signal_connect_data( instance, sig, handle, ptr, cast(GClosureNotify) 0, cast(GConnectFlags)0 ); |
604 } | 606 } |
605 // macro | 607 // macro |
606 void gdk_cursor_destroy( GdkCursor* cursor ){ | 608 void gdk_cursor_destroy( GdkCursor* cursor ){ |
607 gdk_cursor_unref(cursor); | 609 gdk_cursor_unref(cursor); |
615 return localeconv().decimal_point; | 617 return localeconv().decimal_point; |
616 } | 618 } |
617 | 619 |
618 // fontconfig.h | 620 // fontconfig.h |
619 struct FcConfig{}; | 621 struct FcConfig{}; |
620 private extern(C) int FcConfigAppFontAddFile (FcConfig *config, char *file); | 622 private extern(C) int FcConfigAppFontAddFile (FcConfig *config, in char *file); |
621 | 623 |
622 | 624 |
623 template NameOfFunc(alias f) { | 625 template NameOfFunc(alias f) { |
624 // Note: highly dependent on the .stringof formatting | 626 // Note: highly dependent on the .stringof formatting |
625 // the value begins with "& " which is why the first two chars are cut off | 627 // the value begins with "& " which is why the first two chars are cut off |
2450 /************************************************************************** | 2452 /************************************************************************** |
2451 | 2453 |
2452 Utility methods -- conversions of gtk macros | 2454 Utility methods -- conversions of gtk macros |
2453 | 2455 |
2454 **************************************************************************/ | 2456 **************************************************************************/ |
2455 static gulong g_signal_connect( gpointer arg0, gchar* arg1, GCallback arg2, gpointer arg3 ) | 2457 static gulong g_signal_connect( gpointer arg0, in gchar* arg1, GCallback arg2, gpointer arg3 ) |
2456 { | 2458 { |
2457 lock.lock(); | 2459 lock.lock(); |
2458 scope(exit) lock.unlock(); | 2460 scope(exit) lock.unlock(); |
2459 return g_signal_connect_data (arg0, arg1, arg2, arg3, null , cast(GConnectFlags) 0) ; | 2461 return g_signal_connect_data (arg0, arg1, arg2, arg3, null , cast(GConnectFlags) 0) ; |
2460 } | 2462 } |
2461 | 2463 |
2462 static gulong g_signal_connect_after( gpointer arg0, gchar* arg1, GCallback arg2, gpointer arg3 ) | 2464 static gulong g_signal_connect_after( gpointer arg0, in gchar* arg1, GCallback arg2, gpointer arg3 ) |
2463 { | 2465 { |
2464 lock.lock(); | 2466 lock.lock(); |
2465 scope(exit) lock.unlock(); | 2467 scope(exit) lock.unlock(); |
2466 return g_signal_connect_data ( arg0, arg1, arg2, arg3, null, GConnectFlags.G_CONNECT_AFTER ); | 2468 return g_signal_connect_data ( arg0, arg1, arg2, arg3, null, GConnectFlags.G_CONNECT_AFTER ); |
2467 } | 2469 } |
2584 // Should use d char[] instead for next two methods? - JJR | 2586 // Should use d char[] instead for next two methods? - JJR |
2585 static char* GTK_STOCK_CANCEL() | 2587 static char* GTK_STOCK_CANCEL() |
2586 { | 2588 { |
2587 lock.lock(); | 2589 lock.lock(); |
2588 scope(exit) lock.unlock(); | 2590 scope(exit) lock.unlock(); |
2589 return "gtk-cancel"; | 2591 return cast(char*)"gtk-cancel".ptr; |
2590 } | 2592 } |
2591 | 2593 |
2592 static char* GTK_STOCK_OK() | 2594 static char* GTK_STOCK_OK() |
2593 { | 2595 { |
2594 lock.lock(); | 2596 lock.lock(); |
2595 scope(exit) lock.unlock(); | 2597 scope(exit) lock.unlock(); |
2596 return "gtk-ok"; | 2598 return cast(char*)"gtk-ok".ptr; |
2597 } | 2599 } |
2598 | 2600 |
2599 static GType GTK_TYPE_CELL_RENDERER_TEXT() | 2601 static GType GTK_TYPE_CELL_RENDERER_TEXT() |
2600 { | 2602 { |
2601 lock.lock(); | 2603 lock.lock(); |
3000 } else { // Phobos | 3002 } else { // Phobos |
3001 return std.c.string.strlen( ptr ); | 3003 return std.c.string.strlen( ptr ); |
3002 } | 3004 } |
3003 } | 3005 } |
3004 //localeconv_decimal_point() localeconv()->decimal_point | 3006 //localeconv_decimal_point() localeconv()->decimal_point |
3007 static void* memmove( void* trg, in void* src, int len ){ | |
3008 version(Tango){ | |
3009 return tango.stdc.string.memmove( trg, src, len ); | |
3010 } else { // Phobos | |
3011 return std.c.string.memmove( trg, src, len ); | |
3012 } | |
3013 } | |
3005 } | 3014 } |
3006 | 3015 |
3007 | 3016 |
3008 | 3017 |
3009 | 3018 |