[Gtk-sharp-list] Gdk.Color's methods.

Lee Mallabone gnome@fonicmonkey.net
13 Apr 2003 14:10:19 +0100


--=-v8fYjSoOok4ETPb5VU0N
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

On Sat, 2003-04-12 at 20:34, Miguel de Icaza wrote:
> Hello,
> 
>    I would like to conceal the following methods from being exported by
> Gdk.Color:
..snip..
>     I tried the following in sources/Gdk.metadata, but as usual, I never
> have any luck with the metadata hacks:
..snip..

It worked okay for me - I think the attached patch implements your
desired changes.

Regards,

Lee.


--=-v8fYjSoOok4ETPb5VU0N
Content-Disposition: attachment; filename=col.diff
Content-Type: text/x-patch; name=col.diff; charset=ANSI_X3.4-1968
Content-Transfer-Encoding: 7bit

Index: gdk/Color.custom
===================================================================
RCS file: /cvs/public/gtk-sharp/gdk/Color.custom,v
retrieving revision 1.4
diff -u -r1.4 Color.custom
--- gdk/Color.custom	28 Feb 2003 07:28:06 -0000	1.4
+++ gdk/Color.custom	13 Apr 2003 13:22:57 -0000
@@ -32,4 +32,12 @@
 	green = (ushort) (g << 8 | g);
 	blue = (ushort) (b << 8 | b);
 	pixel = 0;
-}
\ No newline at end of file
+}
+
+[DllImport("libgdk-win32-2.0-0.dll")]
+static extern uint gdk_color_hash(ref Gdk.Color raw);
+
+public override int GetHashCode() {
+        return (int) gdk_color_hash(ref this);
+}
+
Index: sources/Gdk.metadata
===================================================================
RCS file: /cvs/public/gtk-sharp/sources/Gdk.metadata,v
retrieving revision 1.14
diff -u -r1.14 Gdk.metadata
--- sources/Gdk.metadata	4 Apr 2003 07:24:02 -0000	1.14
+++ sources/Gdk.metadata	13 Apr 2003 13:22:57 -0000
@@ -118,6 +118,7 @@
   </data>
 </rule>
 
+      
 <!-- ref parameters -->
 <rule>
   <class name="GdkColor">
@@ -182,6 +183,19 @@
       <value>1</value>
     </attribute>
   </data>
+</rule>
+<rule>
+  <class name="GdkColor">
+    <method>Hash</method>
+    <method>Copy</method>
+    <method>Free</method>
+  </class>
+  <data>
+    <attribute target="method">
+      <name>hidden</name>
+      <value>1</value>
+    </attribute>
+  </data>
 </rule>
 <rule>
   <class name="GdkPixbuf">
Index: api/gdk-api.xml
===================================================================
RCS file: /cvs/public/gtk-sharp/api/gdk-api.xml,v
retrieving revision 1.16
diff -u -r1.16 gdk-api.xml
--- api/gdk-api.xml	4 Apr 2003 07:24:02 -0000	1.16
+++ api/gdk-api.xml	13 Apr 2003 13:22:58 -0000
@@ -1809,7 +1809,7 @@
       <field cname="red" type="guint16"/>
       <field cname="green" type="guint16"/>
       <field cname="blue" type="guint16"/>
-      <method name="Copy" cname="gdk_color_copy">
+      <method name="Copy" cname="gdk_color_copy" hidden="1">
         <return-type type="GdkColor*"/>
       </method>
       <method name="Equal" cname="gdk_color_equal">
@@ -1818,13 +1818,13 @@
           <parameter type="const-GdkColor*" name="colorb"/>
         </parameters>
       </method>
-      <method name="Free" cname="gdk_color_free">
+      <method name="Free" cname="gdk_color_free" hidden="1">
         <return-type type="void"/>
       </method>
       <method name="GetType" cname="gdk_color_get_type" shared="true">
         <return-type type="GType"/>
       </method>
-      <method name="Hash" cname="gdk_color_hash">
+      <method name="Hash" cname="gdk_color_hash" hidden="1">
         <return-type type="guint"/>
       </method>
       <method name="Parse" cname="gdk_color_parse" shared="true">

--=-v8fYjSoOok4ETPb5VU0N--