[Gtk-sharp-list] Some Gtk# methods has C style

Luis G. ghempresa at hotmail.com
Fri Mar 13 14:13:06 EDT 2009


Hi,

I see that some Gtk# methods has a C style alike.

For example 

Gtk.Widget

public void GetSizeRequest (out int width, out int height)

public void SetSizeRequest (int width, int height)

These methods doesn't look good for C# programing, i think a better way
would be something like this :

Create a struct called Size :

public struct Size
{
   public int Width;
   public int Height;

   public Size(int width, int height)
  {
    Width = width;
    Height = height;
  }


}

Now make a property in Gtk.Widget called SizeRequest :

public Size SizeRequest
{
    get
    {
        // called GetSizeRequest passing Width and Height of Size struct and
return it
    }
    set
    {
       // called SetSizeRequest passing Width and Height of Size struct
    }
}

And using these methods (GetSizeRequest, SetSizeRequest) for internal
operations.


This called is more C# friendly :

myWidget.SizeRequest.Width

Instead of :

int myWidth;

myWidget.GetSizeRequest(myWidth, null);

-- 
View this message in context: http://www.nabble.com/Some-Gtk--methods-has-C-style-tp22501226p22501226.html
Sent from the Mono - Gtk# mailing list archive at Nabble.com.



More information about the Gtk-sharp-list mailing list