also, disable the call do BindColumns in
[mono.git] / mcs / class / Managed.Windows.Forms / System.Windows.Forms / ThemeGtk.cs
index fb90f1249a9b64684949d58fd695583830828e12..90aa89eaf343050abf15aa9f9c076b5c7da7f495 100644 (file)
@@ -96,11 +96,18 @@ namespace System.Windows.Forms
                        internal short blue;
                }
 
+               [StructLayout(LayoutKind.Sequential)]   
+               internal struct GObjectStruct {
+                       public IntPtr Instance;
+                       public IntPtr ref_count;
+                       public IntPtr data;
+               }
+
+
                [StructLayout(LayoutKind.Sequential)]   
                internal struct GtkStyleStruct
                {
-                       [MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValArray, SizeConst=12)]
-                       internal byte[] obj; /* GObject is 12 bytes*/
+                       internal GObjectStruct obj;
                        [MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValArray, SizeConst=5)]
                        internal GdkColorStruct[] fg;
                        [MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValArray, SizeConst=5)]               
@@ -141,40 +148,40 @@ namespace System.Windows.Forms
                static extern IntPtr gdk_window_foreign_new_for_display (IntPtr display, uint anid);
 
                [DllImport("libgdk-x11-2.0.so")]
-               static extern bool gdk_init_check(out int argc, string argv);   
+               static extern bool gdk_init_check(IntPtr argc, IntPtr argv);    
                
-               [DllImport("libgdk-x11-2.0.so")]
-               static extern IntPtr gdk_pixmap_new (IntPtr drawable, int width, int height, int depth);
+               //[DllImport("libgdk-x11-2.0.so")]
+               //static extern IntPtr gdk_pixmap_new (IntPtr drawable, int width, int height, int depth);
                
-               [DllImport("libgdk-x11-2.0.so")]
-               static extern IntPtr gdk_pixbuf_get_from_drawable (IntPtr dest, IntPtr drawable_src, IntPtr cmap,
-                                                                  int src_x, int src_y, int dest_x, int dest_y, int width, int height);
+               //[DllImport("libgdk-x11-2.0.so")]
+               //static extern IntPtr gdk_pixbuf_get_from_drawable (IntPtr dest, IntPtr drawable_src, IntPtr cmap,
+               //                                                 int src_x, int src_y, int dest_x, int dest_y, int width, int height);
                
-               [DllImport("libgdk-x11-2.0.so")]
-               static extern bool gdk_pixbuf_save_to_buffer (IntPtr pixbuf, out IntPtr buffer, out UIntPtr buffer_size, string type, out IntPtr error, IntPtr option_dummy);
+               //[DllImport("libgdk-x11-2.0.so")]
+               //static extern bool gdk_pixbuf_save_to_buffer (IntPtr pixbuf, out IntPtr buffer, out UIntPtr buffer_size, string type, out IntPtr error, IntPtr option_dummy);
                
-               [DllImport("libgdk-x11-2.0.so")]
-               static extern IntPtr gdk_drawable_get_colormap (IntPtr drawable);
+               //[DllImport("libgdk-x11-2.0.so")]
+               //static extern IntPtr gdk_drawable_get_colormap (IntPtr drawable);
                
-               [DllImport("libgdk-x11-2.0.so")]
-               static extern IntPtr gdk_colormap_get_system ();
+               //[DllImport("libgdk-x11-2.0.so")]
+               //static extern IntPtr gdk_colormap_get_system ();
                
-               [DllImport("libgdk-x11-2.0.so")]
-               static extern IntPtr gdk_pixbuf_new (int colorspace, bool has_alpha, int bits_per_sample, int width, int height);
+               //[DllImport("libgdk-x11-2.0.so")]
+               //static extern IntPtr gdk_pixbuf_new (int colorspace, bool has_alpha, int bits_per_sample, int width, int height);
                
-               [DllImport("libgdk-x11-2.0.so")]
-               static extern IntPtr gdk_gc_new (IntPtr drawable);
+               //[DllImport("libgdk-x11-2.0.so")]
+               //static extern IntPtr gdk_gc_new (IntPtr drawable);
                
                /* glib imports*/
-               [DllImport("libglib-2.0.so")]
-               static extern void g_free (IntPtr mem);
+               //[DllImport("libglib-2.0.so")]
+               //static extern void g_free (IntPtr mem);
                
-               [DllImport("libgobject-2.0.so")]
-               static extern void g_object_unref (IntPtr nativeObject);
+               //[DllImport("libgobject-2.0.so")]
+               //static extern void g_object_unref (IntPtr nativeObject);
 
                /* GTK imports */               
                [DllImport("libgtk-x11-2.0.so")]
-               static extern bool gtk_init_check (out int argc, string argv);
+               static extern bool gtk_init_check (IntPtr argc, IntPtr argv);
 
                [DllImport("libgtk-x11-2.0.so")]
                static extern IntPtr gtk_adjustment_new (double value, double lower, double upper, double step_increment, double page_increment, double page_size);
@@ -191,8 +198,8 @@ namespace System.Windows.Forms
                [DllImport("libgtk-x11-2.0.so")]
                static extern IntPtr gtk_style_attach (IntPtr raw, IntPtr window);
 
-               [DllImport("libgtk-x11-2.0.so")]
-               static extern IntPtr gtk_rc_style_new ();
+               //[DllImport("libgtk-x11-2.0.so")]
+               //static extern IntPtr gtk_rc_style_new ();
 
                [DllImport("libgtk-x11-2.0.so")]
                static extern IntPtr gtk_invisible_new ();
