1 /*
2  * This file is part of EvinceD.
3  * EvinceD is based on GtkD.
4  *
5  * EvinceD is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU Lesser General Public License
7  * as published by the Free Software Foundation; either version 3
8  * of the License, or (at your option) any later version, with
9  * some exceptions, please read the COPYING file.
10  *
11  * EvinceD 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
14  * GNU Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with EvinceD; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
19  */
20 
21 // generated automatically - do not change
22 // find conversion definition on APILookup.txt
23 
24 
25 module evince.view.JobFind;
26 
27 private import evince.document.Document;
28 private import evince.view.Job;
29 private import evince.view.c.functions;
30 public  import evince.view.c.types;
31 private import glib.ConstructionException;
32 private import glib.ListG;
33 private import glib.Str;
34 private import gobject.ObjectG;
35 private import gobject.Signals;
36 private import std.algorithm;
37 
38 
39 /** */
40 public class JobFind : Job
41 {
42 	/** the main Gtk struct */
43 	protected EvJobFind* evJobFind;
44 
45 	/** Get the main Gtk struct */
46 	public EvJobFind* getJobFindStruct(bool transferOwnership = false)
47 	{
48 		if (transferOwnership)
49 			ownedRef = false;
50 		return evJobFind;
51 	}
52 
53 	/** the main Gtk struct as a void* */
54 	protected override void* getStruct()
55 	{
56 		return cast(void*)evJobFind;
57 	}
58 
59 	/**
60 	 * Sets our main struct and passes it to the parent class.
61 	 */
62 	public this (EvJobFind* evJobFind, bool ownedRef = false)
63 	{
64 		this.evJobFind = evJobFind;
65 		super(cast(EvJob*)evJobFind, ownedRef);
66 	}
67 
68 
69 	/** */
70 	public static GType getType()
71 	{
72 		return ev_job_find_get_type();
73 	}
74 
75 	/** */
76 	public this(Document document, int startPage, int nPages, string text, bool caseSensitive)
77 	{
78 		auto __p = ev_job_find_new((document is null) ? null : document.getDocumentStruct(), startPage, nPages, Str.toStringz(text), caseSensitive);
79 
80 		if(__p is null)
81 		{
82 			throw new ConstructionException("null returned by new");
83 		}
84 
85 		this(cast(EvJobFind*) __p, true);
86 	}
87 
88 	/** */
89 	public int getNResults(int pages)
90 	{
91 		return ev_job_find_get_n_results(evJobFind, pages);
92 	}
93 
94 	/**
95 	 * Returns: the job's find options
96 	 *
97 	 * Since: 3.6
98 	 */
99 	public EvFindOptions getOptions()
100 	{
101 		return ev_job_find_get_options(evJobFind);
102 	}
103 
104 	/** */
105 	public double getProgress()
106 	{
107 		return ev_job_find_get_progress(evJobFind);
108 	}
109 
110 	/**
111 	 * Returns: a #GList of #GList<!-- -->s containing #EvRectangle<!-- -->s
112 	 */
113 	public ListG getResults()
114 	{
115 		auto __p = ev_job_find_get_results(evJobFind);
116 
117 		if(__p is null)
118 		{
119 			return null;
120 		}
121 
122 		return new ListG(cast(GList*) __p);
123 	}
124 
125 	/** */
126 	public bool hasResults()
127 	{
128 		return ev_job_find_has_results(evJobFind) != 0;
129 	}
130 
131 	/** */
132 	public void setOptions(EvFindOptions options)
133 	{
134 		ev_job_find_set_options(evJobFind, options);
135 	}
136 
137 	/** */
138 	gulong addOnUpdated(void delegate(int, JobFind) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
139 	{
140 		return Signals.connect(this, "updated", dlg, connectFlags ^ ConnectFlags.SWAPPED);
141 	}
142 }