]> git.lyx.org Git - lyx.git/blob - src/frontends/gtk/ghelpers.h
Change glob() API to accept a dir parameter.
[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 "lengthcommon.h"
16
17 #include <gtkmm.h>
18
19 #include <string>
20 #include <vector>
21
22 class FuncRequest;
23
24 namespace lyx {
25 namespace frontend {
26
27 // Get a GTK stockID from a lyx function id.
28 // Return Gtk::Stock::MISSING_IMAGE if no suitable stock found
29 Gtk::BuiltinStockID getGTKStockIcon(FuncRequest const & func);
30
31 std::string const getDefaultUnit();
32
33 void unitsComboFromLength(Gtk::ComboBox * combo,
34                            Gtk::TreeModelColumn<Glib::ustring> const & stringcol,
35                            LyXLength const & len,
36                            std::string defunit);
37
38 std::vector<std::string> const buildLengthUnitList();
39
40 std::vector<std::string> const buildLengthNoRelUnitList();
41
42 /** name is the name of the glade file, without path or extension.
43  *  Eg, "aboutlyx", "tableCreate".
44  */
45 std::string const findGladeFile(std::string const & name);
46
47 template<class A>
48 typename std::vector<A>::size_type
49 findPos(std::vector<A> const & vec, A const & val)
50 {
51         typename std::vector<A>::const_iterator it =
52                 std::find(vec.begin(), vec.end(), val);
53         if (it == vec.end())
54                 return 0;
55         return std::distance(vec.begin(), it);
56 }
57
58 } // namespace frontend
59 } // namespace lyx
60
61 #endif // NOT GHELPERS_H