]> git.lyx.org Git - lyx.git/blob - src/frontends/gtk/ghelpers.h
Add ShowFile dialog
[lyx.git] / src / frontends / gtk / ghelpers.h
1 // -*- C++ -*-
2 /**
3  * \file ghelpers.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Angus Leeming
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #ifndef GHELPERS_H
13 #define GHELPERS_H
14
15 #include <string>
16 #include <vector>
17
18 namespace lyx {
19 namespace frontend {
20
21 /** name is the name of the glade file, without path or extension.
22  *  Eg, "aboutlyx", "tableCreate".
23  */
24 std::string const findGladeFile(std::string const & name);
25
26 template<class A>
27 typename std::vector<A>::size_type
28 findPos(std::vector<A> const & vec, A const & val)
29 {
30         typename std::vector<A>::const_iterator it =
31                 std::find(vec.begin(), vec.end(), val);
32         if (it == vec.end())
33                 return 0;
34         return std::distance(vec.begin(), it);
35 }
36
37 } // namespace frontend
38 } // namespace lyx
39
40 #endif // NOT GHELPERS_H