@@ -203,8 +210,8 @@ namespace System.Windows.Forms
                [DllImport("libgtk-x11-2.0.so")]
                static extern IntPtr gtk_widget_get_style (IntPtr raw);
 
-               [DllImport("libgtk-x11-2.0.so")]
-               static extern void gtk_style_detach (IntPtr raw);
+               //[DllImport("libgtk-x11-2.0.so")]
+               //static extern void gtk_style_detach (IntPtr raw);
                
                [DllImport("libgtk-x11-2.0.so")]
                static extern IntPtr gtk_button_new ();
@@ -231,8 +238,8 @@ namespace System.Windows.Forms
                static extern void gtk_range_set_value (IntPtr range, double value);
 
                /* GTK Drawing */
-               [DllImport("libgtk-x11-2.0.so")]
-               static extern void gtk_paint_handle (IntPtr style, IntPtr window, int state_type, int shadow_type, IntPtr area, IntPtr widget, string detail, int x, int y, int width, int height, int orientation);
+               //[DllImport("libgtk-x11-2.0.so")]
+               //static extern void gtk_paint_handle (IntPtr style, IntPtr window, int state_type, int shadow_type, IntPtr area, IntPtr widget, string detail, int x, int y, int width, int height, int orientation);
 
                [DllImport("libgtk-x11-2.0.so")]
                static extern void gtk_paint_arrow (IntPtr style, IntPtr window, int state_type, int shadow_type, 
@@ -250,11 +257,11 @@ namespace System.Windows.Forms
                static extern void gtk_paint_flat_box (IntPtr style, IntPtr window, int state_type, int shadow_type,
                                                       IntPtr area, IntPtr widget, string detail, int x, int y, int width, int height);
                
-               [DllImport("libgtk-x11-2.0.so")]
-               static extern void gtk_paint_hline(IntPtr style, IntPtr window, int state_type, IntPtr area, IntPtr widget, string detail, int x1, int x2, int y);
+               //[DllImport("libgtk-x11-2.0.so")]
+               //static extern void gtk_paint_hline(IntPtr style, IntPtr window, int state_type, IntPtr area, IntPtr widget, string detail, int x1, int x2, int y);
                
-               [DllImport("libgtk-x11-2.0.so")]
-               static extern void gtk_paint_vline(IntPtr style, IntPtr window, int state_type, IntPtr area, IntPtr widget, string detail, int y1, int y2, int x);
+               //[DllImport("libgtk-x11-2.0.so")]
+               //static extern void gtk_paint_vline(IntPtr style, IntPtr window, int state_type, IntPtr area, IntPtr widget, string detail, int y1, int y2, int x);
                
                [DllImport("libgtk-x11-2.0.so")]
                static extern void gtk_paint_check(IntPtr style, IntPtr window, int state_type, int shadow_type, IntPtr area, IntPtr widget, string detail, int x, int y, int width, int height);
@@ -312,14 +319,12 @@ namespace System.Windows.Forms
                public static void InitGtk ()
                {       
                        Console.WriteLine ("ThemeGtk Init");            
-                       int argc = 0;
-                       string argv = "";
                        
-                       gdk_init_check (out argc, argv);        
+                       gdk_init_check (IntPtr.Zero, IntPtr.Zero);      
 
                        dispmgr =  gdk_display_manager_get ();
                        gdkdisplay =  gdk_display_manager_get_default_display (dispmgr);
-                       gtk_init_check (out argc, argv);
+                       gtk_init_check (IntPtr.Zero, IntPtr.Zero);
 
                        widget = gtk_invisible_new ();
                        gtk_widget_ensure_style (widget);
@@ -378,7 +383,6 @@ namespace System.Windows.Forms
                {
                        Console.WriteLine ("ThemeGtk constructor");
                        InitGtk ();
-                       default_font =  new Font (FontFamily.GenericSansSerif, 8.25f);
                        
                        LoadSysDefaultColors ();        
 
@@ -595,7 +599,7 @@ namespace System.Windows.Forms
                        #endif
 
                        // Now the text
-                       if (button.text != null && button.text != String.Empty)
+                       if (button.Text != null && button.Text != String.Empty)
                                ButtonBase_DrawText (button, dc);
                }
                
@@ -604,7 +608,7 @@ namespace System.Windows.Forms
                        Rectangle buttonRectangle = button.ClientRectangle;
                        
                        StateType state_type = StateType.Normal;
-                       ShadowType shadow_type = button.flat_style == FlatStyle.Flat ? ShadowType.In : ShadowType.Out;
+                       ShadowType shadow_type = button.FlatStyle == FlatStyle.Flat ? ShadowType.In : ShadowType.Out;
                        string detail = "buttondefault";
                        
                        if (((button is CheckBox) && (((CheckBox)button).check_state == CheckState.Checked)) ||
@@ -628,7 +632,7 @@ namespace System.Windows.Forms
                        if (button.Focused)
                                gtk_widget_grab_focus (global_gtk_button);
                        
-                       if (button.flat_style == FlatStyle.Flat)
+                       if (button.FlatStyle == FlatStyle.Flat)
                                gtk_paint_flat_box (current_style,
                                                    current_gdk_drawable,
                                                    (int) state_type,
@@ -639,7 +643,7 @@ namespace System.Windows.Forms
                                                    buttonRectangle.X, buttonRectangle.Y,
                                                    buttonRectangle.Width, buttonRectangle.Height);
                        else
-                       if (button.flat_style != FlatStyle.Popup || (button.flat_style == FlatStyle.Popup && button.is_entered))
+                       if (button.FlatStyle != FlatStyle.Popup || (button.FlatStyle == FlatStyle.Popup && button.is_entered))
                                gtk_paint_box (current_style,
                                               current_gdk_drawable,
                                               (int) state_type,