1 // Gtk.SpinButton.cs - Gtk SpinButton class customizations
2 //
3 // Author: Mike Kestner <mkestner@ximian.com>
4 //
5 // Copyright (C) 2004 Novell, Inc.
6 //
7 // This program is free software; you can redistribute it and/or
8 // modify it under the terms of version 2 of the Lesser GNU General
9 // Public License as published by the Free Software Foundation.
10 //
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 // Lesser General Public License for more details.
15 //
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this program; if not, write to the
18 // Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 // Boston, MA 02111-1307, USA.
20 
21 
22 namespace Gtk {
23 
24 	using System;
25 	using System.Runtime.InteropServices;
26 
27 	public partial class SpinButton {
28 
29 		[DllImport (Global.GtkNativeDll, CallingConvention = CallingConvention.Cdecl)]
gtk_spin_button_new_with_range(double min, double max, double step)30 		static extern IntPtr gtk_spin_button_new_with_range (double min, double max, double step);
31 
SpinButton(double min, double max, double step)32 		public SpinButton (double min, double max, double step) : base (IntPtr.Zero)
33 		{
34 			if (GetType() != typeof (SpinButton)) {
35 				Adjustment adj = new Adjustment (min, min, max, step, 10 * step, 0);
36 				string[] names = new string [1];
37 				GLib.Value[] vals = new GLib.Value [1];
38 				names [0] = "adjustment";
39 				vals [0] = new GLib.Value (adj);
40 				CreateNativeObject (names, vals);
41 				vals [0].Dispose ();
42 				return;
43 			}
44 
45 			Raw = gtk_spin_button_new_with_range (min, max, step);
46 		}
47 	}
48 }
49