1 /*
2  * This file is part of gtkD.
3  *
4  * gtkD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 3
7  * of the License, or (at your option) any later version, with
8  * some exceptions, please read the COPYING file.
9  *
10  * gtkD is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with gtkD; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19  
20 // generated automatically - do not change
21 // find conversion definition on APILookup.txt
22 // implement new conversion functionalities on the wrap.utils pakage
23 
24 /*
25  * Conversion parameters:
26  * inFile  = gtkglext-gdkglinit.html
27  * outPack = glgdk
28  * outFile = GLdInit
29  * strct   = 
30  * realStrct=
31  * ctorStrct=
32  * clss    = GLdInit
33  * interf  = 
34  * class Code: No
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * prefixes:
40  * 	- gdk_gl_
41  * omit structs:
42  * omit prefixes:
43  * omit code:
44  * omit signals:
45  * imports:
46  * 	- glib.Str
47  * structWrap:
48  * module aliases:
49  * local aliases:
50  * overrides:
51  */
52 
53 module glgdk.GLdInit;
54 
55 public  import gtkglc.glgdktypes;
56 
57 private import gtkglc.glgdk;
58 private import glib.ConstructionException;
59 private import gobject.ObjectG;
60 
61 
62 private import glib.Str;
63 
64 
65 
66 
67 /**
68  * Description
69  */
70 public class GLdInit
71 {
72 	
73 	/**
74 	 */
75 	
76 	/**
77 	 * Call this function before using any other GdkGLExt functions in your
78 	 * applications. It will initialize everything needed to operate the library
79 	 * and parses some standard command line options. argc and
80 	 * argv are adjusted accordingly so your own code will
81 	 * never see those standard arguments.
82 	 * Note
83 	 * This function will terminate your program if it was unable to initialize
84 	 * the library for some reason. If you want your program to fall back to a
85 	 * textual interface you want to call gdk_gl_init_check() instead.
86 	 * Params:
87 	 * argv = Address of the argv parameter of
88 	 *  main(). Any parameters understood by
89 	 *  gdk_gl_init() are stripped before return.
90 	 */
91 	public static void init(ref string[] argv)
92 	{
93 		// void gdk_gl_init (int *argc,  char ***argv);
94 		char** outargv = Str.toStringzArray(argv);
95 		int argc = cast(int) argv.length;
96 		
97 		gdk_gl_init(&argc, &outargv);
98 		
99 		argv = null;
100 		foreach ( cstr; outargv[0 .. argc] )
101 		{
102 			argv ~= Str.toString(cstr);
103 		}
104 	}
105 	
106 	/**
107 	 * This function does the same work as gdk_gl_init() with only
108 	 * a single change: It does not terminate the program if the library can't be
109 	 * initialized. Instead it returns FALSE on failure.
110 	 * This way the application can fall back to some other means of communication
111 	 * with the user - for example a curses or command line interface.
112 	 * Params:
113 	 * argv = Address of the argv parameter of
114 	 *  main(). Any parameters understood by
115 	 *  gdk_gl_init() are stripped before return.
116 	 * Returns: TRUE if the GUI has been successfully initialized, FALSE otherwise.
117 	 */
118 	public static int initCheck(ref string[] argv)
119 	{
120 		// gboolean gdk_gl_init_check (int *argc,  char ***argv);
121 		char** outargv = Str.toStringzArray(argv);
122 		int argc = cast(int) argv.length;
123 		
124 		auto p = gdk_gl_init_check(&argc, &outargv);
125 		
126 		argv = null;
127 		foreach ( cstr; outargv[0 .. argc] )
128 		{
129 			argv ~= Str.toString(cstr);
130 		}
131 		return p;
132 	}
133 	
134 	/**
135 	 * Parses command line arguments, and initializes global
136 	 * attributes of GdkGLExt.
137 	 * Any arguments used by GdkGLExt are removed from the array and
138 	 * argc and argv are updated accordingly.
139 	 * You shouldn't call this function explicitely if you are using
140 	 * gdk_gl_init(), or gdk_gl_init_check().
141 	 * Params:
142 	 * argv = the array of command line arguments.
143 	 * Returns: TRUE if initialization succeeded, otherwise FALSE. <<PartII.GdkGLExt API Reference Query>>
144 	 */
145 	public static int parseArgs(ref string[] argv)
146 	{
147 		// gboolean gdk_gl_parse_args (int *argc,  char ***argv);
148 		char** outargv = Str.toStringzArray(argv);
149 		int argc = cast(int) argv.length;
150 		
151 		auto p = gdk_gl_parse_args(&argc, &outargv);
152 		
153 		argv = null;
154 		foreach ( cstr; outargv[0 .. argc] )
155 		{
156 			argv ~= Str.toString(cstr);
157 		}
158 		return p;
159 	}
160 }